Commit | Line | Data |
---|---|---|
6d5259d5 KM |
1 | .\" Copyright (c) 1980 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
5 | .\" @(#)mtop.4 4.1 (Berkeley) %G% | |
6 | .\" | |
7 | .TH MTOP 4 10/8/81 | |
8 | .UC 4 | |
9 | .SH NAME | |
10 | mt \- 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 or TM78 formatters | |
16 | .IR ht (4) | |
17 | or | |
18 | .IR mt (4), | |
19 | or on the UNIBUS using either the TM11, TS11, or TU45 formatters | |
20 | .IR tm (4), | |
21 | .IR ts (4) | |
22 | or | |
23 | .IR ut (4). | |
24 | The following description applies to any of the transport/controller pairs. | |
25 | The files | |
26 | .I "mt0, ..., mt7" | |
27 | are low density, and | |
28 | .I "mt8, ..., mt15" | |
29 | are high density. | |
30 | On the TM03 and TM11 low density is 800bpi and high density is 1600bpi. | |
31 | On the TM78 low density is 1600bpi and high density is 6250bpi. | |
32 | On the TS11 both low and high density are 1600bpi. | |
33 | The files | |
34 | .I "mt0, ..., mt3" | |
35 | and | |
36 | .I "mt8, ..., mt11" | |
37 | are rewound when closed; the others are not. | |
38 | When a file open for writing is closed, two end-of-files are written. | |
39 | If the tape is not to be rewound | |
40 | it is positioned with the head between the two | |
41 | tapemarks. | |
42 | .PP | |
43 | A standard tape consists of a | |
44 | series of 1024 byte records terminated by an | |
45 | end-of-file. | |
46 | To the extent possible, the system makes | |
47 | it possible, if inefficient, to treat | |
48 | the tape like any other file. | |
49 | Seeks have their usual meaning and it is possible | |
50 | to read or write a byte at a time. | |
51 | Writing in very small units is inadvisable, | |
52 | however, because it tends to create monstrous record | |
53 | gaps. | |
54 | .PP | |
55 | The | |
56 | .I mt | |
57 | files discussed above are useful | |
58 | when it is desired to access the tape in a way | |
59 | compatible with ordinary files. | |
60 | When foreign tapes are to be dealt with, and especially | |
61 | when long records are to be read or written, the | |
62 | `raw' interface is appropriate. | |
63 | The associated files are named | |
64 | .I "rmt0, ..., rmt15," | |
65 | but the same minor-device considerations as for the regular files still apply. | |
66 | A number of other ioctl operations are available | |
67 | on raw magnetic tape. | |
68 | The following definitions are from <sys/mtio.h>: | |
69 | .PP | |
70 | .nf | |
71 | /* | |
72 | * Structures and definitions for mag tape io control commands | |
73 | */ | |
74 | ||
75 | /* mag tape io control commands */ | |
76 | #define MTIOCTOP (('m'<<8)|1) /* do a mag tape op */ | |
77 | #define MTIOCGET (('m'<<8)|2) /* get mag tape status */ | |
78 | ||
79 | /* structure for MTIOCTOP - mag tape op command */ | |
80 | struct mtop { | |
81 | short mt_op; /* operations defined below */ | |
82 | daddr_t mt_count; /* how many of them */ | |
83 | }; | |
84 | ||
85 | /* operations */ | |
86 | #define MTWEOF 0 /* write an end-of-file record */ | |
87 | #define MTFSF 1 /* forward space file */ | |
88 | #define MTBSF 2 /* backward space file */ | |
89 | #define MTFSR 3 /* forward space record */ | |
90 | #define MTBSR 4 /* backward space record */ | |
91 | #define MTREW 5 /* rewind */ | |
92 | #define MTOFFL 6 /* rewind and put the drive offline */ | |
93 | #define MTNOP 7 /* no operation, sets status only */ | |
94 | ||
95 | /* structure for MTIOCGET - mag tape get status command */ | |
96 | ||
97 | struct mtget { | |
98 | short mt_type; /* type of magtape device */ | |
99 | /* the following two registers are grossly device dependent */ | |
100 | short mt_dsreg; /* ``drive status'' register */ | |
101 | short mt_erreg; /* ``error'' register */ | |
102 | /* end device-dependent registers */ | |
103 | short mt_resid; /* residual count */ | |
104 | /* the following two are not yet implemented */ | |
105 | daddr_t mt_fileno; /* file number of current position */ | |
106 | daddr_t mt_blkno; /* block number of current position */ | |
107 | /* end not yet implemented */ | |
108 | }; | |
109 | ||
110 | /* | |
111 | * Constants for mt_type byte | |
112 | */ | |
113 | #define MT_ISTS 01 | |
114 | #define MT_ISHT 02 | |
115 | #define MT_ISTM 03 | |
116 | #define MT_ISMT 04 | |
117 | #define MT_ISUT 05 | |
118 | .fi | |
119 | .ft R | |
120 | .PP | |
121 | Each | |
122 | .I read | |
123 | or | |
124 | .I write | |
125 | call reads or writes the next record on the tape. | |
126 | In the write case the record has the same length as the | |
127 | buffer given. | |
128 | During a read, the record size is passed | |
129 | back as the number of bytes read, provided it is no greater | |
130 | than the buffer size; | |
131 | if the record is long, an error is indicated. | |
132 | In raw tape I/O seeks are ignored. | |
133 | A zero byte count is returned when a tape mark is read, | |
134 | but another read will fetch the first record of the | |
135 | new tape file. | |
136 | .SH FILES | |
137 | /dev/mt?, | |
138 | /dev/rmt? | |
139 | .SH "SEE ALSO" | |
140 | mt(1), tar(1), tp(1), ht(4), mt(4), tm(4), ts(4) | |
141 | .SH BUGS |