-->
Page 1097
The driver supports three ioctl requests. Requests not recognized by the st driver are passed to the scsi driver. The definitions below are from /usr/include/linux/mtio.h:
MTIOCTOP: Perform a tape operation
This request takes an argument of type (struct mtop *). Not all drives support all operations. The driver returns an EIO error if the drive rejects an operation.
/* Structure for MTIOCTOP _ mag tape op command: */ struct mtop { short mt_op; /* operations defined below */ int mt_count; /* how many of them */ };
Magnetic tape operations:
MTBSF | Backward space over mt_count filemarks. |
MTBSFM | Backward space over mt_count filemarks. Reposition the tape to the EOT side of the last filemark. |
MTBSR | Backward space over mt_count records (tape blocks). |
MTBSS | Backward space over mt_count setmarks. |
MTEOM | Go to the end of the recorded media (for appending files). |
MTERASE | Erase tape. |
MTFSF | Forward space over mt_count filemarks. |
MTFSFM | Forward space over mt_count filemarks. Reposition the tape to the BOT side of the last filemark. |
MTFSR | Forward space over mt_count records (tape blocks). |
MTFSS | Forward space over mt_count setmarks. |
MTNOP | No op; flushes the driver's buffer as a side effect. Should be used before reading status with MTIOCGET. |
MTOFFL | Rewind and put the drive off line. |
MTRESET | Reset drive. |
MTRETEN | Retention tape. |
MTREW | Rewind. |
MTSEEK | Seek to the tape block number specified in mt_count. This operation requires either a SCSI-2 drive that supports the LOCATE command (device-specific address) or a Tandberg-compatible SCSI-1 drive (Tandberg, Archive Viper, Wangtek, ). The block number should be one that was previously returned by MTIOCPOS because the number is device-specific. |
MTSETBLK | Set the drive's block length to the value specified in mt_count. A block length of zero sets the drive to variable block size mode. |
MTSETDENSITY | Set the tape density to the code in mt_count. Some useful density codes are |
18 0x00 Implicit 0x11 QIC-525 0x04 QIC-11 0x12 QIC-1350 0x05 QIC-24 0x13 DDS 0x0F QIC-120 0x14 Exabyte EXB-8200 0x10 QIC-150 0x15 Exabyte EXB-8500 | |
MTWEOF | Write mt_count filemarks. |
MTWSM | Write mt_count setmarks. |
Page 1098
MTSETDRVBUFFER | Set various drive and driver options according to bits encoded in mt_count. These consist of the drive's buffering mode, six Boolean driver options, and the buffer write threshold. These parameters are initialized only when the device is first detected. The settings persist when the device is closed and reopened. A single operation can affect just the buffering mode, just the Boolean options, or just the write threshold. |
A value having zeros in the high-order 4 bits will be used to set the drive's buffering mode. The buffering modes are: | |
0 The drive will not report GOOD status on write commands until the data blocks are actually written to the medium. 1 The drive may report GOOD status on write commands as soon as all the data has been transferred to the drive's internal buffer. 2 The drive may report GOOD status on write commands as soon as all the data has been transferred to the drive's internal buffer and all buffered data from different initiators has been successfully written to the medium. | |
To control the write threshold, the value in mt_count must include the constant MT_ST_WRITE_THRESHOLD logically ORed with a block count in the low 28 bits. The block count refers to 1024-byte blocks, not the physical block size on the tape. The threshold cannot exceed the driver's internal buffer size (see the description). | |
To set and clear the Boolean options, the value in mt_count must include the constant MT_ST_BOOLEANS logically ORed with whatever combination of the following options is desired. Any options not specified are set false. The Boolean options are | |
MT_ST_BUFFER_WRITES | (Default: true) Buffer all write operations. If this option is false and the drive uses a fixed block size, then all write operations must be for a multiple of the block size. This option must be set false to write reliable multi-volume archives. |
MT_ST_ASYNC_WRITES | (Default: true) When this options is true, write operations return immediately without waiting for the data to be transferred to the drive if the data fits into the driver's buffer. The write threshold determines how full the buffer must be before a new SCSI write command is issued. Any errors reported by the drive will be held until the next operation. This option must be set false to write reliable multi-volume archives. |
MT_ST_READ_AHEAD | (Default: true) This option causes the driver to provide read buffering and read-ahead. If this option is false and the drive uses a fixed block size, then all read operations must be for a multiple of the block size. |
MT_ST_TWO_FM |
(Default: false) This option modifies the driver behavior when a file
is closed. The normal action is to write a single filemark. If the option
is true, the driver will write two filemarks and backspace over the second one. |
Note that this option should not be set true for QIC tape drives because they are unable to overwrite a filemark. These drives detect the end of recorded data by testing for blank tape rather than two consecutive filemarks. | |
MT_ST_DEBUGGING | (Default: false) This option turns on various debugging messages from the driver (effective only if the driver was compiled with DEBUG defined). |
MT_ST_FAST_EOM | (Default: false) This option causes the MTEOM operation to be sent directly to the drive, potentially speeding up the operation but causing the driver |