[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 19/36] qmp: implement qmp_query_commands without qmp
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PATCH 19/36] qmp: implement qmp_query_commands without qmp_cmds |
Date: |
Fri, 25 Sep 2015 16:03:47 +0200 |
From: Marc-André Lureau <address@hidden>
So we can get rid of the static qmp_cmds table.
Signed-off-by: Marc-André Lureau <address@hidden>
---
monitor.c | 25 ++++++++++++++-----------
1 file changed, 14 insertions(+), 11 deletions(-)
diff --git a/monitor.c b/monitor.c
index bfa0329..a2eb228 100644
--- a/monitor.c
+++ b/monitor.c
@@ -850,21 +850,24 @@ static void hmp_info_help(Monitor *mon, const QDict
*qdict)
help_cmd(mon, "info");
}
-CommandInfoList *qmp_query_commands(Error **errp)
+static void query_commands_cb(QmpCommand *cmd, void *opaque)
{
- CommandInfoList *info, *cmd_list = NULL;
- const mon_cmd_t *cmd;
+ CommandInfoList *info, **list = opaque;
- for (cmd = qmp_cmds; cmd->name != NULL; cmd++) {
- info = g_malloc0(sizeof(*info));
- info->value = g_malloc0(sizeof(*info->value));
- info->value->name = g_strdup(cmd->name);
+ info = g_malloc0(sizeof(*info));
+ info->value = g_malloc0(sizeof(*info->value));
+ info->value->name = g_strdup(cmd->name);
+ info->next = *list;
+ *list = info;
+}
- info->next = cmd_list;
- cmd_list = info;
- }
+CommandInfoList *qmp_query_commands(Error **errp)
+{
+ CommandInfoList *list = NULL;
+
+ qmp_for_each_command(query_commands_cb, &list);
- return cmd_list;
+ return list;
}
EventInfoList *qmp_query_events(Error **errp)
--
2.4.3
- [Qemu-devel] [PATCH 09/36] qapi: remove qmp-events.txt, (continued)
- [Qemu-devel] [PATCH 09/36] qapi: remove qmp-events.txt, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 14/36] monitor: remove usage of generated marshal functions, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 13/36] build-sys: do not generate qmp-commands-old.h, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 15/36] monitor: register gen:false commands manually, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 18/36] qapi: remove "middle" mode, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 16/36] qmp: register qapi commands (no middle mode), marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 21/36] misc: spelling, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 19/36] qmp: implement qmp_query_commands without qmp_cmds,
marcandre . lureau <=
- [Qemu-devel] [PATCH 05/36] qapi: move examples to json schema, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 17/36] qmp: use qmp_dispatch(), marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 23/36] qmp: use a return callback for the command reply, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 20/36] qmp: remove old qmp-commands table, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 22/36] qmp: teach qmp_dispatch() to take a pre-filled QDict, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 24/36] qmp: add QmpClient, marcandre . lureau, 2015/09/25
- [Qemu-devel] [PATCH 26/36] qmp: check that async command have an 'id', marcandre . lureau, 2015/09/25