home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / KERNEL-S / V1.2 / LINUX-1.2 / LINUX-1 / linux / drivers / scsi / README.st < prev    next >
Encoding:
Text File  |  1995-01-14  |  6.7 KB  |  160 lines

  1. This file contains brief information about the SCSI tape driver.
  2. Last modified: Tue Jan 10 21:32:35 1995 by root@kai.home
  3.  
  4. BASICS
  5.  
  6. The driver is generic. The state of a drive is not modified when the
  7. driver is initialized or a device is opened. The mode parameters of the
  8. drive can be modified with ioctls. The driver supports fixed and
  9. variable block size (within buffer limits). Both the auto-rewind
  10. (minor equals device number) and non-rewind devices (minor is 128 +
  11. device number) are implemented.
  12.  
  13. By default the driver writes one filemark when the device is closed after
  14. writing and the last operation has been a write. Two filemarks can be
  15. optionally written. In both cases end of data is signified by
  16. returning zero bytes for two consecutive reads.
  17.  
  18. BUFFERING
  19.  
  20. The driver uses a buffer allocated at system initialization. The size
  21. of the buffer is selectable at compile and/or boot time. The buffer is
  22. used to store the data being transferred to/from the SCSI adapter. The
  23. following buffering options are selectable at compile time and/or at run
  24. time (via ioctl):
  25.  
  26. Buffering of data to be written across write calls for fixed block
  27. mode (define ST_BUFFER_WRITES). This should be disabled if reliable
  28. detection of end of media (EOM) for fixed block mode is desired.
  29.  
  30. Asynchronous writing. Writing the buffer contents to the tape is
  31. started and the write call returns immediately. The status is checked
  32. at the next tape operation. Should not used if reliable EOM detection
  33. is desired.
  34.  
  35. Read ahead for fixed block mode (ST_READ_AHEAD). Filling the buffer is
  36. attempted even if the user does not want to get all of the data at
  37. this read command. Should be disabled for those drives that don't like
  38. a filemark to truncate a read request or that don't like backspacing.
  39.  
  40. The buffer size is defined (in 1024 byte units) by ST_BUFFER_BLOCKS or
  41. at boot time. The maximum number of buffers allocated is defined by
  42. ST_MAX_BUFFERS. One buffer is allocated for each detected drive up to
  43. the maximum. The threshold for triggering asynchronous write is
  44. defined by ST_WRITE_THRESHOLD.
  45.  
  46.  
  47. BOOT TIME CONFIGURATION
  48.  
  49. The buffer size, write threshold, and the maximum number of allocated buffers
  50. are configurable at boot time using, e.g., the LILO command line. The option
  51. syntax is the following:
  52.  
  53.            st=aa[,bb[,cc]]
  54.  
  55. where
  56.   aa is the buffer size in 1024 byte units
  57.   bb is the write threshold in 1024 byte units
  58.   cc is the maximum number of tape buffers to allocate (the number of
  59.         buffers is bounded also by the number of drives detected)
  60.  
  61.  
  62. IOCTLS
  63.  
  64. The tape is positioned and the drive parameters are set with ioctls
  65. defined in mtio.h The tape control program 'mt' uses these ioctls. Try
  66. to find an mt that supports all of the Linux SCSI tape ioctls and
  67. opens the device for writing if the tape contents will be modified
  68. (look for a package mt-st* from the Linux ftp sites; the GNU mt does
  69. not open for writing for, e.g., erase).
  70.  
  71. The supported ioctls are:
  72.  
  73. The following use the structure mtop:
  74.  
  75. MTFSF   Space forward over count filemarks. Tape positioned after filemark.
  76. MTFSFM  As above but tape positioned before filemark.
  77. MTBSF    Space backward over count filemarks. Tape positioned before
  78.         filemark.
  79. MTBSFM  As above but ape positioned after filemark.
  80. MTFSR   Space forward over count records.
  81. MTBSR   Space backward over count records.
  82. MTFSS   Space forward over count setmarks.
  83. MTBSS   Space backward over count setmarks.
  84. MTWEOF  Write count filemarks.
  85. MTWSM   Write count setmarks.
  86. MTREW   Rewind tape.
  87. MTOFFL  Set device off line (often rewind plus eject).
  88. MTNOP   Do nothing except flush the buffers.
  89. MTRETEN Retension tape.
  90. MTEOM   Space to end of recorded data.
  91. MTERASE Erase tape.
  92. MTSEEK    Seek to tape block count. Uses Tandberg-compatible seek (QFA)
  93.         for SCSI-1 drives and SCSI-2 seek for SCSI-2 drives. The file and
  94.     block numbers in the status are not valid after a seek.
  95. MTSETBLK Set the drive block size. Setting to zero sets the drive into
  96.         variable block mode (if applicable).
  97. MTSETDENSITY Sets the drive density code to arg. See drive
  98.         documentation for available codes.
  99. MTSETDRVBUFFER
  100.     Is used for several things. The command is obtained from count
  101.         with mask MT_SET_OPTIONS, the low order bits are used as argument.
  102.     The subcommands are:
  103.     0
  104.            The drive buffer option is set to the argument. Zero means
  105.            no buffering.
  106.         MT_ST_BOOLEANS
  107.            Sets the buffering options. The bits are the new states
  108.            (enabled/disabled) of the write buffering (MT_ST_BUFFER_WRITES),
  109.            asynchronous writes (MT_ST_ASYNC_WRITES), read ahead
  110.            (MT_ST_READ_AHEAD), writing of two filemark (ST_TWO_FM),
  111.        using the SCSI spacing to EOD (MT_ST_FAST_EOM), and
  112.        debugging (MT_ST_DEBUGGING ; debugging must be compiled into the
  113.        driver).
  114.         MT_ST_WRITE_THRESHOLD
  115.            Sets the write threshold for this device to kilobytes
  116.            specified by the lowest bits.
  117.  
  118. The following ioctl uses the structure mtpos:
  119. MTIOCPOS Reads the current position from the drive. Uses
  120.         Tandberg-compatible QFA for SCSI-1 drives and the SCSI-2
  121.         command for the SCSI-2 drives.
  122.  
  123. The following ioctl uses the structure mtget to return the status:
  124. MTIOCGET Returns some status information.
  125.         The file number and block number within file are returned. The
  126.         block is -1 when it can't be determined (e.g., after MTBSF).
  127.         The drive type is either MTISSCSI1 or MTISSCSI2.
  128.         The number of recovered errors since the previous status call
  129.         is stored in the lower word of the field mt_erreg.
  130.         The current block size and the density code are stored in the field
  131.         mt_dsreg (shifts for the subfields are MT_ST_BLKSIZE_SHIFT and
  132.         MT_ST_DENSITY_SHIFT).
  133.     The GMT_xxx status bits reflect the drive status. GMT_DR_OPEN
  134.     is set if there is no tape in the drive. GMT_EOD means either
  135.     end of recorded data or end of tape. GMT_EOT means end of tape.
  136.  
  137.  
  138. MISCELLANEOUS COMPILE OPTIONS
  139.  
  140. The recovered write errors are considered fatal if ST_RECOVERED_WRITE_FATAL
  141. is defined.
  142.  
  143. Immediate return from tape positioning SCSI commands can be enabled by
  144. defining ST_NOWAIT.
  145.  
  146. The MTEOM command is by default implemented as spacing over 32767
  147. filemarks. With this method the file number in the status is
  148. correct. The user can request using direct spacing to EOD by setting
  149. ST_FAST_EOM 1 (or using the MT_ST_OPTIONS ioctl). In this case the file
  150. number will be invalid.
  151.  
  152. When using read ahead or buffered writes the position within the file
  153. may not be correct after the file is closed (correct position may
  154. require backspacing over more than one record). The correct position
  155. within file can be obtained if ST_IN_FILE_POS is defined. (The
  156. driver always backs over a filemark crossed by read ahead if the user
  157. does not request data that far.)
  158.  
  159. Kai M{kisara
  160.