From 0c5f4d92cd00575d80eb057dae0e9901a00f5098 Mon Sep 17 00:00:00 2001 From: Pierre Schweitzer Date: Sun, 10 May 2015 20:47:44 +0000 Subject: [PATCH] [NTFS] Add two more flags (mutually exclusive) for IRP context: - _COMPLETE will cause the IRP to be completed at the end of the dispatch, with the run-time priority boost set by caller - _QUEUE will cause the IRP to be queued for delayed execution (not yet implemented) This allows more flexibility for callers that can set the behavior thanks to the flags. Default behavior is the previous one: by default the IRP is completed at the end of the dispatch That one should really come to FastFAT... svn path=/trunk/; revision=67635 --- reactos/drivers/filesystems/ntfs/dispatch.c | 7 ++++++- reactos/drivers/filesystems/ntfs/misc.c | 1 + reactos/drivers/filesystems/ntfs/ntfs.h | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/reactos/drivers/filesystems/ntfs/dispatch.c b/reactos/drivers/filesystems/ntfs/dispatch.c index 6f42b4163e3..0f53c629109 100644 --- a/reactos/drivers/filesystems/ntfs/dispatch.c +++ b/reactos/drivers/filesystems/ntfs/dispatch.c @@ -85,8 +85,13 @@ NtfsFsdDispatch(PDEVICE_OBJECT DeviceObject, else Status = STATUS_INSUFFICIENT_RESOURCES; + ASSERT(((IrpContext->Flags & IRPCONTEXT_COMPLETE) && !(IrpContext->Flags & IRPCONTEXT_QUEUE)) || + (!(IrpContext->Flags & IRPCONTEXT_COMPLETE) && (IrpContext->Flags & IRPCONTEXT_QUEUE))); + Irp->IoStatus.Status = Status; - IoCompleteRequest(Irp, IrpContext->PriorityBoost); + + if (IrpContext->Flags & IRPCONTEXT_COMPLETE) + IoCompleteRequest(Irp, IrpContext->PriorityBoost); if (IrpContext) ExFreePoolWithTag(IrpContext, 'PRIN'); diff --git a/reactos/drivers/filesystems/ntfs/misc.c b/reactos/drivers/filesystems/ntfs/misc.c index 97ceab1b40e..12bfdc27239 100644 --- a/reactos/drivers/filesystems/ntfs/misc.c +++ b/reactos/drivers/filesystems/ntfs/misc.c @@ -88,6 +88,7 @@ NtfsAllocateIrpContext(PDEVICE_OBJECT DeviceObject, IrpContext->FileObject = IrpContext->Stack->FileObject; IrpContext->IsTopLevel = (IoGetTopLevelIrp() == Irp); IrpContext->PriorityBoost = IO_NO_INCREMENT; + IrpContext->Flags = IRPCONTEXT_COMPLETE; if (IrpContext->MajorFunction == IRP_MJ_FILE_SYSTEM_CONTROL || IrpContext->MajorFunction == IRP_MJ_DEVICE_CONTROL || diff --git a/reactos/drivers/filesystems/ntfs/ntfs.h b/reactos/drivers/filesystems/ntfs/ntfs.h index 05d63e8ec7d..1d2d204b08f 100644 --- a/reactos/drivers/filesystems/ntfs/ntfs.h +++ b/reactos/drivers/filesystems/ntfs/ntfs.h @@ -392,6 +392,8 @@ typedef struct { } REPARSE_POINT_ATTRIBUTE, *PREPARSE_POINT_ATTRIBUTE; #define IRPCONTEXT_CANWAIT 0x1 +#define IRPCONTEXT_COMPLETE 0x2 +#define IRPCONTEXT_QUEUE 0x4 typedef struct {