ia64/linux-2.6.18-xen.hg

changeset 598:f1d726b984a3

Blktap kernel compat layer

The kernel side of the blktap extended vbd compatibility layer.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jul 09 10:44:08 2008 +0100 (2008-07-09)
parents db4f08203b8a
children 29228a5f9fea
files drivers/xen/blktap/blktap.c
line diff
     1.1 --- a/drivers/xen/blktap/blktap.c	Tue Jul 08 09:31:24 2008 +0100
     1.2 +++ b/drivers/xen/blktap/blktap.c	Wed Jul 09 10:44:08 2008 +0100
     1.3 @@ -89,8 +89,13 @@ static int mmap_pages = MMAP_PAGES;
     1.4  /*Data struct handed back to userspace for tapdisk device to VBD mapping*/
     1.5  typedef struct domid_translate {
     1.6  	unsigned short domid;
     1.7 +	unsigned short busid;
     1.8 +} domid_translate_t ;
     1.9 +
    1.10 +typedef struct domid_translate_ext {
    1.11 +	unsigned short domid;
    1.12  	u32 busid;
    1.13 -} domid_translate_t ;
    1.14 +} domid_translate_ext_t ;
    1.15  
    1.16  /*Data struct associated with each of the tapdisk devices*/
    1.17  typedef struct tap_blkif {
    1.18 @@ -110,7 +115,7 @@ typedef struct tap_blkif {
    1.19  	unsigned long *idx_map;       /*Record the user ring id to kern 
    1.20  					[req id, idx] tuple                  */
    1.21  	blkif_t *blkif;               /*Associate blkif with tapdev          */
    1.22 -	struct domid_translate trans; /*Translation from domid to bus.       */
    1.23 +	struct domid_translate_ext trans; /*Translation from domid to bus.   */
    1.24  } tap_blkif_t;
    1.25  
    1.26  static struct tap_blkif *tapfds[MAX_TAP_DEV];
    1.27 @@ -213,6 +218,7 @@ static int blktap_major;
    1.28  #define BLKTAP_IOCTL_MAJOR	     7
    1.29  #define BLKTAP_QUERY_ALLOC_REQS      8
    1.30  #define BLKTAP_IOCTL_FREEINTF        9
    1.31 +#define BLKTAP_IOCTL_NEWINTF_EXT     50
    1.32  #define BLKTAP_IOCTL_PRINT_IDXS      100  
    1.33  
    1.34  /* blktap switching modes: (Set with BLKTAP_IOCTL_SETMODE)             */
    1.35 @@ -784,6 +790,26 @@ static int blktap_ioctl(struct inode *in
    1.36  		info->trans.busid = tr->busid;
    1.37  		return info->minor;
    1.38  	}
    1.39 +	case BLKTAP_IOCTL_NEWINTF_EXT:
    1.40 +	{
    1.41 +		void __user *udata = (void __user *) arg;
    1.42 +		domid_translate_ext_t tr;
    1.43 +
    1.44 +		if (copy_from_user(&tr, udata, sizeof(domid_translate_ext_t)))
    1.45 +			return -EFAULT;
    1.46 +
    1.47 +		DPRINTK("NEWINTF_EXT Req for domid %d and bus id %d\n", 
    1.48 +		       tr.domid, tr.busid);
    1.49 +		info = get_next_free_dev();
    1.50 +		if (!info) {
    1.51 +			WPRINTK("Error initialising /dev/xen/blktap - "
    1.52 +				"No more devices\n");
    1.53 +			return -1;
    1.54 +		}
    1.55 +		info->trans.domid = tr.domid;
    1.56 +		info->trans.busid = tr.busid;
    1.57 +		return info->minor;
    1.58 +	}
    1.59  	case BLKTAP_IOCTL_FREEINTF:
    1.60  	{
    1.61  		unsigned long dev = arg;