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