MTIO(7) — Silicon Graphics
NAME
mtio − magnetic tape interface
DESCRIPTION
The special file /dev/rmt1 refers to the streaming quarter inch cartridge magtape drive. The special file /dev/rmt1, is a 10000 fci, 45 to 60 MByte quarter inch tape streaming drive. The special file /dev/rmt2, is the no rewind version of the device. The special file /dev/rmt3, is a 1600/6250 bpi half-inch tape drive, and the special file /dev/rmt4, is the no rewind version of the half-inch tape device.
The device /dev/bsrmt[34] for the half-inch tape does a byte swap upon writing and reading of the tape. This is particulary useful for VAX type tapes which are byteswapped when created.
Refer to mt(1) for the specifications of ioctl commands to manipulate the tape drives. The special files /dev/rmt1 and /dev/rmt3 are closed by writing a file mark and rewinding when writing to the tape. The files /dev/rmt2 and /dev/rmt4 are not rewound when closed.
The standard quarter inch 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 half-inch tape drive is written in block sizes of up to 32 KBytes blocks. The half-inch tape drive is a standard start stop device.
The mt 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 associated files are named /dev/rmt1 and /dev/rmt3. A number of ioctl operations are available on raw magnetic tape. Refer to mt(1) for additional information for use with /dev/rmt1 and /dev/rmt3.
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 */
#defineMTBSF 2 /* backward space file */
#defineMTFSR 3 /* forward space record */
#defineMTBSR 4 /* backward space record */
#defineMTREW 5 /* rewind */
#defineMTOFFL 6 /* off-line */
#defineMTNOP 7 /* no operation, sets status only */
#defineMTERASE 8 /* erase the tape */
#defineMTRET 9 /* Retension the tape */
#defineMTBLKSIZE 10 /* return the default blocksize used by this tape */
/* 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 */
short mt_hard_error1; /* hard error byte 1 of status */
short mt_soft_error0; /* soft error byte of status */
short mt_at_bot;
short mt_file_mark;
short mt_retries;
/* end device-dependent registers */
daddr_t mt_status;
daddr_t mt_fileno; /* file number of current position */
daddr_t mt_blkno; /* block number of current position */
};
#define AT_BOT 0x01
#define NO_TAPE 0x02
#define WR_PROT 0x04
#define HARD_ERROR 0x08
#define SOFT_ERROR 0x10
#define NOT_ONLINE 0x20
/*
* Constants for mt_type byte
*/
#defineMT_ISDSD 0x01 /* DSD - Streaming Quarter Inch Tape Drive */
#defineMT_ISTMT 0x02 /* Tapemaster 1/2" Tape drive */
#defineMT_ISSTT 0x03 /* Storager 2 tape drive */
/* mag tape io control commands */
#defineMTIOCTOP ((’m’<<8)|1) /* do a mag tape op */
#defineMTIOCGET ((’m’<<8)|2) /* get tape status */
Each read or write call uses the next record on the tape.
FILES
/dev/rmt1Cartridge tape
/dev/rmt2Cartridge tape — no rewind
/dev/rmt3Half-Inch tape
/dev/rmt4Half-Inch tape — no rewind
/dev/bsrmt3Half-Inch tape with byte-swap option
/dev/bsrmt4Half-Inch tape — no rewind with byte-swap option
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/rmt2 and /dev/rmt4 is 0x01.
SEE ALSO
Version 2.5r1 — October 29, 1986