From nobody Wed Nov 5 16:36:55 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1535458264533668.8897098140868; Tue, 28 Aug 2018 05:11:04 -0700 (PDT) Received: from localhost ([::1]:37822 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fucpi-0006GV-FA for importer@patchew.org; Tue, 28 Aug 2018 08:10:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33469) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fucnv-0005KP-Vo for qemu-devel@nongnu.org; Tue, 28 Aug 2018 08:09:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fucmc-00006G-Tp for qemu-devel@nongnu.org; Tue, 28 Aug 2018 08:07:44 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:55276 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fucmc-00005e-NP for qemu-devel@nongnu.org; Tue, 28 Aug 2018 08:07:42 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4EACD40216E5; Tue, 28 Aug 2018 12:07:42 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-97.ams2.redhat.com [10.36.116.97]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0D9ED2026D6B; Tue, 28 Aug 2018 12:07:42 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 23D851138603; Tue, 28 Aug 2018 14:07:36 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 28 Aug 2018 14:07:36 +0200 Message-Id: <20180828120736.32323-3-armbru@redhat.com> In-Reply-To: <20180828120736.32323-1-armbru@redhat.com> References: <20180828120736.32323-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 28 Aug 2018 12:07:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Tue, 28 Aug 2018 12:07:42 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'armbru@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 2/2] qapi: Update docs for generator changes since commit 9ee86b85267 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mdroth@linux.vnet.ibm.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Markus Armbruster --- docs/devel/qapi-code-gen.txt | 131 ++++++++++++++++++++++++++--------- 1 file changed, 100 insertions(+), 31 deletions(-) diff --git a/docs/devel/qapi-code-gen.txt b/docs/devel/qapi-code-gen.txt index c2e11465f0..49149f495a 100644 --- a/docs/devel/qapi-code-gen.txt +++ b/docs/devel/qapi-code-gen.txt @@ -1035,7 +1035,7 @@ Example: #ifndef EXAMPLE_QAPI_TYPES_H #define EXAMPLE_QAPI_TYPES_H =20 -[Built-in types omitted...] + #include "qapi/qapi-builtin-types.h" =20 typedef struct UserDefOne UserDefOne; =20 @@ -1062,7 +1062,7 @@ Example: UserDefOneList *arg1; }; =20 - #endif + #endif /* EXAMPLE_QAPI_TYPES_H */ $ cat qapi-generated/example-qapi-types.c [Uninteresting stuff omitted...] =20 @@ -1092,6 +1092,8 @@ Example: visit_free(v); } =20 +[Uninteresting stuff omitted...] + =3D=3D=3D Code generated for visiting QAPI types =3D=3D=3D =20 These are the visitor functions used to walk through and convert @@ -1118,7 +1120,9 @@ Example: #ifndef EXAMPLE_QAPI_VISIT_H #define EXAMPLE_QAPI_VISIT_H =20 -[Visitors for built-in types omitted...] + #include "qapi/qapi-builtin-visit.h" + #include "example-qapi-types.h" + =20 void visit_type_UserDefOne_members(Visitor *v, UserDefOne *obj, Error = **errp); void visit_type_UserDefOne(Visitor *v, const char *name, UserDefOne **= obj, Error **errp); @@ -1126,7 +1130,7 @@ Example: =20 void visit_type_q_obj_my_command_arg_members(Visitor *v, q_obj_my_comm= and_arg *obj, Error **errp); =20 - #endif + #endif /* EXAMPLE_QAPI_VISIT_H */ $ cat qapi-generated/example-qapi-visit.c [Uninteresting stuff omitted...] =20 @@ -1219,6 +1223,8 @@ Example: error_propagate(errp, err); } =20 +[Uninteresting stuff omitted...] + =3D=3D=3D Code generated for commands =3D=3D=3D =20 These are the marshaling/dispatch functions for the commands defined @@ -1238,18 +1244,17 @@ Example: $ cat qapi-generated/example-qapi-commands.h [Uninteresting stuff omitted...] =20 - #ifndef EXAMPLE_QMP_COMMANDS_H - #define EXAMPLE_QMP_COMMANDS_H + #ifndef EXAMPLE_QAPI_COMMANDS_H + #define EXAMPLE_QAPI_COMMANDS_H =20 #include "example-qapi-types.h" - #include "qapi/qmp/qdict.h" #include "qapi/qmp/dispatch.h" =20 - void example_qmp_init_marshal(QmpCommandList *cmds); 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); =20 - #endif + #endif /* EXAMPLE_QAPI_COMMANDS_H */ $ cat qapi-generated/example-qapi-commands.c [Uninteresting stuff omitted...] =20 @@ -1316,6 +1321,8 @@ Example: qmp_marshal_my_command, QCO_NO_OPTIONS); } =20 +[Uninteresting stuff omitted...] + =3D=3D=3D Code generated for events =3D=3D=3D =20 This is the code related to events defined in the schema, providing @@ -1333,10 +1340,10 @@ Example: $ cat qapi-generated/example-qapi-events.h [Uninteresting stuff omitted...] =20 - #ifndef EXAMPLE_QAPI_EVENT_H - #define EXAMPLE_QAPI_EVENT_H + #ifndef EXAMPLE_QAPI_EVENTS_H + #define EXAMPLE_QAPI_EVENTS_H =20 - #include "qapi/qmp/qdict.h" + #include "qapi/util.h" #include "example-qapi-types.h" =20 =20 @@ -1348,11 +1355,11 @@ Example: } example_QAPIEvent; =20 #define example_QAPIEvent_str(val) \ - qapi_enum_lookup(example_QAPIEvent_lookup, (val)) + qapi_enum_lookup(&example_QAPIEvent_lookup, (val)) =20 - extern const char *const example_QAPIEvent_lookup[]; + extern const QEnumLookup example_QAPIEvent_lookup; =20 - #endif + #endif /* EXAMPLE_QAPI_EVENTS_H */ $ cat qapi-generated/example-qapi-events.c [Uninteresting stuff omitted...] =20 @@ -1382,6 +1389,8 @@ Example: .size =3D EXAMPLE_QAPI_EVENT__MAX }; =20 +[Uninteresting stuff omitted...] + =3D=3D=3D Code generated for introspection =3D=3D=3D =20 The following files are created: @@ -1396,30 +1405,90 @@ Example: $ cat qapi-generated/example-qapi-introspect.h [Uninteresting stuff omitted...] =20 - #ifndef EXAMPLE_QMP_INTROSPECT_H - #define EXAMPLE_QMP_INTROSPECT_H + #ifndef EXAMPLE_QAPI_INTROSPECT_H + #define EXAMPLE_QAPI_INTROSPECT_H =20 - extern const QLitObject qmp_schema_qlit; + #include "qapi/qmp/qlit.h" =20 - #endif + extern const QLitObject example_qmp_schema_qlit; + + #endif /* EXAMPLE_QAPI_INTROSPECT_H */ $ cat qapi-generated/example-qapi-introspect.c [Uninteresting stuff omitted...] =20 const QLitObject example_qmp_schema_qlit =3D QLIT_QLIST(((QLitObject[]= ) { QLIT_QDICT(((QLitDictEntry[]) { - { "arg-type", QLIT_QSTR("0") }, - { "meta-type", QLIT_QSTR("event") }, - { "name", QLIT_QSTR("Event") }, - { } + { "arg-type", QLIT_QSTR("0"), }, + { "meta-type", QLIT_QSTR("command"), }, + { "name", QLIT_QSTR("my-command"), }, + { "ret-type", QLIT_QSTR("1"), }, + {} + })), + QLIT_QDICT(((QLitDictEntry[]) { + { "arg-type", QLIT_QSTR("2"), }, + { "meta-type", QLIT_QSTR("event"), }, + { "name", QLIT_QSTR("MY_EVENT"), }, + {} + })), + QLIT_QDICT(((QLitDictEntry[]) { + { "members", QLIT_QLIST(((QLitObject[]) { + QLIT_QDICT(((QLitDictEntry[]) { + { "name", QLIT_QSTR("arg1"), }, + { "type", QLIT_QSTR("[1]"), }, + {} + })), + {} + })), }, + { "meta-type", QLIT_QSTR("object"), }, + { "name", QLIT_QSTR("0"), }, + {} + })), + QLIT_QDICT(((QLitDictEntry[]) { + { "members", QLIT_QLIST(((QLitObject[]) { + QLIT_QDICT(((QLitDictEntry[]) { + { "name", QLIT_QSTR("integer"), }, + { "type", QLIT_QSTR("int"), }, + {} + })), + QLIT_QDICT(((QLitDictEntry[]) { + { "default", QLIT_QNULL, }, + { "name", QLIT_QSTR("string"), }, + { "type", QLIT_QSTR("str"), }, + {} + })), + {} + })), }, + { "meta-type", QLIT_QSTR("object"), }, + { "name", QLIT_QSTR("1"), }, + {} })), QLIT_QDICT(((QLitDictEntry[]) { { "members", QLIT_QLIST(((QLitObject[]) { - { } - })) }, - { "meta-type", QLIT_QSTR("object") }, - { "name", QLIT_QSTR("0") }, - { } - })), - ... - { } + {} + })), }, + { "meta-type", QLIT_QSTR("object"), }, + { "name", QLIT_QSTR("2"), }, + {} + })), + QLIT_QDICT(((QLitDictEntry[]) { + { "element-type", QLIT_QSTR("1"), }, + { "meta-type", QLIT_QSTR("array"), }, + { "name", QLIT_QSTR("[1]"), }, + {} + })), + QLIT_QDICT(((QLitDictEntry[]) { + { "json-type", QLIT_QSTR("int"), }, + { "meta-type", QLIT_QSTR("builtin"), }, + { "name", QLIT_QSTR("int"), }, + {} + })), + QLIT_QDICT(((QLitDictEntry[]) { + { "json-type", QLIT_QSTR("string"), }, + { "meta-type", QLIT_QSTR("builtin"), }, + { "name", QLIT_QSTR("str"), }, + {} + })), + {} })); + +[Uninteresting stuff omitted...] --=20 2.17.1