X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-20-growhash.c;h=890bcd27818aeed610856f94c5603ce43ed07958;hp=6bcfd7d3baee007dbb29633068ef0c6010160113;hb=8a47d50d72ea62e378dc92b150c92c1317c73fa3;hpb=6804501c350181dea8f531142b28c620b70edbd9 diff --git a/ccan/tdb2/test/run-20-growhash.c b/ccan/tdb2/test/run-20-growhash.c index 6bcfd7d3..890bcd27 100644 --- a/ccan/tdb2/test/run-20-growhash.c +++ b/ccan/tdb2/test/run-20-growhash.c @@ -1,15 +1,10 @@ -#include -#include -#include -#include -#include -#include +#include "tdb2-source.h" #include #include "logging.h" static uint64_t myhash(const void *key, size_t len, uint64_t seed, void *priv) { - return *(uint64_t *)key; + return *(const uint64_t *)key; } static void add_bits(uint64_t *val, unsigned new, unsigned new_bits, @@ -47,7 +42,7 @@ int main(int argc, char *argv[]) struct tdb_data key = { (unsigned char *)&kdata, sizeof(kdata) }; struct tdb_data dbuf = { (unsigned char *)&kdata, sizeof(kdata) }; union tdb_attribute hattr = { .hash = { .base = { TDB_ATTRIBUTE_HASH }, - .hash_fn = myhash } }; + .fn = myhash } }; int flags[] = { TDB_INTERNAL, TDB_DEFAULT, TDB_NOMMAP, TDB_INTERNAL|TDB_CONVERT, TDB_CONVERT, TDB_NOMMAP|TDB_CONVERT, @@ -76,7 +71,7 @@ int main(int argc, char *argv[]) /* Check first still exists. */ kdata = make_key(0, 0, 0, 0, 0, 0); - ok1(find_and_lock(tdb, key, F_RDLCK, &h, &rec) != 0); + ok1(find_and_lock(tdb, key, F_RDLCK, &h, &rec, NULL) != 0); /* Should have created correct hash. */ ok1(h.h == tdb_hash(tdb, key.dptr, key.dsize)); /* Should have located space in group 0, bucket 0. */ @@ -98,7 +93,7 @@ int main(int argc, char *argv[]) ok1(tdb_store(tdb, key, dbuf, TDB_INSERT) == 0); ok1(tdb_check(tdb, NULL, NULL) == 0); - ok1(find_and_lock(tdb, key, F_RDLCK, &h, &rec) != 0); + ok1(find_and_lock(tdb, key, F_RDLCK, &h, &rec, NULL)); /* Should have created correct hash. */ ok1(h.h == tdb_hash(tdb, key.dptr, key.dsize)); /* Should have moved to subhash */ @@ -122,7 +117,7 @@ int main(int argc, char *argv[]) ok1(tdb_store(tdb, key, dbuf, TDB_INSERT) == 0); ok1(tdb_check(tdb, NULL, NULL) == 0); - ok1(find_and_lock(tdb, key, F_RDLCK, &h, &rec) != 0); + ok1(find_and_lock(tdb, key, F_RDLCK, &h, &rec, NULL)); /* Should have created correct hash. */ ok1(h.h == tdb_hash(tdb, key.dptr, key.dsize)); /* Should have moved to subhash */