SMTIO(4) — Silicon Graphics
NAME
smtio − UNIX streaming magnetic tape interface
DESCRIPTION
The special file /dev/rmt1 refers to the UNIX streaming magtape drive, which is on the MULTIBUS using the DSD-5217 controller. The following description applies to any of the transport/controller pairs. The special files /dev/rmt1, /dev/rqic, and /dev/mt1 are 10000 fci, 450 ft, 45 ips, 45 MByte Quarter Inch Tape streaming drives, e.g., Archive, Wangtek or Cipher. /dev/nrqic, /dev/nrmt1, and /dev/nmt1 are no rewind devices with the same specifications as above. /dev/nrmt1 is the special file meant as the default to smt commands. Refer to smt(1) for the specifications of ioctl commands to manipulate the tape drives. The files /dev/rqic, /dev/rmt1, and /dev/mt1 are rewound when closed; the others are not. These files will also be closed by writing a file mark. The other files will not be rewound upon close. They will also write a file mark but will be positioned at the file mark for additional files to be added to the tape cartridge.
A standard tape consists of a series of 512 byte records terminated by an end-of-file. The system makes it possible to treat the tape like any other file. Seeks do not have their usual meaning and it is not possible to read or write a byte at a time. Writing in very small blocks (less than 5120 bytes) is inadvisable because this tends to create large record gaps and causes the tape to stop streaming. The tape drive must then reposition the tape cartridge for the next write or read. This causes a slower performance due to the tape moving backwards and forwards and stopping and starting.
The smt(1) manipulation program discussed above is useful when it is desired to access the tape in a way compatible with ordinary files. When foreign tapes are to be dealt with, and especially when long records are to be read or written, the ‘raw’ interface is appropriate. The standard format for referring to the ‘blocked’ device is /dev/mt1, but the ‘raw’ and the ‘blocked’ devices are the same for the Quarter Inch Streaming tape drive. The associated files are named /dev/rmt1 and /dev/rqic but the same minor device considerations as for the regular devices still apply. A number of ioctl operations are available on raw magnetic tape. Refer to smt(1) for additional information for use with /dev/nrmt1. The following definitions are from /usr/include/sys/mtio.h:
/*
* Structures and definitions for mag tape io control commands
*/
/* structure for MTIOCTOP - mag tape op command */
structmtop {
short mt_op; /* operations defined below */
daddr_t mt_count; /* how many of them */
};
/* operations */
#defineMTWEOF 0 /* write an end-of-file record */
#defineMTFSF 1 /* forward space file */
#defineMTFSR 3 /* forward space record */
#defineMTREW 5 /* rewind */
#defineMTNOP 7 /* no operation, sets status only */
/* structure for MTIOCGET - mag tape get status command */
structmtget {
short mt_type; /* type of magtape device */
/* the following six registers are very device dependent */
short mt_hard_error0; /* hard error byte 0 of status from DSD */
short mt_hard_error1; /* hard error byte 1 of status from DSD */
short mt_soft_error0; /* soft error byte of status from DSD */
short mt_at_bot; /* byte 0xff when tape at bot */
short mt_retries; /* byte number of retries by tape drive */
short mt_file_mark; /* byte 0xff when file mark encountered */
/* end device-dependent registers */
daddr_t mt_fileno; /* file number of current position */
daddr_t mt_blkno; /* block number of current position */
};
/*
* Constants for mt_type byte
*/
#defineMT_ISTS 0x01 /* Streaming Quarter Inch Tape Drive */
/* mag tape io control commands */
#defineMTIOCTOP ((’m’<<8)|1) /* do a mag tape op */
#defineMTIOCGET ((’m’<<8)|2) /* get tape status */
#ifndef KERNEL
#defineDEFTAPE "/dev/rmtioctl" /* IOCTL device */
#endif
Each read or write call reads or writes the next record on the tape. In the write case the record has the same length as the buffer given. Each tape write will write one file mark on close and will either rewind or position itself at the file mark. Addition writes will be positioned after the file mark and can be accessed by using the smt(1) streaming tape manipulation program.
FILES
/dev/mt1Cartridge tape
/dev/rmt1Cartridge tape
/dev/rqicCartridge tape
/dev/nrmt1Cartridge tape — no rewind
The minor device numbers for each of the above devices to build special files using mknod(1) is based on the standard default minor device number being 0x00. The minor device number for the /dev/nrmt* and /dev/nrqic is 0x01. The above minor device numbers refer to tape drive 0 of the DSD controller and at present the hardware only supports this one tape drive.
SEE ALSO
BUGS
The status should be returned in a device independent format, but the status returned is very device independent.
Version 2.1 — January 02, 1985