add some asserts

svn path=/trunk/; revision=14498
This commit is contained in:
Royce Mitchell III 2005-04-05 05:12:16 +00:00
parent 13027a8afa
commit f165c00432

View file

@ -4,7 +4,7 @@
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
* FILE: ntoskrnl/io/mdl.c * FILE: ntoskrnl/io/mdl.c
* PURPOSE: Io manager mdl functions * PURPOSE: Io manager mdl functions
* *
* PROGRAMMERS: David Welch (welch@mcmail.com) * PROGRAMMERS: David Welch (welch@mcmail.com)
*/ */
@ -32,7 +32,7 @@ IoAllocateMdl(PVOID VirtualAddress,
PIRP Irp) PIRP Irp)
{ {
PMDL Mdl; PMDL Mdl;
if (ChargeQuota) if (ChargeQuota)
{ {
// Mdl = ExAllocatePoolWithQuota(NonPagedPool, // Mdl = ExAllocatePoolWithQuota(NonPagedPool,
@ -48,27 +48,27 @@ IoAllocateMdl(PVOID VirtualAddress,
TAG_MDL); TAG_MDL);
} }
MmInitializeMdl(Mdl, (char*)VirtualAddress, Length); MmInitializeMdl(Mdl, (char*)VirtualAddress, Length);
if (Irp) if (Irp)
{ {
if (SecondaryBuffer) if (SecondaryBuffer)
{ {
ASSERT(Irp->MdlAddress); ASSERT(Irp->MdlAddress);
/* FIXME: add to end of list maybe?? */ /* FIXME: add to end of list maybe?? */
Mdl->Next = Irp->MdlAddress->Next; Mdl->Next = Irp->MdlAddress->Next;
Irp->MdlAddress->Next = Mdl; Irp->MdlAddress->Next = Mdl;
} }
else else
{ {
/* /*
* What if there's allready an mdl at Irp->MdlAddress? * What if there's allready an mdl at Irp->MdlAddress?
* Is that bad and should we do something about it? * Is that bad and should we do something about it?
*/ */
Irp->MdlAddress = Mdl; Irp->MdlAddress = Mdl;
} }
} }
return(Mdl); return(Mdl);
} }
@ -122,13 +122,16 @@ IoBuildPartialMdl(PMDL SourceMdl,
*/ */
VOID STDCALL VOID STDCALL
IoFreeMdl(PMDL Mdl) IoFreeMdl(PMDL Mdl)
{ {
/* /*
* This unmaps partial mdl's from kernel space but also asserts that non-partial * This unmaps partial mdl's from kernel space but also asserts that non-partial
* mdl's isn't still mapped into kernel space. * mdl's isn't still mapped into kernel space.
*/ */
ASSERT(Mdl);
ASSERT_IRQL(DISPATCH_LEVEL);
MmPrepareMdlForReuse(Mdl); MmPrepareMdlForReuse(Mdl);
ExFreePool(Mdl); ExFreePool(Mdl);
} }