ReactOS 0.4.16-dev-329-g9223134
flush.cpp File Reference
#include "udffs.h"
Include dependency graph for flush.cpp:

Go to the source code of this file.

Macros

#define UDF_BUG_CHECK_ID   UDF_FILE_FLUSH
 

Functions

NTSTATUS NTAPI UDFFlush (PDEVICE_OBJECT DeviceObject, PIRP Irp)
 
NTSTATUS UDFCommonFlush (PtrUDFIrpContext PtrIrpContext, PIRP Irp)
 
ULONG UDFFlushAFile (IN PtrUDFFCB Fcb, IN PtrUDFCCB Ccb, OUT PIO_STATUS_BLOCK PtrIoStatus, IN ULONG FlushFlags)
 
ULONG UDFFlushADirectory (IN PVCB Vcb, IN PUDF_FILE_INFO FI, OUT PIO_STATUS_BLOCK PtrIoStatus, IN ULONG FlushFlags)
 
ULONG UDFFlushLogicalVolume (IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp, IN PVCB Vcb, IN ULONG FlushFlags)
 
NTSTATUS NTAPI UDFFlushCompletion (PDEVICE_OBJECT PtrDeviceObject, PIRP Irp, PVOID Context)
 
BOOLEAN UDFFlushIsBreaking (IN PVCB Vcb, IN ULONG FlushFlags)
 
VOID UDFFlushTryBreak (IN PVCB Vcb)
 

Macro Definition Documentation

◆ UDF_BUG_CHECK_ID

#define UDF_BUG_CHECK_ID   UDF_FILE_FLUSH

Definition at line 20 of file flush.cpp.

Function Documentation

◆ UDFCommonFlush()

NTSTATUS UDFCommonFlush ( PtrUDFIrpContext  PtrIrpContext,
PIRP  Irp 
)

Definition at line 110 of file flush.cpp.

