ia64/xen-unstable

view linux-2.4-xen-sparse/include/linux/blk.h @ 6385:f34e732ed4bf

Xenstore testsuite robustness: save output rather than rerun on failure.
"make check" reruns a test which fails with more verbosity. If the test
fails intermittently, that doesn't work well: save the output and simply
dump it if the test fails.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Christian Limpach <Christian.Limpach@cl.cam.ac.uk>
author cl349@firebug.cl.cam.ac.uk
date Tue Aug 23 19:58:59 2005 +0000 (2005-08-23)
parents f294acb25858
children 8799d14bef77 9312a3e8a6f8 23979fb12c49 84ee014ebd41 99914b54f7bf 81576d3d1ca8 3a8f27c6d56c cc5f88b719d0 fa0754a9f64f 112d44270733
line source
1 #ifndef _BLK_H
2 #define _BLK_H
4 #include <linux/blkdev.h>
5 #include <linux/locks.h>
6 #include <linux/config.h>
7 #include <linux/spinlock.h>
9 /*
10 * Spinlock for protecting the request queue which
11 * is mucked around with in interrupts on potentially
12 * multiple CPU's..
13 */
14 extern spinlock_t io_request_lock;
16 /*
17 * Initialization functions.
18 */
19 extern int isp16_init(void);
20 extern int cdu31a_init(void);
21 extern int acsi_init(void);
22 extern int mcd_init(void);
23 extern int mcdx_init(void);
24 extern int sbpcd_init(void);
25 extern int aztcd_init(void);
26 extern int sony535_init(void);
27 extern int gscd_init(void);
28 extern int cm206_init(void);
29 extern int optcd_init(void);
30 extern int sjcd_init(void);
31 extern int cdi_init(void);
32 extern int hd_init(void);
33 extern int ide_init(void);
34 extern int xd_init(void);
35 extern int mfm_init(void);
36 extern int loop_init(void);
37 extern int md_init(void);
38 extern int ap_init(void);
39 extern int ddv_init(void);
40 extern int z2_init(void);
41 extern int swim3_init(void);
42 extern int swimiop_init(void);
43 extern int amiga_floppy_init(void);
44 extern int atari_floppy_init(void);
45 extern int ez_init(void);
46 extern int bpcd_init(void);
47 extern int ps2esdi_init(void);
48 extern int jsfd_init(void);
49 extern int viodasd_init(void);
50 extern int viocd_init(void);
52 #if defined(CONFIG_ARCH_S390)
53 extern int dasd_init(void);
54 extern int xpram_init(void);
55 extern int tapeblock_init(void);
56 #endif /* CONFIG_ARCH_S390 */
58 #if defined(CONFIG_XEN)
59 extern int xlblk_init(void);
60 #endif /* CONFIG_XEN */
62 extern void set_device_ro(kdev_t dev,int flag);
63 void add_blkdev_randomness(int major);
65 extern int floppy_init(void);
66 extern int rd_doload; /* 1 = load ramdisk, 0 = don't load */
67 extern int rd_prompt; /* 1 = prompt for ramdisk, 0 = don't prompt */
68 extern int rd_image_start; /* starting block # of image */
70 #ifdef CONFIG_BLK_DEV_INITRD
72 #define INITRD_MINOR 250 /* shouldn't collide with /dev/ram* too soon ... */
74 extern unsigned long initrd_start,initrd_end;
75 extern int initrd_below_start_ok; /* 1 if it is not an error if initrd_start < memory_start */
76 void initrd_init(void);
78 #endif
81 /*
82 * end_request() and friends. Must be called with the request queue spinlock
83 * acquired. All functions called within end_request() _must_be_ atomic.
84 *
85 * Several drivers define their own end_request and call
86 * end_that_request_first() and end_that_request_last()
87 * for parts of the original function. This prevents
88 * code duplication in drivers.
89 */
91 static inline void blkdev_dequeue_request(struct request * req)
92 {
93 list_del(&req->queue);
94 }
96 int end_that_request_first(struct request *req, int uptodate, char *name);
97 void end_that_request_last(struct request *req);
99 #if defined(MAJOR_NR) || defined(IDE_DRIVER)
101 #undef DEVICE_ON
102 #undef DEVICE_OFF
104 /*
105 * Add entries as needed.
106 */
108 #ifdef IDE_DRIVER
110 #define DEVICE_NR(device) (MINOR(device) >> PARTN_BITS)
111 #define DEVICE_NAME "ide"
113 #elif (MAJOR_NR == RAMDISK_MAJOR)
115 /* ram disk */
116 #define DEVICE_NAME "ramdisk"
117 #define DEVICE_NR(device) (MINOR(device))
118 #define DEVICE_NO_RANDOM
120 #elif (MAJOR_NR == Z2RAM_MAJOR)
122 /* Zorro II Ram */
123 #define DEVICE_NAME "Z2RAM"
124 #define DEVICE_REQUEST do_z2_request
125 #define DEVICE_NR(device) (MINOR(device))
127 #elif (MAJOR_NR == FLOPPY_MAJOR)
129 static void floppy_off(unsigned int nr);
131 #define DEVICE_NAME "floppy"
132 #define DEVICE_INTR do_floppy
133 #define DEVICE_REQUEST do_fd_request
134 #define DEVICE_NR(device) ( (MINOR(device) & 3) | ((MINOR(device) & 0x80 ) >> 5 ))
135 #define DEVICE_OFF(device) floppy_off(DEVICE_NR(device))
137 #elif (MAJOR_NR == HD_MAJOR)
139 /* Hard disk: timeout is 6 seconds. */
140 #define DEVICE_NAME "hard disk"
141 #define DEVICE_INTR do_hd
142 #define TIMEOUT_VALUE (6*HZ)
143 #define DEVICE_REQUEST do_hd_request
144 #define DEVICE_NR(device) (MINOR(device)>>6)
146 #elif (SCSI_DISK_MAJOR(MAJOR_NR))
148 #define DEVICE_NAME "scsidisk"
149 #define TIMEOUT_VALUE (2*HZ)
150 #define DEVICE_NR(device) (((MAJOR(device) & SD_MAJOR_MASK) << (8 - 4)) + (MINOR(device) >> 4))
152 /* Kludge to use the same number for both char and block major numbers */
153 #elif (MAJOR_NR == MD_MAJOR) && defined(MD_DRIVER)
155 #define DEVICE_NAME "Multiple devices driver"
156 #define DEVICE_REQUEST do_md_request
157 #define DEVICE_NR(device) (MINOR(device))
159 #elif (MAJOR_NR == SCSI_TAPE_MAJOR)
161 #define DEVICE_NAME "scsitape"
162 #define DEVICE_INTR do_st
163 #define DEVICE_NR(device) (MINOR(device) & 0x7f)
165 #elif (MAJOR_NR == OSST_MAJOR)
167 #define DEVICE_NAME "onstream"
168 #define DEVICE_INTR do_osst
169 #define DEVICE_NR(device) (MINOR(device) & 0x7f)
170 #define DEVICE_ON(device)
171 #define DEVICE_OFF(device)
173 #elif (MAJOR_NR == SCSI_CDROM_MAJOR)
175 #define DEVICE_NAME "CD-ROM"
176 #define DEVICE_NR(device) (MINOR(device))
178 #elif (MAJOR_NR == XT_DISK_MAJOR)
180 #define DEVICE_NAME "xt disk"
181 #define DEVICE_REQUEST do_xd_request
182 #define DEVICE_NR(device) (MINOR(device) >> 6)
184 #elif (MAJOR_NR == PS2ESDI_MAJOR)
186 #define DEVICE_NAME "PS/2 ESDI"
187 #define DEVICE_REQUEST do_ps2esdi_request
188 #define DEVICE_NR(device) (MINOR(device) >> 6)
190 #elif (MAJOR_NR == CDU31A_CDROM_MAJOR)
192 #define DEVICE_NAME "CDU31A"
193 #define DEVICE_REQUEST do_cdu31a_request
194 #define DEVICE_NR(device) (MINOR(device))
196 #elif (MAJOR_NR == ACSI_MAJOR) && (defined(CONFIG_ATARI_ACSI) || defined(CONFIG_ATARI_ACSI_MODULE))
198 #define DEVICE_NAME "ACSI"
199 #define DEVICE_INTR do_acsi
200 #define DEVICE_REQUEST do_acsi_request
201 #define DEVICE_NR(device) (MINOR(device) >> 4)
203 #elif (MAJOR_NR == MITSUMI_CDROM_MAJOR)
205 #define DEVICE_NAME "Mitsumi CD-ROM"
206 /* #define DEVICE_INTR do_mcd */
207 #define DEVICE_REQUEST do_mcd_request
208 #define DEVICE_NR(device) (MINOR(device))
210 #elif (MAJOR_NR == MITSUMI_X_CDROM_MAJOR)
212 #define DEVICE_NAME "Mitsumi CD-ROM"
213 /* #define DEVICE_INTR do_mcdx */
214 #define DEVICE_REQUEST do_mcdx_request
215 #define DEVICE_NR(device) (MINOR(device))
217 #elif (MAJOR_NR == MATSUSHITA_CDROM_MAJOR)
219 #define DEVICE_NAME "Matsushita CD-ROM controller #1"
220 #define DEVICE_REQUEST do_sbpcd_request
221 #define DEVICE_NR(device) (MINOR(device))
223 #elif (MAJOR_NR == MATSUSHITA_CDROM2_MAJOR)
225 #define DEVICE_NAME "Matsushita CD-ROM controller #2"
226 #define DEVICE_REQUEST do_sbpcd2_request
227 #define DEVICE_NR(device) (MINOR(device))
229 #elif (MAJOR_NR == MATSUSHITA_CDROM3_MAJOR)
231 #define DEVICE_NAME "Matsushita CD-ROM controller #3"
232 #define DEVICE_REQUEST do_sbpcd3_request
233 #define DEVICE_NR(device) (MINOR(device))
235 #elif (MAJOR_NR == MATSUSHITA_CDROM4_MAJOR)
237 #define DEVICE_NAME "Matsushita CD-ROM controller #4"
238 #define DEVICE_REQUEST do_sbpcd4_request
239 #define DEVICE_NR(device) (MINOR(device))
241 #elif (MAJOR_NR == AZTECH_CDROM_MAJOR)
243 #define DEVICE_NAME "Aztech CD-ROM"
244 #define DEVICE_REQUEST do_aztcd_request
245 #define DEVICE_NR(device) (MINOR(device))
247 #elif (MAJOR_NR == CDU535_CDROM_MAJOR)
249 #define DEVICE_NAME "SONY-CDU535"
250 #define DEVICE_INTR do_cdu535
251 #define DEVICE_REQUEST do_cdu535_request
252 #define DEVICE_NR(device) (MINOR(device))
254 #elif (MAJOR_NR == GOLDSTAR_CDROM_MAJOR)
256 #define DEVICE_NAME "Goldstar R420"
257 #define DEVICE_REQUEST do_gscd_request
258 #define DEVICE_NR(device) (MINOR(device))
260 #elif (MAJOR_NR == CM206_CDROM_MAJOR)
261 #define DEVICE_NAME "Philips/LMS CD-ROM cm206"
262 #define DEVICE_REQUEST do_cm206_request
263 #define DEVICE_NR(device) (MINOR(device))
265 #elif (MAJOR_NR == OPTICS_CDROM_MAJOR)
267 #define DEVICE_NAME "DOLPHIN 8000AT CD-ROM"
268 #define DEVICE_REQUEST do_optcd_request
269 #define DEVICE_NR(device) (MINOR(device))
271 #elif (MAJOR_NR == SANYO_CDROM_MAJOR)
273 #define DEVICE_NAME "Sanyo H94A CD-ROM"
274 #define DEVICE_REQUEST do_sjcd_request
275 #define DEVICE_NR(device) (MINOR(device))
277 #elif (MAJOR_NR == APBLOCK_MAJOR)
279 #define DEVICE_NAME "apblock"
280 #define DEVICE_REQUEST ap_request
281 #define DEVICE_NR(device) (MINOR(device))
283 #elif (MAJOR_NR == DDV_MAJOR)
285 #define DEVICE_NAME "ddv"
286 #define DEVICE_REQUEST ddv_request
287 #define DEVICE_NR(device) (MINOR(device)>>PARTN_BITS)
289 #elif (MAJOR_NR == MFM_ACORN_MAJOR)
291 #define DEVICE_NAME "mfm disk"
292 #define DEVICE_INTR do_mfm
293 #define DEVICE_REQUEST do_mfm_request
294 #define DEVICE_NR(device) (MINOR(device) >> 6)
296 #elif (MAJOR_NR == NBD_MAJOR)
298 #define DEVICE_NAME "nbd"
299 #define DEVICE_REQUEST do_nbd_request
300 #define DEVICE_NR(device) (MINOR(device))
302 #elif (MAJOR_NR == MDISK_MAJOR)
304 #define DEVICE_NAME "mdisk"
305 #define DEVICE_REQUEST mdisk_request
306 #define DEVICE_NR(device) (MINOR(device))
308 #elif (MAJOR_NR == DASD_MAJOR)
310 #define DEVICE_NAME "dasd"
311 #define DEVICE_REQUEST do_dasd_request
312 #define DEVICE_NR(device) (MINOR(device) >> PARTN_BITS)
314 #elif (MAJOR_NR == I2O_MAJOR)
316 #define DEVICE_NAME "I2O block"
317 #define DEVICE_REQUEST i2ob_request
318 #define DEVICE_NR(device) (MINOR(device)>>4)
320 #elif (MAJOR_NR == COMPAQ_SMART2_MAJOR)
322 #define DEVICE_NAME "ida"
323 #define TIMEOUT_VALUE (25*HZ)
324 #define DEVICE_REQUEST do_ida_request
325 #define DEVICE_NR(device) (MINOR(device) >> 4)
327 #endif /* MAJOR_NR == whatever */
329 /* provide DEVICE_xxx defaults, if not explicitly defined
330 * above in the MAJOR_NR==xxx if-elif tree */
331 #ifndef DEVICE_ON
332 #define DEVICE_ON(device) do {} while (0)
333 #endif
334 #ifndef DEVICE_OFF
335 #define DEVICE_OFF(device) do {} while (0)
336 #endif
338 #if (MAJOR_NR != SCSI_TAPE_MAJOR) && (MAJOR_NR != OSST_MAJOR)
339 #if !defined(IDE_DRIVER)
341 #ifndef CURRENT
342 #define CURRENT blkdev_entry_next_request(&blk_dev[MAJOR_NR].request_queue.queue_head)
343 #endif
344 #ifndef QUEUE_EMPTY
345 #define QUEUE_EMPTY list_empty(&blk_dev[MAJOR_NR].request_queue.queue_head)
346 #endif
348 #ifndef DEVICE_NAME
349 #define DEVICE_NAME "unknown"
350 #endif
352 #define CURRENT_DEV DEVICE_NR(CURRENT->rq_dev)
354 #ifdef DEVICE_INTR
355 static void (*DEVICE_INTR)(void) = NULL;
356 #endif
358 #define SET_INTR(x) (DEVICE_INTR = (x))
360 #ifdef DEVICE_REQUEST
361 static void (DEVICE_REQUEST)(request_queue_t *);
362 #endif
364 #ifdef DEVICE_INTR
365 #define CLEAR_INTR SET_INTR(NULL)
366 #else
367 #define CLEAR_INTR
368 #endif
370 #define INIT_REQUEST \
371 if (QUEUE_EMPTY) {\
372 CLEAR_INTR; \
373 return; \
374 } \
375 if (MAJOR(CURRENT->rq_dev) != MAJOR_NR) \
376 panic(DEVICE_NAME ": request list destroyed"); \
377 if (CURRENT->bh) { \
378 if (!buffer_locked(CURRENT->bh)) \
379 panic(DEVICE_NAME ": block not locked"); \
380 }
382 #endif /* !defined(IDE_DRIVER) */
385 #ifndef LOCAL_END_REQUEST /* If we have our own end_request, we do not want to include this mess */
387 #if ! SCSI_BLK_MAJOR(MAJOR_NR) && (MAJOR_NR != COMPAQ_SMART2_MAJOR)
389 static inline void end_request(int uptodate) {
390 struct request *req = CURRENT;
392 if (end_that_request_first(req, uptodate, DEVICE_NAME))
393 return;
395 #ifndef DEVICE_NO_RANDOM
396 add_blkdev_randomness(MAJOR(req->rq_dev));
397 #endif
398 DEVICE_OFF(req->rq_dev);
399 blkdev_dequeue_request(req);
400 end_that_request_last(req);
401 }
403 #endif /* ! SCSI_BLK_MAJOR(MAJOR_NR) */
404 #endif /* LOCAL_END_REQUEST */
406 #endif /* (MAJOR_NR != SCSI_TAPE_MAJOR) */
407 #endif /* defined(MAJOR_NR) || defined(IDE_DRIVER) */
409 #endif /* _BLK_H */