Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mt(4) — GDT-UNX 6.8_er0

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mt(1)

tar(1)

tp(1)

ht(4)

tm(4)

ts(4)

MT(4)  —  UNIX Programmer’s Manual

NAME

mt − UNIX magtape interface

DESCRIPTION

The files mt0, ..., mt15 refer to the UNIX magtape drives, which may be on the MASSBUS using the TM03 formatter ht(4), or on the UNIBUS using either the TM11 or TS11 formatters tm(4) or ts(4). The following description applies to any of the transport/controller pairs. The files mt0, ..., mt7 are 800bpi, and mt8, ..., mt15 are 1600bpi.  (But note that only 1600 bpi is available with the TS11.)  The files mt0, ..., mt3 and mt8, ..., mt11 are rewound when closed; the others are not.  When a file open for writing 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. 

A standard tape consists of a series of 1024 byte records terminated by an end-of-file.  To the extent possible, the system makes it possible, if inefficient, to treat the tape like any other file.  Seeks have their usual meaning and it is possible to read or write a byte at a time.  Writing in very small units is inadvisable, however, because it tends to create monstrous record gaps. 

The mt files discussed above are 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 rmt0, ..., rmt15, but the same minor-device considerations as for the regular files still apply.  A number of other ioctl operations are available on raw magnetic tape.  The following definitions are from <sys/mtio.h>:

/\(**
 \(** Structures and definitions for mag tape io control commands
 \(**/
 /\(** mag tape io control commands \(**/
#define MTIOCTOP((’m’<<8)|1)/\(** do a mag tape op \(**/
#define MTIOCGET((’m’<<8)|2)/\(** get mag tape status \(**/
 /\(** structure for MTIOCTOP - mag tape op command \(**/
structmtop{
shortmt_op;/\(** operations defined below \(**/
daddr_tmt_count;/\(** how many of them \(**/
};
 /\(** operations \(**/
#define MTWEOF0/\(** write an end-of-file record \(**/
#define MTFSF1/\(** forward space file \(**/
#define MTBSF2/\(** backward space file \(**/
#define MTFSR3/\(** forward space record \(**/
#define MTBSR4/\(** backward space record \(**/
#define MTREW5/\(** rewind \(**/
#define MTOFFL6/\(** rewind and put the drive offline \(**/
#define MTNOP7/\(** no operation, sets status only \(**/
 /\(** 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_t mt_fileno;/\(** file number of current position \(**/
daddr_t mt_blkno;/\(** block number of current position \(**/
/\(** end not yet implemented \(**/
};
 /\(**
 \(** Constants for mt_type byte
 \(**/
#define MT_ISTS01
#define MT_ISHT02
#define MT_ISTM03

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; if the record is long, an error is indicated.  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. 

FILES

/dev/mt?, /dev/rmt? 

SEE ALSO

mt(1), tar(1), tp(1), ht(4), tm(4), ts(4)

BUGS

August 03, 1983  —  4/1/81

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