From 8c154674c69d61c433c9bbd30bf1099f50c56f59 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 7 Aug 2007 11:21:48 +0000 Subject: r24265: Add the tdb_hashsize: parameter This makes it possible to set the default hashsize for any tdb. I would like to remove the "open files database hash size" in favor of this one. I'll check that removal in with the next commit, please complain/revert if it's not ok. Volker (This used to be commit e9bd7a63a8d462b1fc3bab99ff843e25bffd156b) --- source3/lib/util_tdb.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c index 471a8c7da9..28a31995c1 100644 --- a/source3/lib/util_tdb.c +++ b/source3/lib/util_tdb.c @@ -696,6 +696,17 @@ TDB_CONTEXT *tdb_open_log(const char *name, int hash_size, int tdb_flags, log_ctx.log_fn = tdb_log; log_ctx.log_private = NULL; + if (hash_size == 0) { + const char *base = strrchr_m(name, '/'); + if (base != NULL) { + base += 1; + } + else { + base = name; + } + hash_size = lp_parm_int(-1, "tdb_hashsize", base, 0); + } + tdb = tdb_open_ex(name, hash_size, tdb_flags, open_flags, mode, &log_ctx, NULL); if (!tdb) @@ -929,6 +940,17 @@ struct tdb_wrap *tdb_wrap_open(TALLOC_CTX *mem_ctx, return NULL; } + if (hash_size == 0) { + const char *base = strrchr_m(name, '/'); + if (base != NULL) { + base += 1; + } + else { + base = name; + } + hash_size = lp_parm_int(-1, "tdb_hashsize", base, 0); + } + w->tdb = tdb_open_ex(name, hash_size, tdb_flags, open_flags, mode, &log_ctx, NULL); if (w->tdb == NULL) { -- cgit