reactos/drivers/storage/classpnp/clntirp.c
Cameron Gutman c2d0d784c7 [USB-BRINGUP-TRUNK]
- Create a branch to do a proper merge of USB work from a trunk base instead of from cmake-bringup
- In the future, DO NOT under any circumstances branch another branch. This leads to merge problems!

svn path=/branches/usb-bringup-trunk/; revision=55018
2012-01-20 20:58:46 +00:00

74 lines
1.3 KiB
C

/*++
Copyright (C) Microsoft Corporation, 1991 - 1999
Module Name:
clntirp.c
Abstract:
Client IRP queuing routines for CLASSPNP
Environment:
kernel mode only
Notes:
Revision History:
--*/
#include "classp.h"
#include "debug.h"
/*
* EnqueueDeferredClientIrp
*
* Note: we currently do not support Cancel for storage irps.
*/
VOID EnqueueDeferredClientIrp(PCLASS_PRIVATE_FDO_DATA FdoData, PIRP Irp)
{
KIRQL oldIrql;
KeAcquireSpinLock(&FdoData->SpinLock, &oldIrql);
InsertTailList(&FdoData->DeferredClientIrpList, &Irp->Tail.Overlay.ListEntry);
KeReleaseSpinLock(&FdoData->SpinLock, oldIrql);
}
/*
* DequeueDeferredClientIrp
*
*/
PIRP DequeueDeferredClientIrp(PCLASS_PRIVATE_FDO_DATA FdoData)
{
KIRQL oldIrql;
PLIST_ENTRY listEntry;
PIRP irp;
KeAcquireSpinLock(&FdoData->SpinLock, &oldIrql);
if (IsListEmpty(&FdoData->DeferredClientIrpList)){
listEntry = NULL;
}
else {
listEntry = RemoveHeadList(&FdoData->DeferredClientIrpList);
}
KeReleaseSpinLock(&FdoData->SpinLock, oldIrql);
if (listEntry == NULL) {
irp = NULL;
} else {
irp = CONTAINING_RECORD(listEntry, IRP, Tail.Overlay.ListEntry);
ASSERT(irp->Type == IO_TYPE_IRP);
InitializeListHead(&irp->Tail.Overlay.ListEntry);
}
return irp;
}