[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Blktapctrl compatibility layer
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1215596509 -3600 # Node ID 830e5d8b71da076b01c0327f360440a6810dcb54 # Parent 79978fcf8797aca698c502376738dbb11d1fe56f Blktapctrl compatibility layer I originally had just changed the NEWINTF ioctl to send over 48-bits of information, which works on 64-bit but not on 32-bit (since the arg is an unsigned long). Additionally, the previous changes would break an older userland against a new kernel. For that reason, introduce a new ioctl (NEWINTF_EXT) that fixes both of these problems. This is the dom0 userland side. Signed-off-by: Chris Lalancette <clalance@xxxxxxxxxx> --- tools/blktap/drivers/blktapctrl.c | 24 ++++++++++++++++++------ tools/blktap/lib/blktaplib.h | 8 +++++++- 2 files changed, 25 insertions(+), 7 deletions(-) diff -r 79978fcf8797 -r 830e5d8b71da tools/blktap/drivers/blktapctrl.c --- a/tools/blktap/drivers/blktapctrl.c Wed Jul 09 10:39:42 2008 +0100 +++ b/tools/blktap/drivers/blktapctrl.c Wed Jul 09 10:41:49 2008 +0100 @@ -123,12 +123,25 @@ static int get_new_dev(int *major, int * static int get_new_dev(int *major, int *minor, blkif_t *blkif) { domid_translate_t tr; + domid_translate_ext_t tr_ext; int ret; char *devname; - tr.domid = blkif->domid; - tr.busid = blkif->be_id; - ret = ioctl(ctlfd, BLKTAP_IOCTL_NEWINTF, tr ); + if (blkif->be_id >= (1<<28)) { + /* new-style backend-id, so use the extended structure */ + tr_ext.domid = blkif->domid; + tr_ext.busid = blkif->be_id; + ret = ioctl(ctlfd, BLKTAP_IOCTL_NEWINTF_EXT, &tr_ext); + DPRINTF("Sent domid %d and be_id %d\n", tr_ext.domid, + tr_ext.busid); + } + else { + /* old-style backend-id; use the old structure */ + tr.domid = blkif->domid; + tr.busid = (unsigned short)blkif->be_id; + ret = ioctl(ctlfd, BLKTAP_IOCTL_NEWINTF, tr); + DPRINTF("Sent domid %d and be_id %d\n", tr.domid, tr.busid); + } if ( (ret <= 0)||(ret > MAX_TAP_DEV) ) { DPRINTF("Incorrect Dev ID [%d]\n",ret); @@ -145,9 +158,8 @@ static int get_new_dev(int *major, int * if (asprintf(&devname,"%s/%s%d",BLKTAP_DEV_DIR, BLKTAP_DEV_NAME, *minor) == -1) return -1; make_blktap_dev(devname,*major,*minor); - DPRINTF("Received device id %d and major %d, " - "sent domid %d and be_id %d\n", - *minor, *major, tr.domid, tr.busid); + DPRINTF("Received device id %d and major %d\n", + *minor, *major); return 0; } diff -r 79978fcf8797 -r 830e5d8b71da tools/blktap/lib/blktaplib.h --- a/tools/blktap/lib/blktaplib.h Wed Jul 09 10:39:42 2008 +0100 +++ b/tools/blktap/lib/blktaplib.h Wed Jul 09 10:41:49 2008 +0100 @@ -57,6 +57,7 @@ #define BLKTAP_IOCTL_MAJOR 7 #define BLKTAP_QUERY_ALLOC_REQS 8 #define BLKTAP_IOCTL_FREEINTF 9 +#define BLKTAP_IOCTL_NEWINTF_EXT 50 #define BLKTAP_IOCTL_PRINT_IDXS 100 /* blktap switching modes: (Set with BLKTAP_IOCTL_SETMODE) */ @@ -161,8 +162,13 @@ typedef struct tapdev_info { typedef struct domid_translate { unsigned short domid; + unsigned short busid; +} domid_translate_t ; + +typedef struct domid_translate_ext { + unsigned short domid; uint32_t busid; -} domid_translate_t ; +} domid_translate_ext_t ; typedef struct image { unsigned long long size; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |