pw_memblock Class Reference

Memory block structure. More...

## Public Types

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

## Public Member Functions

SPA_EXPORT int | pw_memblock_map (struct pw_memblock *mem)
| Map a memblock. More...
SPA_EXPORT int | pw_memblock_alloc (enum pw_memblock_flags flags, size_t size, struct pw_memblock **mem)
| Create a new memblock. More...
SPA_EXPORT 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

enum pw_memblock_flags

Flags passed to pw_memblock_alloc()

## Member Function Documentation

## pw_memblock_alloc()

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

Create a new memblock.

Parameters

  | flags | memblock flags
  | size | size to allocate
  [out] | mem | memblock 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_MEMBLOCK_FLAG_MAP_TWICE, PW_MEMBLOCK_FLAG_SEAL, PW_MEMBLOCK_FLAG_WITH_FD, pw_memblock_map(), and size.

## pw_memblock_free()

SPA_EXPORT void pw_memblock_free | ( | struct pw_memblock * | mem | ) |

Free a memblock.

Parameters

  mem | a memblock

References fd, flags, memblock::link, ptr, PW_MEMBLOCK_FLAG_WITH_FD, and size.

## pw_memblock_map()

SPA_EXPORT int pw_memblock_map | ( | struct pw_memblock * | mem | ) |

Map a memblock.

Parameters

  mem | a memblock

Returns
  0 on success, < 0 on error

References fd, flags, offset, ptr, PW_MEMBLOCK_FLAG_MAP_READ, PW_MEMBLOCK_FLAG_MAP_READWRITE, PW_MEMBLOCK_FLAG_MAP_TWICE, PW_MEMBLOCK_FLAG_MAP_WRITE, and size.

## Field Documentation

## fd

int pw_memblock::fd

memfd if any

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

## 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

size of mapped memory

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

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

- mem.h
- mem.c