param: remove generated loadparm ctx table file and include it directly
authorGarming Sam <garming@catalyst.net.nz>
Fri, 24 Jan 2014 02:52:15 +0000 (15:52 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 19 Feb 2014 21:11:17 +0000 (10:11 +1300)
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>
script/generate_param.py
source3/param/loadparm_ctx.c
source3/param/wscript_build

index 97ef470..8bd2e2b 100644 (file)
@@ -35,8 +35,8 @@ parser.add_option("-f", "--file", dest="filename",
                   help="input file", metavar="FILE")
 parser.add_option("-o", "--output", dest="output",
                   help='output file', metavar="FILE")
-parser.add_option("--mode", type="choice", metavar="<FUNCTIONS|S3PROTO|LIBPROTO|PARAMDEFS|S3PARAM|S3TABLE>",
-                 choices=["FUNCTIONS", "S3PROTO", "LIBPROTO", "PARAMDEFS", "S3PARAM", "S3TABLE"], default="FUNCTIONS")
+parser.add_option("--mode", type="choice", metavar="<FUNCTIONS|S3PROTO|LIBPROTO|PARAMDEFS|S3PARAM>",
+                 choices=["FUNCTIONS", "S3PROTO", "LIBPROTO", "PARAMDEFS", "S3PARAM"], default="FUNCTIONS")
 parser.add_option("--scope", metavar="<GLOBAL|LOCAL>",
                   choices = ["GLOBAL", "LOCAL"], default="GLOBAL")
 
@@ -285,29 +285,6 @@ def make_s3_param(path_in, path_out):
     finally:
         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':
     generate_functions(options.filename, options.output)
 elif options.mode == 'S3PROTO':
@@ -318,5 +295,3 @@ elif options.mode == 'PARAMDEFS':
     make_param_defs(options.filename, options.output, options.scope)
 elif options.mode == 'S3PARAM':
     make_s3_param(options.filename, options.output)
-elif options.mode == 'S3TABLE':
-    make_s3_param_ctx_table(options.filename, options.output)
index c85d077..ee999dc 100644 (file)
@@ -56,7 +56,20 @@ static bool lp_load_for_s4_ctx(const char *filename)
        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)
 {
index 34a906e..2b3efa4 100644 (file)
@@ -14,12 +14,6 @@ bld.SAMBA_GENERATOR('s3_param_proto_h',
                     group='build_source',
                     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',
                   source='pyparam.c',
                   deps='param',