2008-03-09 14:11:42 +00:00
|
|
|
/*
|
2005-01-26 13:58:37 +00:00
|
|
|
* COPYRIGHT: See COPYING in the top level directory
|
2004-06-21 04:11:44 +00:00
|
|
|
* PROJECT: ReactOS kernel
|
2015-10-04 11:54:25 +00:00
|
|
|
* FILE: ntoskrnl/cc/mdl.c
|
2004-06-21 04:11:44 +00:00
|
|
|
* PURPOSE: Implements MDL Cache Manager Functions
|
2005-01-26 13:58:37 +00:00
|
|
|
*
|
|
|
|
* PROGRAMMERS: Alex Ionescu
|
2004-06-21 04:11:44 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* INCLUDES ******************************************************************/
|
|
|
|
|
2004-08-15 16:39:12 +00:00
|
|
|
#include <ntoskrnl.h>
|
2004-06-21 04:11:44 +00:00
|
|
|
#define NDEBUG
|
2008-08-30 16:31:06 +00:00
|
|
|
#include <debug.h>
|
2004-06-21 04:11:44 +00:00
|
|
|
|
|
|
|
/* FUNCTIONS *****************************************************************/
|
|
|
|
|
|
|
|
/*
|
2005-05-07 15:19:33 +00:00
|
|
|
* @implemented
|
2004-06-21 04:11:44 +00:00
|
|
|
*/
|
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2012-12-19 11:11:34 +00:00
|
|
|
CcMdlRead (
|
|
|
|
IN PFILE_OBJECT FileObject,
|
|
|
|
IN PLARGE_INTEGER FileOffset,
|
|
|
|
IN ULONG Length,
|
|
|
|
OUT PMDL * MdlChain,
|
|
|
|
OUT PIO_STATUS_BLOCK IoStatus
|
|
|
|
)
|
2004-06-21 04:11:44 +00:00
|
|
|
{
|
2014-11-29 21:43:39 +00:00
|
|
|
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu\n",
|
|
|
|
FileObject, FileOffset->QuadPart, Length);
|
|
|
|
|
2012-12-19 11:11:34 +00:00
|
|
|
UNIMPLEMENTED;
|
2004-06-21 04:11:44 +00:00
|
|
|
}
|
|
|
|
|
2005-05-07 15:19:33 +00:00
|
|
|
/*
|
2012-12-19 11:11:34 +00:00
|
|
|
* NAME INTERNAL
|
2007-01-21 21:01:57 +00:00
|
|
|
* CcMdlReadComplete2@8
|
2004-06-21 04:11:44 +00:00
|
|
|
*
|
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* ARGUMENTS
|
2005-05-07 15:19:33 +00:00
|
|
|
* MdlChain
|
|
|
|
* DeviceObject
|
|
|
|
*
|
2004-06-21 04:11:44 +00:00
|
|
|
* RETURN VALUE
|
2005-05-07 15:19:33 +00:00
|
|
|
* None.
|
2004-06-21 04:11:44 +00:00
|
|
|
*
|
|
|
|
* NOTE
|
2012-12-19 11:11:34 +00:00
|
|
|
* Used by CcMdlReadComplete@8 and FsRtl
|
2004-06-21 04:11:44 +00:00
|
|
|
*
|
|
|
|
*/
|
2005-05-09 01:38:29 +00:00
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2012-12-19 11:11:34 +00:00
|
|
|
CcMdlReadComplete2 (
|
2013-07-16 22:37:01 +00:00
|
|
|
IN PFILE_OBJECT FileObject,
|
|
|
|
IN PMDL MemoryDescriptorList
|
|
|
|
)
|
2004-06-21 04:11:44 +00:00
|
|
|
{
|
2005-05-07 15:19:33 +00:00
|
|
|
PMDL Mdl;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-05-07 15:19:33 +00:00
|
|
|
/* Free MDLs */
|
2007-01-21 04:46:38 +00:00
|
|
|
while ((Mdl = MemoryDescriptorList))
|
2005-05-07 15:19:33 +00:00
|
|
|
{
|
2007-01-21 04:46:38 +00:00
|
|
|
MemoryDescriptorList = Mdl->Next;
|
2005-05-07 15:19:33 +00:00
|
|
|
MmUnlockPages(Mdl);
|
|
|
|
IoFreeMdl(Mdl);
|
|
|
|
}
|
2004-06-21 04:11:44 +00:00
|
|
|
}
|
|
|
|
|
2005-05-07 15:19:33 +00:00
|
|
|
/*
|
|
|
|
* NAME EXPORTED
|
|
|
|
* CcMdlReadComplete@8
|
2004-06-21 04:11:44 +00:00
|
|
|
*
|
|
|
|
* DESCRIPTION
|
|
|
|
*
|
|
|
|
* ARGUMENTS
|
|
|
|
*
|
|
|
|
* RETURN VALUE
|
2005-05-07 15:19:33 +00:00
|
|
|
* None.
|
2004-06-21 04:11:44 +00:00
|
|
|
*
|
|
|
|
* NOTE
|
2005-05-07 15:19:33 +00:00
|
|
|
* From Bo Branten's ntifs.h v13.
|
2004-06-21 04:11:44 +00:00
|
|
|
*
|
2005-05-07 15:19:33 +00:00
|
|
|
* @implemented
|
2004-06-21 04:11:44 +00:00
|
|
|
*/
|
2005-05-07 15:19:33 +00:00
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2012-12-19 11:11:34 +00:00
|
|
|
CcMdlReadComplete (
|
|
|
|
IN PFILE_OBJECT FileObject,
|
|
|
|
IN PMDL MdlChain)
|
2004-06-21 04:11:44 +00:00
|
|
|
{
|
2005-05-07 15:19:33 +00:00
|
|
|
PDEVICE_OBJECT DeviceObject = NULL;
|
|
|
|
PFAST_IO_DISPATCH FastDispatch;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-05-07 15:19:33 +00:00
|
|
|
/* Get Fast Dispatch Data */
|
|
|
|
DeviceObject = IoGetRelatedDeviceObject(FileObject);
|
|
|
|
FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-05-07 15:19:33 +00:00
|
|
|
/* Check if we support Fast Calls, and check this one */
|
|
|
|
if (FastDispatch && FastDispatch->MdlReadComplete)
|
|
|
|
{
|
2020-10-31 14:18:02 +00:00
|
|
|
/* Use the fast path */
|
|
|
|
if (FastDispatch->MdlReadComplete(FileObject,
|
|
|
|
MdlChain,
|
|
|
|
DeviceObject))
|
|
|
|
{
|
|
|
|
/* Request was handled */
|
|
|
|
return;
|
|
|
|
}
|
2005-05-07 15:19:33 +00:00
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-05-07 15:19:33 +00:00
|
|
|
/* Use slow path */
|
2013-07-16 22:37:01 +00:00
|
|
|
CcMdlReadComplete2(FileObject, MdlChain);
|
2004-06-21 04:11:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
2005-05-07 15:19:33 +00:00
|
|
|
* @implemented
|
2004-06-21 04:11:44 +00:00
|
|
|
*/
|
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2012-12-19 11:11:34 +00:00
|
|
|
CcMdlWriteComplete (
|
|
|
|
IN PFILE_OBJECT FileObject,
|
|
|
|
IN PLARGE_INTEGER FileOffset,
|
|
|
|
IN PMDL MdlChain)
|
2004-06-21 04:11:44 +00:00
|
|
|
{
|
2005-05-07 15:19:33 +00:00
|
|
|
PDEVICE_OBJECT DeviceObject = NULL;
|
|
|
|
PFAST_IO_DISPATCH FastDispatch;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-05-07 15:19:33 +00:00
|
|
|
/* Get Fast Dispatch Data */
|
|
|
|
DeviceObject = IoGetRelatedDeviceObject(FileObject);
|
|
|
|
FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-05-07 15:19:33 +00:00
|
|
|
/* Check if we support Fast Calls, and check this one */
|
|
|
|
if (FastDispatch && FastDispatch->MdlWriteComplete)
|
|
|
|
{
|
2020-10-31 14:18:02 +00:00
|
|
|
/* Use the fast path */
|
|
|
|
if (FastDispatch->MdlWriteComplete(FileObject,
|
|
|
|
FileOffset,
|
|
|
|
MdlChain,
|
|
|
|
DeviceObject))
|
|
|
|
{
|
|
|
|
/* Request was handled */
|
|
|
|
return;
|
|
|
|
}
|
2005-05-07 15:19:33 +00:00
|
|
|
}
|
2005-05-09 01:38:29 +00:00
|
|
|
|
2005-05-07 15:19:33 +00:00
|
|
|
/* Use slow path */
|
2007-02-26 20:22:55 +00:00
|
|
|
CcMdlWriteComplete2(FileObject,FileOffset, MdlChain);
|
2005-05-07 15:19:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
VOID
|
2007-02-26 20:22:55 +00:00
|
|
|
NTAPI
|
2012-12-19 11:11:34 +00:00
|
|
|
CcMdlWriteComplete2 (
|
2007-02-26 20:22:55 +00:00
|
|
|
IN PFILE_OBJECT FileObject,
|
|
|
|
IN PLARGE_INTEGER FileOffset,
|
2012-12-19 11:11:34 +00:00
|
|
|
IN PMDL MdlChain)
|
2005-05-07 15:19:33 +00:00
|
|
|
{
|
|
|
|
UNIMPLEMENTED;
|
2004-06-21 04:11:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2004-06-21 04:11:44 +00:00
|
|
|
CcMdlWriteAbort (
|
|
|
|
IN PFILE_OBJECT FileObject,
|
2012-12-19 11:11:34 +00:00
|
|
|
IN PMDL MdlChain)
|
2004-06-21 04:11:44 +00:00
|
|
|
{
|
2012-12-19 11:11:34 +00:00
|
|
|
UNIMPLEMENTED;
|
2004-06-21 04:11:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
|
|
|
VOID
|
2008-11-29 20:47:48 +00:00
|
|
|
NTAPI
|
2004-06-21 04:11:44 +00:00
|
|
|
CcPrepareMdlWrite (
|
2012-12-19 11:11:34 +00:00
|
|
|
IN PFILE_OBJECT FileObject,
|
|
|
|
IN PLARGE_INTEGER FileOffset,
|
|
|
|
IN ULONG Length,
|
|
|
|
OUT PMDL * MdlChain,
|
|
|
|
OUT PIO_STATUS_BLOCK IoStatus)
|
2004-06-21 04:11:44 +00:00
|
|
|
{
|
2014-11-29 21:43:39 +00:00
|
|
|
CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu\n",
|
|
|
|
FileObject, FileOffset->QuadPart, Length);
|
|
|
|
|
2012-12-19 11:11:34 +00:00
|
|
|
UNIMPLEMENTED;
|
2004-06-21 04:11:44 +00:00
|
|
|
}
|