summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2009-07-29 14:37:39 +0200
committerMichael Adam <obnox@samba.org>2009-07-29 16:26:25 +0200
commit05794380395bad93aac5b225e07a446864740e78 (patch)
tree784a26969788d98c6d9b6538371b6678714dc8b3 /source3
parent14c2bc91b9ccf85f82d56f4b0dbe8346a06bfe7e (diff)
downloadsamba-05794380395bad93aac5b225e07a446864740e78.tar.gz
samba-05794380395bad93aac5b225e07a446864740e78.tar.bz2
samba-05794380395bad93aac5b225e07a446864740e78.zip
s3:dbwrap: add dbwrap_trans_change_uint32_atomic()
A transaction wrapper for dbwrap_change_uint32_atomic(). Michael
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h4
-rw-r--r--source3/lib/dbwrap_util.c17
2 files changed, 21 insertions, 0 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 6d9c35beb0..78e2b25dcb 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -442,6 +442,10 @@ bool dbwrap_fetch_uint32(struct db_context *db, const char *keystr,
int dbwrap_store_uint32(struct db_context *db, const char *keystr, uint32_t v);
NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
uint32_t *oldval, uint32_t change_val);
+NTSTATUS dbwrap_trans_change_uint32_atomic(struct db_context *db,
+ const char *keystr,
+ uint32_t *oldval,
+ uint32_t change_val);
NTSTATUS dbwrap_change_int32_atomic(struct db_context *db, const char *keystr,
int32 *oldval, int32 change_val);
NTSTATUS dbwrap_trans_store(struct db_context *db, TDB_DATA key, TDB_DATA dbuf,
diff --git a/source3/lib/dbwrap_util.c b/source3/lib/dbwrap_util.c
index 118d681eb9..72442690e3 100644
--- a/source3/lib/dbwrap_util.c
+++ b/source3/lib/dbwrap_util.c
@@ -166,6 +166,23 @@ NTSTATUS dbwrap_change_uint32_atomic(struct db_context *db, const char *keystr,
return ret;
}
+NTSTATUS dbwrap_trans_change_uint32_atomic(struct db_context *db,
+ const char *keystr,
+ uint32_t *oldval,
+ uint32_t change_val)
+{
+ NTSTATUS ret;
+ struct dbwrap_change_uint32_atomic_context state;
+
+ state.keystr = keystr;
+ state.oldval = oldval;
+ state.change_val = change_val;
+
+ ret = dbwrap_trans_do(db, dbwrap_change_uint32_atomic_action, &state);
+
+ return ret;
+}
+
/**
* Atomic integer change (addition):
*