class FakeBlockDevice
Defined at line 33 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
A fake device implementing (most of) the BlockDevice interface on top of an in-memory VMO
representing the device. This allows clients of the BlockDevice interface to test against this
fake in-process instead of relying on a real block device.
This device also supports pausing processing FIFO transactions to allow tests to emulate slow
devices or validate behavior in intermediate states.
This class is thread-safe.
This class is not movable or copyable.
Public Methods
void FakeBlockDevice (const Config & )
Defined at line 19 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
zx::result<zx::vmo> VmoChildReference ()
Returns a VMO child reference of the block device.
Defined at line 31 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
void Pause ()
When paused, this device will make FIFO operations block until Resume() is called. The device
is in the Resume() state by default.
Defined at line 41 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
void FakeBlockDevice (uint64_t block_count, uint32_t block_size)
Defined at line 42 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
void FakeBlockDevice (const FakeBlockDevice & )
Defined at line 44 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
FakeBlockDevice & operator= (const FakeBlockDevice & )
Defined at line 45 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
void FakeBlockDevice (FakeBlockDevice && other)
Defined at line 46 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
void Resume ()
Defined at line 46 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
FakeBlockDevice & operator= (FakeBlockDevice && other)
Defined at line 47 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
void ~FakeBlockDevice ()
Defined at line 49 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
void SetWriteBlockLimit (uint64_t limit)
Sets the number of blocks which may be written to the block device. Once |limit| is reached,
all following operations will return ZX_ERR_IO.
May be "std::nullopt" to allow an unlimited count of blocks.
Defined at line 52 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
void ResetWriteBlockLimit ()
Turns off the "write block limit".
Defined at line 57 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
void set_hook (Hook hook)
Defined at line 62 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
uint64_t GetWriteBlockCount ()
Defined at line 62 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
void ResetBlockCounts ()
Defined at line 67 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
void SetInfoFlags (fuchsia_storage_block::wire::DeviceFlag flags)
Defined at line 72 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
void SetBlockCount (uint64_t block_count)
Defined at line 77 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
void SetBlockSize (uint32_t block_size)
Defined at line 83 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
zx::result<std::string> GetTopologicalPath ()
Defined at line 88 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
bool IsRegistered (vmoid_t vmoid)
Defined at line 89 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
zx::result<> Rebind (std::string_view url_suffix)
Defined at line 92 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
zx_status_t VolumeGetInfo (fuchsia_storage_block::wire::VolumeManagerInfo * out_manager_info, fuchsia_storage_block::wire::VolumeInfo * out_volume_info)
Defined at line 96 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
zx_status_t VolumeQuerySlices (const uint64_t * slices, size_t slices_count, fuchsia_storage_block::wire::VsliceRange * out_ranges, size_t * out_ranges_count)
Defined at line 102 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
zx_status_t VolumeExtend (uint64_t offset, uint64_t length)
Defined at line 108 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
zx_status_t VolumeShrink (uint64_t offset, uint64_t length)
Defined at line 112 of file ../../src/storage/lib/block_client/cpp/fake_block_device.h
void Wipe ()
Wipes the device to a zeroed state.
Defined at line 210 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
zx_status_t FifoTransaction (BlockFifoRequest * requests, size_t count)
Defined at line 107 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
zx_status_t BlockGetInfo (fuchsia_storage_block::wire::BlockInfo * out_info)
Defined at line 201 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
zx_status_t BlockAttachVmo (const zx::vmo & vmo, storage::Vmoid * out_vmoid)
Defined at line 216 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc
Protected Methods
void ResizeDeviceToAtLeast (uint64_t new_size)
Resizes the block device to be at least |new_size| bytes.
Defined at line 94 of file ../../src/storage/lib/block_client/cpp/fake_block_device.cc