[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 09/21] qom: add plug_list QMP command
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 09/21] qom: add plug_list QMP command |
Date: |
Sun, 24 Jul 2011 20:44:41 -0500 |
Signed-off-by: Anthony Liguori <address@hidden>
---
monitor.c | 25 +++++++++++++++++++++++++
qmp-commands.hx | 9 +++++++++
2 files changed, 34 insertions(+), 0 deletions(-)
diff --git a/monitor.c b/monitor.c
index 8406b5b..f17eb3a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1069,6 +1069,31 @@ static int do_plug_create(Monitor *mon, const QDict
*qdict, QObject **ret_data)
return 0;
}
+static int do_plug_list(Monitor *mon, const QDict *qdict, QObject **ret_data)
+{
+ QList *qlist = qlist_new();
+ const char *type = qdict_get_try_str(qdict, "type");
+ GSList *i;
+
+ for (i = global_plug_list; i; i = i->next) {
+ TypeInstance *obj = i->data;
+ QDict *item = qdict_new();
+
+ if (type && !type_is_type(obj, type)) {
+ continue;
+ }
+
+ qdict_put(item, "id", qstring_from_str(type_get_id(obj)));
+ qdict_put(item, "type", qstring_from_str(type_get_type(obj)));
+
+ qlist_append(qlist, item);
+ }
+
+ *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 c86d396..16f3f4d 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -112,6 +112,15 @@ Notes:
EQMP
{
+ .name = "plug_list",
+ .args_type = "type:s?",
+ .params = "",
+ .help = "list plugs",
+ .user_print = monitor_user_noop,
+ .mhandler.cmd_new = do_plug_list,
+ },
+
+ {
.name = "eject",
.args_type = "force:-f,device:B",
.params = "[-f] device",
--
1.7.4.1
- [Qemu-devel] [PATCH 17/21] qom: add CharDriver class, (continued)
- [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, 2011/07/24
- [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 <=
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Kevin Wolf, 2011/07/25
- Re: [Qemu-devel] [RFC][PATCH 0/21] QEMU Object Model, Paolo Bonzini, 2011/07/26