X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=ccan%2Ftdb%2Ftdb_private.h;h=4993ff811041e8d4fcdaf375a246a705eb9a0069;hb=e84f843dfeb798e66b32a212bb7ffb095eebd7aa;hp=9942e503da7e4298535b3cf7f87b67d7cffaab94;hpb=2c67a284d11b5b030d8095df7ff2b31275d7d29c;p=ccan diff --git a/ccan/tdb/tdb_private.h b/ccan/tdb/tdb_private.h index 9942e503..4993ff81 100644 --- a/ccan/tdb/tdb_private.h +++ b/ccan/tdb/tdb_private.h @@ -1,3 +1,5 @@ +#ifndef TDB_PRIVATE_H +#define TDB_PRIVATE_H /* Unix SMB/CIFS implementation. @@ -42,10 +44,14 @@ #include #include #include +#include +#include "config.h" #endif #include "tdb.h" -#ifndef HAVE_GETPAGESIZE +/* #define TDB_TRACE 1 */ + +#if HAVE_GETPAGESIZE #define getpagesize() 0x2000 #endif @@ -82,6 +88,18 @@ typedef uint32_t tdb_off_t; * argument. */ #define TDB_LOG(x) tdb->log.log_fn x +#ifdef TDB_TRACE +void tdb_trace(const struct tdb_context *tdb, const char *fmt, ...); +void tdb_trace_record(const struct tdb_context *tdb, TDB_DATA rec); +#else +static inline void tdb_trace(const struct tdb_context *tdb, const char *fmt, ...) +{ +} +static inline void tdb_trace_record(const struct tdb_context *tdb, TDB_DATA rec) +{ +} +#endif /* !TDB_TRACE */ + /* lock offsets */ #define GLOBAL_LOCK 0 #define ACTIVE_LOCK 4 @@ -181,6 +199,7 @@ struct tdb_context { int page_size; int max_dead_records; bool have_transaction_lock; + int tracefd; volatile sig_atomic_t *interrupt_sig_ptr; }; @@ -208,6 +227,7 @@ int tdb_ofs_read(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d); int tdb_ofs_write(struct tdb_context *tdb, tdb_off_t offset, tdb_off_t *d); int tdb_lock_record(struct tdb_context *tdb, tdb_off_t off); int tdb_unlock_record(struct tdb_context *tdb, tdb_off_t off); +int tdb_transaction_cancel_internal(struct tdb_context *tdb); int tdb_rec_read(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec); int tdb_rec_write(struct tdb_context *tdb, tdb_off_t offset, struct list_struct *rec); int tdb_do_delete(struct tdb_context *tdb, tdb_off_t rec_ptr, struct list_struct *rec); @@ -225,3 +245,4 @@ int tdb_rec_free_read(struct tdb_context *tdb, tdb_off_t off, struct list_struct *rec); +#endif