1 #ifndef __CROSS_NT_RWLOCK__H__ 2 #define __CROSS_NT_RWLOCK__H__ 3 4 #ifndef MAXIMUM_PROCESSORS 5 #define MAXIMUM_PROCESSORS 32 6 #endif 7 8 typedef union _NDIS_RW_LOCK_REFCOUNT { 9 unsigned int RefCount; 10 UCHAR cacheLine[16]; // One refCount per cache line 11 } NDIS_RW_LOCK_REFCOUNT; 12 13 typedef struct _NDIS_RW_LOCK { 14 union { 15 struct { 16 KSPIN_LOCK SpinLock; 17 PVOID Context; 18 }; 19 UCHAR Reserved[16]; 20 }; 21 22 NDIS_RW_LOCK_REFCOUNT RefCount[MAXIMUM_PROCESSORS]; 23 } NDIS_RW_LOCK, *PNDIS_RW_LOCK; 24 25 typedef struct _LOCK_STATE { 26 USHORT LockState; 27 KIRQL OldIrql; 28 } LOCK_STATE, *PLOCK_STATE; 29 30 #define RWLOCK_STATE_FREE 0 31 #define RWLOCK_STATE_READ_ACQUIRED 1 32 #define RWLOCK_STATE_WRITE_ACQUIRED 2 33 #define RWLOCK_STATE_RECURSIVE 3 34 #define RWLOCK_STATE_RELEASED 0xffff 35 36 #define RWLOCK_FOR_WRITE TRUE 37 #define RWLOCK_FOR_READ FALSE 38 39 #endif /* __CROSS_NT_RWLOCK__H__ */ 40