[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 22 of 29 RFC] libxl: add libxl__parse_disk_hotplug_path
# HG changeset patch # User Roger Pau Monne <roger.pau@xxxxxxxxxxxxx> # Date 1328179164 -3600 # Node ID 478459fa6bfce280bf31e1d971c5f2b39eee6986 # Parent 346d86654b1dd81b5aba821bf9732844bb35c7a3 libxl: add libxl__parse_disk_hotplug_path Create a libxl_device_disk from hotplug xenstore information. Signed-off-by: Roger Pau Monne <roger.pau@xxxxxxxxxxxxx> diff -r 346d86654b1d -r 478459fa6bfc tools/libxl/libxl_device.c --- a/tools/libxl/libxl_device.c Thu Feb 02 11:36:34 2012 +0100 +++ b/tools/libxl/libxl_device.c Thu Feb 02 11:39:24 2012 +0100 @@ -84,6 +84,45 @@ int libxl__parse_hotplug_path(libxl__gc return libxl__device_kind_from_string(strkind, &dev->backend_kind); } +int libxl__parse_disk_hotplug_path(libxl__gc *gc, + const char *path, + libxl_device_disk *disk) +{ + char *value; + + disk->pdev_path = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/%s", + path, + "pdev_path")); + + disk->vdev = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/%s", path, + "vdev")); + + disk->script = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/%s", + path, + "script")); + value = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/%s", path, + "removable")); + if (value) + disk->removable = atoi(value); + + value = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/%s", path, + "readwrite")); + if (value) + disk->readwrite = atoi(value); + + value = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/%s", path, + "is_cdrom")); + if (value) + disk->is_cdrom = atoi(value); + + value = libxl__xs_read(gc, XBT_NULL, libxl__sprintf(gc, "%s/%s", path, + "format")); + if (value) + disk->format = atoi(value); + + return 0; +} + int libxl__device_generic_add(libxl__gc *gc, libxl__device *device, char **bents, char **fents) { diff -r 346d86654b1d -r 478459fa6bfc tools/libxl/libxl_internal.h --- a/tools/libxl/libxl_internal.h Thu Feb 02 11:36:34 2012 +0100 +++ b/tools/libxl/libxl_internal.h Thu Feb 02 11:39:24 2012 +0100 @@ -310,6 +310,9 @@ typedef struct { _hidden int libxl__parse_hotplug_path(libxl__gc *gc, const char *path, libxl__device *dev); +_hidden int libxl__parse_disk_hotplug_path(libxl__gc *gc, + const char *path, + libxl_device_disk *disk); _hidden int libxl__device_remove(libxl__gc *gc, libxl__device *dev); _hidden int libxl__device_destroy(libxl__gc *gc, libxl__device *dev); _hidden int libxl__devices_destroy(libxl__gc *gc, uint32_t domid); _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |