From: Zhu Guihua Date: Tue, 21 Oct 2014 11:46:04 +0000 (+0800) Subject: qdev: add qdev_build_hotpluggable_device_list helper X-Git-Tag: qemu-xen-4.6.0-rc1~118^2~2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=66e56b13;p=qemu-upstream-4.6-testing.git qdev: add qdev_build_hotpluggable_device_list helper For peripheral device del completion, add a function to build a list for hotpluggable devices. Signed-off-by: Zhu Guihua Reviewed-by: Marcel Apfelbaum Reviewed-by: Igor Mammedov Signed-off-by: Luiz Capitulino --- diff --git a/hw/core/qdev.c b/hw/core/qdev.c index a1e924777..9357aba45 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -866,6 +866,19 @@ void qdev_alias_all_properties(DeviceState *target, Object *source) } while (class != object_class_by_name(TYPE_DEVICE)); } +int qdev_build_hotpluggable_device_list(Object *obj, void *opaque) +{ + GSList **list = opaque; + DeviceState *dev = DEVICE(obj); + + if (dev->realized && object_property_get_bool(obj, "hotpluggable", NULL)) { + *list = g_slist_append(*list, dev); + } + + object_child_foreach(obj, qdev_build_hotpluggable_device_list, opaque); + return 0; +} + static bool device_get_realized(Object *obj, Error **errp) { DeviceState *dev = DEVICE(obj); diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 1fca75c59..22820fef5 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -360,6 +360,8 @@ extern int qdev_hotplug; char *qdev_get_dev_path(DeviceState *dev); +int qdev_build_hotpluggable_device_list(Object *obj, void *opaque); + void qbus_set_hotplug_handler(BusState *bus, DeviceState *handler, Error **errp);