3 openscsi, scsiready, scsi, scsicmd, scsierror \- SCSI device operations
22 Scsi* openscsi(char *devdir)
25 void closescsi(Scsi *s)
28 int scsiready(Scsi *s)
31 int scsi(Scsi *s, uchar *cmd, int ncmd,
33 void *data, int ndata, int dir)
36 int scsicmd(Scsi *s, uchar *cmd, int ncmd,
38 void *data, int ndata, int dir)
41 char* scsierror(int asc, int ascq)
46 These routines provide an interface
47 to a SCSI or ATAPI device via Plan 9's
51 attempts to open the file
53 and use it to send raw SCSI commands.
54 On success, it reads the device's inquiry
55 string and stores it in in returned
59 closes the connection and frees the
64 sends the ``unit ready'' command up to three times,
65 returning zero if the unit responds that it is ready,
69 returns a textual description of the SCSI status
70 denoted by the ASC and ASCQ sense codes.
71 The description is found by consulting
72 .BR /sys/lib/scsicodes .
73 The returned string will be overwritten by
80 execute a single SCSI command on the named device.
90 a successful operation
95 returning the number of bytes stored.
104 are transmitted as the data argument to
106 number of bytes written is returned.
121 simply issues the command and
124 works a bit harder and
125 is the more commonly used routine.
127 attempts to send the command;
135 sends a request sense command to
136 obtain the reason for the failure,
137 sends a unit ready command in
138 an attempt to bring the unit out of any
139 inconsistent states, and tries again.
140 If the second try fails,
143 sense and unit ready commands
149 with a reason for failure.
159 record the number of times a media
160 change has been detected, and the
161 time when the current media was
162 inserted into the drive (really the
163 first time a SCSI command was issued
164 after it was inserted).
165 They are maintained by
171 these commands will produce a fair
172 amount of debugging output on file descriptor 2
173 when SCSI commands fail.
176 .B /sys/lib/scsicodes
177 List of textual messages corresponding to SCSI error codes;
181 .B /usr/local/plan9/src/libdisk/scsi.c
187 SCSI devices on Unix do not present the interface expected by