Author: vlendec
Date: 2007-08-07 11:21:48 +0000 (Tue, 07 Aug 2007)
New Revision: 24265

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24265

Log:
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

Modified:
   branches/SAMBA_3_2/source/lib/util_tdb.c
   branches/SAMBA_3_2_0/source/lib/util_tdb.c


Changeset:
Modified: branches/SAMBA_3_2/source/lib/util_tdb.c
===================================================================
--- branches/SAMBA_3_2/source/lib/util_tdb.c    2007-08-07 11:08:49 UTC (rev 
24264)
+++ branches/SAMBA_3_2/source/lib/util_tdb.c    2007-08-07 11:21:48 UTC (rev 
24265)
@@ -696,6 +696,17 @@
        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 @@
                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) {

Modified: branches/SAMBA_3_2_0/source/lib/util_tdb.c
===================================================================
--- branches/SAMBA_3_2_0/source/lib/util_tdb.c  2007-08-07 11:08:49 UTC (rev 
24264)
+++ branches/SAMBA_3_2_0/source/lib/util_tdb.c  2007-08-07 11:21:48 UTC (rev 
24265)
@@ -696,6 +696,17 @@
        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 @@
                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) {

Reply via email to