summaryrefslogtreecommitdiffstats
path: root/private/ntos/lfs/lfsdata.h
blob: dbc21152f5b2a79435bc35b345b512fe4b1d5df5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
/*++ BUILD Version: 0000    // Increment this if a change has global effects

Copyright (c) 1989  Microsoft Corporation

Module Name:

    LfsData.c

Abstract:

    This module declares the global data used by the Log File Service.

Author:

    Brian Andrew    [BrianAn]   20-June-1991

Revision History:

--*/

#ifndef _LFSDATA_
#define _LFSDATA_

//
//  The global Lfs data record
//

extern LFS_DATA LfsData;

//
//  Various large integer constants.
//

#define LfsMaximumFileSize (0x0000000100000000)

extern LARGE_INTEGER LfsLi0;
extern LARGE_INTEGER LfsLi1;

//
//  The following Lsn is used as a starting point in the file.
//

extern LSN LfsStartingLsn;

//
//  Turn on pseudo-asserts if NTFS_FREE_ASSERTS is defined.
//

#if !DBG
#ifdef NTFS_FREE_ASSERTS
#undef ASSERT
#undef ASSERTMSG
#define ASSERT(exp)        if (!(exp)) { extern BOOLEAN KdDebuggerEnabled; DbgPrint("%s:%d %s\n",__FILE__,__LINE__,#exp); if (KdDebuggerEnabled) { DbgBreakPoint(); } }
#define ASSERTMSG(msg,exp) if (!(exp)) { extern BOOLEAN KdDebuggerEnabled; DbgPrint("%s:%d %s %s\n",__FILE__,__LINE__,msg,#exp); if (KdDebuggerEnabled) { DbgBreakPoint(); } }
#endif
#endif

//
//  The global Lfs debug level variable, its values are:
//
//      0x00000000      Always gets printed (used when about to bug check)
//
//      0x00000001      Error conditions
//      0x00000002      Debug hooks
//      0x00000004      Catch exceptions before completing Irp
//      0x00000008      Unwinding during error conditions
//
//      0x00000010      Lfs initialization
//      0x00000020      Lfs query log records
//      0x00000040      Lfs write log records
//      0x00000080      Lfs registry routines
//
//      0x00000100      Lfs worker thread routines
//      0x00000200
//      0x00000400
//      0x00000800
//
//      0x00001000      Log page support routines
//      0x00002000      Lsn support routines
//      0x00004000      Miscellaneous support routines
//      0x00008000      Support routines for cache operations
//
//      0x00010000      Structure support routines
//      0x00020000      Verify/validate support routines
//      0x00040000      Synchronization routines
//      0x00080000      Log buffer support routines
//
//      0x00100000      Support routines for manipulating log records
//      0x00200000      Support routines for manipulation lfs restart areas
//      0x00400000      Support routines for client restart operations
//      0x00800000
//
//      0x01000000
//      0x02000000
//      0x04000000
//      0x08000000
//
//      0x10000000
//      0x20000000
//      0x40000000
//      0x80000000
//

#ifdef LFSDBG

#define DEBUG_TRACE_ERROR                (0x00000001)
#define DEBUG_TRACE_DEBUG_HOOKS          (0x00000002)
#define DEBUG_TRACE_CATCH_EXCEPTIONS     (0x00000004)
#define DEBUG_TRACE_UNWIND               (0x00000008)
#define DEBUG_TRACE_INITIALIZATION       (0x00000010)
#define DEBUG_TRACE_QUERY                (0x00000020)
#define DEBUG_TRACE_WRITE                (0x00000040)
#define DEBUG_TRACE_RESTART              (0x00000080)
#define DEBUG_TRACE_REGISTRY             (0x00000100)
#define DEBUG_TRACE_WORKER               (0x00000200)
#define DEBUG_TRACE_0x00000400           (0x00000400)
#define DEBUG_TRACE_0x00000800           (0x00000800)
#define DEBUG_TRACE_LOG_PAGE_SUP         (0x00001000)
#define DEBUG_TRACE_LSN_SUP              (0x00002000)
#define DEBUG_TRACE_MISC_SUP             (0x00004000)
#define DEBUG_TRACE_CACHE_SUP            (0x00008000)
#define DEBUG_TRACE_STRUC_SUP            (0x00010000)
#define DEBUG_TRACE_VERIFY_SUP           (0x00020000)
#define DEBUG_TRACE_SYNCH_SUP            (0x00040000)
#define DEBUG_TRACE_LBCB_SUP             (0x00080000)
#define DEBUG_TRACE_LOG_RECORD_SUP       (0x00100000)
#define DEBUG_TRACE_RESTART_SUP          (0x00200000)
#define DEBUG_TRACE_0x00400000           (0x00400000)
#define DEBUG_TRACE_0x00800000           (0x00800000)
#define DEBUG_TRACE_0x01000000           (0x01000000)
#define DEBUG_TRACE_0x02000000           (0x02000000)
#define DEBUG_TRACE_0x04000000           (0x04000000)
#define DEBUG_TRACE_0x08000000           (0x08000000)
#define DEBUG_TRACE_0x10000000           (0x10000000)
#define DEBUG_TRACE_0x20000000           (0x20000000)
#define DEBUG_TRACE_0x40000000           (0x40000000)
#define DEBUG_TRACE_0x80000000           (0x80000000)

extern LONG LfsDebugTraceLevel;
extern LONG LfsDebugTraceIndent;

#define DebugTrace(INDENT,LEVEL,X,Y) {                      \
    LONG _i;                                                \
    if (((LEVEL) == 0) || (LfsDebugTraceLevel & (LEVEL))) { \
        _i = (ULONG)PsGetCurrentThread();                   \
        DbgPrint("%08lx:",_i);                              \
        if ((INDENT) < 0) {                                 \
            LfsDebugTraceIndent += (INDENT);                \
        }                                                   \
        if (LfsDebugTraceIndent < 0) {                      \
            LfsDebugTraceIndent = 0;                        \
        }                                                   \
        for (_i = 0; _i < LfsDebugTraceIndent; _i += 1) {   \
            DbgPrint(" ");                                  \
        }                                                   \
        DbgPrint(X,Y);                                      \
        if ((INDENT) > 0) {                                 \
            LfsDebugTraceIndent += (INDENT);                \
        }                                                   \
    }                                                       \
}

#define DebugDump(STR,LEVEL,PTR) {                          \
    ULONG _i;                                               \
    VOID LfsDump();                                         \
    if (((LEVEL) == 0) || (LfsDebugTraceLevel & (LEVEL))) { \
        _i = (ULONG)PsGetCurrentThread();                   \
        DbgPrint("%08lx:",_i);                              \
        DbgPrint(STR);                                      \
        if (PTR != NULL) {LfsDump(PTR);}                    \
        DbgBreakPoint();                                    \
    }                                                       \
}

#define DebugUnwind(X) {                                                      \
    if (AbnormalTermination()) {                                             \
        DebugTrace(0, DEBUG_TRACE_UNWIND, #X ", Abnormal termination.\n", 0); \
    }                                                                         \
}

#define DebugDoit(X)                     {X;}

#else

#define DebugTrace(INDENT,LEVEL,X,Y)     {NOTHING;}
#define DebugDump(STR,LEVEL,PTR)         {NOTHING;}
#define DebugUnwind(X)                   {NOTHING;}
#define DebugDoit(X)                     {NOTHING;}

#endif // LFSDBG

#endif // _LFSDATA_