From f7e84f8ef86c3323f70e2fa30fd8a49cab1febf9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 14 Sep 2011 07:41:13 +0930 Subject: 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 (Imported from CCAN commit 3e46dde21261966941469a6c75e1b45cd2d26324) --- lib/tdb2/test/run-tdb1-incompatible.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'lib/tdb2/test/run-tdb1-incompatible.c') diff --git a/lib/tdb2/test/run-tdb1-incompatible.c b/lib/tdb2/test/run-tdb1-incompatible.c index a2754461e2..58e1fba1fa 100644 --- a/lib/tdb2/test/run-tdb1-incompatible.c +++ b/lib/tdb2/test/run-tdb1-incompatible.c @@ -3,9 +3,10 @@ #include #include -static unsigned int tdb1_dumb_hash(TDB_DATA *key) +static uint64_t tdb1_dumb_hash(const void *key, size_t len, uint64_t seed, + void *unused) { - return key->dsize; + return len; } static void log_fn(struct tdb1_context *tdb, enum tdb_log_level level, @@ -31,14 +32,16 @@ static unsigned int hdr_rwlocks(const char *fname) return hdr.rwlocks; } -static unsigned int jenkins_hashfn(TDB_DATA *key) +static uint64_t jenkins_hashfn(const void *key, size_t len, uint64_t seed, + void *unused) { - return hashlittle(key->dptr, key->dsize); + return hashlittle(key, len); } -static unsigned int old_hash(TDB_DATA *key) +static uint64_t old_hash(const void *key, size_t len, uint64_t seed, + void *unused) { - return tdb1_old_hash(key); + return tdb1_old_hash(key, len, seed, unused); } int main(int argc, char *argv[]) -- cgit