aboutsummaryrefslogtreecommitdiff
path: root/docs/devel
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2019-11-20 19:25:48 +0100
committerMarkus Armbruster <armbru@redhat.com>2020-01-14 11:01:58 +0100
commit00ca24ff9e5fc3c6ae608226908e6864ad8193a8 (patch)
treebafb9fbc9b4fd8961e264b9580c5d4f68162343c /docs/devel
parent0cc0e2689498e2b731330980b1cecb83987b1bc8 (diff)
qapi: Generate command registration stuff into separate files
Having to include qapi-commands.h just for qmp_init_marshal() is suboptimal. Generate it into separate files. This lets monitor/misc.c, qga/main.c, and the generated qapi-commands-FOO.h include less. Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <20191120182551.23795-4-armbru@redhat.com> [Typos in docs/devel/qapi-code-gen.txt fixed] Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'docs/devel')
-rw-r--r--docs/devel/qapi-code-gen.txt19
1 files changed, 16 insertions, 3 deletions
diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt
index 45c93a43cc..59d6973e1e 100644
--- a/docs/devel/qapi-code-gen.txt
+++ b/docs/devel/qapi-code-gen.txt
@@ -1493,6 +1493,10 @@ $(prefix)qapi-commands.c: Command marshal/dispatch functions for each
$(prefix)qapi-commands.h: Function prototypes for the QMP commands
specified in the schema
+$(prefix)qapi-init-commands.h - Command initialization prototype
+
+$(prefix)qapi-init-commands.c - Command initialization code
+
Example:
$ cat qapi-generated/example-qapi-commands.h
@@ -1502,11 +1506,9 @@ Example:
#define EXAMPLE_QAPI_COMMANDS_H
#include "example-qapi-types.h"
- #include "qapi/qmp/dispatch.h"
UserDefOne *qmp_my_command(UserDefOneList *arg1, Error **errp);
void qmp_marshal_my_command(QDict *args, QObject **ret, Error **errp);
- void example_qmp_init_marshal(QmpCommandList *cmds);
#endif /* EXAMPLE_QAPI_COMMANDS_H */
$ cat qapi-generated/example-qapi-commands.c
@@ -1566,7 +1568,19 @@ Example:
visit_end_struct(v, NULL);
visit_free(v);
}
+[Uninteresting stuff omitted...]
+ $ cat qapi-generated/example-qapi-init-commands.h
+[Uninteresting stuff omitted...]
+ #ifndef EXAMPLE_QAPI_INIT_COMMANDS_H
+ #define EXAMPLE_QAPI_INIT_COMMANDS_H
+ #include "qapi/qmp/dispatch.h"
+
+ void example_qmp_init_marshal(QmpCommandList *cmds);
+
+ #endif /* EXAMPLE_QAPI_INIT_COMMANDS_H */
+ $ cat qapi-generated/example-qapi-init-commands.c
+[Uninteresting stuff omitted...]
void example_qmp_init_marshal(QmpCommandList *cmds)
{
QTAILQ_INIT(cmds);
@@ -1574,7 +1588,6 @@ Example:
qmp_register_command(cmds, "my-command",
qmp_marshal_my_command, QCO_NO_OPTIONS);
}
-
[Uninteresting stuff omitted...]
For a modular QAPI schema (see section Include directives), code for