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 | 41f799d877961d095401a628307e0c690dfbc124 (patch) | |
tree | 5687f03d0009a3f379375a3d52087afbb14591e2 /lib/dbwrap/dbwrap_tdb.c | |
parent | f6eb187fdab6b8088bb065e418fe604c4eba7751 (diff) | |
download | samba-41f799d877961d095401a628307e0c690dfbc124.tar.gz |
dbwrap: dbwrap_transaction_start_nonblock().
Implemented for ntdb and tdb; falls back to the blocking variant
for others.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/dbwrap/dbwrap_tdb.c')
-rw-r--r-- | lib/dbwrap/dbwrap_tdb.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/dbwrap/dbwrap_tdb.c b/lib/dbwrap/dbwrap_tdb.c index 99ea62a3a1d..883c7f3c9c9 100644 --- a/lib/dbwrap/dbwrap_tdb.c +++ b/lib/dbwrap/dbwrap_tdb.c @@ -374,6 +374,19 @@ static int db_tdb_transaction_start(struct db_context *db) return tdb_transaction_start(db_ctx->wtdb->tdb) ? -1 : 0; } +static NTSTATUS db_tdb_transaction_start_nonblock(struct db_context *db) +{ + struct db_tdb_ctx *db_ctx = + talloc_get_type_abort(db->private_data, struct db_tdb_ctx); + int ret; + + ret = tdb_transaction_start_nonblock(db_ctx->wtdb->tdb); + if (ret != 0) { + return map_nt_error_from_tdb(tdb_error(db_ctx->wtdb->tdb)); + } + return NT_STATUS_OK; +} + static int db_tdb_transaction_commit(struct db_context *db) { struct db_tdb_ctx *db_ctx = @@ -452,6 +465,7 @@ struct db_context *db_open_tdb(TALLOC_CTX *mem_ctx, result->get_seqnum = db_tdb_get_seqnum; result->persistent = ((tdb_flags & TDB_CLEAR_IF_FIRST) == 0); result->transaction_start = db_tdb_transaction_start; + result->transaction_start_nonblock = db_tdb_transaction_start_nonblock; result->transaction_commit = db_tdb_transaction_commit; result->transaction_cancel = db_tdb_transaction_cancel; result->exists = db_tdb_exists; |