File: /usr/src/linux/drivers/s390/char/tapedefs.h

1     /***********************************************************************
2      *  drivers/s390/char/tapedefs.h
3      *    tape device driver for S/390 and zSeries tapes.
4      *
5      *  S390 and zSeries version
6      *    Copyright (C) 2001 IBM Corporation
7      *    Author(s):  Carsten Otte <cotte@de.ibm.com>
8      *                Tuan Ngo-Anh <ngoanh@de.ibm.com>
9      *
10      *
11      ***********************************************************************
12      */
13     
14     /* Kernel Version Compatibility section */
15     #include <linux/version.h>
16     #include <linux/blkdev.h>
17     #include <linux/blk.h>
18     #include <asm/irq.h>
19     
20     #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,2,17))
21     #define TAPE_DEBUG               // use s390 debug feature
22     #else
23     #undef TAPE_DEBUG                // debug feature not supported by our 2.2.16 code
24     static inline void set_normalized_cda ( ccw1_t * cp, unsigned long address ) {
25         cp -> cda = address;
26     }
27     static inline void clear_normalized_cda ( ccw1_t * ccw ) {
28         ccw -> cda = 0;
29     }
30     #define BUG() PRINT_FATAL("tape390: CRITICAL INTERNAL ERROR OCCURED. REPORT THIS BACK TO LINUX390@DE.IBM.COM\n")
31     #endif
32     #define CONFIG_S390_TAPE_DYNAMIC // allow devices to be attached or detached on the fly
33     #define TAPEBLOCK_RETRIES 20     // number of retries, when a block-dev request fails.
34     
35     
36     #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,3,98))
37     #define INIT_BLK_DEV(d_major,d_request_fn,d_queue_fn,d_current) \
38     do { \
39             blk_dev[d_major].queue = d_queue_fn; \
40     } while(0)
41     static inline struct request * 
42     tape_next_request( request_queue_t *queue ) 
43     {
44             return blkdev_entry_next_request(&queue->queue_head);
45     }
46     static inline void 
47     tape_dequeue_request( request_queue_t * q, struct request *req )
48     {
49             blkdev_dequeue_request (req);
50     }
51     #else 
52     #define s390_dev_info_t dev_info_t
53     typedef struct request *request_queue_t;
54     #ifndef init_waitqueue_head
55     #define init_waitqueue_head(x) do { *x = NULL; } while(0)
56     #endif
57     #define blk_init_queue(x,y) do {} while(0)
58     #define blk_queue_headactive(x,y) do {} while(0)
59     #define INIT_BLK_DEV(d_major,d_request_fn,d_queue_fn,d_current) \
60     do { \
61             blk_dev[d_major].request_fn = d_request_fn; \
62             blk_dev[d_major].queue = d_queue_fn; \
63             blk_dev[d_major].current_request = d_current; \
64     } while(0)
65     static inline struct request *
66     tape_next_request( request_queue_t *queue ) 
67     {
68         return *queue;
69     }
70     static inline void 
71     tape_dequeue_request( request_queue_t * q, struct request *req )
72     {
73             *q = req->next;
74             req->next = NULL;
75     }
76     #endif 
77