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 | 945473aac0abffd8509bbeef3ed5a32737b7df51 (patch) | |
tree | 1a01de9fd747aade6fbcc3ae00545f3be7bbc415 /lib | |
parent | e92cb556fdb5faee71f614475aaade846dcd0aed (diff) | |
download | samba-945473aac0abffd8509bbeef3ed5a32737b7df51.tar.gz samba-945473aac0abffd8509bbeef3ed5a32737b7df51.tar.bz2 samba-945473aac0abffd8509bbeef3ed5a32737b7df51.zip |
dbwrap: dbwrap_hash_size().
Implemented for ntdb and tdb; falls back to 0 for others.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib')
-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, 12 insertions, 0 deletions
diff --git a/lib/dbwrap/dbwrap.c b/lib/dbwrap/dbwrap.c index f898819b9d..4c0160a474 100644 --- a/lib/dbwrap/dbwrap.c +++ b/lib/dbwrap/dbwrap.c @@ -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) { diff --git a/lib/dbwrap/dbwrap.h b/lib/dbwrap/dbwrap.h index 796475d3e2..30c24fedb3 100644 --- a/lib/dbwrap/dbwrap.h +++ b/lib/dbwrap/dbwrap.h @@ -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); diff --git a/lib/dbwrap/dbwrap_cache.c b/lib/dbwrap/dbwrap_cache.c index 1badeb13b9..f2a9c5fb0b 100644 --- a/lib/dbwrap/dbwrap_cache.c +++ b/lib/dbwrap/dbwrap_cache.c @@ -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; diff --git a/lib/dbwrap/dbwrap_file.c b/lib/dbwrap/dbwrap_file.c index 4499021c57..54ed320864 100644 --- a/lib/dbwrap/dbwrap_file.c +++ b/lib/dbwrap/dbwrap_file.c @@ -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))) { diff --git a/lib/dbwrap/dbwrap_private.h b/lib/dbwrap/dbwrap_private.h index f5b2140866..d49a568cd0 100644 --- a/lib/dbwrap/dbwrap_private.h +++ b/lib/dbwrap/dbwrap_private.h @@ -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; diff --git a/lib/dbwrap/dbwrap_rbt.c b/lib/dbwrap/dbwrap_rbt.c index 67794e6b96..afe9974cb5 100644 --- a/lib/dbwrap/dbwrap_rbt.c +++ b/lib/dbwrap/dbwrap_rbt.c @@ -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; diff --git a/lib/dbwrap/dbwrap_tdb.c b/lib/dbwrap/dbwrap_tdb.c index a6176b75c4..80d41b4ebb 100644 --- a/lib/dbwrap/dbwrap_tdb.c +++ b/lib/dbwrap/dbwrap_tdb.c @@ -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: |