ReactOS  0.4.14-dev-583-g2a1ba2c
fastio.cpp File Reference
#include "udffs.h"
Include dependency graph for fastio.cpp:

Go to the source code of this file.

Macros

#define UDF_BUG_CHECK_ID   UDF_FILE_FAST_IO
 
#define NtReqFcb   ((PtrUDFNTRequiredFCB)Context)
 
#define NtReqFcb   ((PtrUDFNTRequiredFCB)Context)
 

Functions

BOOLEAN NTAPI UDFFastIoCheckIfPossible (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, IN BOOLEAN CheckForReadOperation, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
FAST_IO_POSSIBLE NTAPI UDFIsFastIoPossible (IN PtrUDFFCB Fcb)
 
BOOLEAN NTAPI UDFFastIoQueryBasicInfo (IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_BASIC_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
BOOLEAN NTAPI UDFFastIoQueryStdInfo (IN PFILE_OBJECT FileObject, IN BOOLEAN Wait, OUT PFILE_STANDARD_INFORMATION Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 
VOID NTAPI UDFFastIoAcqCreateSec (IN PFILE_OBJECT FileObject)
 
VOID NTAPI UDFFastIoRelCreateSec (IN PFILE_OBJECT FileObject)
 
BOOLEAN NTAPI UDFAcqLazyWrite (IN PVOID Context, IN BOOLEAN Wait)
 
VOID NTAPI UDFRelLazyWrite (IN PVOID Context)
 
BOOLEAN NTAPI UDFAcqReadAhead (IN PVOID Context, IN BOOLEAN Wait)
 
VOID NTAPI UDFRelReadAhead (IN PVOID Context)
 
BOOLEAN NTAPI UDFFastIoCopyWrite (IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, IN PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
 

Macro Definition Documentation

◆ NtReqFcb [1/2]

#define NtReqFcb   ((PtrUDFNTRequiredFCB)Context)

◆ NtReqFcb [2/2]

#define NtReqFcb   ((PtrUDFNTRequiredFCB)Context)

◆ UDF_BUG_CHECK_ID

#define UDF_BUG_CHECK_ID   UDF_FILE_FAST_IO

Definition at line 20 of file fastio.cpp.

Function Documentation

◆ UDFAcqLazyWrite()

BOOLEAN NTAPI UDFAcqLazyWrite ( IN PVOID  Context,
IN BOOLEAN  Wait 
)

Definition at line 423 of file fastio.cpp.

426 {
427  // The context is whatever we passed to the Cache Manager when invoking
428  // the CcInitializeCacheMaps() function. In the case of the UDF FSD
429  // implementation, this context is a pointer to the NT_REQ_FCB structure.
431 
432  MmPrint((" UDFAcqLazyWrite()\n"));
433 
434  // Acquire the PagingIoResource in the NT_REQ_FCB exclusively. Then, set the
435  // lazy-writer thread id in the NT_REQ_FCB structure for identification
436  // when an actual write request is received by the FSD.
437  // Note: The lazy-writer typically always supplies WAIT set to TRUE.
438  if (!UDFAcquireResourceExclusive(&(NtReqFcb->PagingIoResource), Wait))
439  return FALSE;
440 
441  // Now, set the lazy-writer thread id.
442  ASSERT(!(NtReqFcb->LazyWriterThreadID));
443  NtReqFcb->LazyWriterThreadID = HandleToUlong(PsGetCurrentThreadId());
444 
447 
448  // If our FSD needs to perform some special preparations in anticipation
449  // of receving a lazy-writer request, do so now.
450  return TRUE;
451 } // end UDFAcqLazyWrite()
#define UDFAcquireResourceExclusive(Resource, CanWait)
Definition: env_spec_w32.h:656
#define TRUE
Definition: types.h:120
#define HandleToUlong(h)
Definition: basetsd.h:79
smooth NULL
Definition: ftsmooth.c:416
PsGetCurrentThreadId
Definition: CrNtStubs.h:7
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
#define MmPrint(_x_)
Definition: env_spec_w32.h:289
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define NtReqFcb
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
struct _UDFNTRequiredFCB * PtrUDFNTRequiredFCB
IN BOOLEAN Wait
Definition: fatprocs.h:1529

Referenced by UDFInitializeFunctionPointers().

◆ UDFAcqReadAhead()

BOOLEAN NTAPI UDFAcqReadAhead ( IN PVOID  Context,
IN BOOLEAN  Wait 
)

Definition at line 514 of file fastio.cpp.

518 {
519  // The context is whatever we passed to the Cache Manager when invoking
520  // the CcInitializeCacheMaps() function. In the case of the UDF FSD
521  // implementation, this context is a pointer to the NT_REQ_FCB structure.
522 #define NtReqFcb ((PtrUDFNTRequiredFCB)Context)
523 
524  MmPrint((" AcqForReadAhead()\n"));
525 
526  // Acquire the MainResource in the NT_REQ_FCB shared.
527  // Note: The read-ahead thread typically always supplies WAIT set to TRUE.
529  if (!UDFAcquireResourceShared(&(NtReqFcb->MainResource), Wait))
530  return FALSE;
531 
534 
535  return TRUE;
536 #undef NtReqFcb
537 
538 } // end UDFAcqReadAhead()
#define TRUE
Definition: types.h:120
smooth NULL
Definition: ftsmooth.c:416
PIRP NTAPI IoGetTopLevelIrp(VOID)
Definition: irp.c:1843
#define MmPrint(_x_)
Definition: env_spec_w32.h:289
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define NtReqFcb
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define UDFAcquireResourceShared(Resource, CanWait)
Definition: env_spec_w32.h:658
#define UDF_CHECK_PAGING_IO_RESOURCE(NTReqFCB)
Definition: udffs.h:262
#define FSRTL_CACHE_TOP_LEVEL_IRP
Definition: fsrtltypes.h:60
IN BOOLEAN Wait
Definition: fatprocs.h:1529

Referenced by UDFInitializeFunctionPointers().

◆ UDFFastIoAcqCreateSec()

VOID NTAPI UDFFastIoAcqCreateSec ( IN PFILE_OBJECT  FileObject)

Definition at line 342 of file fastio.cpp.

345 {
347 
348  MmPrint((" AcqForCreateSection()\n"));
349  // Acquire the MainResource exclusively for the file stream
350  if(!ExIsResourceAcquiredExclusiveLite(&(NtReqFcb->MainResource)) ||
351  !ExIsResourceAcquiredExclusiveLite(&(NtReqFcb->PagingIoResource)) ) {
353  } else {
354  MmPrint((" already acquired\n"));
355  }
356  UDFAcquireResourceExclusive(&(NtReqFcb->MainResource), TRUE);
357 
358  // Although this is typically not required, the UDF FSD will
359  // also acquire the PagingIoResource exclusively at this time
360  // to conform with the resource acquisition described in the set
361  // file information routine. Once again though, we will probably
362  // not need to do this.
363  UDFAcquireResourceExclusive(&(NtReqFcb->PagingIoResource), TRUE);
364  NtReqFcb->AcqSectionCount++;
365 
366  return;
367 } // end UDFFastIoAcqCreateSec()
#define UDFAcquireResourceExclusive(Resource, CanWait)
Definition: env_spec_w32.h:656
#define TRUE
Definition: types.h:120
BOOLEAN NTAPI ExIsResourceAcquiredExclusiveLite(IN PERESOURCE Resource)
Definition: resource.c:1619
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define MmPrint(_x_)
Definition: env_spec_w32.h:289
#define NtReqFcb
#define UDF_CHECK_PAGING_IO_RESOURCE(NTReqFCB)
Definition: udffs.h:262
struct _UDFNTRequiredFCB * PtrUDFNTRequiredFCB

Referenced by UDFInitializeFunctionPointers().

◆ UDFFastIoCheckIfPossible()

BOOLEAN NTAPI UDFFastIoCheckIfPossible ( IN PFILE_OBJECT  FileObject,
IN PLARGE_INTEGER  FileOffset,
IN ULONG  Length,
IN BOOLEAN  Wait,
IN ULONG  LockKey,
IN BOOLEAN  CheckForReadOperation,
OUT PIO_STATUS_BLOCK  IoStatus,
IN PDEVICE_OBJECT  DeviceObject 
)

Definition at line 42 of file fastio.cpp.

52 {
53  BOOLEAN ReturnedStatus = FALSE;
54  PtrUDFFCB Fcb = NULL;
55  PtrUDFCCB Ccb = NULL;
56  LARGE_INTEGER IoLength;
57 
58  // Obtain a pointer to the FCB and CCB for the file stream.
59  Ccb = (PtrUDFCCB)(FileObject->FsContext2);
60  ASSERT(Ccb);
61  Fcb = Ccb->Fcb;
62  ASSERT(Fcb);
63 
64  // Validate that this is a fast-IO request to a regular file.
65  // The UDF FSD for example, will not allow fast-IO requests
66  // to volume objects, or to directories.
67  if ((Fcb->NodeIdentifier.NodeType == UDF_NODE_TYPE_VCB) ||
68  (Fcb->FCBFlags & UDF_FCB_DIRECTORY)) {
69  // This is not allowed.
71  MmPrint((" UDFFastIoCheckIfPossible() TRUE, Failed\n"));
72  return FALSE;
73  }
74 /*
75  // back pressure for very smart and fast system cache ;)
76  if(Fcb->Vcb->VerifyCtx.ItemCount >= UDF_MAX_VERIFY_CACHE) {
77  AdPrint((" Verify queue overflow -> UDFFastIoCheckIfPossible() = FALSE\n"));
78  return FALSE;
79  }
80 */
81  IoLength.QuadPart = Length;
82 
83  // The FSD can determine the checks that it needs to perform.
84  // Typically, a FSD will check whether there exist any byte-range
85  // locks that would prevent a fast-IO operation from proceeding.
86 
87  // ... (FSD specific checks go here).
88 
90  // The following routine is exported by the FSRTL
91  // package and it returns TRUE if the read operation should be
92  // allowed to proceed based on the status of the current byte-range
93  // locks on the file stream. If we do not use the FSRTL package
94  // for byte-range locking support, then we must substitute our
95  // own checks over here.
96  ReturnedStatus = FsRtlFastCheckLockForRead(&(Fcb->NTRequiredFCB->FileLock),
97  FileOffset, &IoLength, LockKey, FileObject,
99  } else {
100 // if(Fcb->Vcb->VCBFlags );
101  // This is a write request. Invoke the FSRTL byte-range lock package
102  // to see whether the write should be allowed to proceed.
103  ReturnedStatus = FsRtlFastCheckLockForWrite(&(Fcb->NTRequiredFCB->FileLock),
104  FileOffset, &IoLength, LockKey, FileObject,
106  }
107 
108  MmPrint((" UDFFastIoCheckIfPossible() %s\n", ReturnedStatus ? "TRUE" : "FALSE"));
109  return(ReturnedStatus);
110 // return FALSE;
111 
112 } // end UDFFastIoCheckIfPossible()
FILE_LOCK FileLock
Definition: fatstruc.h:1070
struct _UDFContextControlBlock * PtrUDFCCB
BOOLEAN NTAPI FsRtlFastCheckLockForRead(IN PFILE_LOCK FileLock, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN ULONG Key, IN PFILE_OBJECT FileObject, IN PVOID Process)
Definition: filelock.c:752
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define UDF_NODE_TYPE_VCB
Definition: struct.h:61
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN CheckForReadOperation
Definition: fatprocs.h:2650
#define PsGetCurrentProcess
Definition: psfuncs.h:17
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2650
#define UDF_FCB_DIRECTORY
Definition: struct.h:303
#define MmPrint(_x_)
Definition: env_spec_w32.h:289
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
struct _FCB::@708::@711 Fcb
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:151
_In_ PFCB Fcb
Definition: cdprocs.h:151
BOOLEAN NTAPI FsRtlFastCheckLockForWrite(IN PFILE_LOCK FileLock, IN PLARGE_INTEGER FileOffset, IN PLARGE_INTEGER Length, IN ULONG Key, IN PFILE_OBJECT FileObject, IN PVOID Process)
Definition: filelock.c:786
LONGLONG QuadPart
Definition: typedefs.h:112

Referenced by UDFInitializeFunctionPointers().

◆ UDFFastIoCopyWrite()

BOOLEAN NTAPI UDFFastIoCopyWrite ( IN PFILE_OBJECT  FileObject,
IN PLARGE_INTEGER  FileOffset,
IN ULONG  Length,
IN BOOLEAN  Wait,
IN ULONG  LockKey,
IN PVOID  Buffer,
OUT PIO_STATUS_BLOCK  IoStatus,
IN PDEVICE_OBJECT  DeviceObject 
)

Definition at line 1160 of file fastio.cpp.

1170 {
1171  PtrUDFFCB Fcb = NULL;
1172  PtrUDFCCB Ccb = NULL;
1173 
1174  // Obtain a pointer to the FCB and CCB for the file stream.
1175  Ccb = (PtrUDFCCB)(FileObject->FsContext2);
1176  ASSERT(Ccb);
1177  Fcb = Ccb->Fcb;
1178  ASSERT(Fcb);
1179 
1180  // back pressure for very smart and fast system cache ;)
1181  if(Fcb->Vcb->VerifyCtx.QueuedCount ||
1182  Fcb->Vcb->VerifyCtx.ItemCount >= UDF_MAX_VERIFY_CACHE) {
1183  AdPrint((" Verify queue overflow -> UDFFastIoCopyWrite() = FALSE\n"));
1184  return FALSE;
1185  }
1186  if(Fcb->NTRequiredFCB->SectionObject.DataSectionObject &&
1187  Length >= 0x10000 &&
1188  FileOffset->LowPart &&
1189  !(FileOffset->LowPart & 0x00ffffff)) {
1190 
1191  MmPrint((" no FastIo 16Mb\n"));
1192  return FALSE;
1193  }
1195 
1196 } // end UDFFastIoCopyWrite()
struct _UDFContextControlBlock * PtrUDFCCB
#define AdPrint(_x_)
Definition: env_spec_w32.h:292
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define UDF_MAX_VERIFY_CACHE
Definition: udf_info.h:1255
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG LockKey
Definition: fatprocs.h:2650
#define MmPrint(_x_)
Definition: env_spec_w32.h:289
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
struct _FCB::@708::@711 Fcb
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
IN PDEVICE_OBJECT DeviceObject
Definition: fatprocs.h:1560
_In_ PFCB _In_ LONGLONG FileOffset
Definition: cdprocs.h:151
BOOLEAN NTAPI FsRtlCopyWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN ULONG LockKey, OUT PVOID Buffer, OUT PIO_STATUS_BLOCK IoStatus, IN PDEVICE_OBJECT DeviceObject)
Definition: fastio.c:264
PVCB Vcb
Definition: cdstruc.h:939
_In_ PFCB Fcb
Definition: cdprocs.h:151
IN BOOLEAN Wait
Definition: fatprocs.h:1529

Referenced by UDFInitializeFunctionPointers().

◆ UDFFastIoQueryBasicInfo()

BOOLEAN NTAPI UDFFastIoQueryBasicInfo ( IN PFILE_OBJECT  FileObject,
IN BOOLEAN  Wait,
OUT PFILE_BASIC_INFORMATION  Buffer,
OUT PIO_STATUS_BLOCK  IoStatus,
IN PDEVICE_OBJECT  DeviceObject 
)

Definition at line 159 of file fastio.cpp.

166 {
167  BOOLEAN ReturnedStatus = FALSE; // fast i/o failed/not allowed
169  PtrUDFIrpContext PtrIrpContext = NULL;
171  PtrUDFFCB Fcb;
172  PtrUDFCCB Ccb;
174  BOOLEAN MainResourceAcquired = FALSE;
175 
177 
178  UDFPrint(("UDFFastIo \n"));
179  // if the file is already opended we can satisfy this request
180  // immediately 'cause all the data we need must be cached
181  _SEH2_TRY {
182 
183  _SEH2_TRY {
184 
185  // Get the FCB and CCB pointers.
186  Ccb = (PtrUDFCCB)(FileObject->FsContext2);
187  ASSERT(Ccb);
188  Fcb = Ccb->Fcb;
189  ASSERT(Fcb);
190  NtReqFcb = Fcb->NTRequiredFCB;
191  //Fcb->Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK;
192 
193  if (!(Fcb->FCBFlags & UDF_FCB_PAGE_FILE)) {
194  // Acquire the MainResource shared.
196  if (!UDFAcquireResourceShared(&(NtReqFcb->MainResource), Wait)) {
198  }
199  MainResourceAcquired = TRUE;
200  }
201 
202  ReturnedStatus =
204 
206 
207  RC = UDFExceptionHandler(PtrIrpContext, NULL);
208 
210 
211  } _SEH2_END;
212 try_exit: NOTHING;
213  } _SEH2_FINALLY {
214  if (MainResourceAcquired) {
216  UDFReleaseResource(&(NtReqFcb->MainResource));
217  MainResourceAcquired = FALSE;
218  }
219  IoStatus->Status = RC;
220  if(ReturnedStatus) {
221  IoStatus->Information = sizeof(FILE_BASIC_INFORMATION);
222  } else {
223  IoStatus->Information = 0;
224  }
225  } _SEH2_END;
226 
228 
229  return(ReturnedStatus);
230 } // end UDFFastIoQueryBasicInfo()
#define UDFPrint(Args)
Definition: udffs.h:225
#define TRUE
Definition: types.h:120
struct _UDFContextControlBlock * PtrUDFCCB
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
VOID UDFLogEvent(NTSTATUS UDFEventLogId, NTSTATUS RC)
Definition: misc.cpp:575
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
LONG NTSTATUS
Definition: precomp.h:26
NTSTATUS UDFGetBasicInformation(IN PFILE_OBJECT FileObject, IN PtrUDFFCB Fcb, IN PFILE_BASIC_INFORMATION PtrBuffer, IN OUT LONG *PtrReturnedLength)
Definition: fileinfo.cpp:532
_SEH2_TRY
Definition: create.c:4250
long LONG
Definition: pedump.c:60
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:11
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
NTSTATUS UDFExceptionHandler(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
Definition: misc.cpp:358
#define try_return(S)
Definition: cdprocs.h:2189
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define NtReqFcb
long UDFExceptionFilter(PtrUDFIrpContext PtrIrpContext, PEXCEPTION_POINTERS PtrExceptionPointers)
Definition: misc.cpp:265
struct _FCB::@708::@711 Fcb
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define NOTHING
Definition: env_spec_w32.h:461
#define UDFAcquireResourceShared(Resource, CanWait)
Definition: env_spec_w32.h:658
#define UDF_FCB_PAGE_FILE
Definition: struct.h:302
#define UDF_ERROR_INTERNAL_ERROR
Definition: errmsg.h:71
_SEH2_END
Definition: create.c:4424
#define UDF_CHECK_PAGING_IO_RESOURCE(NTReqFCB)
Definition: udffs.h:262
_SEH2_FINALLY
Definition: create.c:4395
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2938
#define STATUS_CANT_WAIT
Definition: ntstatus.h:438
IN BOOLEAN Wait
Definition: fatprocs.h:1529
#define FILE_BASIC_INFORMATION
Definition: disk.h:53

Referenced by UDFInitializeFunctionPointers().

◆ UDFFastIoQueryStdInfo()

BOOLEAN NTAPI UDFFastIoQueryStdInfo ( IN PFILE_OBJECT  FileObject,
IN BOOLEAN  Wait,
OUT PFILE_STANDARD_INFORMATION  Buffer,
OUT PIO_STATUS_BLOCK  IoStatus,
IN PDEVICE_OBJECT  DeviceObject 
)

Definition at line 250 of file fastio.cpp.

256 {
257  BOOLEAN ReturnedStatus = FALSE; // fast i/o failed/not allowed
259  PtrUDFIrpContext PtrIrpContext = NULL;
261  PtrUDFFCB Fcb;
262  PtrUDFCCB Ccb;
263 // PtrUDFNTRequiredFCB NtReqFcb = NULL;
264 // BOOLEAN MainResourceAcquired = FALSE;
265 
267 
268  UDFPrint(("UDFFastIo \n"));
269  // if the file is already opended we can satisfy this request
270  // immediately 'cause all the data we need must be cached
271  _SEH2_TRY {
272 
273  _SEH2_TRY {
274 
275  // Get the FCB and CCB pointers.
276  Ccb = (PtrUDFCCB)(FileObject->FsContext2);
277  ASSERT(Ccb);
278  Fcb = Ccb->Fcb;
279  ASSERT(Fcb);
280 // NtReqFcb = Fcb->NTRequiredFCB;
281  //Fcb->Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK;
282 
283 /*
284  if (!(Fcb->FCBFlags & UDF_FCB_PAGE_FILE)) {
285  // Acquire the MainResource shared.
286  UDF_CHECK_PAGING_IO_RESOURCE(NtReqFcb);
287  if (!UDFAcquireResourceShared(&(NtReqFcb->MainResource), Wait)) {
288  try_return(RC = STATUS_CANT_WAIT);
289  }
290  MainResourceAcquired = TRUE;
291  }
292 */
293  ReturnedStatus =
295 
297 
298  RC = UDFExceptionHandler(PtrIrpContext, NULL);
299 
301 
302  } _SEH2_END;
303 //try_exit: NOTHING;
304  } _SEH2_FINALLY {
305 /*
306  if (MainResourceAcquired) {
307  UDFReleaseResource(&(NtReqFcb->MainResource));
308  MainResourceAcquired = FALSE;
309  }
310 */
311  IoStatus->Status = RC;
312  if(ReturnedStatus) {
313  IoStatus->Information = sizeof(FILE_STANDARD_INFORMATION);
314  } else {
315  IoStatus->Information = 0;
316  }
317  } _SEH2_END;
318 
320 
321  return(ReturnedStatus);
322 } // end UDFFastIoQueryStdInfo()
#define UDFPrint(Args)
Definition: udffs.h:225
struct _UDFContextControlBlock * PtrUDFCCB
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
IN PLARGE_INTEGER IN ULONG IN BOOLEAN IN ULONG IN BOOLEAN OUT PIO_STATUS_BLOCK IoStatus
Definition: fatprocs.h:2650
VOID UDFLogEvent(NTSTATUS UDFEventLogId, NTSTATUS RC)
Definition: misc.cpp:575
LONG NTSTATUS
Definition: precomp.h:26
_SEH2_TRY
Definition: create.c:4250
long LONG
Definition: pedump.c:60
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:11
unsigned char BOOLEAN
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
NTSTATUS UDFExceptionHandler(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
Definition: misc.cpp:358
NTSTATUS UDFGetStandardInformation(IN PtrUDFFCB Fcb, IN PFILE_STANDARD_INFORMATION PtrBuffer, IN OUT LONG *PtrReturnedLength)
Definition: fileinfo.cpp:614
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:101
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define FILE_STANDARD_INFORMATION
Definition: disk.h:54
long UDFExceptionFilter(PtrUDFIrpContext PtrIrpContext, PEXCEPTION_POINTERS PtrExceptionPointers)
Definition: misc.cpp:265
struct _FCB::@708::@711 Fcb
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:593
#define UDF_ERROR_INTERNAL_ERROR
Definition: errmsg.h:71
_SEH2_END
Definition: create.c:4424
_SEH2_FINALLY
Definition: create.c:4395
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
_In_ PFCB Fcb
Definition: cdprocs.h:151
return STATUS_SUCCESS
Definition: btrfs.c:2938

Referenced by UDFInitializeFunctionPointers().

◆ UDFFastIoRelCreateSec()

VOID NTAPI UDFFastIoRelCreateSec ( IN PFILE_OBJECT  FileObject)

Definition at line 387 of file fastio.cpp.

389 {
391 
392  MmPrint((" RelFromCreateSection()\n"));
393 
394  NtReqFcb->AcqSectionCount--;
395  // Release the PagingIoResource for the file stream
396  UDFReleaseResource(&(NtReqFcb->PagingIoResource));
397 
398  // Release the MainResource for the file stream
399  UDFReleaseResource(&(NtReqFcb->MainResource));
400 
401  return;
402 } // end UDFFastIoRelCreateSec()
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
_Inout_ PFILE_OBJECT FileObject
Definition: cdprocs.h:593
#define MmPrint(_x_)
Definition: env_spec_w32.h:289
#define NtReqFcb
struct _UDFNTRequiredFCB * PtrUDFNTRequiredFCB

Referenced by UDFInitializeFunctionPointers().

◆ UDFIsFastIoPossible()

FAST_IO_POSSIBLE NTAPI UDFIsFastIoPossible ( IN PtrUDFFCB  Fcb)

Definition at line 118 of file fastio.cpp.

121 {
122  if( !(Fcb->Vcb->VCBFlags & UDF_VCB_FLAGS_VOLUME_MOUNTED) /*||
123  !FsRtlOplockIsFastIoPossible(&(Fcb->Oplock))*/ ) {
124  UDFPrint((" FastIoIsNotPossible\n"));
125  return FastIoIsNotPossible;
126  }
127 /*
128  // back pressure for very smart and fast system cache ;)
129  if(Fcb->Vcb->VerifyCtx.ItemCount >= UDF_MAX_VERIFY_CACHE) {
130  AdPrint((" Verify queue overflow -> UDFIsFastIoPossible() = FastIoIsNotPossible\n"));
131  return FastIoIsNotPossible;
132  }
133 */
134  if(FsRtlAreThereCurrentFileLocks(&(Fcb->NTRequiredFCB->FileLock)) ) {
135  UDFPrint((" FastIoIsQuestionable\n"));
136  return FastIoIsQuestionable;
137  }
138  UDFPrint((" FastIoIsPossible\n"));
139  return FastIoIsPossible;
140 } // end UDFIsFastIoPossible()
FILE_LOCK FileLock
Definition: fatstruc.h:1070
#define UDFPrint(Args)
Definition: udffs.h:225
#define FsRtlAreThereCurrentFileLocks(FL)
Definition: fsrtlfuncs.h:1584
#define UDF_VCB_FLAGS_VOLUME_MOUNTED
Definition: udf_common.h:459
PVCB Vcb
Definition: cdstruc.h:939
_In_ PFCB Fcb
Definition: cdprocs.h:151

Referenced by UDFCommonCleanup(), UDFCommonCreate(), UDFCommonRead(), UDFCommonWrite(), UDFFastLock(), UDFFastUnlockAll(), UDFFastUnlockAllByKey(), UDFFastUnlockSingle(), UDFSetAllocationInformation(), and UDFSetEOF().

◆ UDFRelLazyWrite()

VOID NTAPI UDFRelLazyWrite ( IN PVOID  Context)

Definition at line 472 of file fastio.cpp.

474 {
475  // The context is whatever we passed to the Cache Manager when invoking
476  // the CcInitializeCacheMaps() function. In the case of the UDF FSD
477  // implementation, this context is a pointer to the NT_REQ_FCB structure.
479 
480  MmPrint((" UDFRelLazyWrite()\n"));
481 
482  // Remove the current thread-id from the NT_REQ_FCB
483  // and release the MainResource.
484  ASSERT((NtReqFcb->LazyWriterThreadID) == HandleToUlong(PsGetCurrentThreadId()));
485  NtReqFcb->LazyWriterThreadID = 0;
486 
487  // Release the acquired resource.
488  UDFReleaseResource(&(NtReqFcb->PagingIoResource));
489 
491  return;
492 } // end UDFRelLazyWrite()
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
#define HandleToUlong(h)
Definition: basetsd.h:79
smooth NULL
Definition: ftsmooth.c:416
PsGetCurrentThreadId
Definition: CrNtStubs.h:7
#define MmPrint(_x_)
Definition: env_spec_w32.h:289
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define NtReqFcb
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
struct _UDFNTRequiredFCB * PtrUDFNTRequiredFCB

Referenced by UDFInitializeFunctionPointers().

◆ UDFRelReadAhead()

VOID NTAPI UDFRelReadAhead ( IN PVOID  Context)

Definition at line 558 of file fastio.cpp.

560 {
561  // The context is whatever we passed to the Cache Manager when invoking
562  // the CcInitializeCacheMaps() function. In the case of the UDF FSD
563  // implementation, this context is a pointer to the NT_REQ_FCB structure.
564 #define NtReqFcb ((PtrUDFNTRequiredFCB)Context)
565 
566  MmPrint((" RelFromReadAhead()\n"));
567 
568  // Release the acquired resource.
570  UDFReleaseResource(&(NtReqFcb->MainResource));
571 
572  // Of course, the FSD should undo whatever else seems appropriate at this
573  // time.
575 
576  return;
577 #undef NtReqFcb
578 } // end UDFRelReadAhead()
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
smooth NULL
Definition: ftsmooth.c:416
#define MmPrint(_x_)
Definition: env_spec_w32.h:289
#define NtReqFcb
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define UDF_CHECK_PAGING_IO_RESOURCE(NTReqFCB)
Definition: udffs.h:262

Referenced by UDFInitializeFunctionPointers().