10 #define RWLOCK_BIAS 0x1000UL
13 #define MAX_BUSY_LOOPS 1000
14 #undef USE_SCHED_YIELD
17 /* We should make sure these are padded to a cache line */
18 #if defined(SPARC_SPINLOCKS)
19 typedef volatile char spinlock_t;
20 #elif defined(POWERPC_SPINLOCKS)
21 typedef volatile unsigned long spinlock_t;
22 #elif defined(INTEL_SPINLOCKS)
23 typedef volatile int spinlock_t;
24 #elif defined(MIPS_SPINLOCKS)
25 typedef volatile unsigned long spinlock_t;
27 #error Need to implement spinlock code in spinlock.h
35 int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type);
36 int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type);
37 int tdb_create_rwlocks(int fd, unsigned int hash_size);
38 int tdb_clear_spinlocks(TDB_CONTEXT *tdb);
40 #define TDB_SPINLOCK_SIZE(hash_size) (((hash_size) + 1) * sizeof(tdb_rwlock_t))
42 #else /* !USE_SPINLOCKS */
44 #define tdb_create_rwlocks(fd, hash_size) 0
45 #define tdb_spinlock(tdb, list, rw_type) (-1)
46 #define tdb_spinunlock(tdb, list, rw_type) (-1)
48 int tdb_spinlock(TDB_CONTEXT *tdb, int list, int rw_type);
49 int tdb_spinunlock(TDB_CONTEXT *tdb, int list, int rw_type);
50 int tdb_create_rwlocks(int fd, unsigned int hash_size);
52 int tdb_clear_spinlocks(TDB_CONTEXT *tdb);
53 #define TDB_SPINLOCK_SIZE(hash_size) 0