summaryrefslogtreecommitdiff
path: root/monitor.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2017-03-03 13:32:25 +0100
committerMarkus Armbruster <armbru@redhat.com>2017-03-05 09:12:25 +0100
commit1527badb954f2d8c17b86e2a258812def5ea3dcc (patch)
tree115c03868efbc08b8149dc738ac0f19be5138ae6 /monitor.c
parent05875687806b71ae980ca59a46777b742b20ac06 (diff)
downloadqemu-1527badb954f2d8c17b86e2a258812def5ea3dcc.tar.gz
qapi: Support multiple command registries per program
The command registry encapsulates a single command list. Give the functions using it a parameter instead. Define suitable command lists in monitor, guest agent and test-qmp-commands. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1488544368-30622-6-git-send-email-armbru@redhat.com> [Debugging turds buried] Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'monitor.c')
-rw-r--r--monitor.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/monitor.c b/monitor.c
index 53f5f5a378..c7f7602466 100644
--- a/monitor.c
+++ b/monitor.c
@@ -221,6 +221,8 @@ static int mon_refcount;
static mon_cmd_t mon_cmds[];
static mon_cmd_t info_cmds[];
+QmpCommandList qmp_commands;
+
Monitor *cur_mon;
static QEMUClockType event_clock_type = QEMU_CLOCK_REALTIME;
@@ -919,7 +921,7 @@ CommandInfoList *qmp_query_commands(Error **errp)
{
CommandInfoList *list = NULL;
- qmp_for_each_command(query_commands_cb, &list);
+ qmp_for_each_command(&qmp_commands, query_commands_cb, &list);
return list;
}
@@ -973,39 +975,40 @@ static void qmp_query_qmp_schema(QDict *qdict, QObject **ret_data,
static void qmp_unregister_commands_hack(void)
{
#ifndef CONFIG_SPICE
- qmp_unregister_command("query-spice");
+ qmp_unregister_command(&qmp_commands, "query-spice");
#endif
#ifndef TARGET_I386
- qmp_unregister_command("rtc-reset-reinjection");
+ qmp_unregister_command(&qmp_commands, "rtc-reset-reinjection");
#endif
#ifndef TARGET_S390X
- qmp_unregister_command("dump-skeys");
+ qmp_unregister_command(&qmp_commands, "dump-skeys");
#endif
#ifndef TARGET_ARM
- qmp_unregister_command("query-gic-capabilities");
+ qmp_unregister_command(&qmp_commands, "query-gic-capabilities");
#endif
#if !defined(TARGET_S390X) && !defined(TARGET_I386)
- qmp_unregister_command("query-cpu-model-expansion");
+ qmp_unregister_command(&qmp_commands, "query-cpu-model-expansion");
#endif
#if !defined(TARGET_S390X)
- qmp_unregister_command("query-cpu-model-baseline");
- qmp_unregister_command("query-cpu-model-comparison");
+ qmp_unregister_command(&qmp_commands, "query-cpu-model-baseline");
+ qmp_unregister_command(&qmp_commands, "query-cpu-model-comparison");
#endif
#if !defined(TARGET_PPC) && !defined(TARGET_ARM) && !defined(TARGET_I386) \
&& !defined(TARGET_S390X)
- qmp_unregister_command("query-cpu-definitions");
+ qmp_unregister_command(&qmp_commands, "query-cpu-definitions");
#endif
}
void monitor_init_qmp_commands(void)
{
- qmp_init_marshal();
+ qmp_init_marshal(&qmp_commands);
- qmp_register_command("query-qmp-schema", qmp_query_qmp_schema,
+ qmp_register_command(&qmp_commands, "query-qmp-schema",
+ qmp_query_qmp_schema,
QCO_NO_OPTIONS);
- qmp_register_command("device_add", qmp_device_add,
+ qmp_register_command(&qmp_commands, "device_add", qmp_device_add,
QCO_NO_OPTIONS);
- qmp_register_command("netdev_add", qmp_netdev_add,
+ qmp_register_command(&qmp_commands, "netdev_add", qmp_netdev_add,
QCO_NO_OPTIONS);
qmp_unregister_commands_hack();
@@ -3787,7 +3790,7 @@ static void handle_qmp_command(JSONMessageParser *parser, GQueue *tokens)
goto err_out;
}
- rsp = qmp_dispatch(req);
+ rsp = qmp_dispatch(&qmp_commands, req);
err_out:
if (err) {