[ros-diffs] [fireball] 46617: [NTOSKRNL/CONFIG] - Add more assert macros for registry operations: locked or loading, exclusively locked or loading, hash and KCB locks, locked for flushing. - Add macros for getting alloc page from KCB and delay alloc item.

fireball at svn.reactos.org fireball at svn.reactos.org
Wed Mar 31 15:25:51 CEST 2010


Author: fireball
Date: Wed Mar 31 15:25:51 2010
New Revision: 46617

URL: http://svn.reactos.org/svn/reactos?rev=46617&view=rev
Log:
[NTOSKRNL/CONFIG]
- Add more assert macros for registry operations: locked or loading, exclusively locked or loading, hash and KCB locks, locked for flushing.
- Add macros for getting alloc page from KCB and delay alloc item.

Modified:
    trunk/reactos/ntoskrnl/include/internal/cm_x.h

Modified: trunk/reactos/ntoskrnl/include/internal/cm_x.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/include/internal/cm_x.h?rev=46617&r1=46616&r2=46617&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/cm_x.h [iso-8859-1] (original)
+++ trunk/reactos/ntoskrnl/include/internal/cm_x.h [iso-8859-1] Wed Mar 31 15:25:51 2010
@@ -92,10 +92,26 @@
            (CmpTestRegistryLock() == TRUE))
 
 //
+// Makes sure that the registry is locked or loading
+//
+#define CMP_ASSERT_REGISTRY_LOCK_OR_LOADING(h)                      \
+    ASSERT((CmpSpecialBootCondition == TRUE) ||                     \
+           (((PCMHIVE)h)->HiveIsLoading == TRUE) ||                 \
+           (CmpTestRegistryLock() == TRUE))
+
+//
 // Makes sure that the registry is exclusively locked
 //
 #define CMP_ASSERT_EXCLUSIVE_REGISTRY_LOCK()                        \
     ASSERT((CmpSpecialBootCondition == TRUE) ||                     \
+           (CmpTestRegistryLockExclusive() == TRUE))
+
+//
+// Makes sure that the registry is exclusively locked or loading
+//
+#define CMP_ASSERT_EXCLUSIVE_REGISTRY_LOCK_OR_LOADING(h)            \
+    ASSERT((CmpSpecialBootCondition == TRUE) ||                     \
+           (((PCMHIVE)h)->HiveIsLoading == TRUE) ||                 \
            (CmpTestRegistryLockExclusive() == TRUE))
 
 //
@@ -256,7 +272,7 @@
 }
 
 //
-// Asserts that either the registry or the KCB is locked
+// Asserts that either the registry or the hash entry is locked
 //
 #define CMP_ASSERT_HASH_ENTRY_LOCK(k)                               \
 {                                                                   \
@@ -266,6 +282,15 @@
 }
 
 //
+// Asserts that either the registry or the KCB is locked
+//
+#define CMP_ASSERT_KCB_LOCK(k)                                      \
+{                                                                   \
+    ASSERT((CmpIsKcbLockedExclusive(k) == TRUE) ||                  \
+           (CmpTestRegistryLockExclusive() == TRUE));               \
+}
+
+//
 // Gets the page attached to the KCB
 //
 #define CmpGetAllocPageFromKcb(k)                                   \
@@ -276,3 +301,35 @@
 //
 #define CmpGetAllocPageFromDelayAlloc(a)                            \
     (PCM_ALLOC_PAGE)(((ULONG_PTR)(a)) & ~(PAGE_SIZE - 1))
+
+//
+// Makes sure that the registry is locked for flushes
+//
+#define CMP_ASSERT_FLUSH_LOCK(h)                                    \
+    ASSERT((CmpSpecialBootCondition == TRUE) ||                     \
+           (((PCMHIVE)h)->HiveIsLoading == TRUE) ||                 \
+           (CmpTestHiveFlusherLockShared((PCMHIVE)h) == TRUE) ||    \
+           (CmpTestHiveFlusherLockExclusive((PCMHIVE)h) == TRUE) || \
+           (CmpTestRegistryLockExclusive() == TRUE));
+
+//
+// Asserts that either the registry or the KCB is locked
+//
+#define CMP_ASSERT_HASH_ENTRY_LOCK(k)                               \
+{                                                                   \
+    ASSERT(((GET_HASH_ENTRY(CmpCacheTable, k).Owner ==              \
+            KeGetCurrentThread())) ||                               \
+           (CmpTestRegistryLockExclusive() == TRUE));               \
+}
+
+//
+// Gets the page attached to the KCB
+//
+#define CmpGetAllocPageFromKcb(k)                                   \
+    (PCM_ALLOC_PAGE)(((ULONG_PTR)(k)) & ~(PAGE_SIZE - 1))
+
+//
+// Gets the page attached to the delayed allocation
+//
+#define CmpGetAllocPageFromDelayAlloc(a)                            \
+    (PCM_ALLOC_PAGE)(((ULONG_PTR)(a)) & ~(PAGE_SIZE - 1))




More information about the Ros-diffs mailing list