class BlockDevices
Defined at line 60 of file ../../src/firmware/paver/block-devices.h
An abstraction for accessing block devices, either via devfs or
fuchsia.storage.partitions.PartitionService.
Public Methods
void BlockDevices (BlockDevices && )
Defined at line 82 of file ../../src/firmware/paver/block-devices.h
BlockDevices & operator= (BlockDevices && )
Defined at line 83 of file ../../src/firmware/paver/block-devices.h
void BlockDevices (const BlockDevices & )
Defined at line 85 of file ../../src/firmware/paver/block-devices.h
BlockDevices & operator= (const BlockDevices & )
Defined at line 86 of file ../../src/firmware/paver/block-devices.h
zx::result<BlockDevices> CreateFromFshostBlockDir (fbl::unique_fd block_dir)
Creates an instance that searches for devices from fshost's /block.
Note that fshost will forward GPT-managed partitions as instances of the PartitionService
instead; see CreateFromPartitionService. Only non-GPT devices will be published here.
`block_dir` can be injected for testing. If unspecified, /block will be opened.
Defined at line 91 of file ../../src/firmware/paver/block-devices.cc
zx::result<BlockDevices> CreateFromPartitionService (fidl::UnownedClientEnd<fuchsia_io::Directory> svc_root)
Creates an instance that searches for GPT-managed devices as instances of PartitionService.
`svc_root` should contain the `fuchsia.storage.partitions.PartitionService` service.
Defined at line 104 of file ../../src/firmware/paver/block-devices.cc
zx::result<BlockDevices> CreateFromSkipBlockService (fidl::UnownedClientEnd<fuchsia_io::Directory> svc_root)
Creates an instance that searches for skip-block devices as instances of
fuchsia.hardware.skipblock.Service. `svc_root` should contain this service.
Defined at line 127 of file ../../src/firmware/paver/block-devices.cc
BlockDevices CreateEmpty ()
Creates an empty BlockDevices instance which never yields any partitions. Useful for tests
which need a valid instance but don't actually use it.
Defined at line 150 of file ../../src/firmware/paver/block-devices.cc
BlockDevices Duplicate ()
Duplicates the underlying connection to create a new BlockDevices.
Separate from the copy constructors (which are deleted) to avoid unintentional expensive
operations.
Defined at line 152 of file ../../src/firmware/paver/block-devices.cc
zx::result<std::vector<std::unique_ptr<VolumeConnector>>> OpenAllPartitions (fit::function<bool (const zx::channel &)> filter)
Returns a connector for every partition that matches the filter. A channel connected to the
fuchsia.hardware.block.partition.Partition service of the block device is provided to `filter`.
Defined at line 154 of file ../../src/firmware/paver/block-devices.cc
zx::result<std::unique_ptr<VolumeConnector>> OpenPartition (fit::function<bool (const zx::channel &)> filter)
Returns a connector for the first partition that matches the filter. A channel connected to
the fuchsia.hardware.block.partition.Partition service of the block device is provided to
`filter`.
Defined at line 159 of file ../../src/firmware/paver/block-devices.cc
zx::result<std::unique_ptr<VolumeConnector>> WaitForPartition (fit::function<bool (const zx::channel &)> filter, zx_duration_t timeout)
Like `OpenPartition`, but will wait for newly added partitions (at least until `timeout`).
Defined at line 240 of file ../../src/firmware/paver/block-devices.cc