r24265: Add the tdb_hashsize:<tdbname> parameter
authorVolker Lendecke <vlendec@samba.org>
Tue, 7 Aug 2007 11:21:48 +0000 (11:21 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:29:21 +0000 (12:29 -0500)
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

source/lib/util_tdb.c

index 471a8c7da9c074a00284e18b7fd0b7b78201c1f9..28a31995c18791530dfac7a22e633fc459bfa2cc 100644 (file)
@@ -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) {