From 77ba8fef8972854b7fad89d97a14f4f9c3eae7a8 Mon Sep 17 00:00:00 2001 From: Stefano Stabellini Date: Fri, 30 Mar 2012 14:33:03 +0000 Subject: xen: handle backend deletion from xenstore Signed-off-by: Stefano Stabellini --- hw/xen_backend.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'hw/xen_backend.c') diff --git a/hw/xen_backend.c b/hw/xen_backend.c index 2673ace185..66cb144397 100644 --- a/hw/xen_backend.c +++ b/hw/xen_backend.c @@ -592,7 +592,7 @@ static void xenstore_update_be(char *watch, char *type, int dom, struct XenDevOps *ops) { struct XenDevice *xendev; - char path[XEN_BUFSIZE], *dom0; + char path[XEN_BUFSIZE], *dom0, *bepath; unsigned int len, dev; dom0 = xs_get_domain_path(xenstore, 0); @@ -611,15 +611,16 @@ static void xenstore_update_be(char *watch, char *type, int dom, return; } - if (0) { - /* FIXME: detect devices being deleted from xenstore ... */ - xen_be_del_xendev(dom, dev); - } - xendev = xen_be_get_xendev(type, dom, dev, ops); if (xendev != NULL) { - xen_be_backend_changed(xendev, path); - xen_be_check_state(xendev); + bepath = xs_read(xenstore, 0, xendev->be, &len); + if (bepath == NULL) { + xen_be_del_xendev(dom, dev); + } else { + free(bepath); + xen_be_backend_changed(xendev, path); + xen_be_check_state(xendev); + } } } -- cgit v1.2.3