From ba2a92db1ff682c16730b1d7f156bac61928f04d Mon Sep 17 00:00:00 2001 From: Paul Durrant Date: Mon, 2 Jan 2023 11:05:16 +0000 Subject: hw/xen: Add xenstore operations to allow redirection to internal emulation Signed-off-by: Paul Durrant Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- accel/xen/xen-all.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'accel') diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c index e85e4ae..4252162 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"); } } -- cgit v1.1