Expand description
Virtio-blk device driver
Implements a block device driver for virtio-blk PCI devices as described in the virtio specification, section 5.2. Supports read and write operations using the legacy (transitional) PCI transport.
§Virtio-blk request format
Each request is a three-descriptor chain:
- Header (device-readable):
VirtioBlkReqHeaderwith request type + sector - Data (device-readable for write, device-writable for read): sector data
- Status (device-writable): single byte result (0 = OK, 1 = IOERR, 2 = UNSUPP)
§QEMU usage
-drive file=disk.img,if=none,id=vd0,format=raw -device virtio-blk-pci,drive=vd0Modules§
- features
- Virtio-blk feature bits (virtio spec 5.2.3)
Structs§
- Virtio
BlkDevice - Virtio block device.
Constants§
- BLOCK_
SIZE - Block size in bytes (standard sector)
Traits§
- Block
Device - Block device trait for generic block I/O operations.
Functions§
- get_
device - Get a reference to the global virtio-blk device, if initialized.
- init
- Probe PCI bus for virtio-blk devices and initialize the first one found.
- is_
initialized - Check if a virtio-blk device has been initialized.