aboutsummaryrefslogtreecommitdiff
path: root/scripts
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 /scripts
parent05875687806b71ae980ca59a46777b742b20ac06 (diff)
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 'scripts')
-rw-r--r--scripts/qapi-commands.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/qapi-commands.py b/scripts/qapi-commands.py
index a75946f47e..2b062ad1fd 100644
--- a/scripts/qapi-commands.py
+++ b/scripts/qapi-commands.py
@@ -198,7 +198,8 @@ def gen_register_command(name, success_response):
options = 'QCO_NO_SUCCESS_RESP'
ret = mcgen('''
- qmp_register_command("%(name)s", qmp_marshal_%(c_name)s, %(opts)s);
+ qmp_register_command(cmds, "%(name)s",
+ qmp_marshal_%(c_name)s, %(opts)s);
''',
name=name, c_name=c_name(name),
opts=options)
@@ -208,9 +209,12 @@ def gen_register_command(name, success_response):
def gen_registry(registry):
ret = mcgen('''
-void qmp_init_marshal(void)
+void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds)
{
-''')
+ QTAILQ_INIT(cmds);
+
+''',
+ c_prefix=c_name(prefix, protect=False))
ret += registry
ret += mcgen('''
}
@@ -289,7 +293,6 @@ fdef.write(mcgen('''
#include "qemu-common.h"
#include "qemu/module.h"
#include "qapi/qmp/types.h"
-#include "qapi/qmp/dispatch.h"
#include "qapi/visitor.h"
#include "qapi/qobject-output-visitor.h"
#include "qapi/qobject-input-visitor.h"
@@ -304,11 +307,12 @@ fdef.write(mcgen('''
fdecl.write(mcgen('''
#include "%(prefix)sqapi-types.h"
#include "qapi/qmp/qdict.h"
+#include "qapi/qmp/dispatch.h"
#include "qapi/error.h"
-void qmp_init_marshal(void);
+void %(c_prefix)sqmp_init_marshal(QmpCommandList *cmds);
''',
- prefix=prefix))
+ prefix=prefix, c_prefix=c_name(prefix, protect=False)))
schema = QAPISchema(input_file)
gen = QAPISchemaGenCommandVisitor()