1
2 #ifndef _ST_H
3 #define _ST_H
4
5
6
7
8 #ifndef _SCSI_H
9 #include "scsi.h"
10 #endif
11
12
13 typedef struct {
14 unsigned char in_use;
15 unsigned char dma;
16 int buffer_size;
17 int buffer_blocks;
18 int buffer_bytes;
19 int read_pointer;
20 int writing;
21 int last_result;
22 int last_result_fatal;
23 unsigned char *b_data;
24 int orig_size;
25 unsigned char *orig_b_data;
26 } ST_buffer;
27
28
29
30 typedef struct {
31 unsigned char defined;
32 unsigned char do_async_writes;
33 unsigned char do_buffer_writes;
34 unsigned char do_read_ahead;
35 unsigned char defaults_for_writes;
36 unsigned char default_compression;
37 short default_density;
38 int default_blksize;
39 } ST_mode;
40
41 #define ST_NBR_MODE_BITS 2
42 #define ST_NBR_MODES (1 << ST_NBR_MODE_BITS)
43 #define ST_MODE_SHIFT (7 - ST_NBR_MODE_BITS)
44 #define ST_MODE_MASK ((ST_NBR_MODES - 1) << ST_MODE_SHIFT)
45
46
47 typedef struct {
48 unsigned char rw;
49 unsigned char moves_after_eof;
50 unsigned char at_sm;
51 unsigned char last_block_valid;
52 u32 last_block_visited;
53 } ST_partstat;
54
55 #define ST_NBR_PARTITIONS 4
56
57
58 typedef struct {
59 kdev_t devt;
60 unsigned capacity;
61 struct wait_queue * waiting;
62 Scsi_Device* device;
63 Scsi_Cmnd SCpnt;
64 struct semaphore sem;
65 ST_buffer * buffer;
66
67
68 unsigned char omit_blklims;
69 unsigned char do_auto_lock;
70 unsigned char can_bsr;
71 unsigned char can_partitions;
72 unsigned char two_fm;
73 unsigned char fast_mteom;
74 unsigned char restr_dma;
75 unsigned char scsi2_logical;
76 unsigned char default_drvbuffer;
77 int write_threshold;
78
79
80 ST_mode modes[ST_NBR_MODES];
81 int current_mode;
82
83
84 int partition;
85 int new_partition;
86 int nbr_partitions;
87 ST_partstat ps[ST_NBR_PARTITIONS];
88 unsigned char dirty;
89 unsigned char ready;
90 unsigned char eof;
91 unsigned char write_prot;
92 unsigned char drv_write_prot;
93 unsigned char in_use;
94 unsigned char eof_hit;
95 unsigned char blksize_changed;
96 unsigned char density_changed;
97 unsigned char compression_changed;
98 unsigned char drv_buffer;
99 unsigned char density;
100 unsigned char door_locked;
101 unsigned char rew_at_close;
102 int block_size;
103 int min_block;
104 int max_block;
105 int recover_count;
106 int drv_block;
107 struct mtget * mt_status;
108
109 #if DEBUG
110 unsigned char write_pending;
111 int nbr_finished;
112 int nbr_waits;
113 #endif
114 } Scsi_Tape;
115
116 extern Scsi_Tape * scsi_tapes;
117
118
119 #define ST_NOEOF 0
120 #define ST_FM 1
121 #define ST_EOM_OK 2
122 #define ST_EOM_ERROR 3
123 #define ST_EOD 4
124
125
126 #define ST_IDLE 0
127 #define ST_READING 1
128 #define ST_WRITING 2
129
130
131 #define ST_READY 0
132 #define ST_NOT_READY 1
133 #define ST_NO_TAPE 2
134
135
136 #define ST_UNLOCKED 0
137 #define ST_LOCKED_EXPLICIT 1
138 #define ST_LOCKED_AUTO 2
139 #define ST_LOCK_FAILS 3
140
141
142 #define QFA_REQUEST_BLOCK 0x02
143 #define QFA_SEEK_BLOCK 0x0c
144
145
146 #define ST_DONT_TOUCH 0
147 #define ST_NO 1
148 #define ST_YES 2
149
150 #endif
151