Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.3 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 1991 - 1999
  3. Module Name:
  4. clntirp.c
  5. Abstract:
  6. Client IRP queuing routines for CLASSPNP
  7. Environment:
  8. kernel mode only
  9. Notes:
  10. Revision History:
  11. --*/
  12. #include "classp.h"
  13. #include "debug.h"
  14. /*
  15. * EnqueueDeferredClientIrp
  16. *
  17. * Note: we currently do not support Cancel for storage irps.
  18. */
  19. VOID EnqueueDeferredClientIrp(PCLASS_PRIVATE_FDO_DATA FdoData, PIRP Irp)
  20. {
  21. KIRQL oldIrql;
  22. KeAcquireSpinLock(&FdoData->SpinLock, &oldIrql);
  23. InsertTailList(&FdoData->DeferredClientIrpList, &Irp->Tail.Overlay.ListEntry);
  24. KeReleaseSpinLock(&FdoData->SpinLock, oldIrql);
  25. }
  26. /*
  27. * DequeueDeferredClientIrp
  28. *
  29. */
  30. PIRP DequeueDeferredClientIrp(PCLASS_PRIVATE_FDO_DATA FdoData)
  31. {
  32. KIRQL oldIrql;
  33. PLIST_ENTRY listEntry;
  34. PIRP irp;
  35. KeAcquireSpinLock(&FdoData->SpinLock, &oldIrql);
  36. if (IsListEmpty(&FdoData->DeferredClientIrpList)){
  37. listEntry = NULL;
  38. }
  39. else {
  40. listEntry = RemoveHeadList(&FdoData->DeferredClientIrpList);
  41. }
  42. KeReleaseSpinLock(&FdoData->SpinLock, oldIrql);
  43. if (listEntry == NULL) {
  44. irp = NULL;
  45. } else {
  46. irp = CONTAINING_RECORD(listEntry, IRP, Tail.Overlay.ListEntry);
  47. ASSERT(irp->Type == IO_TYPE_IRP);
  48. InitializeListHead(&irp->Tail.Overlay.ListEntry);
  49. }
  50. return irp;
  51. }