summaryrefslogtreecommitdiff
path: root/source4/param
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-07-07 21:35:51 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-07-08 11:23:23 +0200
commit61b937d23695ef8820a969f769732ecf79662597 (patch)
tree05673281bc5291a7ac0d0bfe8fea7cf180717cc8 /source4/param
parent27e169e17efd7150cc9479face9989586a65c70f (diff)
downloadsamba-61b937d23695ef8820a969f769732ecf79662597.tar.gz
samba-61b937d23695ef8820a969f769732ecf79662597.tar.bz2
samba-61b937d23695ef8820a969f769732ecf79662597.zip
s4-param change to struct bitmap to match s3-param
Diffstat (limited to 'source4/param')
-rw-r--r--source4/param/loadparm.c31
-rw-r--r--source4/param/wscript_build2
2 files changed, 17 insertions, 16 deletions
diff --git a/source4/param/loadparm.c b/source4/param/loadparm.c
index 41fee6fde9..47ee05bcd2 100644
--- a/source4/param/loadparm.c
+++ b/source4/param/loadparm.c
@@ -69,6 +69,7 @@
#include "lib/socket/socket.h"
#include "auth/gensec/gensec.h"
#include "s3_param.h"
+#include "../lib/util/bitmap.h"
#define standard_sub_basic talloc_strdup
@@ -96,7 +97,7 @@ static bool defaults_saved = false;
int bAvailable; \
int iMaxPrintJobs; \
char *volume; \
- int *copymap; \
+ struct bitmap *copymap; \
char dummy[3]; /* for alignment */
#include "param_global.h"
@@ -1569,7 +1570,7 @@ static struct loadparm_service *getservicebyname(struct loadparm_context *lp_ctx
const char *pszServiceName);
static void copy_service(struct loadparm_service *pserviceDest,
struct loadparm_service *pserviceSource,
- int *pcopymapDest);
+ struct bitmap *pcopymapDest);
static bool service_ok(struct loadparm_service *service);
static bool do_section(const char *pszSectionName, void *);
static void init_copymap(struct loadparm_service *pservice);
@@ -2097,7 +2098,7 @@ static struct loadparm_service *getservicebyname(struct loadparm_context *lp_ctx
static void copy_service(struct loadparm_service *pserviceDest,
struct loadparm_service *pserviceSource,
- int *pcopymapDest)
+ struct bitmap *pcopymapDest)
{
int i;
bool bcopyall = (pcopymapDest == NULL);
@@ -2106,7 +2107,7 @@ static void copy_service(struct loadparm_service *pserviceDest,
for (i = 0; parm_table[i].label; i++)
if (parm_table[i].offset != -1 && parm_table[i].p_class == P_LOCAL &&
- (bcopyall || pcopymapDest[i])) {
+ (bcopyall || bitmap_query(pcopymapDest, i))) {
void *src_ptr =
((char *)pserviceSource) + parm_table[i].offset;
void *dest_ptr =
@@ -2146,9 +2147,8 @@ static void copy_service(struct loadparm_service *pserviceDest,
if (bcopyall) {
init_copymap(pserviceDest);
if (pserviceSource->copymap)
- memcpy((void *)pserviceDest->copymap,
- (void *)pserviceSource->copymap,
- sizeof(int) * NUMPARAMETERS);
+ bitmap_copy(pserviceDest->copymap,
+ pserviceSource->copymap);
}
data = pserviceSource->param_opt;
@@ -2388,16 +2388,17 @@ static bool handle_logfile(struct loadparm_context *lp_ctx, int unused,
static void init_copymap(struct loadparm_service *pservice)
{
int i;
- talloc_free(pservice->copymap);
- pservice->copymap = talloc_array(pservice, int, NUMPARAMETERS);
- if (pservice->copymap == NULL) {
+
+ TALLOC_FREE(pservice->copymap);
+
+ pservice->copymap = bitmap_talloc(NULL, NUMPARAMETERS);
+ if (!pservice->copymap)
DEBUG(0,
("Couldn't allocate copymap!! (size %d)\n",
(int)NUMPARAMETERS));
- return;
- }
- for (i = 0; i < NUMPARAMETERS; i++)
- pservice->copymap[i] = true;
+ else
+ for (i = 0; i < NUMPARAMETERS; i++)
+ bitmap_set(pservice->copymap, i);
}
/**
@@ -2671,7 +2672,7 @@ bool lpcfg_do_service_parameter(struct loadparm_context *lp_ctx,
for (i = 0; parm_table[i].label; i++)
if (parm_table[i].offset == parm_table[parmnum].offset &&
parm_table[i].p_class == parm_table[parmnum].p_class)
- service->copymap[i] = false;
+ bitmap_clear(service->copymap, i);
return set_variable(service, parmnum, parm_ptr, pszParmName,
pszParmValue, lp_ctx, false);
diff --git a/source4/param/wscript_build b/source4/param/wscript_build
index 7f45402017..8cd9955737 100644
--- a/source4/param/wscript_build
+++ b/source4/param/wscript_build
@@ -20,7 +20,7 @@ bld.SAMBA_LIBRARY('samba-hostconfig',
pc_files='samba-hostconfig.pc',
vnum='0.0.1',
deps='DYNCONFIG',
- public_deps='samba-util',
+ public_deps='samba-util bitmap',
public_headers='param.h',
autoproto='param_proto.h',
)