Leaked source code of windows server 2003
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.

203 lines
7.0 KiB

  1. /*++ BUILD Version: 0000 // Increment this if a change has global effects
  2. Copyright (c) 1989 Microsoft Corporation
  3. Module Name:
  4. LfsData.c
  5. Abstract:
  6. This module declares the global data used by the Log File Service.
  7. Author:
  8. Brian Andrew [BrianAn] 20-June-1991
  9. Revision History:
  10. --*/
  11. #ifndef _LFSDATA_
  12. #define _LFSDATA_
  13. //
  14. // The global Lfs data record
  15. //
  16. extern LFS_DATA LfsData;
  17. //
  18. // Various large integer constants.
  19. //
  20. #define LfsMaximumFileSize (0x0000000100000000)
  21. extern LARGE_INTEGER LfsLi0;
  22. extern LARGE_INTEGER LfsLi1;
  23. //
  24. // The following Lsn is used as a starting point in the file.
  25. //
  26. extern LSN LfsStartingLsn;
  27. #ifdef LFS_CLUSTER_CHECK
  28. //
  29. // Check for gaps in the log.
  30. //
  31. extern BOOLEAN LfsTestBreakOnAnyError;
  32. extern BOOLEAN LfsTestCheckLbcb;
  33. #endif
  34. //
  35. // Turn on pseudo-asserts if NTFS_FREE_ASSERTS is defined.
  36. //
  37. #if !DBG
  38. #ifdef NTFS_FREE_ASSERTS
  39. #undef ASSERT
  40. #undef ASSERTMSG
  41. #define ASSERT(exp) if (!(exp)) { extern PBOOLEAN KdDebuggerEnabled; DbgPrint("%s:%d %s\n",__FILE__,__LINE__,#exp); if (*KdDebuggerEnabled) { DbgBreakPoint(); } }
  42. #define ASSERTMSG(msg,exp) if (!(exp)) { extern PBOOLEAN KdDebuggerEnabled; DbgPrint("%s:%d %s %s\n",__FILE__,__LINE__,msg,#exp); if (*KdDebuggerEnabled) { DbgBreakPoint(); } }
  43. #endif
  44. #endif
  45. //
  46. // The global Lfs debug level variable, its values are:
  47. //
  48. // 0x00000000 Always gets printed (used when about to bug check)
  49. //
  50. // 0x00000001 Error conditions
  51. // 0x00000002 Debug hooks
  52. // 0x00000004 Catch exceptions before completing Irp
  53. // 0x00000008 Unwinding during error conditions
  54. //
  55. // 0x00000010 Lfs initialization
  56. // 0x00000020 Lfs query log records
  57. // 0x00000040 Lfs write log records
  58. // 0x00000080 Lfs registry routines
  59. //
  60. // 0x00000100 Lfs worker thread routines
  61. // 0x00000200
  62. // 0x00000400
  63. // 0x00000800
  64. //
  65. // 0x00001000 Log page support routines
  66. // 0x00002000 Lsn support routines
  67. // 0x00004000 Miscellaneous support routines
  68. // 0x00008000 Support routines for cache operations
  69. //
  70. // 0x00010000 Structure support routines
  71. // 0x00020000 Verify/validate support routines
  72. // 0x00040000 Synchronization routines
  73. // 0x00080000 Log buffer support routines
  74. //
  75. // 0x00100000 Support routines for manipulating log records
  76. // 0x00200000 Support routines for manipulation lfs restart areas
  77. // 0x00400000 Support routines for client restart operations
  78. // 0x00800000
  79. //
  80. // 0x01000000
  81. // 0x02000000
  82. // 0x04000000
  83. // 0x08000000
  84. //
  85. // 0x10000000
  86. // 0x20000000
  87. // 0x40000000
  88. // 0x80000000
  89. //
  90. #ifdef LFSDBG
  91. #define DEBUG_TRACE_ERROR (0x00000001)
  92. #define DEBUG_TRACE_DEBUG_HOOKS (0x00000002)
  93. #define DEBUG_TRACE_CATCH_EXCEPTIONS (0x00000004)
  94. #define DEBUG_TRACE_UNWIND (0x00000008)
  95. #define DEBUG_TRACE_INITIALIZATION (0x00000010)
  96. #define DEBUG_TRACE_QUERY (0x00000020)
  97. #define DEBUG_TRACE_WRITE (0x00000040)
  98. #define DEBUG_TRACE_RESTART (0x00000080)
  99. #define DEBUG_TRACE_REGISTRY (0x00000100)
  100. #define DEBUG_TRACE_WORKER (0x00000200)
  101. #define DEBUG_TRACE_0x00000400 (0x00000400)
  102. #define DEBUG_TRACE_0x00000800 (0x00000800)
  103. #define DEBUG_TRACE_LOG_PAGE_SUP (0x00001000)
  104. #define DEBUG_TRACE_LSN_SUP (0x00002000)
  105. #define DEBUG_TRACE_MISC_SUP (0x00004000)
  106. #define DEBUG_TRACE_CACHE_SUP (0x00008000)
  107. #define DEBUG_TRACE_STRUC_SUP (0x00010000)
  108. #define DEBUG_TRACE_VERIFY_SUP (0x00020000)
  109. #define DEBUG_TRACE_SYNCH_SUP (0x00040000)
  110. #define DEBUG_TRACE_LBCB_SUP (0x00080000)
  111. #define DEBUG_TRACE_LOG_RECORD_SUP (0x00100000)
  112. #define DEBUG_TRACE_RESTART_SUP (0x00200000)
  113. #define DEBUG_TRACE_0x00400000 (0x00400000)
  114. #define DEBUG_TRACE_0x00800000 (0x00800000)
  115. #define DEBUG_TRACE_0x01000000 (0x01000000)
  116. #define DEBUG_TRACE_0x02000000 (0x02000000)
  117. #define DEBUG_TRACE_0x04000000 (0x04000000)
  118. #define DEBUG_TRACE_0x08000000 (0x08000000)
  119. #define DEBUG_TRACE_0x10000000 (0x10000000)
  120. #define DEBUG_TRACE_0x20000000 (0x20000000)
  121. #define DEBUG_TRACE_0x40000000 (0x40000000)
  122. #define DEBUG_TRACE_0x80000000 (0x80000000)
  123. extern LONG LfsDebugTraceLevel;
  124. extern LONG LfsDebugTraceIndent;
  125. #define DebugTrace(INDENT,LEVEL,X,Y) { \
  126. LONG _i; \
  127. if (((LEVEL) == 0) || (LfsDebugTraceLevel & (LEVEL))) { \
  128. _i = (ULONG)PsGetCurrentThread(); \
  129. DbgPrint("%08lx:",_i); \
  130. if ((INDENT) < 0) { \
  131. LfsDebugTraceIndent += (INDENT); \
  132. } \
  133. if (LfsDebugTraceIndent < 0) { \
  134. LfsDebugTraceIndent = 0; \
  135. } \
  136. for (_i = 0; _i < LfsDebugTraceIndent; _i += 1) { \
  137. DbgPrint(" "); \
  138. } \
  139. DbgPrint(X,Y); \
  140. if ((INDENT) > 0) { \
  141. LfsDebugTraceIndent += (INDENT); \
  142. } \
  143. } \
  144. }
  145. #define DebugDump(STR,LEVEL,PTR) { \
  146. ULONG _i; \
  147. VOID LfsDump(); \
  148. if (((LEVEL) == 0) || (LfsDebugTraceLevel & (LEVEL))) { \
  149. _i = (ULONG)PsGetCurrentThread(); \
  150. DbgPrint("%08lx:",_i); \
  151. DbgPrint(STR); \
  152. if (PTR != NULL) {LfsDump(PTR);} \
  153. DbgBreakPoint(); \
  154. } \
  155. }
  156. #define DebugUnwind(X) { \
  157. if (AbnormalTermination()) { \
  158. DebugTrace(0, DEBUG_TRACE_UNWIND, #X ", Abnormal termination.\n", 0); \
  159. } \
  160. }
  161. #define DebugDoit(X) {X;}
  162. #else
  163. #define DebugTrace(INDENT,LEVEL,X,Y) {NOTHING;}
  164. #define DebugDump(STR,LEVEL,PTR) {NOTHING;}
  165. #define DebugUnwind(X) {NOTHING;}
  166. #define DebugDoit(X) {NOTHING;}
  167. #endif // LFSDBG
  168. #endif // _LFSDATA_