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.

91 lines
2.3 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. PDRIVER_DISPATCH PdoMajorFunctionTable[IRP_MJ_MAXIMUM_FUNCTION + 1];
  14. VOID
  15. iScsiPortInitializeDispatchTables()
  16. {
  17. ULONG inx;
  18. //
  19. // Initialize FDO dispatch table
  20. //
  21. for (inx = 0; inx <= IRP_MJ_MAXIMUM_FUNCTION; inx++) {
  22. FdoMajorFunctionTable[inx] = iScsiPortDispatchUnsupported;
  23. }
  24. FdoMajorFunctionTable[IRP_MJ_DEVICE_CONTROL] = iScsiPortFdoDeviceControl;
  25. FdoMajorFunctionTable[IRP_MJ_SCSI] = iScsiPortFdoDispatch;
  26. FdoMajorFunctionTable[IRP_MJ_PNP] = iScsiPortFdoPnp;
  27. FdoMajorFunctionTable[IRP_MJ_POWER] = iScsiPortPower;
  28. FdoMajorFunctionTable[IRP_MJ_CREATE] = iScsiPortFdoCreateClose;
  29. FdoMajorFunctionTable[IRP_MJ_CLOSE] = iScsiPortFdoCreateClose;
  30. FdoMajorFunctionTable[IRP_MJ_SYSTEM_CONTROL] = iScsiPortSystemControl;
  31. //
  32. // Initialize PDO dispatch table
  33. //
  34. for(inx = 0; inx <= IRP_MJ_MAXIMUM_FUNCTION; inx++) {
  35. PdoMajorFunctionTable[inx] = iScsiPortDispatchUnsupported;
  36. }
  37. PdoMajorFunctionTable[IRP_MJ_DEVICE_CONTROL] = iScsiPortPdoDeviceControl;
  38. PdoMajorFunctionTable[IRP_MJ_SCSI] = iScsiPortPdoDispatch;
  39. PdoMajorFunctionTable[IRP_MJ_PNP] = iScsiPortPdoPnp;
  40. PdoMajorFunctionTable[IRP_MJ_POWER] = iScsiPortPower;
  41. PdoMajorFunctionTable[IRP_MJ_CREATE] = iScsiPortPdoCreateClose;
  42. PdoMajorFunctionTable[IRP_MJ_CLOSE] = iScsiPortPdoCreateClose;
  43. PdoMajorFunctionTable[IRP_MJ_SYSTEM_CONTROL] = iScsiPortSystemControl;
  44. return;
  45. }
  46. NTSTATUS
  47. iScsiPortGlobalDispatch(
  48. IN PDEVICE_OBJECT DeviceObject,
  49. IN PIRP Irp
  50. )
  51. {
  52. PCOMMON_EXTENSION commonExtension = DeviceObject->DeviceExtension;
  53. PIO_STACK_LOCATION irpStack = IoGetCurrentIrpStackLocation(Irp);
  54. return (commonExtension->MajorFunction[irpStack->MajorFunction])(DeviceObject,
  55. Irp);
  56. }
  57. NTSTATUS
  58. iScsiPortDispatchUnsupported(
  59. IN PDEVICE_OBJECT DeviceObject,
  60. IN PIRP Irp
  61. )
  62. {
  63. Irp->IoStatus.Status = STATUS_INVALID_DEVICE_REQUEST;
  64. IoCompleteRequest(Irp, IO_NO_INCREMENT);
  65. return STATUS_INVALID_DEVICE_REQUEST;
  66. }