-#include <ccan/tdb2/tdb.c>
-#include <ccan/tdb2/free.c>
-#include <ccan/tdb2/lock.c>
-#include <ccan/tdb2/io.c>
-#include <ccan/tdb2/hash.c>
-#include <ccan/tdb2/check.c>
-#include <ccan/tdb2/transaction.c>
+#include "tdb2-source.h"
#include <ccan/tap/tap.h>
#include "logging.h"
unsigned char *buffer;
int flags[] = { TDB_DEFAULT, TDB_NOMMAP,
TDB_CONVERT, TDB_NOMMAP|TDB_CONVERT };
- struct tdb_data key = { (unsigned char *)"key", 3 };
+ struct tdb_data key = tdb_mkdata("key", 3);
struct tdb_data data;
buffer = malloc(1000);
/* Cancelling a transaction means no store */
tdb_transaction_cancel(tdb);
- ok1(tdb->allrecord_lock.count == 0 && tdb->num_lockrecs == 0);
+ ok1(tdb->file->allrecord_lock.count == 0
+ && tdb->file->num_lockrecs == 0);
ok1(tdb_check(tdb, NULL, NULL) == 0);
ok1(tdb_fetch(tdb, key, &data) == TDB_ERR_NOEXIST);
ok1(memcmp(data.dptr, buffer, data.dsize) == 0);
free(data.dptr);
ok1(tdb_transaction_commit(tdb) == 0);
- ok1(tdb->allrecord_lock.count == 0 && tdb->num_lockrecs == 0);
+ ok1(tdb->file->allrecord_lock.count == 0
+ && tdb->file->num_lockrecs == 0);
ok1(tdb_check(tdb, NULL, NULL) == 0);
ok1(tdb_fetch(tdb, key, &data) == TDB_SUCCESS);
ok1(data.dsize == 1000);