https://git.reactos.org/?p=reactos.git;a=commitdiff;h=02da7b452c413c05d6863…
commit 02da7b452c413c05d6863b03eb2d2479d25060d4
Author: Pierre Schweitzer <pierre(a)reactos.org>
AuthorDate: Sun Sep 9 11:14:42 2018 +0200
Commit: Pierre Schweitzer <pierre(a)reactos.org>
CommitDate: Sun Sep 9 14:02:13 2018 +0200
[NTOSKRNL] Move data mapping implementation to an internel helper
---
ntoskrnl/cc/pin.c | 58 ++++++++++++++++++++++++++++++++++++-------------------
1 file changed, 38 insertions(+), 20 deletions(-)
diff --git a/ntoskrnl/cc/pin.c b/ntoskrnl/cc/pin.c
index d96c64bc2f..3c8747e76b 100644
--- a/ntoskrnl/cc/pin.c
+++ b/ntoskrnl/cc/pin.c
@@ -31,12 +31,10 @@ ULONG CcPinReadNoWait = 0;
/* FUNCTIONS *****************************************************************/
-/*
- * @implemented
- */
+static
BOOLEAN
NTAPI
-CcMapData (
+CcpMapData(
IN PFILE_OBJECT FileObject,
IN PLARGE_INTEGER FileOffset,
IN ULONG Length,
@@ -53,19 +51,6 @@ CcMapData (
LONGLONG ROffset;
KIRQL OldIrql;
- DPRINT("CcMapData(FileObject 0x%p, FileOffset %I64x, Length %lu, Flags
0x%lx,"
- " pBcb 0x%p, pBuffer 0x%p)\n", FileObject, FileOffset->QuadPart,
- Length, Flags, pBcb, pBuffer);
-
- if (Flags & MAP_WAIT)
- {
- ++CcMapDataWait;
- }
- else
- {
- ++CcMapDataNoWait;
- }
-
ReadOffset = FileOffset->QuadPart;
ASSERT(FileObject);
@@ -160,11 +145,44 @@ CcMapData (
InsertTailList(&SharedCacheMap->BcbList, &iBcb->BcbEntry);
KeReleaseSpinLock(&SharedCacheMap->BcbSpinLock, OldIrql);
- CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx ->
TRUE Bcb=%p\n",
- FileObject, FileOffset, Length, Flags, iBcb);
return TRUE;
}
+/*
+ * @implemented
+ */
+BOOLEAN
+NTAPI
+CcMapData (
+ IN PFILE_OBJECT FileObject,
+ IN PLARGE_INTEGER FileOffset,
+ IN ULONG Length,
+ IN ULONG Flags,
+ OUT PVOID *pBcb,
+ OUT PVOID *pBuffer)
+{
+ BOOLEAN Ret;
+
+ DPRINT("CcMapData(FileObject 0x%p, FileOffset %I64x, Length %lu, Flags
0x%lx,"
+ " pBcb 0x%p, pBuffer 0x%p)\n", FileObject, FileOffset->QuadPart,
+ Length, Flags, pBcb, pBuffer);
+
+ if (Flags & MAP_WAIT)
+ {
+ ++CcMapDataWait;
+ }
+ else
+ {
+ ++CcMapDataNoWait;
+ }
+
+ Ret = CcpMapData(FileObject, FileOffset, Length, Flags, pBcb, pBuffer);
+
+ CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%p Length=%lu Flags=0x%lx ->
%d Bcb=%p\n",
+ FileObject, FileOffset, Length, Flags, Ret, *pBcb);
+ return Ret;
+}
+
/*
* @unimplemented
*/
@@ -246,7 +264,7 @@ CcPinRead (
}
/* Map first */
- if (!CcMapData(FileObject, FileOffset, Length, Flags, Bcb, Buffer))
+ if (!CcpMapData(FileObject, FileOffset, Length, Flags, Bcb, Buffer))
{
return FALSE;
}