[NTOS]: Remove trailing whitespace ; Use a correct pool tag in the CmpFree() call in CmpFreeDelayItem().

svn path=/trunk/; revision=75063
This commit is contained in:
Hermès Bélusca-Maïto 2017-06-16 20:44:51 +00:00
parent 098839afec
commit 89d7d06790

View file

@ -55,11 +55,11 @@ CmpFreeKeyControlBlock(IN PCM_KEY_CONTROL_BLOCK Kcb)
ULONG i; ULONG i;
PCM_ALLOC_PAGE AllocPage; PCM_ALLOC_PAGE AllocPage;
PAGED_CODE(); PAGED_CODE();
/* Sanity checks */ /* Sanity checks */
ASSERT(IsListEmpty(&Kcb->KeyBodyListHead) == TRUE); ASSERT(IsListEmpty(&Kcb->KeyBodyListHead) == TRUE);
for (i = 0; i < 4; i++) ASSERT(Kcb->KeyBodyArray[i] == NULL); for (i = 0; i < 4; i++) ASSERT(Kcb->KeyBodyArray[i] == NULL);
/* Check if it wasn't privately allocated */ /* Check if it wasn't privately allocated */
if (!Kcb->PrivateAlloc) if (!Kcb->PrivateAlloc)
{ {
@ -67,22 +67,22 @@ CmpFreeKeyControlBlock(IN PCM_KEY_CONTROL_BLOCK Kcb)
CmpFree(Kcb, TAG_KCB); CmpFree(Kcb, TAG_KCB);
return; return;
} }
/* Acquire the private allocation lock */ /* Acquire the private allocation lock */
KeAcquireGuardedMutex(&CmpAllocBucketLock); KeAcquireGuardedMutex(&CmpAllocBucketLock);
/* Sanity check on lock ownership */ /* Sanity check on lock ownership */
CMP_ASSERT_HASH_ENTRY_LOCK(Kcb->ConvKey); CMP_ASSERT_HASH_ENTRY_LOCK(Kcb->ConvKey);
/* Add us to the free list */ /* Add us to the free list */
InsertTailList(&CmpFreeKCBListHead, &Kcb->FreeListEntry); InsertTailList(&CmpFreeKCBListHead, &Kcb->FreeListEntry);
/* Get the allocation page */ /* Get the allocation page */
AllocPage = CmpGetAllocPageFromKcb(Kcb); AllocPage = CmpGetAllocPageFromKcb(Kcb);
/* Sanity check */ /* Sanity check */
ASSERT(AllocPage->FreeCount != CM_KCBS_PER_PAGE); ASSERT(AllocPage->FreeCount != CM_KCBS_PER_PAGE);
/* Increase free count */ /* Increase free count */
if (++AllocPage->FreeCount == CM_KCBS_PER_PAGE) if (++AllocPage->FreeCount == CM_KCBS_PER_PAGE)
{ {
@ -93,15 +93,15 @@ CmpFreeKeyControlBlock(IN PCM_KEY_CONTROL_BLOCK Kcb)
Kcb = (PVOID)((ULONG_PTR)AllocPage + Kcb = (PVOID)((ULONG_PTR)AllocPage +
FIELD_OFFSET(CM_ALLOC_PAGE, AllocPage) + FIELD_OFFSET(CM_ALLOC_PAGE, AllocPage) +
i * sizeof(CM_KEY_CONTROL_BLOCK)); i * sizeof(CM_KEY_CONTROL_BLOCK));
/* Remove the entry */ /* Remove the entry */
RemoveEntryList(&Kcb->FreeListEntry); RemoveEntryList(&Kcb->FreeListEntry);
} }
/* Free the page */ /* Free the page */
CmpFree(AllocPage, TAG_KCB); CmpFree(AllocPage, TAG_KCB);
} }
/* Release the lock */ /* Release the lock */
KeReleaseGuardedMutex(&CmpAllocBucketLock); KeReleaseGuardedMutex(&CmpAllocBucketLock);
} }
@ -121,43 +121,43 @@ CmpAllocateKeyControlBlock(VOID)
{ {
/* They are, acquire the bucket lock */ /* They are, acquire the bucket lock */
KeAcquireGuardedMutex(&CmpAllocBucketLock); KeAcquireGuardedMutex(&CmpAllocBucketLock);
/* See if there's something on the free KCB list */ /* See if there's something on the free KCB list */
SearchKcbList: SearchKcbList:
if (!IsListEmpty(&CmpFreeKCBListHead)) if (!IsListEmpty(&CmpFreeKCBListHead))
{ {
/* Remove the entry */ /* Remove the entry */
NextEntry = RemoveHeadList(&CmpFreeKCBListHead); NextEntry = RemoveHeadList(&CmpFreeKCBListHead);
/* Get the KCB */ /* Get the KCB */
CurrentKcb = CONTAINING_RECORD(NextEntry, CurrentKcb = CONTAINING_RECORD(NextEntry,
CM_KEY_CONTROL_BLOCK, CM_KEY_CONTROL_BLOCK,
FreeListEntry); FreeListEntry);
/* Get the allocation page */ /* Get the allocation page */
AllocPage = CmpGetAllocPageFromKcb(CurrentKcb); AllocPage = CmpGetAllocPageFromKcb(CurrentKcb);
/* Decrease the free count */ /* Decrease the free count */
ASSERT(AllocPage->FreeCount != 0); ASSERT(AllocPage->FreeCount != 0);
AllocPage->FreeCount--; AllocPage->FreeCount--;
/* Make sure this KCB is privately allocated */ /* Make sure this KCB is privately allocated */
ASSERT(CurrentKcb->PrivateAlloc == 1); ASSERT(CurrentKcb->PrivateAlloc == 1);
/* Release the allocation lock */ /* Release the allocation lock */
KeReleaseGuardedMutex(&CmpAllocBucketLock); KeReleaseGuardedMutex(&CmpAllocBucketLock);
/* Return the KCB */ /* Return the KCB */
return CurrentKcb; return CurrentKcb;
} }
/* Allocate an allocation page */ /* Allocate an allocation page */
AllocPage = CmpAllocate(PAGE_SIZE, TRUE, TAG_KCB); AllocPage = CmpAllocate(PAGE_SIZE, TRUE, TAG_KCB);
if (AllocPage) if (AllocPage)
{ {
/* Set default entries */ /* Set default entries */
AllocPage->FreeCount = CM_KCBS_PER_PAGE; AllocPage->FreeCount = CM_KCBS_PER_PAGE;
/* Loop each entry */ /* Loop each entry */
for (i = 0; i < CM_KCBS_PER_PAGE; i++) for (i = 0; i < CM_KCBS_PER_PAGE; i++)
{ {
@ -165,14 +165,14 @@ SearchKcbList:
CurrentKcb = (PVOID)((ULONG_PTR)AllocPage + CurrentKcb = (PVOID)((ULONG_PTR)AllocPage +
FIELD_OFFSET(CM_ALLOC_PAGE, AllocPage) + FIELD_OFFSET(CM_ALLOC_PAGE, AllocPage) +
i * sizeof(CM_KEY_CONTROL_BLOCK)); i * sizeof(CM_KEY_CONTROL_BLOCK));
/* Set it up */ /* Set it up */
CurrentKcb->PrivateAlloc = TRUE; CurrentKcb->PrivateAlloc = TRUE;
CurrentKcb->DelayCloseEntry = NULL; CurrentKcb->DelayCloseEntry = NULL;
InsertTailList(&CmpFreeKCBListHead, InsertTailList(&CmpFreeKCBListHead,
&CurrentKcb->FreeListEntry); &CurrentKcb->FreeListEntry);
} }
/* Now go back and search the list */ /* Now go back and search the list */
goto SearchKcbList; goto SearchKcbList;
} }
@ -186,7 +186,7 @@ SearchKcbList:
CurrentKcb->PrivateAlloc = 0; CurrentKcb->PrivateAlloc = 0;
CurrentKcb->DelayCloseEntry = NULL; CurrentKcb->DelayCloseEntry = NULL;
} }
/* Return it */ /* Return it */
return CurrentKcb; return CurrentKcb;
} }
@ -200,42 +200,42 @@ CmpAllocateDelayItem(VOID)
ULONG i; ULONG i;
PLIST_ENTRY NextEntry; PLIST_ENTRY NextEntry;
PAGED_CODE(); PAGED_CODE();
/* Lock the allocation buckets */ /* Lock the allocation buckets */
KeAcquireGuardedMutex(&CmpDelayAllocBucketLock); KeAcquireGuardedMutex(&CmpDelayAllocBucketLock);
/* Look for an item on the free list */ /* Look for an item on the free list */
SearchList: SearchList:
if (!IsListEmpty(&CmpFreeDelayItemsListHead)) if (!IsListEmpty(&CmpFreeDelayItemsListHead))
{ {
/* Get the current entry in the list */ /* Get the current entry in the list */
NextEntry = RemoveHeadList(&CmpFreeDelayItemsListHead); NextEntry = RemoveHeadList(&CmpFreeDelayItemsListHead);
/* Grab the item */ /* Grab the item */
Entry = CONTAINING_RECORD(NextEntry, CM_DELAY_ALLOC, ListEntry); Entry = CONTAINING_RECORD(NextEntry, CM_DELAY_ALLOC, ListEntry);
/* Clear the list */ /* Clear the list */
Entry->ListEntry.Flink = Entry->ListEntry.Blink = NULL; Entry->ListEntry.Flink = Entry->ListEntry.Blink = NULL;
/* Grab the alloc page */ /* Grab the alloc page */
AllocPage = CmpGetAllocPageFromDelayAlloc(Entry); AllocPage = CmpGetAllocPageFromDelayAlloc(Entry);
/* Decrease free entries */ /* Decrease free entries */
ASSERT(AllocPage->FreeCount != 0); ASSERT(AllocPage->FreeCount != 0);
AllocPage->FreeCount--; AllocPage->FreeCount--;
/* Release the lock */ /* Release the lock */
KeReleaseGuardedMutex(&CmpDelayAllocBucketLock); KeReleaseGuardedMutex(&CmpDelayAllocBucketLock);
return Entry; return Entry;
} }
/* Allocate an allocation page */ /* Allocate an allocation page */
AllocPage = CmpAllocate(PAGE_SIZE, TRUE, TAG_CM); AllocPage = CmpAllocate(PAGE_SIZE, TRUE, TAG_CM);
if (AllocPage) if (AllocPage)
{ {
/* Set default entries */ /* Set default entries */
AllocPage->FreeCount = CM_DELAYS_PER_PAGE; AllocPage->FreeCount = CM_DELAYS_PER_PAGE;
/* Loop each entry */ /* Loop each entry */
for (i = 0; i < CM_DELAYS_PER_PAGE; i++) for (i = 0; i < CM_DELAYS_PER_PAGE; i++)
{ {
@ -245,7 +245,7 @@ SearchList:
i * sizeof(CM_DELAY_ALLOC)); i * sizeof(CM_DELAY_ALLOC));
InsertTailList(&CmpFreeDelayItemsListHead, InsertTailList(&CmpFreeDelayItemsListHead,
&Entry->ListEntry); &Entry->ListEntry);
/* Clear the KCB pointer */ /* Clear the KCB pointer */
Entry->Kcb = NULL; Entry->Kcb = NULL;
} }
@ -256,7 +256,7 @@ SearchList:
KeReleaseGuardedMutex(&CmpDelayAllocBucketLock); KeReleaseGuardedMutex(&CmpDelayAllocBucketLock);
return NULL; return NULL;
} }
/* Do the search again */ /* Do the search again */
goto SearchList; goto SearchList;
} }
@ -269,17 +269,17 @@ CmpFreeDelayItem(PVOID Entry)
PCM_ALLOC_PAGE AllocPage; PCM_ALLOC_PAGE AllocPage;
ULONG i; ULONG i;
PAGED_CODE(); PAGED_CODE();
/* Lock the table */ /* Lock the table */
KeAcquireGuardedMutex(&CmpDelayAllocBucketLock); KeAcquireGuardedMutex(&CmpDelayAllocBucketLock);
/* Add the entry at the end */ /* Add the entry at the end */
InsertTailList(&CmpFreeDelayItemsListHead, &AllocEntry->ListEntry); InsertTailList(&CmpFreeDelayItemsListHead, &AllocEntry->ListEntry);
/* Get the alloc page */ /* Get the alloc page */
AllocPage = CmpGetAllocPageFromDelayAlloc(Entry); AllocPage = CmpGetAllocPageFromDelayAlloc(Entry);
ASSERT(AllocPage->FreeCount != CM_DELAYS_PER_PAGE); ASSERT(AllocPage->FreeCount != CM_DELAYS_PER_PAGE);
/* Increase the number of free items */ /* Increase the number of free items */
if (++AllocPage->FreeCount == CM_DELAYS_PER_PAGE) if (++AllocPage->FreeCount == CM_DELAYS_PER_PAGE)
{ {
@ -292,11 +292,11 @@ CmpFreeDelayItem(PVOID Entry)
i * sizeof(CM_DELAY_ALLOC)); i * sizeof(CM_DELAY_ALLOC));
RemoveEntryList(&AllocEntry->ListEntry); RemoveEntryList(&AllocEntry->ListEntry);
} }
/* Now free the page */ /* Now free the page */
CmpFree(AllocPage, 0); CmpFree(AllocPage, TAG_CM);
} }
/* Release the lock */ /* Release the lock */
KeReleaseGuardedMutex(&CmpDelayAllocBucketLock); KeReleaseGuardedMutex(&CmpDelayAllocBucketLock);
} }