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