scripts: Allow block module to not define BlockDriver
Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1473043845-13197-2-git-send-email-famz@redhat.com Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
This commit is contained in:
parent
2d76e724cf
commit
159975f38b
|
@ -37,7 +37,6 @@ def add_module(fheader, library, format_name, protocol_name):
|
||||||
def process_file(fheader, filename):
|
def process_file(fheader, filename):
|
||||||
# This parser assumes the coding style rules are being followed
|
# This parser assumes the coding style rules are being followed
|
||||||
with open(filename, "r") as cfile:
|
with open(filename, "r") as cfile:
|
||||||
found_something = False
|
|
||||||
found_start = False
|
found_start = False
|
||||||
library, _ = os.path.splitext(os.path.basename(filename))
|
library, _ = os.path.splitext(os.path.basename(filename))
|
||||||
for line in cfile:
|
for line in cfile:
|
||||||
|
@ -51,16 +50,10 @@ def process_file(fheader, filename):
|
||||||
add_module(fheader, library, format_name, protocol_name)
|
add_module(fheader, library, format_name, protocol_name)
|
||||||
found_start = False
|
found_start = False
|
||||||
elif line.find("static BlockDriver") != -1:
|
elif line.find("static BlockDriver") != -1:
|
||||||
found_something = True
|
|
||||||
found_start = True
|
found_start = True
|
||||||
format_name = ""
|
format_name = ""
|
||||||
protocol_name = ""
|
protocol_name = ""
|
||||||
|
|
||||||
if not found_something:
|
|
||||||
print("No BlockDriver struct found in " + filename + ". \
|
|
||||||
Is this really a module?", file=sys.stderr)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
def print_top(fheader):
|
def print_top(fheader):
|
||||||
fheader.write('''/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
|
fheader.write('''/* AUTOMATICALLY GENERATED, DO NOT MODIFY */
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue