1c2466934SMike Pritchard.\" Copyright (c) 1996 2c2466934SMike Pritchard.\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved. 3c2466934SMike Pritchard.\" 4c2466934SMike Pritchard.\" Copyright (c) 1983, 1991, 1993 5c2466934SMike Pritchard.\" The Regents of the University of California. All rights reserved. 6c2466934SMike Pritchard.\" 7c2466934SMike Pritchard.\" Redistribution and use in source and binary forms, with or without 8c2466934SMike Pritchard.\" modification, are permitted provided that the following conditions 9c2466934SMike Pritchard.\" are met: 10c2466934SMike Pritchard.\" 1. Redistributions of source code must retain the above copyright 11c2466934SMike Pritchard.\" notice, this list of conditions and the following disclaimer. 12c2466934SMike Pritchard.\" 2. Redistributions in binary form must reproduce the above copyright 13c2466934SMike Pritchard.\" notice, this list of conditions and the following disclaimer in the 14c2466934SMike Pritchard.\" documentation and/or other materials provided with the distribution. 15c2466934SMike Pritchard.\" 3. All advertising materials mentioning features or use of this software 16c2466934SMike Pritchard.\" must display the following acknowledgement: 17c2466934SMike Pritchard.\" This product includes software developed by the University of 18c2466934SMike Pritchard.\" California, Berkeley and its contributors. 19c2466934SMike Pritchard.\" 4. Neither the name of the University nor the names of its contributors 20c2466934SMike Pritchard.\" may be used to endorse or promote products derived from this software 21c2466934SMike Pritchard.\" without specific prior written permission. 22c2466934SMike Pritchard.\" 23c2466934SMike Pritchard.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24c2466934SMike Pritchard.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25c2466934SMike Pritchard.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26c2466934SMike Pritchard.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27c2466934SMike Pritchard.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28c2466934SMike Pritchard.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29c2466934SMike Pritchard.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30c2466934SMike Pritchard.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31c2466934SMike Pritchard.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32c2466934SMike Pritchard.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33c2466934SMike Pritchard.\" SUCH DAMAGE. 34c2466934SMike Pritchard.\" 35c2466934SMike Pritchard.\" @(#)mtio.4 8.1 (Berkeley) 6/5/93 36c2466934SMike Pritchard.\" 37c2466934SMike Pritchard.Dd February 11, 1996 38c2466934SMike Pritchard.Dt MTIO 4 i386 39c2466934SMike Pritchard.Os FreeBSD 2.2 40c2466934SMike Pritchard.Sh NAME 41c2466934SMike Pritchard.Nm mtio 42c2466934SMike Pritchard.Nd 43c2466934SMike Pritchard.Tn FreeBSD 44c2466934SMike Pritchardmagtape interface 45c2466934SMike Pritchard.Sh DESCRIPTION 46c2466934SMike PritchardThe special files 47c2466934SMike Pritchardnamed 48c2466934SMike Pritchard.Pa /dev/[nr]st* 49c2466934SMike Pritchardrefer to SCSI tape drives, 50c2466934SMike Pritchardwhich may be attached to the system. 51c2466934SMike Pritchard.Pa /dev/[nr]st*.ctl 52c2466934SMike Pritchardare control devices that can be used to issue ioctls to the SCSI 53c2466934SMike Pritchardtape driver to set parameters that are required to last beyond the 54c2466934SMike Pritchardunmounting of a tape. 55c2466934SMike Pritchard.Pp 56c2466934SMike Pritchard.Pp 57c2466934SMike PritchardThe rewind devices automatically rewind 58c2466934SMike Pritchardwhen the last requested read, write or seek has finished, or the end of the tape 59c2466934SMike Pritchardhas been reached. The letter 60c2466934SMike Pritchard.Ql n 61c2466934SMike Pritchardis usually prepended to 62c2466934SMike Pritchardthe name of the no-rewind devices. 63c2466934SMike Pritchard.Pp 64c2466934SMike PritchardTapes can be written with either fixed length records or variable length 65c2466934SMike Pritchardrecords. See 66c2466934SMike Pritchard.Xr st 4 67c2466934SMike Pritchardfor more information. Two end-of-file markers mark the end of a tape, and 68c2466934SMike Pritchardone end-of-file marker marks the end of a tape file. 69c2466934SMike PritchardIf the tape is not to be rewound it is positioned with the 70c2466934SMike Pritchardhead in between the two tape marks, where the next write 71c2466934SMike Pritchardwill over write the second end-of-file marker. 72c2466934SMike Pritchard.Pp 73c2466934SMike PritchardAll of the magtape devices may be manipulated with the 74c2466934SMike Pritchard.Xr mt 1 75c2466934SMike Pritchardcommand. 76c2466934SMike Pritchard.Pp 77c2466934SMike PritchardA number of 78c2466934SMike Pritchard.Xr ioctl 2 79c2466934SMike Pritchardoperations are available 80c2466934SMike Pritchardon raw magnetic tape. 81c2466934SMike PritchardThe following definitions are from 82c2466934SMike Pritchard.Aq Pa sys/mtio.h : 83c2466934SMike Pritchard.Bd -literal 84c2466934SMike Pritchard/* 85c2466934SMike Pritchard * Structures and definitions for mag tape io control commands 86c2466934SMike Pritchard */ 87c2466934SMike Pritchard 88c2466934SMike Pritchard/* structure for MTIOCTOP - mag tape op command */ 89c2466934SMike Pritchardstruct mtop { 90c2466934SMike Pritchard short mt_op; /* operations defined below */ 91c2466934SMike Pritchard daddr_t mt_count; /* how many of them */ 92c2466934SMike Pritchard}; 93c2466934SMike Pritchard 94c2466934SMike Pritchard/* operations */ 95c2466934SMike Pritchard#define MTWEOF 0 /* write an end-of-file record */ 96c2466934SMike Pritchard#define MTFSF 1 /* forward space file */ 97c2466934SMike Pritchard#define MTBSF 2 /* backward space file */ 98c2466934SMike Pritchard#define MTFSR 3 /* forward space record */ 99c2466934SMike Pritchard#define MTBSR 4 /* backward space record */ 100c2466934SMike Pritchard#define MTREW 5 /* rewind */ 101c2466934SMike Pritchard#define MTOFFL 6 /* rewind and put the drive offline */ 102c2466934SMike Pritchard#define MTNOP 7 /* no operation, sets status only */ 103c2466934SMike Pritchard#define MTCACHE 8 /* enable controller cache */ 104c2466934SMike Pritchard#define MTNOCACHE 9 /* disable controller cache */ 105c2466934SMike Pritchard 106c2466934SMike Pritchard#if defined(__FreeBSD__) 107c2466934SMike Pritchard/* Set block size for device. If device is a variable size dev */ 108c2466934SMike Pritchard/* a non zero parameter will change the device to a fixed block size */ 109c2466934SMike Pritchard/* device with block size set to that of the parameter passed in. */ 110c2466934SMike Pritchard/* Resetting the block size to 0 will restore the device to a variable */ 111c2466934SMike Pritchard/* block size device. */ 112c2466934SMike Pritchard 113c2466934SMike Pritchard#define MTSETBSIZ 10 114c2466934SMike Pritchard 115c2466934SMike Pritchard/* Set density values for device. They are defined in the SCSI II spec */ 116c2466934SMike Pritchard/* and range from 0 to 0x17. Sets the value for the opened mode only */ 117c2466934SMike Pritchard 118c2466934SMike Pritchard#define MTSETDNSTY 11 119c2466934SMike Pritchard 120c2466934SMike Pritchard#define MTERASE 12 /* erase to EOM */ 121c2466934SMike Pritchard#define MTEOD 13 /* Space to EOM */ 122c2466934SMike Pritchard#define MTCOMP 14 /* select compression mode 0=off, 1=def */ 123c2466934SMike Pritchard#define MTRETENS 15 /* re-tension tape */ 124c2466934SMike Pritchard 125c2466934SMike Pritchard#endif 126c2466934SMike Pritchard 127c2466934SMike Pritchard/* structure for MTIOCGET - mag tape get status command */ 128c2466934SMike Pritchard 129c2466934SMike Pritchardstruct mtget { 130c2466934SMike Pritchard short mt_type; /* type of magtape device */ 131c2466934SMike Pritchard/* the following two registers are grossly device dependent */ 132c2466934SMike Pritchard short mt_dsreg; /* ``drive status'' register */ 133c2466934SMike Pritchard short mt_erreg; /* ``error'' register */ 134c2466934SMike Pritchard/* end device-dependent registers */ 135c2466934SMike Pritchard short mt_resid; /* residual count */ 136c2466934SMike Pritchard#if defined (__FreeBSD__) 137c2466934SMike Pritchard daddr_t mt_blksiz; /* presently operating blocksize */ 138c2466934SMike Pritchard daddr_t mt_density; /* presently operating density */ 139c2466934SMike Pritchard daddr_t mt_comp; /* presently operating compression */ 140c2466934SMike Pritchard daddr_t mt_blksiz0; /* blocksize for mode 0 */ 141c2466934SMike Pritchard daddr_t mt_blksiz1; /* blocksize for mode 1 */ 142c2466934SMike Pritchard daddr_t mt_blksiz2; /* blocksize for mode 2 */ 143c2466934SMike Pritchard daddr_t mt_blksiz3; /* blocksize for mode 3 */ 144c2466934SMike Pritchard daddr_t mt_density0; /* density for mode 0 */ 145c2466934SMike Pritchard daddr_t mt_density1; /* density for mode 1 */ 146c2466934SMike Pritchard daddr_t mt_density2; /* density for mode 2 */ 147c2466934SMike Pritchard daddr_t mt_density3; /* density for mode 3 */ 148c2466934SMike Pritchard/* the following are not yet implemented */ 149c2466934SMike Pritchard u_char mt_comp0; /* compression type for mode 0 */ 150c2466934SMike Pritchard u_char mt_comp1; /* compression type for mode 1 */ 151c2466934SMike Pritchard u_char mt_comp2; /* compression type for mode 2 */ 152c2466934SMike Pritchard u_char mt_comp3; /* compression type for mode 3 */ 153c2466934SMike Pritchard#endif 154c2466934SMike Pritchard daddr_t mt_fileno; /* file number of current position */ 155c2466934SMike Pritchard daddr_t mt_blkno; /* block number of current position */ 156c2466934SMike Pritchard/* end not yet implemented */ 157c2466934SMike Pritchard}; 158c2466934SMike Pritchard 159c2466934SMike Pritchard/* 160c2466934SMike Pritchard * Constants for mt_type byte. These are the same 161c2466934SMike Pritchard * for controllers compatible with the types listed. 162c2466934SMike Pritchard */ 163c2466934SMike Pritchard#define MT_ISTS 0x01 /* TS-11 */ 164c2466934SMike Pritchard#define MT_ISHT 0x02 /* TM03 Massbus: TE16, TU45, TU77 */ 165c2466934SMike Pritchard#define MT_ISTM 0x03 /* TM11/TE10 Unibus */ 166c2466934SMike Pritchard#define MT_ISMT 0x04 /* TM78/TU78 Massbus */ 167c2466934SMike Pritchard#define MT_ISUT 0x05 /* SI TU-45 emulation on Unibus */ 168c2466934SMike Pritchard#define MT_ISCPC 0x06 /* SUN */ 169c2466934SMike Pritchard#define MT_ISAR 0x07 /* SUN */ 170c2466934SMike Pritchard#define MT_ISTMSCP 0x08 /* DEC TMSCP protocol (TU81, TK50) */ 171c2466934SMike Pritchard#define MT_ISCY 0x09 /* CCI Cipher */ 172c2466934SMike Pritchard#define MT_ISCT 0x0a /* HP 1/4 tape */ 173c2466934SMike Pritchard#define MT_ISFHP 0x0b /* HP 7980 1/2 tape */ 174c2466934SMike Pritchard#define MT_ISEXABYTE 0x0c /* Exabyte */ 175c2466934SMike Pritchard#define MT_ISEXA8200 0x0c /* Exabyte EXB-8200 */ 176c2466934SMike Pritchard#define MT_ISEXA8500 0x0d /* Exabyte EXB-8500 */ 177c2466934SMike Pritchard#define MT_ISVIPER1 0x0e /* Archive Viper-150 */ 178c2466934SMike Pritchard#define MT_ISPYTHON 0x0f /* Archive Python (DAT) */ 179c2466934SMike Pritchard#define MT_ISHPDAT 0x10 /* HP 35450A DAT drive */ 180c2466934SMike Pritchard#define MT_ISMFOUR 0x11 /* M4 Data 1/2 9track drive */ 181c2466934SMike Pritchard#define MT_ISTK50 0x12 /* DEC SCSI TK50 */ 182c2466934SMike Pritchard#define MT_ISMT02 0x13 /* Emulex MT02 SCSI tape controller */ 183c2466934SMike Pritchard 184c2466934SMike Pritchard/* mag tape io control commands */ 185c2466934SMike Pritchard#define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */ 186c2466934SMike Pritchard#define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */ 187c2466934SMike Pritchard#define MTIOCIEOT _IO('m', 3) /* ignore EOT error */ 188c2466934SMike Pritchard#define MTIOCEEOT _IO('m', 4) /* enable EOT error */ 189c2466934SMike Pritchard 190c2466934SMike Pritchard#ifndef KERNEL 191c2466934SMike Pritchard#define DEFTAPE "/dev/nrst0" 192c2466934SMike Pritchard#endif 193c2466934SMike Pritchard 194c2466934SMike Pritchard#ifdef KERNEL 195c2466934SMike Pritchard/* 196c2466934SMike Pritchard * minor device number 197c2466934SMike Pritchard */ 198c2466934SMike Pritchard 199c2466934SMike Pritchard#define T_UNIT 003 /* unit selection */ 200c2466934SMike Pritchard#define T_NOREWIND 004 /* no rewind on close */ 201c2466934SMike Pritchard#define T_DENSEL 030 /* density select */ 202c2466934SMike Pritchard#define T_800BPI 000 /* select 800 bpi */ 203c2466934SMike Pritchard#define T_1600BPI 010 /* select 1600 bpi */ 204c2466934SMike Pritchard#define T_6250BPI 020 /* select 6250 bpi */ 205c2466934SMike Pritchard#define T_BADBPI 030 /* undefined selection */ 206c2466934SMike Pritchard#endif 207c2466934SMike Pritchard#endif /* _SYS_MTIO_H_ */ 208c2466934SMike Pritchard.Ed 209c2466934SMike Pritchard.Pp 210c2466934SMike Pritchard.Sh FILES 211c2466934SMike Pritchard.Bl -tag -width /dev/[nr]st* -compact 212c2466934SMike Pritchard.It Pa /dev/[nr]st* 213c2466934SMike Pritchard.El 214c2466934SMike Pritchard.Sh SEE ALSO 215c2466934SMike Pritchard.Xr mt 1 , 216c2466934SMike Pritchard.Xr tar 1 , 217c2466934SMike Pritchard.Xr st 4 218c2466934SMike Pritchard.Sh HISTORY 219c2466934SMike PritchardThe 220c2466934SMike Pritchard.Nm mtio 221c2466934SMike Pritchardmanual appeared in 222c2466934SMike Pritchard.Bx 4.2 . 223c2466934SMike PritchardAn i386 version first appeared in FreeBSD 2.2. 224c2466934SMike Pritchard.Sh BUGS 225c2466934SMike PritchardThe status should be returned in a device independent format. 226c2466934SMike Pritchard.Pp 227c2466934SMike PritchardThe special file naming should be redone in a more consistent and 228c2466934SMike Pritchardunderstandable manner. 229