ReactOS 0.4.15-dev-5853-gcb454ef
fastio.c
Go to the documentation of this file.
1/*
2 * PROJECT: VFAT Filesystem
3 * LICENSE: GPL-2.0-or-later (https://spdx.org/licenses/GPL-2.0-or-later)
4 * PURPOSE: Fast IO routines
5 * COPYRIGHT: Copyright 2005 Hervé Poussineau <hpoussin@reactos.org>
6 * Copyright 2015-2018 Pierre Schweitzer <pierre@reactos.org>
7 */
8
9#include "vfat.h"
10
11#define NDEBUG
12#include <debug.h>
13
14static FAST_IO_CHECK_IF_POSSIBLE VfatFastIoCheckIfPossible;
15
16static
28{
29 /* Prevent all Fast I/O requests */
30 DPRINT("VfatFastIoCheckIfPossible(): returning FALSE.\n");
31
40
41 return FALSE;
42}
43
44static FAST_IO_READ VfatFastIoRead;
45
46static
58{
59 DPRINT("VfatFastIoRead()\n");
60
69
70 return FALSE;
71}
72
73static FAST_IO_WRITE VfatFastIoWrite;
74
75static
87{
88 DPRINT("VfatFastIoWrite()\n");
89
98
99 return FALSE;
100}
101
102static FAST_IO_QUERY_BASIC_INFO VfatFastIoQueryBasicInfo;
103
104static
106NTAPI
113{
115 PVFATFCB FCB = NULL;
118
119 DPRINT("VfatFastIoQueryBasicInfo()\n");
120
121 FCB = (PVFATFCB)FileObject->FsContext;
122 if (FCB == NULL)
123 {
124 return FALSE;
125 }
126
128
130 {
132 {
134 return FALSE;
135 }
136 }
137
139 FCB,
140 DeviceObject->DeviceExtension,
141 Buffer,
142 &BufferLength);
143
145 {
147 }
148
149 if (NT_SUCCESS(Status))
150 {
151 IoStatus->Status = STATUS_SUCCESS;
152 IoStatus->Information = sizeof(FILE_BASIC_INFORMATION) - BufferLength;
153 Success = TRUE;
154 }
155
157
158 return Success;
159}
160
161static FAST_IO_QUERY_STANDARD_INFO VfatFastIoQueryStandardInfo;
162
163static
165NTAPI
172{
174 PVFATFCB FCB = NULL;
177
178 DPRINT("VfatFastIoQueryStandardInfo()\n");
179
181
182 FCB = (PVFATFCB)FileObject->FsContext;
183 if (FCB == NULL)
184 {
185 return FALSE;
186 }
187
189
191 {
193 {
195 return FALSE;
196 }
197 }
198
200 Buffer,
201 &BufferLength);
202
204 {
206 }
207
208 if (NT_SUCCESS(Status))
209 {
210 IoStatus->Status = STATUS_SUCCESS;
211 IoStatus->Information = sizeof(FILE_STANDARD_INFORMATION) - BufferLength;
212 Success = TRUE;
213 }
214
216
217 return Success;
218}
219
220static FAST_IO_LOCK VfatFastIoLock;
221
222static
224NTAPI
230 ULONG Key,
235{
236 DPRINT("VfatFastIoLock\n");
237
247
248 return FALSE;
249}
250
251static FAST_IO_UNLOCK_SINGLE VfatFastIoUnlockSingle;
252
253static
255NTAPI
261 ULONG Key,
264{
265 DPRINT("VfatFastIoUnlockSingle\n");
266
274
275 return FALSE;
276}
277
278static FAST_IO_UNLOCK_ALL VfatFastIoUnlockAll;
279
280static
282NTAPI
288{
289 DPRINT("VfatFastIoUnlockAll\n");
290
295
296 return FALSE;
297}
298
299static FAST_IO_UNLOCK_ALL_BY_KEY VfatFastIoUnlockAllByKey;
300
301static
303NTAPI
307 ULONG Key,
310{
311 DPRINT("VfatFastIoUnlockAllByKey\n");
312
318
319 return FALSE;
320}
321
322static FAST_IO_DEVICE_CONTROL VfatFastIoDeviceControl;
323
324static
326NTAPI
337{
338 DPRINT("VfatFastIoDeviceControl\n");
339
349
350 return FALSE;
351}
352
353static FAST_IO_ACQUIRE_FILE VfatAcquireFileForNtCreateSection;
354
355static
356VOID
357NTAPI
360{
361 DPRINT("VfatAcquireFileForNtCreateSection\n");
363}
364
365static FAST_IO_RELEASE_FILE VfatReleaseFileForNtCreateSection;
366
367static
368VOID
369NTAPI
372{
373 DPRINT("VfatReleaseFileForNtCreateSection\n");
375}
376
377static FAST_IO_DETACH_DEVICE VfatFastIoDetachDevice;
378
379static
380VOID
381NTAPI
385{
386 DPRINT("VfatFastIoDetachDevice\n");
389}
390
391static FAST_IO_QUERY_NETWORK_OPEN_INFO VfatFastIoQueryNetworkOpenInfo;
392
393static
395NTAPI
402{
403 DPRINT("VfatFastIoQueryNetworkOpenInfo\n");
404
410
411 return FALSE;
412}
413
414static FAST_IO_ACQUIRE_FOR_MOD_WRITE VfatAcquireForModWrite;
415
416static
418NTAPI
424{
425 DPRINT("VfatAcquireForModWrite\n");
426
431
433}
434
435static FAST_IO_MDL_READ VfatMdlRead;
436
437static
439NTAPI
448{
449 DPRINT("VfatMdlRead\n");
450
458
459 return FALSE;
460}
461
462static FAST_IO_MDL_READ_COMPLETE VfatMdlReadComplete;
463
464static
466NTAPI
471{
472 DPRINT("VfatMdlReadComplete\n");
473
477
478 return FALSE;
479}
480
481static FAST_IO_PREPARE_MDL_WRITE VfatPrepareMdlWrite;
482
483static
485NTAPI
494{
495 DPRINT("VfatPrepareMdlWrite\n");
496
504
505 return FALSE;
506}
507
508static FAST_IO_MDL_WRITE_COMPLETE VfatMdlWriteComplete;
509
510static
512NTAPI
518{
519 DPRINT("VfatMdlWriteComplete\n");
520
525
526 return FALSE;
527}
528
529static FAST_IO_READ_COMPRESSED VfatFastIoReadCompressed;
530
531static
533NTAPI
545{
546 DPRINT("VfatFastIoReadCompressed\n");
547
558
559 return FALSE;
560}
561
562static FAST_IO_WRITE_COMPRESSED VfatFastIoWriteCompressed;
563
564static
566NTAPI
578{
579 DPRINT("VfatFastIoWriteCompressed\n");
580
591
592 return FALSE;
593}
594
595static FAST_IO_MDL_READ_COMPLETE_COMPRESSED VfatMdlReadCompleteCompressed;
596
597static
599NTAPI
604{
605 DPRINT("VfatMdlReadCompleteCompressed\n");
606
610
611 return FALSE;
612}
613
614static FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED VfatMdlWriteCompleteCompressed;
615
616static
618NTAPI
624{
625 DPRINT("VfatMdlWriteCompleteCompressed\n");
626
631
632 return FALSE;
633}
634
635static FAST_IO_QUERY_OPEN VfatFastIoQueryOpen;
636
637static
639NTAPI
641 IN PIRP Irp,
644{
645 DPRINT("VfatFastIoQueryOpen\n");
646
650
651 return FALSE;
652}
653
654static FAST_IO_RELEASE_FOR_MOD_WRITE VfatReleaseForModWrite;
655
656static
658NTAPI
663{
664 DPRINT("VfatReleaseForModWrite\n");
665
669
671}
672
673static FAST_IO_ACQUIRE_FOR_CCFLUSH VfatAcquireForCcFlush;
674
675static
677NTAPI
681{
682 PVFATFCB Fcb = (PVFATFCB)FileObject->FsContext;
683
684 DPRINT("VfatAcquireForCcFlush\n");
685
687
688 /* Make sure it is not a volume lock */
690
691 /* Acquire the resource */
693
694 return STATUS_SUCCESS;
695}
696
697static FAST_IO_RELEASE_FOR_CCFLUSH VfatReleaseForCcFlush;
698
699static
701NTAPI
705{
706 PVFATFCB Fcb = (PVFATFCB)FileObject->FsContext;
707
708 DPRINT("VfatReleaseForCcFlush\n");
709
711
712 /* Make sure it is not a volume lock */
714
715 /* Release the resource */
717
718 return STATUS_SUCCESS;
719}
720
722NTAPI
726{
728 ASSERT(Fcb);
729 DPRINT("VfatAcquireForLazyWrite(): Fcb %p\n", Fcb);
730
732 {
733 DPRINT("VfatAcquireForLazyWrite(): ExReleaseResourceLite failed.\n");
734 return FALSE;
735 }
736 return TRUE;
737}
738
739VOID
740NTAPI
743{
745 ASSERT(Fcb);
746 DPRINT("VfatReleaseFromLazyWrite(): Fcb %p\n", Fcb);
747
749}
750
751CODE_SEG("INIT")
752VOID
755{
784}
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:160
_In_ PFCB Fcb
Definition: cdprocs.h:159
Definition: bufpool.h:45
_In_ PIRP Irp
Definition: csq.h:116
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
FAST_IO_DISPATCH FastIoDispatch
Definition: fastio.c:20
#define FCB_IS_VOLUME
Definition: ntfs.h:510
static FAST_IO_WRITE_COMPRESSED VfatFastIoWriteCompressed
Definition: fastio.c:562
static FAST_IO_ACQUIRE_FILE VfatAcquireFileForNtCreateSection
Definition: fastio.c:353
static FAST_IO_READ VfatFastIoRead
Definition: fastio.c:44
static FAST_IO_MDL_WRITE_COMPLETE VfatMdlWriteComplete
Definition: fastio.c:508
static FAST_IO_MDL_WRITE_COMPLETE_COMPRESSED VfatMdlWriteCompleteCompressed
Definition: fastio.c:614
static FAST_IO_CHECK_IF_POSSIBLE VfatFastIoCheckIfPossible
Definition: fastio.c:14
static FAST_IO_QUERY_STANDARD_INFO VfatFastIoQueryStandardInfo
Definition: fastio.c:161
static FAST_IO_RELEASE_FILE VfatReleaseFileForNtCreateSection
Definition: fastio.c:365
static FAST_IO_ACQUIRE_FOR_CCFLUSH VfatAcquireForCcFlush
Definition: fastio.c:673
static FAST_IO_UNLOCK_ALL_BY_KEY VfatFastIoUnlockAllByKey
Definition: fastio.c:299
static FAST_IO_MDL_READ_COMPLETE_COMPRESSED VfatMdlReadCompleteCompressed
Definition: fastio.c:595
static FAST_IO_ACQUIRE_FOR_MOD_WRITE VfatAcquireForModWrite
Definition: fastio.c:414
static FAST_IO_DETACH_DEVICE VfatFastIoDetachDevice
Definition: fastio.c:377
VOID VfatInitFastIoRoutines(PFAST_IO_DISPATCH FastIoDispatch)
Definition: fastio.c:753
BOOLEAN NTAPI VfatAcquireForLazyWrite(IN PVOID Context, IN BOOLEAN Wait)
Definition: fastio.c:723
static FAST_IO_MDL_READ VfatMdlRead
Definition: fastio.c:435
static FAST_IO_UNLOCK_SINGLE VfatFastIoUnlockSingle
Definition: fastio.c:251
static FAST_IO_DEVICE_CONTROL VfatFastIoDeviceControl
Definition: fastio.c:322
static FAST_IO_QUERY_BASIC_INFO VfatFastIoQueryBasicInfo
Definition: fastio.c:102
VOID NTAPI VfatReleaseFromLazyWrite(IN PVOID Context)
Definition: fastio.c:741
static FAST_IO_QUERY_OPEN VfatFastIoQueryOpen
Definition: fastio.c:635
static FAST_IO_MDL_READ_COMPLETE VfatMdlReadComplete
Definition: fastio.c:462
static FAST_IO_WRITE VfatFastIoWrite
Definition: fastio.c:73
static FAST_IO_RELEASE_FOR_CCFLUSH VfatReleaseForCcFlush
Definition: fastio.c:697
static FAST_IO_UNLOCK_ALL VfatFastIoUnlockAll
Definition: fastio.c:278
static FAST_IO_LOCK VfatFastIoLock
Definition: fastio.c:220
static FAST_IO_READ_COMPRESSED VfatFastIoReadCompressed
Definition: fastio.c:529
static FAST_IO_PREPARE_MDL_WRITE VfatPrepareMdlWrite
Definition: fastio.c:481
static FAST_IO_QUERY_NETWORK_OPEN_INFO VfatFastIoQueryNetworkOpenInfo
Definition: fastio.c:391
static FAST_IO_RELEASE_FOR_MOD_WRITE VfatReleaseForModWrite
Definition: fastio.c:654
#define ExAcquireResourceExclusiveLite(res, wait)
Definition: env_spec_w32.h:615
ERESOURCE * PERESOURCE
Definition: env_spec_w32.h:595
#define ExAcquireResourceSharedLite(res, wait)
Definition: env_spec_w32.h:621
@ Success
Definition: eventcreate.c:712
#define BooleanFlagOn(F, SF)
Definition: ext2fs.h:183
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2665
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN BOOLEAN ExclusiveLock
Definition: fatprocs.h:2714
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN CheckForReadOperation
Definition: fatprocs.h:2666
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ULONG BOOLEAN FailImmediately
Definition: fatprocs.h:2713
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
Definition: fatprocs.h:2711
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Outptr_ PMDL * MdlChain
Definition: fsrtlfuncs.h:49
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
Status
Definition: gdiplustypes.h:25
static CODE_SEG("PAGE")
Definition: isapnp.c:1482
if(dx< 0)
Definition: linetemp.h:194
#define ASSERT(a)
Definition: mode.c:44
#define FILE_STANDARD_INFORMATION
Definition: disk.h:54
#define FILE_BASIC_INFORMATION
Definition: disk.h:53
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
Definition: resource.c:1817
#define STATUS_SUCCESS
Definition: shellext.h:65
#define DPRINT
Definition: sndvol32.h:71
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
PFAST_IO_ACQUIRE_FOR_MOD_WRITE AcquireForModWrite
Definition: iotypes.h:1748
PFAST_IO_QUERY_STANDARD_INFO FastIoQueryStandardInfo
Definition: iotypes.h:1738
PFAST_IO_UNLOCK_ALL_BY_KEY FastIoUnlockAllByKey
Definition: iotypes.h:1742
PFAST_IO_RELEASE_FOR_CCFLUSH ReleaseForCcFlush
Definition: iotypes.h:1760
PFAST_IO_MDL_READ_COMPLETE MdlReadComplete
Definition: iotypes.h:1750
PFAST_IO_MDL_WRITE_COMPLETE_COMPRESSED MdlWriteCompleteCompressed
Definition: iotypes.h:1756
PFAST_IO_MDL_READ MdlRead
Definition: iotypes.h:1749
PFAST_IO_WRITE FastIoWrite
Definition: iotypes.h:1736
PFAST_IO_UNLOCK_ALL FastIoUnlockAll
Definition: iotypes.h:1741
PFAST_IO_QUERY_NETWORK_OPEN_INFO FastIoQueryNetworkOpenInfo
Definition: iotypes.h:1747
PFAST_IO_ACQUIRE_FOR_CCFLUSH AcquireForCcFlush
Definition: iotypes.h:1759
PFAST_IO_MDL_WRITE_COMPLETE MdlWriteComplete
Definition: iotypes.h:1752
ULONG SizeOfFastIoDispatch
Definition: iotypes.h:1733
PFAST_IO_DEVICE_CONTROL FastIoDeviceControl
Definition: iotypes.h:1743
PFAST_IO_ACQUIRE_FILE AcquireFileForNtCreateSection
Definition: iotypes.h:1744
PFAST_IO_READ FastIoRead
Definition: iotypes.h:1735
PFAST_IO_QUERY_BASIC_INFO FastIoQueryBasicInfo
Definition: iotypes.h:1737
PFAST_IO_LOCK FastIoLock
Definition: iotypes.h:1739
PFAST_IO_WRITE_COMPRESSED FastIoWriteCompressed
Definition: iotypes.h:1754
PFAST_IO_MDL_READ_COMPLETE_COMPRESSED MdlReadCompleteCompressed
Definition: iotypes.h:1755
PFAST_IO_UNLOCK_SINGLE FastIoUnlockSingle
Definition: iotypes.h:1740
PFAST_IO_READ_COMPRESSED FastIoReadCompressed
Definition: iotypes.h:1753
PFAST_IO_RELEASE_FILE ReleaseFileForNtCreateSection
Definition: iotypes.h:1745
PFAST_IO_PREPARE_MDL_WRITE PrepareMdlWrite
Definition: iotypes.h:1751
PFAST_IO_RELEASE_FOR_MOD_WRITE ReleaseForModWrite
Definition: iotypes.h:1758
PFAST_IO_CHECK_IF_POSSIBLE FastIoCheckIfPossible
Definition: iotypes.h:1734
PFAST_IO_QUERY_OPEN FastIoQueryOpen
Definition: iotypes.h:1757
PFAST_IO_DETACH_DEVICE FastIoDetachDevice
Definition: iotypes.h:1746
Definition: cdstruc.h:902
ULONG Flags
Definition: ntfs.h:536
ERESOURCE MainResource
Definition: ntfs.h:528
Definition: vfat.h:448
#define NTAPI
Definition: typedefs.h:36
#define IN
Definition: typedefs.h:39
uint32_t ULONG
Definition: typedefs.h:59
#define OUT
Definition: typedefs.h:40
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
struct _VFATFCB * PVFATFCB
#define FCB_IS_PAGE_FILE
Definition: vfat.h:436
NTSTATUS VfatGetBasicInformation(PFILE_OBJECT FileObject, PVFATFCB FCB, PDEVICE_EXTENSION DeviceExt, PFILE_BASIC_INFORMATION BasicInfo, PULONG BufferLength)
Definition: finfo.c:280
NTSTATUS VfatGetStandardInformation(PVFATFCB FCB, PFILE_STANDARD_INFORMATION StandardInfo, PULONG BufferLength)
Definition: finfo.c:73
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3771
_In_ WDFDPC _In_ BOOLEAN Wait
Definition: wdfdpc.h:170
_In_ WDFREQUEST _In_ size_t _In_ size_t _In_ ULONG IoControlCode
Definition: wdfio.h:325
_In_ WDFREQUEST _In_ size_t OutputBufferLength
Definition: wdfio.h:320
_In_ WDFREQUEST _In_ size_t _In_ size_t InputBufferLength
Definition: wdfio.h:322
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR OutputBuffer
Definition: wdfiotarget.h:863
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR InputBuffer
Definition: wdfiotarget.h:953
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT SourceDevice
Definition: iofuncs.h:690
_Must_inspect_result_ __drv_aliasesMem PDEVICE_OBJECT _In_ PDEVICE_OBJECT TargetDevice
Definition: iofuncs.h:691
_In_ PLARGE_INTEGER _Out_ struct _ERESOURCE ** ResourceToRelease
Definition: iotypes.h:1598
_Out_ PFILE_NETWORK_OPEN_INFORMATION NetworkInformation
Definition: iotypes.h:1703
_In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Out_ PVOID _Out_ PMDL _Out_ PIO_STATUS_BLOCK _Out_ struct _COMPRESSED_DATA_INFO * CompressedDataInfo
Definition: iotypes.h:1658
_In_ PLARGE_INTEGER _In_ ULONG _In_ ULONG _Out_ PVOID _Out_ PMDL _Out_ PIO_STATUS_BLOCK _Out_ struct _COMPRESSED_DATA_INFO _In_ ULONG CompressedDataInfoLength
Definition: iotypes.h:1659
* PFILE_OBJECT
Definition: iotypes.h:1998
struct _FAST_IO_DISPATCH FAST_IO_DISPATCH
_In_ PLARGE_INTEGER EndingOffset
Definition: iotypes.h:1597