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.

201 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. spudp.h
  5. Abstract:
  6. This is the local header file for SPUD. It includes all other
  7. necessary header files for SPUD.
  8. Author:
  9. John Ballard (jballard) 21-Oct-1996
  10. Revision History:
  11. --*/
  12. #ifndef _SPUDP_H_
  13. #define _SPUDP_H_
  14. //
  15. // N.B. ntos\inc\init.h and ntos\inc\ke.h declare NtBuildNumber and
  16. // KeServiceDescriptorTable without the additional level of indirection
  17. // necessary to access them through an export thunk. To get around this,
  18. // we'll #define them to goofy values, include the header files, then
  19. // undef them before declaring them properly.
  20. //
  21. #include <ntosp.h>
  22. #include <zwapi.h>
  23. #include <tdikrnl.h>
  24. //
  25. // Our device name.
  26. //
  27. #define SPUD_DEVICE_NAME L"\\Device\\Spud"
  28. //
  29. // Priority boost for completed I/O requests.
  30. //
  31. #define SPUD_PRIORITY_BOOST 2
  32. //
  33. // Set ENABLE_OB_TRACING to enable OB reference count tracing.
  34. //
  35. // Set ALLOW_UNLOAD to allow the driver to be conditionally unloaded.
  36. //
  37. // Set USE_SPUD_COUNTERS to enable SPUD activity counters.
  38. //
  39. #if DBG
  40. #define ENABLE_OB_TRACING 1
  41. #define ALLOW_UNLOAD 0
  42. #define USE_SPUD_COUNTERS 1
  43. #else
  44. #define ENABLE_OB_TRACING 0
  45. #define ALLOW_UNLOAD 0
  46. #define USE_SPUD_COUNTERS 1
  47. #endif
  48. //
  49. // Pool tags.
  50. //
  51. #define SPUD_NONPAGED_DATA_POOL_TAG 'NupS'
  52. #define SPUD_HANDLE_TABLE_POOL_TAG 'HupS'
  53. #define SPUD_TRACE_LOG_POOL_TAG 'TupS'
  54. #define SPUD_REQ_CONTEXT_POOL_TAG 'RupS'
  55. typedef struct _TRANSMIT_FILE_BUFFERS {
  56. PVOID Head;
  57. ULONG HeadLength;
  58. PVOID Tail;
  59. ULONG TailLength;
  60. } TRANSMIT_FILE_BUFFERS, *PTRANSMIT_FILE_BUFFERS, *LPTRANSMIT_FILE_BUFFERS;
  61. //
  62. // Goodies stolen from WINSOCK2.H (to make AFD.H happy).
  63. //
  64. #ifndef SG_UNCONSTRAINED_GROUP
  65. #define SG_UNCONSTRAINED_GROUP 0x01
  66. #endif
  67. #ifndef SG_CONSTRAINED_GROUP
  68. #define SG_CONSTRAINED_GROUP 0x02
  69. #endif
  70. #include <afd.h>
  71. #include <uspud.h>
  72. #include "spudstr.h"
  73. #include "spudproc.h"
  74. #include "spuddata.h"
  75. #include "reftrace.h"
  76. //
  77. // Pool allocators.
  78. //
  79. #define SPUD_ALLOCATE_POOL(a,b,t) ExAllocatePoolWithTag(a,b,t)
  80. #define SPUD_FREE_POOL(a) ExFreePool(a)
  81. //
  82. // Debug-specific stuff.
  83. //
  84. #if DBG
  85. //
  86. // Define our own assert so that we can actually catch assertion failures
  87. // when running a checked SPUD on a free kernel.
  88. //
  89. VOID
  90. SpudAssert(
  91. PVOID FailedAssertion,
  92. PVOID FileName,
  93. ULONG LineNumber,
  94. PCHAR Message
  95. );
  96. #undef ASSERT
  97. #define ASSERT( exp ) \
  98. if (!(exp)) \
  99. SpudAssert( #exp, __FILE__, __LINE__, NULL )
  100. #undef ASSERTMSG
  101. #define ASSERTMSG( msg, exp ) \
  102. if (!(exp)) \
  103. SpudAssert( #exp, __FILE__, __LINE__, msg )
  104. #endif // DBG
  105. //
  106. // OB reference tracing stuff.
  107. //
  108. #if ENABLE_OB_TRACING
  109. #define TRACE_OB_REFERENCE( obj ) \
  110. if( SpudTraceLog != NULL ) { \
  111. WriteRefTraceLog( \
  112. SpudTraceLog, \
  113. (PVOID)(obj), \
  114. +1, \
  115. __FILE__, \
  116. __LINE__ \
  117. ); \
  118. } else
  119. #define TRACE_OB_DEREFERENCE( obj ) \
  120. if( SpudTraceLog != NULL ) { \
  121. WriteRefTraceLog( \
  122. SpudTraceLog, \
  123. (PVOID)(obj), \
  124. -1, \
  125. __FILE__, \
  126. __LINE__ \
  127. ); \
  128. } else
  129. #else // !ENABLE_OB_TRACING
  130. #define TRACE_OB_REFERENCE( obj )
  131. #define TRACE_OB_DEREFERENCE( obj )
  132. #endif // ENABLE_OB_TRACING
  133. //
  134. // Activity counters.
  135. //
  136. #if USE_SPUD_COUNTERS
  137. #define BumpCount(c) InterlockedIncrement( &SpudCounters.c )
  138. #else // !USE_SPUD_COUNTERS
  139. #define BumpCount(c) ((void)0)
  140. #endif // USE_SPUD_COUNTERS
  141. #endif // _SPUDP_H_