074defc6bc00f23e5b4f3577ff3d7262c7526737
[reactos.git] / reactos / drivers / filesystems / fastfat / fastio.c
1 /*
2 * FILE: drivers/fs/vfat/fastio.c
3 * PURPOSE: Fast IO routines.
4 * COPYRIGHT: See COPYING in the top level directory
5 * PROJECT: ReactOS kernel
6 * PROGRAMMER: Herve Poussineau (hpoussin@reactos.org)
7 */
8
9 #include "vfat.h"
10
11 #define NDEBUG
12 #include <debug.h>
13
14 static FAST_IO_CHECK_IF_POSSIBLE VfatFastIoCheckIfPossible;
15
16 static
17 BOOLEAN
18 NTAPI
19 VfatFastIoCheckIfPossible(
20 IN PFILE_OBJECT FileObject,
21 IN PLARGE_INTEGER FileOffset,
22 IN ULONG Length,
23 IN BOOLEAN Wait,
24 IN ULONG LockKey,
25 IN BOOLEAN CheckForReadOperation,
26 OUT PIO_STATUS_BLOCK IoStatus,
27 IN PDEVICE_OBJECT DeviceObject)
28 {
29 /* Prevent all Fast I/O requests */
30 DPRINT("VfatFastIoCheckIfPossible(): returning FALSE.\n");
31
32 UNREFERENCED_PARAMETER(FileObject);
33 UNREFERENCED_PARAMETER(FileOffset);
34 UNREFERENCED_PARAMETER(Length);
35 UNREFERENCED_PARAMETER(Wait);
36 UNREFERENCED_PARAMETER(LockKey);
37 UNREFERENCED_PARAMETER(CheckForReadOperation);
38 UNREFERENCED_PARAMETER(IoStatus);
39 UNREFERENCED_PARAMETER(DeviceObject);
40
41 return FALSE;
42 }
43
44 static FAST_IO_READ VfatFastIoRead;
45
46 static
47 BOOLEAN
48 NTAPI
49 VfatFastIoRead(
50 IN PFILE_OBJECT FileObject,
51 IN PLARGE_INTEGER FileOffset,
52 IN ULONG Length,
53 IN BOOLEAN Wait,
54 IN ULONG LockKey,
55 OUT PVOID Buffer,
56 OUT PIO_STATUS_BLOCK IoStatus,
57 IN PDEVICE_OBJECT DeviceObject)
58 {
59 DPRINT("VfatFastIoRead()\n");
60
61 UNREFERENCED_PARAMETER(FileObject);
62 UNREFERENCED_PARAMETER(FileOffset);
63 UNREFERENCED_PARAMETER(Length);
64 UNREFERENCED_PARAMETER(Wait);
65 UNREFERENCED_PARAMETER(LockKey);
66 UNREFERENCED_PARAMETER(Buffer);
67 UNREFERENCED_PARAMETER(IoStatus);
68 UNREFERENCED_PARAMETER(DeviceObject);
69
70 return FALSE;
71 }
72
73 static FAST_IO_WRITE VfatFastIoWrite;
74
75 static
76 BOOLEAN
77 NTAPI
78 VfatFastIoWrite(
79 IN PFILE_OBJECT FileObject,
80 IN PLARGE_INTEGER FileOffset,
81 IN ULONG Length,
82 IN BOOLEAN Wait,
83 IN ULONG LockKey,
84 OUT PVOID Buffer,
85 OUT PIO_STATUS_BLOCK IoStatus,
86 IN PDEVICE_OBJECT DeviceObject)
87 {
88 DPRINT("VfatFastIoWrite()\n");
89
90 UNREFERENCED_PARAMETER(FileObject);
91 UNREFERENCED_PARAMETER(FileOffset);
92 UNREFERENCED_PARAMETER(Length);
93 UNREFERENCED_PARAMETER(Wait);
94 UNREFERENCED_PARAMETER(LockKey);
95 UNREFERENCED_PARAMETER(Buffer);
96 UNREFERENCED_PARAMETER(IoStatus);
97 UNREFERENCED_PARAMETER(DeviceObject);
98
99 return FALSE;
100 }
101
102 static FAST_IO_QUERY_BASIC_INFO VfatFastIoQueryBasicInfo;
103
104 static
105 BOOLEAN
106 NTAPI
107 VfatFastIoQueryBasicInfo(
108 IN PFILE_OBJECT FileObject,
109 IN BOOLEAN Wait,
110 OUT PFILE_BASIC_INFORMATION Buffer,
111 OUT PIO_STATUS_BLOCK IoStatus,
112 IN PDEVICE_OBJECT DeviceObject)
113 {
114 DPRINT("VfatFastIoQueryBasicInfo()\n");
115
116 UNREFERENCED_PARAMETER(FileObject);
117 UNREFERENCED_PARAMETER(Wait);
118 UNREFERENCED_PARAMETER(Buffer);
119 UNREFERENCED_PARAMETER(IoStatus);
120 UNREFERENCED_PARAMETER(DeviceObject);
121
122 return FALSE;
123 }
124
125 static FAST_IO_QUERY_STANDARD_INFO VfatFastIoQueryStandardInfo;
126
127 static
128 BOOLEAN
129 NTAPI
130 VfatFastIoQueryStandardInfo(
131 IN PFILE_OBJECT FileObject,
132 IN BOOLEAN Wait,
133 OUT PFILE_STANDARD_INFORMATION Buffer,
134 OUT PIO_STATUS_BLOCK IoStatus,
135 IN PDEVICE_OBJECT DeviceObject)
136 {
137 DPRINT("VfatFastIoQueryStandardInfo\n");
138
139 UNREFERENCED_PARAMETER(FileObject);
140 UNREFERENCED_PARAMETER(Wait);
141 UNREFERENCED_PARAMETER(Buffer);
142 UNREFERENCED_PARAMETER(IoStatus);
143 UNREFERENCED_PARAMETER(DeviceObject);
144
145 return FALSE;
146 }
147
148 static FAST_IO_LOCK VfatFastIoLock;
149
150 static
151 BOOLEAN
152 NTAPI
153 VfatFastIoLock(
154 IN PFILE_OBJECT FileObject,
155 IN PLARGE_INTEGER FileOffset,
156 IN PLARGE_INTEGER Length,
157 PEPROCESS ProcessId,
158 ULONG Key,
159 BOOLEAN FailImmediately,
160 BOOLEAN ExclusiveLock,
161 OUT PIO_STATUS_BLOCK IoStatus,
162 IN PDEVICE_OBJECT DeviceObject)
163 {
164 DPRINT("VfatFastIoLock\n");
165
166 UNREFERENCED_PARAMETER(FileObject);
167 UNREFERENCED_PARAMETER(FileOffset);
168 UNREFERENCED_PARAMETER(Length);
169 UNREFERENCED_PARAMETER(ProcessId);
170 UNREFERENCED_PARAMETER(Key);
171 UNREFERENCED_PARAMETER(FailImmediately);
172 UNREFERENCED_PARAMETER(ExclusiveLock);
173 UNREFERENCED_PARAMETER(IoStatus);
174 UNREFERENCED_PARAMETER(DeviceObject);
175
176 return FALSE;
177 }
178
179 static FAST_IO_UNLOCK_SINGLE VfatFastIoUnlockSingle;
180
181 static
182 BOOLEAN
183 NTAPI
184 VfatFastIoUnlockSingle(
185 IN PFILE_OBJECT FileObject,
186 IN PLARGE_INTEGER FileOffset,
187 IN PLARGE_INTEGER Length,
188 PEPROCESS ProcessId,
189 ULONG Key,
190 OUT PIO_STATUS_BLOCK IoStatus,
191 IN PDEVICE_OBJECT DeviceObject)
192 {
193 DPRINT("VfatFastIoUnlockSingle\n");
194
195 UNREFERENCED_PARAMETER(FileObject);
196 UNREFERENCED_PARAMETER(FileOffset);
197 UNREFERENCED_PARAMETER(Length);
198 UNREFERENCED_PARAMETER(ProcessId);
199 UNREFERENCED_PARAMETER(Key);
200 UNREFERENCED_PARAMETER(IoStatus);
201 UNREFERENCED_PARAMETER(DeviceObject);
202
203 return FALSE;
204 }
205
206 static FAST_IO_UNLOCK_ALL VfatFastIoUnlockAll;
207
208 static
209 BOOLEAN
210 NTAPI
211 VfatFastIoUnlockAll(
212 IN PFILE_OBJECT FileObject,
213 PEPROCESS ProcessId,
214 OUT PIO_STATUS_BLOCK IoStatus,
215 IN PDEVICE_OBJECT DeviceObject)
216 {
217 DPRINT("VfatFastIoUnlockAll\n");
218
219 UNREFERENCED_PARAMETER(FileObject);
220 UNREFERENCED_PARAMETER(ProcessId);
221 UNREFERENCED_PARAMETER(IoStatus);
222 UNREFERENCED_PARAMETER(DeviceObject);
223
224 return FALSE;
225 }
226
227 static FAST_IO_UNLOCK_ALL_BY_KEY VfatFastIoUnlockAllByKey;
228
229 static
230 BOOLEAN
231 NTAPI
232 VfatFastIoUnlockAllByKey(
233 IN PFILE_OBJECT FileObject,
234 PVOID ProcessId,
235 ULONG Key,
236 OUT PIO_STATUS_BLOCK IoStatus,
237 IN PDEVICE_OBJECT DeviceObject)
238 {
239 DPRINT("VfatFastIoUnlockAllByKey\n");
240
241 UNREFERENCED_PARAMETER(FileObject);
242 UNREFERENCED_PARAMETER(ProcessId);
243 UNREFERENCED_PARAMETER(Key);
244 UNREFERENCED_PARAMETER(IoStatus);
245 UNREFERENCED_PARAMETER(DeviceObject);
246
247 return FALSE;
248 }
249
250 static FAST_IO_DEVICE_CONTROL VfatFastIoDeviceControl;
251
252 static
253 BOOLEAN
254 NTAPI
255 VfatFastIoDeviceControl(
256 IN PFILE_OBJECT FileObject,
257 IN BOOLEAN Wait,
258 IN PVOID InputBuffer OPTIONAL,
259 IN ULONG InputBufferLength,
260 OUT PVOID OutputBuffer OPTIONAL,
261 IN ULONG OutputBufferLength,
262 IN ULONG IoControlCode,
263 OUT PIO_STATUS_BLOCK IoStatus,
264 IN PDEVICE_OBJECT DeviceObject)
265 {
266 DPRINT("VfatFastIoDeviceControl\n");
267
268 UNREFERENCED_PARAMETER(FileObject);
269 UNREFERENCED_PARAMETER(Wait);
270 UNREFERENCED_PARAMETER(InputBuffer);
271 UNREFERENCED_PARAMETER(InputBufferLength);
272 UNREFERENCED_PARAMETER(OutputBuffer);
273 UNREFERENCED_PARAMETER(OutputBufferLength);
274 UNREFERENCED_PARAMETER(IoControlCode);
275 UNREFERENCED_PARAMETER(IoStatus);
276 UNREFERENCED_PARAMETER(DeviceObject);
277
278 return FALSE;
279 }
280
281 static FAST_IO_ACQUIRE_FILE VfatAcquireFileForNtCreateSection;
282
283 static
284 VOID
285 NTAPI
286 VfatAcquireFileForNtCreateSection(
287 IN PFILE_OBJECT FileObject)
288 {
289 DPRINT("VfatAcquireFileForNtCreateSection\n");
290 UNREFERENCED_PARAMETER(FileObject);
291 }
292
293 static FAST_IO_RELEASE_FILE VfatReleaseFileForNtCreateSection;
294
295 static
296 VOID
297 NTAPI
298 VfatReleaseFileForNtCreateSection(
299 IN PFILE_OBJECT FileObject)
300 {
301 DPRINT("VfatReleaseFileForNtCreateSection\n");
302 UNREFERENCED_PARAMETER(FileObject);
303 }
304
305 static FAST_IO_DETACH_DEVICE VfatFastIoDetachDevice;
306
307 static
308 VOID
309 NTAPI
310 VfatFastIoDetachDevice(
311 IN PDEVICE_OBJECT SourceDevice,
312 IN PDEVICE_OBJECT TargetDevice)
313 {
314 DPRINT("VfatFastIoDetachDevice\n");
315 UNREFERENCED_PARAMETER(SourceDevice);
316 UNREFERENCED_PARAMETER(TargetDevice);
317 }
318
319 static FAST_IO_QUERY_NETWORK_OPEN_INFO VfatFastIoQueryNetworkOpenInfo;
320
321 static
322 BOOLEAN
323 NTAPI
324 VfatFastIoQueryNetworkOpenInfo(
325 IN PFILE_OBJECT FileObject,
326 IN BOOLEAN Wait,
327 OUT PFILE_NETWORK_OPEN_INFORMATION Buffer,
328 OUT PIO_STATUS_BLOCK IoStatus,
329 IN PDEVICE_OBJECT DeviceObject)
330 {
331 DPRINT("VfatFastIoQueryNetworkOpenInfo\n");
332
333 UNREFERENCED_PARAMETER(FileObject);
334 UNREFERENCED_PARAMETER(Wait);
335 UNREFERENCED_PARAMETER(Buffer);
336 UNREFERENCED_PARAMETER(IoStatus);
337 UNREFERENCED_PARAMETER(DeviceObject);
338
339 return FALSE;
340 }
341
342 static FAST_IO_ACQUIRE_FOR_MOD_WRITE VfatAcquireForModWrite;
343
344 static
345 NTSTATUS
346 NTAPI
347 VfatAcquireForModWrite(
348 IN PFILE_OBJECT FileObject,
349 IN PLARGE_INTEGER EndingOffset,
350 OUT PERESOURCE* ResourceToRelease,
351 IN PDEVICE_OBJECT DeviceObject)
352 {
353 DPRINT("VfatAcquireForModWrite\n");
354
355 UNREFERENCED_PARAMETER(FileObject);
356 UNREFERENCED_PARAMETER(EndingOffset);
357 UNREFERENCED_PARAMETER(ResourceToRelease);
358 UNREFERENCED_PARAMETER(DeviceObject);
359
360 return STATUS_INVALID_DEVICE_REQUEST;
361 }
362
363 static FAST_IO_MDL_READ VfatMdlRead;
364
365 static
366 BOOLEAN
367 NTAPI
368 VfatMdlRead(
369 IN PFILE_OBJECT FileObject,
370 IN PLARGE_INTEGER FileOffset,
371 IN ULONG Length,
372 IN ULONG LockKey,
373 OUT PMDL* MdlChain,
374 OUT PIO_STATUS_BLOCK IoStatus,
375 IN PDEVICE_OBJECT DeviceObject)
376 {
377 DPRINT("VfatMdlRead\n");
378
379 UNREFERENCED_PARAMETER(FileObject);
380 UNREFERENCED_PARAMETER(FileOffset);
381 UNREFERENCED_PARAMETER(Length);
382 UNREFERENCED_PARAMETER(LockKey);
383 UNREFERENCED_PARAMETER(MdlChain);
384 UNREFERENCED_PARAMETER(IoStatus);
385 UNREFERENCED_PARAMETER(DeviceObject);
386
387 return FALSE;
388 }
389
390 static FAST_IO_MDL_READ_COMPLETE VfatMdlReadComplete;
391
392 static
393 BOOLEAN
394 NTAPI
395 VfatMdlReadComplete(
396 IN PFILE_OBJECT FileObject,
397 IN PMDL MdlChain,
398 IN PDEVICE_OBJECT DeviceObject)
399 {
400 DPRINT("VfatMdlReadComplete\n");
401
402 UNREFERENCED_PARAMETER(FileObject);
403 UNREFERENCED_PARAMETER(MdlChain);
404 UNREFERENCED_PARAMETER(DeviceObject);
405
406 return FALSE;
407 }
408
409 static FAST_IO_PREPARE_MDL_WRITE VfatPrepareMdlWrite;
410
411 static
412 BOOLEAN
413 NTAPI
414 VfatPrepareMdlWrite(
415 IN PFILE_OBJECT FileObject,
416 IN PLARGE_INTEGER FileOffset,
417 IN ULONG Length,
418 IN ULONG LockKey,
419 OUT PMDL* MdlChain,
420 OUT PIO_STATUS_BLOCK IoStatus,
421 IN PDEVICE_OBJECT DeviceObject)
422 {
423 DPRINT("VfatPrepareMdlWrite\n");
424
425 UNREFERENCED_PARAMETER(FileObject);
426 UNREFERENCED_PARAMETER(FileOffset);
427 UNREFERENCED_PARAMETER(Length);
428 UNREFERENCED_PARAMETER(LockKey);
429 UNREFERENCED_PARAMETER(MdlChain);
430 UNREFERENCED_PARAMETER(IoStatus);
431 UNREFERENCED_PARAMETER(DeviceObject);
432
433 return FALSE;
434 }
435
436 static FAST_IO_MDL_WRITE_COMPLETE VfatMdlWriteComplete;
437
438 static
439 BOOLEAN
440 NTAPI
441 VfatMdlWriteComplete(
442 IN PFILE_OBJECT FileObject,
443 IN PLARGE_INTEGER FileOffset,
444 IN PMDL MdlChain,
445 IN PDEVICE_OBJECT DeviceObject)
446 {
447 DPRINT("VfatMdlWriteComplete\n");
448
449 UNREFERENCED_PARAMETER(FileObject);
450 UNREFERENCED_PARAMETER(FileOffset);
451 UNREFERENCED_PARAMETER(MdlChain);
452 UNREFERENCED_PARAMETER(DeviceObject);
453
454 return FALSE;
455 }
456
457 static FAST_IO_READ_COMPRESSED VfatFastIoReadCompressed;
458
459 static
460 BOOLEAN
461 NTAPI
462 VfatFastIoReadCompressed(
463 IN PFILE_OBJECT FileObject,
464 IN PLARGE_INTEGER FileOffset,
465 IN ULONG Length,
466 IN ULONG LockKey,
467 OUT PVOID Buffer,
468 OUT PMDL* MdlChain,
469 OUT PIO_STATUS_BLOCK IoStatus,
470 OUT PCOMPRESSED_DATA_INFO CompressedDataInfo,
471 IN ULONG CompressedDataInfoLength,
472 IN PDEVICE_OBJECT DeviceObject)
473 {
474 DPRINT("VfatFastIoReadCompressed\n");
475
476 UNREFERENCED_PARAMETER(FileObject);
477 UNREFERENCED_PARAMETER(FileOffset);
478 UNREFERENCED_PARAMETER(Length);
479 UNREFERENCED_PARAMETER(LockKey);
480 UNREFERENCED_PARAMETER(Buffer);
481 UNREFERENCED_PARAMETER(MdlChain);
482 UNREFERENCED_PARAMETER(IoStatus);
483 UNREFERENCED_PARAMETER(CompressedDataInfo);
484 UNREFERENCED_PARAMETER(CompressedDataInfoLength);
485 UNREFERENCED_PARAMETER(DeviceObject);
486
487 return FALSE;
488 }
489
490 static FAST_IO_WRITE_COMPRESSED VfatFastIoWriteCompressed;
491
492 static
493 BOOLEAN
494 NTAPI
495 VfatFastIoWriteCompressed(
496 IN PFILE_OBJECT FileObject,
497 IN PLARGE_INTEGER FileOffset,
498 IN ULONG Length,
499 IN ULONG LockKey,
500 IN PVOID Buffer,
501 OUT PMDL* MdlChain,
502 OUT PIO_STATUS_BLOCK IoStatus,
503 IN PCOMPRESSED_DATA_INFO CompressedDataInfo,
504 IN ULONG CompressedDataInfoLength,
505 IN PDEVICE_OBJECT DeviceObject)
506 {
507 DPRINT("VfatFastIoWriteCompressed\n");
508
509 UNREFERENCED_PARAMETER(FileObject);
510 UNREFERENCED_PARAMETER(FileOffset);
511 UNREFERENCED_PARAMETER(Length);
512 UNREFERENCED_PARAMETER(LockKey);
513 UNREFERENCED_PARAMETER(Buffer);
514 UNREFERENCED_PARAMETER(MdlChain);
515 UNREFERENCED_PARAMETER(IoStatus);
516 UNREFERENCED_PARAMETER(CompressedDataInfo);
517 UNREFERENCED_PARAMETER(CompressedDataInfoLength);
518 UNREFERENCED_PARAMETER(DeviceObject);
519
520 return FALSE;
521 }
522
523 static FAST_IO_MDL_READ_COMPLETE_COMPRESSED VfatMdlReadCompleteCompressed;
524
525 static
526 BOOLEAN
527 NTAPI
528 VfatMdlReadCompleteCompressed(
529 IN PFILE_OBJECT FileObject,
530 IN PMDL MdlChain,
531 IN PDEVICE_OBJECT DeviceObject)
532 {
533 DPRINT("VfatMdlReadCompleteCompressed\n");
534
535 UNREFERENCED_PARAMETER(FileObject);
536 UNREFERENCED_PARAMETER(MdlChain);
537 UNREFERENCED_PARAMETER(DeviceObject);
538
539 return FALSE;
540 }
541
542 static FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED VfatMdlWriteCompleteCompressed;
543
544 static
545 BOOLEAN
546 NTAPI
547 VfatMdlWriteCompleteCompressed(
548 IN PFILE_OBJECT FileObject,
549 IN PLARGE_INTEGER FileOffset,
550 IN PMDL MdlChain,
551 IN PDEVICE_OBJECT DeviceObject)
552 {
553 DPRINT("VfatMdlWriteCompleteCompressed\n");
554
555 UNREFERENCED_PARAMETER(FileObject);
556 UNREFERENCED_PARAMETER(FileOffset);
557 UNREFERENCED_PARAMETER(MdlChain);
558 UNREFERENCED_PARAMETER(DeviceObject);
559
560 return FALSE;
561 }
562
563 static FAST_IO_QUERY_OPEN VfatFastIoQueryOpen;
564
565 static
566 BOOLEAN
567 NTAPI
568 VfatFastIoQueryOpen(
569 IN PIRP Irp,
570 OUT PFILE_NETWORK_OPEN_INFORMATION NetworkInformation,
571 IN PDEVICE_OBJECT DeviceObject)
572 {
573 DPRINT("VfatFastIoQueryOpen\n");
574
575 UNREFERENCED_PARAMETER(Irp);
576 UNREFERENCED_PARAMETER(NetworkInformation);
577 UNREFERENCED_PARAMETER(DeviceObject);
578
579 return FALSE;
580 }
581
582 static FAST_IO_RELEASE_FOR_MOD_WRITE VfatReleaseForModWrite;
583
584 static
585 NTSTATUS
586 NTAPI
587 VfatReleaseForModWrite(
588 IN PFILE_OBJECT FileObject,
589 IN PERESOURCE ResourceToRelease,
590 IN PDEVICE_OBJECT DeviceObject)
591 {
592 DPRINT("VfatReleaseForModWrite\n");
593
594 UNREFERENCED_PARAMETER(FileObject);
595 UNREFERENCED_PARAMETER(ResourceToRelease);
596 UNREFERENCED_PARAMETER(DeviceObject);
597
598 return STATUS_INVALID_DEVICE_REQUEST;
599 }
600
601 static FAST_IO_ACQUIRE_FOR_CCFLUSH VfatAcquireForCcFlush;
602
603 static
604 NTSTATUS
605 NTAPI
606 VfatAcquireForCcFlush(
607 IN PFILE_OBJECT FileObject,
608 IN PDEVICE_OBJECT DeviceObject)
609 {
610 PVFATFCB Fcb = (PVFATFCB)FileObject->FsContext;
611
612 DPRINT("VfatAcquireForCcFlush\n");
613
614 UNREFERENCED_PARAMETER(DeviceObject);
615
616 /* Make sure it is not a volume lock */
617 ASSERT(!(Fcb->Flags & FCB_IS_VOLUME));
618
619 /* Acquire the resource */
620 ExAcquireResourceExclusiveLite(&(Fcb->MainResource), TRUE);
621
622 return STATUS_SUCCESS;
623 }
624
625 static FAST_IO_RELEASE_FOR_CCFLUSH VfatReleaseForCcFlush;
626
627 static
628 NTSTATUS
629 NTAPI
630 VfatReleaseForCcFlush(
631 IN PFILE_OBJECT FileObject,
632 IN PDEVICE_OBJECT DeviceObject)
633 {
634 PVFATFCB Fcb = (PVFATFCB)FileObject->FsContext;
635
636 DPRINT("VfatReleaseForCcFlush\n");
637
638 UNREFERENCED_PARAMETER(DeviceObject);
639
640 /* Make sure it is not a volume lock */
641 ASSERT(!(Fcb->Flags & FCB_IS_VOLUME));
642
643 /* Release the resource */
644 ExReleaseResourceLite(&(Fcb->MainResource));
645
646 return STATUS_SUCCESS;
647 }
648
649 BOOLEAN
650 NTAPI
651 VfatAcquireForLazyWrite(
652 IN PVOID Context,
653 IN BOOLEAN Wait)
654 {
655 PVFATFCB Fcb = (PVFATFCB)Context;
656 ASSERT(Fcb);
657 DPRINT("VfatAcquireForLazyWrite(): Fcb %p\n", Fcb);
658
659 if (!ExAcquireResourceExclusiveLite(&(Fcb->MainResource), Wait))
660 {
661 DPRINT("VfatAcquireForLazyWrite(): ExReleaseResourceLite failed.\n");
662 return FALSE;
663 }
664 return TRUE;
665 }
666
667 VOID
668 NTAPI
669 VfatReleaseFromLazyWrite(
670 IN PVOID Context)
671 {
672 PVFATFCB Fcb = (PVFATFCB)Context;
673 ASSERT(Fcb);
674 DPRINT("VfatReleaseFromLazyWrite(): Fcb %p\n", Fcb);
675
676 ExReleaseResourceLite(&(Fcb->MainResource));
677 }
678
679 BOOLEAN
680 NTAPI
681 VfatAcquireForReadAhead(
682 IN PVOID Context,
683 IN BOOLEAN Wait)
684 {
685 PVFATFCB Fcb = (PVFATFCB)Context;
686 ASSERT(Fcb);
687 DPRINT("VfatAcquireForReadAhead(): Fcb %p\n", Fcb);
688
689 if (!ExAcquireResourceExclusiveLite(&(Fcb->MainResource), Wait))
690 {
691 DPRINT("VfatAcquireForReadAhead(): ExReleaseResourceLite failed.\n");
692 return FALSE;
693 }
694 return TRUE;
695 }
696
697 VOID
698 NTAPI
699 VfatReleaseFromReadAhead(
700 IN PVOID Context)
701 {
702 PVFATFCB Fcb = (PVFATFCB)Context;
703 ASSERT(Fcb);
704 DPRINT("VfatReleaseFromReadAhead(): Fcb %p\n", Fcb);
705
706 ExReleaseResourceLite(&(Fcb->MainResource));
707 }
708
709 VOID
710 VfatInitFastIoRoutines(
711 PFAST_IO_DISPATCH FastIoDispatch)
712 {
713 FastIoDispatch->SizeOfFastIoDispatch = sizeof(FAST_IO_DISPATCH);
714 FastIoDispatch->FastIoCheckIfPossible = VfatFastIoCheckIfPossible;
715 FastIoDispatch->FastIoRead = VfatFastIoRead;
716 FastIoDispatch->FastIoWrite = VfatFastIoWrite;
717 FastIoDispatch->FastIoQueryBasicInfo = VfatFastIoQueryBasicInfo;
718 FastIoDispatch->FastIoQueryStandardInfo = VfatFastIoQueryStandardInfo;
719 FastIoDispatch->FastIoLock = VfatFastIoLock;
720 FastIoDispatch->FastIoUnlockSingle = VfatFastIoUnlockSingle;
721 FastIoDispatch->FastIoUnlockAll = VfatFastIoUnlockAll;
722 FastIoDispatch->FastIoUnlockAllByKey = VfatFastIoUnlockAllByKey;
723 FastIoDispatch->FastIoDeviceControl = VfatFastIoDeviceControl;
724 FastIoDispatch->AcquireFileForNtCreateSection = VfatAcquireFileForNtCreateSection;
725 FastIoDispatch->ReleaseFileForNtCreateSection = VfatReleaseFileForNtCreateSection;
726 FastIoDispatch->FastIoDetachDevice = VfatFastIoDetachDevice;
727 FastIoDispatch->FastIoQueryNetworkOpenInfo = VfatFastIoQueryNetworkOpenInfo;
728 FastIoDispatch->MdlRead = VfatMdlRead;
729 FastIoDispatch->MdlReadComplete = VfatMdlReadComplete;
730 FastIoDispatch->PrepareMdlWrite = VfatPrepareMdlWrite;
731 FastIoDispatch->MdlWriteComplete = VfatMdlWriteComplete;
732 FastIoDispatch->FastIoReadCompressed = VfatFastIoReadCompressed;
733 FastIoDispatch->FastIoWriteCompressed = VfatFastIoWriteCompressed;
734 FastIoDispatch->MdlReadCompleteCompressed = VfatMdlReadCompleteCompressed;
735 FastIoDispatch->MdlWriteCompleteCompressed = VfatMdlWriteCompleteCompressed;
736 FastIoDispatch->FastIoQueryOpen = VfatFastIoQueryOpen;
737 FastIoDispatch->AcquireForModWrite = VfatAcquireForModWrite;
738 FastIoDispatch->ReleaseForModWrite = VfatReleaseForModWrite;
739 FastIoDispatch->AcquireForCcFlush = VfatAcquireForCcFlush;
740 FastIoDispatch->ReleaseForCcFlush = VfatReleaseForCcFlush;
741 }