summaryrefslogtreecommitdiff
path: root/source4/lib/tdb
diff options
context:
space:
mode:
Diffstat (limited to 'source4/lib/tdb')
-rw-r--r--source4/lib/tdb/common/spinlock.c22
-rw-r--r--source4/lib/tdb/common/tdbutil.c8
-rw-r--r--source4/lib/tdb/include/spinlock.h4
3 files changed, 17 insertions, 17 deletions
diff --git a/source4/lib/tdb/common/spinlock.c b/source4/lib/tdb/common/spinlock.c
index 1b789d4daa..0c8991c1e0 100644
--- a/source4/lib/tdb/common/spinlock.c
+++ b/source4/lib/tdb/common/spinlock.c
@@ -55,7 +55,7 @@
static inline int __spin_trylock(spinlock_t *lock)
{
- unsigned int result;
+ uint_t result;
asm volatile("ldstub [%1], %0"
: "=r" (result)
@@ -85,7 +85,7 @@ static inline int __spin_is_locked(spinlock_t *lock)
static inline int __spin_trylock(spinlock_t *lock)
{
- unsigned int result;
+ uint_t result;
__asm__ __volatile__(
"1: lwarx %0,0,%1\n\
@@ -167,7 +167,7 @@ static inline int __spin_is_locked(spinlock_t *lock)
/* Returns 0 if the lock is acquired, EBUSY otherwise. */
static inline int __spin_trylock(spinlock_t *lock)
{
- unsigned int val;
+ uint_t val;
val = __lock_test_and_set(lock, 1);
return val == 0 ? 0 : EBUSY;
}
@@ -185,16 +185,16 @@ static inline void __spin_lock_init(spinlock_t *lock)
/* Returns 1 if the lock is held, 0 otherwise. */
static inline int __spin_is_locked(spinlock_t *lock)
{
- unsigned int val;
+ uint_t val;
val = __add_and_fetch(lock, 0);
return val;
}
#elif defined(MIPS_SPINLOCKS)
-static inline unsigned int load_linked(unsigned long addr)
+static inline uint_t load_linked(unsigned long addr)
{
- unsigned int res;
+ uint_t res;
__asm__ __volatile__("ll\t%0,(%1)"
: "=r" (res)
@@ -203,9 +203,9 @@ static inline unsigned int load_linked(unsigned long addr)
return res;
}
-static inline unsigned int store_conditional(unsigned long addr, unsigned int value)
+static inline uint_t store_conditional(unsigned long addr, uint_t value)
{
- unsigned int res;
+ uint_t res;
__asm__ __volatile__("sc\t%0,(%2)"
: "=r" (res)
@@ -215,7 +215,7 @@ static inline unsigned int store_conditional(unsigned long addr, unsigned int va
static inline int __spin_trylock(spinlock_t *lock)
{
- unsigned int mw;
+ uint_t mw;
do {
mw = load_linked(lock);
@@ -418,7 +418,7 @@ int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type)
return 0;
}
-int tdb_create_rwlocks(int fd, unsigned int hash_size)
+int tdb_create_rwlocks(int fd, uint_t hash_size)
{
unsigned size, i;
tdb_rwlock_t *rwlocks;
@@ -460,7 +460,7 @@ int tdb_clear_spinlocks(TDB_CONTEXT *tdb)
return 0;
}
#else
-int tdb_create_rwlocks(int fd, unsigned int hash_size) { return 0; }
+int tdb_create_rwlocks(int fd, uint_t hash_size) { return 0; }
int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type) { return -1; }
int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type) { return -1; }
diff --git a/source4/lib/tdb/common/tdbutil.c b/source4/lib/tdb/common/tdbutil.c
index 05f4713c82..6b9ad414c5 100644
--- a/source4/lib/tdb/common/tdbutil.c
+++ b/source4/lib/tdb/common/tdbutil.c
@@ -91,7 +91,7 @@ static TDB_DATA make_tdb_data(const char *dptr, size_t dsize)
Lock a chain with timeout (in seconds).
****************************************************************************/
-static int tdb_chainlock_with_timeout_internal(TDB_CONTEXT *tdb, TDB_DATA key, unsigned int timeout, int rw_type)
+static int tdb_chainlock_with_timeout_internal(TDB_CONTEXT *tdb, TDB_DATA key, uint_t timeout, int rw_type)
{
/* Allow tdb_chainlock to be interrupted by an alarm. */
int ret;
@@ -129,7 +129,7 @@ static int tdb_chainlock_with_timeout_internal(TDB_CONTEXT *tdb, TDB_DATA key, u
Write lock a chain. Return -1 if timeout or lock failed.
****************************************************************************/
-int tdb_chainlock_with_timeout(TDB_CONTEXT *tdb, TDB_DATA key, unsigned int timeout)
+int tdb_chainlock_with_timeout(TDB_CONTEXT *tdb, TDB_DATA key, uint_t timeout)
{
return tdb_chainlock_with_timeout_internal(tdb, key, timeout, F_WRLCK);
}
@@ -138,7 +138,7 @@ int tdb_chainlock_with_timeout(TDB_CONTEXT *tdb, TDB_DATA key, unsigned int time
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, uint_t timeout)
{
TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1);
@@ -160,7 +160,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(TDB_CONTEXT *tdb, const char *keyval, uint_t timeout)
{
TDB_DATA key = make_tdb_data(keyval, strlen(keyval)+1);
diff --git a/source4/lib/tdb/include/spinlock.h b/source4/lib/tdb/include/spinlock.h
index 967fe37457..1255d455de 100644
--- a/source4/lib/tdb/include/spinlock.h
+++ b/source4/lib/tdb/include/spinlock.h
@@ -36,7 +36,7 @@ typedef struct {
int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type);
int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type);
-int tdb_create_rwlocks(int fd, unsigned int hash_size);
+int tdb_create_rwlocks(int fd, uint_t hash_size);
int tdb_clear_spinlocks(TDB_CONTEXT *tdb);
#define TDB_SPINLOCK_SIZE(hash_size) (((hash_size) + 1) * sizeof(tdb_rwlock_t))
@@ -49,7 +49,7 @@ int tdb_clear_spinlocks(TDB_CONTEXT *tdb);
#else
int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type);
int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type);
-int tdb_create_rwlocks(int fd, unsigned int hash_size);
+int tdb_create_rwlocks(int fd, uint_t hash_size);
#endif
int tdb_clear_spinlocks(TDB_CONTEXT *tdb);
#define TDB_SPINLOCK_SIZE(hash_size) 0