From ae58ff981df4acadb43f0c89e75b760538673bf4 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Wed, 29 Jul 2009 15:14:57 +0200 Subject: [PATCH] s3:dbwrap: add dbwrap_trans_change_int32_atomic() A transaction wrapper for dbwrap_change_int32_atomic(). Michael --- source3/include/proto.h | 4 ++++ source3/lib/dbwrap_util.c | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/source3/include/proto.h b/source3/include/proto.h index b7a16567fe2..00cfd6129e6 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -448,6 +448,10 @@ NTSTATUS dbwrap_trans_change_uint32_atomic(struct db_context *db, uint32_t change_val); NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr, int32_t *oldval, int32_t change_val); +NTSTATUS dbwrap_trans_change_int32_atomic(struct db_context *db, + const char *keystr, + int32_t *oldval, + int32_t change_val); NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf, int flag); NTSTATUS dbwrap_trans_delete(struct db_context *db, TDB_DATA key); diff --git a/source3/lib/dbwrap_util.c b/source3/lib/dbwrap_util.c index ca0658579a2..1c190167b5b 100644 --- a/source3/lib/dbwrap_util.c +++ b/source3/lib/dbwrap_util.c @@ -250,6 +250,23 @@ NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr, return ret; } +NTSTATUS dbwrap_trans_change_int32_atomic(struct db_context *db, + const char *keystr, + int32_t *oldval, + int32_t change_val) +{ + NTSTATUS ret; + struct dbwrap_change_int32_atomic_context state; + + state.keystr = keystr; + state.oldval = oldval; + state.change_val = change_val; + + ret = dbwrap_trans_do(db, dbwrap_change_int32_atomic_action, &state); + + return ret; +} + struct dbwrap_store_context { TDB_DATA *key; TDB_DATA *dbuf; -- 2.11.4.GIT