kernel: Forbid implicit casts between spinlock and int32

This commit is contained in:
Pawel Dziepak
2013-11-29 03:36:31 +01:00
parent 7b4befcd47
commit e736a456ba
11 changed files with 38 additions and 30 deletions
+9 -5
View File
@@ -31,15 +31,19 @@ typedef ulong cpu_status;
(spinlock)->count_low = 0; \
(spinlock)->count_high = 0; \
} while (false)
# define B_SPINLOCK_IS_LOCKED(spinlock) ((spinlock)->lock > 0)
#else
typedef int32 spinlock;
typedef struct {
int32 lock;
} spinlock;
# define B_SPINLOCK_INITIALIZER 0
# define B_INITIALIZE_SPINLOCK(lock) do { *(lock) = 0; } while (false)
# define B_SPINLOCK_IS_LOCKED(lock) (*(lock) > 0)
# define B_SPINLOCK_INITIALIZER { 0 }
# define B_INITIALIZE_SPINLOCK(spinlock) do { \
(spinlock)->lock = 0; \
} while (false)
#endif
#define B_SPINLOCK_IS_LOCKED(spinlock) (atomic_get(&(spinlock)->lock) > 0)
typedef struct {
int32 lock;
} rw_spinlock;