From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59922) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zcuts-00020E-BN for qemu-devel@nongnu.org; Fri, 18 Sep 2015 08:36:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zcutn-0006BU-1N for qemu-devel@nongnu.org; Fri, 18 Sep 2015 08:36:24 -0400 References: <1441857991-7309-1-git-send-email-eblake@redhat.com> <1441857991-7309-28-git-send-email-eblake@redhat.com> <55FA84C5.8060206@cn.fujitsu.com> <55FACF90.408@redhat.com> <55FB1E65.6030402@redhat.com> <55FB6041.2060602@cn.fujitsu.com> From: Eric Blake Message-ID: <55FC053C.2030702@redhat.com> Date: Fri, 18 Sep 2015 06:36:12 -0600 MIME-Version: 1.0 In-Reply-To: <55FB6041.2060602@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sgmgUOFw23upOfBiRrWvD323rCNdepB1D" Subject: Re: [Qemu-devel] [PATCH RFC v4 27/29] qapi: Change Netdev into a flat union List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wen Congyang , qemu-devel@nongnu.org Cc: Peter Maydell , "Michael S. Tsirkin" , Jason Wang , Vincenzo Maffione , Luiz Capitulino , Max Filippov , Gerd Hoffmann , Dmitry Fleytman , "Edgar E. Iglesias" , Rob Herring , armbru@redhat.com, Scott Feldman , =?UTF-8?B?S8WRdsOhZ8OzLCBab2x0w6Fu?= , marcandre.lureau@redhat.com, Jiri Pirko , Alistair Francis , Jan Kiszka , Stefan Hajnoczi , Giuseppe Lettieri , Luigi Rizzo , David Gibson , Alexander Graf , Peter Crosthwaite , Michael Walle , "open list:sPAPR pseries" , Peter Chubb This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --sgmgUOFw23upOfBiRrWvD323rCNdepB1D Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/17/2015 06:52 PM, Wen Congyang wrote: >> >=20 > OK, I will try it. What is difference between start_struct() and start_= implicit_struct()? If you have the following QDict: { "a":1, "b":2", "c:3" } start_struct() corresponds to the {, and end_struct() corresponds to the }. If the corresponding qapi type is completely inline, then that's all the more you need: struct Foo { int a; int b; int c; }; But oftentimes, we want some sub-structure in our qapi types. So suppose we want to always parse 'b' and 'c' together, in a reusable struct, as in: struct Bar { int b; int c; }; struct Foo { int a; Bar *sub; } With the above representation, we can do a boxed visit by using only start_struct()/end_struct(), but it maps to two levels of {} nesting, as = in: { "a":1, "sub":{ "b":2, "c":3 } } But sometimes we want the C struct nesting while still keeping the QDict representation flat. And that's where start_implicit_struct() enters the picture. It says to start a new C struct while still keeping the QDict nesting unchanged. Right now, we use implicit structs for 'base' types and for flat unions, although some of my pending qapi patches get rid of the use of implicit structs for base types. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --sgmgUOFw23upOfBiRrWvD323rCNdepB1D Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJV/AU8AAoJEKeha0olJ0NqGGMH/3lJAEh6/w1rp4SX1G1Yhxwh /7/Ek4uwzOg8ssYWLwb4//oCmJW7gn3joY8PKMG1VGQUM8/kR34IVvLsU+x8FFMd 1LnkD0I4k4i3WFAeN11wAsOBAukYSQ0S+1UQxHssK9oBMVOde53018nquya5UGPW WeNwn6ZCzurhQb2/QE5QX7D3HMZI4fTunVfXT+O3rGhZn5zaUxoSINqZzkuvtvLP z6df5bozCwSaYR6ZbVUD5S96gjNP2OYur6i6DdLVYsaqLus98aBy+TGOdqxmLoY3 j8ewgrQ1xjIroIzZhDej5C8gir4IUbrbl6JFF/RxfX9aM8ohJhfXP7i68xWSZos= =o8yf -----END PGP SIGNATURE----- --sgmgUOFw23upOfBiRrWvD323rCNdepB1D--