ReactOS  0.4.11-dev-765-g5e024bf
irp cancel boilerplate.c File Reference

Go to the source code of this file.

Functions

 CancelRoutine (DEV_OBJ Dev, Irp)
 
QUEUE_BOLIERPLATE Lock (theLock)
 
 IoSetCancelRoutine (Irp, CancelRoutine)
 
 if (Irp->Cancel &&IoSetCancelRoutine(Irp, NULL))
 
 IoMarkIrpPending (Irp)
 
 InsertTailList (Queue)
 
 Unlock (theLock)
 
 if (!IoSetCancelRoutine(Irp, NULL))
 
 IoCompleteRequest (Irp, IO_NO_INCREMENT)
 

Variables

Irp Tail Overlay DriverContext [3] = &theLock
 
Irp IoStatus Status = STATUS_PENDING
 
 DEQUEUE_BOILERPLATE
 
 Irp = RemoveHeadList(Queue)
 
Irp IoStatus Information = 0
 

Function Documentation

CancelRoutine ( DEV_OBJ  Dev,
Irp   
)

Definition at line 10 of file irp cancel boilerplate.c.

14 {
15  //don't need this since we have our own sync. protecting irp cancellation
16  IoReleaseCancelSpinLock(Irp->CancelIrql);
17 
18  theLock = Irp->Tail.Overlay.DriverContext[3];
19 
20  Lock(theLock);
21  RemoveEntryList(&Irp->Tail.Overlay.ListEntry);
22  Unlock(theLock);
23 
24  Irp->IoStatus.Status = STATUS_CANCELLED;
25  Irp->IoStatus.Information = 0;
26 
28 
29 }
QUEUE_BOLIERPLATE Lock(theLock)
_In_ PIRP Irp
Definition: csq.h:116
FORCEINLINE BOOLEAN RemoveEntryList(_In_ PLIST_ENTRY Entry)
Definition: rtlfuncs.h:105
Unlock(theLock)
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
VOID NTAPI IoReleaseCancelSpinLock(IN KIRQL Irql)
Definition: util.c:150
IoCompleteRequest(Irp, IO_NO_INCREMENT)
#define IO_NO_INCREMENT
Definition: iotypes.h:565
if ( Irp->Cancel &&  IoSetCancelRoutineIrp, NULL)

Definition at line 39 of file irp cancel boilerplate.c.

40  {
41  /*
42  Irp has already been cancelled (before we got to queue it),
43  and we got to remove the cancel routine before the canceler could,
44  so we cancel/complete the irp ourself.
45  */
46 
47  Unlock(theLock);
48 
49  Irp->IoStatus.Status = STATUS_CANCELLED;
50  Irp->IoStatus.Information = 0;
52 
53  return FALSE;
54  }
_In_ PIRP Irp
Definition: csq.h:116
Unlock(theLock)
#define FALSE
Definition: types.h:117
#define STATUS_CANCELLED
Definition: udferr_usr.h:170
IoCompleteRequest(Irp, IO_NO_INCREMENT)
#define IO_NO_INCREMENT
Definition: iotypes.h:565
if ( IoSetCancelRoutineIrp, NULL)

Definition at line 75 of file irp cancel boilerplate.c.

76  {
77  /*
78  Cancel routine WILL be called after we release the spinlock. It will try to remove
79  the irp from the list and cancel/complete this irp. Since we allready removed it,
80  make its ListEntry point to itself.
81  */
82 
83  InitializeListHead(&Irp->Tail.Overlay.ListEntry);
84 
85  Unlock(theLock);
86 
87  return;
88  }
_In_ PIRP Irp
Definition: csq.h:116
Unlock(theLock)
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
InsertTailList ( Queue  )
IoCompleteRequest ( Irp  ,
IO_NO_INCREMENT   
)

Referenced by CancelRoutine(), and if().

IoMarkIrpPending ( Irp  )

