|
@@ -430,7 +430,15 @@ static void xen_bus_unrealize(BusState *bus)
|
|
trace_xen_bus_unrealize();
|
|
trace_xen_bus_unrealize();
|
|
|
|
|
|
if (xenbus->backend_watch) {
|
|
if (xenbus->backend_watch) {
|
|
- xen_bus_remove_watch(xenbus, xenbus->backend_watch, NULL);
|
|
|
|
|
|
+ unsigned int i;
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < xenbus->backend_types; i++) {
|
|
|
|
+ if (xenbus->backend_watch[i]) {
|
|
|
|
+ xen_bus_remove_watch(xenbus, xenbus->backend_watch[i], NULL);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ g_free(xenbus->backend_watch);
|
|
xenbus->backend_watch = NULL;
|
|
xenbus->backend_watch = NULL;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -446,8 +454,11 @@ static void xen_bus_unrealize(BusState *bus)
|
|
|
|
|
|
static void xen_bus_realize(BusState *bus, Error **errp)
|
|
static void xen_bus_realize(BusState *bus, Error **errp)
|
|
{
|
|
{
|
|
|
|
+ char *key = g_strdup_printf("%u", xen_domid);
|
|
XenBus *xenbus = XEN_BUS(bus);
|
|
XenBus *xenbus = XEN_BUS(bus);
|
|
unsigned int domid;
|
|
unsigned int domid;
|
|
|
|
+ const char **type;
|
|
|
|
+ unsigned int i;
|
|
Error *local_err = NULL;
|
|
Error *local_err = NULL;
|
|
|
|
|
|
trace_xen_bus_realize();
|
|
trace_xen_bus_realize();
|
|
@@ -469,19 +480,32 @@ static void xen_bus_realize(BusState *bus, Error **errp)
|
|
|
|
|
|
module_call_init(MODULE_INIT_XEN_BACKEND);
|
|
module_call_init(MODULE_INIT_XEN_BACKEND);
|
|
|
|
|
|
- xenbus->backend_watch =
|
|
|
|
- xen_bus_add_watch(xenbus, "", /* domain root node */
|
|
|
|
- "backend", xen_bus_backend_changed, &local_err);
|
|
|
|
- if (local_err) {
|
|
|
|
- /* This need not be treated as a hard error so don't propagate */
|
|
|
|
- error_reportf_err(local_err,
|
|
|
|
- "failed to set up enumeration watch: ");
|
|
|
|
|
|
+ type = xen_backend_get_types(&xenbus->backend_types);
|
|
|
|
+ xenbus->backend_watch = g_new(XenWatch *, xenbus->backend_types);
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < xenbus->backend_types; i++) {
|
|
|
|
+ char *node = g_strdup_printf("backend/%s", type[i]);
|
|
|
|
+
|
|
|
|
+ xenbus->backend_watch[i] =
|
|
|
|
+ xen_bus_add_watch(xenbus, node, key, xen_bus_backend_changed,
|
|
|
|
+ &local_err);
|
|
|
|
+ if (local_err) {
|
|
|
|
+ /* This need not be treated as a hard error so don't propagate */
|
|
|
|
+ error_reportf_err(local_err,
|
|
|
|
+ "failed to set up '%s' enumeration watch: ",
|
|
|
|
+ type[i]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ g_free(node);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ g_free(type);
|
|
|
|
+ g_free(key);
|
|
return;
|
|
return;
|
|
|
|
|
|
fail:
|
|
fail:
|
|
xen_bus_unrealize(bus);
|
|
xen_bus_unrealize(bus);
|
|
|
|
+ g_free(key);
|
|
}
|
|
}
|
|
|
|
|
|
static void xen_bus_unplug_request(HotplugHandler *hotplug,
|
|
static void xen_bus_unplug_request(HotplugHandler *hotplug,
|