1.\" Copyright (c) 1983, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. 9.\" 2. Redistributions in binary form must reproduce the above copyright 10.\" notice, this list of conditions and the following disclaimer in the 11.\" documentation and/or other materials provided with the distribution. 12.\" 3. All advertising materials mentioning features or use of this software 13.\" must display the following acknowledgement: 14.\" This product includes software developed by the University of 15.\" California, Berkeley and its contributors. 16.\" 4. Neither the name of the University nor the names of its contributors 17.\" may be used to endorse or promote products derived from this software 18.\" without specific prior written permission. 19.\" 20.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 21.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 24.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" @(#)mtio.4 8.1 (Berkeley) 6/5/93 33.\" 34.Dd June 5, 1993 35.Dt MTIO 4 vax 36.Os BSD 4.2 37.Sh NAME 38.Nm mtio 39.Nd 40.Tn UNIX 41magtape interface 42.Sh DESCRIPTION 43The special files 44named 45.Pa /dev/mt0 46and 47.Pa /dev/rmt0 48through 49.Pa /dev/mt23 50and 51.Pa /dev/rmt23 52refer to 53.Tn UNIX 54magtape drives, 55which may be on the 56.Tn MASSBUS 57using the 58.Tn TM03 59formatter 60.Xr ht 4 , 61or 62.Tn TM78 63formatter, 64.Xr mt 4 , 65or on the 66.Tn UNIBUS 67using either the 68.Tn TM11 69or 70.Tn TS11 71formatters 72.Xr tm 4 , 73.Tn TU45 74compatible formatters, 75.Xr ut 4 , 76or 77.Xr ts 4 . 78These devices are typical tape block devices, 79see 80.Xr physio 4 . 81.Pp 82The following table of the converntional device names 83is applicable to any of the transport/controller pairs. 84(But note that only 1600 85.Tn BPI 86is available with the 87.Tn TS11 . ) 88.Bl -column "no-rewindxxx" "or lowest densityxx" "or lowest densityxx" "or lowest densityxx" -offset indent 89 800 BPI 1600 BPI 6500 BPI 90.Em or lowest density or second density or third density 91 92Rewind mt0/rmt0 mt8/rmt8 mt16/rmt16 93Rewind mt1/rmt1 mt9/rmt9 mt17/rmt17 94Rewind mt2/rmt2 mt10/rmt10 mt18/rmt18 95Rewind mt3/rmt3 mt11/rmt11 mt19/rmt19 96No-rewind nmt4/nrmt4 nmt12/nrmt12 nmt20/nrmt20 97No-rewind nmt5/nrmt5 nmt13/nrmt13 nmt21/nrmt21 98No-rewind nmt6/nrmt6 nmt14/nrmt14 nmt22/nrmt22 99No-rewind nmt7/nrmt7 nmt15/nrmt15 nmt23/nrmt32 100.El 101.Pp 102The rewind devices automatically rewind 103when the last requested read, write or seek has finished, or the end of the tape 104has been reached. The letter 105.Ql n 106is usually prepended to 107the name of the no-rewind devices. 108.Pp 109Unix tapes are written in multiples of 1024 byte block 110records. Two end-of-file markers mark the end of a tape, and 111one end-of-file marker marks the end of a tape file. 112If the tape is not to be rewound it is positioned with the 113head in between the two tape marks, where the next write 114will over write the second end-of-file marker. 115.Pp 116All of the magtape devices may be manipulated with the 117.Xr mt 1 118command. 119.Pp 120A number of 121.Xr ioctl 2 122operations are available 123on raw magnetic tape. 124The following definitions are from 125.Aq Pa sys/mtio.h : 126.Bd -literal 127/* 128 * Structures and definitions for mag tape io control commands 129 */ 130 131/* structure for MTIOCTOP - mag tape op command */ 132struct mtop { 133 short mt_op; /* operations defined below */ 134 daddr_t mt_count; /* how many of them */ 135}; 136 137/* operations */ 138#define MTWEOF 0 /* write an end-of-file record */ 139#define MTFSF 1 /* forward space file */ 140#define MTBSF 2 /* backward space file */ 141#define MTFSR 3 /* forward space record */ 142#define MTBSR 4 /* backward space record */ 143#define MTREW 5 /* rewind */ 144#define MTOFFL 6 /* rewind and put the drive offline */ 145#define MTNOP 7 /* no operation, sets status only */ 146#define MTCACHE 8 /* enable controller cache */ 147#define MTNOCACHE 9 /* disable controller cache */ 148 149/* structure for MTIOCGET - mag tape get status command */ 150 151struct mtget { 152 short mt_type; /* type of magtape device */ 153/* the following two registers are grossly device dependent */ 154 short mt_dsreg; /* ``drive status'' register */ 155 short mt_erreg; /* ``error'' register */ 156/* end device-dependent registers */ 157 short mt_resid; /* residual count */ 158/* the following two are not yet implemented */ 159 daddr_t mt_fileno; /* file number of current position */ 160 daddr_t mt_blkno; /* block number of current position */ 161/* end not yet implemented */ 162}; 163 164/* 165 * Constants for mt_type byte. These are the same 166 * for controllers compatible with the types listed. 167 */ 168#define MT_ISTS 0x01 /* TS-11 */ 169#define MT_ISHT 0x02 /* TM03 Massbus: TE16, TU45, TU77 */ 170#define MT_ISTM 0x03 /* TM11/TE10 Unibus */ 171#define MT_ISMT 0x04 /* TM78/TU78 Massbus */ 172#define MT_ISUT 0x05 /* SI TU-45 emulation on Unibus */ 173#define MT_ISCPC 0x06 /* SUN */ 174#define MT_ISAR 0x07 /* SUN */ 175#define MT_ISTMSCP 0x08 /* DEC TMSCP protocol (TU81, TK50) */ 176#define MT_ISCY 0x09 /* CCI Cipher */ 177#define MT_ISCT 0x0a /* HP 1/4 tape */ 178#define MT_ISFHP 0x0b /* HP 7980 1/2 tape */ 179#define MT_ISEXABYTE 0x0c /* Exabyte */ 180#define MT_ISEXA8200 0x0c /* Exabyte EXB-8200 */ 181#define MT_ISEXA8500 0x0d /* Exabyte EXB-8500 */ 182#define MT_ISVIPER1 0x0e /* Archive Viper-150 */ 183#define MT_ISPYTHON 0x0f /* Archive Python (DAT) */ 184#define MT_ISHPDAT 0x10 /* HP 35450A DAT drive */ 185 186/* mag tape io control commands */ 187#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */ 188#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */ 189#define MTIOCIEOT _IO('m', 3) /* ignore EOT error */ 190#define MTIOCEEOT _IO('m', 4) /* enable EOT error */ 191 192#ifndef KERNEL 193#define DEFTAPE "/dev/rmt12" 194#endif 195 196#ifdef KERNEL 197/* 198 * minor device number 199 */ 200 201#define T_UNIT 003 /* unit selection */ 202#define T_NOREWIND 004 /* no rewind on close */ 203#define T_DENSEL 030 /* density select */ 204#define T_800BPI 000 /* select 800 bpi */ 205#define T_1600BPI 010 /* select 1600 bpi */ 206#define T_6250BPI 020 /* select 6250 bpi */ 207#define T_BADBPI 030 /* undefined selection */ 208#endif 209.Ed 210.Pp 211.Sh FILES 212.Bl -tag -width /dev/rmt? -compact 213.It Pa /dev/mt? 214.It Pa /dev/rmt? 215.El 216.Sh SEE ALSO 217.Xr mt 1 , 218.Xr tar 1 , 219.Xr tp 1 , 220.Xr ht 4 , 221.Xr tm 4 , 222.Xr ts 4 , 223.Xr mt 4 , 224.Xr ut 4 225.Sh HISTORY 226The 227.Nm mtio 228manual appeared in 229.Bx 4.2 . 230.Sh BUGS 231The status should be returned in a device independent format. 232.Pp 233The special file naming should be redone in a more consistent and 234understandable manner. 235