mirror of
https://github.com/reactos/reactos.git
synced 2024-06-30 01:42:30 +00:00
[NTOSKRNL] Stubplement CcPinMappedData() and simplify CcPinRead()
It's based on the code that was in CcPinRead() implementation. This made no sense to have CcPinMappedData() doing nothing while implementing everything in CcPinRead(). Indeed, drivers (starting with MS drivers) can map data first and pin it afterwards with CcPinMappedData(). It was leading to incorrect behavior with our previous noop implementation.
This commit is contained in:
parent
a9f2677782
commit
469e15c7ae
|
@ -161,6 +161,7 @@ CcPinMappedData (
|
||||||
IN ULONG Flags,
|
IN ULONG Flags,
|
||||||
OUT PVOID * Bcb)
|
OUT PVOID * Bcb)
|
||||||
{
|
{
|
||||||
|
PINTERNAL_BCB iBcb;
|
||||||
PROS_SHARED_CACHE_MAP SharedCacheMap;
|
PROS_SHARED_CACHE_MAP SharedCacheMap;
|
||||||
|
|
||||||
CCTRACE(CC_API_DEBUG, "FileOffset=%p FileOffset=%p Length=%lu Flags=0x%lx\n",
|
CCTRACE(CC_API_DEBUG, "FileOffset=%p FileOffset=%p Length=%lu Flags=0x%lx\n",
|
||||||
|
@ -174,7 +175,21 @@ CcPinMappedData (
|
||||||
ASSERT(SharedCacheMap);
|
ASSERT(SharedCacheMap);
|
||||||
ASSERT(SharedCacheMap->PinAccess);
|
ASSERT(SharedCacheMap->PinAccess);
|
||||||
|
|
||||||
/* no-op for current implementation. */
|
iBcb = *Bcb;
|
||||||
|
ASSERT(iBcb->Pinned == FALSE);
|
||||||
|
|
||||||
|
iBcb->Pinned = TRUE;
|
||||||
|
iBcb->Vacb->PinCount++;
|
||||||
|
|
||||||
|
if (Flags & PIN_EXCLUSIVE)
|
||||||
|
{
|
||||||
|
ExAcquireResourceExclusiveLite(&iBcb->Lock, TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ExAcquireResourceSharedLite(&iBcb->Lock, TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,8 +206,6 @@ CcPinRead (
|
||||||
OUT PVOID * Bcb,
|
OUT PVOID * Bcb,
|
||||||
OUT PVOID * Buffer)
|
OUT PVOID * Buffer)
|
||||||
{
|
{
|
||||||
PINTERNAL_BCB iBcb;
|
|
||||||
|
|
||||||
CCTRACE(CC_API_DEBUG, "FileOffset=%p FileOffset=%p Length=%lu Flags=0x%lx\n",
|
CCTRACE(CC_API_DEBUG, "FileOffset=%p FileOffset=%p Length=%lu Flags=0x%lx\n",
|
||||||
FileObject, FileOffset, Length, Flags);
|
FileObject, FileOffset, Length, Flags);
|
||||||
|
|
||||||
|
@ -205,32 +218,20 @@ CcPinRead (
|
||||||
++CcPinReadNoWait;
|
++CcPinReadNoWait;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CcMapData(FileObject, FileOffset, Length, Flags, Bcb, Buffer))
|
/* Map first */
|
||||||
|
if (!CcMapData(FileObject, FileOffset, Length, Flags, Bcb, Buffer))
|
||||||
{
|
{
|
||||||
if (CcPinMappedData(FileObject, FileOffset, Length, Flags, Bcb))
|
return FALSE;
|
||||||
{
|
|
||||||
iBcb = *Bcb;
|
|
||||||
|
|
||||||
ASSERT(iBcb->Pinned == FALSE);
|
|
||||||
|
|
||||||
iBcb->Pinned = TRUE;
|
|
||||||
iBcb->Vacb->PinCount++;
|
|
||||||
|
|
||||||
if (Flags & PIN_EXCLUSIVE)
|
|
||||||
{
|
|
||||||
ExAcquireResourceExclusiveLite(&iBcb->Lock, TRUE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ExAcquireResourceSharedLite(&iBcb->Lock, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
CcUnpinData(*Bcb);
|
|
||||||
}
|
}
|
||||||
return FALSE;
|
|
||||||
|
/* Pin then */
|
||||||
|
if (!CcPinMappedData(FileObject, FileOffset, Length, Flags, Bcb))
|
||||||
|
{
|
||||||
|
CcUnpinData(*Bcb);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue