]> git.ozlabs.org Git - ccan/blobdiff - ccan/tdb2/test/layout.c
tdb2: traverse and chainlock support.
[ccan] / ccan / tdb2 / test / layout.c
index f0a2b897e38032b17b8d00b3efe2cfdded708ebd..87718d31cba4db878550b3d1ecee230800cc79d1 100644 (file)
@@ -3,6 +3,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
+#include "logging.h"
 
 struct tdb_layout *new_tdb_layout(void)
 {
@@ -152,13 +153,6 @@ static void add_to_freetable(struct tdb_context *tdb,
        add_free_record(tdb, eoff, sizeof(struct tdb_used_record) + elen);
 }
 
-static tdb_off_t hash_off(struct tdb_context *tdb, uint64_t list)
-{
-       return tdb->header.v.hash_off
-               + ((list & ((1ULL << tdb->header.v.hash_bits) - 1))
-                  * sizeof(tdb_off_t));
-}
-
 static void add_to_hashtable(struct tdb_context *tdb,
                             tdb_off_t eoff,
                             struct tdb_data key)
@@ -208,7 +202,7 @@ struct tdb_context *tdb_layout_get(struct tdb_layout *layout)
 
        mem = malloc(len);
        /* Now populate our header, cribbing from a real TDB header. */
-       tdb = tdb_open(NULL, TDB_INTERNAL, O_RDWR, 0, NULL);
+       tdb = tdb_open(NULL, TDB_INTERNAL, O_RDWR, 0, &tap_log_attr);
        hdr = (void *)mem;
        *hdr = tdb->header;
        hdr->v.generation++;