qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v7 2/4] blockdev: Add dynamic generation of modu


From: Max Reitz
Subject: Re: [Qemu-devel] [PATCH v7 2/4] blockdev: Add dynamic generation of module_block.h
Date: Wed, 10 Aug 2016 20:30:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0

On 08.08.2016 20:07, 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.
> 
> Signed-off-by: Marc MarĂ­ <address@hidden>
> Signed-off-by: Colin Lord <address@hidden>
> Reviewed-by: Stefan Hajnoczi <address@hidden>
> ---
>  Makefile                        |   7 +++
>  scripts/modules/module_block.py | 108 
> ++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 115 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..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 <address@hidden>
> +#
> +# 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 = line.split()
> +
> +    # data[0] -> struct element name
> +    # data[1] -> =
> +    # data[2] -> value
> +
> +    return data[2].replace('"', '')[:-1]
> +
> +def add_module(fheader, library, format_name, protocol_name):
> +    lines = []
> +    lines.append('.library_name = "' + library + '",')
> +    if format_name != "":
> +        lines.append('.format_name = "' + format_name + '",')

Hm, why did you reintroduce some of the format driver handling?

Max

> +    if protocol_name != "":
> +        lines.append('.protocol_name = "' + protocol_name + '",')
> +
> +    text = '\n        '.join(lines)
> +    fheader.write('\n    {\n        ' + text + '\n    },')

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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