https://git.reactos.org/?p=reactos.git;a=commitdiff;h=8a335a3141dc698c517a76feec797549fed75040
commit 8a335a3141dc698c517a76feec797549fed75040 Author: George Bișoc <george.bi...@reactos.org> AuthorDate: Thu Feb 16 20:16:53 2023 +0100 Commit: George Bișoc <george.bi...@reactos.org> CommitDate: Sun Oct 1 20:06:00 2023 +0200 [NTOS:CM] Implement the shared lock macro for use CmpAcquireKcbLockSharedByKey can come in handy for use to lock KCBs by their convkey with a shared lock, specifically we would need this for cache lookup stuff. --- ntoskrnl/include/internal/cm_x.h | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/ntoskrnl/include/internal/cm_x.h b/ntoskrnl/include/internal/cm_x.h index daf7d67643b..5e7dffd2872 100644 --- a/ntoskrnl/include/internal/cm_x.h +++ b/ntoskrnl/include/internal/cm_x.h @@ -89,6 +89,14 @@ (GET_HASH_ENTRY(CmpCacheTable, \ (k)->ConvKey)->Owner == KeGetCurrentThread()) +// +// Shared acquires a KCB by index +// +#define CmpAcquireKcbLockSharedByIndex(i) \ +{ \ + ExAcquirePushLockShared(&CmpCacheTable[(i)].Lock); \ +} + // // Exclusively acquires a KCB by index // @@ -120,6 +128,16 @@ CmpAcquireKcbLockExclusiveByKey(IN ULONG ConvKey) CmpAcquireKcbLockExclusiveByIndex(GET_HASH_INDEX(ConvKey)); } +// +// Shared acquires a KCB by key +// +FORCEINLINE +VOID +CmpAcquireKcbLockSharedByKey( + _In_ ULONG ConvKey) +{ + CmpAcquireKcbLockSharedByIndex(GET_HASH_INDEX(ConvKey)); +} // // Shared acquires a KCB @@ -130,14 +148,6 @@ CmpAcquireKcbLockExclusiveByKey(IN ULONG ConvKey) (k)->ConvKey)->Lock); \ } -// -// Shared acquires a KCB by index -// -#define CmpAcquireKcbLockSharedByIndex(i) \ -{ \ - ExAcquirePushLockShared(&CmpCacheTable[(i)].Lock); \ -} - // // Tries to convert a KCB lock //