114{
120 PVCB Vcb = NULL;
122 BOOLEAN AcquiredVCB = FALSE;
123 BOOLEAN AcquiredFCB = FALSE;
124 BOOLEAN PostRequest = FALSE;
125 BOOLEAN CanWait = TRUE;
126
127 UDFPrint(("UDFCommonFlush: \n"));
128
129 _SEH2_TRY {
130
131 // Get some of the parameters supplied to us
132 CanWait = ((PtrIrpContext->IrpContextFlags & UDF_IRP_CONTEXT_CAN_BLOCK) ? TRUE : FALSE);
133 // If we cannot wait, post the request immediately since a flush is inherently blocking/synchronous.
134 if (!CanWait) {
135 PostRequest = TRUE;
136 try_return(RC);
137 }
138
139 // First, get a pointer to the current I/O stack location
141 ASSERT(IrpSp);
142
145
146 // Get the FCB and CCB pointers
147 Ccb = (PtrUDFCCB)(FileObject->FsContext2);
148 ASSERT(Ccb);
149 Fcb = Ccb->Fcb;
150 ASSERT(Fcb);
151 NtReqFcb = Fcb->NTRequiredFCB;
152
153 // Check the type of object passed-in. That will determine the course of
154 // action we take.
155 if ((Fcb->NodeIdentifier.NodeType == UDF_NODE_TYPE_VCB) || (Fcb->FCBFlags & UDF_FCB_ROOT_DIRECTORY)) {
156
157 if (Fcb->NodeIdentifier.NodeType == UDF_NODE_TYPE_VCB) {
158 Vcb = (PVCB)(Fcb);
159 } else {
160 Vcb = Fcb->Vcb;
161 }
162 Vcb->VCBFlags |= UDF_VCB_SKIP_EJECT_CHECK;
163
164#ifdef UDF_DELAYED_CLOSE
166#endif //UDF_DELAYED_CLOSE
167
168 UDFAcquireResourceExclusive(&(Vcb->VCBResource), TRUE);
169 AcquiredVCB = TRUE;
170 // The caller wishes to flush all files for the mounted
171 // logical volume. The flush volume routine below should simply
172 // walk through all of the open file streams, acquire the
173 // VCB resource, and request the flush operation from the Cache
174 // Manager. Basically, the sequence of operations listed below
175 // for a single file should be executed on all open files.
176
177 UDFFlushLogicalVolume(PtrIrpContext, Irp, Vcb, 0);
178
179 UDFReleaseResource(&(Vcb->VCBResource));
180 AcquiredVCB = FALSE;
181
182 try_return(RC);
183 } else
184 if (!(Fcb->FCBFlags & UDF_FCB_DIRECTORY)) {
185 // This is a regular file.
186 Vcb = Fcb->Vcb;
187 ASSERT(Vcb);
188 if(!ExIsResourceAcquiredExclusiveLite(&(Vcb->VCBResource)) &&
189 !ExIsResourceAcquiredSharedLite(&(Vcb->VCBResource))) {
190 UDFAcquireResourceShared(&(Vcb->VCBResource), TRUE);
191 AcquiredVCB = TRUE;
192 }
194 UDFAcquireResourceExclusive(&(NtReqFcb->MainResource), TRUE);
195 AcquiredFCB = TRUE;
196
197 // Request the Cache Manager to perform a flush operation.
198 // Further, instruct the Cache Manager that we wish to flush the
199 // entire file stream.
200 UDFFlushAFile(Fcb, Ccb, &(Irp->IoStatus), 0);
201 RC = Irp->IoStatus.Status;
202
203 // Some log-based FSD implementations may wish to flush their
204 // log files at this time. Finally, we should update the time-stamp
205 // values for the file stream appropriately. This would involve
206 // obtaining the current time and modifying the appropriate directory
207 // entry fields.
208 } else {
209 Vcb = Fcb->Vcb;
210 }
211
212try_exit: NOTHING;
213
214 } _SEH2_FINALLY {
215
216 if (AcquiredFCB) {
218 UDFReleaseResource(&(NtReqFcb->MainResource));
219 AcquiredFCB = FALSE;
220 }
221 if (AcquiredVCB) {
222 UDFReleaseResource(&(Vcb->VCBResource));
223 AcquiredVCB = FALSE;
224 }
225
227 if (PostRequest) {
228 // Nothing to lock now.
229 BrutePoint();
230 RC = UDFPostRequest(PtrIrpContext, Irp);
231 } else {
232 // Some applications like this request very much
233 // (ex. WinWord). But it's not a good idea for CD-R/RW media
234 if(Vcb->FlushMedia) {
235 PIO_STACK_LOCATION PtrNextIoStackLocation = NULL;
237
238 // Send the request down at this point.
239 // To do this, we must set the next IRP stack location, and
240 // maybe set a completion routine.
241 // Be careful about marking the IRP pending if the lower level
242 // driver returned pending and we do have a completion routine!
243 PtrNextIoStackLocation = IoGetNextIrpStackLocation(Irp);
244 *PtrNextIoStackLocation = *IrpSp;
245
246 // Set the completion routine to "eat-up" any
247 // STATUS_INVALID_DEVICE_REQUEST error code returned by the lower
248 // level driver.
250
251 RC1 = IoCallDriver(Vcb->TargetDeviceObject, Irp);
252
253 RC = ((RC1 == STATUS_INVALID_DEVICE_REQUEST) ? RC : RC1);
254
255 // Release the IRP context at this time.
256 UDFReleaseIrpContext(PtrIrpContext);
257 } else {
258 Irp->IoStatus.Status = RC;
259 Irp->IoStatus.Information = 0;
260 // Free up the Irp Context
261 UDFReleaseIrpContext(PtrIrpContext);
262 // complete the IRP
264 }
265 }
266 }
267 } _SEH2_END;
268
269 return(RC);
270} // end UDFCommonFlush()
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
unsigned char BOOLEAN
LONG NTSTATUS
Definition: precomp.h:26
_In_ PFCB Fcb
Definition: cdprocs.h:159
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
Definition: cdprocs.h:592
#define try_return(S)
Definition: cdprocs.h:2179
struct _VCB * PVCB
Definition: fatstruc.h:557
VOID UDFCloseAllDelayed(IN PVCB Vcb)
Definition: close.cpp:754
_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
_In_ PIO_STACK_LOCATION IrpSp
Definition: create.c:4137
NTSTATUS UDFPostRequest(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp)
Definition: misc.cpp:1128
VOID UDFReleaseIrpContext(PtrUDFIrpContext PtrIrpContext)
Definition: misc.cpp:1086
#define UDFReleaseResource(Resource)
Definition: env_spec_w32.h:661
#define UDFAcquireResourceShared(Resource, CanWait)
Definition: env_spec_w32.h:658
#define UDFAcquireResourceExclusive(Resource, CanWait)
Definition: env_spec_w32.h:656
#define BrutePoint()
Definition: env_spec_w32.h:504
#define NtReqFcb
ULONG UDFFlushLogicalVolume(IN PtrUDFIrpContext PtrIrpContext, IN PIRP Irp, IN PVCB Vcb, IN ULONG FlushFlags)
Definition: flush.cpp:506
NTSTATUS NTAPI UDFFlushCompletion(PDEVICE_OBJECT PtrDeviceObject, PIRP Irp, PVOID Context)
Definition: flush.cpp:578
ULONG UDFFlushAFile(IN PtrUDFFCB Fcb, IN PtrUDFCCB Ccb, OUT PIO_STATUS_BLOCK PtrIoStatus, IN ULONG FlushFlags)
Definition: flush.cpp:288
#define NOTHING
Definition: input_list.c:10
#define IoSetCompletionRoutine(_Irp, _CompletionRoutine, _Context, _InvokeOnSuccess, _InvokeOnError, _InvokeOnCancel)
Definition: irp.cpp:490
#define ASSERT(a)
Definition: mode.c:44
BOOLEAN NTAPI ExIsResourceAcquiredExclusiveLite(IN PERESOURCE Resource)
Definition: resource.c:1624
ULONG NTAPI ExIsResourceAcquiredSharedLite(IN PERESOURCE Resource)
Definition: resource.c:1663
#define IoCompleteRequest
Definition: irp.c:1240
#define IoCallDriver
Definition: irp.c:1225
#define Vcb
Definition: cdprocs.h:1415
#define _SEH2_AbnormalTermination()
Definition: pseh2_64.h:166
#define _SEH2_FINALLY
Definition: pseh2_64.h:114
#define _SEH2_END
Definition: pseh2_64.h:155
#define _SEH2_TRY
Definition: pseh2_64.h:55
#define STATUS_SUCCESS
Definition: shellext.h:65
#define UDF_IRP_CONTEXT_CAN_BLOCK
Definition: struct.h:385
struct _UDFContextControlBlock * PtrUDFCCB
#define UDF_FCB_ROOT_DIRECTORY
Definition: struct.h:304
#define UDF_NODE_TYPE_VCB
Definition: struct.h:61
#define UDF_FCB_DIRECTORY
Definition: struct.h:303
PVCB Vcb
Definition: cdstruc.h:933
struct _FCB::@731::@734 Fcb
PFILE_OBJECT FileObject
Definition: iotypes.h:3169
uint32 IrpContextFlags
Definition: struct.h:364
Definition: cdstruc.h:498
#define UDF_VCB_SKIP_EJECT_CHECK
Definition: udf_common.h:470
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
#define UDF_CHECK_PAGING_IO_RESOURCE(NTReqFCB)
Definition: udffs.h:260
#define UDFPrint(Args)
Definition: udffs.h:223
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
Definition: wdfdevice.h:550
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
* PFILE_OBJECT
Definition: iotypes.h:1998
#define IO_DISK_INCREMENT
Definition: iotypes.h:600

