|
USBIP C library 0.7.0
Virtual USB devices & host drivers over USB/IP
|
Mass-storage configuration: a block-storage backend + presentation options. More...
#include <classes/msc.h>
Collaboration diagram for msc_opts:Data Fields | |
| uint32_t(* | num_blocks )(void *user) |
| Report the medium's capacity, in blocks. | |
| uint32_t(* | block_size )(void *user) |
| Report the block size in bytes (commonly 512). | |
| int(* | read )(void *user, uint32_t lba, uint32_t count, uint8_t *buf) |
Read count blocks starting at logical block lba. | |
| int(* | write )(void *user, uint32_t lba, uint32_t count, const uint8_t *buf) |
Write count blocks starting at logical block lba. | |
| int | n_luns |
Logical units this interface carries: entries used in luns. | |
| msc_lun | luns [MSC_MAX_LUNS] |
The units, when n_luns says there are several. | |
| int | read_only |
| Present a write-protected medium (every unit) | |
| int | medium |
| What the medium is: one of MSC_MEDIUM_DISK (the default), MSC_MEDIUM_CDROM or MSC_MEDIUM_FLOPPY. | |
| int | ufi |
| Declare the UFI command set (bInterfaceSubClass 0x04, SFF-8070i) instead of SCSI transparent (0x06) - the subclass a real USB floppy drive reports, and what makes Windows show the drive as a floppy rather than a removable disk. | |
| const char * | vendor |
| INQUIRY strings (may be NULL). | |
| const char * | product |
| const char * | revision |
| const char * | serial |
Serial number returned by INQUIRY EVPD page 0x80, which Windows asks every removable device for (may be NULL for a default). | |
| void(* | on_command )(void *user, const char *text) |
Human-readable log hook, called with a description of each SCSI command handled (may be NULL). | |
| const char * | name |
| Optional iInterface name for this disk, e.g. | |
| void * | user |
Opaque pointer passed to on_command - and, on a single-unit disk, to the block callbacks above. | |
Mass-storage configuration: a block-storage backend + presentation options.
The backend addresses the medium in fixed-size blocks. With one logical unit - the default - every callback receives the opaque user pointer below; with several (see luns) they receive that unit's msc_lun::user instead, and user is left to on_command.
| uint32_t(* msc_opts::num_blocks) (void *user) |
Report the medium's capacity, in blocks.
| user | the unit's backend context. |
| uint32_t(* msc_opts::block_size) (void *user) |
Report the block size in bytes (commonly 512).
| user | the unit's backend context. |
| int(* msc_opts::read) (void *user, uint32_t lba, uint32_t count, uint8_t *buf) |
Read count blocks starting at logical block lba.
| user | the unit's backend context. |
| lba | first logical block address. |
| count | number of blocks to read. |
| buf | destination, count × block_size() bytes. |
| int(* msc_opts::write) (void *user, uint32_t lba, uint32_t count, const uint8_t *buf) |
Write count blocks starting at logical block lba.
| user | the unit's backend context. |
| lba | first logical block address. |
| count | number of blocks to write. |
| buf | source, count × block_size() bytes. |
| int msc_opts::n_luns |
Logical units this interface carries: entries used in luns.
Zero - the usual case - means one unit, backed by user, described by the fields below; anything above MSC_MAX_LUNS is refused by msc_add().
| msc_lun msc_opts::luns[MSC_MAX_LUNS] |
The units, when n_luns says there are several.
| int msc_opts::read_only |
Present a write-protected medium (every unit)
| int msc_opts::medium |
What the medium is: one of MSC_MEDIUM_DISK (the default), MSC_MEDIUM_CDROM or MSC_MEDIUM_FLOPPY.
A CD-ROM is always read-only; a floppy answers MODE SENSE page 0x05 with the geometry of the standard format its capacity matches. Overridden per unit by msc_lun::medium
| int msc_opts::ufi |
Declare the UFI command set (bInterfaceSubClass 0x04, SFF-8070i) instead of SCSI transparent (0x06) - the subclass a real USB floppy drive reports, and what makes Windows show the drive as a floppy rather than a removable disk.
The transport stays Bulk-Only (bInterfaceProtocol 0x50); UFI-over-CBI is not offered. Intended for MSC_MEDIUM_FLOPPY, but not restricted to it. The UFI commands themselves (FORMAT UNIT, READ(12)/WRITE(12), VERIFY, SEEK, REZERO UNIT) are answered whatever the subclass, as they are legal SCSI too.
| const char* msc_opts::vendor |
INQUIRY strings (may be NULL).
The vendor and revision are the device's; the product id is overridden per unit by msc_lun::product.
| const char * msc_opts::product |
| const char * msc_opts::revision |
| const char* msc_opts::serial |
Serial number returned by INQUIRY EVPD page 0x80, which Windows asks every removable device for (may be NULL for a default).
Truncated past 20 chars. Overridden per unit by msc_lun::serial.
| void(* msc_opts::on_command) (void *user, const char *text) |
Human-readable log hook, called with a description of each SCSI command handled (may be NULL).
On a multi-unit disk each line names its unit.
| user | the user pointer. |
| text | a NUL-terminated description. |
| const char* msc_opts::name |
Optional iInterface name for this disk, e.g.
"Storage" - shown by the host (Linux: /sys/bus/usb/devices/.../interface; Windows: the device name).
| void* msc_opts::user |
Opaque pointer passed to on_command - and, on a single-unit disk, to the block callbacks above.
With n_luns set, each unit brings its own msc_lun::user for those instead.