| 1 | #include "sync/rwlock_internal.h" |
|---|---|
| 2 | #include <sync/lock_chk.h> |
| 3 | #include <sync/mutex.h> |
| 4 | #include <sync/qspinlock.h> |
| 5 | #include <sync/raw_spinlock.h> |
| 6 | #include <sync/rwlock.h> |
| 7 | #include <sync/spinlock.h> |
| 8 | #include <test/static_assert.h> |
| 9 | |
| 10 | /* verification of lock word sizes and bitfield not overlapping */ |
| 11 | static_assert_size(struct raw_spinlock, 1); |
| 12 | #ifndef DEBUG_LOCK_CHK |
| 13 | static_assert_size(struct qspinlock, 4); |
| 14 | static_assert_size(struct spinlock, 1); |
| 15 | static_assert_size(struct mutex, 8); |
| 16 | static_assert_size(struct rwlock, 8); |
| 17 | #endif |
| 18 | |
| 19 | static_assert(LOCK_UNCHKD == 0); |
| 20 | static_assert(LOCK_CHKD_FULL == (LOCK_CHKD_ORDER | LOCK_CHKD_THREAD)); |
| 21 | |
| 22 | static_assert_disjoint_masks(Q_SPIN_LOCKED_MASK, Q_SPIN_PENDING_MASK); |
| 23 | static_assert_disjoint_masks(Q_SPIN_TAIL_MASK, Q_SPIN_LOCKED_PENDING_MASK); |
| 24 | |
| 25 | static_assert_disjoint_masks(RWLOCK_OWNER_MASK, |
| 26 | (uintptr_t) (RWLOCK_WRITER_HELD_BIT | |
| 27 | RWLOCK_PRIO_CEIL_MASK | |
| 28 | RWLOCK_WAITER_BIT | |
| 29 | RWLOCK_WRITER_WANT_BIT)); |
| 30 |