diff options
author | Volker Lendecke <vl@samba.org> | 2012-01-02 13:30:51 +0100 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2012-04-20 13:42:40 +0200 |
commit | 8e5b11bc143e8532aeed504e47b881ce53411ce3 (patch) | |
tree | 8677fa01565fdaabd899862926fd5d38f1d2f002 /source3 | |
parent | 0f20ffbcbd41895dd073051539411f7194ae8224 (diff) | |
download | samba-8e5b11bc143e8532aeed504e47b881ce53411ce3.tar.gz samba-8e5b11bc143e8532aeed504e47b881ce53411ce3.tar.bz2 samba-8e5b11bc143e8532aeed504e47b881ce53411ce3.zip |
s3-dbwrap: Add "db_context" to "db_record"
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/dbwrap/dbwrap.c | 6 | ||||
-rw-r--r-- | source3/lib/dbwrap/dbwrap.h | 1 | ||||
-rw-r--r-- | source3/lib/dbwrap/dbwrap_private.h | 1 | ||||
-rw-r--r-- | source3/lib/dbwrap/dbwrap_tdb.c | 2 |
4 files changed, 10 insertions, 0 deletions
diff --git a/source3/lib/dbwrap/dbwrap.c b/source3/lib/dbwrap/dbwrap.c index 82b1c54ac4..21d46ea895 100644 --- a/source3/lib/dbwrap/dbwrap.c +++ b/source3/lib/dbwrap/dbwrap.c @@ -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; diff --git a/source3/lib/dbwrap/dbwrap.h b/source3/lib/dbwrap/dbwrap.h index 6fd5999a9d..ff41e647ef 100644 --- a/source3/lib/dbwrap/dbwrap.h +++ b/source3/lib/dbwrap/dbwrap.h @@ -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, diff --git a/source3/lib/dbwrap/dbwrap_private.h b/source3/lib/dbwrap/dbwrap_private.h index b24e3b370c..28da1add53 100644 --- a/source3/lib/dbwrap/dbwrap_private.h +++ b/source3/lib/dbwrap/dbwrap_private.h @@ -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); diff --git a/source3/lib/dbwrap/dbwrap_tdb.c b/source3/lib/dbwrap/dbwrap_tdb.c index e1b26e4e09..9450be0e65 100644 --- a/source3/lib/dbwrap/dbwrap_tdb.c +++ b/source3/lib/dbwrap/dbwrap_tdb.c @@ -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); } |