On 08.08.2016 20:07, Colin Lord wrote: > From: Marc Mari <mar...@redhat.com> > > 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Ă <mar...@redhat.com> > Signed-off-by: Colin Lord <cl...@redhat.com> > Reviewed-by: Stefan Hajnoczi <stefa...@redhat.com> > --- > 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 <mar...@redhat.com> > +# > +# 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 },')
signature.asc
Description: OpenPGP digital signature