On Tue, 30 Sep 2014 17:40:34 +0800 Zhu Guihua <[email protected]> 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 <[email protected]> > --- > 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);
