From d3fee429aee87e9c05a4a606fbf0b60b16dac782 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 3 Jul 2006 06:40:56 +0000 Subject: r16774: This patch modifies the tdb API to allow the logging function to be used as part of ldb. This allows tdb failures to be passed all the way up to Samba's DEBUG system, which allowed easier debugging. Unfortunately I had to extend the tdb API, as the logging function didn't have a context pointer. I've worked over the 'debug levels' in TDB. Most of them were 0, which didn't seem right, as some were trace-like messages. We didn't see any of these previously, except when accessing TDB directly. Andrew Bartlett (This used to be commit 58898092c1ce043f6d698db5065f372b79109e22) --- source4/lib/tdb/tools/tdbtool.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'source4/lib/tdb/tools/tdbtool.c') diff --git a/source4/lib/tdb/tools/tdbtool.c b/source4/lib/tdb/tools/tdbtool.c index 0941a73118..5aa47bd9f5 100644 --- a/source4/lib/tdb/tools/tdbtool.c +++ b/source4/lib/tdb/tools/tdbtool.c @@ -79,9 +79,9 @@ static void print_asc(unsigned char *buf,int len) } #ifdef PRINTF_ATTRIBUTE -static void tdb_log(struct tdb_context *t, int level, const char *format, ...) PRINTF_ATTRIBUTE(3,4); +static void tdb_log(struct tdb_context *t, enum tdb_debug_level level, const char *format, ...) PRINTF_ATTRIBUTE(3,4); #endif -static void tdb_log(struct tdb_context *t, int level, const char *format, ...) +static void tdb_log(struct tdb_context *t, enum tdb_debug_level level, const char *format, ...) { va_list ap; @@ -190,7 +190,7 @@ static void create_tdb(void) } if (tdb) tdb_close(tdb); tdb = tdb_open_ex(tok, 0, TDB_CLEAR_IF_FIRST, - O_RDWR | O_CREAT | O_TRUNC, 0600, tdb_log, NULL); + O_RDWR | O_CREAT | O_TRUNC, 0600, tdb_log, NULL, NULL); if (!tdb) { printf("Could not create %s: %s\n", tok, strerror(errno)); } @@ -204,7 +204,7 @@ static void open_tdb(void) return; } if (tdb) tdb_close(tdb); - tdb = tdb_open_ex(tok, 0, 0, O_RDWR, 0600, tdb_log, NULL); + tdb = tdb_open_ex(tok, 0, 0, O_RDWR, 0600, tdb_log, NULL, NULL); if (!tdb) { printf("Could not open %s: %s\n", tok, strerror(errno)); } @@ -340,7 +340,7 @@ static void move_rec(void) print_rec(tdb, key, dbuf, NULL); - dst_tdb = tdb_open_ex(file, 0, 0, O_RDWR, 0600, tdb_log, NULL); + dst_tdb = tdb_open_ex(file, 0, 0, O_RDWR, 0600, tdb_log, NULL, NULL); if ( !dst_tdb ) { terror("unable to open destination tdb"); return; -- cgit