1 /******************************************************************************
4 * Shared definitions between all levels of XenLinux Virtual block devices.
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
10 * This file may be distributed separately from the Linux kernel, or
11 * incorporated into other software packages, subject to the following license:
13 * Permission is hereby granted, free of charge, to any person obtaining a copy
14 * of this source file (the "Software"), to deal in the Software without
15 * restriction, including without limitation the rights to use, copy, modify,
16 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
17 * and to permit persons to whom the Software is furnished to do so, subject to
18 * the following conditions:
20 * The above copyright notice and this permission notice shall be included in
21 * all copies or substantial portions of the Software.
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
32 #ifndef __XEN_DRIVERS_BLOCK_H__
33 #define __XEN_DRIVERS_BLOCK_H__
35 #include <linux/config.h>
36 #include <linux/module.h>
37 #include <linux/kernel.h>
38 #include <linux/sched.h>
39 #include <linux/slab.h>
40 #include <linux/string.h>
41 #include <linux/errno.h>
43 #include <linux/hdreg.h>
44 #include <linux/blkdev.h>
45 #include <linux/major.h>
46 #include <linux/devfs_fs_kernel.h>
47 #include <asm-xen/xen-public/xen.h>
48 #include <asm-xen/xen-public/io/blkif.h>
49 #include <asm-xen/xen-public/io/ring.h>
51 #include <asm/atomic.h>
52 #include <asm/uaccess.h>
55 #define DPRINTK(_f, _a...) printk ( KERN_ALERT _f , ## _a )
57 #define DPRINTK(_f, _a...) ((void)0)
61 #define DPRINTK_IOCTL(_f, _a...) printk ( KERN_ALERT _f , ## _a )
63 #define DPRINTK_IOCTL(_f, _a...) ((void)0)
66 struct xlbd_type_info {
75 * We have one of these per vbd, whether ide, scsi or 'other'. They
76 * hang in private_data off the gendisk structure. We may end up
77 * putting all kinds of interesting stuff here :-)
79 struct xlbd_major_info {
83 struct xlbd_type_info *type;
86 struct xlbd_disk_info {
88 struct xlbd_major_info *mi;
91 typedef struct xen_block {
95 extern struct request_queue *xlbd_blk_queue;
96 extern spinlock_t blkif_io_lock;
98 extern int blkif_open(struct inode *inode, struct file *filep);
99 extern int blkif_release(struct inode *inode, struct file *filep);
100 extern int blkif_ioctl(struct inode *inode, struct file *filep,
101 unsigned command, unsigned long argument);
102 extern int blkif_check(dev_t dev);
103 extern int blkif_revalidate(dev_t dev);
104 extern void blkif_control_send(blkif_request_t *req, blkif_response_t *rsp);
105 #ifdef CONFIG_XEN_BLKDEV_GRANT
106 extern void blkif_control_probe_send(
107 blkif_request_t *req, blkif_response_t *rsp, unsigned long address);
109 extern void do_blkif_request (request_queue_t *rq);
111 extern void xlvbd_update_vbds(void);
113 /* Virtual block-device subsystem. */
114 extern int xlvbd_init(void);
115 extern void xlvbd_cleanup(void);
117 #endif /* __XEN_DRIVERS_BLOCK_H__ */