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.

254 lines
4.0 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. spudproc.h
  5. Abstract:
  6. This module contains routine prototypes for SPUD.
  7. Author:
  8. John Ballard (jballard) 21-Oct-1996
  9. Revision History:
  10. --*/
  11. #ifndef _SPUDPROCS_H_
  12. #define _SPUDPROCS_H_
  13. //
  14. // Driver entrypoint.
  15. //
  16. NTSTATUS
  17. DriverEntry(
  18. IN PDRIVER_OBJECT DriverObject,
  19. IN PUNICODE_STRING RegistryPath
  20. );
  21. //
  22. // Initialization routines.
  23. //
  24. NTSTATUS
  25. SpudInitializeData(
  26. VOID
  27. );
  28. //
  29. // IRP handlers.
  30. //
  31. NTSTATUS
  32. SpudIrpCreate(
  33. IN PDEVICE_OBJECT DeviceObject,
  34. IN PIRP Irp
  35. );
  36. NTSTATUS
  37. SpudIrpClose(
  38. IN PDEVICE_OBJECT DeviceObject,
  39. IN PIRP Irp
  40. );
  41. NTSTATUS
  42. SpudIrpCleanup(
  43. IN PDEVICE_OBJECT DeviceObject,
  44. IN PIRP Irp
  45. );
  46. NTSTATUS
  47. SpudIrpQuery(
  48. IN PDEVICE_OBJECT DeviceObject,
  49. IN PIRP Irp
  50. );
  51. //
  52. // Completion port safety.
  53. //
  54. PVOID
  55. SpudReferenceCompletionPort(
  56. VOID
  57. );
  58. VOID
  59. SpudDereferenceCompletionPort(
  60. VOID
  61. );
  62. //
  63. // XxxAndRecv routines.
  64. //
  65. NTSTATUS
  66. SpudAfdRecvFastReq(
  67. PFILE_OBJECT fileObject,
  68. PAFD_RECV_INFO recvInfo,
  69. PSPUD_REQ_CONTEXT reqContext
  70. );
  71. NTSTATUS
  72. SpudAfdContinueRecv(
  73. PDEVICE_OBJECT DeviceObject,
  74. PIRP Irp,
  75. PVOID Context
  76. );
  77. NTSTATUS
  78. SpudAfdCompleteRecv(
  79. PDEVICE_OBJECT DeviceObject,
  80. PIRP Irp,
  81. PVOID Context
  82. );
  83. VOID
  84. SpudCompleteRequest(
  85. PSPUD_AFD_REQ_CONTEXT SpudReqContext
  86. );
  87. NTSTATUS
  88. SpudInitializeContextManager(
  89. VOID
  90. );
  91. VOID
  92. SpudTerminateContextManager(
  93. VOID
  94. );
  95. NTSTATUS
  96. SpudAllocateRequestContext(
  97. OUT PSPUD_AFD_REQ_CONTEXT *SpudReqContext,
  98. IN PSPUD_REQ_CONTEXT ReqContext,
  99. IN PAFD_RECV_INFO RecvInfo OPTIONAL,
  100. IN PIRP Irp,
  101. IN PIO_STATUS_BLOCK IoStatusBlock OPTIONAL
  102. );
  103. VOID
  104. SpudFreeRequestContext(
  105. IN PSPUD_AFD_REQ_CONTEXT SpudReqContext
  106. );
  107. PSPUD_AFD_REQ_CONTEXT
  108. SpudGetRequestContext(
  109. IN PSPUD_REQ_CONTEXT ReqContext
  110. );
  111. //
  112. // Service entry/exit routines.
  113. //
  114. NTSTATUS
  115. SpudEnterService(
  116. #if DBG
  117. IN PSTR ServiceName,
  118. #endif
  119. IN BOOLEAN InitRequired
  120. );
  121. VOID
  122. SpudLeaveService(
  123. #if DBG
  124. IN PSTR ServiceName,
  125. IN NTSTATUS Status,
  126. #endif
  127. IN BOOLEAN DerefRequired
  128. );
  129. #if DBG
  130. #define SPUD_ENTER_SERVICE( name, init ) \
  131. SpudEnterService( (PSTR)(name), (BOOLEAN)(init) )
  132. #define SPUD_LEAVE_SERVICE( name, status, deref ) \
  133. SpudLeaveService( (PSTR)(name), (NTSTATUS)(status), (BOOLEAN)(deref) )
  134. #else
  135. #define SPUD_ENTER_SERVICE( name, init ) \
  136. SpudEnterService( (BOOLEAN)(init) )
  137. #define SPUD_LEAVE_SERVICE( name, status, deref ) \
  138. SpudLeaveService( (BOOLEAN)(deref) )
  139. #endif
  140. //
  141. // Miscellaneous helper routines.
  142. //
  143. NTSTATUS
  144. SpudGetAfdDeviceObject(
  145. IN PFILE_OBJECT AfdFileObject
  146. );
  147. //
  148. // Macros stolen from NTOS\IO\IOP.H.
  149. //
  150. //+
  151. //
  152. // VOID
  153. // IopDequeueThreadIrp(
  154. // IN PIRP Irp
  155. // )
  156. //
  157. // Routine Description:
  158. //
  159. // This routine dequeues the specified I/O Request Packet (IRP) from the
  160. // thread IRP queue which it is currently queued.
  161. //
  162. // Arguments:
  163. //
  164. // Irp - Specifies the IRP that is dequeued.
  165. //
  166. // Return Value:
  167. //
  168. // None.
  169. //
  170. //-
  171. #define IopDequeueThreadIrp( Irp ) { RemoveEntryList( &Irp->ThreadListEntry ); }
  172. //+
  173. // VOID
  174. // IopQueueThreadIrp(
  175. // IN PIRP Irp
  176. // )
  177. //
  178. // Routine Description:
  179. //
  180. // This routine queues the specified I/O Request Packet (IRP) to the thread
  181. // whose TCB address is stored in the packet.
  182. //
  183. // Arguments:
  184. //
  185. // Irp - Supplies the IRP to be queued for the specified thread.
  186. //
  187. // Return Value:
  188. //
  189. // None.
  190. //
  191. //-
  192. #define IopQueueThreadIrp( Irp ) { \
  193. KIRQL irql; \
  194. KeRaiseIrql( APC_LEVEL, &irql ); \
  195. InsertHeadList( &Irp->Tail.Overlay.Thread->IrpList, \
  196. &Irp->ThreadListEntry ); \
  197. KeLowerIrql( irql ); \
  198. }
  199. #endif // _SPUDPROCS_H_