summaryrefslogtreecommitdiff
path: root/hw/xen_backend.c
diff options
context:
space:
mode:
authorStefano Stabellini <stefano.stabellini@eu.citrix.com>2012-03-30 14:33:03 +0000
committerStefano Stabellini <stefano.stabellini@eu.citrix.com>2012-04-13 17:34:26 +0000
commit77ba8fef8972854b7fad89d97a14f4f9c3eae7a8 (patch)
tree9ff02a3a2880328c5fbdecc97a3de1e48b43ddc8 /hw/xen_backend.c
parent9468e9c41a89b1c9f3a905b8959e1dd3f055c732 (diff)
xen: handle backend deletion from xenstore
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Diffstat (limited to 'hw/xen_backend.c')
-rw-r--r--hw/xen_backend.c17
1 files changed, 9 insertions, 8 deletions
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);
+ }
}
}