Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mtio(4) — AOS 4.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

mt(1)

tar(1)

tp(1)

st(4)

MTIO(4)  —  

NAME

mtio − magtape interface

DESCRIPTION

The files st0, rst0, nst0, nrst0 refer to the IBM RT PC streaming tape drive, st(4). The files st0 and rst0 are rewound when closed; the others are not.  When a file open for writing is closed, two ends-of-file are written. 

A standard tape consists of a series of 512 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.  Due to hardware limitations, reads and writes cannot be intermingled, and writing always truncates the tape (not just the file) at that point. 

The st 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 the “raw” interface is appropriate.  The associated files are named rst0 and nrst0. 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
 ∗/
 /∗ 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 ∗/
#define MTERASE 8/∗ for streamer: erase tape ∗/
#define MTRETENSION9/∗ for streamer: retension 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
#defineMT_ISHT0x02
#defineMT_ISTM0x03
#defineMT_ISMT0x04
#defineMT_ISUT0x05
#defineMT_ISCPC0x06
#defineMT_ISAR0x07
#defineMT_ISST0x08
 /∗ 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

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. 

Note that certain tapes do not have this capability.  See the device manual page for details. 

FILES

/dev/{n,}st
/dev/{n,}rst

SEE ALSO

mt(1), tar(1), tp(1), st(4)

BUGS

The status should be returned in a device-independent format. 

The default tape doesn’t apply to the IBM RT PC. 

PRPQs 5799-WZQ/5799-PFF: IBM/4.3  —  July 1987

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