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