X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=ccan%2Ftdb2%2Ftest%2Frun-30-exhaust-before-expand.c;h=db391e7e59c4b391358366633eb7f6f76e533db0;hp=ff749aac7ad144e3ed306017a9fa92fcd94feb7f;hb=bbeb528e74c0e234e1f724ac8d54be404cfc6f9a;hpb=51a56b52627e635566253a3fae081c3f466b6bb6 diff --git a/ccan/tdb2/test/run-30-exhaust-before-expand.c b/ccan/tdb2/test/run-30-exhaust-before-expand.c index ff749aac..db391e7e 100644 --- a/ccan/tdb2/test/run-30-exhaust-before-expand.c +++ b/ccan/tdb2/test/run-30-exhaust-before-expand.c @@ -1,25 +1,19 @@ -#include -#include -#include -#include -#include -#include -#include +#include "tdb2-source.h" #include #include #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);