1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-03 12:58:35 +03:00

lib/param: generate the param_functions.h containing the prototypes

Pair-programmed-with: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
This commit is contained in:
Garming Sam 2014-01-15 17:18:13 +13:00 committed by Andrew Bartlett
parent 526cf3c119
commit cc6a77835b
4 changed files with 12 additions and 45 deletions

View File

@ -49,6 +49,7 @@ struct gensec_settings;
#ifdef CONFIG_H_IS_FROM_SAMBA
#include "lib/param/param_proto.h"
#include "lib/param/param_functions.h"
#endif
const char **lpcfg_interfaces(struct loadparm_context *);
@ -61,7 +62,7 @@ int lpcfg_allow_dns_updates(struct loadparm_context *);
void reload_charcnv(struct loadparm_context *lp_ctx);
struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx);
bool lpcfg_autoloaded(struct loadparm_service *, struct loadparm_service *);
char *lpcfg_tls_keyfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
char *lpcfg_tls_certfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
@ -69,6 +70,8 @@ char *lpcfg_tls_cafile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
char *lpcfg_tls_dhpfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
char *lpcfg_tls_crlfile(TALLOC_CTX *mem_ctx, struct loadparm_context *);
const char *lpcfg_dnsdomain(struct loadparm_context *);
const char *lpcfg_servicename(const struct loadparm_service *service);

View File

@ -6,6 +6,12 @@ bld.SAMBA_GENERATOR('param_functions.c',
group='build_source',
rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT} --mode=FUNCTIONS')
bld.SAMBA_GENERATOR('param_functions.h',
source= '../../script/generate_param.py ../../docs-xml/smbdotconf/parameters.all.xml',
target='param_functions.h',
group='build_source',
rule='${PYTHON} ${SRC[0].abspath(env)} --file ${SRC[1].abspath(env)} --output ${TGT} --mode=LIBPROTO')
bld.SAMBA_GENERATOR('param_local_h',
source= '../../script/mkparamdefs.pl loadparm.c param_functions.c ',
target='param_local.h',
@ -38,8 +44,7 @@ bld.SAMBA_LIBRARY('samba-hostconfig',
deps='DYNCONFIG server-role',
public_deps='samba-util param_local_h',
public_headers='param.h',
autoproto='param_proto.h',
autoproto_extra_source='param_functions.c'
autoproto='param_proto.h'
)

View File

@ -124,45 +124,6 @@ sub print_footer($$)
$file->("\n#endif /* $header_name */\n\n");
}
sub handle_loadparm($$)
{
my ($file,$line) = @_;
my $scope;
my $type;
my $name;
my $var;
if ($line =~ /^FN_(GLOBAL|LOCAL)_(CONST_STRING|STRING|BOOL|bool|CHAR|INTEGER|LIST)\((\w+),(.*)\)/o) {
$scope = $1;
$type = $2;
$name = $3;
$var = $4;
} elsif ($line =~ /^FN_(GLOBAL|LOCAL)_PARM_(CONST_STRING|STRING|BOOL|bool|CHAR|INTEGER|LIST)\((\w+),(.*)\)/o) {
$scope = $1;
$type = $2;
$name = $3;
$var = $4;
} else {
return;
}
my %tmap = (
"BOOL" => "bool ",
"CONST_STRING" => "const char *",
"STRING" => "const char *",
"INTEGER" => "int ",
"CHAR" => "char ",
"LIST" => "const char **",
);
my %smap = (
"GLOBAL" => "struct loadparm_context *",
"LOCAL" => "struct loadparm_service *, struct loadparm_service *"
);
$file->("$tmap{$type}lpcfg_$name($smap{$scope});\n");
}
sub process_file($$$)
{
my ($public_file, $private_file, $filename) = @_;
@ -203,8 +164,6 @@ sub process_file($$$)
next if ($line =~ /^\/|[;]/);
if ($line =~ /^FN_/) {
handle_loadparm($public_file, $line);
handle_loadparm($private_file, $line);
next;
}

View File

@ -20,7 +20,7 @@ bld.env.build_public_headers = 'include/public'
# these are includes which appear in public headers, but with #ifdef conditional
# compilation, so they are safe
bld.env.public_headers_skip = ['lib/param/param_proto.h']
bld.env.public_headers_skip = ['lib/param/param_proto.h', 'lib/param/param_functions.h']
samba_version.load_version(bld.env, is_install=bld.is_install)
bld.SAMBA_MKVERSION('version.h')