FreeBSD/Linux Kernel Cross Reference
sys/sys/mtio.h
1 /*
2 * Copyright (c) 1982, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. All advertising materials mentioning features or use of this software
14 * must display the following acknowledgement:
15 * This product includes software developed by the University of
16 * California, Berkeley and its contributors.
17 * 4. Neither the name of the University nor the names of its contributors
18 * may be used to endorse or promote products derived from this software
19 * without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)mtio.h 8.1 (Berkeley) 6/2/93
34 * $FreeBSD: src/sys/sys/mtio.h,v 1.8.2.1 1999/09/05 08:22:40 peter Exp $
35 */
36
37 #ifndef _SYS_MTIO_H_
38 #define _SYS_MTIO_H_
39
40 #ifndef KERNEL
41 #include <sys/types.h>
42 #endif
43 #include <sys/ioccom.h>
44
45 /*
46 * Structures and definitions for mag tape io control commands
47 */
48
49 /* structure for MTIOCTOP - mag tape op command */
50 struct mtop {
51 short mt_op; /* operations defined below */
52 daddr_t mt_count; /* how many of them */
53 };
54
55 /* operations */
56 #define MTWEOF 0 /* write an end-of-file record */
57 #define MTFSF 1 /* forward space file */
58 #define MTBSF 2 /* backward space file */
59 #define MTFSR 3 /* forward space record */
60 #define MTBSR 4 /* backward space record */
61 #define MTREW 5 /* rewind */
62 #define MTOFFL 6 /* rewind and put the drive offline */
63 #define MTNOP 7 /* no operation, sets status only */
64 #define MTCACHE 8 /* enable controller cache */
65 #define MTNOCACHE 9 /* disable controller cache */
66
67 #if defined(__FreeBSD__)
68 /* Set block size for device. If device is a variable size dev */
69 /* a non zero parameter will change the device to a fixed block size */
70 /* device with block size set to that of the parameter passed in. */
71 /* Resetting the block size to 0 will restore the device to a variable */
72 /* block size device. */
73
74 #define MTSETBSIZ 10
75
76 /* Set density values for device. They are defined in the SCSI II spec */
77 /* and range from 0 to 0x17. Sets the value for the opened mode only */
78
79 #define MTSETDNSTY 11
80
81 #define MTERASE 12 /* erase to EOM */
82 #define MTEOD 13 /* Space to EOM */
83 #define MTCOMP 14 /* select compression mode 0=off, 1=def */
84 #define MTRETENS 15 /* re-tension tape */
85
86 #endif
87
88 /* structure for MTIOCGET - mag tape get status command */
89
90 struct mtget {
91 short mt_type; /* type of magtape device */
92 /* the following two registers are grossly device dependent */
93 short mt_dsreg; /* ``drive status'' register */
94 short mt_erreg; /* ``error'' register */
95 /* end device-dependent registers */
96 short mt_resid; /* residual count */
97 #if defined (__FreeBSD__)
98 daddr_t mt_blksiz; /* presently operating blocksize */
99 daddr_t mt_density; /* presently operating density */
100 daddr_t mt_comp; /* presently operating compression */
101 daddr_t mt_blksiz0; /* blocksize for mode 0 */
102 daddr_t mt_blksiz1; /* blocksize for mode 1 */
103 daddr_t mt_blksiz2; /* blocksize for mode 2 */
104 daddr_t mt_blksiz3; /* blocksize for mode 3 */
105 daddr_t mt_density0; /* density for mode 0 */
106 daddr_t mt_density1; /* density for mode 1 */
107 daddr_t mt_density2; /* density for mode 2 */
108 daddr_t mt_density3; /* density for mode 3 */
109 /* the following are not yet implemented */
110 u_char mt_comp0; /* compression type for mode 0 */
111 u_char mt_comp1; /* compression type for mode 1 */
112 u_char mt_comp2; /* compression type for mode 2 */
113 u_char mt_comp3; /* compression type for mode 3 */
114 #endif
115 daddr_t mt_fileno; /* file number of current position */
116 daddr_t mt_blkno; /* block number of current position */
117 /* end not yet implemented */
118 };
119
120 /*
121 * Constants for mt_type byte. These are the same
122 * for controllers compatible with the types listed.
123 */
124 #define MT_ISTS 0x01 /* TS-11 */
125 #define MT_ISHT 0x02 /* TM03 Massbus: TE16, TU45, TU77 */
126 #define MT_ISTM 0x03 /* TM11/TE10 Unibus */
127 #define MT_ISMT 0x04 /* TM78/TU78 Massbus */
128 #define MT_ISUT 0x05 /* SI TU-45 emulation on Unibus */
129 #define MT_ISCPC 0x06 /* SUN */
130 #define MT_ISAR 0x07 /* SUN */
131 #define MT_ISTMSCP 0x08 /* DEC TMSCP protocol (TU81, TK50) */
132 #define MT_ISCY 0x09 /* CCI Cipher */
133 #define MT_ISCT 0x0a /* HP 1/4 tape */
134 #define MT_ISFHP 0x0b /* HP 7980 1/2 tape */
135 #define MT_ISEXABYTE 0x0c /* Exabyte */
136 #define MT_ISEXA8200 0x0c /* Exabyte EXB-8200 */
137 #define MT_ISEXA8500 0x0d /* Exabyte EXB-8500 */
138 #define MT_ISVIPER1 0x0e /* Archive Viper-150 */
139 #define MT_ISPYTHON 0x0f /* Archive Python (DAT) */
140 #define MT_ISHPDAT 0x10 /* HP 35450A DAT drive */
141 #define MT_ISMFOUR 0x11 /* M4 Data 1/2 9track drive */
142 #define MT_ISTK50 0x12 /* DEC SCSI TK50 */
143 #define MT_ISMT02 0x13 /* Emulex MT02 SCSI tape controller */
144
145 /* mag tape io control commands */
146 #define MTIOCTOP _IOW('m', 1, struct mtop) /* do a mag tape op */
147 #define MTIOCGET _IOR('m', 2, struct mtget) /* get tape status */
148 #define MTIOCIEOT _IO('m', 3) /* ignore EOT error */
149 #define MTIOCEEOT _IO('m', 4) /* enable EOT error */
150
151 #ifndef KERNEL
152 #define DEFTAPE "/dev/nrst0"
153 #endif
154
155 #ifdef KERNEL
156 /*
157 * minor device number
158 */
159
160 #define T_UNIT 003 /* unit selection */
161 #define T_NOREWIND 004 /* no rewind on close */
162 #define T_DENSEL 030 /* density select */
163 #define T_800BPI 000 /* select 800 bpi */
164 #define T_1600BPI 010 /* select 1600 bpi */
165 #define T_6250BPI 020 /* select 6250 bpi */
166 #define T_BADBPI 030 /* undefined selection */
167 #endif
168
169 #endif /* !_SYS_MTIO_H_ */
Cache object: 5a96235ba5caf319beb641345fc4af54
|