X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-tdb1-nested-transactions.c;h=be4e926946c7e3a8a2fc5f913d94c97a521a32e6;hb=97224cbbe29e76522ec38d031c54b1cadce8ae03;hp=2518003c634d06b464bba28d98ac82818e2aec84;hpb=fab544c24c1ad6523f95893abcaec4e6cce6c2b4;p=ccan diff --git a/ccan/tdb2/test/run-tdb1-nested-transactions.c b/ccan/tdb2/test/run-tdb1-nested-transactions.c index 2518003c..be4e9269 100644 --- a/ccan/tdb2/test/run-tdb1-nested-transactions.c +++ b/ccan/tdb2/test/run-tdb1-nested-transactions.c @@ -7,28 +7,29 @@ int main(int argc, char *argv[]) { - struct tdb1_context *tdb; - TDB1_DATA key, data; + struct tdb_context *tdb; + TDB_DATA key, data; 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, + 1024, TDB_DEFAULT, O_CREAT|O_TRUNC|O_RDWR, 0600, &taplogctx, NULL); 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); free(data.dptr); ok1(tdb1_transaction_start(tdb) != 0); - ok1(tdb1_error(tdb) == TDB1_ERR_NESTING); + ok1(tdb_error(tdb) == TDB_ERR_EINVAL); data = tdb1_fetch(tdb, key); ok1(data.dsize == strlen("world")); @@ -41,9 +42,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); + 1024, TDB_ALLOW_NESTING, O_RDWR, 0, &taplogctx, NULL); ok1(tdb); ok1(tdb1_transaction_start(tdb) == 0);