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

s3-dbwrap: Add "db_context" to "db_record"

This commit is contained in:
Volker Lendecke 2012-01-02 13:30:51 +01:00
parent 0f20ffbcbd
commit 8e5b11bc14
4 changed files with 10 additions and 0 deletions

View File

@ -161,6 +161,7 @@ static struct db_record *dbwrap_fetch_locked_internal(
return NULL;
}
(void)talloc_steal(rec, lock_order);
rec->db = db;
TALLOC_FREE(frame);
return rec;
}
@ -183,6 +184,11 @@ struct db_record *dbwrap_try_fetch_locked(struct db_context *db,
? db->try_fetch_locked : db->fetch_locked);
}
struct db_context *dbwrap_record_get_db(struct db_record *rec)
{
return rec->db;
}
struct dbwrap_fetch_state {
TALLOC_CTX *mem_ctx;
TDB_DATA data;

View File

@ -37,6 +37,7 @@ struct db_record *dbwrap_fetch_locked(struct db_context *db,
struct db_record *dbwrap_try_fetch_locked(struct db_context *db,
TALLOC_CTX *mem_ctx,
TDB_DATA key);
struct db_context *dbwrap_record_get_db(struct db_record *rec);
NTSTATUS dbwrap_delete(struct db_context *db, TDB_DATA key);
NTSTATUS dbwrap_store(struct db_context *db, TDB_DATA key,

View File

@ -26,6 +26,7 @@
#include "dbwrap/dbwrap_open.h"
struct db_record {
struct db_context *db;
TDB_DATA key, value;
NTSTATUS (*store)(struct db_record *rec, TDB_DATA data, int flag);
NTSTATUS (*delete_rec)(struct db_record *rec);

View File

@ -276,6 +276,7 @@ static int db_tdb_traverse_func(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf,
rec.store = db_tdb_store;
rec.delete_rec = db_tdb_delete;
rec.private_data = ctx->db->private_data;
rec.db = ctx->db;
return ctx->f(&rec, ctx->private_data);
}
@ -316,6 +317,7 @@ static int db_tdb_traverse_read_func(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA d
rec.store = db_tdb_store_deny;
rec.delete_rec = db_tdb_delete_deny;
rec.private_data = ctx->db->private_data;
rec.db = ctx->db;
return ctx->f(&rec, ctx->private_data);
}