X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-tdb1-3G-file.c;h=1eab4476712a3a760ab408090b8d726de57c5833;hb=a446f1d4d161d66bbb19ba2551cf6429a4865964;hp=43e9f2ad9bd831f847acfe954ab3e6305315b207;hpb=60210a73ec08a7b34ba637ad19e6749cf6dc1952;p=ccan diff --git a/ccan/tdb2/test/run-tdb1-3G-file.c b/ccan/tdb2/test/run-tdb1-3G-file.c index 43e9f2ad..1eab4476 100644 --- a/ccan/tdb2/test/run-tdb1-3G-file.c +++ b/ccan/tdb2/test/run-tdb1-3G-file.c @@ -4,13 +4,13 @@ #include #include #include -#include "tdb1-logging.h" +#include "logging.h" -static int tdb1_expand_file_sparse(struct tdb1_context *tdb, +static int tdb1_expand_file_sparse(struct tdb_context *tdb, tdb1_off_t size, tdb1_off_t addition) { - if (tdb->read_only || tdb->traverse_read) { + if ((tdb->flags & TDB_RDONLY) || tdb->tdb1.traverse_read) { tdb->last_error = TDB_ERR_RDONLY; return -1; } @@ -46,7 +46,7 @@ static const struct tdb1_methods large_io_methods = { tdb1_expand_file_sparse }; -static int test_traverse(struct tdb1_context *tdb, TDB_DATA key, TDB_DATA data, +static int test_traverse(struct tdb_context *tdb, TDB_DATA key, TDB_DATA data, void *_data) { TDB_DATA *expect = _data; @@ -59,18 +59,18 @@ static int test_traverse(struct tdb1_context *tdb, TDB_DATA key, TDB_DATA data, int main(int argc, char *argv[]) { - struct tdb1_context *tdb; + struct tdb_context *tdb; TDB_DATA key, orig_data, data; uint32_t hash; tdb1_off_t rec_ptr; struct tdb1_record rec; plan_tests(24); - tdb = tdb1_open_ex("run-36-file.tdb", 1024, TDB_DEFAULT, - O_CREAT|O_TRUNC|O_RDWR, 0600, &taplogctx, NULL); + tdb = tdb1_open("run-36-file.tdb", 1024, TDB_DEFAULT, + O_CREAT|O_TRUNC|O_RDWR, 0600, &tap_log_attr); ok1(tdb); - tdb->methods = &large_io_methods; + tdb->tdb1.io = &large_io_methods; /* Enlarge the file (internally multiplies by 2). */ ok1(tdb1_expand(tdb, 1500000000) == 0); @@ -89,7 +89,7 @@ int main(int argc, char *argv[]) free(data.dptr); /* That currently fills at the end, make sure that's true. */ - hash = tdb->hash_fn(&key); + hash = tdb_hash(tdb, key.dptr, key.dsize); rec_ptr = tdb1_find_lock_hash(tdb, key, hash, F_RDLCK, &rec); ok1(rec_ptr); ok1(rec_ptr > 2U*1024*1024*1024);