Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mt(1)

tar(1)

ar(4S)

tm(4S)

st(4S)

xt(4S)

MTIO(4)  —  SPECIAL FILES

NAME

mtio − UNIX system magnetic tape interface

SYNOPSIS

#include <sys/ioctl.h>
#include <sys/mtio.h>

DESCRIPTION

The files mt0, ..., mt15 refer to the UNIX system magnetic tape drives, which read and write magnetic tape in 2048 byte blocks (the 2048 is actually BLKDEV_IOSIZE in <sys/param.h>).  The following description applies to any of the transport/controller pairs.  The files mt0, ..., mt3 and mt8, ..., mt11 are rewound when closed; the others are not.  When a nine track tape file, open for writing or just written, is closed, two end-of-files are written; if the tape is not to be rewound it is positioned with the head between the two tapemarks.  When a 1/4" tape file, (due to a bug, only if) just written, is closed, only one end of file mark is written because of the inability to overwrite data on a 1/4" tape; see below. 

1/4" tapes are not able to back up and always write fixed sized blocks.  Since they cannot back up, they cannot support backward space file and backward space record.  Since they always write fixed sized blocks, the size of transfers using the raw interface (see below) must be a multiple of the underlying blocksize, usually 512 bytes. 

1/4" tapes also have an unusual tape format.  They have parallel tracks, but only record information on one track at a time, switching to another track near the physical end of the medium.  They erase all the tracks at once while writing the first track.  Therefore, they cannot, in general, overwrite previously written data.  If the old data were not on the first track, it would not be erased before being overwritten, and the result would be unreadable. 

The mt files discussed above are useful when it you want to access the tape in a way compatible with ordinary files.  When using foreign tapes, and especially when reading or writing long records, the ‘raw’ interface is appropriate.  The associated files are named rmt0, ..., rmt15, but the same minor-device considerations as for the regular files still apply.  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.  During a read, the record size is passed back as the number of bytes read, provided it is no greater than the buffer size.  In raw tape I/O seeks are ignored.  A zero byte count is returned when a tape mark is read, but another read will fetch the first record of the new tape file. 

A number of additional ioctl operations are available on raw magnetic tape.  The following definitions are from <sys/mtio.h>:

/∗
 ∗ Structures and definitions for mag tape I/O control commands
 ∗/
 /∗ structure for MTIOCTOP - mag tape op command ∗/
structmtop{
shortmt_op;/∗ operations defined below ∗/
daddr_tmt_count;/∗ how many of them ∗/
};
 /∗ operations ∗/
#defineMTWEOF0/∗ write an end-of-file record ∗/
#defineMTFSF1/∗ forward space file ∗/
#defineMTBSF2/∗ backward space file ∗/
#defineMTFSR3/∗ forward space record ∗/
#defineMTBSR4/∗ backward space record ∗/
#defineMTREW5/∗ rewind ∗/
#defineMTOFFL6/∗ rewind and put the drive offline ∗/
#defineMTNOP7/∗ no operation, sets status only ∗/
#defineMTRETEN8/∗ retension the tape ∗/
#defineMTERASE9/∗ erase the entire tape ∗/
 /∗ structure for MTIOCGET - mag tape get status command ∗/
 structmtget{
shortmt_type;/∗ type of magtape device ∗/
/∗ the following two registers are grossly device dependent ∗/
shortmt_dsreg;/∗ “drive status” register ∗/
shortmt_erreg;/∗ “error” register ∗/
/∗ end device-dependent registers ∗/
shortmt_resid;/∗ residual count ∗/
/∗ the following two are not yet implemented ∗/
daddr_tmt_fileno;/∗ file number of current position ∗/
daddr_tmt_blkno;/∗ block number of current position ∗/
/∗ end not yet implemented ∗/
};
 /∗
 ∗ Constants for mt_type byte
 ∗/
#defineMT_ISTS0x01/∗ vax: unibus ts-11 ∗/
#defineMT_ISHT0x02/∗ vax: massbus tu77, etc ∗/
#defineMT_ISTM0x03/∗ vax: unibus tm-11 ∗/
#defineMT_ISMT0x04/∗ vax: massbus tu78 ∗/
#defineMT_ISUT0x05/∗ vax: unibus gcr ∗/
#defineMT_ISCPC0x06/∗ sun: Multibus tapemaster ∗/
#defineMT_ISAR0x07/∗ sun: Multibus archive ∗/
#defineMT_ISSC0x08/∗ sun: SCSI archive ∗/
#defineMT_ISXY0x09/∗ sun: Xylogics 472 ∗/
 /∗ mag tape io control commands ∗/
#defineMTIOCTOP_IOW(m, 1, struct mtop)/∗ do a mag tape op ∗/
#defineMTIOCGET_IOR(m, 2, struct mtget)/∗ get tape status ∗/
 #ifndef KERNEL
#defineDEFTAPE"/dev/rmt12"
#endif

FILES

/dev/mt∗
/dev/rmt∗
/dev/rar∗

SEE ALSO

mt(1), tar(1), ar(4S), tm(4S), st(4S), xt(4S)

Sun Release 3.2  —  Last change: 26 July 1985

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026