diff options
author | Volker Lendecke <vlendec@samba.org> | 2006-04-17 11:49:06 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 11:16:23 -0500 |
commit | e17302200c138eec7df504a7f4b2bde46073a810 (patch) | |
tree | 0973275cef43fef24af3d07530f4464ec0702427 /source3/tdb | |
parent | 76a2ac3ac324466962adbeaf1f2a85572f631c0a (diff) | |
download | samba-e17302200c138eec7df504a7f4b2bde46073a810.tar.gz samba-e17302200c138eec7df504a7f4b2bde46073a810.tar.bz2 samba-e17302200c138eec7df504a7f4b2bde46073a810.zip |
r15101: Little step towards getting Samba4 tdb into 3: tdb_lock_bystring does not
have the timeout argument in Samba4. Add a new routine
tdb_lock_bystring_with_timeout.
Volker
(This used to be commit b9c6e3f55602fa505859a4b2cd137b74105d685f)
Diffstat (limited to 'source3/tdb')
-rw-r--r-- | source3/tdb/tdbutil.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c index 09baff072f..f1809229f8 100644 --- a/source3/tdb/tdbutil.c +++ b/source3/tdb/tdbutil.c @@ -104,11 +104,19 @@ int tdb_chainlock_with_timeout( TDB_CONTEXT *tdb, TDB_DATA key, unsigned int tim Lock a chain by string. Return -1 if timeout or lock failed. ****************************************************************************/ -int tdb_lock_bystring(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout) +int tdb_lock_bystring(TDB_CONTEXT *tdb, const char *keyval) { TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); - return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_WRLCK); + return tdb_chainlock(tdb, key); +} + +int tdb_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval, + int timeout) +{ + TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); + + return tdb_chainlock_with_timeout(tdb, key, timeout); } /**************************************************************************** @@ -126,7 +134,7 @@ void tdb_unlock_bystring(TDB_CONTEXT *tdb, const char *keyval) Read lock a chain by string. Return -1 if timeout or lock failed. ****************************************************************************/ -int tdb_read_lock_bystring(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout) +int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout) { TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1); @@ -311,7 +319,7 @@ int32 tdb_change_int32_atomic(TDB_CONTEXT *tdb, const char *keystr, int32 *oldva int32 val; int32 ret = -1; - if (tdb_lock_bystring(tdb, keystr,0) == -1) + if (tdb_lock_bystring(tdb, keystr) == -1) return -1; if ((val = tdb_fetch_int32(tdb, keystr)) == -1) { @@ -352,7 +360,7 @@ BOOL tdb_change_uint32_atomic(TDB_CONTEXT *tdb, const char *keystr, uint32 *oldv uint32 val; BOOL ret = False; - if (tdb_lock_bystring(tdb, keystr,0) == -1) + if (tdb_lock_bystring(tdb, keystr) == -1) return False; if (!tdb_fetch_uint32(tdb, keystr, &val)) { |