vserver 1.9.5.x5
[linux-2.6.git] / include / asm-ia64 / spinlock.h
index a56a066..909936f 100644 (file)
@@ -19,6 +19,9 @@
 
 typedef struct {
        volatile unsigned int lock;
+#ifdef CONFIG_PREEMPT
+       unsigned int break_lock;
+#endif
 } spinlock_t;
 
 #define SPIN_LOCK_UNLOCKED                     (spinlock_t) { 0 }
@@ -116,11 +119,15 @@ do {                                                                                      \
 typedef struct {
        volatile unsigned int read_counter      : 31;
        volatile unsigned int write_lock        :  1;
+#ifdef CONFIG_PREEMPT
+       unsigned int break_lock;
+#endif
 } rwlock_t;
 #define RW_LOCK_UNLOCKED (rwlock_t) { 0, 0 }
 
 #define rwlock_init(x)         do { *(x) = RW_LOCK_UNLOCKED; } while(0)
-#define rwlock_is_locked(x)    (*(volatile int *) (x) != 0)
+#define read_can_lock(rw)      (*(volatile int *)(rw) >= 0)
+#define write_can_lock(rw)     (*(volatile int *)(rw) == 0)
 
 #define _raw_read_lock(rw)                                                             \
 do {                                                                                   \
@@ -190,6 +197,8 @@ do {                                                                                \
 
 #endif /* !ASM_SUPPORTED */
 
+#define _raw_read_trylock(lock) generic_raw_read_trylock(lock)
+
 #define _raw_write_unlock(x)                                                           \
 ({                                                                                     \
        smp_mb__before_clear_bit();     /* need barrier before releasing lock... */     \