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