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 */ 31 VOID NTAPI EnqueueDeferredClientIrp(PCLASS_PRIVATE_FDO_DATA FdoData, PIRP Irp) 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 */ 45 PIRP NTAPI DequeueDeferredClientIrp(PCLASS_PRIVATE_FDO_DATA FdoData) 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 } 70