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

200 lines
3.9 KiB
HTML

<HTML
><HEAD
><TITLE
>dxfer_direction</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="UP"
TITLE="The sg_io_hdr_t structure in detail"
HREF="sg_io_hdr_t.html"><LINK
REL="PREVIOUS"
TITLE="interface_id"
HREF="x163.html"><LINK
REL="NEXT"
TITLE="cmd_len"
HREF="x184.html"></HEAD
><BODY
CLASS="SECT1"
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="x163.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 6. The sg_io_hdr_t structure in detail</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x184.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN166">6.2. dxfer_direction</H1
><P
>The type of dxfer_direction is int.
This is required to be one of the following:
<P
></P
><UL
><LI
><P
>SG_DXFER_NONE /* e.g. a SCSI Test Unit Ready command */</P
></LI
><LI
><P
>SG_DXFER_TO_DEV /* e.g. a SCSI WRITE command */</P
></LI
><LI
><P
>SG_DXFER_FROM_DEV /* e.g. a SCSI READ command */</P
></LI
><LI
><P
>SG_DXFER_TO_FROM_DEV</P
></LI
><LI
><P
>SG_DXFER_UNKNOWN</P
></LI
></UL
>
The value SG_DXFER_NONE should be used when there is no data transfer
associated with a command (e.g. TEST UNIT READY). The value
SG_DXFER_TO_DEV should be used when data is being moved from user
memory towards the device (e.g. WRITE). The value SG_DXFER_FROM_DEV
should be used when data is being moved from the device towards user
memory (e.g. READ).</P
><P
> The value SG_DXFER_TO_FROM_DEV is only relevant to indirect IO
(otherwise it is treated like SG_DXFER_FROM_DEV). Data is moved from
the user space to the kernel buffers. The command is then performed and
most likely a READ-like command transfers data from the device into the
kernel buffers. Finally the kernel buffers are copied back into the user
space. This technique allows application writers to initialize the
buffer and perhaps deduce the number of bytes actually read from the
device (i.e. detect underrun). This is better done by using 'resid' if
it is supported.</P
><P
> The value SG_DXFER_UNKNOWN is for those (rare) situations where the
data direction is not known. It may be useful for backward
compatibility of existing applications when the relevant direction
information is not available in the sg interface layer. There is
a (minor) performance "hit" associated with choosing this
option (e.g. on the PCI bus). Some recent pseudo device drivers (e.g.
USB mass storage) may have problems handling this value (especially
on vendor-specific SCSI commands).</P
><P
> N.B. 'dxfer_direction' must have one of the five indicated values
and cannot be uninitialized or zero.</P
><P
> If 'dxfer_len' is zero then all values are treated like SG_DXFER_NONE.</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="x163.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="x184.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>interface_id</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="sg_io_hdr_t.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>cmd_len</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>