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] [xen-unstable] xl: fix cdrom_insert parsing

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xl: fix cdrom_insert parsing
From: Xen patchbot-unstable <patchbot@xxxxxxx>
Date: Fri, 18 Feb 2011 01:50:19 -0800
Delivery-date: Fri, 18 Feb 2011 01:51:01 -0800
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
# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
# Date 1297972140 0
# Node ID 0e52f58dead5f54d62e124ad1c2e84ca567af663
# Parent  acec8a17879633d26e83b869f9db036a16ff74f2
xl: fix cdrom_insert parsing

Reuse the same code used to parse the disk line from the VM config file
in cd_insert.

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/xl_cmdimpl.c |   37 ++++++++++---------------------------
 1 files changed, 10 insertions(+), 27 deletions(-)

diff -r acec8a178796 -r 0e52f58dead5 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Thu Feb 17 19:48:05 2011 +0000
+++ b/tools/libxl/xl_cmdimpl.c  Thu Feb 17 19:49:00 2011 +0000
@@ -1849,40 +1849,23 @@ static void cd_insert(const char *dom, c
 static void cd_insert(const char *dom, const char *virtdev, char *phys)
 {
     libxl_device_disk disk; /* we don't free disk's contents */
-    char *p;
+    char *buf = NULL;
 
     find_domain(dom);
 
+    if (asprintf(&buf, "%s,%s:cdrom,r", phys ? phys : "", virtdev) < 0) {
+        fprintf(stderr, "out of memory\n");
+        return;
+    }
+    if (!parse_disk_config(&disk, buf)) {
+        fprintf(stderr, "format error\n");
+        return;
+    }
     disk.backend_domid = 0;
     disk.domid = domid;
-    if (phys) {
-        p = strchr(phys, ':');
-        if (!p) {
-            fprintf(stderr, "No type specified, ");
-            disk.pdev_path = phys;
-            if (!strncmp(phys, "/dev", 4)) {
-                fprintf(stderr, "assuming phy:\n");
-                disk.backend = DISK_BACKEND_PHY;
-            } else {
-                fprintf(stderr, "assuming file:\n");
-                disk.backend = DISK_BACKEND_TAP; 
-            }
-        } else {
-            *p = '\0';
-            p++;
-            disk.pdev_path = p;
-            libxl_string_to_backend(&ctx, phys, &disk.backend);
-        }
-    } else {
-            disk.pdev_path = strdup("");
-            disk.format = DISK_FORMAT_EMPTY;
-    }
-    disk.vdev = (char*)virtdev;
-    disk.unpluggable = 1;
-    disk.readwrite = 0;
-    disk.is_cdrom = 1;
 
     libxl_cdrom_insert(&ctx, domid, &disk);
+    free(buf);
 }
 
 int main_cd_eject(int argc, char **argv)

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] xl: fix cdrom_insert parsing, Xen patchbot-unstable <=