1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

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>
This commit is contained in:
Rusty Russell 2012-06-22 15:07:44 +09:30
parent 41f799d877
commit e92cb556fd
7 changed files with 11 additions and 1 deletions

View File

@ -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;
}

View File

@ -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 */

View File

@ -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;

View File

@ -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))) {

View File

@ -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;

View File

@ -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;

View File

@ -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: