class BlockDevices

Defined at line 81 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 108 of file ../../src/firmware/paver/block-devices.h

BlockDevices & operator= (BlockDevices && )

Defined at line 109 of file ../../src/firmware/paver/block-devices.h

void BlockDevices (const BlockDevices & )

Defined at line 111 of file ../../src/firmware/paver/block-devices.h

BlockDevices & operator= (const BlockDevices & )

Defined at line 112 of file ../../src/firmware/paver/block-devices.h

const fbl::unique_fd & devfs_root ()

Defined at line 119 of file ../../src/firmware/paver/block-devices.h

zx::result<BlockDevices> CreateDevfs (fbl::unique_fd devfs_root)

Creates an instance that searches for devices in Devfs.

`devfs_root` can be injected for testing. If unspecified, the devfs root will be connected to

/dev.

Defined at line 146 of file ../../src/firmware/paver/block-devices.cc

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 158 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 171 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 194 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 217 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 219 of file ../../src/firmware/paver/block-devices.cc

bool IsStorageHost ()

Defined at line 221 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 223 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 228 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, const char * devfs_suffix)

Like `OpenPartition`, but will wait for newly added partitions (at least until `timeout`).

Defined at line 320 of file ../../src/firmware/paver/block-devices.cc