From 6e16e29d532d7542c210fd725bf61df1e7a97795 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 14 Sep 2011 07:47:13 +0930 Subject: 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 (Imported from CCAN commit 49475d68deecd0b31597ed6094229171d2699b11) --- lib/tdb2/tdb1_tdb.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/tdb2/tdb1_tdb.c') 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"); -- cgit