xref: /freebsd/share/man/man4/mtio.4 (revision e627b39baccd1ec9129690167cf5e6d860509655)
1.\" Copyright (c) 1996
2.\"	Mike Pritchard <mpp@FreeBSD.org>.  All rights reserved.
3.\"
4.\" Copyright (c) 1983, 1991, 1993
5.\"	The Regents of the University of California.  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.\"     @(#)mtio.4	8.1 (Berkeley) 6/5/93
36.\"
37.Dd February 11, 1996
38.Dt MTIO 4 i386
39.Os FreeBSD 2.2
40.Sh NAME
41.Nm mtio
42.Nd
43.Tn FreeBSD
44magtape interface
45.Sh DESCRIPTION
46The special files
47named
48.Pa /dev/[nr]st*
49refer to SCSI tape drives,
50which may be attached to the system.
51.Pa /dev/[nr]st*.ctl
52are control devices that can be used to issue ioctls to the SCSI
53tape driver to set parameters that are required to last beyond the
54unmounting of a tape.
55.Pp
56.Pp
57The rewind devices automatically rewind
58when the last requested read, write or seek has finished, or the end of the tape
59has been reached. The letter
60.Ql n
61is usually prepended to
62the name of the no-rewind devices.
63.Pp
64Tapes can be written with either fixed length records or variable length
65records.  See
66.Xr st 4
67for more information.  Two end-of-file markers mark the end of a tape, and
68one end-of-file marker marks the end of a tape file.
69If the tape is not to be rewound it is positioned with the
70head in between the two tape marks, where the next write
71will over write the second end-of-file marker.
72.Pp
73All of the magtape devices may be manipulated with the
74.Xr mt 1
75command.
76.Pp
77A number of
78.Xr ioctl 2
79operations are available
80on raw magnetic tape.
81The following definitions are from
82.Aq Pa sys/mtio.h :
83.Bd  -literal
84/*
85 * Structures and definitions for mag tape io control commands
86 */
87
88/* structure for MTIOCTOP - mag tape op command */
89struct mtop {
90	short	mt_op;		/* operations defined below */
91	daddr_t	mt_count;	/* how many of them */
92};
93
94/* operations */
95#define MTWEOF		0	/* write an end-of-file record */
96#define MTFSF		1	/* forward space file */
97#define MTBSF		2	/* backward space file */
98#define MTFSR		3	/* forward space record */
99#define MTBSR		4	/* backward space record */
100#define MTREW		5	/* rewind */
101#define MTOFFL		6	/* rewind and put the drive offline */
102#define MTNOP		7	/* no operation, sets status only */
103#define MTCACHE		8	/* enable controller cache */
104#define MTNOCACHE	9	/* disable controller cache */
105
106#if defined(__FreeBSD__)
107/* Set block size for device. If device is a variable size dev		*/
108/* a non zero parameter will change the device to a fixed block size	*/
109/* device with block size set to that of the parameter passed in.	*/
110/* Resetting the block size to 0 will restore the device to a variable	*/
111/* block size device. */
112
113#define MTSETBSIZ	10
114
115/* Set density values for device. They are defined in the SCSI II spec	*/
116/* and range from 0 to 0x17. Sets the value for the opened mode only	*/
117
118#define MTSETDNSTY	11
119
120#define MTERASE		12	/* erase to EOM */
121#define MTEOD		13	/* Space to EOM */
122#define MTCOMP		14	/* select compression mode 0=off, 1=def */
123#define MTRETENS	15	/* re-tension tape */
124
125#endif
126
127/* structure for MTIOCGET - mag tape get status command */
128
129struct mtget {
130	short	mt_type;	/* type of magtape device */
131/* the following two registers are grossly device dependent */
132	short	mt_dsreg;	/* ``drive status'' register */
133	short	mt_erreg;	/* ``error'' register */
134/* end device-dependent registers */
135	short	mt_resid;	/* residual count */
136#if defined (__FreeBSD__)
137	daddr_t mt_blksiz;	/* presently operating blocksize */
138	daddr_t mt_density;	/* presently operating density */
139	daddr_t mt_comp;	/* presently operating compression */
140	daddr_t mt_blksiz0;	/* blocksize for mode 0 */
141	daddr_t mt_blksiz1;	/* blocksize for mode 1 */
142	daddr_t mt_blksiz2;	/* blocksize for mode 2 */
143	daddr_t mt_blksiz3;	/* blocksize for mode 3 */
144	daddr_t mt_density0;	/* density for mode 0 */
145	daddr_t mt_density1;	/* density for mode 1 */
146	daddr_t mt_density2;	/* density for mode 2 */
147	daddr_t mt_density3;	/* density for mode 3 */
148/* the following are not yet implemented */
149	u_char	mt_comp0;	/* compression type for mode 0 */
150	u_char	mt_comp1;	/* compression type for mode 1 */
151	u_char	mt_comp2;	/* compression type for mode 2 */
152	u_char	mt_comp3;	/* compression type for mode 3 */
153#endif
154	daddr_t	mt_fileno;	/* file number of current position */
155	daddr_t	mt_blkno;	/* block number of current position */
156/* end not yet implemented */
157};
158
159/*
160 * Constants for mt_type byte.  These are the same
161 * for controllers compatible with the types listed.
162 */
163#define	MT_ISTS		0x01		/* TS-11 */
164#define	MT_ISHT		0x02		/* TM03 Massbus: TE16, TU45, TU77 */
165#define	MT_ISTM		0x03		/* TM11/TE10 Unibus */
166#define	MT_ISMT		0x04		/* TM78/TU78 Massbus */
167#define	MT_ISUT		0x05		/* SI TU-45 emulation on Unibus */
168#define	MT_ISCPC	0x06		/* SUN */
169#define	MT_ISAR		0x07		/* SUN */
170#define	MT_ISTMSCP	0x08		/* DEC TMSCP protocol (TU81, TK50) */
171#define MT_ISCY		0x09		/* CCI Cipher */
172#define MT_ISCT		0x0a		/* HP 1/4 tape */
173#define MT_ISFHP	0x0b		/* HP 7980 1/2 tape */
174#define MT_ISEXABYTE	0x0c		/* Exabyte */
175#define MT_ISEXA8200	0x0c		/* Exabyte EXB-8200 */
176#define MT_ISEXA8500	0x0d		/* Exabyte EXB-8500 */
177#define MT_ISVIPER1	0x0e		/* Archive Viper-150 */
178#define MT_ISPYTHON	0x0f		/* Archive Python (DAT) */
179#define MT_ISHPDAT	0x10		/* HP 35450A DAT drive */
180#define MT_ISMFOUR	0x11		/* M4 Data 1/2 9track drive */
181#define MT_ISTK50	0x12		/* DEC SCSI TK50 */
182#define MT_ISMT02	0x13		/* Emulex MT02 SCSI tape controller */
183
184/* mag tape io control commands */
185#define	MTIOCTOP	_IOW('m', 1, struct mtop)	/* do a mag tape op */
186#define	MTIOCGET	_IOR('m', 2, struct mtget)	/* get tape status */
187#define MTIOCIEOT	_IO('m', 3)			/* ignore EOT error */
188#define MTIOCEEOT	_IO('m', 4)			/* enable EOT error */
189
190#ifndef KERNEL
191#define	DEFTAPE	"/dev/nrst0"
192#endif
193
194#ifdef	KERNEL
195/*
196 * minor device number
197 */
198
199#define	T_UNIT		003		/* unit selection */
200#define	T_NOREWIND	004		/* no rewind on close */
201#define	T_DENSEL	030		/* density select */
202#define	T_800BPI	000		/* select  800 bpi */
203#define	T_1600BPI	010		/* select 1600 bpi */
204#define	T_6250BPI	020		/* select 6250 bpi */
205#define	T_BADBPI	030		/* undefined selection */
206#endif
207#endif /* _SYS_MTIO_H_ */
208.Ed
209.Pp
210.Sh FILES
211.Bl -tag -width /dev/[nr]st* -compact
212.It Pa /dev/[nr]st*
213.El
214.Sh SEE ALSO
215.Xr mt 1 ,
216.Xr tar 1 ,
217.Xr st 4
218.Sh HISTORY
219The
220.Nm mtio
221manual appeared in
222.Bx 4.2 .
223An i386 version first appeared in
224.Fx 2.2 .
225.Sh BUGS
226The status should be returned in a device independent format.
227.Pp
228The special file naming should be redone in a more consistent and
229understandable manner.
230