]> 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 ff749aac7ad144e3ed306017a9fa92fcd94feb7f..db391e7e59c4b391358366633eb7f6f76e533db0 100644 (file)
@@ -1,25 +1,19 @@
-#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"
 
 static bool empty_freetable(struct tdb_context *tdb)
 {
-       struct tdb_freetable free;
+       struct tdb_freetable ftab;
        unsigned int i;
 
        /* Now, free table should be completely exhausted in zone 0 */
-       if (tdb_read_convert(tdb, tdb->ftable_off, &free, sizeof(free)) != 0)
+       if (tdb_read_convert(tdb, tdb->tdb2.ftable_off, &ftab, sizeof(ftab)) != 0)
                abort();
 
-       for (i = 0; i < sizeof(free.buckets)/sizeof(free.buckets[0]); i++) {
-               if (free.buckets[i])
+       for (i = 0; i < sizeof(ftab.buckets)/sizeof(ftab.buckets[0]); i++) {
+               if (ftab.buckets[i])
                        return false;
        }
        return true;
@@ -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);