22#define EXT2_FLPFLUSH_MAGIC 'FF2E'
133 DEBUG(
DL_FLP, (
"Ext2FloppyFlushDpc is to be started...\n"));
156 DEBUG(
DL_ERR, (
"Ex2StartFloppy...: failed to allocate Context\n"));
210#if !EXT2_PRE_ALLOCATION_SUPPORT
286 Irp = IrpContext->Irp;
300 DEBUG(
DL_INF, (
"Ext2WriteVolume: Off=%I64xh Len=%xh Paging=%xh Nocache=%xh\n",
304 Irp->IoStatus.Information = 0;
323 Vcb->PartitionInformation.PartitionLength.QuadPart ) {
324 Irp->IoStatus.Information = 0;
366 if (
Ccb !=
NULL && !PagingIo) {
383 }
else if (Nocache && !PagingIo && (
Vcb->SectionObject.DataSectionObject !=
NULL)) {
386 MainResourceAcquired =
TRUE;
410 MainResourceAcquired =
FALSE;
457 }
else if (PagingIo) {
479 while (RemainLength > 0) {
481 DirtyStart = DirtyLba;
487 if (DirtyLba == -1) {
489 DirtyLba = DirtyStart + DirtyLength;
500 ASSERT(DirtyLba <= DirtyStart);
504 DEBUG(
DL_ERR, (
"Ex2WriteVolume: failed to allocate Extent\n"));
512 RemainLength - DirtyLba );
515 if (DirtyLba + DirtyLength >= DirtyStart + RemainLength) {
558 Irp = IrpContext->Irp;
605 Irp = IrpContext->Irp;
613 if (MainResourceAcquired) {
617 if (!IrpContext->ExceptionInProgress) {
640 if (SynchronousIo && !PagingIo) {
740 DEBUG(
DL_FLP, (
"Ext2WriteInode is starting FlushingDpc...\n"));
818 Irp = IrpContext->Irp;
832 DEBUG(
DL_INF, (
"Ext2WriteFile: %wZ Offset=%I64xh Length=%xh Paging=%xh Nocache=%xh\n",
847 Irp->IoStatus.Information = 0;
859 if (Nocache && !PagingIo &&
927 RecursiveWriteThrough =
TRUE;
938 PagingIoResourceAcquired =
TRUE;
945 Irp->IoStatus.Information = 0;
975 MainResourceAcquired =
TRUE;
980 if (Nocache &&
Ccb !=
NULL &&
Fcb->SectionObject.DataSectionObject !=
NULL) {
1041 PagingIoResourceAcquired =
TRUE;
1062 PagingIoResourceAcquired =
FALSE;
1084 FileSizesChanged =
TRUE;
1086 if (
Fcb->
Header.FileSize.QuadPart >= 0x80000000 &&
1092 DEBUG(
DL_IO, (
"Ext2WriteFile: expanding %wZ to FS: %I64xh FA: %I64xh\n",
1168 FileSizesChanged =
TRUE;
1177 DEBUG(
DL_FLP, (
"Ext2WriteFile is starting FlushingDpc...\n"));
1223 Irp = IrpContext->Irp;
1229 FileSizesChanged =
TRUE;
1244 DEBUG(
DL_IO, (
"Ext2WriteFile: %wZ written FS: %I64xh FA: %I64xh BO: %I64xh LEN: %u\n",
1251 if (FileSizesChanged) {
1270 if (PagingIoResourceAcquired) {
1274 if (MainResourceAcquired) {
1279 if (!OpPostIrp && !IrpContext->ExceptionInProgress) {
1294 if (SynchronousIo) {
1311 DEBUG(
DL_IO, (
"Ext2WriteFile: %wZ written at Offset=%I64xh Length=%xh PagingIo=%d Nocache=%d "
1312 "RetLen=%xh VDL=%I64xh FileSize=%I64xh i_size=%I64xh Status=%xh\n",
1336 Irp = IrpContext->Irp;
1345 if (!IrpContext->ExceptionInProgress) {
1374 bCompleteRequest =
FALSE;
1412 bCompleteRequest =
FALSE;
1426 bCompleteRequest =
FALSE;
1434 if (bCompleteRequest) {
static PIO_STACK_LOCATION IoGetCurrentIrpStackLocation(PIRP Irp)
_In_ ULONG _In_ BATTERY_QUERY_INFORMATION_LEVEL _In_ LONG _In_ ULONG _Out_ PULONG ReturnedLength
#define READ_AHEAD_GRANULARITY
VOID NTAPI CcPrepareMdlWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, OUT PMDL *MdlChain, OUT PIO_STATUS_BLOCK IoStatus)
VOID NTAPI CcMdlWriteComplete(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain)
VOID NTAPI CcSetReadAheadGranularity(IN PFILE_OBJECT FileObject, IN ULONG Granularity)
VOID NTAPI CcFlushCache(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, OUT OPTIONAL PIO_STATUS_BLOCK IoStatus)
#define CcIsFileCached(FO)
_Inout_ PFILE_OBJECT _In_ TYPE_OF_OPEN PFCB _In_opt_ PCCB Ccb
#define IRP_CONTEXT_FLAG_WAIT
#define NT_SUCCESS(StatCode)
VOID NTAPI KeInitializeDpc(IN PKDPC Dpc, IN PKDEFERRED_ROUTINE DeferredRoutine, IN PVOID DeferredContext)
#define EXT2_FEATURE_RO_COMPAT_LARGE_FILE
BOOLEAN Ext2ZeroData(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER Start, IN PLARGE_INTEGER End)
struct _EXT2_FLPFLUSH_CONTEXT * PEXT2_FLPFLUSH_CONTEXT
NTSTATUS Ext2WriteFile(IN PEXT2_IRP_CONTEXT IrpContext)
NTSTATUS Ext2WriteComplete(IN PEXT2_IRP_CONTEXT IrpContext)
NTSTATUS Ext2WriteVolume(IN PEXT2_IRP_CONTEXT IrpContext)
struct _EXT2_FLPFLUSH_CONTEXT EXT2_FLPFLUSH_CONTEXT
NTSTATUS Ext2Write(IN PEXT2_IRP_CONTEXT IrpContext)
VOID Ext2StartFloppyFlushDpc(PEXT2_VCB Vcb, PEXT2_FCB Fcb, PFILE_OBJECT FileObject)
#define EXT2_FLPFLUSH_MAGIC
VOID Ext2FloppyFlushDpc(IN PKDPC Dpc, IN PVOID DeferredContext, IN PVOID SystemArgument1, IN PVOID SystemArgument2)
VOID Ext2DeferWrite(IN PEXT2_IRP_CONTEXT, PIRP Irp)
VOID Ext2FloppyFlush(IN PVOID Parameter)
NTSTATUS Ext2WriteInode(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_MCB Mcb, IN ULONGLONG Offset, IN PVOID Buffer, IN ULONG Size, IN BOOLEAN bDirectIo, OUT PULONG BytesWritten)
_In_ PIO_STACK_LOCATION IrpSp
#define ExAcquireResourceExclusiveLite(res, wait)
#define ExAcquireResourceSharedLite(res, wait)
NTSTATUS Ext2FlushVcb(IN PEXT2_VCB Vcb)
VOID Ext2FreePool(IN PVOID P, IN ULONG Tag)
#define ClearFlag(_F, _SF)
#define VCB_VOLUME_LOCKED
#define IsSpecialFile(Fcb)
VOID Ext2OplockComplete(IN PVOID Context, IN PIRP Irp)
#define CCB_VOLUME_DASD_PURGE
PVOID Ext2AllocatePool(IN POOL_TYPE PoolType, IN SIZE_T NumberOfBytes, IN ULONG Tag)
BOOLEAN Ext2SaveBuffer(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN LONGLONG Offset, IN ULONG Size, IN PVOID Buf)
#define IRP_CONTEXT_FLAG_WRITE_THROUGH
NTSTATUS Ext2PurgeVolume(IN PEXT2_VCB Vcb, IN BOOLEAN FlushBeforePurge)
#define IsVcbReadOnly(Vcb)
#define IsFileDeleted(Mcb)
VOID Ext2DestroyExtentChain(IN PEXT2_EXTENT Chain)
PEXT2_EXTENT Ext2AllocateExtent()
BOOLEAN Ext2SaveInode(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN struct inode *Inode)
#define IsExt2FsDevice(DO)
NTSTATUS Ext2QueueRequest(IN PEXT2_IRP_CONTEXT IrpContext)
#define FCB_ALLOC_IN_WRITE
#define SetLongFlag(_F, _SF)
#define VCB_DISMOUNT_PENDING
NTSTATUS Ext2BuildExtents(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_MCB Mcb, IN ULONGLONG Offset, IN ULONG Size, IN BOOLEAN bAlloc, OUT PEXT2_EXTENT *Chain)
#define FCB_FILE_MODIFIED
BOOLEAN Ext2LookupVcbExtent(IN PEXT2_VCB Vcb, IN LONGLONG Vbn, OUT PLONGLONG Lbn, OUT PLONGLONG Length)
VOID Ext2FreeIrpContext(IN PEXT2_IRP_CONTEXT IrpContext)
NTSTATUS Ext2LockUserBuffer(IN PIRP Irp, IN ULONG Length, IN LOCK_OPERATION Operation)
#define ClearLongFlag(_F, _SF)
struct _EXT2_FCBVCB * PEXT2_FCBVCB
PVOID Ext2GetUserBuffer(IN PIRP Irp)
VOID Ext2NotifyReportChange(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_MCB Mcb, IN ULONG Filter, IN ULONG Action)
#define IsInodeSymLink(I)
BOOLEAN Ext2SaveSuper(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb)
BOOLEAN Ext2RemoveVcbExtent(IN PEXT2_VCB Vcb, IN LONGLONG Vbn, IN LONGLONG Length)
struct _EXT2_VCB * PEXT2_VCB
#define IRP_CONTEXT_FLAG_DEFERRED
#define IRP_CONTEXT_FLAG_REQUEUED
VOID Ext2LockIrp(IN PVOID Context, IN PIRP Irp)
#define IsLazyWriter(Fcb)
#define IsWritingToEof(Pos)
struct _EXT2_CCB * PEXT2_CCB
NTSTATUS Ext2ExpandFile(PEXT2_IRP_CONTEXT IrpContext, PEXT2_VCB Vcb, PEXT2_MCB Mcb, PLARGE_INTEGER Size)
struct _EXT2_FCB * PEXT2_FCB
NTSTATUS Ext2ReadWriteBlocks(IN PEXT2_IRP_CONTEXT IrpContext, IN PEXT2_VCB Vcb, IN PEXT2_EXTENT Extent, IN ULONG Length)
#define CEILING_ALIGNED(T, A, B)
NTSTATUS Ext2CompleteIrpContext(IN PEXT2_IRP_CONTEXT IrpContext, IN NTSTATUS Status)
#define CCB_ALLOW_EXTENDED_DASD_IO
int Ext2CheckFileAccess(PEXT2_VCB Vcb, PEXT2_MCB Mcb, int attempt)
BOOLEAN Ext2AddVcbExtent(IN PEXT2_VCB Vcb, IN LONGLONG Vbn, IN LONGLONG Length)
FAST_IO_POSSIBLE Ext2IsFastIoPossible(IN PEXT2_FCB Fcb)
#define INODE_HAS_EXTENT(i)
IN PVCB IN VBO IN ULONG OUT PBCB * Bcb
IN PDCB IN PCCB IN VBO IN OUT PULONG OUT PDIRENT OUT PBCB OUT PVBO ByteOffset
IN PFCB IN PFILE_OBJECT FileObject IN ULONG AllocationSize
IN PVCB IN ULONG IN OUT PULONG IN BOOLEAN OUT PLARGE_MCB Mcb
BOOLEAN NTAPI FsRtlCheckLockForWriteAccess(IN PFILE_LOCK FileLock, IN PIRP Irp)
_Must_inspect_result_ _In_ PFSRTL_PER_STREAM_CONTEXT Ptr
#define FSRTL_FSP_TOP_LEVEL_IRP
#define FSRTL_MAX_TOP_LEVEL_IRP_FLAG
VOID NTAPI CcSetFileSizes(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes)
VOID NTAPI CcInitializeCacheMap(IN PFILE_OBJECT FileObject, IN PCC_FILE_SIZES FileSizes, IN BOOLEAN PinAccess, IN PCACHE_MANAGER_CALLBACKS Callbacks, IN PVOID LazyWriteContext)
BOOLEAN NTAPI CcZeroData(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER StartOffset, IN PLARGE_INTEGER EndOffset, IN BOOLEAN Wait)
BOOLEAN NTAPI CcPurgeCacheSection(IN PSECTION_OBJECT_POINTERS SectionObjectPointer, IN OPTIONAL PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN UninitializeCacheMaps)
#define EXCEPTION_EXECUTE_HANDLER
#define FILE_USE_FILE_POINTER_POSITION
_In_ ULONG _In_ ULONG Offset
_In_ ULONG _In_ ULONG _In_ ULONG Length
BOOLEAN NTAPI CcCopyWrite(IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, IN BOOLEAN Wait, IN PVOID Buffer)
BOOLEAN NTAPI CcCanIWrite(IN PFILE_OBJECT FileObject, IN ULONG BytesToWrite, IN BOOLEAN Wait, IN UCHAR Retrying)
VOID NTAPI CcDeferWrite(IN PFILE_OBJECT FileObject, IN PCC_POST_DEFERRED_WRITE PostRoutine, IN PVOID Context1, IN PVOID Context2, IN ULONG BytesToWrite, IN BOOLEAN Retrying)
BOOLEAN NTAPI ExAcquireSharedStarveExclusive(IN PERESOURCE Resource, IN BOOLEAN Wait)
VOID FASTCALL ExReleaseResourceLite(IN PERESOURCE Resource)
PIRP NTAPI IoGetTopLevelIrp(VOID)
VOID NTAPI IoSetTopLevelIrp(IN PIRP Irp)
#define STATUS_FILE_LOCK_CONFLICT
NTSTATUS NTAPI FsRtlCheckOplock(IN POPLOCK Oplock, IN PIRP Irp, IN PVOID Context, IN POPLOCK_WAIT_COMPLETE_ROUTINE CompletionRoutine OPTIONAL, IN POPLOCK_FS_PREPOST_IRP PostIrpRoutine OPTIONAL)
#define _SEH2_EXCEPT(...)
#define STATUS_END_OF_FILE
struct _EXT2_EXTENT * Next
EXT2_IDENTIFIER Identifier
CACHE_MANAGER_CALLBACKS CacheManagerCallbacks
EXT2_IDENTIFIER_TYPE Type
ERESOURCE PagingIoResource
NTFSIDENTIFIER Identifier
FSRTL_ADVANCED_FCB_HEADER Header
struct _IO_STACK_LOCATION::@3974::@3979 Write
union _IO_STACK_LOCATION::@1575 Parameters
BOOLEAN NTAPI KeSetTimer(IN OUT PKTIMER Timer, IN LARGE_INTEGER DueTime, IN PKDPC Dpc OPTIONAL)
VOID NTAPI KeInitializeTimer(OUT PKTIMER Timer)
#define STATUS_INVALID_DEVICE_REQUEST
#define STATUS_MEDIA_WRITE_PROTECTED
#define STATUS_ACCESS_DENIED
#define STATUS_INVALID_PARAMETER
#define STATUS_UNSUCCESSFUL
#define STATUS_FILE_DELETED
#define STATUS_INVALID_USER_BUFFER
#define STATUS_INSUFFICIENT_RESOURCES
_In_ PDEVICE_OBJECT DeviceObject
_In_ WDFREQUEST _In_ WDFFILEOBJECT FileObject
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
_Must_inspect_result_ _In_ PWDF_DPC_CONFIG _In_ PWDF_OBJECT_ATTRIBUTES _Out_ WDFDPC * Dpc
_Must_inspect_result_ _In_ WDFIOTARGET _In_opt_ WDFREQUEST _In_opt_ PWDF_MEMORY_DESCRIPTOR _In_opt_ PLONGLONG _In_opt_ PWDF_REQUEST_SEND_OPTIONS _Out_opt_ PULONG_PTR BytesWritten
_Must_inspect_result_ _In_ WDFCMRESLIST List
VOID NTAPI ExQueueWorkItem(IN PWORK_QUEUE_ITEM WorkItem, IN WORK_QUEUE_TYPE QueueType)
VOID(NTAPI * PCC_POST_DEFERRED_WRITE)(_In_ PVOID Context1, _In_ PVOID Context2)
#define ExInitializeWorkItem(Item, Routine, Context)
#define FILE_NOTIFY_CHANGE_SIZE
#define FILE_ACTION_MODIFIED
#define FO_FILE_SIZE_CHANGED
#define FO_SYNCHRONOUS_IO
#define IRP_SYNCHRONOUS_PAGING_IO
#define IRP_MJ_MAXIMUM_FUNCTION
_In_opt_ PVOID _In_opt_ PVOID SystemArgument1
_In_opt_ PVOID DeferredContext
_In_opt_ PVOID _In_opt_ PVOID _In_opt_ PVOID SystemArgument2
#define ObDereferenceObject
#define ObReferenceObject
_Inout_opt_ PVOID Parameter