MTIO(7) MTIO(7)
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 */
struct mtop {
Page 1 (last mod. 8/20/87)
MTIO(7) MTIO(7)
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 /* off-line */
#define MTNOP 7 /* no operation, sets status only */
#define MTRET 8 /* retension the tape */
#define MTRST 9 /* reset operation */
/* structure for MTIOCGET - mag tape get status command */
struct mtget {
short mt_type;/* type of magtape device */
/* the following two registers are very device dependent */
short mt_dsreg; /* 'drive status' register */
short mt_erreg; /* 'error' register */
/* end device-dependent registers */
short mt_resid; /* residual count */
/* the following two are not yet implemented */
daddr_t mt_fileno; /*file number of current position*/
daddr_t mt_blkno; /*block number of current position*/
/* end not yet implemented */
};
Status and Error register definitions can be found in
/usr/include/sys/tsreg.h. Definitions are consistent among all
quarter inch cartridge magtape drives.
/*
* Constants for mt_type byte
*/
#define MT_ISQIC 0x01 /* qic-02 tape controller */
#define MT_ISXM 0x08/* Xylogics magtape */
#define MT_ISCPHR 0x09 /* Cipher 540S tape drive */
/* mag tape io control commands */
#define MTIOCODE(x) ('t'<<8|(x))
#define MTIOCTOP MTIOCODE('a')/* perform tape op */
#define MTIOCGET MTIOCODE('b')/* get tape status */
#define MTIOCGETBLKSIZE MTIOCODE('c')/* get tape block size */
Each read or write call uses the next record on the tape.
FILES
/dev/rmt1 Cartridge tape
/dev/rmt2 Cartridge tape - no rewind
Page 2 (last mod. 8/20/87)
MTIO(7) MTIO(7)
/dev/rmt3 Half-Inch tape
/dev/rmt4 Half-Inch tape - no rewind
/dev/bsrmt3 Half-Inch tape with byte-swap option
/dev/bsrmt4 Half-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
mt(1), tar(1), cpio(1)
ORIGIN
4.3 BSD
Page 3 (last mod. 8/20/87)