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

[Xen-devel] [PATCH 2 of 6 RESENT] libxl: Accept disk name in libxl_devid

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 2 of 6 RESENT] libxl: Accept disk name in libxl_devid_to_device_disk
From: Marek Marczykowski <marmarek@xxxxxxxxxxxx>
Date: Sun, 05 Jun 2011 18:50:32 +0200
Cc: marmarek@xxxxxxxxxxxx
Delivery-date: Sun, 05 Jun 2011 09:55:06 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1307292630@devel14>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1307292630@devel14>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.8.2
# HG changeset patch
# User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
# Date 1306962929 -7200
# Node ID 5231fa19f3e39091ff29e2a6dca057ca54403092
# Parent  c32797243a6ba61dd2942a0307151e42fb7bf157
libxl: Accept disk name in libxl_devid_to_device_disk

Accept disk name in xl block-detach.

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

diff -r c32797243a6b -r 5231fa19f3e3 tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Sat Jun 04 01:33:13 2011 +0200
+++ b/tools/libxl/libxl_device.c        Wed Jun 01 23:15:29 2011 +0200
@@ -198,7 +198,7 @@ static int device_virtdisk_matches(const
     return 1;
 }
 
-int libxl__device_disk_dev_number(char *virtpath, int *pdisk, int *ppartition)
+int libxl__device_disk_dev_number(const char *virtpath, int *pdisk, int 
*ppartition)
 {
     int disk, partition;
     char *ep;
diff -r c32797243a6b -r 5231fa19f3e3 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Sat Jun 04 01:33:13 2011 +0200
+++ b/tools/libxl/libxl_internal.h      Wed Jun 01 23:15:29 2011 +0200
@@ -205,7 +205,7 @@ _hidden char *libxl__device_disk_string_
 _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,
                                           int *pdisk, int *ppartition);
 
 _hidden int libxl__device_console_add(libxl__gc *gc, uint32_t domid,
diff -r c32797243a6b -r 5231fa19f3e3 tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c Sat Jun 04 01:33:13 2011 +0200
+++ b/tools/libxl/libxl_utils.c Wed Jun 01 23:15:29 2011 +0200
@@ -530,18 +530,18 @@ int libxl_devid_to_device_disk(libxl_ctx
                                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, NULL, NULL);
+    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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>