mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
[NTOS:CM] Add KCB array lock function prototypes & Other Stuff
Implement CmpBuildAndLockKcbArray and CmpUnLockKcbArray prototypes, we'll gonna need these to do the locking/unlocking of KCBs stacked up in an array. In addition implement some CM constructs specifically for cache lookup implementation (more at documentation remarks). === DOCUMENTATION REMARKS === CMP_SUBKEY_LEVELS_DEPTH_LIMIT -- This is the limit of up to 32 subkey levels that the registry can permit. This is used in CmpComputeHashValue to ensure that we don't compute more than the limit of subkeys we're allowed to. CMP_KCBS_IN_ARRAY_LIMIT -- This is equal to CMP_SUBKEY_LEVELS_DEPTH_LIMIT plus the addition by 2. This construct is used as a limit of KCB elements the array can hold. 2 serves as an additional space for the array (one for the root object and another one as extra space so we don't blow up the stack array). CMP_LOCK_KCB_ARRAY_EXCLUSIVE & CMP_LOCK_KCB_ARRAY_SHARED -- These flags are used exclusively for CmpBuildAndLockKcbArray and CmpLockKcbArray. Their meaning are obvious. CM_HASH_CACHE_STACK -- A structure used to store the hashes of KCBs for locking. It is named "stack" because the way we store the hashes of KCBs is within an auxilliary "outer stack array".
This commit is contained in:
parent
8a335a3141
commit
c6230ba255
1 changed files with 39 additions and 0 deletions
|
@ -95,6 +95,12 @@
|
|||
#define CMP_ENLIST_KCB_LOCKED_SHARED 0x1
|
||||
#define CMP_ENLIST_KCB_LOCKED_EXCLUSIVE 0x2
|
||||
|
||||
//
|
||||
// CmpBuildAndLockKcbArray & CmpLockKcbArray Flags
|
||||
//
|
||||
#define CMP_LOCK_KCB_ARRAY_EXCLUSIVE 0x1
|
||||
#define CMP_LOCK_KCB_ARRAY_SHARED 0x2
|
||||
|
||||
//
|
||||
// Unload Flags
|
||||
//
|
||||
|
@ -119,6 +125,12 @@
|
|||
#define CM_DELAYS_PER_PAGE \
|
||||
((PAGE_SIZE - FIELD_OFFSET(CM_ALLOC_PAGE, AllocPage)) / sizeof(CM_DELAY_ALLOC))
|
||||
|
||||
//
|
||||
// Cache Lookup & KCB Array constructs
|
||||
//
|
||||
#define CMP_SUBKEY_LEVELS_DEPTH_LIMIT 32
|
||||
#define CMP_KCBS_IN_ARRAY_LIMIT (CMP_SUBKEY_LEVELS_DEPTH_LIMIT + 2)
|
||||
|
||||
//
|
||||
// Value Search Results
|
||||
//
|
||||
|
@ -402,6 +414,15 @@ typedef struct _HIVE_LIST_ENTRY
|
|||
BOOLEAN Allocate;
|
||||
} HIVE_LIST_ENTRY, *PHIVE_LIST_ENTRY;
|
||||
|
||||
//
|
||||
// Hash Cache Stack
|
||||
//
|
||||
typedef struct _CM_HASH_CACHE_STACK
|
||||
{
|
||||
UNICODE_STRING NameOfKey;
|
||||
ULONG ConvKey;
|
||||
} CM_HASH_CACHE_STACK, *PCM_HASH_CACHE_STACK;
|
||||
|
||||
//
|
||||
// Parse context for Key Object
|
||||
//
|
||||
|
@ -993,6 +1014,23 @@ DelistKeyBodyFromKCB(
|
|||
IN BOOLEAN LockHeld
|
||||
);
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
CmpUnLockKcbArray(
|
||||
_In_ PULONG LockedKcbs
|
||||
);
|
||||
|
||||
PULONG
|
||||
NTAPI
|
||||
CmpBuildAndLockKcbArray(
|
||||
_In_ PCM_HASH_CACHE_STACK HashCacheStack,
|
||||
_In_ ULONG KcbLockFlags,
|
||||
_In_ PCM_KEY_CONTROL_BLOCK Kcb,
|
||||
_Inout_ PULONG OuterStackArray,
|
||||
_In_ ULONG TotalRemainingSubkeys,
|
||||
_In_ ULONG MatchRemainSubkeyLevel
|
||||
);
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
CmpAcquireTwoKcbLocksExclusiveByKey(
|
||||
|
@ -1084,6 +1122,7 @@ CmpCreateLinkNode(
|
|||
IN PHHIVE Hive,
|
||||
IN HCELL_INDEX Cell,
|
||||
IN PACCESS_STATE AccessState,
|
||||
IN PULONG KcbsLocked,
|
||||
IN UNICODE_STRING Name,
|
||||
IN KPROCESSOR_MODE AccessMode,
|
||||
IN ULONG CreateOptions,
|
||||
|
|
Loading…
Reference in a new issue