[NTOS:CC] Avoid some magic numbers.
authorThomas Faber <thomas.faber@reactos.org>
Tue, 20 Feb 2018 12:18:34 +0000 (13:18 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Thu, 22 Feb 2018 13:03:03 +0000 (14:03 +0100)
ntoskrnl/cc/cacheman.c
ntoskrnl/cc/copy.c
sdk/include/ndk/cctypes.h

index 9ef906e..a2f9a9b 100644 (file)
@@ -228,7 +228,7 @@ CcScheduleReadAhead (
         /* It's active now!
          * Be careful with the mask, you don't want to mess with node code
          */
-        InterlockedOr((volatile long *)&PrivateCacheMap->UlongFlags, 0x10000);
+        InterlockedOr((volatile long *)&PrivateCacheMap->UlongFlags, PRIVATE_CACHE_MAP_READ_AHEAD_ACTIVE);
         KeReleaseSpinLock(&PrivateCacheMap->ReadAheadSpinLock, OldIrql);
 
         /* Get a work item */
@@ -250,7 +250,7 @@ CcScheduleReadAhead (
 
         /* Fail path: lock again, and revert read ahead active */
         KeAcquireSpinLock(&PrivateCacheMap->ReadAheadSpinLock, &OldIrql);
-        InterlockedAnd((volatile long *)&PrivateCacheMap->UlongFlags, 0xFFFEFFFF);
+        InterlockedAnd((volatile long *)&PrivateCacheMap->UlongFlags, ~PRIVATE_CACHE_MAP_READ_AHEAD_ACTIVE);
     }
 
     /* Done (fail) */
index a907340..4328777 100644 (file)
@@ -594,7 +594,7 @@ Clear:
     {
         /* Mark read ahead as unactive */
         KeAcquireSpinLockAtDpcLevel(&PrivateCacheMap->ReadAheadSpinLock);
-        InterlockedAnd((volatile long *)&PrivateCacheMap->UlongFlags, 0xFFFEFFFF);
+        InterlockedAnd((volatile long *)&PrivateCacheMap->UlongFlags, ~PRIVATE_CACHE_MAP_READ_AHEAD_ACTIVE);
         KeReleaseSpinLockFromDpcLevel(&PrivateCacheMap->ReadAheadSpinLock);
     }
     KeReleaseQueuedSpinLock(LockQueueMasterLock, OldIrql);
index c07e967..ef5a57e 100644 (file)
@@ -61,6 +61,9 @@ typedef struct _PRIVATE_CACHE_MAP_FLAGS
     ULONG Available:14;
 } PRIVATE_CACHE_MAP_FLAGS;
 
+#define PRIVATE_CACHE_MAP_READ_AHEAD_ACTIVE     (1 << 16)
+#define PRIVATE_CACHE_MAP_READ_AHEAD_ENABLED    (1 << 17)
+
 typedef struct _PRIVATE_CACHE_MAP
 {
     union