]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/test/run-30-exhaust-before-expand.c
tdb2: merge tdb1_context into tdb_context.
[ccan] / ccan / tdb2 / test / run-30-exhaust-before-expand.c
index f887b8b4cee27c7a143732ede894e7d90aa55580..db391e7e59c4b391358366633eb7f6f76e533db0 100644 (file)
@@ -1,10 +1,4 @@
-#include <ccan/tdb2/tdb.c>
-#include <ccan/tdb2/free.c>
-#include <ccan/tdb2/lock.c>
-#include <ccan/tdb2/io.c>
-#include <ccan/tdb2/check.c>
-#include <ccan/tdb2/hash.c>
-#include <ccan/tdb2/transaction.c>
+#include "tdb2-source.h"
 #include <ccan/tap/tap.h>
 #include <err.h>
 #include "logging.h"
@@ -15,7 +9,7 @@ static bool empty_freetable(struct tdb_context *tdb)
        unsigned int i;
 
        /* Now, free table should be completely exhausted in zone 0 */
-       if (tdb_read_convert(tdb, tdb->ftable_off, &ftab, sizeof(ftab)) != 0)
+       if (tdb_read_convert(tdb, tdb->tdb2.ftable_off, &ftab, sizeof(ftab)) != 0)
                abort();
 
        for (i = 0; i < sizeof(ftab.buckets)/sizeof(ftab.buckets[0]); i++) {
@@ -59,9 +53,9 @@ int main(int argc, char *argv[])
                ok1(tdb_check(tdb, NULL, NULL) == 0);
                ok1(!empty_freetable(tdb));
 
-               size = tdb->map_size;
+               size = tdb->file->map_size;
                /* Insert minimal-length records until we expand. */
-               for (j = 0; tdb->map_size == size; j++) {
+               for (j = 0; tdb->file->map_size == size; j++) {
                        was_empty = empty_freetable(tdb);
                        if (tdb_store(tdb, k, k, TDB_INSERT) != 0)
                                err(1, "Failed to store record %i", j);