BSD 4_3 release
[unix-history] / usr / man / man4 / mtio.4
CommitLineData
79540a66
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
95f51977 5.\" @(#)mtio.4 6.2 (Berkeley) 5/16/86
79540a66 6.\"
95f51977 7.TH MTIO 4 "May 16, 1986"
79540a66
KM
8.UC 5
9.SH NAME
10mtio \- UNIX magtape interface
11.SH DESCRIPTION
12The files
13.I "mt0, ..., mt15"
14refer to the UNIX magtape drives,
15which may be on the MASSBUS using the TM03 formatter
16.IR ht (4),
17or TM78 formatter,
18.IR mt (4),
19or on the UNIBUS using either the TM11 or TS11 formatters
20.IR tm (4),
21TU45 compatible formatters,
22.IR ut (4),
23or
24.IR ts (4).
25The following description applies to any of the transport/controller pairs.
26The files
27.I "mt0, ..., mt7"
249fe986 28are 800bpi (or the transport's lowest density),
79540a66 29.I "mt8, ..., mt15"
249fe986 30are 1600bpi (or the transport's second density), and
79540a66 31.I "mt16, ..., mt23"
249fe986 32are 6250bpi (or the transport's third density).
79540a66
KM
33(But note that only 1600 bpi is available with the TS11.)
34The files
35.IR "mt0, ..., mt3" ,
36.IR "mt8, ..., mt11" ,
37and
38.I "mt16, ..., mt19"
39are rewound when closed; the others are not.
40When a file open for writing is closed, two end-of-files are written.
41If the tape is not to be rewound
42it is positioned with the head between the two
43tapemarks.
44.PP
45A standard tape consists of a
46series of 1024 byte records terminated by an
47end-of-file.
48To the extent possible, the system makes
49it possible, if inefficient, to treat
50the tape like any other file.
51Seeks have their usual meaning and it is possible
52to read or write a byte at a time.
53Writing in very small units is inadvisable,
249fe986 54however, because it uses most of the tape in record
79540a66
KM
55gaps.
56.PP
57The
58.I mt
59files discussed above are useful
60when it is desired to access the tape in a way
61compatible with ordinary files.
62When foreign tapes are to be dealt with, and especially
63when long records are to be read or written, the
64`raw' interface is appropriate.
65The associated files are named
66.I "rmt0, ..., rmt23,"
67but the same minor-device considerations as for the regular files still apply.
68A number of other ioctl operations are available
69on raw magnetic tape.
70The following definitions are from
71.RI < sys/mtio.h >:
72.PP
73.nf
74/*
75 * Structures and definitions for mag tape io control commands
76 */
77
78/* structure for MTIOCTOP - mag tape op command */
79struct mtop {
80 short mt_op; /* operations defined below */
81 daddr_t mt_count; /* how many of them */
82};
83
84/* operations */
85#define MTWEOF 0 /* write an end-of-file record */
86#define MTFSF 1 /* forward space file */
87#define MTBSF 2 /* backward space file */
88#define MTFSR 3 /* forward space record */
89#define MTBSR 4 /* backward space record */
90#define MTREW 5 /* rewind */
91#define MTOFFL 6 /* rewind and put the drive offline */
92#define MTNOP 7 /* no operation, sets status only */
249fe986
MK
93#define MTCACHE 8 /* enable controller cache */
94#define MTNOCACHE 9 /* disable controller cache */
79540a66
KM
95
96/* structure for MTIOCGET - mag tape get status command */
97
98struct mtget {
99 short mt_type; /* type of magtape device */
100/* the following two registers are grossly device dependent */
101 short mt_dsreg; /* ``drive status'' register */
102 short mt_erreg; /* ``error'' register */
103/* end device-dependent registers */
104 short mt_resid; /* residual count */
105/* the following two are not yet implemented */
106 daddr_t mt_fileno; /* file number of current position */
107 daddr_t mt_blkno; /* block number of current position */
108/* end not yet implemented */
109};
110
111/*
249fe986
MK
112 * Constants for mt_type byte. These are the same
113 * for other controllers compatible with the types listed.
79540a66 114 */
249fe986
MK
115#define MT_ISTS 0x01 /* TS-11 */
116#define MT_ISHT 0x02 /* TM03 Massbus: TE16, TU45, TU77 */
117#define MT_ISTM 0x03 /* TM11/TE10 Unibus */
118#define MT_ISMT 0x04 /* TM78/TU78 Massbus */
119#define MT_ISUT 0x05 /* SI TU-45 emulation on Unibus */
120#define MT_ISCPC 0x06 /* SUN */
121#define MT_ISAR 0x07 /* SUN */
122#define MT_ISTMSCP 0x08 /* DEC TMSCP protocol (TU81, TK50) */
79540a66
KM
123
124/* mag tape io control commands */
125#define MTIOCTOP _IOW(m, 1, struct mtop) /* do a mag tape op */
126#define MTIOCGET _IOR(m, 2, struct mtget) /* get tape status */
249fe986
MK
127#define MTIOCIEOT _IO(m, 3) /* ignore EOT error */
128#define MTIOCEEOT _IO(m, 4) /* enable EOT error */
79540a66
KM
129
130#ifndef KERNEL
131#define DEFTAPE "/dev/rmt12"
132#endif
133.fi
134.ft R
135.PP
136Each
137.I read
138or
139.I write
140call reads or writes the next record on the tape.
141In the write case the record has the same length as the
142buffer given.
143During a read, the record size is passed
144back as the number of bytes read, provided it is no greater
145than the buffer size;
146if the record is long, an error is indicated.
147In raw tape I/O seeks are ignored.
148A zero byte count is returned when a tape mark is read,
149but another read will fetch the first record of the
150new tape file.
151.SH FILES
152/dev/mt?
153.br
154/dev/rmt?
155.SH "SEE ALSO"
156mt(1),
157tar(1),
158tp(1),
159ht(4),
160tm(4),
161ts(4),
162mt(4),
163ut(4)
164.SH BUGS
165The status should be returned in a device independent format.
249fe986
MK
166.PP
167The special file naming should be redone in a more consistent and
168understandable manner.