Received: from eggs.gnu.org ([2001:4830:134:3::10]:60180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYwEn-00006O-IF for qemu-devel@nongnu.org; Tue, 30 Sep 2014 08:09:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XYwEi-0007Wq-Uc for qemu-devel@nongnu.org; Tue, 30 Sep 2014 08:09:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XYwEi-0007Wc-Lz for qemu-devel@nongnu.org; Tue, 30 Sep 2014 08:08:56 -0400 Date: Tue, 30 Sep 2014 14:08:37 +0200 From: Igor Mammedov Message-ID: <20140930140837.74791c64@nial.usersys.redhat.com> In-Reply-To: <10d53bf553d243380f0355024a1cb300b04060a9.1412067797.git.zhugh.fnst@cn.fujitsu.com> References: <10d53bf553d243380f0355024a1cb300b04060a9.1412067797.git.zhugh.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/2] qdev: add list built for devices List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Zhu Guihua Cc: peter.crosthwaite@xilinx.com, mst@redhat.com, hutao@cn.fujitsu.com, armbru@redhat.com, qemu-devel@nongnu.org, isimatu.yasuaki@jp.fujitsu.com, kroosec@gmail.com, tangchen@cn.fujitsu.com, pbonzini@redhat.com, lcapitulino@redhat.com, afaerber@suse.de On Tue, 30 Sep 2014 17:40:34 +0800 Zhu Guihua wrote: rephrase subj to qdev: func_name() helper > For peripheral device del completion, add a function to build a list for > devices. > > Signed-off-by: Zhu Guihua > --- > 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 fcb1638..041ac38 100644 > --- a/hw/core/qdev.c > +++ b/hw/core/qdev.c > @@ -1074,6 +1074,19 @@ void device_reset(DeviceState *dev) > } > } > > +int device_built_list(Object *obj, void *opaque) qdev_build_hotpluggable_device_list() might describe better what function does You can put object_child_foreach(peripheral, device_built_list, &list) inside if this callback, see for example qmp_pc_dimm_device_list() Also function would return ALL devices regardless of whether they are hotpluggable or not. "hotpluggable" property can be used to discard non hotpluggable devices. > +{ > + GSList **list = opaque; > + DeviceState *dev = DEVICE(obj); > + > + if (dev->realized) { > + *list = g_slist_append(*list, dev); > + } > + > + return 0; > + > +} > + > Object *qdev_get_machine(void) > { > static Object *dev; > diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h > index 178fee2..3c30837 100644 > --- a/include/hw/qdev-core.h > +++ b/include/hw/qdev-core.h > @@ -348,6 +348,8 @@ void qdev_machine_init(void); > */ > void device_reset(DeviceState *dev); > > +int device_built_list(Object *obj, void *opaque); > + > const struct VMStateDescription *qdev_get_vmsd(DeviceState *dev); > > const char *qdev_fw_name(DeviceState *dev);