: Blktapctrl compatibility layer
PATCH 1/3 : 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.
tools/blktap/drivers/blktapctrl.c +18 -6
@@ -123,12 +123,25 @@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 @@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 ; }
tools/blktap/lib/blktaplib.h +7 -1
@@ -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 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-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Quoted 8 lines · Chris Lalancette
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 <[email protected]>
I tested this lats night, and I see that it's been committed. I can confirm that it resolves the issue reported by Chris Head.
thanks,
R
Signature · 1 line
Ryan O'Connor <[email protected]>
Quoted 2 lines · Ryan O'Connor
I tested this lats night, and I see that it's been committed. I can confirm that it resolves the issue reported by Chris Head.
Excellent, thanks for the testing.
Chris Lalancette