Commit | Line | Data |
---|---|---|
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 | |
10 | mtio \- UNIX magtape interface | |
11 | .SH DESCRIPTION | |
12 | The files | |
13 | .I "mt0, ..., mt15" | |
14 | refer to the UNIX magtape drives, | |
15 | which may be on the MASSBUS using the TM03 formatter | |
16 | .IR ht (4), | |
17 | or TM78 formatter, | |
18 | .IR mt (4), | |
19 | or on the UNIBUS using either the TM11 or TS11 formatters | |
20 | .IR tm (4), | |
21 | TU45 compatible formatters, | |
22 | .IR ut (4), | |
23 | or | |
24 | .IR ts (4). | |
25 | The following description applies to any of the transport/controller pairs. | |
26 | The files | |
27 | .I "mt0, ..., mt7" | |
249fe986 | 28 | are 800bpi (or the transport's lowest density), |
79540a66 | 29 | .I "mt8, ..., mt15" |
249fe986 | 30 | are 1600bpi (or the transport's second density), and |
79540a66 | 31 | .I "mt16, ..., mt23" |
249fe986 | 32 | are 6250bpi (or the transport's third density). |
79540a66 KM |
33 | (But note that only 1600 bpi is available with the TS11.) |
34 | The files | |
35 | .IR "mt0, ..., mt3" , | |
36 | .IR "mt8, ..., mt11" , | |
37 | and | |
38 | .I "mt16, ..., mt19" | |
39 | are rewound when closed; the others are not. | |
40 | When a file open for writing is closed, two end-of-files are written. | |
41 | If the tape is not to be rewound | |
42 | it is positioned with the head between the two | |
43 | tapemarks. | |
44 | .PP | |
45 | A standard tape consists of a | |
46 | series of 1024 byte records terminated by an | |
47 | end-of-file. | |
48 | To the extent possible, the system makes | |
49 | it possible, if inefficient, to treat | |
50 | the tape like any other file. | |
51 | Seeks have their usual meaning and it is possible | |
52 | to read or write a byte at a time. | |
53 | Writing in very small units is inadvisable, | |
249fe986 | 54 | however, because it uses most of the tape in record |
79540a66 KM |
55 | gaps. |
56 | .PP | |
57 | The | |
58 | .I mt | |
59 | files discussed above are useful | |
60 | when it is desired to access the tape in a way | |
61 | compatible with ordinary files. | |
62 | When foreign tapes are to be dealt with, and especially | |
63 | when long records are to be read or written, the | |
64 | `raw' interface is appropriate. | |
65 | The associated files are named | |
66 | .I "rmt0, ..., rmt23," | |
67 | but the same minor-device considerations as for the regular files still apply. | |
68 | A number of other ioctl operations are available | |
69 | on raw magnetic tape. | |
70 | The 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 */ | |
79 | struct 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 | ||
98 | struct 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 | |
136 | Each | |
137 | .I read | |
138 | or | |
139 | .I write | |
140 | call reads or writes the next record on the tape. | |
141 | In the write case the record has the same length as the | |
142 | buffer given. | |
143 | During a read, the record size is passed | |
144 | back as the number of bytes read, provided it is no greater | |
145 | than the buffer size; | |
146 | if the record is long, an error is indicated. | |
147 | In raw tape I/O seeks are ignored. | |
148 | A zero byte count is returned when a tape mark is read, | |
149 | but another read will fetch the first record of the | |
150 | new tape file. | |
151 | .SH FILES | |
152 | /dev/mt? | |
153 | .br | |
154 | /dev/rmt? | |
155 | .SH "SEE ALSO" | |
156 | mt(1), | |
157 | tar(1), | |
158 | tp(1), | |
159 | ht(4), | |
160 | tm(4), | |
161 | ts(4), | |
162 | mt(4), | |
163 | ut(4) | |
164 | .SH BUGS | |
165 | The status should be returned in a device independent format. | |
249fe986 MK |
166 | .PP |
167 | The special file naming should be redone in a more consistent and | |
168 | understandable manner. |