direct-io.hg

view linux-2.6-xen-sparse/drivers/xen/blkback/common.h @ 8615:7ef28da1d777

remove ASSERT macro that is not used anymore in blkback.

Signed-off-by: Vincent Hanquez <vincent@xensource.com>
author vhanquez@kneesa.uk.xensource.com
date Mon Jan 16 21:29:10 2006 +0000 (2006-01-16)
parents 6f62ad959f6b
children 7eaa8d1a4ea0
line source
2 #ifndef __BLKIF__BACKEND__COMMON_H__
3 #define __BLKIF__BACKEND__COMMON_H__
5 #include <linux/config.h>
6 #include <linux/version.h>
7 #include <linux/module.h>
8 #include <linux/interrupt.h>
9 #include <linux/slab.h>
10 #include <linux/blkdev.h>
11 #include <linux/vmalloc.h>
12 #include <asm/io.h>
13 #include <asm/setup.h>
14 #include <asm/pgalloc.h>
15 #include <asm-xen/evtchn.h>
16 #include <asm/hypervisor.h>
17 #include <asm-xen/xen-public/io/blkif.h>
18 #include <asm-xen/xen-public/io/ring.h>
19 #include <asm-xen/gnttab.h>
20 #include <asm-xen/driver_util.h>
22 #if 0
23 #define DPRINTK(_f, _a...) printk(KERN_ALERT "(file=%s, line=%d) " _f, \
24 __FILE__ , __LINE__ , ## _a )
25 #else
26 #define DPRINTK(_f, _a...) ((void)0)
27 #endif
29 struct vbd {
30 blkif_vdev_t handle; /* what the domain refers to this vbd as */
31 unsigned char readonly; /* Non-zero -> read-only */
32 unsigned char type; /* VDISK_xxx */
33 u32 pdevice; /* phys device that this vbd maps to */
34 struct block_device *bdev;
35 };
37 struct backend_info;
39 typedef struct blkif_st {
40 /* Unique identifier for this interface. */
41 domid_t domid;
42 unsigned int handle;
43 /* Physical parameters of the comms window. */
44 unsigned int evtchn;
45 unsigned int irq;
46 /* Comms information. */
47 blkif_back_ring_t blk_ring;
48 struct vm_struct *blk_ring_area;
49 /* The VBD attached to this interface. */
50 struct vbd vbd;
51 /* Back pointer to the backend_info. */
52 struct backend_info *be;
53 /* Private fields. */
54 enum { DISCONNECTED, CONNECTED } status;
55 #ifdef CONFIG_XEN_BLKDEV_TAP_BE
56 /* Is this a blktap frontend */
57 unsigned int is_blktap;
58 #endif
59 spinlock_t blk_ring_lock;
60 atomic_t refcnt;
62 wait_queue_head_t wq;
63 struct task_struct *xenblkd;
64 atomic_t io_pending;
65 request_queue_t *plug;
67 /* statistics */
68 unsigned long st_print;
69 int st_rd_req;
70 int st_wr_req;
71 int st_oo_req;
73 struct work_struct free_work;
75 grant_handle_t shmem_handle;
76 grant_ref_t shmem_ref;
77 } blkif_t;
79 blkif_t *alloc_blkif(domid_t domid);
80 void free_blkif_callback(blkif_t *blkif);
81 int blkif_map(blkif_t *blkif, unsigned long shared_page, unsigned int evtchn);
83 #define blkif_get(_b) (atomic_inc(&(_b)->refcnt))
84 #define blkif_put(_b) \
85 do { \
86 if (atomic_dec_and_test(&(_b)->refcnt)) \
87 free_blkif_callback(_b); \
88 } while (0)
90 /* Create a vbd. */
91 int vbd_create(blkif_t *blkif, blkif_vdev_t vdevice, unsigned major,
92 unsigned minor, int readonly);
93 void vbd_free(struct vbd *vbd);
95 unsigned long vbd_size(struct vbd *vbd);
96 unsigned int vbd_info(struct vbd *vbd);
97 unsigned long vbd_secsize(struct vbd *vbd);
99 struct phys_req {
100 unsigned short dev;
101 unsigned short nr_sects;
102 struct block_device *bdev;
103 blkif_sector_t sector_number;
104 };
106 int vbd_translate(struct phys_req *req, blkif_t *blkif, int operation);
108 void blkif_interface_init(void);
110 void blkif_xenbus_init(void);
112 irqreturn_t blkif_be_int(int irq, void *dev_id, struct pt_regs *regs);
113 int blkif_schedule(void *arg);
115 void update_blkif_status(blkif_t *blkif);
117 #endif /* __BLKIF__BACKEND__COMMON_H__ */
119 /*
120 * Local variables:
121 * c-file-style: "linux"
122 * indent-tabs-mode: t
123 * c-indent-level: 8
124 * c-basic-offset: 8
125 * tab-width: 8
126 * End:
127 */