WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [qemu-xen-unstable] fix cdrom eject, media change, stubd

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [qemu-xen-unstable] fix cdrom eject, media change, stubdom fallback case
From: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Date: Tue, 26 May 2009 05:51:01 -0700
Delivery-date: Thu, 11 Jun 2009 08:01:48 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
commit 16a3f599db2afcd87137294f8c497597ddcccde1
Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date:   Thu May 21 18:45:39 2009 +0100

    fix cdrom eject, media change, stubdom fallback case
    
    this patch fixes few cdrom handling issues:
    
    - when a cdrom medium event occurs and the new filename is NULL,
      we should eject the emulated cdrom instead of just ignoring the event;
    
    - when a cdrom medium event occurs and we are in a stubdom, we have to
      pass the xenstore path of the frontend to bdrv_open instead of the
      filename;
    
    - when we try and fail to open a cdrom (or disk) in a stubdom we should
      not fall back to the usual "non-stubdom" code path because is useless
      and wrong.
    
    Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---
 xenstore.c |   48 ++++++++++++++++++++++++++++--------------------
 1 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/xenstore.c b/xenstore.c
index 9360771..3db3531 100644
--- a/xenstore.c
+++ b/xenstore.c
@@ -476,9 +476,8 @@ void xenstore_parse_domain_config(int hvm_domid)
             continue;
        if (bdrv_open2(bs, danger_buf, BDRV_O_CACHE_WB /* snapshot and 
write-back */, &bdrv_raw) == 0) {
            pstrcpy(bs->filename, sizeof(bs->filename), params);
-       } else
-#endif
-
+       }
+#else
         if (params[0]) {
            if (!format) {
                if (!drv) {
@@ -504,6 +503,8 @@ void xenstore_parse_domain_config(int hvm_domid)
                 fprintf(stderr, "qemu: could not open vbd '%s' or hard disk 
image '%s' (drv '%s' format '%s')\n", buf, params, drv ? drv : "?", format ? 
format->format_name : "0");
         }
 
+#endif
+
        drives_table[nb_drives].bdrv = bs;
        drives_table[nb_drives].used = 1;
        nb_drives++;
@@ -955,23 +956,22 @@ void xenstore_process_event(void *opaque)
     fprintf(stderr,"medium change watch on `%s' (index: %d): %s\n",
            vec[XS_WATCH_TOKEN], hd_index, image ? image : "<none>");
 
-    if (image == NULL)
-        goto out;  /* gone */
-
-    /* Strip off blktap sub-type prefix */
-    bpath = strdup(vec[XS_WATCH_PATH]); 
-    if (bpath == NULL)
-        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 && !strcmp(drv, "tap") && ((offset = strchr(image, ':')) != NULL))
-        memmove(image, offset+1, strlen(offset+1)+1);
+    if (image != NULL) {
+        /* Strip off blktap sub-type prefix */
+        bpath = strdup(vec[XS_WATCH_PATH]); 
+        if (bpath == NULL)
+            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 && !strcmp(drv, "tap") && ((offset = strchr(image, ':')) != 
NULL))
+            memmove(image, offset+1, strlen(offset+1)+1);
 
-    if (!strcmp(image, drives_table[hd_index].bdrv->filename))
-        goto out;  /* identical */
+        if (!strcmp(image, drives_table[hd_index].bdrv->filename))
+            goto out;  /* identical */
+    }
 
     drives_table[hd_index].bdrv->filename[0] = '\0';
     bdrv_close(drives_table[hd_index].bdrv);
@@ -980,8 +980,16 @@ void xenstore_process_event(void *opaque)
         media_filename[hd_index] = NULL;
     }
 
-    if (image[0]) {
+    if (image && image[0]) {
+#ifdef CONFIG_STUBDOM
+        char path[strlen(vec[XS_WATCH_PATH]) - 6 + 8];
+        path[0] = '\0';
+        strncat(path, vec[XS_WATCH_PATH], strlen(vec[XS_WATCH_PATH]) - 6);
+        strcat(path, "frontend");
+        media_filename[hd_index] = xs_read(xsh, XBT_NULL, path, &len);
+#else
         media_filename[hd_index] = strdup(image);
+#endif
         xenstore_check_new_media_present(5000);
     }
 
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [qemu-xen-unstable] fix cdrom eject, media change, stubdom fallback case, Ian Jackson <=