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.
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 records terminated by an end-of-file, where each record is a multiple of 512 bytes. 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 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 */
#define MTWEOF 0 /* write an end-of-file record */
#define MTFSF 1 /* forward space file */
#define MTBSF 2 /* backward space file */
#define MTFSR 3 /* forward space record */
#define MTBSR 4 /* backward space record */
#define MTREW 5 /* rewind */
#define MTOFFL 6 /* offline - not used */
#define MTNOP 7 /* no operation, sets status only */
#define MTERASE 8 /* Erase function */
#define MTRET 9 /* Retention function */
#define MTBLKSIZE 10 /* Return Default Block Size from ioctl */
#define MTRESET 11 /* Reset the controller */
/* structure for MTIOCGET - mag tape get status command */
structmtget {
short mt_type; /* type of magtape device */
short mt_hard_error0; /* drive/controller status register */
short mt_hard_error1; /* hard error register */
short mt_soft_error0; /* soft error register */
short mt_at_bot;
int mt_resid; /* residual count (not done in prev I/O) */
daddr_t mt_status;
daddr_t mt_fileno; /* file number of current position */
daddr_t mt_blkno; /* block number of current position */
};
/*
* flags for the drive status
*/
#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
*/
#define MT_ISDSD 0x01 /* DSD and 1/4" tape drives */
#define MT_ISTMT 0x02 /* Ciprico TM-1000 and 1/2" drives */
#define MT_ISSTT 0x03 /* Storager and 1/4" tape drives */
/* mag tape io control commands */
#define MTIOCTOP ((’m’<<8)|1)
#define MTIOCGET ((’m’<<8)|2)
FILES
/dev/rmt1Cartridge tape
/dev/rmt2Cartridge tape — no rewind
/dev/rmt3Half-Inch tape
/dev/rmt4Half-Inch tape — no rewind
The minor device numbers for each of the above devices to build special files using mknod(1M) 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 3.6 — December 20, 1987