#include <ccan/tdb2/tdb.c>
+#include <ccan/tdb2/open.c>
#include <ccan/tdb2/free.c>
#include <ccan/tdb2/lock.c>
#include <ccan/tdb2/io.c>
/* We rig the hash so adjacent-numbered records always clash. */
static uint64_t clash(const void *key, size_t len, uint64_t seed, void *priv)
{
- return ((uint64_t)*(unsigned int *)key)
+ return ((uint64_t)*(const unsigned int *)key)
<< (64 - TDB_TOPLEVEL_HASH_BITS - 1);
}
ok1(h.hlock_start == 0);
ok1(h.hlock_range ==
1ULL << (64-(TDB_TOPLEVEL_HASH_BITS-TDB_HASH_GROUP_BITS)));
- ok1((tdb->flags & TDB_NOLOCK) || tdb->num_lockrecs == 1);
+ ok1((tdb->flags & TDB_NOLOCK) || tdb->file->num_lockrecs == 1);
ok1((tdb->flags & TDB_NOLOCK)
- || tdb->lockrecs[0].off == TDB_HASH_LOCK_START);
+ || tdb->file->lockrecs[0].off == TDB_HASH_LOCK_START);
/* FIXME: Check lock length */
/* Allocate a new record. */
ok1(h.hlock_start == 0);
ok1(h.hlock_range ==
1ULL << (64-(TDB_TOPLEVEL_HASH_BITS-TDB_HASH_GROUP_BITS)));
- ok1((tdb->flags & TDB_NOLOCK) || tdb->num_lockrecs == 1);
+ ok1((tdb->flags & TDB_NOLOCK) || tdb->file->num_lockrecs == 1);
ok1((tdb->flags & TDB_NOLOCK)
- || tdb->lockrecs[0].off == TDB_HASH_LOCK_START);
+ || tdb->file->lockrecs[0].off == TDB_HASH_LOCK_START);
/* FIXME: Check lock length */
ok1(tdb_unlock_hashes(tdb, h.hlock_start, h.hlock_range,
ok1(h.hlock_start == 0);
ok1(h.hlock_range ==
1ULL << (64-(TDB_TOPLEVEL_HASH_BITS-TDB_HASH_GROUP_BITS)));
- ok1((tdb->flags & TDB_NOLOCK) || tdb->num_lockrecs == 1);
+ ok1((tdb->flags & TDB_NOLOCK) || tdb->file->num_lockrecs == 1);
ok1((tdb->flags & TDB_NOLOCK)
- || tdb->lockrecs[0].off == TDB_HASH_LOCK_START);
+ || tdb->file->lockrecs[0].off == TDB_HASH_LOCK_START);
/* FIXME: Check lock length */
/* Make it expand 0'th bucket. */
ok1(h.hlock_start == 0);
ok1(h.hlock_range ==
1ULL << (64-(TDB_TOPLEVEL_HASH_BITS-TDB_HASH_GROUP_BITS)));
- ok1((tdb->flags & TDB_NOLOCK) || tdb->num_lockrecs == 1);
+ ok1((tdb->flags & TDB_NOLOCK) || tdb->file->num_lockrecs == 1);
ok1((tdb->flags & TDB_NOLOCK)
- || tdb->lockrecs[0].off == TDB_HASH_LOCK_START);
+ || tdb->file->lockrecs[0].off == TDB_HASH_LOCK_START);
/* FIXME: Check lock length */
/* Simple delete should work. */
ok1(h.hlock_start == 0);
ok1(h.hlock_range ==
1ULL << (64-(TDB_TOPLEVEL_HASH_BITS-TDB_HASH_GROUP_BITS)));
- ok1((tdb->flags & TDB_NOLOCK) || tdb->num_lockrecs == 1);
+ ok1((tdb->flags & TDB_NOLOCK) || tdb->file->num_lockrecs == 1);
ok1((tdb->flags & TDB_NOLOCK)
- || tdb->lockrecs[0].off == TDB_HASH_LOCK_START);
+ || tdb->file->lockrecs[0].off == TDB_HASH_LOCK_START);
/* FIXME: Check lock length */
ok1(expand_group(tdb, &h) == 0);