forget update de.rc
[reactos.git] / reactos / ntoskrnl / cc / mdl.c
1 /* $Id$
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/cc/fs.c
6 * PURPOSE: Implements MDL Cache Manager Functions
7 *
8 * PROGRAMMERS: Alex Ionescu
9 */
10
11 /* INCLUDES ******************************************************************/
12
13 #include <ntoskrnl.h>
14 #define NDEBUG
15 #include <internal/debug.h>
16
17 /* FUNCTIONS *****************************************************************/
18
19 /*
20 * @implemented
21 */
22 VOID
23 STDCALL
24 CcMdlRead(
25 IN PFILE_OBJECT FileObject,
26 IN PLARGE_INTEGER FileOffset,
27 IN ULONG Length,
28 OUT PMDL * MdlChain,
29 OUT PIO_STATUS_BLOCK IoStatus
30 )
31 {
32 UNIMPLEMENTED;
33 }
34
35 /*
36 * NAME INTERNAL
37 * CcMdlReadCompleteDev@8
38 *
39 * DESCRIPTION
40 *
41 * ARGUMENTS
42 * MdlChain
43 * DeviceObject
44 *
45 * RETURN VALUE
46 * None.
47 *
48 * NOTE
49 * Used by CcMdlReadComplete@8 and FsRtl
50 *
51 */
52 VOID
53 STDCALL
54 CcMdlReadCompleteDev(IN PMDL MdlChain,
55 IN PFILE_OBJECT FileObject)
56 {
57 PMDL Mdl;
58
59 /* Free MDLs */
60 while ((Mdl = MdlChain))
61 {
62 MdlChain = Mdl->Next;
63 MmUnlockPages(Mdl);
64 IoFreeMdl(Mdl);
65 }
66 }
67
68 /*
69 * NAME EXPORTED
70 * CcMdlReadComplete@8
71 *
72 * DESCRIPTION
73 *
74 * ARGUMENTS
75 *
76 * RETURN VALUE
77 * None.
78 *
79 * NOTE
80 * From Bo Branten's ntifs.h v13.
81 *
82 * @implemented
83 */
84 VOID
85 STDCALL
86 CcMdlReadComplete(IN PFILE_OBJECT FileObject,
87 IN PMDL MdlChain)
88 {
89 PDEVICE_OBJECT DeviceObject = NULL;
90 PFAST_IO_DISPATCH FastDispatch;
91
92 /* Get Fast Dispatch Data */
93 DeviceObject = IoGetRelatedDeviceObject(FileObject);
94 FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
95
96 /* Check if we support Fast Calls, and check this one */
97 if (FastDispatch && FastDispatch->MdlReadComplete)
98 {
99 /* Use the fast path */
100 FastDispatch->MdlReadComplete(FileObject,
101 MdlChain,
102 DeviceObject);
103 }
104
105 /* Use slow path */
106 CcMdlReadCompleteDev(MdlChain, FileObject);
107 }
108
109 /*
110 * @implemented
111 */
112 VOID
113 STDCALL
114 CcMdlWriteComplete(IN PFILE_OBJECT FileObject,
115 IN PLARGE_INTEGER FileOffset,
116 IN PMDL MdlChain)
117 {
118 PDEVICE_OBJECT DeviceObject = NULL;
119 PFAST_IO_DISPATCH FastDispatch;
120
121 /* Get Fast Dispatch Data */
122 DeviceObject = IoGetRelatedDeviceObject(FileObject);
123 FastDispatch = DeviceObject->DriverObject->FastIoDispatch;
124
125 /* Check if we support Fast Calls, and check this one */
126 if (FastDispatch && FastDispatch->MdlWriteComplete)
127 {
128 /* Use the fast path */
129 FastDispatch->MdlWriteComplete(FileObject,
130 FileOffset,
131 MdlChain,
132 DeviceObject);
133 }
134
135 /* Use slow path */
136 CcMdlWriteCompleteDev(FileOffset, MdlChain, FileObject);
137 }
138
139 VOID
140 STDCALL
141 CcMdlWriteCompleteDev(IN PLARGE_INTEGER FileOffset,
142 IN PMDL MdlChain,
143 IN PFILE_OBJECT FileObject)
144 {
145 UNIMPLEMENTED;
146 }
147
148 /*
149 * @unimplemented
150 */
151 VOID
152 STDCALL
153 CcMdlWriteAbort (
154 IN PFILE_OBJECT FileObject,
155 IN PMDL MdlChain
156 )
157 {
158 UNIMPLEMENTED;
159 }
160
161 /*
162 * @unimplemented
163 */
164 VOID
165 STDCALL
166 CcPrepareMdlWrite (
167 IN PFILE_OBJECT FileObject,
168 IN PLARGE_INTEGER FileOffset,
169 IN ULONG Length,
170 OUT PMDL * MdlChain,
171 OUT PIO_STATUS_BLOCK IoStatus
172 )
173 {
174 UNIMPLEMENTED;
175 }