1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-03 01:18:10 +03:00

param: remove generated loadparm ctx table file and include it directly

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Change-Id: I5f1d42e3ae6495accf7a711938cc28c03ab2cd62
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Nadezhda Ivanova <nivanova@samba.org>
This commit is contained in:
Garming Sam 2014-01-24 15:52:15 +13:00 committed by Andrew Bartlett
parent 9780113846
commit 0941789063
3 changed files with 16 additions and 34 deletions

View File

@ -35,8 +35,8 @@ parser.add_option("-f", "--file", dest="filename",
help="input file", metavar="FILE") help="input file", metavar="FILE")
parser.add_option("-o", "--output", dest="output", parser.add_option("-o", "--output", dest="output",
help='output file', metavar="FILE") help='output file', metavar="FILE")
parser.add_option("--mode", type="choice", metavar="<FUNCTIONS|S3PROTO|LIBPROTO|PARAMDEFS|S3PARAM|S3TABLE>", parser.add_option("--mode", type="choice", metavar="<FUNCTIONS|S3PROTO|LIBPROTO|PARAMDEFS|S3PARAM>",
choices=["FUNCTIONS", "S3PROTO", "LIBPROTO", "PARAMDEFS", "S3PARAM", "S3TABLE"], default="FUNCTIONS") choices=["FUNCTIONS", "S3PROTO", "LIBPROTO", "PARAMDEFS", "S3PARAM"], default="FUNCTIONS")
parser.add_option("--scope", metavar="<GLOBAL|LOCAL>", parser.add_option("--scope", metavar="<GLOBAL|LOCAL>",
choices = ["GLOBAL", "LOCAL"], default="GLOBAL") choices = ["GLOBAL", "LOCAL"], default="GLOBAL")
@ -285,29 +285,6 @@ def make_s3_param(path_in, path_out):
finally: finally:
file_out.close() file_out.close()
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 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")
file_out.write("\t.get_parm_ptr = lp_parm_ptr,\n")
file_out.write("\t.get_service = lp_service_for_s4_ctx,\n")
file_out.write("\t.get_servicebynum = lp_servicebynum_for_s4_ctx,\n")
file_out.write("\t.get_default_loadparm_service = lp_default_loadparm_service,\n")
file_out.write("\t.get_numservices = lp_numservices,\n")
file_out.write("\t.load = lp_load_for_s4_ctx,\n")
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")
file_out.write("};")
finally:
file_out.close()
if options.mode == 'FUNCTIONS': if options.mode == 'FUNCTIONS':
generate_functions(options.filename, options.output) generate_functions(options.filename, options.output)
elif options.mode == 'S3PROTO': elif options.mode == 'S3PROTO':
@ -318,5 +295,3 @@ elif options.mode == 'PARAMDEFS':
make_param_defs(options.filename, options.output, options.scope) make_param_defs(options.filename, options.output, options.scope)
elif options.mode == 'S3PARAM': elif options.mode == 'S3PARAM':
make_s3_param(options.filename, options.output) make_s3_param(options.filename, options.output)
elif options.mode == 'S3TABLE':
make_s3_param_ctx_table(options.filename, options.output)

View File

@ -56,7 +56,20 @@ static bool lp_load_for_s4_ctx(const char *filename)
return status; return status;
} }
#include "loadparm_ctx_table.c" static struct loadparm_s3_helpers s3_fns =
{
.get_parametric = lp_parm_const_string_service,
.get_parm_struct = lp_get_parameter,
.get_parm_ptr = lp_parm_ptr,
.get_service = lp_service_for_s4_ctx,
.get_servicebynum = lp_servicebynum_for_s4_ctx,
.get_default_loadparm_service = lp_default_loadparm_service,
.get_numservices = lp_numservices,
.load = lp_load_for_s4_ctx,
.set_cmdline = lp_set_cmdline,
.dump = lp_dump,
.dnsdomain = lp_dnsdomain,
};
const struct loadparm_s3_helpers *loadparm_s3_helpers(void) const struct loadparm_s3_helpers *loadparm_s3_helpers(void)
{ {

View File

@ -14,12 +14,6 @@ bld.SAMBA_GENERATOR('s3_param_proto_h',
group='build_source', group='build_source',
rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT} --mode=S3PROTO') rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT} --mode=S3PROTO')
bld.SAMBA_GENERATOR('s3_loadparm_ctx_table_c',
source= '../../script/generate_param.py ../../docs-xml/smbdotconf/parameters.all.xml',
target='loadparm_ctx_table.c',
group='build_source',
rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT} --mode=S3TABLE')
bld.SAMBA3_PYTHON('pys3param', bld.SAMBA3_PYTHON('pys3param',
source='pyparam.c', source='pyparam.c',
deps='param', deps='param',