summary refs log tree commit diff stats
path: root/accel/xen/xen-all.c
diff options
context:
space:
mode:
authorPaul Durrant <pdurrant@amazon.com>2023-01-02 11:05:16 +0000
committerDavid Woodhouse <dwmw@amazon.co.uk>2023-03-07 17:04:30 +0000
commitba2a92db1ff682c16730b1d7f156bac61928f04d (patch)
treedde2437fc696530e24735ca05cdbd84e4fbf5bb2 /accel/xen/xen-all.c
parent15e283c5b684c2e502e9327186eb89eb69c68812 (diff)
downloadfocaccia-qemu-ba2a92db1ff682c16730b1d7f156bac61928f04d.tar.gz
focaccia-qemu-ba2a92db1ff682c16730b1d7f156bac61928f04d.zip
hw/xen: Add xenstore operations to allow redirection to internal emulation
Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Reviewed-by: Paul Durrant <paul@xen.org>
Diffstat (limited to 'accel/xen/xen-all.c')
-rw-r--r--accel/xen/xen-all.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c
index e85e4aeba5..425216230f 100644
--- a/accel/xen/xen-all.c
+++ b/accel/xen/xen-all.c
@@ -90,12 +90,15 @@ void xenstore_store_pv_console_info(int i, Chardev *chr)
 }
 
 
-static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)
+static void xenstore_record_dm_state(const char *state)
 {
+    struct xs_handle *xs;
     char path[50];
 
+    /* We now have everything we need to set the xenstore entry. */
+    xs = xs_open(0);
     if (xs == NULL) {
-        error_report("xenstore connection not initialized");
+        fprintf(stderr, "Could not contact XenStore\n");
         exit(1);
     }
 
@@ -109,6 +112,8 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)
         error_report("error recording dm state");
         exit(1);
     }
+
+    xs_close(xs);
 }
 
 
@@ -117,7 +122,7 @@ static void xen_change_state_handler(void *opaque, bool running,
 {
     if (running) {
         /* record state running */
-        xenstore_record_dm_state(xenstore, "running");
+        xenstore_record_dm_state("running");
     }
 }