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

598 lines
7.2 KiB
HTML

<HTML
><HEAD
><TITLE
>The Linux SCSI Generic (sg) HOWTO</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
"><LINK
REL="NEXT"
TITLE="Introduction"
HREF="intro.html"></HEAD
><BODY
CLASS="BOOK"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="BOOK"
><A
NAME="INDEX"><DIV
CLASS="TITLEPAGE"
><H1
CLASS="TITLE"
><A
NAME="AEN2">The Linux SCSI Generic (sg) HOWTO</H1
><H3
CLASS="AUTHOR"
><A
NAME="AEN5">Douglas Gilbert</H3
><DIV
CLASS="AFFILIATION"
><DIV
CLASS="ADDRESS"
><P
CLASS="ADDRESS"
>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dgilbert@interlog.com<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</P
></DIV
></DIV
><P
CLASS="COPYRIGHT"
><A
HREF="ln32.html"
>Copyright</A
> &copy; 2001, 2002 by Douglas Gilbert</P
><P
CLASS="PUBDATE"
>2002-05-03<BR></P
><DIV
CLASS="REVHISTORY"
><TABLE
WIDTH="100%"
BORDER="0"
><TR
><TH
ALIGN="LEFT"
VALIGN="TOP"
COLSPAN="3"
><B
>Revision History</B
></TH
></TR
><TR
><TD
ALIGN="LEFT"
>Revision 1.2</TD
><TD
ALIGN="LEFT"
>2002-05-03</TD
><TD
ALIGN="LEFT"
>Revised by: dpg</TD
></TR
><TR
><TD
ALIGN="LEFT"
COLSPAN="3"
>ENOMEM, EPERM; DRIVER_SENSE-&#62;CHECK_CONDITION</TD
></TR
><TR
><TD
ALIGN="LEFT"
>Revision 1.1</TD
><TD
ALIGN="LEFT"
>2002-01-26</TD
><TD
ALIGN="LEFT"
>Revised by: dpg</TD
></TR
><TR
><TD
ALIGN="LEFT"
COLSPAN="3"
>corrections, host_status, odd dxfer_len</TD
></TR
><TR
><TD
ALIGN="LEFT"
>Revision 1.0</TD
><TD
ALIGN="LEFT"
>2001-12-21</TD
><TD
ALIGN="LEFT"
>Revised by: dpg</TD
></TR
><TR
><TD
ALIGN="LEFT"
COLSPAN="3"
>original, displace SCSI-PROGRAMMING-HOWTO</TD
></TR
></TABLE
></DIV
><DIV
><DIV
CLASS="ABSTRACT"
><A
NAME="AEN37"><P
></P
><P
> This HOWTO describes the SCSI Generic driver (sg) found in the Linux
2.4 production series of kernels.
It focuses on the the interface and characteristics of the driver
that application writers may need to know. The driver's theory of
operations is covered and some brief examples are included.
</P
><P
></P
></DIV
></DIV
><HR></DIV
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
>1. <A
HREF="intro.html"
>Introduction</A
></DT
><DT
>2. <A
HREF="what.html"
>What the sg driver does</A
></DT
><DT
>3. <A
HREF="iddriver.html"
>Identifying the version of the SG driver</A
></DT
><DT
>4. <A
HREF="interface.html"
>Interface</A
></DT
><DT
>5. <A
HREF="theory.html"
>Theory of operation</A
></DT
><DT
>6. <A
HREF="sg_io_hdr_t.html"
>The sg_io_hdr_t structure in detail</A
></DT
><DD
><DL
><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
></DD
><DT
>7. <A
HREF="syscalls.html"
>System calls</A
></DT
><DD
><DL
><DT
>7.1. <A
HREF="open.html"
>open()</A
></DT
><DT
>7.2. <A
HREF="write.html"
>write()</A
></DT
><DT
>7.3. <A
HREF="read.html"
>read()</A
></DT
><DT
>7.4. <A
HREF="poll.html"
>poll()</A
></DT
><DT
>7.5. <A
HREF="close.html"
>close()</A
></DT
><DT
>7.6. <A
HREF="mmap.html"
>mmap()</A
></DT
><DT
>7.7. <A
HREF="fcntl.html"
>fcntl(sg_fd, F_SETFL, oflags | FASYNC)</A
></DT
><DT
>7.8. <A
HREF="errors.html"
>Errors reported in errno</A
></DT
></DL
></DD
><DT
>8. <A
HREF="ioctl.html"
>Ioctl()s</A
></DT
><DD
><DL
><DT
>8.1. <A
HREF="sg_io.html"
>SG_IO</A
></DT
><DT
>8.2. <A
HREF="g_access.html"
>SG_GET_ACCESS_COUNT</A
></DT
><DT
>8.3. <A
HREF="gs_commandq.html"
>SG_SET_COMMAND_Q (and _GET_)</A
></DT
><DT
>8.4. <A
HREF="s_debug.html"
>SG_SET_DEBUG</A
></DT
><DT
>8.5. <A
HREF="e_host.html"
>SG_EMULATED_HOST</A
></DT
><DT
>8.6. <A
HREF="gs_orphan.html"
>SG_SET_KEEP_ORPHAN (and _GET_)</A
></DT
><DT
>8.7. <A
HREF="s_lowdma.html"
>SG_SET_FORCE_LOW_DMA</A
></DT
><DT
>8.8. <A
HREF="g_lowdma.html"
>SG_GET_LOW_DMA</A
></DT
><DT
>8.9. <A
HREF="n_cmd_len.html"
>SG_NEXT_CMD_LEN</A
></DT
><DT
>8.10. <A
HREF="g_numw.html"
>SG_GET_NUM_WAITING</A
></DT
><DT
>8.11. <A
HREF="s_packid.html"
>SG_SET_FORCE_PACK_ID</A
></DT
><DT
>8.12. <A
HREF="g_packid.html"
>SG_GET_PACK_ID</A
></DT
><DT
>8.13. <A
HREF="g_rq_tab.html"
>SG_GET_REQUEST_TABLE</A
></DT
><DT
>8.14. <A
HREF="gs_rs_size.html"
>SG_SET_RESERVED_SIZE (and _GET_ )</A
></DT
><DT
>8.15. <A
HREF="scsi_reset.html"
>SG_SCSI_RESET</A
></DT
><DT
>8.16. <A
HREF="g_scsi_id.html"
>SG_GET_SCSI_ID</A
></DT
><DT
>8.17. <A
HREF="g_sg_tabsz.html"
>SG_GET_SG_TABLESIZE</A
></DT
><DT
>8.18. <A
HREF="g_to.html"
>SG_GET_TIMEOUT</A
></DT
><DT
>8.19. <A
HREF="s_to.html"
>SG_SET_TIMEOUT</A
></DT
><DT
>8.20. <A
HREF="s_xform.html"
>SG_SET_TRANSFORM</A
></DT
><DT
>8.21. <A
HREF="g_xform.html"
>SG_GET_TRANSFORM</A
></DT
><DT
>8.22. <A
HREF="ioctl_removed.html"
>Sg ioctls removed in version 3</A
></DT
><DT
>8.23. <A
HREF="scsi_g_idlun.html"
>SCSI_IOCTL_GET_IDLUN</A
></DT
><DT
>8.24. <A
HREF="scsi_g_pci.html"
>SCSI_IOCTL_GET_PCI</A
></DT
><DT
>8.25. <A
HREF="scsi_p_host.html"
>SCSI_IOCTL_PROBE_HOST</A
></DT
><DT
>8.26. <A
HREF="scsi_snd_cmd.html"
>SCSI_IOCTL_SEND_COMMAND</A
></DT
></DL
></DD
><DT
>9. <A
HREF="dmmio.html"
>Direct and Mmap-ed IO</A
></DT
><DD
><DL
><DT
>9.1. <A
HREF="dio.html"
>Direct IO</A
></DT
><DT
>9.2. <A
HREF="mmapio.html"
>Mmap-ed IO</A
></DT
></DL
></DD
><DT
>10. <A
HREF="init.html"
>Driver and module initialization</A
></DT
><DT
>11. <A
HREF="proc.html"
>Sg and the "proc" file system</A
></DT
><DD
><DL
><DT
>11.1. <A
HREF="sg_debug.html"
>/proc/scsi/sg/debug</A
></DT
></DL
></DD
><DT
>12. <A
HREF="async.html"
>Asynchronous usage of sg</A
></DT
><DT
>A. <A
HREF="sg3_utils.html"
>Sg3_utils package</A
></DT
><DT
>B. <A
HREF="sg_header.html"
>sg_header, the original sg control structure</A
></DT
><DT
>C. <A
HREF="pexample.html"
>Programming example</A
></DT
><DT
>D. <A
HREF="debugging.html"
>Debugging</A
></DT
><DT
>E. <A
HREF="refs.html"
>Other references</A
></DT
></DL
></DIV
></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"
>&nbsp;</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="intro.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Introduction</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>