libvhost-user: add a simple link test without glib
[qemu.git] / util / nvdimm-utils.c
blob5cc768ca47965e9636123317910c5314eb8b30eb
1 #include "qemu/nvdimm-utils.h"
2 #include "hw/mem/nvdimm.h"
4 static int nvdimm_device_list(Object *obj, void *opaque)
6 GSList **list = opaque;
8 if (object_dynamic_cast(obj, TYPE_NVDIMM)) {
9 *list = g_slist_append(*list, DEVICE(obj));
12 object_child_foreach(obj, nvdimm_device_list, opaque);
13 return 0;
17 * inquire NVDIMM devices and link them into the list which is
18 * returned to the caller.
20 * Note: it is the caller's responsibility to free the list to avoid
21 * memory leak.
23 GSList *nvdimm_get_device_list(void)
25 GSList *list = NULL;
27 object_child_foreach(qdev_get_machine(), nvdimm_device_list, &list);
28 return list;