class BlockDevice

Defined at line 44 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

|BlockDevice| represents a single SCSI direct access block device.

|BlockDevice| bridges between the Zircon block protocol and SCSI commands/responses.

Public Methods

void BlockDevice (Controller * controller, uint8_t target, uint16_t lun, DeviceOptions device_options)

Public so that we can use make_unique.

Clients should use BlockDevice::Bind().

Defined at line 49 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

void RemoveDevice ()

Remove this block device.

Defined at line 70 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

fbl::String LunName ()

Defined at line 85 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

zx::result<std::unique_ptr<BlockDevice>> Bind (Controller * controller, uint8_t target, uint16_t lun, uint32_t max_transfer_bytes, DeviceOptions device_options)

Create a BlockDevice at a specific target/lun.

|controller| is a pointer to the scsi::Controller this BlockDevice is attached to.

|controller| must outlast BlockDevice.

This BlockDevice does not take ownership of or any references on |controller|.

A |max_transfer_bytes| value of fuchsia_storage_block::wire::kMaxTransferUnbounded implies

there is no limit on the transfer size.

Returns a BlockDevice* to allow for removal of removable media disks.

Defined at line 93 of file ../../src/devices/block/lib/scsi/block-device.cc

void ~BlockDevice ()

Defined at line 75 of file ../../src/devices/block/lib/scsi/block-device.cc

void ShutdownAsync (fit::callback<void ()> callback)

Asynchronously shut down the block server, invoking `callback` upon completion.

This must be called before the `BlockDevice` is deleted.

Defined at line 80 of file ../../src/devices/block/lib/scsi/block-device.cc

fbl::String DeviceName ()

Defined at line 82 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

uint8_t target ()

Defined at line 94 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

uint16_t lun ()

Defined at line 95 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

bool removable ()

Defined at line 97 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

bool dpo_fua_available ()

Defined at line 98 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

bool write_protected ()

Defined at line 99 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

bool write_cache_enabled ()

Defined at line 100 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

uint64_t block_count ()

Defined at line 101 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

uint32_t block_size_bytes ()

Defined at line 102 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

uint32_t max_transfer_bytes ()

Defined at line 103 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

void BlockDevice (const BlockDevice & )

Defined at line 105 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

BlockDevice & operator= (const BlockDevice & )

Defined at line 106 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

DeviceOptions & GetDeviceOptions ()

for test

Defined at line 109 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

std::optional<block_server::BlockServer> & block_server ()

Exposed for testing

Defined at line 112 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

std::unique_ptr<BlockDevice> CreateForTesting (Controller * controller, uint8_t target, uint16_t lun, DeviceOptions device_options, uint64_t block_count, uint32_t block_size_bytes)

Defined at line 113 of file ../../src/devices/block/lib/scsi/include/lib/scsi/block-device.h

void OnRequests (std::span<block_server::Request> requests)

block_server::DriverInterface implementation

Defined at line 330 of file ../../src/devices/block/lib/scsi/block-device.cc

fdf::Logger & logger ()

Defined at line 473 of file ../../src/devices/block/lib/scsi/block-device.cc

void Get (GetCompleter::Sync & completer)

fuchsia_driver_token::NodeToken implementation

Defined at line 464 of file ../../src/devices/block/lib/scsi/block-device.cc