summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-07-08 09:19:43 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-07-08 12:35:56 +0200
commitcda86869400285afe17db87a9a666fbcc5b918a8 (patch)
treed5e36a1f276729a827c2303bdfad56b8aacff55f /source4
parentcf406f7e7d58b9c993ba1ddc6471fa85e445ba88 (diff)
downloadsamba-cda86869400285afe17db87a9a666fbcc5b918a8.tar.gz
samba-cda86869400285afe17db87a9a666fbcc5b918a8.tar.bz2
samba-cda86869400285afe17db87a9a666fbcc5b918a8.zip
lib/param: Merge struct loadparm_service into common
This is handled by a common header and a .c file that is included into both loadparm.c files. In the process, _lp functions were renamed to lp__ to allow the common function definition declarations to be used by source3 and source4 (which have different macro definitions). The only parameter to change type is 'strict_locking' which was a bool, and is now an int, to accommodate the 'Auto' value from source3. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Fri Jul 8 12:35:56 CEST 2011 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r--source4/param/loadparm.c24
-rw-r--r--source4/param/wscript_build7
-rwxr-xr-xsource4/script/mkproto.pl54
3 files changed, 52 insertions, 33 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 36788290d1..b890ad81a9 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -61,7 +61,6 @@
#include "smb_server/smb_server.h"
#include "libcli/raw/signing.h"
#include "../lib/util/dlinklist.h"
-#include "../lib/util/parmlist.h"
#include "param/param.h"
#include "param/loadparm.h"
#include "libcli/raw/libcliraw.h"
@@ -70,7 +69,6 @@
#include "auth/gensec/gensec.h"
#include "s3_param.h"
#include "../lib/util/bitmap.h"
-#include "../lib/param/param_structs.h"
#define standard_sub_basic talloc_strdup
@@ -1031,7 +1029,7 @@ static struct parm_struct parm_table[] = {
.label = "strict locking",
.type = P_BOOL,
.p_class = P_LOCAL,
- .offset = LOCAL_VAR(bStrictLocking),
+ .offset = LOCAL_VAR(iStrictLocking),
.special = NULL,
.enum_list = NULL
},
@@ -1039,7 +1037,7 @@ static struct parm_struct parm_table[] = {
.label = "oplocks",
.type = P_BOOL,
.p_class = P_LOCAL,
- .offset = LOCAL_VAR(bOplocks),
+ .offset = LOCAL_VAR(bOpLocks),
.special = NULL,
.enum_list = NULL
},
@@ -1420,12 +1418,16 @@ static struct loadparm_context *global_loadparm_context;
return(lp_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault->val))); \
}
+#define FN_LOCAL_CONST_STRING(fn_name,val) FN_LOCAL_STRING(fn_name, val)
+
#define FN_LOCAL_LIST(fn_name,val) \
_PUBLIC_ const char **lpcfg_ ## fn_name(struct loadparm_service *service, \
struct loadparm_service *sDefault) {\
return(const char **)(service != NULL && service->val != NULL? service->val : sDefault->val); \
}
+#define FN_LOCAL_PARM_BOOL(fn_name, val) FN_LOCAL_BOOL(fn_name, val)
+
#define FN_LOCAL_BOOL(fn_name,val) \
_PUBLIC_ bool lpcfg_ ## fn_name(struct loadparm_service *service, \
struct loadparm_service *sDefault) { \
@@ -1438,6 +1440,16 @@ static struct loadparm_context *global_loadparm_context;
return((service != NULL)? service->val : sDefault->val); \
}
+#define FN_LOCAL_PARM_INTEGER(fn_name, val) FN_LOCAL_INTEGER(fn_name, val)
+
+#define FN_LOCAL_PARM_CHAR(fn_name, val) FN_LOCAL_CHAR(fn_name, val)
+
+#define FN_LOCAL_CHAR(fn_name,val) \
+ _PUBLIC_ char lpcfg_ ## fn_name(struct loadparm_service *service, \
+ struct loadparm_service *sDefault) { \
+ return((service != NULL)? service->val : sDefault->val); \
+ }
+
#include "lib/param/param_functions.c"
FN_GLOBAL_INTEGER(server_role, server_role)
@@ -3171,8 +3183,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
lp_ctx->sDefault->bBrowseable = true;
lp_ctx->sDefault->bRead_only = true;
lp_ctx->sDefault->bMap_archive = true;
- lp_ctx->sDefault->bStrictLocking = true;
- lp_ctx->sDefault->bOplocks = true;
+ lp_ctx->sDefault->iStrictLocking = true;
+ lp_ctx->sDefault->bOpLocks = true;
lp_ctx->sDefault->iCreate_mask = 0744;
lp_ctx->sDefault->iCreate_force_mode = 0000;
lp_ctx->sDefault->iDir_mask = 0755;
diff --git a/source4/param/wscript_build b/source4/param/wscript_build
index a56191d089..d5ca60d207 100644
--- a/source4/param/wscript_build
+++ b/source4/param/wscript_build
@@ -5,11 +5,6 @@ bld.SAMBA_GENERATOR('s3_param_h',
target='s3_param.h',
rule='${PERL} ${SRC[1].abspath(env)} ${SRC[0].abspath(env)} --file ${TGT}')
-bld.SAMBA_GENERATOR('param_local_h',
- source= '../../lib/param/param_functions.c ../../script/mkparamdefs.pl',
- target='param_local.h',
- rule='${PERL} ${SRC[1].abspath(env)} ${SRC[0].abspath(env)} --file ${TGT} --generate-scope=LOCAL')
-
bld.SAMBA_GENERATOR('param_global_h',
source= 'loadparm.c ../../script/mkparamdefs.pl',
target='param_global.h',
@@ -20,7 +15,7 @@ bld.SAMBA_LIBRARY('samba-hostconfig',
pc_files='samba-hostconfig.pc',
vnum='0.0.1',
deps='DYNCONFIG',
- public_deps='samba-util bitmap',
+ public_deps='samba-util bitmap param_local_h',
public_headers='param.h',
autoproto='param_proto.h',
autoproto_extra_source='../../lib/param/param_functions.c'
diff --git a/source4/script/mkproto.pl b/source4/script/mkproto.pl
index 4760e63bda..348f150e6d 100755
--- a/source4/script/mkproto.pl
+++ b/source4/script/mkproto.pl
@@ -127,28 +127,40 @@ sub print_footer($$)
sub handle_loadparm($$)
{
my ($file,$line) = @_;
-
- if ($line =~ /^FN_(GLOBAL|LOCAL)_(CONST_STRING|STRING|BOOL|bool|CHAR|INTEGER|LIST)\((\w+),.*\)/o) {
- my $scope = $1;
- my $type = $2;
- my $name = $3;
-
- 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");
+ 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($$$)