The main control structure for the version 3 SCSI generic driver has
a struct tag name of "sg_io_hdr" and a typedef name of "sg_io_hdr_t".
The structure is shown in abridged form below. The "[i]" notation
indicates an input value while "[o]" indicates a value that is output.
The "[i->o]" indicates a value that is conveyed from input to output and
apart from one special case, is not used by the driver. The "[i->o]" members
are meant to aid an application matching the request sent to a write()
to the corresponding response received by a read(). For pointers the
"[*i]" indicates a pointer that is used for reading from user memory into
the driver, "[*o]" is a pointer used for writing, and "[*io]" indicates
a pointer used for either reading or writing.
typedef struct sg_io_hdr
{
int interface_id; /* [i] 'S' (required) */
int dxfer_direction; /* [i] */
unsigned char cmd_len; /* [i] */
unsigned char mx_sb_len; /* [i] */
unsigned short iovec_count; /* [i] */
unsigned int dxfer_len; /* [i] */
void * dxferp; /* [i], [*io] */
unsigned char * cmdp; /* [i], [*i] */
unsigned char * sbp; /* [i], [*o] */
unsigned int timeout; /* [i] unit: millisecs */
unsigned int flags; /* [i] */
int pack_id; /* [i->o] */
void * usr_ptr; /* [i->o] */
unsigned char status; /* [o] */
unsigned char masked_status;/* [o] */
unsigned char msg_status; /* [o] */
unsigned char sb_len_wr; /* [o] */
unsigned short host_status; /* [o] */
unsigned short driver_status;/* [o] */
int resid; /* [o] */
unsigned int duration; /* [o] */
unsigned int info; /* [o] */
} sg_io_hdr_t; /* 64 bytes long (on i386) */ |