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