aboutsummaryrefslogtreecommitdiff
path: root/include/hw
diff options
context:
space:
mode:
Diffstat (limited to 'include/hw')
-rw-r--r--include/hw/xen/xen-bus-helper.h6
-rw-r--r--include/hw/xen/xen-bus.h15
2 files changed, 21 insertions, 0 deletions
diff --git a/include/hw/xen/xen-bus-helper.h b/include/hw/xen/xen-bus-helper.h
index 5cd9c3d759..4c0f747445 100644
--- a/include/hw/xen/xen-bus-helper.h
+++ b/include/hw/xen/xen-bus-helper.h
@@ -36,4 +36,10 @@ int xs_node_scanf(struct xs_handle *xsh, xs_transaction_t tid,
const char *node, const char *key, Error **errp,
const char *fmt, ...);
+/* Watch node/key unless node is empty, in which case watch key */
+void xs_node_watch(struct xs_handle *xsh, const char *node, const char *key,
+ char *token, Error **errp);
+void xs_node_unwatch(struct xs_handle *xsh, const char *node, const char *key,
+ const char *token, Error **errp);
+
#endif /* HW_XEN_BUS_HELPER_H */
diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h
index 85a75d8dec..df73674fcd 100644
--- a/include/hw/xen/xen-bus.h
+++ b/include/hw/xen/xen-bus.h
@@ -10,6 +10,11 @@
#include "hw/xen/xen_common.h"
#include "hw/sysbus.h"
+#include "qemu/notify.h"
+
+typedef void (*XenWatchHandler)(void *opaque);
+
+typedef struct XenWatch XenWatch;
typedef struct XenDevice {
DeviceState qdev;
@@ -18,10 +23,14 @@ typedef struct XenDevice {
char *backend_path, *frontend_path;
enum xenbus_state backend_state, frontend_state;
Notifier exit;
+ XenWatch *frontend_state_watch;
} XenDevice;
typedef char *(*XenDeviceGetName)(XenDevice *xendev, Error **errp);
typedef void (*XenDeviceRealize)(XenDevice *xendev, Error **errp);
+typedef void (*XenDeviceFrontendChanged)(XenDevice *xendev,
+ enum xenbus_state frontend_state,
+ Error **errp);
typedef void (*XenDeviceUnrealize)(XenDevice *xendev, Error **errp);
typedef struct XenDeviceClass {
@@ -32,6 +41,7 @@ typedef struct XenDeviceClass {
const char *device;
XenDeviceGetName get_name;
XenDeviceRealize realize;
+ XenDeviceFrontendChanged frontend_changed;
XenDeviceUnrealize unrealize;
} XenDeviceClass;
@@ -47,6 +57,7 @@ typedef struct XenBus {
BusState qbus;
domid_t backend_id;
struct xs_handle *xsh;
+ NotifierList watch_notifiers;
} XenBus;
typedef struct XenBusClass {
@@ -64,4 +75,8 @@ typedef struct XenBusClass {
void xen_bus_init(void);
+void xen_device_backend_set_state(XenDevice *xendev,
+ enum xenbus_state state);
+enum xenbus_state xen_device_backend_get_state(XenDevice *xendev);
+
#endif /* HW_XEN_BUS_H */