summaryrefslogtreecommitdiff
path: root/source4/lib/tdb/tools
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-07-03 06:40:56 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:45 -0500
commitd3fee429aee87e9c05a4a606fbf0b60b16dac782 (patch)
tree792984356cd682124de421c8d9852cfb7ddc8bff /source4/lib/tdb/tools
parentfcce0991c29338a63e3e1e50815eb981a2fa113c (diff)
downloadsamba-d3fee429aee87e9c05a4a606fbf0b60b16dac782.tar.gz
samba-d3fee429aee87e9c05a4a606fbf0b60b16dac782.tar.bz2
samba-d3fee429aee87e9c05a4a606fbf0b60b16dac782.zip
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)
Diffstat (limited to 'source4/lib/tdb/tools')
-rw-r--r--source4/lib/tdb/tools/tdbtool.c10
-rw-r--r--source4/lib/tdb/tools/tdbtorture.c6
2 files changed, 8 insertions, 8 deletions
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;
diff --git a/source4/lib/tdb/tools/tdbtorture.c b/source4/lib/tdb/tools/tdbtorture.c
index ac09898696..559a84d99b 100644
--- a/source4/lib/tdb/tools/tdbtorture.c
+++ b/source4/lib/tdb/tools/tdbtorture.c
@@ -53,9 +53,9 @@ static int in_transaction;
static int error_count;
#ifdef PRINTF_ATTRIBUTE
-static void tdb_log(struct tdb_context *tdb, int level, const char *format, ...) PRINTF_ATTRIBUTE(3,4);
+static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const char *format, ...) PRINTF_ATTRIBUTE(3,4);
#endif
-static void tdb_log(struct tdb_context *tdb, int level, const char *format, ...)
+static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const char *format, ...)
{
va_list ap;
@@ -266,7 +266,7 @@ static void usage(void)
}
db = tdb_open_ex("torture.tdb", hash_size, TDB_CLEAR_IF_FIRST,
- O_RDWR | O_CREAT, 0600, tdb_log, NULL);
+ O_RDWR | O_CREAT, 0600, tdb_log, NULL, NULL);
if (!db) {
fatal("db open failed");
}