From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN6aM-0002nU-EQ for qemu-devel@nongnu.org; Wed, 05 Aug 2015 17:50:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZN6aI-0004kg-3K for qemu-devel@nongnu.org; Wed, 05 Aug 2015 17:50:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36826) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZN6aH-0004jG-SJ for qemu-devel@nongnu.org; Wed, 05 Aug 2015 17:50:50 -0400 References: <1438703896-12553-1-git-send-email-armbru@redhat.com> <1438703896-12553-33-git-send-email-armbru@redhat.com> <55C27AC8.8060906@redhat.com> From: Eric Blake Message-ID: <55C28532.7080802@redhat.com> Date: Wed, 5 Aug 2015 15:50:42 -0600 MIME-Version: 1.0 In-Reply-To: <55C27AC8.8060906@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="pT6t9gGGWmec062Ql9kcFQDISLL7jWrCI" Subject: Re: [Qemu-devel] [PATCH RFC v3 32/32] qapi-introspect: Hide type names List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster , qemu-devel@nongnu.org Cc: kwolf@redhat.com, berto@igalia.com, mdroth@linux.vnet.ibm.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --pT6t9gGGWmec062Ql9kcFQDISLL7jWrCI Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08/05/2015 03:06 PM, Eric Blake wrote: > On 08/04/2015 09:58 AM, Markus Armbruster wrote: >> To eliminate the temptation for clients to look up types by name >> (which are not ABI), replace all type names by meaningless strings. >> >> Reduces output of query-schema by 13 out of 85KiB. >=20 > I'm starting to be more in favor of this patch, both for ABI reasons an= d > for size shavings. It definitely looks better than in v2, where munged= > names are just an arbitrary number, and where builtins are not munged. >=20 >> >> TODO Either generate comments with the true type names, or provide an >> option to generate without type name hiding. >=20 > See also my comments on 30/32 about whether we should mask array types > differently (and yes, the lack of comments made it a bit harder to chas= e > down types for my commentary in that mail). In fact, squashing this in was all the more I needed to implement the proposal there: diff --git i/scripts/qapi-introspect.py w/scripts/qapi-introspect.py index 5e99d4b..d723ef1 100644 --- i/scripts/qapi-introspect.py +++ w/scripts/qapi-introspect.py @@ -97,10 +97,12 @@ const char %(c_name)s[] =3D %(c_string)s; # characters. if isinstance(typ, QAPISchemaBuiltinType): return typ.name + if isinstance(typ, QAPISchemaArrayType): + return '[' + self._use_type(typ.element_type) + ']' return self._name(typ.name) def _gen_json(self, name, mtype, obj=3D{}): - if mtype !=3D 'command' and mtype !=3D 'event' and mtype !=3D 'b= uiltin': + if mtype not in ('command', 'event', 'builtin', 'array'): name =3D self._name(name) obj['name'] =3D name obj['meta-type'] =3D mtype @@ -126,8 +128,9 @@ const char %(c_name)s[] =3D %(c_string)s; self._gen_json(name, 'enum', { 'values': values }) def visit_array_type(self, name, info, element_type): - self._gen_json(name, 'array', - { 'element-type': self._use_type(element_type) })= + element =3D self._use_type(element_type) + self._gen_json('[' + element + ']', 'array', + { 'element-type': element }) def visit_object_type_flat(self, name, info, members, variants): obj =3D { 'members': [self._gen_member(m) for m in members] } --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --pT6t9gGGWmec062Ql9kcFQDISLL7jWrCI 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/ iQEcBAEBCAAGBQJVwoUyAAoJEKeha0olJ0Nq5dcH/iH11zkUdzT8xjMcN2tUeIu7 LPt4z/LAZQsR7QB2Mp5+FFaY2ToZZmh5VEnmmLsTeIC0jqyc5mE8rY63PtoZuud+ 1okRqPb9RTsK2m5DuQ4GurH7y3VixKkJDYZ0+8gDid450sb82VFvnyOV8LOh8dld 8LlK3Mk9W/PlPW+JgNmIlTlUm6vjNX/cL8GTYNRt/gFaO3ooB6Xm/Vfk9LXXKgID 0HiuV/BahxaPxpPToFsAOz7ez7Lb8G4mwGz64Jo6bFdxXu+PCOQwp5ldTp8e0mfR MzkwtnNXiHRM/ic0MuyV5AQ9y6YUYyPLQ2/zg5R2hJoZM+MU/cZ6qAfaUyDGYzU= =0OeN -----END PGP SIGNATURE----- --pT6t9gGGWmec062Ql9kcFQDISLL7jWrCI--