aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_internal.h
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@citrix.com>2012-07-26 16:47:34 +0100
committerRoger Pau Monne <roger.pau@citrix.com>2012-07-26 16:47:34 +0100
commitb24dc64ef34437c958b40a71f510f404e0c4bbe4 (patch)
tree45d6b1f9269c422f0618918c64f4ba41752ddb7b /tools/libxl/libxl_internal.h
parent24bc7a06aea0dd3cb3c9e0ba6c0367d54fdd503e (diff)
downloadxen-b24dc64ef34437c958b40a71f510f404e0c4bbe4.tar.gz
xen-b24dc64ef34437c958b40a71f510f404e0c4bbe4.tar.bz2
xen-b24dc64ef34437c958b40a71f510f404e0c4bbe4.zip
libxl: call hotplug scripts for disk devices from libxl
Since most of the needed work is already done in previous patches, this patch only contains the necessary code to call hotplug scripts for disk devices, that should be called when the device is added or removed from a guest. We will chain the launch of the disk hotplug scripts after the device_backend_callback callback, or directly from libxl__initiate_device_{add,remove} if the device is already in the desired state. Signed-off-by: Roger Pau Monne <roger.pau@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/libxl_internal.h')
-rw-r--r--tools/libxl/libxl_internal.h20
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 382ec79dd7..2567c4d38a 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -74,6 +74,7 @@
#define LIBXL_INIT_TIMEOUT 10
#define LIBXL_DESTROY_TIMEOUT 10
+#define LIBXL_HOTPLUG_TIMEOUT 10
#define LIBXL_DEVICE_MODEL_START_TIMEOUT 10
#define LIBXL_QEMU_BODGE_TIMEOUT 2
#define LIBXL_XENCONSOLE_LIMIT 1048576
@@ -1832,11 +1833,14 @@ struct libxl__ao_device {
int active;
int rc;
libxl__ev_devstate backend_ds;
- /* Bodge for Qemu devices */
+ /* Bodge for Qemu devices, also used for timeout of hotplug execution */
libxl__ev_time timeout;
/* Used internally to have a reference to the upper libxl__ao_devices
* struct when present */
libxl__ao_devices *aodevs;
+ /* device hotplug execution */
+ const char *what;
+ libxl__ev_child child;
};
/* Helper struct to simply the plug/unplug of multiple devices at the same
@@ -1966,6 +1970,20 @@ _hidden void libxl__wait_device_connection(libxl__egc*,
_hidden void libxl__initiate_device_remove(libxl__egc *egc,
libxl__ao_device *aodev);
+/*
+ * libxl__get_hotplug_script_info returns the args and env that should
+ * be passed to the hotplug script for the requested device.
+ *
+ * Since a device might not need to execute any hotplug script, this function
+ * can return the following values:
+ * < 0: Error
+ * 0: No need to execute hotplug script
+ * 1: Execute hotplug script
+ */
+_hidden int libxl__get_hotplug_script_info(libxl__gc *gc, libxl__device *dev,
+ char ***args, char ***env,
+ libxl__device_action action);
+
/*----- local disk attach: attach a disk locally to run the bootloader -----*/
typedef struct libxl__disk_local_state libxl__disk_local_state;