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.

75 lines
1.6 KiB

  1. /*++
  2. Copyright (C) Microsoft Corporation, 2000
  3. Module Name:
  4. dispatch.c
  5. Abstract:
  6. This file contains code for dispatch routines for iScsiPort
  7. Environment:
  8. kernel mode only
  9. Revision History:
  10. --*/
  11. #include "port.h"
  12. PDRIVER_DISPATCH FdoMajorFunctionTable[IRP_MJ_MAXIMUM_FUNCTION + 1];
  13. VOID
  14. iScsiPortInitializeDispatchTables()
  15. {
  16. ULONG inx;
  17. //
  18. // Initialize FDO dispatch table
  19. //
  20. for (inx = 0; inx <= IRP_MJ_MAXIMUM_FUNCTION; inx++) {
  21. FdoMajorFunctionTable[inx] = iScsiPortDispatchUnsupported;
  22. }
  23. FdoMajorFunctionTable[IRP_MJ_DEVICE_CONTROL] = iScsiPortFdoDeviceControl;
  24. FdoMajorFunctionTable[IRP_MJ_PNP] = iScsiPortFdoPnp;
  25. FdoMajorFunctionTable[IRP_MJ_POWER] = iScsiPortPower;
  26. FdoMajorFunctionTable[IRP_MJ_CREATE] = iScsiPortFdoCreateClose;
  27. FdoMajorFunctionTable[IRP_MJ_CLOSE] = iScsiPortFdoCreateClose;
  28. FdoMajorFunctionTable[IRP_MJ_SYSTEM_CONTROL] = iScsiPortSystemControl;
  29. return;
  30. }
  31. NTSTATUS
  32. iScsiPortGlobalDispatch(
  33. IN PDEVICE_OBJECT DeviceObject,
  34. IN PIRP Irp
  35. )
  36. {
  37. PCOMMON_EXTENSION commonExtension = DeviceObject->DeviceExtension;
  38. PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp);
  39. return (commonExtension->MajorFunction[irpStack->MajorFunction])(DeviceObject,
  40. Irp);
  41. }
  42. NTSTATUS
  43. iScsiPortDispatchUnsupported(
  44. IN PDEVICE_OBJECT DeviceObject,
  45. IN PIRP Irp
  46. )
  47. {
  48. Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
  49. IoCompleteRequest(Irp, IO_NO_INCREMENT);
  50. return STATUS_INVALID_DEVICE_REQUEST;
  51. }