Windows: Suspend/Resume for afsd_service
[openafs.git] / src / WINNT / afsrdr / common / AFSRedirCommonDefines.h
1 /*
2  * Copyright (c) 2008-2011 Kernel Drivers, LLC.
3  * Copyright (c) 2009-2011 Your File System, Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * - Redistributions of source code must retain the above copyright notice,
11  *   this list of conditions and the following disclaimer.
12  * - Redistributions in binary form must reproduce the above copyright
13  *   notice,
14  *   this list of conditions and the following disclaimer in the
15  *   documentation
16  *   and/or other materials provided with the distribution.
17  * - Neither the name of Kernel Drivers, LLC nor the names of its
18  *   contributors may be
19  *   used to endorse or promote products derived from this software without
20  *   specific prior written permission from Kernel Drivers, LLC
21  *   and Your File System, Inc.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
26  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
27  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
28  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
29  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34  */
35
36 #ifndef _AFS_REDIR_COMMON_DEFINES_H
37 #define _AFS_REDIR_COMMON_DEFINES_H
38
39 //
40 // Allocation defines
41 //
42
43 #define AFS_GENERIC_MEMORY_1_TAG     '1GFA'
44 #define AFS_GENERIC_MEMORY_2_TAG     '2GFA'
45 #define AFS_GENERIC_MEMORY_3_TAG     '3GFA'
46 #define AFS_GENERIC_MEMORY_4_TAG     '4GFA'
47 #define AFS_GENERIC_MEMORY_5_TAG     '5GFA'
48 #define AFS_GENERIC_MEMORY_6_TAG     '6GFA'
49 #define AFS_GENERIC_MEMORY_7_TAG     '7GFA'
50 #define AFS_GENERIC_MEMORY_8_TAG     '8GFA'
51 #define AFS_GENERIC_MEMORY_9_TAG     '9GFA'
52 #define AFS_GENERIC_MEMORY_10_TAG    'AGFA'
53 #define AFS_GENERIC_MEMORY_11_TAG    'BGFA'
54 #define AFS_GENERIC_MEMORY_12_TAG    'CGFA'
55 #define AFS_GENERIC_MEMORY_13_TAG    'DGFA'
56 #define AFS_GENERIC_MEMORY_14_TAG    'EGFA'
57 #define AFS_GENERIC_MEMORY_15_TAG    'FGFA'
58 #define AFS_GENERIC_MEMORY_16_TAG    'GGFA'
59 #define AFS_GENERIC_MEMORY_17_TAG    'HGFA'
60 #define AFS_GENERIC_MEMORY_18_TAG    'IGFA'
61 #define AFS_GENERIC_MEMORY_19_TAG    'JGFA'
62 #define AFS_GENERIC_MEMORY_20_TAG    'KGFA'
63 #define AFS_GENERIC_MEMORY_21_TAG    'LGFA'
64 #define AFS_GENERIC_MEMORY_22_TAG    'MGFA'
65 #define AFS_GENERIC_MEMORY_23_TAG    'NGFA'
66 #define AFS_GENERIC_MEMORY_24_TAG    'OGFA'
67 #define AFS_GENERIC_MEMORY_25_TAG    'PGFA'
68 #define AFS_GENERIC_MEMORY_26_TAG    'QGFA'
69 #define AFS_GENERIC_MEMORY_27_TAG    'RGFA'
70 #define AFS_GENERIC_MEMORY_28_TAG    'SGFA'
71 #define AFS_GENERIC_MEMORY_29_TAG    'TGFA'
72 #define AFS_FCB_ALLOCATION_TAG       'AFFA'
73 #define AFS_FCB_NP_ALLOCATION_TAG    'NFFA'
74 #define AFS_VCB_ALLOCATION_TAG       'CVFA'
75 #define AFS_VCB_NP_ALLOCATION_TAG    'NVFA'
76 #define AFS_CCB_ALLOCATION_TAG       'CCFA'
77 #define AFS_WORKER_CB_TAG            'CWFA'
78 #define AFS_WORK_ITEM_TAG            'IWFA'
79 #define AFS_POOL_ENTRY_TAG           'EPFA'
80 #define AFS_PROCESS_CB_TAG           'CPFA'
81 #define AFS_DIR_BUFFER_TAG           'BDFA'
82 #define AFS_DIR_ENTRY_TAG            'EDFA'
83 #define AFS_NAME_BUFFER_ONE_TAG      '1NFA'
84 #define AFS_NAME_BUFFER_TWO_TAG      '2NFA'
85 #define AFS_NAME_BUFFER_THREE_TAG    '3NFA'
86 #define AFS_NAME_BUFFER_FOUR_TAG     '4NFA'
87 #define AFS_NAME_BUFFER_FIVE_TAG     '5NFA'
88 #define AFS_NAME_BUFFER_SIX_TAG      '6NFA'
89 #define AFS_NAME_BUFFER_SEVEN_TAG    '7NFA'
90 #define AFS_NAME_BUFFER_EIGHT_TAG    '8NFA'
91 #define AFS_NAME_BUFFER_NINE_TAG     '9NFA'
92 #define AFS_NAME_BUFFER_TEN_TAG      'ANFA'
93 #define AFS_SUBST_BUFFER_TAG         'SBFA'
94 #define AFS_FILE_CREATE_BUFFER_TAG   'CFFA'
95 #define AFS_RENAME_REQUEST_TAG       'RFFA'
96 #define AFS_DIR_ENTRY_NP_TAG         'NDFA'
97 #define AFS_PROVIDER_CB              'PNFA'
98 #define AFS_EXTENT_TAG               'xSFA'
99 #define AFS_EXTENT_REQUEST_TAG       'XSFA'
100 #define AFS_EXTENT_RELEASE_TAG       'LSFA'
101 #define AFS_IO_RUN_TAG               'iSFA'
102 #define AFS_GATHER_TAG               'gSFA'
103 #define AFS_UPDATE_RESULT_TAG        'RUFA'
104 #define AFS_EXTENTS_RESULT_TAG       'XEFA'
105 #define AFS_SYS_NAME_NODE_TAG        'NSFA'
106 #define AFS_REPARSE_NAME_TAG         'NRFA'
107 #define AFS_NAME_ARRAY_TAG           'ANFA'
108 #define AFS_OBJECT_INFO_TAG          'IOFA'
109 #define AFS_NP_OBJECT_INFO_TAG       'ONFA'
110 #define AFS_DIR_SNAPSHOT_TAG         'SSFA'
111 #define AFS_LIBRARY_QUEUE_TAG        'QLFA'
112 #define AFS_NETWORK_PROVIDER_1_TAG   '1ZFA'
113 #define AFS_NETWORK_PROVIDER_2_TAG   '2ZFA'
114 #define AFS_NETWORK_PROVIDER_3_TAG   '3ZFA'
115 #define AFS_NETWORK_PROVIDER_4_TAG   '4ZFA'
116 #define AFS_NETWORK_PROVIDER_5_TAG   '5ZFA'
117 #define AFS_NETWORK_PROVIDER_6_TAG   '6ZFA'
118 #define AFS_NETWORK_PROVIDER_7_TAG   '7ZFA'
119 #define AFS_NETWORK_PROVIDER_8_TAG   '8ZFA'
120 #define AFS_NETWORK_PROVIDER_9_TAG   '9ZFA'
121 #define AFS_NETWORK_PROVIDER_10_TAG  'AZFA'
122 #define AFS_NETWORK_PROVIDER_11_TAG  'BZFA'
123 #define AFS_AG_ENTRY_CB_TAG          'GAFA'
124 #define AFS_PROCESS_AG_CB_TAG        'APFA'
125
126 #define __Enter
127
128 #define try_return(S) { S; goto try_exit; }
129
130 //
131 // Object types allocated
132 //
133
134 #define AFS_FILE_FCB                            0x0001
135 #define AFS_DIRECTORY_FCB                       0x0002
136 #define AFS_NON_PAGED_FCB                       0x0003
137 #define AFS_CCB                                 0x0004
138 #define AFS_ROOT_FCB                            0x0006
139 #define AFS_VCB                                 0x0007
140 #define AFS_NON_PAGED_VCB                       0x0008
141 #define AFS_ROOT_ALL                            0x0009
142 #define AFS_IOCTL_FCB                           0x000A
143 #define AFS_MOUNT_POINT_FCB                     0x000B
144 #define AFS_SYMBOLIC_LINK_FCB                   0x000C
145 #define AFS_SPECIAL_SHARE_FCB                   0x000D
146 #define AFS_DFS_LINK_FCB                        0x000E
147
148 #define AFS_INVALID_FCB                         0x00FF
149
150 //
151 // Debug information
152 //
153
154 #define AFS_DBG_FLAG_BREAK_ON_ENTRY     0x00000001   // Only enabled in checked build
155 #define AFS_DBG_TRACE_TO_DEBUGGER       0x00000002
156 #define AFS_DBG_FLAG_ENABLE_FORCE_CRASH 0x00000004   // Only enabled in checked build
157 #define AFS_DBG_BUGCHECK_EXCEPTION      0x00000008
158 #define AFS_DBG_CLEAN_SHUTDOWN          0x00000010
159 #define AFS_DBG_REQUIRE_CLEAN_SHUTDOWN  0x00000020
160
161 //
162 // Pool state
163 //
164
165 #define POOL_UNKNOWN            0
166 #define POOL_INACTIVE           1
167 #define POOL_ACTIVE             2
168
169 //
170 // Volume flags
171 //
172
173 #define AFS_VOLUME_FLAGS_OFFLINE                        0x00000001
174 #define AFS_VOLUME_PRIVATE_WOKER_INITIALIZED            0x00000002
175 #define AFS_VOLUME_INSERTED_HASH_TREE                   0x00000004
176 #define AFS_VOLUME_ACTIVE_GLOBAL_ROOT                   0x00000008
177
178 //
179 // Need this to handle the break point definition
180 //
181
182 typedef
183 void
184 (*PAFSDumpTraceFiles)( void);
185
186 extern PAFSDumpTraceFiles  AFSDumpTraceFilesFnc;
187
188 //
189 // Debug information
190 //
191
192 static inline void AFS_ASSERT() {
193     AFSDumpTraceFilesFnc();
194 }
195
196 #if DBG
197
198 //#define AFS_VALIDATE_EXTENTS            0
199
200 static inline void AFSBreakPoint() {
201     AFSDumpTraceFilesFnc();
202 #if !defined(KD_DEBUGGER_ENABLED)
203 #define KD_DEBUGGER_ENABLED DBG
204 #endif // KD_DEBUGGER_ENABLED
205
206 #if (NTDDI_VERSION >= NTDDI_WS03)
207     KdRefreshDebuggerNotPresent();
208 #endif
209
210 #if defined(KD_DEBUGGER_NOT_PRESENT)
211     if (KD_DEBUGGER_NOT_PRESENT == FALSE)
212         DbgBreakPoint();
213 #endif // KD_DEBUGGER_NOT_PRESENT
214 }
215
216 #define AFSPrint        DbgPrint
217
218 #else
219
220 static inline void AFSBreakPoint() {
221     AFSDumpTraceFilesFnc();
222 }
223
224 #define AFSPrint
225
226 #endif
227
228 //
229 // Library control device name
230 //
231
232 #define AFS_LIBRARY_CONTROL_DEVICE_NAME     L"\\Device\\AFSLibraryControlDevice"
233
234 #define AFS_REDIR_LIBRARY_SERVICE_ENTRY     L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\AFSLibrary"
235
236 #endif
237