xref: /netbsd-src/share/man/man4/mtio.4 (revision ae1bfcddc410612bc8c58b807e1830becb69a24c)
1.\" Copyright (c) 1983, 1991 The Regents of the University of California.
2.\" 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.\"     from: @(#)mtio.4	6.5 (Berkeley) 3/27/91
33.\"	$Id: mtio.4,v 1.2 1993/08/01 07:36:07 mycroft Exp $
34.\"
35.Dd March 27, 1991
36.Dt MTIO 4 vax
37.Os BSD 4.2
38.Sh NAME
39.Nm mtio
40.Nd
41.Tn UNIX
42magtape interface
43.Sh DESCRIPTION
44The special files
45named
46.Pa /dev/mt0
47and
48.Pa /dev/rmt0
49through
50.Pa /dev/mt23
51and
52.Pa /dev/rmt23
53refer to
54.Tn UNIX
55magtape drives,
56which may be on the
57.Tn MASSBUS
58using the
59.Tn TM03
60formatter
61.Xr ht 4 ,
62or
63.Tn TM78
64formatter,
65.Xr mt 4 ,
66or on the
67.Tn UNIBUS
68using either the
69.Tn TM11
70or
71.Tn TS11
72formatters
73.Xr tm 4 ,
74.Tn TU45
75compatible formatters,
76.Xr ut 4 ,
77or
78.Xr ts 4 .
79These devices are typical tape block devices,
80see
81.Xr physio 4 .
82.Pp
83The following table of the converntional device names
84is applicable to any of the transport/controller pairs.
85(But note that only 1600
86.Tn BPI
87is available with the
88.Tn TS11 . )
89.Bl -column "no-rewindxxx" "or lowest densityxx" "or lowest densityxx" "or lowest densityxx" -offset indent
90	      800 BPI	      1600 BPI	      6500 BPI
91.Em	or lowest density	or second density	or third density
92
93Rewind	     mt0/rmt0	      mt8/rmt8	       mt16/rmt16
94Rewind	     mt1/rmt1	      mt9/rmt9	       mt17/rmt17
95Rewind	     mt2/rmt2	      mt10/rmt10	       mt18/rmt18
96Rewind	     mt3/rmt3	      mt11/rmt11	       mt19/rmt19
97No-rewind	    nmt4/nrmt4	    nmt12/nrmt12	    nmt20/nrmt20
98No-rewind	    nmt5/nrmt5	    nmt13/nrmt13	    nmt21/nrmt21
99No-rewind	    nmt6/nrmt6	    nmt14/nrmt14	    nmt22/nrmt22
100No-rewind	    nmt7/nrmt7	    nmt15/nrmt15	    nmt23/nrmt32
101.El
102.Pp
103The rewind devices automatically rewind
104when the last requested read, write or seek has finished, or the end of the tape
105has been reached. The letter
106.Ql n
107is usually prepended to
108the name of the no-rewind devices.
109.Pp
110Unix tapes are written in multiples of 1024 byte block
111records. Two end-of-file markers mark the end of a tape, and
112one end-of-file marker marks the end of a tape file.
113If the tape is not to be rewound it is positioned with the
114head in between the two tape marks, where the next write
115will over write the second end-of-file marker.
116.Pp
117All of the magtape devices may be manipulated with the
118.Xr mt 1
119command.
120.Pp
121A number of
122.Xr ioctl 2
123operations are available
124on raw magnetic tape.
125The following definitions are from
126.Aq Pa sys/mtio.h :
127.Bd  -literal
128/*
129 * Structures and definitions for mag tape io control commands
130 */
131
132/* structure for MTIOCTOP - mag tape op command */
133struct	mtop	{
134	short	mt_op;		/* operations defined below */
135	daddr_t	mt_count;	/* how many of them */
136};
137
138/* operations */
139#define MTWEOF	0	/* write an end-of-file record */
140#define MTFSF	1	/* forward space file */
141#define MTBSF	2	/* backward space file */
142#define MTFSR	3	/* forward space record */
143#define MTBSR	4	/* backward space record */
144#define MTREW	5	/* rewind */
145#define MTOFFL	6	/* rewind and put the drive offline */
146#define MTNOP	7	/* no operation, sets status only */
147#define MTCACHE 8	/* enable controller cache */
148#define MTNOCACHE 9	/* disable controller cache */
149
150/* structure for MTIOCGET - mag tape get status command */
151
152struct	mtget	{
153	short	mt_type;	/* type of magtape device */
154/* the following two registers are grossly device dependent */
155	short	mt_dsreg;	/* ``drive status'' register */
156	short	mt_erreg;	/* ``error'' register */
157/* end device-dependent registers */
158	short	mt_resid;	/* residual count */
159/* the following two are not yet implemented */
160	daddr_t	mt_fileno;	/* file number of current position */
161	daddr_t	mt_blkno;	/* block number of current position */
162/* end not yet implemented */
163};
164
165/*
166 * Constants for mt_type byte.  These are the same
167 * for controllers compatible with the types listed.
168 */
169#define	MT_ISTS		0x01		/* TS-11 */
170#define	MT_ISHT		0x02		/* TM03 Massbus: TE16, TU45, TU77 */
171#define	MT_ISTM		0x03		/* TM11/TE10 Unibus */
172#define	MT_ISMT		0x04		/* TM78/TU78 Massbus */
173#define	MT_ISUT		0x05		/* SI TU-45 emulation on Unibus */
174#define	MT_ISCPC	0x06		/* SUN */
175#define	MT_ISAR		0x07		/* SUN */
176#define	MT_ISTMSCP	0x08		/* DEC TMSCP protocol (TU81, TK50) */
177#define MT_ISCY 	0x09		/* CCI Cipher */
178#define MT_ISCT 	0x0a		/* HP 1/4 tape */
179#define MT_ISFHP	0x0b		/* HP 7980 1/2 tape */
180#define MT_ISEXABYTE	0x0c		/* Exabyte */
181#define MT_ISEXA8200	0x0c		/* Exabyte EXB-8200 */
182#define MT_ISEXA8500	0x0d		/* Exabyte EXB-8500 */
183#define MT_ISVIPER1	0x0e		/* Archive Viper-150 */
184#define MT_ISPYTHON	0x0f		/* Archive Python (DAT) */
185#define MT_ISHPDAT	0x10		/* HP 35450A DAT drive */
186
187/* mag tape io control commands */
188#define	MTIOCTOP	_IOW('m', 1, struct mtop)	/* do a mag tape op */
189#define	MTIOCGET	_IOR('m', 2, struct mtget)	/* get tape status */
190#define MTIOCIEOT	_IO('m', 3)			/* ignore EOT error */
191#define MTIOCEEOT	_IO('m', 4)			/* enable EOT error */
192
193#ifndef KERNEL
194#define	DEFTAPE	"/dev/rmt12"
195#endif
196
197#ifdef	KERNEL
198/*
199 * minor device number
200 */
201
202#define	T_UNIT		003		/* unit selection */
203#define	T_NOREWIND	004		/* no rewind on close */
204#define	T_DENSEL	030		/* density select */
205#define	T_800BPI	000		/* select  800 bpi */
206#define	T_1600BPI	010		/* select 1600 bpi */
207#define	T_6250BPI	020		/* select 6250 bpi */
208#define	T_BADBPI	030		/* undefined selection */
209#endif
210.Ed
211.Pp
212.Sh FILES
213.Bl -tag -width /dev/rmt? -compact
214.It Pa /dev/mt?
215.It Pa /dev/rmt?
216.El
217.Sh SEE ALSO
218.Xr mt 1 ,
219.Xr tar 1 ,
220.Xr tp 1 ,
221.Xr ht 4 ,
222.Xr tm 4 ,
223.Xr ts 4 ,
224.Xr mt 4 ,
225.Xr ut 4
226.Sh HISTORY
227The
228.Nm mtio
229manual appeared in
230.Bx 4.2 .
231.Sh BUGS
232The status should be returned in a device independent format.
233.Pp
234The special file naming should be redone in a more consistent and
235understandable manner.
236