mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-24 09:23:37 -05:00
sys: ioq: use FsRtlCancellableWaitForSingleObject
This commit is contained in:
parent
a8c0bbcf85
commit
440f66a786
@ -353,6 +353,7 @@ VOID FspQueueDelayedWorkItem(FSP_DELAYED_WORK_ITEM *DelayedWorkItem, LARGE_INTEG
|
|||||||
|
|
||||||
/* I/O queue */
|
/* I/O queue */
|
||||||
#define FspIoqTimeout ((PIRP)1)
|
#define FspIoqTimeout ((PIRP)1)
|
||||||
|
#define FspIoqCancelled ((PIRP)2)
|
||||||
#define FspIoqPostIrp(Q, I, R) FspIoqPostIrpEx(Q, I, FALSE, R)
|
#define FspIoqPostIrp(Q, I, R) FspIoqPostIrpEx(Q, I, FALSE, R)
|
||||||
#define FspIoqPostIrpBestEffort(Q, I, R)FspIoqPostIrpEx(Q, I, TRUE, R)
|
#define FspIoqPostIrpBestEffort(Q, I, R)FspIoqPostIrpEx(Q, I, TRUE, R)
|
||||||
typedef struct
|
typedef struct
|
||||||
@ -376,7 +377,8 @@ VOID FspIoqStop(FSP_IOQ *Ioq);
|
|||||||
BOOLEAN FspIoqStopped(FSP_IOQ *Ioq);
|
BOOLEAN FspIoqStopped(FSP_IOQ *Ioq);
|
||||||
VOID FspIoqRemoveExpired(FSP_IOQ *Ioq);
|
VOID FspIoqRemoveExpired(FSP_IOQ *Ioq);
|
||||||
BOOLEAN FspIoqPostIrpEx(FSP_IOQ *Ioq, PIRP Irp, BOOLEAN BestEffort, NTSTATUS *PResult);
|
BOOLEAN FspIoqPostIrpEx(FSP_IOQ *Ioq, PIRP Irp, BOOLEAN BestEffort, NTSTATUS *PResult);
|
||||||
PIRP FspIoqNextPendingIrp(FSP_IOQ *Ioq, PIRP BoundaryIrp, PLARGE_INTEGER Timeout);
|
PIRP FspIoqNextPendingIrp(FSP_IOQ *Ioq, PIRP BoundaryIrp, PLARGE_INTEGER Timeout,
|
||||||
|
PIRP CancellableIrp);
|
||||||
BOOLEAN FspIoqStartProcessingIrp(FSP_IOQ *Ioq, PIRP Irp);
|
BOOLEAN FspIoqStartProcessingIrp(FSP_IOQ *Ioq, PIRP Irp);
|
||||||
PIRP FspIoqEndProcessingIrp(FSP_IOQ *Ioq, UINT_PTR IrpHint);
|
PIRP FspIoqEndProcessingIrp(FSP_IOQ *Ioq, UINT_PTR IrpHint);
|
||||||
BOOLEAN FspIoqRetryCompleteIrp(FSP_IOQ *Ioq, PIRP Irp, NTSTATUS *PResult);
|
BOOLEAN FspIoqRetryCompleteIrp(FSP_IOQ *Ioq, PIRP Irp, NTSTATUS *PResult);
|
||||||
|
@ -477,17 +477,20 @@ BOOLEAN FspIoqPostIrpEx(FSP_IOQ *Ioq, PIRP Irp, BOOLEAN BestEffort, NTSTATUS *PR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PIRP FspIoqNextPendingIrp(FSP_IOQ *Ioq, PIRP BoundaryIrp, PLARGE_INTEGER Timeout)
|
PIRP FspIoqNextPendingIrp(FSP_IOQ *Ioq, PIRP BoundaryIrp, PLARGE_INTEGER Timeout,
|
||||||
|
PIRP CancellableIrp)
|
||||||
{
|
{
|
||||||
/* timeout of 0 normally means infinite wait; for us it means do not do any wait at all! */
|
/* timeout of 0 normally means infinite wait; for us it means do not do any wait at all! */
|
||||||
if (0 != Timeout)
|
if (0 != Timeout)
|
||||||
{
|
{
|
||||||
NTSTATUS Result;
|
NTSTATUS Result;
|
||||||
Result = KeWaitForSingleObject(&Ioq->PendingIrpEvent, Executive, KernelMode, FALSE,
|
Result = FsRtlCancellableWaitForSingleObject(&Ioq->PendingIrpEvent, Timeout,
|
||||||
Timeout);
|
CancellableIrp);
|
||||||
ASSERT(STATUS_SUCCESS == Result || STATUS_TIMEOUT == Result);
|
|
||||||
if (STATUS_TIMEOUT == Result)
|
if (STATUS_TIMEOUT == Result)
|
||||||
return FspIoqTimeout;
|
return FspIoqTimeout;
|
||||||
|
if (STATUS_CANCELLED == Result || STATUS_THREAD_IS_TERMINATING == Result)
|
||||||
|
return FspIoqCancelled;
|
||||||
|
ASSERT(STATUS_SUCCESS == Result);
|
||||||
}
|
}
|
||||||
FSP_IOQ_PEEK_CONTEXT PeekContext;
|
FSP_IOQ_PEEK_CONTEXT PeekContext;
|
||||||
PeekContext.IrpHint = 0 != BoundaryIrp ? BoundaryIrp : (PVOID)1;
|
PeekContext.IrpHint = 0 != BoundaryIrp ? BoundaryIrp : (PVOID)1;
|
||||||
|
@ -590,7 +590,7 @@ NTSTATUS FspVolumeTransact(
|
|||||||
KeQuerySystemTime(&Timeout);
|
KeQuerySystemTime(&Timeout);
|
||||||
Timeout.QuadPart += FsvolDeviceExtension->VolumeParams.TransactTimeout * 10000ULL;
|
Timeout.QuadPart += FsvolDeviceExtension->VolumeParams.TransactTimeout * 10000ULL;
|
||||||
/* convert millis to nanos and add to absolute time */
|
/* convert millis to nanos and add to absolute time */
|
||||||
while (0 == (PendingIrp = FspIoqNextPendingIrp(FsvolDeviceExtension->Ioq, 0, &Timeout)))
|
while (0 == (PendingIrp = FspIoqNextPendingIrp(FsvolDeviceExtension->Ioq, 0, &Timeout, Irp)))
|
||||||
{
|
{
|
||||||
if (FspIoqStopped(FsvolDeviceExtension->Ioq))
|
if (FspIoqStopped(FsvolDeviceExtension->Ioq))
|
||||||
{
|
{
|
||||||
@ -598,10 +598,10 @@ NTSTATUS FspVolumeTransact(
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (FspIoqTimeout == PendingIrp)
|
if (FspIoqTimeout == PendingIrp || FspIoqCancelled == PendingIrp)
|
||||||
{
|
{
|
||||||
Irp->IoStatus.Information = 0;
|
Irp->IoStatus.Information = 0;
|
||||||
Result = STATUS_SUCCESS;
|
Result = FspIoqTimeout == PendingIrp ? STATUS_SUCCESS : STATUS_CANCELLED;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -651,7 +651,7 @@ NTSTATUS FspVolumeTransact(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get the next pending IRP, but do not go beyond the first reposted IRP! */
|
/* get the next pending IRP, but do not go beyond the first reposted IRP! */
|
||||||
PendingIrp = FspIoqNextPendingIrp(FsvolDeviceExtension->Ioq, RepostedIrp, 0);
|
PendingIrp = FspIoqNextPendingIrp(FsvolDeviceExtension->Ioq, RepostedIrp, 0, Irp);
|
||||||
if (0 == PendingIrp)
|
if (0 == PendingIrp)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user