summaryrefslogtreecommitdiff
path: root/source4/lib/ldb/ldb_tdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2006-07-10 12:51:36 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:09:59 -0500
commit35fda6c5f344e71b1ed0bd195a62161e31401149 (patch)
tree6fd96d68dceac6bdde0ddf557b66103207e7be33 /source4/lib/ldb/ldb_tdb
parentbfc02627ceb02046fb23c62f28dc69765c8aa8f0 (diff)
downloadsamba-35fda6c5f344e71b1ed0bd195a62161e31401149.tar.gz
samba-35fda6c5f344e71b1ed0bd195a62161e31401149.tar.bz2
samba-35fda6c5f344e71b1ed0bd195a62161e31401149.zip
r16916: Implement metze's proposed changes to the tdb logging API.
This clearly links the log function with its private pointer, and makes the argument list for tdb_open_ex a bit shorter. Andrew Bartlett (This used to be commit 5d5503e8d8a10ead3ef21a5ffda52cadb9a07727)
Diffstat (limited to 'source4/lib/ldb/ldb_tdb')
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
index 31276d3948..df9cac1307 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb_wrap.c
@@ -63,7 +63,7 @@ static void ltdb_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, con
{
va_list ap;
const char *name = tdb_name(tdb);
- struct ldb_context *ldb = talloc_get_type(tdb_logging_private(tdb), struct ldb_context);
+ struct ldb_context *ldb = talloc_get_type(tdb_get_logging_private(tdb), struct ldb_context);
enum ldb_debug_level ldb_level;
char *message;
va_start(ap, fmt);
@@ -106,6 +106,9 @@ struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
{
struct ltdb_wrap *w;
struct stat st;
+ struct tdb_logging_context log_ctx;
+ log_ctx.log_fn = ltdb_log_fn;
+ log_ctx.log_private = ldb;
if (stat(path, &st) == 0) {
for (w=tdb_list;w;w=w->next) {
@@ -121,7 +124,7 @@ struct tdb_context *ltdb_wrap_open(TALLOC_CTX *mem_ctx,
return NULL;
}
- w->tdb = tdb_open_ex(path, hash_size, tdb_flags, open_flags, mode, ltdb_log_fn, ldb, NULL);
+ w->tdb = tdb_open_ex(path, hash_size, tdb_flags, open_flags, mode, &log_ctx, NULL);
if (w->tdb == NULL) {
talloc_free(w);
return NULL;