MT(4) MT(4) NAME mt - magtape interface SYNOPSIS #include <sys/types.h> #include <sys/mtio.h> DESCRIPTION The rmt files refer to magnetic tape drives. Filenames beginning with `rmt' are rewound when closed; those begin- ning with `nrmt' are not. When a file open for writing is closed, two file marks are written. If the tape is not to be rewound, it is positioned with the head between the two file marks. Conventionally rmt0 is 800, rmt1 is 1600, and rmt2 is 6250 bpi. Each read(2) or write call reads or writes the next record on the tape. Read returns at most a single record; the return value is the record size. If the next record is larger than the read buffer, an error is returned. A file mark causes read to return 0; the next read will return the next record. Seeks are ignored. An ioctl(2) call performs special operations: MTIOCTOP perform a suboperation encoded as below in the mt_op field of a structure whose address is passed as the third argument of ioctl. struct mtop { short mt_op; /* operation */ daddr_t mt_count; /* repeat count */ }; MTWEOF write an end-of-file record MTFSF forward space file MTBSF backward space file MTFSR forward space record MTBSR backward space record MTREW rewind MTOFFL rewind and put the drive offline The files described above provide a `raw' interface. There is also a `block' interface which attempts to treat the tape like an ordinary file as much as possible. Block tapes are accessed through files with names beginning with `mt' or `nmt'. Such a tape contains a single file, consisting of a series of 1024-byte records followed by a file mark. Seeks have their usual meaning, and it is possible to read and write a byte at a time, though writing in very small units MT(4) MT(4) may create enormous record gaps. The file always ends at the most recently written byte. Conventions for minor device numbers vary among different hardware drivers: For the TU78, the drive unit number is encoded in the two low-order bits. Adding 4 prevents the tape from rewinding at close time. Adding 8 selects 6250 bpi for writing; the default is 1600. The tape drive senses density automatically when reading. The TE16 is like the TU78, except that the default den- sity is 800 bpi, and adding 8 to the device number selects 1600. For TMSCP tape drives such as the TU81 and the TK50, the unit number is encoded in the three low-order bits. Adding 128 prevents the tape from rewinding on close. Density is selected by octal bits 070; the eight possi- ble values represent eight different device-dependent tape formats. For 9-track tape drives, add 0 for 800 bpi, 8 for 1600, 16 for 6250. For TK50 cartridge drives, add 24 (old-style block format). For TK70 drives, add 8. The tape drives sense density automati- cally on reading, but if a drive doesn't support a par- ticular density, the hardware may complain when the device is opened. FILES SEE ALSO tape(1) BUGS If any non-data error is encountered, the tape drivers gen- erally refuse to do anything more until closed. The naming convention behaves poorly with multiple tape drives. Block tape has probably outlived its usefulness.