ia64/xen-unstable

view linux-2.6-xen-sparse/drivers/xen/blkfront/block.h @ 14100:e47738923a05

[LINUX] Purge include <linux/config.h>. It has been obsolete for some time now.

Signed-off-by: Ian Campbell <ian.campbell@xensource.com>
author Ian Campbell <ian.campbell@xensource.com>
date Fri Feb 23 16:56:45 2007 +0000 (2007-02-23)
parents 3adf00179a63
children bfe2136c163a
line source
1 /******************************************************************************
2 * block.h
3 *
4 * Shared definitions between all levels of XenLinux Virtual block devices.
5 *
6 * Copyright (c) 2003-2004, Keir Fraser & Steve Hand
7 * Modifications by Mark A. Williamson are (c) Intel Research Cambridge
8 * Copyright (c) 2004-2005, Christian Limpach
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation; or, when distributed
13 * separately from the Linux kernel or incorporated into other
14 * software packages, subject to the following license:
15 *
16 * Permission is hereby granted, free of charge, to any person obtaining a copy
17 * of this source file (the "Software"), to deal in the Software without
18 * restriction, including without limitation the rights to use, copy, modify,
19 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
20 * and to permit persons to whom the Software is furnished to do so, subject to
21 * the following conditions:
22 *
23 * The above copyright notice and this permission notice shall be included in
24 * all copies or substantial portions of the Software.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
31 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
32 * IN THE SOFTWARE.
33 */
35 #ifndef __XEN_DRIVERS_BLOCK_H__
36 #define __XEN_DRIVERS_BLOCK_H__
38 #include <linux/version.h>
39 #include <linux/module.h>
40 #include <linux/kernel.h>
41 #include <linux/sched.h>
42 #include <linux/slab.h>
43 #include <linux/string.h>
44 #include <linux/errno.h>
45 #include <linux/fs.h>
46 #include <linux/hdreg.h>
47 #include <linux/blkdev.h>
48 #include <linux/major.h>
49 #include <asm/hypervisor.h>
50 #include <xen/xenbus.h>
51 #include <xen/gnttab.h>
52 #include <xen/interface/xen.h>
53 #include <xen/interface/io/blkif.h>
54 #include <xen/interface/io/ring.h>
55 #include <asm/io.h>
56 #include <asm/atomic.h>
57 #include <asm/uaccess.h>
59 #if 1
60 #define IPRINTK(fmt, args...) \
61 printk(KERN_INFO "xen_blk: " fmt, ##args)
62 #else
63 #define IPRINTK(fmt, args...) ((void)0)
64 #endif
66 #if 1
67 #define WPRINTK(fmt, args...) \
68 printk(KERN_WARNING "xen_blk: " fmt, ##args)
69 #else
70 #define WPRINTK(fmt, args...) ((void)0)
71 #endif
73 #define DPRINTK(_f, _a...) pr_debug(_f, ## _a)
75 #if 0
76 #define DPRINTK_IOCTL(_f, _a...) printk(KERN_ALERT _f, ## _a)
77 #else
78 #define DPRINTK_IOCTL(_f, _a...) ((void)0)
79 #endif
81 struct xlbd_type_info
82 {
83 int partn_shift;
84 int disks_per_major;
85 char *devname;
86 char *diskname;
87 };
89 struct xlbd_major_info
90 {
91 int major;
92 int index;
93 int usage;
94 struct xlbd_type_info *type;
95 };
97 struct blk_shadow {
98 blkif_request_t req;
99 unsigned long request;
100 unsigned long frame[BLKIF_MAX_SEGMENTS_PER_REQUEST];
101 };
103 #define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
105 /*
106 * We have one of these per vbd, whether ide, scsi or 'other'. They
107 * hang in private_data off the gendisk structure. We may end up
108 * putting all kinds of interesting stuff here :-)
109 */
110 struct blkfront_info
111 {
112 struct xenbus_device *xbdev;
113 dev_t dev;
114 struct gendisk *gd;
115 int vdevice;
116 blkif_vdev_t handle;
117 int connected;
118 int ring_ref;
119 blkif_front_ring_t ring;
120 unsigned int irq;
121 struct xlbd_major_info *mi;
122 request_queue_t *rq;
123 struct work_struct work;
124 struct gnttab_free_callback callback;
125 struct blk_shadow shadow[BLK_RING_SIZE];
126 unsigned long shadow_free;
127 int feature_barrier;
129 /**
130 * The number of people holding this device open. We won't allow a
131 * hot-unplug unless this is 0.
132 */
133 int users;
134 };
136 extern spinlock_t blkif_io_lock;
138 extern int blkif_open(struct inode *inode, struct file *filep);
139 extern int blkif_release(struct inode *inode, struct file *filep);
140 extern int blkif_ioctl(struct inode *inode, struct file *filep,
141 unsigned command, unsigned long argument);
142 extern int blkif_getgeo(struct block_device *, struct hd_geometry *);
143 extern int blkif_check(dev_t dev);
144 extern int blkif_revalidate(dev_t dev);
145 extern void do_blkif_request (request_queue_t *rq);
147 /* Virtual block-device subsystem. */
148 /* Note that xlvbd_add doesn't call add_disk for you: you're expected
149 to call add_disk on info->gd once the disk is properly connected
150 up. */
151 int xlvbd_add(blkif_sector_t capacity, int device,
152 u16 vdisk_info, u16 sector_size, struct blkfront_info *info);
153 void xlvbd_del(struct blkfront_info *info);
154 int xlvbd_barrier(struct blkfront_info *info);
156 #endif /* __XEN_DRIVERS_BLOCK_H__ */