scsi man page on Plan9

Man page or keyword search:  
man Server   549 pages
apropos Keyword Search (all sections)
Output format
Plan9 logo
[printable version]

SCSI(2)								       SCSI(2)

       openscsi,  closescsi, scsiready, scsi, scsicmd, scsierror - SCSI device

       #include <u.h>
       #include <libc.h>
       #include <disk.h>

       typedef struct Scsi {
	    char  *inquire;
	    int	  rawfd;
	    int	  nchange;
	    ulong changetime;

       Scsi* openscsi(char *devdir)

       void  closescsi(Scsi *s)

       int   scsiready(Scsi *s)

       int   scsi(Scsi *s, uchar *cmd, int ncmd,
			   void *data, int ndata, int dir)

       int   scsicmd(Scsi *s, uchar *cmd, int ncmd,
			   void *data, int ndata, int dir)

       char* scsierror(int asc, int ascq)

       int   scsiverbose;

       These routines provide an interface to  a  SCSI	or  ATAPI  device  via

       Openscsi	 attempts  to  open the file devdir/raw and use it to send raw
       SCSI commands.  On success, it reads the device's  inquiry  string  and
       stores  it in inquire in the returned Scsi structure.  Closescsi closes
       the connection and frees the Scsi structure.

       Scsiready sends the ``unit ready'' command up to three times, returning
       zero if the unit responds that it is ready, or -1 on error.

       Scsierror  returns  a textual description of the SCSI status denoted by
       the ASC and ASCQ sense codes.  The description is found	by  consulting
       /sys/lib/scsicodes.   The  returned  string  will be overwritten by the
       next call to scsierror.

       Scsi and scsicmd execute a single SCSI command  on  the	named  device.
       There  should  be ncmd bytes of command data in cmd; if dir is Sread, a
       successful operation will store up to ndata bytes into data,  returning
       the  number  of bytes stored.  If dir is Swrite, the ndata bytes begin‐
       ning at data are transmitted as the data argument to the	 command,  and
       the  number  of	bytes  written is returned.  If dir is Snone, data and
       ndata are ignored.  On error, scsi and scsicmd return -1.  Scsicmd sim‐
       ply  issues the command and returns the result; scsi works a bit harder
       and is the more commonly used routine.  Scsi attempts to send the  com‐
       mand;  if it is successful, scsi returns what scsicmd returned.	Other‐
       wise, scsi sends a request sense command to obtain the reason  for  the
       failure, sends a unit ready command in an attempt to bring the unit out
       of any inconsistent states, and tries again.  If the second try	fails,
       scsi  sends  the	 request  sense and unit ready commands again and then
       uses scsierror to set errstr with a reason for failure.

       The nchange and changetime fields in the Scsi structure record the num‐
       ber  of	times  a media change has been detected, and the time when the
       current media was inserted into the drive (really the first time a SCSI
       command	was  issued  after  it	was inserted).	They are maintained by

       If scsiverbose is set, these commands will produce  a  fair  amount  of
       debugging output on file descriptor 2 when SCSI commands fail.

	      List of textual messages corresponding to SCSI error codes; con‐
	      sulted by scsierror.


       sd(3), scuzz(8)

                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server Plan9

List of man pages available for Plan9

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net