PipeWire  0.2.0
pw_memblock Class Reference

Memory block structure. More...

Public Types

enum  pw_memblock_flags
 Flags passed to pw_memblock_alloc() More...
 

Public Member Functions

int pw_memblock_map (struct pw_memblock *mem)
 Map a memblock. More...
 
int pw_memblock_alloc (enum pw_memblock_flags flags, size_t size, struct pw_memblock **mem)
 Create a new memblock. More...
 
void pw_memblock_free (struct pw_memblock *mem)
 Free a memblock. More...
 

Data Fields

enum pw_memblock_flags flags
 flags used when allocating More...
 
int fd
 memfd if any More...
 
off_t offset
 offset of mappable memory More...
 
void * ptr
 ptr to mapped memory More...
 
size_t size
 size of mapped memory More...
 

Detailed Description

Memory block structure.

Member Enumeration Documentation

◆ pw_memblock_flags

Flags passed to pw_memblock_alloc()

Member Function Documentation

◆ pw_memblock_alloc()

int pw_memblock_alloc ( enum pw_memblock_flags  flags,
size_t  size,
struct pw_memblock **  mem 
)

Create a new memblock.

Parameters
flagsmemblock flags
sizesize to allocate
[out]memmemblock structure to fill
Returns
0 on success, < 0 on error

References F_ADD_SEALS, F_SEAL_GROW, F_SEAL_SEAL, F_SEAL_SHRINK, fd, flags, memblock::mem, MFD_ALLOW_SEALING, MFD_CLOEXEC, offset, ptr, pw_log::pw_log_error(), pw_log::pw_log_warn(), PW_MEMBLOCK_FLAG_MAP_TWICE, PW_MEMBLOCK_FLAG_SEAL, PW_MEMBLOCK_FLAG_WITH_FD, pw_memblock_map(), and size.

Referenced by pw_control_link(), and pw_memblock_import().

◆ pw_memblock_free()

void pw_memblock_free ( struct pw_memblock mem)

Free a memblock.

Parameters
mema memblock

References fd, flags, memblock::link, memblock::mem, ptr, pw_log::pw_log_debug(), PW_MEMBLOCK_FLAG_WITH_FD, and size.

Referenced by pw_control_destroy().

◆ pw_memblock_map()

int pw_memblock_map ( struct pw_memblock mem)

Map a memblock.

Parameters
mema memblock
Returns
0 on success, < 0 on error

References fd, flags, offset, ptr, pw_log::pw_log_debug(), PW_MEMBLOCK_FLAG_MAP_READ, PW_MEMBLOCK_FLAG_MAP_READWRITE, PW_MEMBLOCK_FLAG_MAP_TWICE, PW_MEMBLOCK_FLAG_MAP_WRITE, and size.

Referenced by pw_memblock_alloc(), and pw_memblock_import().

Field Documentation

◆ fd

int pw_memblock::fd

◆ flags

enum pw_memblock_flags pw_memblock::flags

flags used when allocating

Referenced by pw_memblock_alloc(), pw_memblock_free(), pw_memblock_import(), and pw_memblock_map().

◆ offset

off_t pw_memblock::offset

offset of mappable memory

Referenced by pw_memblock_alloc(), pw_memblock_import(), and pw_memblock_map().

◆ ptr

void* pw_memblock::ptr

ptr to mapped memory

Referenced by pw_control_link(), pw_memblock_alloc(), pw_memblock_free(), and pw_memblock_map().

◆ size

size_t pw_memblock::size

The documentation for this class was generated from the following files: