aboutsummaryrefslogtreecommitdiff
path: root/qmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'qmp.c')
-rw-r--r--qmp.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/qmp.c b/qmp.c
index d71ceb4e4d..8e9a595398 100644
--- a/qmp.c
+++ b/qmp.c
@@ -16,6 +16,7 @@
#include "qmp-commands.h"
#include "kvm.h"
#include "arch_init.h"
+#include "hw/qdev.h"
NameInfo *qmp_query_name(Error **errp)
{
@@ -154,3 +155,30 @@ void qmp_cont(Error **errp)
vm_start();
}
+
+DevicePropertyInfoList *qmp_qom_list(const char *path, Error **errp)
+{
+ DeviceState *dev;
+ bool ambiguous = false;
+ DevicePropertyInfoList *props = NULL;
+ DeviceProperty *prop;
+
+ dev = qdev_resolve_path(path, &ambiguous);
+ if (dev == NULL) {
+ error_set(errp, QERR_DEVICE_NOT_FOUND, path);
+ return NULL;
+ }
+
+ QTAILQ_FOREACH(prop, &dev->properties, node) {
+ DevicePropertyInfoList *entry = g_malloc0(sizeof(*entry));
+
+ entry->value = g_malloc0(sizeof(DevicePropertyInfo));
+ entry->next = props;
+ props = entry;
+
+ entry->value->name = g_strdup(prop->name);
+ entry->value->type = g_strdup(prop->type);
+ }
+
+ return props;
+}