summaryrefslogtreecommitdiff
path: root/source3/param
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-29 10:49:35 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-29 05:50:46 +0200
commit21756b7c7d3048ce3396ab63aebc80babf4819e9 (patch)
tree3cc69859540ec12e98748f925ed16e3009192995 /source3/param
parent573109d346b67a9f711187636a2cae3ae7f1cbcf (diff)
downloadsamba-21756b7c7d3048ce3396ab63aebc80babf4819e9.tar.gz
samba-21756b7c7d3048ce3396ab63aebc80babf4819e9.tar.bz2
samba-21756b7c7d3048ce3396ab63aebc80babf4819e9.zip
s3-param Use .offset rather than .ptr when defining parameters
This change has a number of purposes: * It removes the fancy logic around pointers into sDefault for all per-share parameters. Instead, this is always expressed as an offset, rather than implicitly via PTR_DIFF macros. * It makes struct parm_struct almost identical to that as used in source4/param. This will very shortly allow the loadparm tables and most of the 'special' helper functions to be placed in common. Andrew Bartlett Autobuild-User: Andrew Bartlett <abartlet@samba.org> Autobuild-Date: Wed Jun 29 05:50:46 CEST 2011 on sn-devel-104
Diffstat (limited to 'source3/param')
-rw-r--r--source3/param/loadparm.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c
index 7da3de393a..430c2de5ac 100644
--- a/source3/param/loadparm.c
+++ b/source3/param/loadparm.c
@@ -930,9 +930,8 @@ static const struct enum_list enum_kerberos_method[] = {
* name first, and all synonyms must follow it with the FLAG_HIDE attribute.
*/
-#define GLOBAL_VAR(name) &Globals.name
-#define LOCAL_VAR(name) &sDefault.name
-#define offset ptr
+#define GLOBAL_VAR(name) offsetof(struct loadparm_global, name)
+#define LOCAL_VAR(name) offsetof(struct loadparm_service, name)
static struct parm_struct parm_table[] = {
{N_("Base Options"), P_SEP, P_SEPARATOR},
@@ -7755,12 +7754,12 @@ void *lp_parm_ptr(struct loadparm_service *service, struct parm_struct *parm)
{
if (service == NULL) {
if (parm->p_class == P_LOCAL)
- return parm->ptr;
+ return (void *)(((char *)&sDefault)+parm->offset);
else if (parm->p_class == P_GLOBAL)
- return parm->ptr;
+ return (void *)(((char *)&Globals)+parm->offset);
else return NULL;
} else {
- return (void *)(((char *)service) + PTR_DIFF(parm->ptr, &sDefault));
+ return (void *)(((char *)service) + parm->offset);
}
}