diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:47:13 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-09-14 07:47:13 +0930 |
commit | 6e16e29d532d7542c210fd725bf61df1e7a97795 (patch) | |
tree | 463f4867fe4ff441d924672b564f508632e57c02 /lib/tdb2/tdb1_tdb.c | |
parent | f8dbfad23c9cab9d52b366d56e8491666a90f714 (diff) | |
download | samba-6e16e29d532d7542c210fd725bf61df1e7a97795.tar.gz samba-6e16e29d532d7542c210fd725bf61df1e7a97795.tar.bz2 samba-6e16e29d532d7542c210fd725bf61df1e7a97795.zip |
tdb2: add TDB_ATTRIBUTE_TDB1_HASHSIZE
This replaces the tdb1_open "hash_size" argument. It will only be
valid when you call tdb_open() with O_CREAT in open_flags, and
TDB_VERSION1 in tdb_flags.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
(Imported from CCAN commit 49475d68deecd0b31597ed6094229171d2699b11)
Diffstat (limited to 'lib/tdb2/tdb1_tdb.c')
-rw-r--r-- | lib/tdb2/tdb1_tdb.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/tdb2/tdb1_tdb.c b/lib/tdb2/tdb1_tdb.c index e9696000b8..bb007722b3 100644 --- a/lib/tdb2/tdb1_tdb.c +++ b/lib/tdb2/tdb1_tdb.c @@ -681,11 +681,6 @@ int tdb1_get_seqnum(struct tdb_context *tdb) return seqnum; } -int tdb1_hash_size(struct tdb_context *tdb) -{ - return tdb->tdb1.header.hash_size; -} - /* add a region of the file to the freelist. Length is the size of the region in bytes, @@ -836,6 +831,11 @@ int tdb1_repack(struct tdb_context *tdb) { struct tdb_context *tmp_db; struct traverse_state state; + union tdb_attribute hsize; + + hsize.base.attr = TDB_ATTRIBUTE_TDB1_HASHSIZE; + hsize.base.next = NULL; + hsize.tdb1_hashsize.hsize = tdb->tdb1.header.hash_size; if (tdb1_transaction_start(tdb) != 0) { tdb_logerr(tdb, tdb->last_error, TDB_LOG_ERROR, @@ -843,7 +843,7 @@ int tdb1_repack(struct tdb_context *tdb) return -1; } - tmp_db = tdb1_open("tmpdb", tdb1_hash_size(tdb), TDB_INTERNAL, O_RDWR|O_CREAT, 0, NULL); + tmp_db = tdb1_open("tmpdb", TDB_INTERNAL, O_RDWR|O_CREAT, 0, &hsize); if (tmp_db == NULL) { tdb->last_error = tdb_logerr(tdb, TDB_ERR_OOM, TDB_LOG_ERROR, __location__ " Failed to create tmp_db"); |