diff options
Diffstat (limited to 'lib/tdb_compat/tdb_compat.h')
-rw-r--r-- | lib/tdb_compat/tdb_compat.h | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/lib/tdb_compat/tdb_compat.h b/lib/tdb_compat/tdb_compat.h index e0a2bf8e5e..98bccf4137 100644 --- a/lib/tdb_compat/tdb_compat.h +++ b/lib/tdb_compat/tdb_compat.h @@ -27,90 +27,6 @@ #include "replace.h" #include <ccan/typesafe_cb/typesafe_cb.h> -#if BUILD_TDB2 -#include <tdb2.h> -#include <fcntl.h> -#include <unistd.h> - -extern TDB_DATA tdb_null; - -/* Old-style tdb_fetch. */ -static inline TDB_DATA tdb_fetch_compat(struct tdb_context *tdb, TDB_DATA k) -{ - TDB_DATA dbuf; - if (tdb_fetch(tdb, k, &dbuf) != TDB_SUCCESS) { - return tdb_null; - } - return dbuf; -} - -static inline TDB_DATA tdb_firstkey_compat(struct tdb_context *tdb) -{ - TDB_DATA k; - if (tdb_firstkey(tdb, &k) != TDB_SUCCESS) { - return tdb_null; - } - return k; -} - -/* Note: this frees the old key.dptr. */ -static inline TDB_DATA tdb_nextkey_compat(struct tdb_context *tdb, TDB_DATA k) -{ - if (tdb_nextkey(tdb, &k) != TDB_SUCCESS) { - return tdb_null; - } - return k; -} - -#define tdb_traverse_read(tdb, fn, p) \ - tdb_traverse_read_(tdb, typesafe_cb_preargs(int, void *, (fn), (p), \ - struct tdb_context *, \ - TDB_DATA, TDB_DATA), (p)) -int64_t tdb_traverse_read_(struct tdb_context *tdb, - int (*fn)(struct tdb_context *, - TDB_DATA, TDB_DATA, void *), void *p); - -/* Old-style tdb_errorstr */ -#define tdb_errorstr_compat(tdb) tdb_errorstr(tdb_error(tdb)) - -/* This typedef doesn't exist in TDB2. */ -typedef struct tdb_context TDB_CONTEXT; - -/* We only need these for the CLEAR_IF_FIRST lock. */ -int tdb_reopen(struct tdb_context *tdb); -int tdb_reopen_all(int parent_longlived); - -/* These no longer exist in tdb2. */ -#define TDB_CLEAR_IF_FIRST 1048576 -#define TDB_INCOMPATIBLE_HASH 2097152 -#define TDB_VOLATILE 4194304 - -/* tdb2 does nonblocking functions via attibutes. */ -enum TDB_ERROR tdb_transaction_start_nonblock(struct tdb_context *tdb); -enum TDB_ERROR tdb_chainlock_nonblock(struct tdb_context *tdb, TDB_DATA key); - - -/* Convenient (typesafe) wrapper for tdb open with logging */ -#define tdb_open_compat(name, hsize, tdb_fl, open_fl, mode, log_fn, log_data) \ - tdb_open_compat_((name), (hsize), (tdb_fl), (open_fl), (mode), \ - typesafe_cb_preargs(void, void *, \ - (log_fn), (log_data), \ - struct tdb_context *, \ - enum tdb_log_level, \ - enum TDB_ERROR, \ - const char *), \ - (log_data)) - -struct tdb_context * -tdb_open_compat_(const char *name, int hash_size, - int tdb_flags, int open_flags, mode_t mode, - void (*log_fn)(struct tdb_context *, - enum tdb_log_level, - enum TDB_ERROR ecode, - const char *message, - void *data), - void *log_data); -#else #include <tdb.h> /* FIXME: Inlining this is a bit lazy, but eases S3 build. */ @@ -140,6 +56,5 @@ static inline TDB_DATA tdb_nextkey_compat(struct tdb_context *tdb, TDB_DATA k) } #define tdb_errorstr_compat(tdb) tdb_errorstr(tdb) #define tdb_fetch_compat tdb_fetch -#endif #endif /* TDB_COMPAT_H */ |