ReactOS  0.4.14-dev-384-g5b37caa
clntirp.c
Go to the documentation of this file.
1 /*++
2 
3 Copyright (C) Microsoft Corporation, 1991 - 1999
4 
5 Module Name:
6 
7  clntirp.c
8 
9 Abstract:
10 
11  Client IRP queuing routines for CLASSPNP
12 
13 Environment:
14 
15  kernel mode only
16 
17 Notes:
18 
19 
20 Revision History:
21 
22 --*/
23 
24 #include "classp.h"
25 
26 /*
27  * EnqueueDeferredClientIrp
28  *
29  * Note: we currently do not support Cancel for storage irps.
30  */
32 {
33  KIRQL oldIrql;
34 
35  KeAcquireSpinLock(&FdoData->SpinLock, &oldIrql);
36  InsertTailList(&FdoData->DeferredClientIrpList, &Irp->Tail.Overlay.ListEntry);
37  KeReleaseSpinLock(&FdoData->SpinLock, oldIrql);
38 }
39 
40 
41 /*
42  * DequeueDeferredClientIrp
43  *
44  */
46 {
47  KIRQL oldIrql;
48  PLIST_ENTRY listEntry;
49  PIRP irp;
50 
51  KeAcquireSpinLock(&FdoData->SpinLock, &oldIrql);
52  if (IsListEmpty(&FdoData->DeferredClientIrpList)){
53  listEntry = NULL;
54  }
55  else {
56  listEntry = RemoveHeadList(&FdoData->DeferredClientIrpList);
57  }
58  KeReleaseSpinLock(&FdoData->SpinLock, oldIrql);
59 
60  if (listEntry == NULL) {
61  irp = NULL;
62  } else {
63  irp = CONTAINING_RECORD(listEntry, IRP, Tail.Overlay.ListEntry);
64  ASSERT(irp->Type == IO_TYPE_IRP);
65  InitializeListHead(&irp->Tail.Overlay.ListEntry);
66  }
67 
68  return irp;
69 }
_In_ PIRP Irp
Definition: csq.h:116
KSPIN_LOCK SpinLock
Definition: classp.h:456
VOID NTAPI EnqueueDeferredClientIrp(PCLASS_PRIVATE_FDO_DATA FdoData, PIRP Irp)
Definition: clntirp.c:31
IRP
Definition: iotypes.h:2463
#define InsertTailList(ListHead, Entry)
_Must_inspect_result_ FORCEINLINE BOOLEAN IsListEmpty(_In_ const LIST_ENTRY *ListHead)
Definition: rtlfuncs.h:57
UCHAR KIRQL
Definition: env_spec_w32.h:591
NTSTATUS(* NTAPI)(IN PFILE_FULL_EA_INFORMATION EaBuffer, IN ULONG EaLength, OUT PULONG ErrorOffset)
Definition: IoEaTest.cpp:117
smooth NULL
Definition: ftsmooth.c:416
FORCEINLINE PLIST_ENTRY RemoveHeadList(_Inout_ PLIST_ENTRY ListHead)
Definition: rtlfuncs.h:128
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
LIST_ENTRY DeferredClientIrpList
Definition: classp.h:443
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
#define IO_TYPE_IRP
Definition: typedefs.h:117
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
PIRP NTAPI DequeueDeferredClientIrp(PCLASS_PRIVATE_FDO_DATA FdoData)
Definition: clntirp.c:45