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>
diff -r 5cd4fe68b6c2 tools/blktap/drivers/blktapctrl.c
--- a/tools/blktap/drivers/blktapctrl.c Tue Jul 08 17:25:04 2008 +0100
+++ b/tools/blktap/drivers/blktapctrl.c Wed Jul 09 02:12:47 2008 +0200
@@ -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;
}
diff -r 5cd4fe68b6c2 tools/blktap/lib/blktaplib.h
--- a/tools/blktap/lib/blktaplib.h Tue Jul 08 17:25:04 2008 +0100
+++ b/tools/blktap/lib/blktaplib.h Wed Jul 09 02:12:47 2008 +0200
@@ -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
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|