# HG changeset patch
# User Marek Marczykowski <marmarek@xxxxxxxxxxxx>
# Date 1307285297 -7200
# Node ID 8080606fb87a751f7cde4c6a08e3945a21d397b0
# Parent 969051f07ee813d2a556f50d37cf59d4e509bf67
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 --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -201,7 +201,7 @@ static int device_virtdisk_matches(const
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 --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -182,7 +182,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);
_hidden int libxl__device_generic_add(libxl_ctx *ctx, libxl__device *device,
char **bents, char **fents);
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -529,18 +529,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);
+ 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
|