-#pragma pack()
-
-#define LCK_RW_ATTR_DEBUG 0x1
-#define LCK_RW_ATTR_DEBUGb 0
-#define LCK_RW_ATTR_STAT 0x2
-#define LCK_RW_ATTR_STATb 1
-#define LCK_RW_ATTR_READ_PRI 0x3
-#define LCK_RW_ATTR_READ_PRIb 2
-#define LCK_RW_ATTR_DIS_THREAD 0x40000000
-#define LCK_RW_ATTR_DIS_THREADb 30
-#define LCK_RW_ATTR_DIS_MYLOCK 0x10000000
-#define LCK_RW_ATTR_DIS_MYLOCKb 28
-
-#define LCK_RW_TAG_DESTROYED 0x00002007 /* lock marked as Destroyed */
+#define LCK_RW_T_SIZE 16
+
+static_assert(sizeof(lck_rw_t) == LCK_RW_T_SIZE);
+
+#define LCK_RW_SHARED_SHIFT 0
+#define LCK_RW_INTERLOCK_BIT 16
+#define LCK_RW_PRIV_EXCL_BIT 24
+#define LCK_RW_WANT_UPGRADE_BIT 25
+#define LCK_RW_WANT_EXCL_BIT 26
+#define LCK_RW_R_WAITING_BIT 27
+#define LCK_RW_W_WAITING_BIT 28
+#define LCK_RW_CAN_SLEEP_BIT 29
+
+#define LCK_RW_INTERLOCK (1 << LCK_RW_INTERLOCK_BIT)
+#define LCK_RW_WANT_UPGRADE (1 << LCK_RW_WANT_UPGRADE_BIT)
+#define LCK_RW_WANT_EXCL (1 << LCK_RW_WANT_EXCL_BIT)
+#define LCK_RW_R_WAITING (1 << LCK_RW_R_WAITING_BIT)
+#define LCK_RW_W_WAITING (1 << LCK_RW_W_WAITING_BIT)
+#define LCK_RW_PRIV_EXCL (1 << LCK_RW_PRIV_EXCL_BIT)
+#define LCK_RW_TAG_VALID (1 << LCK_RW_TAG_VALID_BIT)
+#define LCK_RW_SHARED_MASK (0xffff << LCK_RW_SHARED_SHIFT)
+#define LCK_RW_SHARED_READER (1 << LCK_RW_SHARED_SHIFT)
+
+#define LCK_RW_WANT_WRITE LCK_RW_WANT_EXCL
+
+
+#define LCK_RW_ATTR_DEBUG 0x1
+#define LCK_RW_ATTR_DEBUGb 0
+#define LCK_RW_ATTR_STAT 0x2
+#define LCK_RW_ATTR_STATb 1
+#define LCK_RW_ATTR_READ_PRI 0x3
+#define LCK_RW_ATTR_READ_PRIb 2
+#define LCK_RW_ATTR_DIS_THREAD 0x40000000
+#define LCK_RW_ATTR_DIS_THREADb 30
+#define LCK_RW_ATTR_DIS_MYLOCK 0x10000000
+#define LCK_RW_ATTR_DIS_MYLOCKb 28
+
+#define LCK_RW_TAG_DESTROYED 0x00002007 /* lock marked as Destroyed */