]> git.proxmox.com Git - mirror_qemu.git/blame - util/nvdimm-utils.c
util/qemu-openpty.c: Don't assume pty.h is glibc-only
[mirror_qemu.git] / util / nvdimm-utils.c
CommitLineData
3f350f6b
SB
1#include "qemu/nvdimm-utils.h"
2#include "hw/mem/nvdimm.h"
3
4static int nvdimm_device_list(Object *obj, void *opaque)
5{
6 GSList **list = opaque;
7
8 if (object_dynamic_cast(obj, TYPE_NVDIMM)) {
9 *list = g_slist_append(*list, DEVICE(obj));
10 }
11
12 object_child_foreach(obj, nvdimm_device_list, opaque);
13 return 0;
14}
15
16/*
17 * inquire NVDIMM devices and link them into the list which is
18 * returned to the caller.
19 *
20 * Note: it is the caller's responsibility to free the list to avoid
21 * memory leak.
22 */
23GSList *nvdimm_get_device_list(void)
24{
25 GSList *list = NULL;
26
27 object_child_foreach(qdev_get_machine(), nvdimm_device_list, &list);
28 return list;
29}