From 01c934c81e55b79601122d8e0740c7946077c37e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 12 Oct 2011 23:01:08 +1100 Subject: lib/util: Add back control of mmap and hash size in tdb for top level build This passes down a struct loadparm_context to allow these parameters to be checked. This may be s3 or s4 context, allowing the #if _SAMBA_BUILD_ macro to go away safely. Andrew Bartlett --- source3/lib/dbwrap/dbwrap_tdb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source3/lib/dbwrap') diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c index 4330c961ec..e9e4900068 100644 --- a/source3/lib/dbwrap/dbwrap_tdb.c +++ b/source3/lib/dbwrap/dbwrap_tdb.c @@ -22,6 +22,7 @@ #include "dbwrap/dbwrap_private.h" #include "dbwrap/dbwrap_tdb.h" #include "lib/util/tdb_wrap.h" +#include "lib/param/param.h" struct db_tdb_ctx { struct tdb_wrap *wtdb; @@ -359,12 +360,14 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, { struct db_context *result = NULL; struct db_tdb_ctx *db_tdb; - + struct loadparm_context *lp_ctx; + result = talloc_zero(mem_ctx, struct db_context); if (result == NULL) { DEBUG(0, ("talloc failed\n")); goto fail; } + lp_ctx = loadparm_init_s3(result, loadparm_s3_context()); result->private_data = db_tdb = talloc(result, struct db_tdb_ctx); if (db_tdb == NULL) { @@ -373,7 +376,8 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, } db_tdb->wtdb = tdb_wrap_open(db_tdb, name, hash_size, tdb_flags, - open_flags, mode); + open_flags, mode, lp_ctx); + talloc_unlink(result, lp_ctx); if (db_tdb->wtdb == NULL) { DEBUG(3, ("Could not open tdb: %s\n", strerror(errno))); goto fail; -- cgit