ReactOS  0.4.14-dev-297-g23e575c
mdl.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: ReactOS kernel
4  * FILE: ntoskrnl/cc/mdl.c
5  * PURPOSE: Implements MDL Cache Manager Functions
6  *
7  * PROGRAMMERS: Alex Ionescu
8  */
9 
10 /* INCLUDES ******************************************************************/
11 
12 #include <ntoskrnl.h>
13 #define NDEBUG
14 #include <debug.h>
15 
16 /* FUNCTIONS *****************************************************************/
17 
18 /*
19  * @implemented
20  */
21 VOID
22 NTAPI
26  IN ULONG Length,
27  OUT PMDL * MdlChain,
29  )
30 {
31  CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu\n",
32  FileObject, FileOffset->QuadPart, Length);
33 
35 }
36 
37 /*
38  * NAME INTERNAL
39  * CcMdlReadComplete2@8
40  *
41  * DESCRIPTION
42  *
43  * ARGUMENTS
44  * MdlChain
45  * DeviceObject
46  *
47  * RETURN VALUE
48  * None.
49  *
50  * NOTE
51  * Used by CcMdlReadComplete@8 and FsRtl
52  *
53  */
54 VOID
55 NTAPI
59 )
60 {
61  PMDL Mdl;
62 
63  /* Free MDLs */
64  while ((Mdl = MemoryDescriptorList))
65  {
66  MemoryDescriptorList = Mdl->Next;
67  MmUnlockPages(Mdl);
68  IoFreeMdl(Mdl);
69  }
70 }
71 
72 /*
73  * NAME EXPORTED
74  * CcMdlReadComplete@8
75  *
76  * DESCRIPTION
77  *
78  * ARGUMENTS
79  *
80  * RETURN VALUE
81  * None.
82  *
83  * NOTE
84  * From Bo Branten's ntifs.h v13.
85  *
86  * @implemented
87  */
88 VOID
89 NTAPI
93 {
95  PFAST_IO_DISPATCH FastDispatch;
96 
97  /* Get Fast Dispatch Data */
99  FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
100 
101  /* Check if we support Fast Calls, and check this one */
102  if (FastDispatch && FastDispatch->MdlReadComplete)
103  {
104  /* Use the fast path */
105  FastDispatch->MdlReadComplete(FileObject,
106  MdlChain,
107  DeviceObject);
108  }
109 
110  /* Use slow path */
112 }
113 
114 /*
115  * @implemented
116  */
117 VOID
118 NTAPI
122  IN PMDL MdlChain)
123 {
125  PFAST_IO_DISPATCH FastDispatch;
126 
127  /* Get Fast Dispatch Data */
129  FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
130 
131  /* Check if we support Fast Calls, and check this one */
132  if (FastDispatch && FastDispatch->MdlWriteComplete)
133  {
134  /* Use the fast path */
135  FastDispatch->MdlWriteComplete(FileObject,
136  FileOffset,
137  MdlChain,
138  DeviceObject);
139  }
140 
141  /* Use slow path */
143 }
144 
145 VOID
146 NTAPI
150  IN PMDL MdlChain)
151 {
153 }
154 
155 /*
156  * @unimplemented
157  */
158 VOID
159 NTAPI
162  IN PMDL MdlChain)
163 {
165 }
166 
167 /*
168  * @unimplemented
169  */
170 VOID
171 NTAPI
175  IN ULONG Length,
176  OUT PMDL * MdlChain,
178 {
179  CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu\n",
180  FileObject, FileOffset->QuadPart, Length);
181 
183 }
#define IN
Definition: typedefs.h:38
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Outptr_ PMDL * MdlChain
Definition: fsrtlfuncs.h:46
VOID NTAPI MmUnlockPages(IN PMDL Mdl)
Definition: mdlsup.c:1439
PDEVICE_OBJECT NTAPI IoGetRelatedDeviceObject(IN PFILE_OBJECT FileObject)
Definition: device.c:1539
PFAST_IO_MDL_READ_COMPLETE MdlReadComplete
Definition: iotypes.h:1707
VOID NTAPI CcMdlWriteComplete2(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain)
Definition: mdl.c:147
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
VOID NTAPI CcMdlWriteComplete(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain)
Definition: mdl.c:119
_Inout_ PMDL MemoryDescriptorList
Definition: mmfuncs.h:406
VOID NTAPI CcMdlReadComplete2(IN PFILE_OBJECT FileObject, IN PMDL MemoryDescriptorList)
Definition: mdl.c:56
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define CC_API_DEBUG
Definition: cc.h:11
VOID NTAPI CcPrepareMdlWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, OUT PMDL *MdlChain, OUT PIO_STATUS_BLOCK IoStatus)
Definition: mdl.c:172
#define CCTRACE(x, fmt,...)
Definition: cc.h:36
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
* PFILE_OBJECT
Definition: iotypes.h:1955
VOID NTAPI IoFreeMdl(PMDL Mdl)
Definition: iomdl.c:146
VOID NTAPI CcMdlRead(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, OUT PMDL *MdlChain, OUT PIO_STATUS_BLOCK IoStatus)
Definition: mdl.c:23
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:151
VOID NTAPI CcMdlWriteAbort(IN PFILE_OBJECT FileObject, IN PMDL MdlChain)
Definition: mdl.c:160
VOID NTAPI CcMdlReadComplete(IN PFILE_OBJECT FileObject, IN PMDL MdlChain)
Definition: mdl.c:90
PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete
Definition: iotypes.h:1709
#define OUT
Definition: typedefs.h:39
unsigned int ULONG
Definition: retypes.h:1
#define UNIMPLEMENTED
Definition: debug.h:114