This file is indexed.

/usr/share/doc/HOWTO/ja-html/SCSI-Programming-HOWTO-11.html is in doc-linux-ja-html 2006.05.25-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
 <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.21">
 <TITLE>The Linux SCSI programming HOWTO: $B%;%s%9%P%C%U%!$rMQ$$$kNc(B</TITLE>
 <LINK HREF="SCSI-Programming-HOWTO-12.html" REL=next>
 <LINK HREF="SCSI-Programming-HOWTO-10.html" REL=previous>
 <LINK HREF="SCSI-Programming-HOWTO.html#toc11" REL=contents>
</HEAD>
<BODY>
<A HREF="SCSI-Programming-HOWTO-12.html">$B<!$N%Z!<%8(B</A>
<A HREF="SCSI-Programming-HOWTO-10.html">$BA0$N%Z!<%8(B</A>
<A HREF="SCSI-Programming-HOWTO.html#toc11">$BL\<!$X(B</A>
<HR>
<H2><A NAME="s11">11.</A> <A HREF="SCSI-Programming-HOWTO.html#toc11">$B%;%s%9%P%C%U%!$rMQ$$$kNc(B</A></H2>


<P>$B$3$3$G$O%a%G%#%"$,AuCV$KEk:\$5$l$F$$$k$+$I$&$+$r8!::$9$k$?$a$K(B TEST
UNIT READY $B%3%^%s%I$r;HMQ$7$^$9!#(Binquiry $B$NNc$K$"$k%X%C%@$N@k8@$H4X?t(B 
<CODE>handle_SCSI_cmd</CODE> $B$,F1MM$KI,MW$G$9!#(B</P>

<P>
<BLOCKQUOTE><CODE>
<PRE>
                        Table 73: TEST UNIT READY Command
+=====-========-========-========-========-========-========-========-========+
|  Bit|   7    |   6    |   5    |   4    |   3    |   2    |   1    |   0    |
|Byte |        |        |        |        |        |        |        |        |
|=====+=======================================================================|
| 0   |                           Operation Code (00h)                        |
|-----+-----------------------------------------------------------------------|
| 1   | Logical Unit Number      |                  Reserved                  |
|-----+-----------------------------------------------------------------------|
| 2   |                           Reserved                                    |
|-----+-----------------------------------------------------------------------|
| 3   |                           Reserved                                    |
|-----+-----------------------------------------------------------------------|
| 4   |                           Reserved                                    |
|-----+-----------------------------------------------------------------------|
| 5   |                           Control                                     |
+=============================================================================+
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>$B0J2<$,$3$l$r<BAu$7$?4X?t$G$9!'(B</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
#define TESTUNITREADY_CMD 0
#define TESTUNITREADY_CMDLEN 6

#define ADD_SENSECODE 12
#define ADD_SC_QUALIFIER 13
#define NO_MEDIA_SC 0x3a
#define NO_MEDIA_SCQ 0x00

int TestForMedium ( void )
{
  /* request READY status */
  static unsigned char cmdblk [TESTUNITREADY_CMDLEN] = {
      TESTUNITREADY_CMD, /* command */
                      0, /* lun/reserved */
                      0, /* reserved */
                      0, /* reserved */
                      0, /* reserved */
                      0};/* control */

  memcpy( cmd + SCSI_OFF, cmdblk, sizeof(cmdblk) );

  /*
   * +------------------+
   * | struct sg_header | &lt;- cmd
   * +------------------+
   * | copy of cmdblk   | &lt;- cmd + SCSI_OFF
   * +------------------+
   */

  if (handle_SCSI_cmd(sizeof(cmdblk), 0, cmd, 
                            0, NULL)) {
      fprintf (stderr, "Test unit ready failed\n");
      exit(2);
  }

  return
   *(((struct sg_header*)cmd)->sense_buffer +ADD_SENSECODE) != 
                                                        NO_MEDIA_SC ||
   *(((struct sg_header*)cmd)->sense_buffer +ADD_SC_QUALIFIER) != 
                                                        NO_MEDIA_SCQ;
}
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>$B$3$N(B<CODE>main</CODE>$B4X?t$HAH$_9g$o$;$k$H!"%A%'%C%/$r9T$&$3$H$,$G$-$^$9!#(B</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
void main( void )
{
  fd = open(DEVICE, O_RDWR);
  if (fd &lt; 0) {
    fprintf( stderr, "Need read/write permissions for "DEVICE".\n" );
    exit(1);
  }

  /* look if medium is loaded */

  if (!TestForMedium()) {
    printf("device is unloaded\n");
  } else {
    printf("device is loaded\n");
  }
}
</PRE>
</CODE></BLOCKQUOTE>
</P>

<P>$BIUO?$N%U%!%$%k(B <CODE>generic_demo.c</CODE> $B$K$ON>J}$NNc$,4^$^$l$^$9!#(B</P>

<HR>
<A HREF="SCSI-Programming-HOWTO-12.html">$B<!$N%Z!<%8(B</A>
<A HREF="SCSI-Programming-HOWTO-10.html">$BA0$N%Z!<%8(B</A>
<A HREF="SCSI-Programming-HOWTO.html#toc11">$BL\<!$X(B</A>
</BODY>
</HTML>