class OffsetMap

Defined at line 38 of file ../../src/devices/block/drivers/core/server.h

Remaps the dev_offset of block requests based on an internal map.

Public Methods

zx::result<std::unique_ptr<OffsetMap>> Create (std::span<const fuchsia_storage_block::wire::BlockOffsetMapping> mappings, uint64_t block_count)

Creates an OffsetMap from one or more mappings. `block_count` is the total size of the device,

used to bounds-check the mappings.

Defined at line 63 of file ../../src/devices/block/drivers/core/server.cc

bool AdjustRequest (BlockFifoRequest & request)

Adjusts `request` by applying the map to dev_offset.

Returns false if the request would exceed the range known to OffsetMap.

Defined at line 125 of file ../../src/devices/block/drivers/core/server.cc

zx::result<std::pair<uint64_t, uint32_t>> Map (uint64_t logical_offset, uint32_t length)

Maps logical_offset to physical device offset and max remaining contiguous length (up to

length).

Returns zx::error(ZX_ERR_OUT_OF_RANGE) if logical_offset is not within any mapping.

Defined at line 102 of file ../../src/devices/block/drivers/core/server.cc