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
CcMdlRead(IN PFILE_OBJECT FileObject,IN PLARGE_INTEGER FileOffset,IN ULONG Length,OUT PMDL * MdlChain,OUT PIO_STATUS_BLOCK IoStatus)23 CcMdlRead (
24 IN PFILE_OBJECT FileObject,
25 IN PLARGE_INTEGER FileOffset,
26 IN ULONG Length,
27 OUT PMDL * MdlChain,
28 OUT PIO_STATUS_BLOCK IoStatus
29 )
30 {
31 CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu\n",
32 FileObject, FileOffset->QuadPart, Length);
33
34 UNIMPLEMENTED;
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
CcMdlReadComplete2(IN PFILE_OBJECT FileObject,IN PMDL MemoryDescriptorList)56 CcMdlReadComplete2 (
57 IN PFILE_OBJECT FileObject,
58 IN PMDL MemoryDescriptorList
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
CcMdlReadComplete(IN PFILE_OBJECT FileObject,IN PMDL MdlChain)90 CcMdlReadComplete (
91 IN PFILE_OBJECT FileObject,
92 IN PMDL MdlChain)
93 {
94 PDEVICE_OBJECT DeviceObject = NULL;
95 PFAST_IO_DISPATCH FastDispatch;
96
97 /* Get Fast Dispatch Data */
98 DeviceObject = IoGetRelatedDeviceObject(FileObject);
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 if (FastDispatch->MdlReadComplete(FileObject,
106 MdlChain,
107 DeviceObject))
108 {
109 /* Request was handled */
110 return;
111 }
112 }
113
114 /* Use slow path */
115 CcMdlReadComplete2(FileObject, MdlChain);
116 }
117
118 /*
119 * @implemented
120 */
121 VOID
122 NTAPI
CcMdlWriteComplete(IN PFILE_OBJECT FileObject,IN PLARGE_INTEGER FileOffset,IN PMDL MdlChain)123 CcMdlWriteComplete (
124 IN PFILE_OBJECT FileObject,
125 IN PLARGE_INTEGER FileOffset,
126 IN PMDL MdlChain)
127 {
128 PDEVICE_OBJECT DeviceObject = NULL;
129 PFAST_IO_DISPATCH FastDispatch;
130
131 /* Get Fast Dispatch Data */
132 DeviceObject = IoGetRelatedDeviceObject(FileObject);
133 FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
134
135 /* Check if we support Fast Calls, and check this one */
136 if (FastDispatch && FastDispatch->MdlWriteComplete)
137 {
138 /* Use the fast path */
139 if (FastDispatch->MdlWriteComplete(FileObject,
140 FileOffset,
141 MdlChain,
142 DeviceObject))
143 {
144 /* Request was handled */
145 return;
146 }
147 }
148
149 /* Use slow path */
150 CcMdlWriteComplete2(FileObject,FileOffset, MdlChain);
151 }
152
153 VOID
154 NTAPI
CcMdlWriteComplete2(IN PFILE_OBJECT FileObject,IN PLARGE_INTEGER FileOffset,IN PMDL MdlChain)155 CcMdlWriteComplete2 (
156 IN PFILE_OBJECT FileObject,
157 IN PLARGE_INTEGER FileOffset,
158 IN PMDL MdlChain)
159 {
160 UNIMPLEMENTED;
161 }
162
163 /*
164 * @unimplemented
165 */
166 VOID
167 NTAPI
CcMdlWriteAbort(IN PFILE_OBJECT FileObject,IN PMDL MdlChain)168 CcMdlWriteAbort (
169 IN PFILE_OBJECT FileObject,
170 IN PMDL MdlChain)
171 {
172 UNIMPLEMENTED;
173 }
174
175 /*
176 * @unimplemented
177 */
178 VOID
179 NTAPI
CcPrepareMdlWrite(IN PFILE_OBJECT FileObject,IN PLARGE_INTEGER FileOffset,IN ULONG Length,OUT PMDL * MdlChain,OUT PIO_STATUS_BLOCK IoStatus)180 CcPrepareMdlWrite (
181 IN PFILE_OBJECT FileObject,
182 IN PLARGE_INTEGER FileOffset,
183 IN ULONG Length,
184 OUT PMDL * MdlChain,
185 OUT PIO_STATUS_BLOCK IoStatus)
186 {
187 CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu\n",
188 FileObject, FileOffset->QuadPart, Length);
189
190 UNIMPLEMENTED;
191 }
192