old-www/HOWTO/SCSI-Generic-HOWTO/sg_io_hdr_t.html

305 lines
4.8 KiB
HTML

<HTML
><HEAD
><TITLE
>The sg_io_hdr_t structure in detail</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="HOME"
TITLE="The Linux SCSI Generic (sg) HOWTO"
HREF="index.html"><LINK
REL="PREVIOUS"
TITLE="Theory of operation"
HREF="theory.html"><LINK
REL="NEXT"
TITLE="interface_id"
HREF="x163.html"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>The Linux SCSI Generic (sg) HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="theory.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x163.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="SG_IO_HDR_T">Chapter 6. The sg_io_hdr_t structure in detail</H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
>6.1. <A
HREF="x163.html"
>interface_id</A
></DT
><DT
>6.2. <A
HREF="x166.html"
>dxfer_direction</A
></DT
><DT
>6.3. <A
HREF="x184.html"
>cmd_len</A
></DT
><DT
>6.4. <A
HREF="x189.html"
>mx_sb_len</A
></DT
><DT
>6.5. <A
HREF="x192.html"
>iovec_count</A
></DT
><DT
>6.6. <A
HREF="x198.html"
>dxfer_len</A
></DT
><DT
>6.7. <A
HREF="x204.html"
>dxferp</A
></DT
><DT
>6.8. <A
HREF="x209.html"
>cmdp</A
></DT
><DT
>6.9. <A
HREF="x212.html"
>sbp</A
></DT
><DT
>6.10. <A
HREF="x215.html"
>timeout</A
></DT
><DT
>6.11. <A
HREF="x233.html"
>flags</A
></DT
><DT
>6.12. <A
HREF="x249.html"
>pack_id</A
></DT
><DT
>6.13. <A
HREF="x252.html"
>usr_ptr</A
></DT
><DT
>6.14. <A
HREF="x255.html"
>status</A
></DT
><DT
>6.15. <A
HREF="x260.html"
>masked_status</A
></DT
><DT
>6.16. <A
HREF="x285.html"
>msg_status</A
></DT
><DT
>6.17. <A
HREF="x288.html"
>sb_len_wr</A
></DT
><DT
>6.18. <A
HREF="x291.html"
>host_status</A
></DT
><DT
>6.19. <A
HREF="x322.html"
>driver_status</A
></DT
><DT
>6.20. <A
HREF="x356.html"
>resid</A
></DT
><DT
>6.21. <A
HREF="x361.html"
>duration</A
></DT
><DT
>6.22. <A
HREF="x364.html"
>info</A
></DT
></DL
></DIV
><P
>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-&#62;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-&#62;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.
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>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-&#62;o] */
void * usr_ptr; /* [i-&#62;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) */</PRE
></FONT
></TD
></TR
></TABLE
></P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="theory.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x163.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Theory of operation</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>interface_id</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>