aboutsummaryrefslogtreecommitdiff
path: root/qmp.c
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-12 14:29:34 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-15 09:20:48 -0600
commitb4b12c6247d89b94e197891fbadb2699fd469ed6 (patch)
treebc60736b89702107917198ffa2ab0c1d5ff3ea1e /qmp.c
parent5dbee474f352401efb404ff8dfb90a3ca90ce3d1 (diff)
qmp: add qom-list command
This can be used to list properties in the device model. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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;
+}