1
2 #ifndef DASD_H
3 #define DASD_H
4
5 /* First of all the external stuff */
6 #include <linux/ioctl.h>
7 #include <linux/major.h>
8 #include <linux/wait.h>
9
10 #define IOCTL_LETTER 'D'
11 #define BIODASDFORMAT _IO(IOCTL_LETTER,0) /* Format the volume or an extent */
12 #define BIODASDDISABLE _IO(IOCTL_LETTER,1) /* Disable the volume (for Linux) */
13 #define BIODASDENABLE _IO(IOCTL_LETTER,2) /* Enable the volume (for Linux) */
14 /* Stuff for reading and writing the Label-Area to/from user space */
15 #define BIODASDGTVLBL _IOR(IOCTL_LETTER,3,dasd_volume_label_t)
16 #define BIODASDSTVLBL _IOW(IOCTL_LETTER,4,dasd_volume_label_t)
17 #define BIODASDRWTB _IOWR(IOCTL_LETTER,5,int)
18 #define BIODASDRSID _IOR(IOCTL_LETTER,6,senseid_t)
19
20 typedef
21 union {
22 char bytes[512];
23 struct {
24 /* 80 Bytes of Label data */
25 char identifier[4]; /* e.g. "LNX1", "VOL1" or "CMS1" */
26 char label[6]; /* Given by user */
27 char security;
28 char vtoc[5]; /* Null in "LNX1"-labelled partitions */
29 char reserved0[5];
30 long ci_size;
31 long blk_per_ci;
32 long lab_per_ci;
33 char reserved1[4];
34 char owner[0xe];
35 char no_part;
36 char reserved2[0x1c];
37 /* 16 Byte of some information on the dasd */
38 short blocksize;
39 char nopart;
40 char unused;
41 long unused2[3];
42 /* 7*10 = 70 Bytes of partition data */
43 struct {
44 char type;
45 long start;
46 long size;
47 char unused;
48 } part[7];
49 } __attribute__ ((packed)) label;
50 } dasd_volume_label_t;
51
52 typedef union {
53 struct {
54 unsigned long no;
55 unsigned int ct;
56 } __attribute__ ((packed)) input;
57 struct {
58 unsigned long noct;
59 } __attribute__ ((packed)) output;
60 } __attribute__ ((packed)) dasd_xlate_t;
61
62 int dasd_init (void);
63 #ifdef MODULE
64 int init_module (void);
65 void cleanup_module (void);
66 #endif /* MODULE */
67
68 /* Definitions for blk.h */
69 /* #define DASD_MAGIC 0x44415344 is ascii-"DASD" */
70 /* #define dasd_MAGIC 0x64617364; is ascii-"dasd" */
71 #define DASD_MAGIC 0xC4C1E2C4 /* is ebcdic-"DASD" */
72 #define dasd_MAGIC 0x8481A284 /* is ebcdic-"dasd" */
73 #define DASD_NAME "dasd"
74 #define DASD_PARTN_BITS 2
75 #define DASD_MAX_DEVICES (256>>DASD_PARTN_BITS)
76
77 #define MAJOR_NR DASD_MAJOR
78 #define PARTN_BITS DASD_PARTN_BITS
79
80 #ifdef __KERNEL__
81 /* Now lets turn to the internal sbtuff */
82 /*
83 define the debug levels:
84 - 0 No debugging output to console or syslog
85 - 1 Log internal errors to syslog, ignore check conditions
86 - 2 Log internal errors and check conditions to syslog
87 - 3 Log internal errors to console, log check conditions to syslog
88 - 4 Log internal errors and check conditions to console
89 - 5 panic on internal errors, log check conditions to console
90 - 6 panic on both, internal errors and check conditions
91 */
92 #define DASD_DEBUG 4
93
94 #define DASD_PROFILE
95 /*
96 define the level of paranoia
97 - 0 quite sure, that things are going right
98 - 1 sanity checking, only to avoid panics
99 - 2 normal sanity checking
100 - 3 extensive sanity checks
101 - 4 exhaustive debug messages
102 */
103 #define DASD_PARANOIA 2
104
105 /*
106 define the depth of flow control, which is logged as a check condition
107 - 0 No flow control messages
108 - 1 Entry of functions logged like check condition
109 - 2 Entry and exit of functions logged like check conditions
110 - 3 Internal structure broken down
111 - 4 unrolling of loops,...
112 */
113 #define DASD_FLOW_CONTROL 0
114
115 #if DASD_DEBUG > 0
116 #define PRINT_DEBUG(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
117 #define PRINT_INFO(x...) printk ( KERN_INFO PRINTK_HEADER x )
118 #define PRINT_WARN(x...) printk ( KERN_WARNING PRINTK_HEADER x )
119 #define PRINT_ERR(x...) printk ( KERN_ERR PRINTK_HEADER x )
120 #define PRINT_FATAL(x...) panic ( PRINTK_HEADER x )
121 #else
122 #define PRINT_DEBUG(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
123 #define PRINT_INFO(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
124 #define PRINT_WARN(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
125 #define PRINT_ERR(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
126 #define PRINT_FATAL(x...) printk ( KERN_DEBUG PRINTK_HEADER x )
127 #endif /* DASD_DEBUG */
128
129 #define INTERNAL_ERRMSG(x,y...) \
130 "Internal error: in file " __FILE__ " line: %d: " x, __LINE__, y
131 #define INTERNAL_CHKMSG(x,y...) \
132 "Inconsistency: in file " __FILE__ " line: %d: " x, __LINE__, y
133 #define INTERNAL_FLWMSG(x,y...) \
134 "Flow control: file " __FILE__ " line: %d: " x, __LINE__, y
135
136 #if DASD_DEBUG > 4
137 #define INTERNAL_ERROR(x...) PRINT_FATAL ( INTERNAL_ERRMSG ( x ) )
138 #elif DASD_DEBUG > 2
139 #define INTERNAL_ERROR(x...) PRINT_ERR ( INTERNAL_ERRMSG ( x ) )
140 #elif DASD_DEBUG > 0
141 #define INTERNAL_ERROR(x...) PRINT_WARN ( INTERNAL_ERRMSG ( x ) )
142 #else
143 #define INTERNAL_ERROR(x...)
144 #endif /* DASD_DEBUG */
145
146 #if DASD_DEBUG > 5
147 #define INTERNAL_CHECK(x...) PRINT_FATAL ( INTERNAL_CHKMSG ( x ) )
148 #elif DASD_DEBUG > 3
149 #define INTERNAL_CHECK(x...) PRINT_ERR ( INTERNAL_CHKMSG ( x ) )
150 #elif DASD_DEBUG > 1
151 #define INTERNAL_CHECK(x...) PRINT_WARN ( INTERNAL_CHKMSG ( x ) )
152 #else
153 #define INTERNAL_CHECK(x...)
154 #endif /* DASD_DEBUG */
155
156 #if DASD_DEBUG > 3
157 #define INTERNAL_FLOW(x...) PRINT_ERR ( INTERNAL_FLWMSG ( x ) )
158 #elif DASD_DEBUG > 2
159 #define INTERNAL_FLOW(x...) PRINT_WARN ( INTERNAL_FLWMSG ( x ) )
160 #else
161 #define INTERNAL_FLOW(x...)
162 #endif /* DASD_DEBUG */
163
164 #if DASD_FLOW_CONTROL > 0
165 #define FUNCTION_ENTRY(x) INTERNAL_FLOW( x "entered %s\n","" );
166 #else
167 #define FUNCTION_ENTRY(x)
168 #endif /* DASD_FLOW_CONTROL */
169
170 #if DASD_FLOW_CONTROL > 1
171 #define FUNCTION_EXIT(x) INTERNAL_FLOW( x "exited %s\n","" );
172 #else
173 #define FUNCTION_EXIT(x)
174 #endif /* DASD_FLOW_CONTROL */
175
176 #if DASD_FLOW_CONTROL > 2
177 #define FUNCTION_CONTROL(x...) INTERNAL_FLOW( x );
178 #else
179 #define FUNCTION_CONTROL(x...)
180 #endif /* DASD_FLOW_CONTROL */
181
182 #if DASD_FLOW_CONTROL > 3
183 #define LOOP_CONTROL(x...) INTERNAL_FLOW( x );
184 #else
185 #define LOOP_CONTROL(x...)
186 #endif /* DASD_FLOW_CONTROL */
187
188 #define DASD_DO_IO_SLEEP 0x01
189 #define DASD_DO_IO_NOLOCK 0x02
190 #define DASD_DO_IO_NODEC 0x04
191
192 #define DASD_NOT_FORMATTED 0x01
193
194 extern wait_queue_head_t dasd_waitq;
195
196 #undef DEBUG_DASD_MALLOC
197 #ifdef DEBUG_DASD_MALLOC
198 void *b;
199 #define kmalloc(x...) (PRINT_INFO(" kmalloc %p\n",b=kmalloc(x)),b)
200 #define kfree(x) PRINT_INFO(" kfree %p\n",x);kfree(x)
201 #define get_free_page(x...) (PRINT_INFO(" gfp %p\n",b=get_free_page(x)),b)
202 #define __get_free_pages(x...) (PRINT_INFO(" gfps %p\n",b=__get_free_pages(x)),b)
203 #endif /* DEBUG_DASD_MALLOC */
204
205 #endif /* __KERNEL__ */
206 #endif /* DASD_H */
207
208 /*
209 * Overrides for Emacs so that we follow Linus's tabbing style.
210 * Emacs will notice this stuff at the end of the file and automatically
211 * adjust the settings for this buffer only. This must remain at the end
212 * of the file.
213 * ---------------------------------------------------------------------------
214 * Local variables:
215 * c-indent-level: 4
216 * c-brace-imaginary-offset: 0
217 * c-brace-offset: -4
218 * c-argdecl-indent: 4
219 * c-label-offset: -4
220 * c-continued-statement-offset: 4
221 * c-continued-brace-offset: 0
222 * indent-tabs-mode: nil
223 * tab-width: 8
224 * End:
225 */
226
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.