Received: from eggs.gnu.org ([2001:4830:134:3::10]:55508) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhKBT-0003iF-NL for qemu-devel@nongnu.org; Thu, 23 Oct 2014 11:20:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XhKBP-0000Vx-2H for qemu-devel@nongnu.org; Thu, 23 Oct 2014 11:20:15 -0400 Received: from mx1.redhat.com ([209.132.183.28]:11971) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhKBO-0000Vf-Rc for qemu-devel@nongnu.org; Thu, 23 Oct 2014 11:20:11 -0400 From: Luiz Capitulino Date: Thu, 23 Oct 2014 11:19:48 -0400 Message-Id: <1414077590-18036-6-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1414077590-18036-1-git-send-email-lcapitulino@redhat.com> References: <1414077590-18036-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 5/7] qdev: add qdev_build_hotpluggable_device_list helper List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: qemu-devel@nongnu.org From: Zhu Guihua 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 --- hw/core/qdev.c | 13 +++++++++++++ include/hw/qdev-core.h | 2 ++ 2 files changed, 15 insertions(+) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index a1e9247..9357aba 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 1fca75c..22820fe 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); -- 1.9.3