X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-tdb1-nested-transactions.c;h=79b9b5683beb4718f0d0fa6db67376b263616b09;hp=e9640990e02945bddf952cabf3b431b8db0f912e;hb=49475d68deecd0b31597ed6094229171d2699b11;hpb=919937354a331bb964564a11b5a5b80403ff8db9 diff --git a/ccan/tdb2/test/run-tdb1-nested-transactions.c b/ccan/tdb2/test/run-tdb1-nested-transactions.c index e9640990..79b9b568 100644 --- a/ccan/tdb2/test/run-tdb1-nested-transactions.c +++ b/ccan/tdb2/test/run-tdb1-nested-transactions.c @@ -3,26 +3,32 @@ #include #include #include -#include "tdb1-logging.h" +#include "logging.h" int main(int argc, char *argv[]) { - struct tdb1_context *tdb; - TDB1_DATA key, data; + struct tdb_context *tdb; + TDB_DATA key, data; + union tdb_attribute hsize; + + hsize.base.attr = TDB_ATTRIBUTE_TDB1_HASHSIZE; + hsize.base.next = &tap_log_attr; + hsize.tdb1_hashsize.hsize = 1024; plan_tests(27); key.dsize = strlen("hi"); key.dptr = (void *)"hi"; - tdb = tdb1_open_ex("run-nested-transactions.tdb", - 1024, TDB1_CLEAR_IF_FIRST|TDB1_DISALLOW_NESTING, - O_CREAT|O_TRUNC|O_RDWR, 0600, &taplogctx, NULL); + tdb = tdb1_open("run-nested-transactions.tdb", + TDB_DEFAULT, + O_CREAT|O_TRUNC|O_RDWR, 0600, &hsize); ok1(tdb); + /* No nesting by default. */ ok1(tdb1_transaction_start(tdb) == 0); data.dptr = (void *)"world"; data.dsize = strlen("world"); - ok1(tdb1_store(tdb, key, data, TDB1_INSERT) == 0); + ok1(tdb1_store(tdb, key, data, TDB_INSERT) == 0); data = tdb1_fetch(tdb, key); ok1(data.dsize == strlen("world")); ok1(memcmp(data.dptr, "world", strlen("world")) == 0); @@ -41,9 +47,8 @@ int main(int argc, char *argv[]) free(data.dptr); tdb1_close(tdb); - /* Allow nesting by default. */ - tdb = tdb1_open_ex("run-nested-transactions.tdb", - 1024, TDB1_DEFAULT, O_RDWR, 0, &taplogctx, NULL); + tdb = tdb1_open("run-nested-transactions.tdb", + TDB_ALLOW_NESTING, O_RDWR, 0, &tap_log_attr); ok1(tdb); ok1(tdb1_transaction_start(tdb) == 0);