qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-block] [PATCH v3 02/32] blockdev: Add dynamic generation of mo


From: Max Reitz
Subject: Re: [Qemu-block] [PATCH v3 02/32] blockdev: Add dynamic generation of module_block.h
Date: Wed, 6 Jul 2016 15:17:38 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 05.07.2016 17:24, Colin Lord wrote:
> From: Marc Mari <address@hidden>
> 
> To simplify the addition of new block modules, add a script that generates
> module_block.h automatically from the modules' source code.
> 
> This script assumes that the QEMU coding style rules are followed.

But the script itself doesn't follow it. :-P
("ERROR: code indent should never use tabs", to quote checkpatch.pl)

> 
> Signed-off-by: Marc MarĂ­ <address@hidden>
> Signed-off-by: Colin Lord <address@hidden>
> ---
>  Makefile                        |   7 +++
>  scripts/modules/module_block.py | 122 
> ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 129 insertions(+)
>  create mode 100644 scripts/modules/module_block.py
> 

[...]

> 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 @@

[...]

> +def add_module(fheader, library, format_name, protocol_name,
> +                probe, probe_device):
> +    lines = []
> +    lines.append('.library_name = "' + library + '",')
> +    if format_name != "":
> +        lines.append('.format_name = "' + format_name + '",')
> +    if protocol_name != "":
> +        lines.append('.protocol_name = "' + protocol_name + '",')
> +    if probe:
> +        lines.append('.has_probe = true,')
> +    if probe_device:
> +        lines.append('.has_probe_device = true,')
> +
> +    text = '\n\t'.join(lines)
> +    fheader.write('\n\t{\n\t' + text + '\n\t},')

I think our normal coding style would be met with:

text = '\n        '.join(lines)
fheader.write('\n    {\n        ' + text + '\n    },')

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):

Reviewed-by: Max Reitz <address@hidden>

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]