#include "config.h"
#include <ccan/tdb2/tdb2.h>
#include <ccan/likely/likely.h>
+#include <ccan/compiler/compiler.h>
#ifdef HAVE_BYTESWAP_H
#include <byteswap.h>
#endif
#define TDB_VERSION ((uint64_t)(0x26011967 + 7))
#define TDB_MAGIC ((uint64_t)0x1999)
#define TDB_FREE_MAGIC ((uint64_t)0xFE)
-#define TDB_COALESCING_MAGIC ((uint64_t)0xFD)
#define TDB_HASH_MAGIC (0xA1ABE11A01092008ULL)
#define TDB_RECOVERY_MAGIC (0xf53bc0e7ad124589ULL)
#define TDB_RECOVERY_INVALID_MAGIC (0x0ULL)
#define TDB_MIN_DATA_LEN \
(sizeof(struct tdb_free_record) - sizeof(struct tdb_used_record))
+/* Indicates this entry is not on an flist (can happen during coalescing) */
+#define TDB_FLIST_NONE ((1ULL << TDB_OFF_UPPER_STEAL) - 1)
+
#if !HAVE_BSWAP_64
static inline uint64_t bswap_64(uint64_t x)
{
uint32_t flags;
/* Logging function */
- tdb_logfn_t log;
- void *log_priv;
+ tdb_logfn_t logfn;
+ void *log_private;
/* Hash function. */
tdb_hashfn_t khash;
/* Lock information */
struct tdb_lock_type allrecord_lock;
- uint64_t num_lockrecs;
+ size_t num_lockrecs;
struct tdb_lock_type *lockrecs;
struct tdb_attribute_stats *stats;
int tdb_transaction_recover(struct tdb_context *tdb);
bool tdb_needs_recovery(struct tdb_context *tdb);
+/* tdb.c: */
+void COLD tdb_logerr(struct tdb_context *tdb,
+ enum TDB_ERROR ecode,
+ enum tdb_debug_level level,
+ const char *fmt, ...);
+
#ifdef TDB_TRACE
void tdb_trace(struct tdb_context *tdb, const char *op);
void tdb_trace_seqnum(struct tdb_context *tdb, uint32_t seqnum, const char *op);