diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2012-06-22 15:07:44 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2012-06-22 07:35:17 +0200 |
commit | e92cb556fdb5faee71f614475aaade846dcd0aed (patch) | |
tree | aa56a6d0aefe643f5a26e074b1b9151031b8f20c /lib/dbwrap | |
parent | 41f799d877961d095401a628307e0c690dfbc124 (diff) | |
download | samba-e92cb556fdb5faee71f614475aaade846dcd0aed.tar.gz samba-e92cb556fdb5faee71f614475aaade846dcd0aed.tar.bz2 samba-e92cb556fdb5faee71f614475aaade846dcd0aed.zip |
dbwrap: dbwrap_name().
Useful for debug messages: particularly once we start switching between .tdb
and .ntdb files.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/dbwrap')
-rw-r--r-- | lib/dbwrap/dbwrap.c | 5 | ||||
-rw-r--r-- | lib/dbwrap/dbwrap.h | 2 | ||||
-rw-r--r-- | lib/dbwrap/dbwrap_cache.c | 1 | ||||
-rw-r--r-- | lib/dbwrap/dbwrap_file.c | 1 | ||||
-rw-r--r-- | lib/dbwrap/dbwrap_private.h | 1 | ||||
-rw-r--r-- | lib/dbwrap/dbwrap_rbt.c | 1 | ||||
-rw-r--r-- | lib/dbwrap/dbwrap_tdb.c | 1 |
7 files changed, 11 insertions, 1 deletions
diff --git a/lib/dbwrap/dbwrap.c b/lib/dbwrap/dbwrap.c index afb069221e..f898819b9d 100644 --- a/lib/dbwrap/dbwrap.c +++ b/lib/dbwrap/dbwrap.c @@ -449,3 +449,8 @@ void dbwrap_db_id(struct db_context *db, const uint8_t **id, size_t *idlen) { db->id(db, id, idlen); } + +const char *dbwrap_name(struct db_context *db) +{ + return db->name; +} diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h index 366e657680..796475d3e2 100644 --- a/lib/dbwrap/dbwrap.h +++ b/lib/dbwrap/dbwrap.h @@ -81,7 +81,7 @@ NTSTATUS dbwrap_transaction_start_nonblock(struct db_context *db); int dbwrap_transaction_commit(struct db_context *db); int dbwrap_transaction_cancel(struct db_context *db); void dbwrap_db_id(struct db_context *db, const uint8_t **id, size_t *idlen); - +const char *dbwrap_name(struct db_context *db); /* The following definitions come from lib/dbwrap_util.c */ diff --git a/lib/dbwrap/dbwrap_cache.c b/lib/dbwrap/dbwrap_cache.c index 4bfa6340af..1badeb13b9 100644 --- a/lib/dbwrap/dbwrap_cache.c +++ b/lib/dbwrap/dbwrap_cache.c @@ -209,6 +209,7 @@ struct db_context *db_open_cache(TALLOC_CTX *mem_ctx, db->parse_record = dbwrap_cache_parse_record; db->exists = dbwrap_cache_exists; db->id = dbwrap_cache_id; + db->name = dbwrap_name(ctx->backing); db->stored_callback = NULL; db->wipe = NULL; db->lock_order = 0; diff --git a/lib/dbwrap/dbwrap_file.c b/lib/dbwrap/dbwrap_file.c index e0fd4ebc73..4499021c57 100644 --- a/lib/dbwrap/dbwrap_file.c +++ b/lib/dbwrap/dbwrap_file.c @@ -372,6 +372,7 @@ struct db_context *db_open_file(TALLOC_CTX *mem_ctx, result->traverse = db_file_traverse; result->traverse_read = db_file_traverse; result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0); + result->name = name; ctx->locked_record = NULL; if (!(ctx->dirname = talloc_strdup(ctx, name))) { diff --git a/lib/dbwrap/dbwrap_private.h b/lib/dbwrap/dbwrap_private.h index b0090e39ad..f5b2140866 100644 --- a/lib/dbwrap/dbwrap_private.h +++ b/lib/dbwrap/dbwrap_private.h @@ -63,6 +63,7 @@ struct db_context { int (*wipe)(struct db_context *db); int (*check)(struct db_context *db); void (*id)(struct db_context *db, const uint8_t **id, size_t *idlen); + const char *name; void *private_data; enum dbwrap_lock_order lock_order; bool persistent; diff --git a/lib/dbwrap/dbwrap_rbt.c b/lib/dbwrap/dbwrap_rbt.c index d512eac219..67794e6b96 100644 --- a/lib/dbwrap/dbwrap_rbt.c +++ b/lib/dbwrap/dbwrap_rbt.c @@ -506,6 +506,7 @@ struct db_context *db_open_rbt(TALLOC_CTX *mem_ctx) result->parse_record = db_rbt_parse_record; result->lock_order = 0; result->id = db_rbt_id; + result->name = "dbwrap rbt"; result->stored_callback = NULL; return result; diff --git a/lib/dbwrap/dbwrap_tdb.c b/lib/dbwrap/dbwrap_tdb.c index 883c7f3c9c..a6176b75c4 100644 --- a/lib/dbwrap/dbwrap_tdb.c +++ b/lib/dbwrap/dbwrap_tdb.c @@ -473,6 +473,7 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, result->id = db_tdb_id; result->check = db_tdb_check; result->stored_callback = NULL; + result->name = tdb_name(db_tdb->wtdb->tdb); return result; fail: |