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

202 lines
3.5 KiB
HTML

<HTML
><HEAD
><TITLE
>SCSI_IOCTL_GET_IDLUN</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="Ioctl()s"
HREF="ioctl.html"><LINK
REL="PREVIOUS"
TITLE="Sg ioctls removed in version 3"
HREF="ioctl_removed.html"><LINK
REL="NEXT"
TITLE="SCSI_IOCTL_GET_PCI"
HREF="scsi_g_pci.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="ioctl_removed.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 8. Ioctl()s</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="scsi_g_pci.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="SCSI_G_IDLUN">8.23. SCSI_IOCTL_GET_IDLUN</H1
><DIV
CLASS="FORMALPARA"
><P
><B
>SCSI_IOCTL_GET_IDLUN 0x5382. </B
>This ioctl takes a pointer to a "struct scsi_idlun" object as its third
argument. The "struct scsi_idlun" is not visible to user applications.
To use this, that structure needs to be replicated in
the user's program. Something like:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>typedef struct my_scsi_idlun {
int four_in_one; /* 4 separate bytes of info compacted into 1 int */
int host_unique_id; /* distinguishes adapter cards from same supplier */
} My_scsi_idlun;</PRE
></FONT
></TD
></TR
></TABLE
>
"four_in_one" is made up as follows:
<TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
WIDTH="100%"
><TR
><TD
><FONT
COLOR="#000000"
><PRE
CLASS="PROGRAMLISTING"
>(scsi_device_id | (lun &#60;&#60; 8) | (channel &#60;&#60; 16) | (host_no &#60;&#60; 24))</PRE
></FONT
></TD
></TR
></TABLE
>
These 4 components are assumed (or masked) to be 1 byte each. These are
the four numbers that the SCSI subsystem uses to index devices, often
written as "&#60;host_no, channel, scsi_id, lun&#62;".
The 'host_unique_id' assigns a different number to each controller from the
same manufacturer/low-level device driver. Most of the information
provided by this command is more easily obtained from SG_GET_SCSI_ID.</P
></DIV
><P
>The 'host_no' element is a change in lk 2.4 kernels. [In the lk 2.2 series
and earlier, it was 'low_inode &#38; 0xff' from the procfs entry
corresponding to the host.] This change makes the use of the
SCSI_IOCTL_GET_BUS_NUMBER ioctl() superfluous.</P
><P
>The advantage of this ioctl() is that it can be called on any SCSI file
descriptor.</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="ioctl_removed.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="scsi_g_pci.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Sg ioctls removed in version 3</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ioctl.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SCSI_IOCTL_GET_PCI</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>