Referenced by _Dispatch_type_(), _Function_class_(), _Requires_lock_held_(), ACPIDispatchDeviceControl(), AfdConnectedSocketReadData(), AfdSelect(), BeepDeviceControl(), CdDevCtrlCompletionRoutine(), CdMultiAsyncCompletionRoutine(), CdRomDeviceControl(), CdRomDeviceControlCompletion(), CdRomDeviceControlDispatch(), CdRomDvdEndAllSessionsCompletion(), CdRomSetVolumeIntermediateCompletion(), CdRomShutdownFlush(), CdRomStartIo(), CdRomSwitchModeCompletion(), CdRomUpdateCapacity(), CdRomXACompletion(), CdSingleAsyncCompletionRoutine(), ClassDeviceControl(), ClassIoComplete(), ClassIoCompletion(), ClasspPowerDownCompletion(), ClasspPowerHandler(), ClasspPowerUpCompletion(), ClasspStartNextPowerIrpCompletion(), ClassReadWrite(), ClassSendSrbAsynchronous(), CUSBDevice::CommitIrp(), CreateRedirectedFile(), DGReceiveDatagram(), DiskDeviceControl(), DiskInfoExceptionCheck(), DiskInfoExceptionComplete(), DiskShutdownFlush(), DispatchReadWrite(), DispTdiConnect(), DispTdiDisconnect(), DispTdiListen(), DispTdiQueryIpHwAddress(), DispTdiReceive(), DispTdiReceiveDatagram(), DispTdiSend(), DispTdiSendDatagram(), do_read(), Ext2DeviceControlCompletion(), Ext2ExceptionHandler(), Ext2FlushCompletionRoutine(), Ext2LockIrp(), Ext2ReadWriteBlocks(), FatFlushCompletionRoutine(), FatMultiAsyncCompletionRoutine(), FatPrePostIrp(), FatSingleAsyncCompletionRoutine(), FDO_HandleResetCyclePort(), FFSDeviceControlCompletion(), FFSExceptionHandler(), FFSFlushCompletionRoutine(), FFSQueueRequest(), FFSReadWriteBlockAsyncCompletionRoutine(), FinishDevPoUpIrp(), ForwardUrbToRootHub(), FreeBT_DispatchPower(), FreeBT_DispatchRead(), FreeBT_DispatchWrite(), FreeBT_GetHCIEvent(), FreeBT_HCIEventCompletion(), FreeBT_HCISendCompletion(), FreeBT_SendHCICommand(), FsRtlAcknowledgeOplockBreak(), FsRtlCancelNotify(), FsRtlNotifyCompleteIrp(), FsRtlNotifyFilterChangeDirectory(), FsRtlPrivateLock(), FsRtlRequestExclusiveOplock(), FsRtlRequestOplockII(), FsRtlWaitOnIrp(), CHubController::HandleBulkOrInterruptTransfer(), HandleReadIrp(), HidClass_Read(), HidUsb_ReadReportCompletion(), HoldIoRequests(), i8042KbdDeviceControl(), i8042KbdInternalDeviceControl(), i8042MouInternalDeviceControl(), IKsPin_DispatchKsStream(), IoCsqInsertIrpEx(), IofCompleteRequest(), KsServiceBusEnumCreateRequest(), LanReadData(), MountMgrChangeNotify(), MsfsRead(), MupForwardIoRequest(), NdisIDeviceIoControl(), NpAddDataQueueEntry(), NpAddWaiter(), NpSetListeningPipeState(), NtfsQueueRequest(), PortClsPower(), ProSendAndFreePnPEvent(), QueueRequest(), QueueUserModeIrp(), RawCompletionRoutine(), RfsdDeviceControlCompletion(), RfsdExceptionHandler(), RfsdFlushCompletionRoutine(), RfsdQueueRequest(), RfsdReadWriteBlockAsyncCompletionRoutine(), RxFsdCommonDispatch(), RxFsdDispatch(), RxLowIoSubmit(), RxPrePostIrp(), ScsiCdRomStartIo(), ScsiClassDeviceControl(), ScsiClassIoComplete(), ScsiClassReadWrite(), ScsiPortDispatchScsi(), SendIrpToThread(), SerialDeviceControl(), SerialRead(), SermouseInternalDeviceControl(), ServiceTransferRequest(), SetIrpIoStatus(), TestIrpHandler(), UDFDevIoctlCompletion(), UDFExceptionHandler(), UDFFlushCompletion(), UDFPostRequest(), USBH_FdoPower(), USBH_PdoIoctlResetPort(), USBH_PortIdleNotificationRequest(), USBH_QueryCapsComplete(), USBH_SelectConfigOrInterfaceComplete(), USBPORT_AbortPipe(), USBPORT_HandleSubmitURB(), USBPORT_IdleNotification(), USBPORT_PdoPower(), USBPORT_QueuePendingTransferIrp(), USBSTOR_QueueAddIrp(), USBSTOR_SendRequest(), VfatQueueRequest(), VfdDeviceControl(), VfdReadWrite(), WaitWakeCompletionRoutine(), and WmipReceiveNotifications().

