diff options
author | Jeremy Allison <jra@samba.org> | 2002-03-21 23:39:17 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-03-21 23:39:17 +0000 |
commit | 67d21b5a4ba35244c4362130ce7c501c89839429 (patch) | |
tree | 09d8be71cd2f1c6fcf1b3c38fb94406f8671c99a /source3/tdb | |
parent | 42955a4d8152ed583394db1954b307f965583265 (diff) | |
download | samba-67d21b5a4ba35244c4362130ce7c501c89839429.tar.gz samba-67d21b5a4ba35244c4362130ce7c501c89839429.tar.bz2 samba-67d21b5a4ba35244c4362130ce7c501c89839429.zip |
Make winbindd_idmap tdb endian independent. This is very important for
sharing between machines with rsync.
Finally removed tdb_store_int/tdb_fetch_int.
Now only tdb_store_int32/tdb_fetch_int32 which are endian independent
are allowed.
Jeremy.
(This used to be commit 1c4a00dcc13f4a7c5876a5cf63ca730190d1132e)
Diffstat (limited to 'source3/tdb')
-rw-r--r-- | source3/tdb/tdbutil.c | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c index 0c816735b7..793b44d89d 100644 --- a/source3/tdb/tdbutil.c +++ b/source3/tdb/tdbutil.c @@ -52,64 +52,6 @@ void tdb_unlock_bystring(TDB_CONTEXT *tdb, char *keyval) } /**************************************************************************** - Fetch a value by a arbitrary blob key, return -1 if not found. - JRA. DEPRECATED ! Use tdb_fetch_int32_byblob instead. -****************************************************************************/ - -int tdb_fetch_int_byblob(TDB_CONTEXT *tdb, char *keyval, size_t len) -{ - TDB_DATA key, data; - int ret; - - key.dptr = keyval; - key.dsize = len; - data = tdb_fetch(tdb, key); - if (!data.dptr || data.dsize != sizeof(int)) - return -1; - - memcpy(&ret, data.dptr, sizeof(int)); - SAFE_FREE(data.dptr); - return ret; -} - -/**************************************************************************** - Fetch a value by string key, return -1 if not found. - JRA. DEPRECATED ! Use tdb_fetch_int32 instead. -****************************************************************************/ - -int tdb_fetch_int(TDB_CONTEXT *tdb, char *keystr) -{ - return tdb_fetch_int_byblob(tdb, keystr, strlen(keystr) + 1); -} - -/**************************************************************************** - Store a value by an arbitary blob key, return 0 on success, -1 on failure. - JRA. DEPRECATED ! Use tdb_store_int32_byblob instead. -****************************************************************************/ - -int tdb_store_int_byblob(TDB_CONTEXT *tdb, char *keystr, size_t len, int v) -{ - TDB_DATA key, data; - - key.dptr = keystr; - key.dsize = len; - data.dptr = (void *)&v; - data.dsize = sizeof(int); - - return tdb_store(tdb, key, data, TDB_REPLACE); -} - -/**************************************************************************** - Store a value by string key, return 0 on success, -1 on failure. - JRA. DEPRECATED ! Use tdb_store_int32 instead. -****************************************************************************/ - -int tdb_store_int(TDB_CONTEXT *tdb, char *keystr, int v) -{ - return tdb_store_int_byblob(tdb, keystr, strlen(keystr) + 1, v); -} - -/**************************************************************************** Fetch a int32 value by a arbitrary blob key, return -1 if not found. Output is int32 in native byte order. ****************************************************************************/ @@ -204,41 +146,6 @@ TDB_DATA tdb_fetch_by_string(TDB_CONTEXT *tdb, char *keystr) /**************************************************************************** Atomic integer change. Returns old value. To create, set initial value in *oldval. - Deprecated. Use int32 version. JRA. -****************************************************************************/ - -int tdb_change_int_atomic(TDB_CONTEXT *tdb, char *keystr, int *oldval, int change_val) -{ - int val; - int ret = -1; - - if (tdb_lock_bystring(tdb, keystr) == -1) - return -1; - - if ((val = tdb_fetch_int(tdb, keystr)) == -1) { - if (tdb_error(tdb) != TDB_ERR_NOEXIST) - goto err_out; - - val = *oldval; - - } else { - *oldval = val; - val += change_val; - } - - if (tdb_store_int(tdb, keystr, val) == -1) - goto err_out; - - ret = 0; - - err_out: - - tdb_unlock_bystring(tdb, keystr); - return ret; -} - -/**************************************************************************** - Atomic integer change. Returns old value. To create, set initial value in *oldval. ****************************************************************************/ int32 tdb_change_int32_atomic(TDB_CONTEXT *tdb, char *keystr, int32 *oldval, int32 change_val) |