1MTIO(4)                    Kernel Interfaces Manual                    MTIO(4)
2
3
4

NAME

6       mtio - UNIX magtape interface
7

DESCRIPTION

9       The files mt0, ..., mt15 refer to the UNIX magtape drives, which may be
10       on the MASSBUS using the TM03 formatter ht(4), or on the  UNIBUS  using
11       either  the  TM11  or  TS11  formatters  tm(4) or ts(4).  The following
12       description applies to any of the transport/controller pairs.
13
14       The files mt0, ..., mt7 are 800bpi (or the transport's lowest density),
15       mt8,  ...,  mt15  are  1600bpi (or the transport's second density), and
16       mt16, ..., mt23 are 6250bpi (or the transport's third  density).   (But
17       note  that  only  1600 bpi is available with the TS11.)  The files mt0,
18       ..., mt3, mt8, ..., mt11, and mt16, ..., mt19 are rewound when  closed;
19       the  others  are not.  When a file open for writing is closed, two end-
20       of-files are written.  If the tape is not to be  rewound  it  is  posi‐
21       tioned with the head between the two tapemarks.
22
23       A standard tape consists of a series of 1024 byte records terminated by
24       an end-of-file.  To the extent possible, the system makes it  possible,
25       if  inefficient,  to  treat  the  tape like any other file.  Seeks have
26       their usual meaning and it is possible to read or write  a  byte  at  a
27       time.   Writing in very small units is inadvisable, however, because it
28       uses most of the tape in record gaps.
29
30       The mt files discussed above are useful when it is  desired  to  access
31       the  tape  in a way compatible with ordinary files.  When foreign tapes
32       are to be dealt with, and especially when long records are to  be  read
33       or  written,  the `raw' interface is appropriate.  The associated files
34       are named rmt0, ..., rmt23, but the same minor-device considerations as
35       for  the regular files still apply.  A number of other ioctl operations
36       are available on raw magnetic tape.  The following definitions are from
37       <sys/mtio.h>:
38
39       /*
40        * Structures and definitions for mag tape io control commands
41        */
42
43       /* structure for MTIOCTOP - mag tape op command */
44       struct    mtop {
45            short     mt_op;         /* operations defined below */
46            daddr_t   mt_count; /* how many of them */
47       };
48
49       /* operations */
50       #define MTWEOF 0    /* write an end-of-file record */
51       #define MTFSF  1    /* forward space file */
52       #define MTBSF  2    /* backward space file */
53       #define MTFSR  3    /* forward space record */
54       #define MTBSR  4    /* backward space record */
55       #define MTREW  5    /* rewind */
56       #define MTOFFL 6    /* rewind and put the drive offline */
57       #define MTNOP  7    /* no operation, sets status only */
58       #define MTCACHE     8    /* enable controller cache */
59       #define MTNOCACHE   9    /* disable controller cache */
60
61       /* structure for MTIOCGET - mag tape get status command */
62
63       struct    mtget     {
64            short     mt_type;  /* type of magtape device */
65       /* the following two registers are grossly device dependent */
66            short     mt_dsreg; /* ``drive status'' register */
67            short     mt_erreg; /* ``error'' register */
68       /* end device-dependent registers */
69            short     mt_resid; /* residual count */
70       /* the following two are not yet implemented */
71            daddr_t   mt_fileno;     /* file number of current position */
72            daddr_t   mt_blkno; /* block number of current position */
73       /* end not yet implemented */
74       };
75
76       /*
77        * Constants for mt_type byte.  These are the same
78        * for other controllers compatible with the types listed.
79        */
80       #define   MT_ISTS        0x01      /* TS-11 */
81       #define   MT_ISHT        0x02      /* TM03 Massbus: TE16, TU45, TU77 */
82       #define   MT_ISTM        0x03      /* TM11/TE10 Unibus */
83       #define   MT_ISMT        0x04      /* TM78/TU78 Massbus */
84       #define   MT_ISUT        0x05      /* SI TU-45 emulation on Unibus */
85       #define   MT_ISCPC  0x06      /* SUN */
86       #define   MT_ISAR        0x07      /* SUN */
87       #define   MT_ISTMSCP     0x08      /* DEC TMSCP protocol (TU81, TK50) */
88
89       /* mag tape io control commands */
90       #define   MTIOCTOP  _IOW(m, 1, struct mtop)       /* do a mag tape op */
91       #define   MTIOCGET  _IOR(m, 2, struct mtget) /* get tape status */
92       #define MTIOCIEOT   _IO(m, 3)           /* ignore EOT error */
93       #define MTIOCEEOT   _IO(m, 4)           /* enable EOT error */
94
95       #ifndef KERNEL
96       #define   DEFTAPE   "/dev/rmt12"
97       #endif
98
99       Each  read  or  write call reads or writes the next record on the tape.
100       In the write case the record has the same length as the  buffer  given.
101       During  a  read,  the record size is passed back as the number of bytes
102       read, provided it is no greater than the buffer size; if the record  is
103       long,  an  error  is  indicated.  In raw tape I/O seeks are ignored.  A
104       zero byte count is returned when a tape mark is read, but another  read
105       will fetch the first record of the new tape file.
106
107       The  MTCACHE  and  MTNOCACHE commands do not apply to all tape drivers.
108       At present only the TMSCP driver supports those commands and then  only
109       for drives such as the TU81+.
110

FILES

112       /dev/mt?
113       /dev/rmt?
114

SEE ALSO

116       mt(1), tar(1), tp(1), ht(4), tm(4), ts(4)
117

BUGS

119       The status should be returned in a device independent format.
120
121       The  special  file  naming  should  be  redone in a more consistent and
122       understandable manner.
123
124
125
1263rd Berkeley Distribution      December 22, 1995                       MTIO(4)
Impressum