summaryrefslogtreecommitdiff
path: root/lib/tdb2/tdb1_tdb.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:41:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:41:13 +0930
commitf7e84f8ef86c3323f70e2fa30fd8a49cab1febf9 (patch)
tree580a9c1302b332602263b7f1192ea5ee61d43521 /lib/tdb2/tdb1_tdb.c
parentb4a5c6dcb6c60a32b92772396dadfffa6b721732 (diff)
downloadsamba-f7e84f8ef86c3323f70e2fa30fd8a49cab1febf9.tar.gz
samba-f7e84f8ef86c3323f70e2fa30fd8a49cab1febf9.tar.bz2
samba-f7e84f8ef86c3323f70e2fa30fd8a49cab1febf9.zip
tdb2: Make TDB1 use the same tdb_hash() wrapper as TDB2
This means converting the tdb1 inbuilt hash functions to the tdb2-style, so they return 64 bit. We truncate to 32 bit everywhere but in tdb_check() which needs to do so explicitly. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 3e46dde21261966941469a6c75e1b45cd2d26324)
Diffstat (limited to 'lib/tdb2/tdb1_tdb.c')
-rw-r--r--lib/tdb2/tdb1_tdb.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/tdb2/tdb1_tdb.c b/lib/tdb2/tdb1_tdb.c
index c69c61d0c0..8392e71240 100644
--- a/lib/tdb2/tdb1_tdb.c
+++ b/lib/tdb2/tdb1_tdb.c
@@ -189,7 +189,7 @@ static TDB_DATA _tdb1_fetch(struct tdb1_context *tdb, TDB_DATA key)
uint32_t hash;
/* find which hash bucket it is in */
- hash = tdb->hash_fn(&key);
+ hash = tdb_hash(tdb, key.dptr, key.dsize);
if (!(rec_ptr = tdb1_find_lock_hash(tdb,key,hash,F_RDLCK,&rec)))
return tdb1_null;
@@ -236,7 +236,7 @@ int tdb1_parse_record(struct tdb1_context *tdb, TDB_DATA key,
uint32_t hash;
/* find which hash bucket it is in */
- hash = tdb->hash_fn(&key);
+ hash = tdb_hash(tdb, key.dptr, key.dsize);
if (!(rec_ptr = tdb1_find_lock_hash(tdb,key,hash,F_RDLCK,&rec))) {
/* record not found */
@@ -270,7 +270,7 @@ static int tdb1_exists_hash(struct tdb1_context *tdb, TDB_DATA key, uint32_t has
int tdb1_exists(struct tdb1_context *tdb, TDB_DATA key)
{
- uint32_t hash = tdb->hash_fn(&key);
+ uint32_t hash = tdb_hash(tdb, key.dptr, key.dsize);
int ret;
ret = tdb1_exists_hash(tdb, key, hash);
@@ -429,7 +429,7 @@ static int tdb1_delete_hash(struct tdb1_context *tdb, TDB_DATA key, uint32_t has
int tdb1_delete(struct tdb1_context *tdb, TDB_DATA key)
{
- uint32_t hash = tdb->hash_fn(&key);
+ uint32_t hash = tdb_hash(tdb, key.dptr, key.dsize);
int ret;
ret = tdb1_delete_hash(tdb, key, hash);
@@ -607,7 +607,7 @@ int tdb1_store(struct tdb1_context *tdb, TDB_DATA key, TDB_DATA dbuf, int flag)
}
/* find which hash bucket it is in */
- hash = tdb->hash_fn(&key);
+ hash = tdb_hash(tdb, key.dptr, key.dsize);
if (tdb1_lock(tdb, TDB1_BUCKET(hash), F_WRLCK) == -1)
return -1;
@@ -624,7 +624,7 @@ int tdb1_append(struct tdb1_context *tdb, TDB_DATA key, TDB_DATA new_dbuf)
int ret = -1;
/* find which hash bucket it is in */
- hash = tdb->hash_fn(&key);
+ hash = tdb_hash(tdb, key.dptr, key.dsize);
if (tdb1_lock(tdb, TDB1_BUCKET(hash), F_WRLCK) == -1)
return -1;