aboutsummaryrefslogtreecommitdiff
path: root/include/hw/xen
diff options
context:
space:
mode:
Diffstat (limited to 'include/hw/xen')
-rw-r--r--include/hw/xen/xen-bus-helper.h39
-rw-r--r--include/hw/xen/xen-bus.h12
2 files changed, 51 insertions, 0 deletions
diff --git a/include/hw/xen/xen-bus-helper.h b/include/hw/xen/xen-bus-helper.h
new file mode 100644
index 0000000000..5cd9c3d759
--- /dev/null
+++ b/include/hw/xen/xen-bus-helper.h
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2018 Citrix Systems Inc.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef HW_XEN_BUS_HELPER_H
+#define HW_XEN_BUS_HELPER_H
+
+#include "hw/xen/xen_common.h"
+
+const char *xs_strstate(enum xenbus_state state);
+
+void xs_node_create(struct xs_handle *xsh, xs_transaction_t tid,
+ const char *node, struct xs_permissions perms[],
+ unsigned int nr_perms, Error **errp);
+void xs_node_destroy(struct xs_handle *xsh, xs_transaction_t tid,
+ const char *node, Error **errp);
+
+/* Write to node/key unless node is empty, in which case write to key */
+void xs_node_vprintf(struct xs_handle *xsh, xs_transaction_t tid,
+ const char *node, const char *key, Error **errp,
+ const char *fmt, va_list ap)
+ GCC_FMT_ATTR(6, 0);
+void xs_node_printf(struct xs_handle *xsh, xs_transaction_t tid,
+ const char *node, const char *key, Error **errp,
+ const char *fmt, ...)
+ GCC_FMT_ATTR(6, 7);
+
+/* Read from node/key unless node is empty, in which case read from key */
+int xs_node_vscanf(struct xs_handle *xsh, xs_transaction_t tid,
+ const char *node, const char *key, Error **errp,
+ const char *fmt, va_list ap);
+int xs_node_scanf(struct xs_handle *xsh, xs_transaction_t tid,
+ const char *node, const char *key, Error **errp,
+ const char *fmt, ...);
+
+#endif /* HW_XEN_BUS_HELPER_H */
diff --git a/include/hw/xen/xen-bus.h b/include/hw/xen/xen-bus.h
index 0cb12464ce..85a75d8dec 100644
--- a/include/hw/xen/xen-bus.h
+++ b/include/hw/xen/xen-bus.h
@@ -8,12 +8,19 @@
#ifndef HW_XEN_BUS_H
#define HW_XEN_BUS_H
+#include "hw/xen/xen_common.h"
#include "hw/sysbus.h"
typedef struct XenDevice {
DeviceState qdev;
+ domid_t frontend_id;
+ char *name;
+ char *backend_path, *frontend_path;
+ enum xenbus_state backend_state, frontend_state;
+ Notifier exit;
} XenDevice;
+typedef char *(*XenDeviceGetName)(XenDevice *xendev, Error **errp);
typedef void (*XenDeviceRealize)(XenDevice *xendev, Error **errp);
typedef void (*XenDeviceUnrealize)(XenDevice *xendev, Error **errp);
@@ -21,6 +28,9 @@ typedef struct XenDeviceClass {
/*< private >*/
DeviceClass parent_class;
/*< public >*/
+ const char *backend;
+ const char *device;
+ XenDeviceGetName get_name;
XenDeviceRealize realize;
XenDeviceUnrealize unrealize;
} XenDeviceClass;
@@ -35,6 +45,8 @@ typedef struct XenDeviceClass {
typedef struct XenBus {
BusState qbus;
+ domid_t backend_id;
+ struct xs_handle *xsh;
} XenBus;
typedef struct XenBusClass {