home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / libscsi1.zoo / LibScsi-0.01 / prevent.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-14  |  712 b   |  33 lines

  1. /*
  2.  * prevent.c - Copyright Steve Woodford, August 1993.
  3.  *
  4.  * Send 'prevent/allow' command to SCSI target.
  5.  * (Prevents/Allows media removal. Kinda like a "lock" mechanism. Not
  6.  * all targets will (or are even able to) honour this.)
  7.  */
  8.  
  9. #include <sys/types.h>
  10. #include <sys/scsi.h>
  11. #include "libscsi.h"
  12.  
  13.  
  14. PUBLIC  short
  15. Scsi_Prevent_Allow(u_char id, u_char flg)
  16. {
  17.     Scsi_Cmd    sc;
  18.  
  19.     if ( id & 0xc0 )
  20.         return(-1);
  21.  
  22.     (void) _Scsi_Timeout( T_Normal(id) );
  23.  
  24.     sc.sc_command = CMD(id, SZ_CMD_MEDIA_REMOVAL);
  25.     sc.sc_z[0]    = LUN(id, 0);
  26.     sc.sc_z[1]    = 0;
  27.     sc.sc_z[2]    = 0;
  28.     sc.sc_z[3]    = flg & 0x01;
  29.     sc.sc_link    = 0;
  30.  
  31.     return ( _Scsi_Command( DMA_READ, &sc, 0L, 0 ) );
  32. }
  33.