[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 12/21] qom: add plug_list_props QMP command
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 12/21] qom: add plug_list_props QMP command |
Date: |
Sun, 24 Jul 2011 20:44:44 -0500 |
Signed-off-by: Anthony Liguori <address@hidden>
---
monitor.c | 35 +++++++++++++++++++++++++++++++++++
qmp-commands.hx | 9 +++++++++
2 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/monitor.c b/monitor.c
index 47011dd..e53808a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1162,6 +1162,41 @@ static int do_plug_set(Monitor *mon, const QDict *qdict,
QObject **ret_data)
return 0;
}
+static void plug_list_props_tramp(Plug *plug, const char *name, const char
*typename, int flags, void *opaque)
+{
+ QList *qlist = opaque;
+ QDict *item = qdict_new();
+
+ qdict_put(item, "name", qstring_from_str(name));
+ qdict_put(item, "type", qstring_from_str(typename));
+ qdict_put(item, "readable", qbool_from_int(!!(flags & PROP_F_READ)));
+ qdict_put(item, "writeable", qbool_from_int(!!(flags & PROP_F_WRITE)));
+ qdict_put(item, "locked", qbool_from_int(!!(flags & PROP_F_LOCKED)));
+
+ qlist_append(qlist, item);
+}
+
+static int do_plug_list_props(Monitor *mon, const QDict *qdict, QObject
**ret_data)
+{
+ const char *id = qdict_get_str(qdict, "id");
+ QList *qlist = qlist_new();
+ TypeInstance *inst;
+ Plug *plug;
+
+ inst = type_find_by_id(id);
+ if (inst == NULL) {
+ return -1;
+ }
+
+ plug = PLUG(inst);
+
+ plug_foreach_property(plug, plug_list_props_tramp, qlist);
+
+ *ret_data = QOBJECT(qlist);
+
+ return 0;
+}
+
#ifdef CONFIG_VNC
static int change_vnc_password(const char *password)
{
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 1d7e87b..6f1091b 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -139,6 +139,15 @@ EQMP
},
{
+ .name = "plug_list_props",
+ .args_type = "id:s",
+ .params = "",
+ .help = "list plug properties",
+ .user_print = monitor_user_noop,
+ .mhandler.cmd_new = do_plug_list_props,
+ },
+
+ {
.name = "eject",
.args_type = "force:-f,device:B",
.params = "[-f] device",
--
1.7.4.1
- [Qemu-devel] [PATCH 01/21] qom: add make infrastructure, (continued)
- [Qemu-devel] [PATCH 01/21] qom: add make infrastructure, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 07/21] plug: add generated property types, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 03/21] qom: Add core type system, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 05/21] plug: add Plug property type, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 10/21] qom: add plug_get QMP command, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 11/21] qom: add plug_set QMP command, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 08/21] qom: add plug_create QMP command, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 13/21] qom: add plug_destroy command, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 16/21] qom-devices: add a Pin class, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 17/21] qom: add CharDriver class, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 12/21] qom: add plug_list_props QMP command,
Anthony Liguori <=
- [Qemu-devel] [PATCH 15/21] qom: add Device class, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 21/21] qom-chrdrv: add UnixServer, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 19/21] qom-chrdrv: add Socket base class, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 18/21] qom-chrdrv: add memory character driver, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 20/21] qom-chrdrv: add TCPServer class, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 14/21] qom: add example qsh command, Anthony Liguori, 2011/07/24
- [Qemu-devel] [PATCH 09/21] qom: add plug_list QMP command, Anthony Liguori, 2011/07/24
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Kevin Wolf, 2011/07/25