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/smbd/notify_internal.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c index 4f2749e17d..484a31c5be 100644 --- a/source3/smbd/notify_internal.c +++ b/source3/smbd/notify_internal.c @@ -32,6 +32,7 @@ #include "messages.h" #include "lib/util/tdb_wrap.h" #include "util_tdb.h" +#include "lib/param/param.h" struct notify_context { struct db_context *db_recursive; @@ -137,11 +138,17 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server, bool notify_internal_parent_init(TALLOC_CTX *mem_ctx) { struct tdb_wrap *db1, *db2; + struct loadparm_context *lp_ctx; if (lp_clustering()) { return true; } + lp_ctx = loadparm_init_s3(mem_ctx, loadparm_s3_context()); + if (lp_ctx == NULL) { + DEBUG(0, ("loadparm_init_s3 failed\n")); + return false; + } /* * Open the tdbs in the parent process (smbd) so that our * CLEAR_IF_FIRST optimization in tdb_reopen_all can properly @@ -150,13 +157,15 @@ bool notify_internal_parent_init(TALLOC_CTX *mem_ctx) db1 = tdb_wrap_open(mem_ctx, lock_path("notify.tdb"), 0, TDB_SEQNUM|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, - O_RDWR|O_CREAT, 0644); + O_RDWR|O_CREAT, 0644, lp_ctx); if (db1 == NULL) { + talloc_unlink(mem_ctx, lp_ctx); DEBUG(1, ("could not open notify.tdb: %s\n", strerror(errno))); return false; } db2 = tdb_wrap_open(mem_ctx, lock_path("notify_onelevel.tdb"), - 0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDWR|O_CREAT, 0644); + 0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, O_RDWR|O_CREAT, 0644, lp_ctx); + talloc_unlink(mem_ctx, lp_ctx); if (db2 == NULL) { DEBUG(1, ("could not open notify_onelevel.tdb: %s\n", strerror(errno))); -- cgit