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