template <typename Meta>

class StoredVmo

Defined at line 50 of file ../../src/lib/vmo_store/stored_vmo.h

A VMO stored in a `VmoStore`.

A `StoredVmo` may have optional `Meta` user metadata associated with it.

Public Methods

template <typename = std::enable_if<std::is_void<Meta>::value>>
void StoredVmo<Meta> (zx::vmo vmo)

Defined at line 53 of file ../../src/lib/vmo_store/stored_vmo.h

template <typename M = Meta, typename = std::enable_if<!std::is_void<Meta>::value>>
void StoredVmo<Meta> (zx::vmo vmo, M meta)

Defined at line 56 of file ../../src/lib/vmo_store/stored_vmo.h

template <typename M = Meta, typename = std::enable_if<!std::is_void<Meta>::value>>
M & meta ()

Defined at line 59 of file ../../src/lib/vmo_store/stored_vmo.h

zx_status_t Map (zx_vm_option_t options, fbl::RefPtr<fzl::VmarManager> manager)

Maps the entire VMO to virtual memory with `options`.

If `manager` is not provided, the root VMAR is used.

Returns `ZX_ERR_ALREADY_BOUND` if the VMO is already mapped.

For other possible errors, see `fzl::VmoMapper::Map`.

Defined at line 69 of file ../../src/lib/vmo_store/stored_vmo.h

zx_status_t Pin (const zx::bti & bti, uint32_t options, bool index)

Pins the VMO using `bti`.

`options` is one or more in the set ZX_BTI_PERM_READ | ZX_BTI_PERM_WRITE | ZX_BTI_CONTIGUOUS.

If `index` is true, enables fast indexing of regions to be fetched through `GetPinnedRegions`.

Returns `ZX_ERR_ALREADY_BOUND` if the VMO is already pinned.

For other possible errors, see `fzl::PinnedVmo::Pin`.

Defined at line 83 of file ../../src/lib/vmo_store/stored_vmo.h

cpp20::span<uint8_t> data ()

Accesses mapped VMO data.

An empty span is returned if the VMO was not mapped to virtual memory.

Defined at line 111 of file ../../src/lib/vmo_store/stored_vmo.h

zx::unowned_vmo vmo ()

Get an unowned handle to the VMO.

Defined at line 116 of file ../../src/lib/vmo_store/stored_vmo.h

const fzl::PinnedVmo & pinned_vmo ()

Accessor for pinned VMO regions.

Defined at line 119 of file ../../src/lib/vmo_store/stored_vmo.h

zx_status_t GetPinnedRegions (uint64_t offset, uint64_t len, fzl::PinnedVmo::Region * out_regions, size_t region_count, size_t * region_count_actual)

Gets the pinned regions from the VMO at `offset` with `len` bytes.

`out_regions` is filled with `Region`s matching the provided range up to `region_count`

entries.

`region_count_actual` contains the number of regions in `out_regions` on success.

Returns `ZX_ERR_BAD_STATE` if the VMO is not pinned, or region indexing was not enabled during

pinning.

Returns `ZX_ERR_OUT_RANGE` if the requested range does not fit within the pinned VMO.

Returns `ZX_ERR_BUFFER_TOO_SMALL` if all the necessary regions to cover the requested range

won't fit the provided buffer. In this case, `region_count_actual` contains the necessary

number of regions to fulfill the range and `out_regions` is filled up to `region_count`.

Calling with `out_regions == nullptr` and `region_count = 0` is a valid pattern to query the

amount of regions required.

Note that there are no alignment requirements on `offset` or `len`, the physical addresses kept

by the `VmoPinner` are just incremented by `offset`, callers must ensure alignment as

appropriate for the intended use of the pinned regions.

Defined at line 140 of file ../../src/lib/vmo_store/stored_vmo.h

void StoredVmo<Meta> (StoredVmo<Meta> && other)

Defined at line 214 of file ../../src/lib/vmo_store/stored_vmo.h

StoredVmo<Meta> & operator= (StoredVmo<Meta> && other)

Defined at line 215 of file ../../src/lib/vmo_store/stored_vmo.h

void StoredVmo<Meta> (const StoredVmo<Meta> & )

Defined at line 217 of file ../../src/lib/vmo_store/stored_vmo.h

StoredVmo<Meta> & operator= (const StoredVmo<Meta> & )

Defined at line 217 of file ../../src/lib/vmo_store/stored_vmo.h

Protected Methods

void set_owner_cookie (void * owner_cookie)

Defined at line 225 of file ../../src/lib/vmo_store/stored_vmo.h

void * owner_cookie ()

Defined at line 226 of file ../../src/lib/vmo_store/stored_vmo.h

zx::vmo take_vmo ()

Defined at line 228 of file ../../src/lib/vmo_store/stored_vmo.h

Friends

template <typename Backing>
class VmoStore
template <typename Meta>
class VmoOwner