[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-4.1-testing] libxl: Accept disk name in libxl_devid_to_device_disk



# HG changeset patch
# User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
# Date 1307285297 -7200
# Node ID 1fc844ffd99b22870b94b2da04a274d1d97a06de
# Parent  d4d0621cf325d8a9efb1c5ea91c2a5a909954932
libxl: Accept disk name in libxl_devid_to_device_disk

Accept disk name in xl block-detach.

Signed-off-by: Marek Marczykowski <marmarek@xxxxxxxxxxxx>

xen-unstable changest: 23604:5d7998be2252
Backport-requested-by: Marek Marczykowski <marmarek@xxxxxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---


diff -r d4d0621cf325 -r 1fc844ffd99b tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Sun Jun 05 16:45:59 2011 +0200
+++ b/tools/libxl/libxl_device.c        Sun Jun 05 16:48:17 2011 +0200
@@ -201,7 +201,7 @@
     return 1;
 }
 
-int libxl__device_disk_dev_number(char *virtpath)
+int libxl__device_disk_dev_number(const char *virtpath)
 {
     int disk, partition;
     char *ep;
diff -r d4d0621cf325 -r 1fc844ffd99b tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Sun Jun 05 16:45:59 2011 +0200
+++ b/tools/libxl/libxl_internal.h      Sun Jun 05 16:48:17 2011 +0200
@@ -182,7 +182,7 @@
 _hidden char *libxl__device_disk_string_of_format(libxl_disk_format format);
 
 _hidden int libxl__device_physdisk_major_minor(const char *physpath, int 
*major, int *minor);
-_hidden int libxl__device_disk_dev_number(char *virtpath);
+_hidden int libxl__device_disk_dev_number(const char *virtpath);
 
 _hidden int libxl__device_generic_add(libxl_ctx *ctx, libxl__device *device,
                              char **bents, char **fents);
diff -r d4d0621cf325 -r 1fc844ffd99b tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Sun Jun 05 16:45:59 2011 +0200
+++ b/tools/libxl/libxl_utils.c Sun Jun 05 16:48:17 2011 +0200
@@ -529,18 +529,18 @@
                                const char *devid, libxl_device_disk *disk)
 {
     libxl__gc gc = LIBXL_INIT_GC(ctx);
-    char *endptr, *val;
+    char *val;
     char *dompath, *diskpath, *be_path;
     unsigned int devid_n;
     int rc = ERROR_INVAL;
 
-    devid_n = strtoul(devid, &endptr, 10);
-    if (devid == endptr) {
+    devid_n = libxl__device_disk_dev_number(devid);
+    if (devid_n < 0) {
         goto out;
     }
     rc = ERROR_FAIL;
     dompath = libxl__xs_get_dompath(&gc, domid);
-    diskpath = libxl__sprintf(&gc, "%s/device/vbd/%s", dompath, devid);
+    diskpath = libxl__sprintf(&gc, "%s/device/vbd/%d", dompath, devid_n);
     if (!diskpath) {
         goto out;
     }

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.