From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54277) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXYHP-0008Df-RG for qemu-devel@nongnu.org; Wed, 10 Aug 2016 14:31:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXYHN-0005j1-QR for qemu-devel@nongnu.org; Wed, 10 Aug 2016 14:31:02 -0400 References: <1470679640-18366-1-git-send-email-clord@redhat.com> <1470679640-18366-3-git-send-email-clord@redhat.com> From: Max Reitz Message-ID: <18144b9f-f7f8-3a2a-31ec-a928ec798af0@redhat.com> Date: Wed, 10 Aug 2016 20:30:53 +0200 MIME-Version: 1.0 In-Reply-To: <1470679640-18366-3-git-send-email-clord@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cMTFiwscqECRvVpP2CRiGX7MqCudRR5PK" Subject: Re: [Qemu-devel] [PATCH v7 2/4] blockdev: Add dynamic generation of module_block.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Colin Lord , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org, Marc Mari This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --cMTFiwscqECRvVpP2CRiGX7MqCudRR5PK From: Max Reitz To: Colin Lord , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org, Marc Mari Message-ID: <18144b9f-f7f8-3a2a-31ec-a928ec798af0@redhat.com> Subject: Re: [PATCH v7 2/4] blockdev: Add dynamic generation of module_block.h References: <1470679640-18366-1-git-send-email-clord@redhat.com> <1470679640-18366-3-git-send-email-clord@redhat.com> In-Reply-To: <1470679640-18366-3-git-send-email-clord@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 08.08.2016 20:07, Colin Lord wrote: > From: Marc Mari >=20 > To simplify the addition of new block modules, add a script that genera= tes > module_block.h automatically from the modules' source code. >=20 > This script assumes that the QEMU coding style rules are followed. >=20 > Signed-off-by: Marc Mar=C3=AD > Signed-off-by: Colin Lord > Reviewed-by: Stefan Hajnoczi > --- > Makefile | 7 +++ > scripts/modules/module_block.py | 108 ++++++++++++++++++++++++++++++++= ++++++++ > 2 files changed, 115 insertions(+) > create mode 100644 scripts/modules/module_block.py >=20 [...] > diff --git a/scripts/modules/module_block.py b/scripts/modules/module_b= lock.py > new file mode 100644 > index 0000000..db4fb54 > --- /dev/null > +++ b/scripts/modules/module_block.py > @@ -0,0 +1,108 @@ > +#!/usr/bin/python > +# > +# Module information generator > +# > +# Copyright Red Hat, Inc. 2015 - 2016 > +# > +# Authors: > +# Marc Mari > +# > +# This work is licensed under the terms of the GNU GPL, version 2. > +# See the COPYING file in the top-level directory. > + > +from __future__ import print_function > +import sys > +import os > + > +def get_string_struct(line): > + data =3D line.split() > + > + # data[0] -> struct element name > + # data[1] -> =3D > + # data[2] -> value > + > + return data[2].replace('"', '')[:-1] > + > +def add_module(fheader, library, format_name, protocol_name): > + lines =3D [] > + lines.append('.library_name =3D "' + library + '",') > + if format_name !=3D "": > + lines.append('.format_name =3D "' + format_name + '",') Hm, why did you reintroduce some of the format driver handling? Max > + if protocol_name !=3D "": > + lines.append('.protocol_name =3D "' + protocol_name + '",') > + > + text =3D '\n '.join(lines) > + fheader.write('\n {\n ' + text + '\n },') --cMTFiwscqECRvVpP2CRiGX7MqCudRR5PK 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 iQEvBAEBCAAZBQJXq3LdEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRA7sUIC6DisrZaf B/9x5tqVXJ/KBPX8+S8lD0Wk0OQqWeYpNU8OX6+IlauT7S9LWKuemE0TGqOib/Px dYiY0rN4/FrmEoHjk0tQLvwH+yTniBL/8amJhj804MTYfHBgxsBKUd7gthHuUdsm SmeUk82gtaHhn4JHSo2vGontbKqBdGFLh2L7wouPmkgIJrGYwlWNkipNauxS80BK yFXrrS14L01k6tk/YoOtFKTgW9y2uYrg/hCLWNwXCP4oJ4llTX2jEEFMLXerfrtL AOhikH8Wpzl3/S8x2doe5sm8V9PxBwJ59hKDHvS0AAJE5bAmJo55yFAXd6j8Dkd3 vEHMLeMvlHY00ac5aD6d9MjE =wVRo -----END PGP SIGNATURE----- --cMTFiwscqECRvVpP2CRiGX7MqCudRR5PK--