All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3]: Blktapctrl compatibility layer
@ 2008-07-09  0:26 Chris Lalancette
  2008-07-09 17:31 ` Ryan O'Connor
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Lalancette @ 2008-07-09  0:26 UTC (permalink / raw)
  To: xen-devel@lists.xensource.com

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]

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@redhat.com>


[-- Attachment #2: xen-unstable-blktapctrl-compat.patch --]
[-- Type: text/x-patch, Size: 2279 bytes --]

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;


[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-07-09 17:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-09  0:26 [PATCH 1/3]: Blktapctrl compatibility layer Chris Lalancette
2008-07-09 17:31 ` Ryan O'Connor
2008-07-09 17:49   ` Chris Lalancette

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.