Received: from eggs.gnu.org ([2001:4830:134:3::10]:36303) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKq1J-0004K8-2u for qemu-devel@nongnu.org; Wed, 06 Jul 2016 12:49:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKq1I-0007qs-6c for qemu-devel@nongnu.org; Wed, 06 Jul 2016 12:49:53 -0400 References: <1467732272-23368-1-git-send-email-clord@redhat.com> <1467732272-23368-3-git-send-email-clord@redhat.com> From: Colin Lord Message-ID: <5ad3bca1-e03a-b3fc-bc14-2eb636a923e6@redhat.com> Date: Wed, 6 Jul 2016 12:49:45 -0400 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 02/32] blockdev: Add dynamic generation of module_block.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org, Marc Mari On 07/06/2016 09:17 AM, Max Reitz wrote: > On 05.07.2016 17:24, Colin Lord wrote: >> From: Marc Mari >> >> To simplify the addition of new block modules, add a script that gener= ates >> module_block.h automatically from the modules' source code. >> >> This script assumes that the QEMU coding style rules are followed. >=20 > But the script itself doesn't follow it. :-P > ("ERROR: code indent should never use tabs", to quote checkpatch.pl) >=20 I guess that is the case. >> >> Signed-off-by: Marc Mar=C3=AD >> Signed-off-by: Colin Lord >> --- >> Makefile | 7 +++ >> scripts/modules/module_block.py | 122 +++++++++++++++++++++++++++++++= +++++++++ >> 2 files changed, 129 insertions(+) >> create mode 100644 scripts/modules/module_block.py >> >=20 > [...] >=20 >> diff --git a/scripts/modules/module_block.py b/scripts/modules/module_= block.py >> new file mode 100644 >> index 0000000..4075574 >> --- /dev/null >> +++ b/scripts/modules/module_block.py >> @@ -0,0 +1,122 @@ >=20 > [...] >=20 >> +def add_module(fheader, library, format_name, protocol_name, >> + probe, probe_device): >> + lines =3D [] >> + lines.append('.library_name =3D "' + library + '",') >> + if format_name !=3D "": >> + lines.append('.format_name =3D "' + format_name + '",') >> + if protocol_name !=3D "": >> + lines.append('.protocol_name =3D "' + protocol_name + '",') >> + if probe: >> + lines.append('.has_probe =3D true,') >> + if probe_device: >> + lines.append('.has_probe_device =3D true,') >> + >> + text =3D '\n\t'.join(lines) >> + fheader.write('\n\t{\n\t' + text + '\n\t},') >=20 > I think our normal coding style would be met with: >=20 > text =3D '\n '.join(lines) > fheader.write('\n {\n ' + text + '\n },') >=20 > Rest looks good, so with that fixed (or maybe we don't need to fix it > because it's just a generated header, I don't know): >=20 Shouldn't be too big a deal to fix. > Reviewed-by: Max Reitz >=20