https://git.reactos.org/?p=reactos.git;a=commitdiff;h=56e2bf2f9265ced788c1e…
commit 56e2bf2f9265ced788c1ef7c0a215811f6d63ca8
Author: Thomas Faber <thomas.faber(a)reactos.org>
AuthorDate: Tue Feb 20 13:18:34 2018 +0100
Commit: Thomas Faber <thomas.faber(a)reactos.org>
CommitDate: Thu Feb 22 14:03:03 2018 +0100
[NTOS:CC] Avoid some magic numbers.
---
ntoskrnl/cc/cacheman.c | 4 ++--
ntoskrnl/cc/copy.c | 2 +-
sdk/include/ndk/cctypes.h | 3 +++
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/ntoskrnl/cc/cacheman.c b/ntoskrnl/cc/cacheman.c
index 9ef906ee43..a2f9a9bb44 100644
--- a/ntoskrnl/cc/cacheman.c
+++ b/ntoskrnl/cc/cacheman.c
@@ -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) */
diff --git a/ntoskrnl/cc/copy.c b/ntoskrnl/cc/copy.c
index a90734000e..43287774a3 100644
--- a/ntoskrnl/cc/copy.c
+++ b/ntoskrnl/cc/copy.c
@@ -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);
diff --git a/sdk/include/ndk/cctypes.h b/sdk/include/ndk/cctypes.h
index c07e96732a..ef5a57eadb 100644
--- a/sdk/include/ndk/cctypes.h
+++ b/sdk/include/ndk/cctypes.h
@@ -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