summaryrefslogtreecommitdiff
path: root/source3/lib/util_tdb.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2007-08-07 11:21:48 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:29:21 -0500
commit8c154674c69d61c433c9bbd30bf1099f50c56f59 (patch)
treeae384c5f6083bdc10956d23183df55952e9ac781 /source3/lib/util_tdb.c
parentd18b7b1223a3f9f7584e6d0913fa588a2bc5a1f3 (diff)
downloadsamba-8c154674c69d61c433c9bbd30bf1099f50c56f59.tar.gz
samba-8c154674c69d61c433c9bbd30bf1099f50c56f59.tar.bz2
samba-8c154674c69d61c433c9bbd30bf1099f50c56f59.zip
r24265: Add the tdb_hashsize:<tdbname> 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)
Diffstat (limited to 'source3/lib/util_tdb.c')
-rw-r--r--source3/lib/util_tdb.c22
1 files changed, 22 insertions, 0 deletions
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) {