summaryrefslogtreecommitdiff
path: root/lib/tdb_compat
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-21 12:57:59 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-21 12:57:59 +0930
commitf08b323a88658c3e52adce4fa346bc03274e2c36 (patch)
tree473cac958b59d537408476d477211cb18dbf29ba /lib/tdb_compat
parent10e6a3282098b3d4d94e72fa27f47825ef4e7f15 (diff)
downloadsamba-f08b323a88658c3e52adce4fa346bc03274e2c36.tar.gz
samba-f08b323a88658c3e52adce4fa346bc03274e2c36.tar.bz2
samba-f08b323a88658c3e52adce4fa346bc03274e2c36.zip
tdb_compat: honour hashsize arg when using tdb2 with TDB_VERSION1 flag.
We use the TDB_ATTRIBUTE_TDB1_HASHSIZE to set the hash size. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/tdb_compat')
-rw-r--r--lib/tdb_compat/tdb_compat.c11
-rw-r--r--lib/tdb_compat/tdb_compat.h2
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/tdb_compat/tdb_compat.c b/lib/tdb_compat/tdb_compat.c
index f311b4bfba..d5d8f09c64 100644
--- a/lib/tdb_compat/tdb_compat.c
+++ b/lib/tdb_compat/tdb_compat.c
@@ -85,7 +85,7 @@ static enum TDB_ERROR clear_if_first(int fd, void *unused)
}
struct tdb_context *
-tdb_open_compat_(const char *name, int hash_size_unused,
+tdb_open_compat_(const char *name, int hash_size,
int tdb_flags, int open_flags, mode_t mode,
void (*log_fn)(struct tdb_context *,
enum tdb_log_level,
@@ -94,7 +94,7 @@ tdb_open_compat_(const char *name, int hash_size_unused,
void *data),
void *log_data)
{
- union tdb_attribute cif, log, hash, max_dead, *attr = NULL;
+ union tdb_attribute cif, log, hash, max_dead, hsize, *attr = NULL;
if (log_fn) {
log.log.base.attr = TDB_ATTRIBUTE_LOG;
@@ -132,6 +132,13 @@ tdb_open_compat_(const char *name, int hash_size_unused,
tdb_flags &= ~TDB_VOLATILE;
}
+ if (hash_size && (tdb_flags & TDB_VERSION1)) {
+ hsize.base.attr = TDB_ATTRIBUTE_TDB1_HASHSIZE;
+ hsize.base.next = attr;
+ hsize.tdb1_hashsize.hsize = hash_size;
+ attr = &hsize;
+ }
+
/* Testsuite uses this to speed things up. */
if (getenv("TDB_NO_FSYNC")) {
tdb_flags |= TDB_NOSYNC;
diff --git a/lib/tdb_compat/tdb_compat.h b/lib/tdb_compat/tdb_compat.h
index cc120bbcb6..0d58075c80 100644
--- a/lib/tdb_compat/tdb_compat.h
+++ b/lib/tdb_compat/tdb_compat.h
@@ -100,7 +100,7 @@ enum TDB_ERROR tdb_transaction_start_nonblock(struct tdb_context *tdb);
(log_data))
struct tdb_context *
-tdb_open_compat_(const char *name, int hash_size_unused,
+tdb_open_compat_(const char *name, int hash_size,
int tdb_flags, int open_flags, mode_t mode,
void (*log_fn)(struct tdb_context *,
enum tdb_log_level,