include "scsi.m"; scsiio := load ScsiIO ScsiIO->PATH; Scsi: adt { inquire: string; rawfd: ref Sys->FD; nchange: int; changetime: int; open: fn(devdir: string): ref Scsi; rawcmd: fn(s: self ref Scsi, cmd: array of byte, data: array of byte, io: int): int; cmd: fn(s: self ref Scsi, cmd: array of byte, data: array of byte, io: int): int; ready: fn(s: self ref Scsi): int; }; Sread, Swrite, Snone: con iota; scsierror: fn(asc: int, ascq: int): string; init: fn(verbose: int);
Init must be called before using any other operation of the module. If verbose is non-zero the module will produce a fair amount of debugging output on file descriptor 2 when SCSI commands fail.
Scsi.open attempts to open the file devdir/raw on which to send raw SCSI commands. On success, it reads the device's inquiry string and returns a reference to a Scsi value to represent the connection. It provides the following operations:
The nchange and changetime elements of Scsi the number of times a media change has been detected, and the first time the current media was detected (the first time a SCSI command was issued after it was inserted). They are maintained by Scsi.cmd. The initial SCSI inquiry result is kept in inquire.
Scsierror returns a textual description of the SCSI status denoted by the ASC and ASCQ sense codes. The description is found by consulting /lib/scsicodes.
SCSIIO(2 ) | Rev: Thu Feb 15 14:43:27 GMT 2007 |