FreeBSD/Linux Kernel Cross Reference
sys/sys/mtio.h
1 /* $NetBSD: mtio.h,v 1.21 2003/08/07 16:34:09 agc Exp $ */
2
3 /*
4 * Copyright (c) 1982, 1986, 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. Neither the name of the University nor the names of its contributors
16 * may be used to endorse or promote products derived from this software
17 * without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 * SUCH DAMAGE.
30 *
31 * @(#)mtio.h 8.1 (Berkeley) 6/2/93
32 */
33
34 #ifndef _SYS_MTIO_H_
35 #define _SYS_MTIO_H_
36
37 /*
38 * Structures and definitions for mag tape io control commands
39 */
40
41 /* structure for MTIOCTOP - mag tape op command */
42 struct mtop {
43 short mt_op; /* operations defined below */
44 int32_t mt_count; /* how many of them */
45 };
46
47 /* operations */
48 #define MTWEOF 0 /* write an end-of-file record */
49 #define MTFSF 1 /* forward space file */
50 #define MTBSF 2 /* backward space file */
51 #define MTFSR 3 /* forward space record */
52 #define MTBSR 4 /* backward space record */
53 #define MTREW 5 /* rewind */
54 #define MTOFFL 6 /* rewind and put the drive offline */
55 #define MTNOP 7 /* no operation, sets status only */
56 #define MTRETEN 8 /* retension */
57 #define MTERASE 9 /* erase entire tape */
58 #define MTEOM 10 /* forward to end of media */
59 #define MTNBSF 11 /* backward space to beginning of file */
60 #define MTCACHE 12 /* enable controller cache */
61 #define MTNOCACHE 13 /* disable controller cache */
62 #define MTSETBSIZ 14 /* set block size; 0 for variable */
63 #define MTSETDNSTY 15 /* set density code for current mode */
64 #define MTCMPRESS 16 /* set/clear device compression */
65 #define MTEWARN 17 /* set/clear early warning behaviour */
66
67 /* structure for MTIOCGET - mag tape get status command */
68
69 struct mtget {
70 short mt_type; /* type of magtape device */
71 /* the following two registers are grossly device dependent */
72 short mt_dsreg; /* ``drive status'' register */
73 short mt_erreg; /* ``error'' register */
74 /* end device-dependent registers */
75 short mt_resid; /* residual count */
76 /* the following two are not yet implemented by most tape drivers */
77 int32_t mt_fileno; /* file number of current position */
78 int32_t mt_blkno; /* block number of current position */
79 /* end not yet implemented */
80 int32_t mt_blksiz; /* current block size */
81 int32_t mt_density; /* current density code */
82 int32_t mt_mblksiz[4]; /* block size for different modes */
83 int32_t mt_mdensity[4]; /* density codes for different modes */
84 };
85
86 /*
87 * Constants for mt_type byte. These are the same
88 * for controllers compatible with the types listed.
89 */
90 #define MT_ISTS 0x01 /* TS-11 */
91 #define MT_ISHT 0x02 /* TM03 Massbus: TE16, TU45, TU77 */
92 #define MT_ISTM 0x03 /* TM11/TE10 Unibus */
93 #define MT_ISMT 0x04 /* TM78/TU78 Massbus */
94 #define MT_ISUT 0x05 /* SI TU-45 emulation on Unibus */
95 #define MT_ISCPC 0x06 /* SUN */
96 #define MT_ISAR 0x07 /* SUN - Also "GENERIC SCSI" */
97 #define MT_ISTMSCP 0x08 /* DEC TMSCP protocol (TU81, TK50) */
98 #define MT_ISCY 0x09 /* CCI Cipher */
99 #define MT_ISCT 0x0a /* HP 1/4 tape */
100 #define MT_ISFHP 0x0b /* HP 7980 1/2 tape */
101 #define MT_ISEXABYTE 0x0c /* Exabyte */
102 #define MT_ISEXA8200 0x0c /* Exabyte EXB-8200 */
103 #define MT_ISEXA8500 0x0d /* Exabyte EXB-8500 */
104 #define MT_ISVIPER1 0x0e /* Archive Viper-150 */
105 #define MT_ISPYTHON 0x0f /* Archive Python (DAT) */
106 #define MT_ISHPDAT 0x10 /* HP 35450A DAT drive */
107 #define MT_ISWANGTEK 0x11 /* WANGTEK 5150ES */
108 #define MT_ISCALIPER 0x12 /* Caliper CP150 */
109 #define MT_ISWTEK5099 0x13 /* WANGTEK 5099ES */
110 #define MT_ISVIPER2525 0x14 /* Archive Viper 2525 */
111 #define MT_ISMFOUR 0x11 /* M4 Data 1/2 9track drive */
112 #define MT_ISTK50 0x12 /* DEC SCSI TK50 */
113 #define MT_ISMT02 0x13 /* Emulex MT02 SCSI tape controller */
114
115 /* bits defined for the mt_dsreg field */
116 #define MT_DS_RDONLY 0x10 /* tape mounted readonly */
117 #define MT_DS_MOUNTED 0x03 /* tape mounted (for control opens) */
118
119 /*
120 * For the mt_erreg field.....This is supposed to be a *generic*
121 * MT interface, so we cannot overload it with SCSI specific entities,
122 * (like ASC/ASCQ) nor is there enough room to put all the information
123 * in that is desirable. This whole structure should be redone.
124 *
125 * In the interim, this will be considered device-specific. For SCSI,
126 * this will be taken to mean the last Sense Key seen. It is not
127 * guaranteed to always be sensibly associated with any command.
128 */
129
130 /*
131 * The action of a MTIOCGET command clears mt_dsreg, mt_erreg, and mt_resid
132 */
133
134 /* mag tape io control commands */
135 #define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */
136 #define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */
137 #define MTIOCIEOT _IO('m', 3) /* ignore EOT error */
138 #define MTIOCEEOT _IO('m', 4) /* enable EOT error */
139 /*
140 * When more SCSI-3 SSC (streaming device) devices are out there
141 * that support the full 32 byte type 2 structure, we'll have to
142 * rethink these ioctls to support all the entities they haul into
143 * the picture (64 bit blocks, logical file record numbers, etc..).
144 */
145 #define MTIOCRDSPOS _IOR('m', 5, u_int32_t) /* get logical blk addr */
146 #define MTIOCRDHPOS _IOR('m', 6, u_int32_t) /* get hardware blk addr */
147 #define MTIOCSLOCATE _IOW('m', 5, u_int32_t) /* seek to logical blk addr */
148 #define MTIOCHLOCATE _IOW('m', 6, u_int32_t) /* seek to hardware blk addr */
149
150 #ifdef _KERNEL
151 /*
152 * minor device number
153 */
154
155 #define T_UNIT 003 /* unit selection */
156 #define T_NOREWIND 004 /* no rewind on close */
157 #define T_DENSEL 030 /* density select */
158 #define T_800BPI 000 /* select 800 bpi */
159 #define T_1600BPI 010 /* select 1600 bpi */
160 #define T_6250BPI 020 /* select 6250 bpi */
161 #define T_BADBPI 030 /* undefined selection */
162 #endif /* _KERNEL */
163
164 #endif /* !_SYS_MTIO_H_ */
Cache object: 406da0e58187ae1c9862894b687fa9d2
|