1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-27 22:50:26 +03:00

dbwrap: dbwrap_hash_size().

Implemented for ntdb and tdb; falls back to 0 for others.

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 e92cb556fd
commit 945473aac0
7 changed files with 12 additions and 0 deletions

View File

@ -407,6 +407,11 @@ int dbwrap_wipe(struct db_context *db)
return db->wipe(db);
}
int dbwrap_hash_size(struct db_context *db)
{
return db->hash_size;
}
int dbwrap_check(struct db_context *db)
{
if (db->check == NULL) {

View File

@ -76,6 +76,8 @@ NTSTATUS dbwrap_parse_record(struct db_context *db, TDB_DATA key,
int dbwrap_wipe(struct db_context *db);
int dbwrap_check(struct db_context *db);
int dbwrap_get_seqnum(struct db_context *db);
/* Returns 0 if unknown. */
int dbwrap_hash_size(struct db_context *db);
int dbwrap_transaction_start(struct db_context *db);
NTSTATUS dbwrap_transaction_start_nonblock(struct db_context *db);
int dbwrap_transaction_commit(struct db_context *db);

View File

@ -210,6 +210,7 @@ struct db_context *db_open_cache(TALLOC_CTX *mem_ctx,
db->exists = dbwrap_cache_exists;
db->id = dbwrap_cache_id;
db->name = dbwrap_name(ctx->backing);
db->hash_size = dbwrap_hash_size(ctx->backing);
db->stored_callback = NULL;
db->wipe = NULL;
db->lock_order = 0;

View File

@ -373,6 +373,7 @@ struct db_context *db_open_file(TALLOC_CTX *mem_ctx,
result->traverse_read = db_file_traverse;
result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0);
result->name = name;
result->hash_size = 0;
ctx->locked_record = NULL;
if (!(ctx->dirname = talloc_strdup(ctx, name))) {

View File

@ -64,6 +64,7 @@ struct db_context {
int (*check)(struct db_context *db);
void (*id)(struct db_context *db, const uint8_t **id, size_t *idlen);
const char *name;
int hash_size;
void *private_data;
enum dbwrap_lock_order lock_order;
bool persistent;

View File

@ -507,6 +507,7 @@ struct db_context *db_open_rbt(TALLOC_CTX *mem_ctx)
result->lock_order = 0;
result->id = db_rbt_id;
result->name = "dbwrap rbt";
result->hash_size = 0;
result->stored_callback = NULL;
return result;

View File

@ -474,6 +474,7 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx,
result->check = db_tdb_check;
result->stored_callback = NULL;
result->name = tdb_name(db_tdb->wtdb->tdb);
result->hash_size = hash_size;
return result;
fail: