summaryrefslogtreecommitdiff
path: root/lib/tdb2/tdb1.h
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:32:13 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-09-14 07:32:13 +0930
commite613effeae7c9373c9e635fc708ec2ce29661d4c (patch)
treed8cdb019f54302de6aa813a62a34e036cf9c7faf /lib/tdb2/tdb1.h
parent50484d4bede6b59706457e44a32cbe2d3e9c28d2 (diff)
downloadsamba-e613effeae7c9373c9e635fc708ec2ce29661d4c.tar.gz
samba-e613effeae7c9373c9e635fc708ec2ce29661d4c.tar.bz2
samba-e613effeae7c9373c9e635fc708ec2ce29661d4c.zip
tdb2: make TDB1 code use tdb2's TDB_ERROR and tdb_logerr()
To do this, we make sure that the first few fields of tdb1_context and tdb_context are the same. This sweep also fixes up a few paths where we weren't setting tdb->ecode before our old logging function. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> (Imported from CCAN commit 919937354a331bb964564a11b5a5b80403ff8db9)
Diffstat (limited to 'lib/tdb2/tdb1.h')
-rw-r--r--lib/tdb2/tdb1.h27
1 files changed, 2 insertions, 25 deletions
diff --git a/lib/tdb2/tdb1.h b/lib/tdb2/tdb1.h
index 8ce5fa9d07..8b3130ad2a 100644
--- a/lib/tdb2/tdb1.h
+++ b/lib/tdb2/tdb1.h
@@ -55,39 +55,18 @@
#define TDB1_DISALLOW_NESTING 1024 /** Disallow transactions to nest */
#define TDB1_INCOMPATIBLE_HASH 2048 /** Better hashing: can't be opened by tdb < 1.2.6. */
-/** The tdb error codes */
-enum TDB1_ERROR {TDB1_SUCCESS=0, TDB1_ERR_CORRUPT, TDB1_ERR_IO, TDB1_ERR_LOCK,
- TDB1_ERR_OOM, TDB1_ERR_EXISTS, TDB1_ERR_NOLOCK, TDB1_ERR_LOCK_TIMEOUT,
- TDB1_ERR_NOEXIST, TDB1_ERR_EINVAL, TDB1_ERR_RDONLY,
- TDB1_ERR_NESTING};
-
-/** Debugging uses one of the following levels */
-enum tdb1_debug_level {TDB1_DEBUG_FATAL = 0, TDB1_DEBUG_ERROR,
- TDB1_DEBUG_WARNING, TDB1_DEBUG_TRACE};
-
/** The tdb data structure */
typedef struct TDB1_DATA {
unsigned char *dptr;
size_t dsize;
} TDB1_DATA;
-#ifndef PRINTF_ATTRIBUTE
-#if (__GNUC__ >= 3)
-/** Use gcc attribute to check printf fns. a1 is the 1-based index of
- * the parameter containing the format, and a2 the index of the first
- * argument. Note that some gcc 2.x versions don't handle this
- * properly **/
-#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format (__printf__, a1, a2)))
-#else
-#define PRINTF_ATTRIBUTE(a1, a2)
-#endif
-#endif
-
/** This is the context structure that is returned from a db open. */
typedef struct tdb1_context TDB1_CONTEXT;
typedef int (*tdb1_traverse_func)(struct tdb1_context *, TDB1_DATA, TDB1_DATA, void *);
-typedef void (*tdb1_log_func)(struct tdb1_context *, enum tdb1_debug_level, const char *, ...) PRINTF_ATTRIBUTE(3, 4);
+typedef void (*tdb1_log_func)(struct tdb1_context *, enum tdb_log_level, enum TDB_ERROR,
+ const char *, void *);
typedef unsigned int (*tdb1_hash_func)(TDB1_DATA *key);
struct tdb1_logging_context {
@@ -138,8 +117,6 @@ int tdb1_lockall_read(struct tdb1_context *tdb);
int tdb1_unlockall_read(struct tdb1_context *tdb);
-tdb1_log_func tdb1_log_fn(struct tdb1_context *tdb);
-
int tdb1_transaction_start(struct tdb1_context *tdb);
int tdb1_transaction_prepare_commit(struct tdb1_context *tdb);