VOID
NTAPI
+INIT_FUNCTION
CmpInitCmPrivateAlloc(VOID)
{
/* Make sure we didn't already do this */
VOID
NTAPI
+INIT_FUNCTION
CmpInitCmPrivateDelayAlloc(VOID)
{
/* Initialize the delay allocation list and lock */
KeAcquireGuardedMutex(&CmpAllocBucketLock);
/* Sanity check on lock ownership */
- //ASSERT((CmpIsKcbLockedExclusive(Kcb) == TRUE) ||
- // (CmpTestRegistryLockExclusive() == TRUE));
+ CMP_ASSERT_HASH_ENTRY_LOCK(Kcb->ConvKey);
/* Add us to the free list */
InsertTailList(&CmpFreeKCBListHead, &Kcb->FreeListEntry);
/* Get the allocation page */
- AllocPage = (PCM_ALLOC_PAGE)((ULONG_PTR)Kcb & 0xFFFFF000);
+ AllocPage = CmpGetAllocPageFromKcb(Kcb);
/* Sanity check */
ASSERT(AllocPage->FreeCount != CM_KCBS_PER_PAGE);
FreeListEntry);
/* Get the allocation page */
- AllocPage = (PCM_ALLOC_PAGE)((ULONG_PTR)CurrentKcb & 0xFFFFF000);
+ AllocPage = CmpGetAllocPageFromKcb(CurrentKcb);
/* Decrease the free count */
ASSERT(AllocPage->FreeCount != 0);
/* Set it up */
CurrentKcb->PrivateAlloc = TRUE;
CurrentKcb->DelayCloseEntry = NULL;
- InsertHeadList(&CmpFreeKCBListHead,
+ InsertTailList(&CmpFreeKCBListHead,
&CurrentKcb->FreeListEntry);
}
}
/* Allocate a KCB only */
- CurrentKcb = CmpAllocate(sizeof(CM_KEY_CONTROL_BLOCK),
- TRUE,
- TAG_CM);
+ CurrentKcb = CmpAllocate(sizeof(CM_KEY_CONTROL_BLOCK), TRUE, TAG_CM);
if (CurrentKcb)
{
/* Set it up */
Entry->ListEntry.Flink = Entry->ListEntry.Blink = NULL;
/* Grab the alloc page */
- AllocPage = (PCM_ALLOC_PAGE)((ULONG_PTR)Entry & 0xFFFFF000);
+ AllocPage = CmpGetAllocPageFromDelayAlloc(Entry);
/* Decrease free entries */
ASSERT(AllocPage->FreeCount != 0);
InsertTailList(&CmpFreeDelayItemsListHead, &AllocEntry->ListEntry);
/* Get the alloc page */
- AllocPage = (PCM_ALLOC_PAGE)((ULONG_PTR)Entry & 0xFFFFF000);
+ AllocPage = CmpGetAllocPageFromDelayAlloc(Entry);
ASSERT(AllocPage->FreeCount != CM_DELAYS_PER_PAGE);
/* Increase the number of free items */