mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
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>
This commit is contained in:
parent
0587568780
commit
1527badb95
9 changed files with 84 additions and 66 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue