mirror of
https://github.com/qemu/qemu.git
synced 2024-11-26 12:23:36 +08:00
3f350f6bb3
nvdimm_device_list is required for parsing the list for devices in subsequent patches. Move it to common utility area. Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com> Reviewed-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Message-Id: <158131055857.2897.15658377276504711773.stgit@lep8c.aus.stglabs.ibm.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
30 lines
673 B
C
30 lines
673 B
C
#include "qemu/nvdimm-utils.h"
|
|
#include "hw/mem/nvdimm.h"
|
|
|
|
static int nvdimm_device_list(Object *obj, void *opaque)
|
|
{
|
|
GSList **list = opaque;
|
|
|
|
if (object_dynamic_cast(obj, TYPE_NVDIMM)) {
|
|
*list = g_slist_append(*list, DEVICE(obj));
|
|
}
|
|
|
|
object_child_foreach(obj, nvdimm_device_list, opaque);
|
|
return 0;
|
|
}
|
|
|
|
/*
|
|
* inquire NVDIMM devices and link them into the list which is
|
|
* returned to the caller.
|
|
*
|
|
* Note: it is the caller's responsibility to free the list to avoid
|
|
* memory leak.
|
|
*/
|
|
GSList *nvdimm_get_device_list(void)
|
|
{
|
|
GSList *list = NULL;
|
|
|
|
object_child_foreach(qdev_get_machine(), nvdimm_device_list, &list);
|
|
return list;
|
|
}
|