xref: /onnv-gate/usr/src/uts/common/sys/mtio.h (revision 0:68f95e015346)
1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * Copyright 2002 Sun Microsystems, Inc.  All rights reserved.
24*0Sstevel@tonic-gate  * Use is subject to license terms.
25*0Sstevel@tonic-gate  *
26*0Sstevel@tonic-gate  *	Copyright (c) 1983-1989 by AT&T.
27*0Sstevel@tonic-gate  *	All rights reserved.
28*0Sstevel@tonic-gate  */
29*0Sstevel@tonic-gate 
30*0Sstevel@tonic-gate /*
31*0Sstevel@tonic-gate  * Portions of this source code were derived from Berkeley 4.3 BSD
32*0Sstevel@tonic-gate  * under license from the Regents of the University of California.
33*0Sstevel@tonic-gate  */
34*0Sstevel@tonic-gate 
35*0Sstevel@tonic-gate #ifndef	_SYS_MTIO_H
36*0Sstevel@tonic-gate #define	_SYS_MTIO_H
37*0Sstevel@tonic-gate 
38*0Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
39*0Sstevel@tonic-gate 
40*0Sstevel@tonic-gate #include <sys/types.h>
41*0Sstevel@tonic-gate 
42*0Sstevel@tonic-gate #ifdef	__cplusplus
43*0Sstevel@tonic-gate extern "C" {
44*0Sstevel@tonic-gate #endif
45*0Sstevel@tonic-gate 
46*0Sstevel@tonic-gate /*
47*0Sstevel@tonic-gate  * Structures and definitions for mag tape io control commands
48*0Sstevel@tonic-gate  */
49*0Sstevel@tonic-gate 
50*0Sstevel@tonic-gate /*
51*0Sstevel@tonic-gate  * structure for MTIOCTOP - mag tape op command
52*0Sstevel@tonic-gate  */
53*0Sstevel@tonic-gate struct mtop	{
54*0Sstevel@tonic-gate 	short		mt_op;		/* operations defined below */
55*0Sstevel@tonic-gate 	daddr_t		mt_count;	/* how many of them */
56*0Sstevel@tonic-gate };
57*0Sstevel@tonic-gate 
58*0Sstevel@tonic-gate #if defined(_SYSCALL32)
59*0Sstevel@tonic-gate struct mtop32	{
60*0Sstevel@tonic-gate 	short		mt_op;		/* operations defined below */
61*0Sstevel@tonic-gate 	daddr32_t	mt_count;	/* how many of them */
62*0Sstevel@tonic-gate };
63*0Sstevel@tonic-gate #endif /* _SYSCALL32 */
64*0Sstevel@tonic-gate 
65*0Sstevel@tonic-gate 
66*0Sstevel@tonic-gate /*
67*0Sstevel@tonic-gate  * values for mt_op
68*0Sstevel@tonic-gate  */
69*0Sstevel@tonic-gate #define	MTWEOF		0	/* write an end-of-file record */
70*0Sstevel@tonic-gate #define	MTFSF		1	/* forward space over file mark */
71*0Sstevel@tonic-gate #define	MTBSF		2	/* backward space over file mark (1/2" only ) */
72*0Sstevel@tonic-gate #define	MTFSR		3	/* forward space to inter-record gap */
73*0Sstevel@tonic-gate #define	MTBSR		4	/* backward space to inter-record gap */
74*0Sstevel@tonic-gate #define	MTREW		5	/* rewind */
75*0Sstevel@tonic-gate #define	MTOFFL		6	/* rewind and put the drive offline */
76*0Sstevel@tonic-gate #define	MTNOP		7	/* no operation, sets status only */
77*0Sstevel@tonic-gate #define	MTRETEN		8	/* retension the tape (cartridge tape only) */
78*0Sstevel@tonic-gate #define	MTERASE		9	/* erase the entire tape */
79*0Sstevel@tonic-gate #define	MTEOM		10	/* position to end of media */
80*0Sstevel@tonic-gate #define	MTNBSF		11	/* backward space file to BOF */
81*0Sstevel@tonic-gate #define	MTSRSZ		12	/* set record size */
82*0Sstevel@tonic-gate #define	MTGRSZ		13	/* get record size */
83*0Sstevel@tonic-gate #define	MTLOAD		14	/* for loading a tape (use o_delay to open */
84*0Sstevel@tonic-gate 				/* the tape device) */
85*0Sstevel@tonic-gate 
86*0Sstevel@tonic-gate /*
87*0Sstevel@tonic-gate  * structure for MTIOCGET - mag tape get status command
88*0Sstevel@tonic-gate  */
89*0Sstevel@tonic-gate struct mtget	{
90*0Sstevel@tonic-gate 	short		mt_type;	/* type of magtape device */
91*0Sstevel@tonic-gate 	/* the following two registers are grossly device dependent */
92*0Sstevel@tonic-gate 	short		mt_dsreg;	/* ``drive status'' register */
93*0Sstevel@tonic-gate 	short		mt_erreg;	/* ``error'' register */
94*0Sstevel@tonic-gate 	/* optional error info. */
95*0Sstevel@tonic-gate 	daddr_t		mt_resid;	/* residual count */
96*0Sstevel@tonic-gate 	daddr_t		mt_fileno;	/* file number of current position */
97*0Sstevel@tonic-gate 	daddr_t		mt_blkno;	/* block number of current position */
98*0Sstevel@tonic-gate 	ushort_t	mt_flags;
99*0Sstevel@tonic-gate 	short		mt_bf;		/* optimum blocking factor */
100*0Sstevel@tonic-gate };
101*0Sstevel@tonic-gate 
102*0Sstevel@tonic-gate #if defined(_SYSCALL32)
103*0Sstevel@tonic-gate struct mtget32	{
104*0Sstevel@tonic-gate 	short		mt_type;	/* type of magtape device */
105*0Sstevel@tonic-gate 	/* the following two registers are grossly device dependent */
106*0Sstevel@tonic-gate 	short		mt_dsreg;	/* ``drive status'' register */
107*0Sstevel@tonic-gate 	short		mt_erreg;	/* ``error'' register */
108*0Sstevel@tonic-gate 	/* optional error info. */
109*0Sstevel@tonic-gate 	daddr32_t	mt_resid;	/* residual count */
110*0Sstevel@tonic-gate 	daddr32_t	mt_fileno;	/* file number of current position */
111*0Sstevel@tonic-gate 	daddr32_t	mt_blkno;	/* block number of current position */
112*0Sstevel@tonic-gate 	ushort_t	mt_flags;
113*0Sstevel@tonic-gate 	short		mt_bf;		/* optimum blocking factor */
114*0Sstevel@tonic-gate };
115*0Sstevel@tonic-gate #endif /* _SYSCALL32 */
116*0Sstevel@tonic-gate 
117*0Sstevel@tonic-gate #define	MT_NDENSITIES	4
118*0Sstevel@tonic-gate #define	MT_NSPEEDS	4
119*0Sstevel@tonic-gate 
120*0Sstevel@tonic-gate /*
121*0Sstevel@tonic-gate  * struct for MTIOCGETDRIVETYPE - get tape config data
122*0Sstevel@tonic-gate  */
123*0Sstevel@tonic-gate struct mtdrivetype {
124*0Sstevel@tonic-gate 	char    name[64];		/* Name, for debug */
125*0Sstevel@tonic-gate 	char    vid[25];		/* Vendor id and model (product) id */
126*0Sstevel@tonic-gate 	char    type;			/* Drive type for driver */
127*0Sstevel@tonic-gate 	int	bsize;			/* Block size */
128*0Sstevel@tonic-gate 	int	options;		/* Drive options */
129*0Sstevel@tonic-gate 	int	max_rretries;		/* Max read retries */
130*0Sstevel@tonic-gate 	int	max_wretries;		/* Max write retries */
131*0Sstevel@tonic-gate 	uchar_t densities[MT_NDENSITIES];	/* density codes, low->hi */
132*0Sstevel@tonic-gate 	uchar_t	default_density;	/* Default density chosen */
133*0Sstevel@tonic-gate 	uchar_t speeds[MT_NSPEEDS];	/* speed codes, low->hi */
134*0Sstevel@tonic-gate 	ushort_t non_motion_timeout;    /* Inquiry type commands */
135*0Sstevel@tonic-gate 	ushort_t io_timeout;		/* io timeout. seconds */
136*0Sstevel@tonic-gate 	ushort_t rewind_timeout;	/* rewind timeout. seconds */
137*0Sstevel@tonic-gate 	ushort_t space_timeout;		/* space cmd timeout. seconds */
138*0Sstevel@tonic-gate 	ushort_t load_timeout;		/* load tape time in seconds */
139*0Sstevel@tonic-gate 	ushort_t unload_timeout;	/* Unload tape time in scounds */
140*0Sstevel@tonic-gate 	ushort_t erase_timeout;		/* erase timeout. seconds */
141*0Sstevel@tonic-gate };
142*0Sstevel@tonic-gate 
143*0Sstevel@tonic-gate 
144*0Sstevel@tonic-gate struct mtdrivetype_request {
145*0Sstevel@tonic-gate 	int	size;
146*0Sstevel@tonic-gate 	struct  mtdrivetype *mtdtp;
147*0Sstevel@tonic-gate };
148*0Sstevel@tonic-gate 
149*0Sstevel@tonic-gate #if defined(_SYSCALL32)
150*0Sstevel@tonic-gate struct mtdrivetype_request32 {
151*0Sstevel@tonic-gate 	int		size;
152*0Sstevel@tonic-gate 	caddr32_t	mtdtp;
153*0Sstevel@tonic-gate };
154*0Sstevel@tonic-gate #endif /* _SYSCALL32 */
155*0Sstevel@tonic-gate 
156*0Sstevel@tonic-gate 
157*0Sstevel@tonic-gate /*
158*0Sstevel@tonic-gate  * values for mt_flags
159*0Sstevel@tonic-gate  */
160*0Sstevel@tonic-gate #define	MTF_SCSI	0x01
161*0Sstevel@tonic-gate #define	MTF_REEL	0x02
162*0Sstevel@tonic-gate #define	MTF_ASF		0x04
163*0Sstevel@tonic-gate 
164*0Sstevel@tonic-gate #define	MTF_TAPE_HEAD_DIRTY	0x08
165*0Sstevel@tonic-gate #define	MTF_TAPE_CLN_SUPPORTED	0x10
166*0Sstevel@tonic-gate 
167*0Sstevel@tonic-gate /*
168*0Sstevel@tonic-gate  * Constants for mt_type byte (these are somewhat obsolete)
169*0Sstevel@tonic-gate  */
170*0Sstevel@tonic-gate #define	MT_ISTS		0x01		/* vax: unibus ts-11 */
171*0Sstevel@tonic-gate #define	MT_ISHT		0x02		/* vax: massbus tu77, etc */
172*0Sstevel@tonic-gate #define	MT_ISTM		0x03		/* vax: unibus tm-11 */
173*0Sstevel@tonic-gate #define	MT_ISMT		0x04		/* vax: massbus tu78 */
174*0Sstevel@tonic-gate #define	MT_ISUT		0x05		/* vax: unibus gcr */
175*0Sstevel@tonic-gate #define	MT_ISCPC	0x06		/* sun: multibus cpc */
176*0Sstevel@tonic-gate #define	MT_ISAR		0x07		/* sun: multibus archive */
177*0Sstevel@tonic-gate #define	MT_ISSC		0x08		/* sun: SCSI archive */
178*0Sstevel@tonic-gate #define	MT_ISSYSGEN11	0x10		/* sun: SCSI Sysgen, QIC-11 only */
179*0Sstevel@tonic-gate #define	MT_ISSYSGEN	0x11		/* sun: SCSI Sysgen QIC-24/11 */
180*0Sstevel@tonic-gate #define	MT_ISDEFAULT	0x12		/* sun: SCSI default CCS */
181*0Sstevel@tonic-gate #define	MT_ISCCS3	0x13		/* sun: SCSI generic (unknown) CCS */
182*0Sstevel@tonic-gate #define	MT_ISMT02	0x14		/* sun: SCSI Emulex MT02 */
183*0Sstevel@tonic-gate #define	MT_ISVIPER1	0x15		/* sun: SCSI Archive QIC-150 Viper */
184*0Sstevel@tonic-gate #define	MT_ISWANGTEK1	0x16		/* sun: SCSI Wangtek QIC-150 */
185*0Sstevel@tonic-gate #define	MT_ISCCS7	0x17		/* sun: SCSI generic (unknown) CCS */
186*0Sstevel@tonic-gate #define	MT_ISCCS8	0x18		/* sun: SCSI generic (unknown) CCS */
187*0Sstevel@tonic-gate #define	MT_ISCCS9	0x19		/* sun: SCSI generic (unknown) CCS */
188*0Sstevel@tonic-gate #define	MT_ISCCS11	0x1a		/* sun: SCSI generic (unknown) CCS */
189*0Sstevel@tonic-gate #define	MT_ISCCS12	0x1b		/* sun: SCSI generic (unknown) CCS */
190*0Sstevel@tonic-gate #define	MT_ISCCS13	0x1c		/* sun: SCSI generic (unknown) CCS */
191*0Sstevel@tonic-gate #define	MT_ISCCS14	0x1d		/* sun: SCSI generic (unknown) CCS */
192*0Sstevel@tonic-gate #define	MT_ISCCS15	0x1e		/* sun: SCSI generic (unknown) CCS */
193*0Sstevel@tonic-gate #define	MT_ISCCS16	0x1f		/* sun: SCSI generic (unknown) CCS */
194*0Sstevel@tonic-gate #define	MT_ISCDC	0x20		/* sun: SCSI CDC 1/2" cartridge */
195*0Sstevel@tonic-gate #define	MT_ISFUJI	0x21		/* sun: SCSI Fujitsu 1/2" cartridge */
196*0Sstevel@tonic-gate #define	MT_ISKENNEDY	0x22		/* sun: SCSI Kennedy 1/2" reel */
197*0Sstevel@tonic-gate #define	MT_ISHP		0x23		/* sun: SCSI HP 1/2" reel */
198*0Sstevel@tonic-gate #define	MT_ISSTC	0x24		/* sun: SCSI IBM STC 3490 */
199*0Sstevel@tonic-gate #define	MT_ISANRITSU	0x25		/* nihon sun: Anritsu 1/2" reel */
200*0Sstevel@tonic-gate #define	MT_ISCCS23	0x26		/* sun: SCSI generic  1/2" */
201*0Sstevel@tonic-gate #define	MT_ISCCS24	0x27		/* sun: SCSI generic  1/2" */
202*0Sstevel@tonic-gate #define	MT_ISEXABYTE	0x28		/* sun: SCSI Exabyte 8mm cartridge */
203*0Sstevel@tonic-gate #define	MT_ISEXB8500	0x29		/* sun: SCSI Exabyte 8500 8mm cart */
204*0Sstevel@tonic-gate #define	MT_ISWANGTHS	0x2a		/* sun: SCSI Wangtek 6130HS RDAT */
205*0Sstevel@tonic-gate #define	MT_ISWANGDAT	0x2b		/* sun: SCSI WangDAT */
206*0Sstevel@tonic-gate #define	MT_ISPYTHON	0x2c		/* sun: SCSI Archive Python DAT  */
207*0Sstevel@tonic-gate #define	MT_ISCCS28	0x2d		/* sun: SCSI generic DAT CCS */
208*0Sstevel@tonic-gate #define	MT_ISCCS29	0x2e		/* sun: SCSI generic (unknown) CCS */
209*0Sstevel@tonic-gate #define	MT_ISCCS30	0x2f		/* sun: SCSI generic (unknown) CCS */
210*0Sstevel@tonic-gate #define	MT_ISCCS31	0x30		/* sun: SCSI generic (unknown) CCS */
211*0Sstevel@tonic-gate #define	MT_ISCCS32	0x31		/* sun: SCSI generic (unknown) CCS */
212*0Sstevel@tonic-gate 
213*0Sstevel@tonic-gate 
214*0Sstevel@tonic-gate /*
215*0Sstevel@tonic-gate  * these are recommended
216*0Sstevel@tonic-gate  */
217*0Sstevel@tonic-gate #define	MT_ISQIC	0x32		/* generic QIC tape drive */
218*0Sstevel@tonic-gate #define	MT_ISREEL	0x33		/* generic reel tape drive */
219*0Sstevel@tonic-gate #define	MT_ISDAT	0x34		/* generic DAT tape drive */
220*0Sstevel@tonic-gate #define	MT_IS8MM	0x35		/* generic 8mm tape drive */
221*0Sstevel@tonic-gate #define	MT_ISOTHER	0x36		/* generic other type of tape drive */
222*0Sstevel@tonic-gate 
223*0Sstevel@tonic-gate /* more Sun devices */
224*0Sstevel@tonic-gate #define	MT_ISTAND25G	0x37		/* sun: SCSI Tandberg 2.5 Gig QIC */
225*0Sstevel@tonic-gate #define	MT_ISDLT	0x38		/* sun: SCSI DLT tape drive */
226*0Sstevel@tonic-gate #define	MT_ISSTK9840	0x39		/* sun: STK 9840, 9940, 9840B */
227*0Sstevel@tonic-gate #define	MT_ISBMDLT1	0x3a		/* sun: Benchmark DLT1 */
228*0Sstevel@tonic-gate #define	MT_LTO		0x3b		/* sun: LTO,s by Hp, Seagate, IBM .. */
229*0Sstevel@tonic-gate 
230*0Sstevel@tonic-gate /*
231*0Sstevel@tonic-gate  * Device table structure and data for looking tape name from
232*0Sstevel@tonic-gate  * tape id number.  Used by mt.c.
233*0Sstevel@tonic-gate  */
234*0Sstevel@tonic-gate struct mt_tape_info {
235*0Sstevel@tonic-gate 	short	t_type;		/* type of magtape device */
236*0Sstevel@tonic-gate 	char	*t_name;	/* printing name */
237*0Sstevel@tonic-gate 	char	*t_dsbits;	/* "drive status" register */
238*0Sstevel@tonic-gate 	char	*t_erbits;	/* "error" register */
239*0Sstevel@tonic-gate };
240*0Sstevel@tonic-gate 
241*0Sstevel@tonic-gate /*
242*0Sstevel@tonic-gate  * this table is now obsolete, use MTIOCGETDRIVETYPE ioctl
243*0Sstevel@tonic-gate  *
244*0Sstevel@tonic-gate  * WARNING: this table will be eliminated in some future release
245*0Sstevel@tonic-gate  */
246*0Sstevel@tonic-gate #define	MT_TAPE_INFO  {\
247*0Sstevel@tonic-gate { MT_ISSYSGEN11,	"Sysgen QIC-11",		0, 0 }, \
248*0Sstevel@tonic-gate { MT_ISSYSGEN,		"Sysgen QIC-24",		0, 0 }, \
249*0Sstevel@tonic-gate { MT_ISMT02,		"Emulex MT-02 QIC-24",		0, 0 }, \
250*0Sstevel@tonic-gate { MT_ISVIPER1,		"Archive QIC-150",		0, 0 }, \
251*0Sstevel@tonic-gate { MT_ISWANGTEK1,	"Wangtek QIC-150",		0, 0 }, \
252*0Sstevel@tonic-gate { MT_ISKENNEDY,		"Kennedy 9612 1/2-inch",	0, 0 }, \
253*0Sstevel@tonic-gate { MT_ISANRITSU,		"Anritsu 1/2-inch",		0, 0 }, \
254*0Sstevel@tonic-gate { MT_ISHP,		"HP 88780 1/2-inch",		0, 0 }, \
255*0Sstevel@tonic-gate { MT_ISEXABYTE,		"Exabyte EXB-8200 8mm",		0, 0 }, \
256*0Sstevel@tonic-gate { MT_ISEXB8500,		"Exabyte EXB-8500 8mm",		0, 0 }, \
257*0Sstevel@tonic-gate { MT_ISWANGDAT,		"WangDAT 3.81mm",		0, 0 }, \
258*0Sstevel@tonic-gate { MT_ISWANGTHS,		"Wangtek 4mm RDAT",		0, 0 }, \
259*0Sstevel@tonic-gate { MT_ISPYTHON,		"Archive Python 4mm Helical Scan",	0, 0 }, \
260*0Sstevel@tonic-gate { MT_ISSTC,		"STC 1/2\" Cartridge",		0, 0}, \
261*0Sstevel@tonic-gate { MT_ISTAND25G,		"Tandberg 2.5 Gig QIC",		0, 0}, \
262*0Sstevel@tonic-gate { MT_ISQIC,		"QIC",		0, 0}, \
263*0Sstevel@tonic-gate { MT_ISREEL,		"REEL",		0, 0}, \
264*0Sstevel@tonic-gate { MT_ISDAT,		"DAT",		0, 0}, \
265*0Sstevel@tonic-gate { MT_IS8MM,		"8mm",		0, 0}, \
266*0Sstevel@tonic-gate { MT_ISOTHER,		"Other",	0, 0}, \
267*0Sstevel@tonic-gate { 0 } \
268*0Sstevel@tonic-gate }
269*0Sstevel@tonic-gate 
270*0Sstevel@tonic-gate /* mag tape io control commands */
271*0Sstevel@tonic-gate #define	MTIOC			('m'<<8)
272*0Sstevel@tonic-gate #define	MTIOCTOP		(MTIOC|1)	/* do a mag tape op */
273*0Sstevel@tonic-gate #define	MTIOCGET		(MTIOC|2)	/* get tape status */
274*0Sstevel@tonic-gate #define	MTIOCGETDRIVETYPE	(MTIOC|3)	/* get tape config data */
275*0Sstevel@tonic-gate #define	MTIOCPERSISTENT		(MTIOC|4)	/* turn on persistent errors */
276*0Sstevel@tonic-gate #define	MTIOCPERSISTENTSTATUS	(MTIOC|5)	/* query persis. err status */
277*0Sstevel@tonic-gate #define	MTIOCLRERR		(MTIOC|6)	/* clear a persitent error */
278*0Sstevel@tonic-gate #define	MTIOCGUARANTEEDORDER	(MTIOC|7)	/* check for guaranteed order */
279*0Sstevel@tonic-gate #define	MTIOCRESERVE		(MTIOC|8)	/* preserve reserve */
280*0Sstevel@tonic-gate #define	MTIOCRELEASE		(MTIOC|9)	/* turnoff preserve reserve */
281*0Sstevel@tonic-gate #define	MTIOCFORCERESERVE	(MTIOC|10)	/* break reservation drive */
282*0Sstevel@tonic-gate 
283*0Sstevel@tonic-gate #define	MTIOCSTATE		(MTIOC|13)	/* Inquire insert/eject state */
284*0Sstevel@tonic-gate 
285*0Sstevel@tonic-gate #define	MTIOCREADIGNOREILI  	(MTIOC|14)	/* Enable/Disable ILI */
286*0Sstevel@tonic-gate #define	MTIOCREADIGNOREEOFS 	(MTIOC|15)	/* Enable/Disable Ignore EOF */
287*0Sstevel@tonic-gate #define	MTIOCSHORTFMK		(MTIOC|16)	/* Enable/Disable Short FMK */
288*0Sstevel@tonic-gate 
289*0Sstevel@tonic-gate /*
290*0Sstevel@tonic-gate  * This state enum is the argument passed to the MTIOCSTATE ioctl.
291*0Sstevel@tonic-gate  */
292*0Sstevel@tonic-gate enum mtio_state { MTIO_NONE, MTIO_EJECTED, MTIO_INSERTED };
293*0Sstevel@tonic-gate 
294*0Sstevel@tonic-gate #ifndef KERNEL
295*0Sstevel@tonic-gate /*
296*0Sstevel@tonic-gate  * don't use DEFTAPE.
297*0Sstevel@tonic-gate  */
298*0Sstevel@tonic-gate #define	DEFTAPE	"/dev/rmt/0"
299*0Sstevel@tonic-gate #endif
300*0Sstevel@tonic-gate 
301*0Sstevel@tonic-gate /*
302*0Sstevel@tonic-gate  * Layout of minor device byte
303*0Sstevel@tonic-gate  * 15 - 8    7    6    5    4    3    2    1    0
304*0Sstevel@tonic-gate  * --------------------------------------------
305*0Sstevel@tonic-gate  * |    |    |    |    |    |    |    |    |----| Unit #. lower 2 bits
306*0Sstevel@tonic-gate  * |    |    |    |    |    |    |    |---------- No rewind on close bit....
307*0Sstevel@tonic-gate  * |    |    |    |    |    |----|--------------- Density Select
308*0Sstevel@tonic-gate  * |    |    |    |    |------------------------- Resrvd.(add. campus dens. bit)
309*0Sstevel@tonic-gate  * |    |    |    |------------------------------ BSD behavior
310*0Sstevel@tonic-gate  * |----|----|----------------------------------- Unit #  bit 2-6
311*0Sstevel@tonic-gate  */
312*0Sstevel@tonic-gate 
313*0Sstevel@tonic-gate #define	MTUNIT(dev)	(((getminor(dev) & 0xff80) >> 5) + \
314*0Sstevel@tonic-gate 			    (getminor(dev) & 0x3))
315*0Sstevel@tonic-gate #define	MT_NOREWIND	(1 <<2)
316*0Sstevel@tonic-gate #define	MT_DENSITY_MASK	(3 <<3)
317*0Sstevel@tonic-gate #define	MT_DENSITY1	(0 <<3)		/* Lowest density/format */
318*0Sstevel@tonic-gate #define	MT_DENSITY2	(1 <<3)
319*0Sstevel@tonic-gate #define	MT_DENSITY3	(2 <<3)
320*0Sstevel@tonic-gate #define	MT_DENSITY4	(3 <<3)		/* Highest density/format */
321*0Sstevel@tonic-gate #define	MTMINOR(unit)	(((unit & 0x7fc) << 5) + (unit & 0x3))
322*0Sstevel@tonic-gate #define	MT_BSD		(1 <<6)		/* BSD behavior on close */
323*0Sstevel@tonic-gate #define	MT_DENSITY(dev) ((getminor(dev) & MT_DENSITY_MASK) >> 3)
324*0Sstevel@tonic-gate 
325*0Sstevel@tonic-gate 
326*0Sstevel@tonic-gate #ifdef	__cplusplus
327*0Sstevel@tonic-gate }
328*0Sstevel@tonic-gate #endif
329*0Sstevel@tonic-gate 
330*0Sstevel@tonic-gate #endif /* _SYS_MTIO_H */
331