[NTOSKRNL]
[reactos.git] / reactos / ntoskrnl / fsrtl / largemcb.c
1 /*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/fsrtl/largemcb.c
5 * PURPOSE: Mapping Control Block (MCB) support for File System Drivers
6 * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
7 */
8
9 /* INCLUDES ******************************************************************/
10
11 #include <ntoskrnl.h>
12 #define NDEBUG
13 #include <debug.h>
14
15 /* PUBLIC FUNCTIONS **********************************************************/
16
17 /*
18 * @unimplemented
19 */
20 BOOLEAN
21 NTAPI
22 FsRtlAddLargeMcbEntry(IN PLARGE_MCB Mcb,
23 IN LONGLONG Vbn,
24 IN LONGLONG Lbn,
25 IN LONGLONG SectorCount)
26 {
27 KeBugCheck(FILE_SYSTEM);
28 return FALSE;
29 }
30
31 /*
32 * @implemented
33 */
34 BOOLEAN
35 NTAPI
36 FsRtlAddMcbEntry(IN PMCB Mcb,
37 IN VBN Vbn,
38 IN LBN Lbn,
39 IN ULONG SectorCount)
40 {
41 /* Call the newer function */
42 return FsRtlAddLargeMcbEntry(&Mcb->
43 DummyFieldThatSizesThisStructureCorrectly,
44 (LONGLONG)Vbn,
45 (LONGLONG)Lbn,
46 (LONGLONG)SectorCount);
47 }
48
49 /*
50 * @unimplemented
51 */
52 BOOLEAN
53 NTAPI
54 FsRtlGetNextLargeMcbEntry(IN PLARGE_MCB Mcb,
55 IN ULONG RunIndex,
56 OUT PLONGLONG Vbn,
57 OUT PLONGLONG Lbn,
58 OUT PLONGLONG SectorCount)
59 {
60 KeBugCheck(FILE_SYSTEM);
61 *Vbn = 0;
62 *Lbn = 0;
63 *SectorCount= 0;
64 return FALSE;
65 }
66
67 /*
68 * @implemented
69 */
70 BOOLEAN
71 NTAPI
72 FsRtlGetNextMcbEntry(IN PMCB Mcb,
73 IN ULONG RunIndex,
74 OUT PVBN Vbn,
75 OUT PLBN Lbn,
76 OUT PULONG SectorCount)
77 {
78 BOOLEAN Return = FALSE;
79 LONGLONG llVbn;
80 LONGLONG llLbn;
81 LONGLONG llSectorCount;
82
83 /* Call the Large version */
84 Return = FsRtlGetNextLargeMcbEntry(
85 &Mcb->DummyFieldThatSizesThisStructureCorrectly,
86 RunIndex,
87 &llVbn,
88 &llLbn,
89 &llSectorCount);
90
91 /* Return the lower 32 bits */
92 *Vbn = (ULONG)llVbn;
93 *Lbn = (ULONG)llLbn;
94 *SectorCount = (ULONG)llSectorCount;
95
96 /* And return the original value */
97 return Return;
98 }
99
100 /*
101 * @unimplemented
102 */
103 VOID
104 NTAPI
105 FsRtlInitializeLargeMcb(IN PLARGE_MCB Mcb,
106 IN POOL_TYPE PoolType)
107 {
108 KeBugCheck(FILE_SYSTEM);
109 }
110
111 /*
112 * @implemented
113 */
114 VOID
115 NTAPI
116 FsRtlInitializeMcb(IN PMCB Mcb,
117 IN POOL_TYPE PoolType)
118 {
119 /* Call the newer function */
120 FsRtlInitializeLargeMcb(&Mcb->DummyFieldThatSizesThisStructureCorrectly,
121 PoolType);
122 }
123
124 /*
125 * @unimplemented
126 */
127 BOOLEAN
128 NTAPI
129 FsRtlLookupLargeMcbEntry(IN PLARGE_MCB Mcb,
130 IN LONGLONG Vbn,
131 OUT PLONGLONG Lbn OPTIONAL,
132 OUT PLONGLONG SectorCountFromLbn OPTIONAL,
133 OUT PLONGLONG StartingLbn OPTIONAL,
134 OUT PLONGLONG SectorCountFromStartingLbn OPTIONAL,
135 OUT PULONG Index OPTIONAL)
136 {
137 KeBugCheck(FILE_SYSTEM);
138 *Lbn = 0;
139 *SectorCountFromLbn = 0;
140 return FALSE;
141 }
142
143 /*
144 * @unimplemented
145 */
146 BOOLEAN
147 NTAPI
148 FsRtlLookupLastLargeMcbEntryAndIndex(IN PLARGE_MCB OpaqueMcb,
149 OUT PLONGLONG LargeVbn,
150 OUT PLONGLONG LargeLbn,
151 OUT PULONG Index)
152 {
153 KeBugCheck(FILE_SYSTEM);
154 *LargeVbn = 0;
155 *LargeLbn = 0;
156 *Index = 0;
157 return FALSE;
158 }
159
160 /*
161 * @unimplemented
162 */
163 BOOLEAN
164 NTAPI
165 FsRtlLookupLastLargeMcbEntry(IN PLARGE_MCB Mcb,
166 OUT PLONGLONG Vbn,
167 OUT PLONGLONG Lbn)
168 {
169 KeBugCheck(FILE_SYSTEM);
170 return(FALSE);
171 }
172
173 /*
174 * @implemented
175 */
176 BOOLEAN
177 NTAPI
178 FsRtlLookupLastMcbEntry(IN PMCB Mcb,
179 OUT PVBN Vbn,
180 OUT PLBN Lbn)
181 {
182 BOOLEAN Return = FALSE;
183 LONGLONG llVbn = 0;
184 LONGLONG llLbn = 0;
185
186 /* Call the Large version */
187 Return = FsRtlLookupLastLargeMcbEntry(
188 &Mcb->DummyFieldThatSizesThisStructureCorrectly,
189 &llVbn,
190 &llLbn);
191
192 /* Return the lower 32-bits */
193 *Vbn = (ULONG)llVbn;
194 *Lbn = (ULONG)llLbn;
195
196 /* And return the original value */
197 return Return;
198 }
199
200 /*
201 * @implemented
202 */
203 BOOLEAN
204 NTAPI
205 FsRtlLookupMcbEntry(IN PMCB Mcb,
206 IN VBN Vbn,
207 OUT PLBN Lbn,
208 OUT PULONG SectorCount OPTIONAL,
209 OUT PULONG Index)
210 {
211 BOOLEAN Return = FALSE;
212 LONGLONG llLbn;
213 LONGLONG llSectorCount;
214
215 /* Call the Large version */
216 Return = FsRtlLookupLargeMcbEntry(&Mcb->
217 DummyFieldThatSizesThisStructureCorrectly,
218 (LONGLONG)Vbn,
219 &llLbn,
220 &llSectorCount,
221 NULL,
222 NULL,
223 Index);
224
225 /* Return the lower 32-bits */
226 *Lbn = (ULONG)llLbn;
227 if (SectorCount) *SectorCount = (ULONG)llSectorCount;
228
229 /* And return the original value */
230 return Return;
231 }
232
233 /*
234 * @implemented
235 */
236 ULONG
237 NTAPI
238 FsRtlNumberOfRunsInLargeMcb(IN PLARGE_MCB Mcb)
239 {
240 ULONG NumberOfRuns;
241
242 /* Read the number of runs while holding the MCB lock */
243 KeAcquireGuardedMutex(Mcb->GuardedMutex);
244 NumberOfRuns = Mcb->BaseMcb.PairCount;
245 KeReleaseGuardedMutex(Mcb->GuardedMutex);
246
247 /* Return the count */
248 return NumberOfRuns;
249 }
250
251 /*
252 * @implemented
253 */
254 ULONG
255 NTAPI
256 FsRtlNumberOfRunsInMcb (IN PMCB Mcb)
257 {
258 /* Call the newer function */
259 return FsRtlNumberOfRunsInLargeMcb(
260 &Mcb->DummyFieldThatSizesThisStructureCorrectly);
261 }
262
263 /*
264 * @unimplemented
265 */
266 VOID
267 NTAPI
268 FsRtlRemoveLargeMcbEntry(IN PLARGE_MCB Mcb,
269 IN LONGLONG Vbn,
270 IN LONGLONG SectorCount)
271 {
272 KeBugCheck(FILE_SYSTEM);
273 }
274
275 /*
276 * @implemented
277 */
278 VOID
279 NTAPI
280 FsRtlRemoveMcbEntry(IN PMCB Mcb,
281 IN VBN Vbn,
282 IN ULONG SectorCount)
283 {
284 /* Call the large function */
285 FsRtlRemoveLargeMcbEntry(&Mcb->DummyFieldThatSizesThisStructureCorrectly,
286 (LONGLONG)Vbn,
287 (LONGLONG)SectorCount);
288 }
289
290 /*
291 * @unimplemented
292 */
293 VOID
294 NTAPI
295 FsRtlResetLargeMcb(IN PLARGE_MCB Mcb,
296 IN BOOLEAN SelfSynchronized)
297 {
298 KeBugCheck(FILE_SYSTEM);
299 }
300
301 /*
302 * @unimplemented
303 */
304 BOOLEAN
305 NTAPI
306 FsRtlSplitLargeMcb(IN PLARGE_MCB Mcb,
307 IN LONGLONG Vbn,
308 IN LONGLONG Amount)
309 {
310 KeBugCheck(FILE_SYSTEM);
311 return FALSE;
312 }
313
314 /*
315 * @unimplemented
316 */
317 VOID
318 NTAPI
319 FsRtlTruncateLargeMcb(IN PLARGE_MCB Mcb,
320 IN LONGLONG Vbn)
321 {
322 KeBugCheck(FILE_SYSTEM);
323 }
324
325 /*
326 * @implemented
327 */
328 VOID
329 NTAPI
330 FsRtlTruncateMcb (IN PMCB Mcb,
331 IN VBN Vbn)
332 {
333 /* Call the newer function */
334 FsRtlTruncateLargeMcb(&Mcb->DummyFieldThatSizesThisStructureCorrectly,
335 (LONGLONG)Vbn);
336 }
337
338 /*
339 * @unimplemented
340 */
341 VOID
342 NTAPI
343 FsRtlUninitializeLargeMcb(IN PLARGE_MCB Mcb)
344 {
345 KeBugCheck(FILE_SYSTEM);
346 }
347
348 /*
349 * @implemented
350 */
351 VOID
352 NTAPI
353 FsRtlUninitializeMcb(IN PMCB Mcb)
354 {
355 /* Call the newer function */
356 FsRtlUninitializeLargeMcb(&Mcb->DummyFieldThatSizesThisStructureCorrectly);
357 }
358