All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Lalancette <clalance@redhat.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH 1/3]: Blktapctrl compatibility layer
Date: Wed, 09 Jul 2008 02:26:01 +0200	[thread overview]
Message-ID: <48740599.10905@redhat.com> (raw)

[-- 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

             reply	other threads:[~2008-07-09  0:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-09  0:26 Chris Lalancette [this message]
2008-07-09 17:31 ` [PATCH 1/3]: Blktapctrl compatibility layer Ryan O'Connor
2008-07-09 17:49   ` Chris Lalancette

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48740599.10905@redhat.com \
    --to=clalance@redhat.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.