summaryrefslogtreecommitdiff
path: root/script/generate_param.py
diff options
context:
space:
mode:
authorGarming Sam <garming@catalyst.net.nz>2014-01-24 15:38:59 +1300
committerAndrew Bartlett <abartlet@samba.org>2014-02-20 10:11:13 +1300
commit9780113846760dd1cafd11e4091aad28f82639d4 (patch)
tree9d3797a43b4cf607834f5b8e0ef8881bbeb71afc /script/generate_param.py
parent12aa85a90c5f06e1d585918d8e44ebc45137f89e (diff)
downloadsamba-9780113846760dd1cafd11e4091aad28f82639d4.tar.gz
param: use loadparm_globals struct instead of lp function pointers in s3_helpers
Signed-off-by: Garming Sam <garming@catalyst.net.nz> Change-Id: I4507cdbf111b7f9dca3ca18ee2bf242ffdfeb4e7 Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
Diffstat (limited to 'script/generate_param.py')
-rw-r--r--script/generate_param.py37
1 files changed, 3 insertions, 34 deletions
diff --git a/script/generate_param.py b/script/generate_param.py
index 7df097ec3ed..97ef470c325 100644
--- a/script/generate_param.py
+++ b/script/generate_param.py
@@ -278,27 +278,8 @@ def make_s3_param(path_in, path_out):
file_out.write("\tbool (*set_cmdline)(const char *pszParmName, const char *pszParmValue);\n")
file_out.write("\tvoid (*dump)(FILE *f, bool show_defaults, int maxtoprint);\n")
file_out.write("\tconst char * (*dnsdomain)(void);\n")
-
- for parameter in iterate_all(path_in):
- # filter out parameteric options
- if ':' in parameter['name']:
- continue
- if parameter['context'] != 'G':
- continue
- output_string = "\t"
- if parameter['constant'] or parameter['type'] == 'string':
- output_string += 'const '
- param_type = mapping.get(parameter['type'])
- if param_type is None:
- raise Exception(parameter['name'] + " has an invalid context " + parameter['context'])
- output_string += param_type
-
- if parameter['type'] == 'string' and not parameter['constant']:
- output_string += " (*%s)(TALLOC_CTX *);\n" % parameter['function']
- else:
- output_string += " (*%s)(void);\n" % parameter['function']
- file_out.write(output_string)
-
+ file_out.write("\tchar * (*lp_string)(TALLOC_CTX *ctx, const char *in);\n")
+ file_out.write("\tstruct loadparm_global *globals;\n")
file_out.write("};\n")
file_out.write("\n#endif /* %s */\n\n" % header)
finally:
@@ -308,7 +289,7 @@ def make_s3_param_ctx_table(path_in, path_out):
file_out = open(path_out, 'w')
try:
file_out.write('/* This file was automatically generated by generate_param.py. DO NOT EDIT */\n\n')
- file_out.write("static const struct loadparm_s3_helpers s3_fns =\n")
+ file_out.write("static struct loadparm_s3_helpers s3_fns =\n")
file_out.write("{\n")
file_out.write("\t.get_parametric = lp_parm_const_string_service,\n")
file_out.write("\t.get_parm_struct = lp_get_parameter,\n")
@@ -321,18 +302,6 @@ def make_s3_param_ctx_table(path_in, path_out):
file_out.write("\t.set_cmdline = lp_set_cmdline,\n")
file_out.write("\t.dump = lp_dump,\n")
file_out.write("\t.dnsdomain = lp_dnsdomain,\n")
- header = get_header(path_out)
-
- for parameter in iterate_all(path_in):
- # filter out parameteric options
- if ':' in parameter['name']:
- continue
- if parameter['context'] != 'G':
- continue
- output_string = "\t.%s" % parameter['function']
- output_string += " = lp_%s,\n" % parameter['function']
- file_out.write(output_string)
-
file_out.write("};")
finally:
file_out.close()