All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pat Campbell <plc@novell.com>
To: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>
Subject: [PATCH][ioemu] strip tap subtype prefix from image name (restyled)
Date: Wed, 30 Jan 2008 07:14:24 -0700	[thread overview]
Message-ID: <47A08640.9030504@novell.com> (raw)

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

More readable version

Currently I am not able to mount or boot from an HVM CDROM when it is configured for 'tap:aio' instead of 'file'.

disk=[ 'tap:aio:/var/lib/xen/images/sles10-sp2-fv/disk0,hda,w', '
       tap:aio:/home/iso/sles/SLES10.iso,hdc:cdrom,r', ]

With the attached patch I am able to boot from the CDROM and or mount it.

Patch changes xenstore.c:xenstore_process_event() to strip the tap subtype prefix from the image name. 

Please apply to xen-unstable tip.

Signed-off-by: Pat Campbell <plc@novell.com>


[-- Attachment #2: xen-blktab-subtype-strip.patch --]
[-- Type: text/x-patch, Size: 1682 bytes --]

diff -r 1c826ea72a80 tools/ioemu/xenstore.c
--- a/tools/ioemu/xenstore.c	Wed Jan 23 15:42:52 2008 +0000
+++ b/tools/ioemu/xenstore.c	Wed Jan 30 07:06:12 2008 -0700
@@ -418,7 +418,7 @@ void xenstore_record_dm_state(char *stat
 
 void xenstore_process_event(void *opaque)
 {
-    char **vec, *image = NULL;
+    char **vec, *offset, *bpath = NULL, *buf = NULL, *drv = NULL, *image = NULL;
     unsigned int len, num, hd_index;
 
     vec = xs_read_watch(xsh, &num);
@@ -440,8 +440,28 @@ void xenstore_process_event(void *opaque
         goto out;
     hd_index = vec[XS_WATCH_TOKEN][2] - 'a';
     image = xs_read(xsh, XBT_NULL, vec[XS_WATCH_PATH], &len);
-    if (image == NULL || !strcmp(image, bs_table[hd_index]->filename))
-        goto out;  /* gone or identical */
+    if (image == NULL)
+        goto out;  /* gone */
+
+    /* Strip off blktap sub-type prefix */
+    bpath = strdup(vec[XS_WATCH_PATH]); 
+    if (bpath)
+        goto out;
+    if ((offset = strrchr(bpath, '/')) != NULL) 
+        *offset = '\0';
+    if (pasprintf(&buf, "%s/type", bpath) == -1) 
+        goto out;
+    drv = xs_read(xsh, XBT_NULL, buf, &len);
+    if (drv) {
+        if (!strcmp(drv, "tap")) {
+            offset = strchr(image, ':'); 
+            if (offset) 
+                memmove(image, offset+1, strlen(offset+1)+1 );
+        }
+    }
+
+    if (!strcmp(image, bs_table[hd_index]->filename))
+        goto out;  /* identical */
 
     do_eject(0, vec[XS_WATCH_TOKEN]);
     bs_table[hd_index]->filename[0] = 0;
@@ -456,6 +476,9 @@ void xenstore_process_event(void *opaque
     }
 
  out:
+    free(drv);
+    free(buf);
+    free(bpath);
     free(image);
     free(vec);
 }

[-- 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-01-30 14:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-30 14:14 Pat Campbell [this message]
2008-01-30 14:38 ` [PATCH][ioemu] strip tap subtype prefix from image name (restyled) Christoph Egger
2008-01-30 14:45   ` Keir Fraser
2008-01-31  8:36     ` Christoph Egger
2008-01-30 16:24   ` Pat Campbell
2008-01-30 16:31     ` Keir Fraser

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=47A08640.9030504@novell.com \
    --to=plc@novell.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.