IoSetCancelRoutine ( Irp  ,
CancelRoutine   
)

Referenced by AfdConnectedSocketReadData(), AfdConnectedSocketWriteData(), AfdDisconnect(), AfdPacketSocketWriteData(), AfdSelect(), BeepCleanup(), BeepStartIo(), DisconnectComplete(), DispPrepareIrpForCancel(), FreeBT_DispatchClean(), FsRtlAcknowledgeOplockBreak(), FsRtlCancelExclusiveIrp(), FsRtlCancelNotify(), FsRtlCancelOplockIIIrp(), FsRtlCancelWaitIrp(), FsRtlNotifySetCancelRoutine(), FsRtlOplockBreakToII(), FsRtlOplockBreakToNone(), FsRtlOplockCleanup(), FsRtlRemoveAndCompleteIrp(), FsRtlRemoveAndCompleteWaitIrp(), FsRtlRequestExclusiveOplock(), FsRtlRequestOplockII(), FsRtlUninitializeOplock(), FsRtlWaitOnIrp(), HandleReadIrp(), IoCancelIrp(), IoCsqInsertIrpEx(), IoCsqRemoveIrp(), IoCsqRemoveNextIrp(), IRPFinish(), KsAddIrpToCancelableQueue(), KsCancelIo(), KsReleaseIrpOnCancelableQueue(), ListenComplete(), MountMgrChangeNotify(), NduDispatchRead(), NpAddDataQueueEntry(), NpAddWaiter(), NpCancelWaiter(), NpCheckForNotify(), NpCompleteStalledWrites(), NpRemoveDataQueueEntry(), NpSetClosingPipeState(), NpSetConnectedPipeState(), NpSetDisconnectedPipeState(), NpSetListeningPipeState(), NpTimerDispatch(), PacketSocketRecvComplete(), PacketSocketSendComplete(), ProcessQueuedRequests(), QueueRequest(), QueueUserModeIrp(), ReceiveActivity(), ReceiveComplete(), RxCompleteRequest_Real(), RxFsdCommonDispatch(), SatisfyPreAccept(), SendComplete(), SignalSocket(), StreamSocketConnectComplete(), UnlockAndMaybeComplete(), USBH_FdoCleanup(), USBH_HubQueuePortIdleIrps(), USBH_PdoRemoveDevice(), USBH_PortIdleNotificationRequest(), USBPORT_CompletePdoWaitWake(), USBPORT_DoneTransfer(), USBPORT_FlushCancelList(), USBPORT_FlushPendingTransfers(), USBPORT_PdoPower(), USBPORT_QueuePendingTransferIrp(), USBSTOR_QueueAddIrp(), USBSTOR_StartIo(), and WmipReceiveNotifications().

QUEUE_BOLIERPLATE Lock ( theLock  )

Referenced by CancelRoutine().

Unlock ( theLock  )

Referenced by CancelRoutine(), and if().

Variable Documentation

DEQUEUE_BOILERPLATE
Initial value:
{
Lock(theLock)
QUEUE_BOLIERPLATE Lock(theLock)

Definition at line 70 of file irp cancel boilerplate.c.

Irp Tail Overlay DriverContext[3] = &theLock

Definition at line 36 of file irp cancel boilerplate.c.

Referenced by DECLSPEC_ALIGN().

Irp IoStatus Information = 0

Definition at line 100 of file irp cancel boilerplate.c.

Irp = RemoveHeadList(Queue)

Definition at line 73 of file irp cancel boilerplate.c.