USBIP C library 0.7.0
Virtual USB devices & host drivers over USB/IP
Loading...
Searching...
No Matches
MSC - Mass storage (SCSI/BOT)
+ Collaboration diagram for MSC - Mass storage (SCSI/BOT):

Files

file  msc.h
 USB Mass Storage (Bulk-Only Transport + SCSI) device class, app API.
 

Data Structures

struct  msc_disk
 One mass-storage function: a single instance of the class on a device. More...
 
struct  msc_lun
 One logical unit: a backend context, plus what this unit alone presents itself as. More...
 
struct  msc_opts
 Mass-storage configuration: a block-storage backend + presentation options. More...
 

Macros

#define MSC_MAX_LUNS
 Most logical units one mass-storage interface can carry.
 

Functions

msc_diskmsc_add (usbip_device *dev, const msc_opts *opts)
 Add a mass-storage function to a device: one interface carrying one logical unit, or msc_opts::n_luns of them.
 
uint64_t msc_floppy_format_size (int format)
 Byte size of a standard floppy format, for sizing the backing image.
 

Variables

const usbip_device_class usbip_device_msc
 The mass-storage class, for usbip_device_add_class()
 

Medium type

What the disk presents itself as, set in msc_opts::medium.

The default (0) is a plain removable disk, so a zero-initialised msc_opts needs no medium field.

#define MSC_MEDIUM_DISK
 Removable direct-access disk (SCSI type 0x00)
 
#define MSC_MEDIUM_CDROM
 Read-only CD-ROM (SCSI type 0x05), MMC commands answered.
 
#define MSC_MEDIUM_FLOPPY
 Floppy: direct-access with a Flexible Disk geometry page.
 

Floppy format

The standard formats a MSC_MEDIUM_FLOPPY disk can be, passed to msc_floppy_format_size().

All of them are 512 bytes per sector.

#define MSC_FLOPPY_2_88M
 2.88 MB - 80 cylinders, 2 heads, 36 sectors
 
#define MSC_FLOPPY_1_44M
 1.44 MB - 80 cylinders, 2 heads, 18 sectors
 
#define MSC_FLOPPY_1_2M
 1.2 MB - 80 cylinders, 2 heads, 15 sectors
 
#define MSC_FLOPPY_720K
 720 KB - 80 cylinders, 2 heads, 9 sectors
 
#define MSC_FLOPPY_360K
 360 KB - 40 cylinders, 2 heads, 9 sectors
 

Detailed Description

Macro Definition Documentation

◆ MSC_MAX_LUNS

#define MSC_MAX_LUNS

Most logical units one mass-storage interface can carry.

The Bulk-Only Transport addresses a unit with the four-bit bCBWLUN field of the CBW, so sixteen is the transport's own ceiling, not a chosen one.

◆ MSC_MEDIUM_DISK

#define MSC_MEDIUM_DISK

Removable direct-access disk (SCSI type 0x00)

◆ MSC_MEDIUM_CDROM

#define MSC_MEDIUM_CDROM

Read-only CD-ROM (SCSI type 0x05), MMC commands answered.

◆ MSC_MEDIUM_FLOPPY

#define MSC_MEDIUM_FLOPPY

Floppy: direct-access with a Flexible Disk geometry page.

◆ MSC_FLOPPY_2_88M

#define MSC_FLOPPY_2_88M

2.88 MB - 80 cylinders, 2 heads, 36 sectors

◆ MSC_FLOPPY_1_44M

#define MSC_FLOPPY_1_44M

1.44 MB - 80 cylinders, 2 heads, 18 sectors

◆ MSC_FLOPPY_1_2M

#define MSC_FLOPPY_1_2M

1.2 MB - 80 cylinders, 2 heads, 15 sectors

◆ MSC_FLOPPY_720K

#define MSC_FLOPPY_720K

720 KB - 80 cylinders, 2 heads, 9 sectors

◆ MSC_FLOPPY_360K

#define MSC_FLOPPY_360K

360 KB - 40 cylinders, 2 heads, 9 sectors

Function Documentation

◆ msc_add()

msc_disk * msc_add ( usbip_device dev,
const msc_opts opts 
)

Add a mass-storage function to a device: one interface carrying one logical unit, or msc_opts::n_luns of them.

Parameters
devthe device.
optsthe block-storage backend and presentation options (see msc_opts).
Returns
the disk handle, or NULL on error.

◆ msc_floppy_format_size()

uint64_t msc_floppy_format_size ( int  format)

Byte size of a standard floppy format, for sizing the backing image.

A MSC_MEDIUM_FLOPPY disk takes its geometry from the capacity it is given, so an app that wants a real floppy sizes its image with this. A capacity matching none of the formats still works - the class reports the true block count with 1.44M's head/sector layout - but no host will call it a standard floppy.

Parameters
formatone of the MSC_FLOPPY_* codes.
Returns
the size in bytes, or 0 if format is not one of them.

Variable Documentation

◆ usbip_device_msc

const usbip_device_class usbip_device_msc
extern

The mass-storage class, for usbip_device_add_class()