Referenced by UDFFlush().

◆ UDFFlush()

NTSTATUS NTAPI UDFFlush ( PDEVICE_OBJECT  DeviceObject,
PIRP  Irp 
)

Definition at line 42 of file flush.cpp.

45{
47 PtrUDFIrpContext PtrIrpContext = NULL;
48 BOOLEAN AreWeTopLevel = FALSE;
49
50 UDFPrint(("UDFFlush: \n"));
51
54 ASSERT(Irp);
55
56 // set the top level context
57 AreWeTopLevel = UDFIsIrpTopLevel(Irp);
58 ASSERT(!UDFIsFSDevObj(DeviceObject));
59
60 _SEH2_TRY {
61
62 // get an IRP context structure and issue the request
63 PtrIrpContext = UDFAllocateIrpContext(Irp, DeviceObject);
64 if(PtrIrpContext) {
65 RC = UDFCommonFlush(PtrIrpContext, Irp);
66 } else {
68 Irp->IoStatus.Status = RC;
69 Irp->IoStatus.Information = 0;
70 // complete the IRP
72 }
73
75
76 RC = UDFExceptionHandler(PtrIrpContext, Irp);
77
79 } _SEH2_END;
80
81 if (AreWeTopLevel) {
83 }
84
86
87 return(RC);
88} // end UDFFlush()
NTSTATUS UDFExceptionHandler(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
Definition: misc.cpp:358
BOOLEAN __fastcall UDFIsIrpTopLevel(PIRP Irp)
Definition: misc.cpp:228
VOID UDFLogEvent(NTSTATUS UDFEventLogId, NTSTATUS RC)
Definition: misc.cpp:575
PtrUDFIrpContext UDFAllocateIrpContext(PIRP Irp, PDEVICE_OBJECT PtrTargetDeviceObject)
Definition: misc.cpp:985
long UDFExceptionFilter(PtrUDFIrpContext PtrIrpContext, PEXCEPTION_POINTERS PtrExceptionPointers)
Definition: misc.cpp:265
#define UDF_ERROR_INTERNAL_ERROR
Definition: errmsg.h:71
NTSTATUS UDFCommonFlush(PtrUDFIrpContext PtrIrpContext, PIRP Irp)
Definition: flush.cpp:110
#define FsRtlEnterFileSystem
#define FsRtlExitFileSystem
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
Definition: irp.c:2000
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:66
#define _SEH2_GetExceptionInformation()
Definition: pseh2_64.h:164
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055

Referenced by UDFInitializeFunctionPointers().

◆ UDFFlushADirectory()

ULONG UDFFlushADirectory ( IN PVCB  Vcb,
IN PUDF_FILE_INFO  FI,
OUT PIO_STATUS_BLOCK  PtrIoStatus,
IN ULONG  FlushFlags 
)

Definition at line 415 of file flush.cpp.

421{
422 UDFPrint(("UDFFlushADirectory: \n"));
423// PDIR_INDEX_HDR hDI;
425// BOOLEAN Referenced = FALSE;
426 ULONG ret_val = 0;
427
428 if(Vcb->VCBFlags & UDF_VCB_FLAGS_RAW_DISK)
429 return 0;
430
431 if(!FI || !FI->Dloc || !FI->Dloc->DirIndex) goto SkipFlushDir;
432// hDI = FI->Dloc->DirIndex;
433
434 // Flush Security if required
435 _SEH2_TRY {
436 UDFWriteSecurity(Vcb, FI->Fcb, &(FI->Fcb->NTRequiredFCB->SecurityDesc));
438 BrutePoint();
439 } _SEH2_END;
440 // Flush SDir if any
441 _SEH2_TRY {
442 if(UDFHasAStreamDir(FI) &&
443 FI->Dloc->SDirInfo &&
444 !UDFIsSDirDeleted(FI->Dloc->SDirInfo) ) {
445 ret_val |=
446 UDFFlushADirectory(Vcb, FI->Dloc->SDirInfo, PtrIoStatus, FlushFlags);
447 }
449 BrutePoint();
450 } _SEH2_END;
451
452 // Flush Dir Tree
453 _SEH2_TRY {
454 UDF_DIR_SCAN_CONTEXT ScanContext;
455 PUDF_FILE_INFO tempFI;
456
457 if(UDFDirIndexInitScan(FI, &ScanContext, 2)) {
458 while((DI = UDFDirIndexScan(&ScanContext, &tempFI))) {
459 // Flush Dir entry
460 _SEH2_TRY {
461 if(!tempFI) continue;
462 if(UDFIsADirectory(tempFI)) {
463 UDFFlushADirectory(Vcb, tempFI, PtrIoStatus, FlushFlags);
464 } else {
465 UDFFlushAFile(tempFI->Fcb, NULL, PtrIoStatus, FlushFlags);
466 }
468 BrutePoint();
469 } _SEH2_END;
470 if(UDFFlushIsBreaking(Vcb, FlushFlags)) {
472 break;
473 }
474 }
475 }
477 BrutePoint();
478 } _SEH2_END;
479SkipFlushDir:
480 // Flush Dir
481 _SEH2_TRY {
482 UDFFlushFile__( Vcb, FI, FlushFlags );
484 BrutePoint();
485 } _SEH2_END;
486
487 return ret_val;
488} // end UDFFlushADirectory()
PDIR_INDEX_ITEM UDFDirIndexScan(PUDF_DIR_SCAN_CONTEXT Context, PUDF_FILE_INFO *_FileInfo)
Definition: dirtree.cpp:378
BOOLEAN UDFDirIndexInitScan(IN PUDF_FILE_INFO DirInfo, OUT PUDF_DIR_SCAN_CONTEXT Context, IN uint_di Index)
Definition: dirtree.cpp:347
ULONG UDFFlushADirectory(IN PVCB Vcb, IN PUDF_FILE_INFO FI, OUT PIO_STATUS_BLOCK PtrIoStatus, IN ULONG FlushFlags)
Definition: flush.cpp:415
BOOLEAN UDFFlushIsBreaking(IN PVCB Vcb, IN ULONG FlushFlags)
Definition: flush.cpp:605
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
NTSTATUS UDFWriteSecurity(IN PVCB Vcb, IN PtrUDFFCB Fcb, IN PSECURITY_DESCRIPTOR *SecurityDesc)
Definition: secursup.cpp:796
#define UDF_FLUSH_FLAGS_INTERRUPTED
Definition: struct.h:343
struct _UDFFileControlBlock * Fcb
Definition: udf_rel.h:362
uint32_t ULONG
Definition: typedefs.h:59
#define UDF_VCB_FLAGS_RAW_DISK
Definition: udf_common.h:476
OSSTATUS UDFFlushFile__(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN ULONG FlushFlags)
Definition: udf_info.cpp:4119
#define UDFIsSDirDeleted(FI)
Definition: udf_info.h:1004
#define UDFHasAStreamDir(FI)
Definition: udf_info.h:1000
#define UDFIsADirectory(FileInfo)
Definition: udf_info.h:792

Referenced by UDFEjectReqWaiter(), UDFFlushADirectory(), UDFFlushAFile(), and UDFFlushLogicalVolume().

◆ UDFFlushAFile()

ULONG UDFFlushAFile ( IN PtrUDFFCB  Fcb,
IN PtrUDFCCB  Ccb,
OUT PIO_STATUS_BLOCK  PtrIoStatus,
IN ULONG  FlushFlags 
)

Definition at line 288 of file flush.cpp.

294{
295 BOOLEAN SetArchive = FALSE;
296// BOOLEAN PurgeCache = FALSE;
297 ULONG ret_val = 0;
298
299 UDFPrint(("UDFFlushAFile: \n"));
300 if(!Fcb)
301 return 0;
302
303 _SEH2_TRY {
304 if(Fcb->Vcb->VCBFlags & UDF_VCB_FLAGS_RAW_DISK)
305 return 0;
307 BrutePoint();
308 } _SEH2_END;
309#ifndef UDF_READ_ONLY_BUILD
310 // Flush Security if required
311 _SEH2_TRY {
312 UDFWriteSecurity(Fcb->Vcb, Fcb, &(Fcb->NTRequiredFCB->SecurityDesc));
314 BrutePoint();
315 } _SEH2_END;
316#endif //UDF_READ_ONLY_BUILD
317 // Flush SDir if any
318 _SEH2_TRY {
319 if(UDFHasAStreamDir(Fcb->FileInfo) &&
320 Fcb->FileInfo->Dloc->SDirInfo &&
321 !UDFIsSDirDeleted(Fcb->FileInfo->Dloc->SDirInfo) ) {
322 ret_val |=
323 UDFFlushADirectory(Fcb->Vcb, Fcb->FileInfo->Dloc->SDirInfo, PtrIoStatus, FlushFlags);
324 }
326 BrutePoint();
327 } _SEH2_END;
328 // Flush File
329 _SEH2_TRY {
330 if((Fcb->CachedOpenHandleCount || !Fcb->OpenHandleCount) &&
331 Fcb->NTRequiredFCB->SectionObject.DataSectionObject) {
332 if(!(Fcb->NTRequiredFCB->NtReqFCBFlags & UDF_NTREQ_FCB_DELETED)
333 &&
334 ((Fcb->NTRequiredFCB->NtReqFCBFlags & UDF_NTREQ_FCB_MODIFIED) ||
335 (Ccb && !(Ccb->CCBFlags & UDF_CCB_FLUSHED)) )) {
336 MmPrint((" CcFlushCache()\n"));
337 CcFlushCache(&(Fcb->NTRequiredFCB->SectionObject), NULL, 0, PtrIoStatus);
338 }
339 // notice, that we should purge cache
340 // we can't do it now, because it may cause last Close
341 // request & thus, structure deallocation
342// PurgeCache = TRUE;
343
344#ifndef UDF_READ_ONLY_BUILD
345 if(Ccb) {
346 if( (Ccb->FileObject->Flags & FO_FILE_MODIFIED) &&
347 !(Ccb->CCBFlags & UDF_CCB_WRITE_TIME_SET)) {
348 if(Fcb->Vcb->CompatFlags & UDF_VCB_IC_UPDATE_MODIFY_TIME) {
351 UDFSetFileXTime(Fcb->FileInfo, NULL, NULL, NULL, &NtTime);
352 Fcb->NTRequiredFCB->LastWriteTime.QuadPart = NtTime;
353 }
354 SetArchive = TRUE;
355 Ccb->FileObject->Flags &= ~FO_FILE_MODIFIED;
356 }
357 if(Ccb->FileObject->Flags & FO_FILE_SIZE_CHANGED) {
358 LONGLONG ASize = UDFGetFileAllocationSize(Fcb->Vcb, Fcb->FileInfo);
359 UDFSetFileSizeInDirNdx(Fcb->Vcb, Fcb->FileInfo, &ASize);
360 Ccb->FileObject->Flags &= ~FO_FILE_SIZE_CHANGED;
361 }
362 }
363#endif //UDF_READ_ONLY_BUILD
364 }
366 BrutePoint();
367 } _SEH2_END;
368
369 _SEH2_TRY {
370#ifndef UDF_READ_ONLY_BUILD
371 if(SetArchive &&
372 (Fcb->Vcb->CompatFlags & UDF_VCB_IC_UPDATE_ARCH_BIT)) {
373 ULONG Attr;
374 PDIR_INDEX_ITEM DirNdx;
375 DirNdx = UDFDirIndex(UDFGetDirIndexByFileInfo(Fcb->FileInfo), Fcb->FileInfo->Index);
376 // Archive bit
377 Attr = UDFAttributesToNT(DirNdx, Fcb->FileInfo->Dloc->FileEntry);
378 if(!(Attr & FILE_ATTRIBUTE_ARCHIVE))
379 UDFAttributesToUDF(DirNdx, Fcb->FileInfo->Dloc->FileEntry, Attr | FILE_ATTRIBUTE_ARCHIVE);
380 }
381#endif //UDF_READ_ONLY_BUILD
382 UDFFlushFile__( Fcb->Vcb, Fcb->FileInfo, FlushFlags);
384 BrutePoint();
385 } _SEH2_END;
386
387/* if(PurgeCache) {
388 _SEH2_TRY {
389 MmPrint((" CcPurgeCacheSection()\n"));
390 CcPurgeCacheSection( &(Fcb->NTRequiredFCB->SectionObject), NULL, 0, FALSE );
391 } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
392 BrutePoint();
393 } _SEH2_END;
394 }*/
395
396 return ret_val;
397} // end UDFFlushAFile()
VOID UDFSetFileXTime(IN PUDF_FILE_INFO FileInfo, IN LONGLONG *CrtTime, IN LONGLONG *AccTime, IN LONGLONG *AttrTime, IN LONGLONG *ChgTime)
VOID UDFAttributesToUDF(IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry, IN ULONG NTAttr)
ULONG UDFAttributesToNT(IN PDIR_INDEX_ITEM FileDirNdx, IN tag *FileEntry)
VOID NTAPI CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
Definition: cachesub.c:222
PDIR_INDEX_HDR UDFGetDirIndexByFileInfo(IN PUDF_FILE_INFO FileInfo)
Definition: dirtree.cpp:1092
#define MmPrint(_x_)
Definition: env_spec_w32.h:289
#define KeQuerySystemTime(t)
Definition: env_spec_w32.h:570
_In_ PLARGE_INTEGER NtTime
Definition: fatprocs.h:1915
#define FILE_ATTRIBUTE_ARCHIVE
Definition: nt_native.h:706
#define UDF_CCB_FLUSHED
Definition: struct.h:173
#define UDF_NTREQ_FCB_DELETED
Definition: struct.h:235
#define UDF_NTREQ_FCB_MODIFIED
Definition: struct.h:236
#define UDF_CCB_WRITE_TIME_SET
Definition: struct.h:156
LARGE_INTEGER LastWriteTime
Definition: fatstruc.h:922
ULONG OpenHandleCount
Definition: ntfs.h:537
PFILE_OBJECT FileObject
Definition: ntfs.h:520
int64_t LONGLONG
Definition: typedefs.h:68
#define UDF_VCB_IC_UPDATE_MODIFY_TIME
Definition: udf_common.h:494
#define UDF_VCB_IC_UPDATE_ARCH_BIT
Definition: udf_common.h:496
void UDFSetFileSizeInDirNdx(IN PVCB Vcb, IN PUDF_FILE_INFO FileInfo, IN int64 *ASize)
Definition: udf_info.cpp:1190
#define UDFGetFileAllocationSize(Vcb, FileInfo)
Definition: udf_info.h:797
__inline PDIR_INDEX_ITEM UDFDirIndex(IN PDIR_INDEX_HDR hDirNdx, IN uint_di i)
Definition: udf_info.h:1105
LONGLONG QuadPart
Definition: typedefs.h:114
#define FO_FILE_MODIFIED
Definition: iotypes.h:1788
#define FO_FILE_SIZE_CHANGED
Definition: iotypes.h:1789

Referenced by UDFCommonFlush(), UDFFlushADirectory(), and UDFSetFileAllocModeFromICB().

◆ UDFFlushCompletion()

NTSTATUS NTAPI UDFFlushCompletion ( PDEVICE_OBJECT  PtrDeviceObject,
PIRP  Irp,
PVOID  Context 
)

Definition at line 578 of file flush.cpp.

583{
584// NTSTATUS RC = STATUS_SUCCESS;
585
586 UDFPrint(("UDFFlushCompletion: \n"));
587
588 if (Irp->PendingReturned) {
590 }
591
592 if (Irp->IoStatus.Status == STATUS_INVALID_DEVICE_REQUEST) {
593 // cannot do much here, can we?
594 Irp->IoStatus.Status = STATUS_SUCCESS;
595 }
596
597 return(STATUS_SUCCESS);
598} // end UDFFlushCompletion()
IoMarkIrpPending(Irp)

Referenced by UDFCommonFlush().

◆ UDFFlushIsBreaking()

BOOLEAN UDFFlushIsBreaking ( IN PVCB  Vcb,
IN ULONG  FlushFlags 
)

Definition at line 605 of file flush.cpp.

609{
610 BOOLEAN ret_val = FALSE;
611// if(!(FlushFlags & UDF_FLUSH_FLAGS_BREAKABLE))
612 return FALSE;
613 UDFAcquireResourceExclusive(&(Vcb->FlushResource),TRUE);
614 ret_val = (Vcb->VCBFlags & UDF_VCB_FLAGS_FLUSH_BREAK_REQ) ? TRUE : FALSE;
615 Vcb->VCBFlags &= ~UDF_VCB_FLAGS_FLUSH_BREAK_REQ;
616 UDFReleaseResource(&(Vcb->FlushResource));
617 return ret_val;
618} // end UDFFlushIsBreaking()
#define UDF_VCB_FLAGS_FLUSH_BREAK_REQ
Definition: udf_common.h:483

Referenced by UDFFlushADirectory().

◆ UDFFlushLogicalVolume()

ULONG UDFFlushLogicalVolume ( IN PtrUDFIrpContext  PtrIrpContext,
IN PIRP  Irp,
IN PVCB  Vcb,
IN ULONG  FlushFlags 
)

Definition at line 506 of file flush.cpp.

512{
513 ULONG ret_val = 0;
514#ifndef UDF_READ_ONLY_BUILD
516
517 UDFPrint(("UDFFlushLogicalVolume: \n"));
518
519 _SEH2_TRY {
520 if(Vcb->VCBFlags & (UDF_VCB_FLAGS_RAW_DISK/* |
521 UDF_VCB_FLAGS_MEDIA_READ_ONLY*/))
522 return 0;
523 if(Vcb->VCBFlags & UDF_VCB_FLAGS_VOLUME_READ_ONLY)
524 return 0;
525 if(!(Vcb->VCBFlags & UDF_VCB_FLAGS_VOLUME_MOUNTED))
526 return 0;
527
528 // NOTE: This function may also be invoked internally as part of
529 // processing a shutdown request.
530 ASSERT(Vcb->RootDirFCB);
531 ret_val |= UDFFlushADirectory(Vcb, Vcb->RootDirFCB->FileInfo, &IoStatus, FlushFlags);
532
533// if(UDFFlushIsBreaking(Vcb, FlushFlags))
534// return;
535 // flush internal cache
536 if(FlushFlags & UDF_FLUSH_FLAGS_LITE) {
537 UDFPrint((" Lite flush, keep Modified=%d.\n", Vcb->Modified));
538 } else {
539 if(Vcb->VerifyOnWrite) {
540 UDFPrint(("UDF: Flushing cache for verify\n"));
541 //WCacheFlushAll__(&(Vcb->FastCache), Vcb);
542 WCacheFlushBlocks__(&(Vcb->FastCache), Vcb, 0, Vcb->LastLBA);
543 UDFVFlush(Vcb);
544 }
545 // umount (this is internal operation, NT will "dismount" volume later)
547
549 WCacheFlushAll__(&(Vcb->FastCache), Vcb);
551 }
552
553 } _SEH2_FINALLY {
554 ;
555 } _SEH2_END;
556#endif //UDF_READ_ONLY_BUILD
557
558 return ret_val;
559} // end UDFFlushLogicalVolume()
VOID UDFPreClrModified(IN PVCB Vcb)
Definition: misc_common.cpp:18
VOID UDFClrModified(IN PVCB Vcb)
Definition: misc_common.cpp:26
OSSTATUS UDFUmount__(IN PVCB Vcb)
Definition: mount.cpp:921
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
VOID UDFVFlush(IN PVCB Vcb)
Definition: remap.cpp:742
#define UDF_FLUSH_FLAGS_LITE
Definition: struct.h:341
#define UDF_VCB_FLAGS_VOLUME_MOUNTED
Definition: udf_common.h:459
#define UDF_VCB_FLAGS_VOLUME_READ_ONLY
Definition: udf_common.h:463
VOID WCacheFlushAll__(IN PW_CACHE Cache, IN PVOID Context)
OSSTATUS WCacheFlushBlocks__(IN PW_CACHE Cache, IN PVOID Context, IN lba_t Lba, IN ULONG BCount)

Referenced by UDFCommonCreate(), UDFCommonDeviceControl(), UDFCommonFlush(), UDFCommonRead(), UDFCommonWrite(), UDFDoDismountSequence(), and UDFLockVolume().

◆ UDFFlushTryBreak()

VOID UDFFlushTryBreak ( IN PVCB  Vcb)

Definition at line 625 of file flush.cpp.

628{
629 UDFAcquireResourceExclusive(&(Vcb->FlushResource),TRUE);
631 UDFReleaseResource(&(Vcb->FlushResource));
632} // end UDFFlushTryBreak()

Referenced by UDFCommonCreate(), UDFCommonDirControl(), UDFCommonFileInfo(), and UDFCommonQueryVolInfo().