OpenAFS
OpenAFS distributed network file system
/cygdrive/c/src/openafs/openafs.git/repo/src/WINNT/afsrdr/common/AFSRedirCommonDefines.h
00001 /*
00002  * Copyright (c) 2008-2011 Kernel Drivers, LLC.
00003  * Copyright (c) 2009-2011 Your File System, Inc.
00004  * All rights reserved.
00005  *
00006  * Redistribution and use in source and binary forms, with or without
00007  * modification, are permitted provided that the following conditions
00008  * are met:
00009  *
00010  * - Redistributions of source code must retain the above copyright notice,
00011  *   this list of conditions and the following disclaimer.
00012  * - Redistributions in binary form must reproduce the above copyright
00013  *   notice,
00014  *   this list of conditions and the following disclaimer in the
00015  *   documentation
00016  *   and/or other materials provided with the distribution.
00017  * - Neither the name of Kernel Drivers, LLC nor the names of its
00018  *   contributors may be
00019  *   used to endorse or promote products derived from this software without
00020  *   specific prior written permission from Kernel Drivers, LLC
00021  *   and Your File System, Inc.
00022  *
00023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00024  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
00025  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
00026  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
00027  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00028  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00029  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00030  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00031  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00032  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00033  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034  */
00035 
00036 #ifndef _AFS_REDIR_COMMON_DEFINES_H
00037 #define _AFS_REDIR_COMMON_DEFINES_H
00038 
00039 //
00040 // Allocation defines
00041 //
00042 
00043 #define AFS_GENERIC_MEMORY_1_TAG     '1GFA'
00044 #define AFS_GENERIC_MEMORY_2_TAG     '2GFA'
00045 #define AFS_GENERIC_MEMORY_3_TAG     '3GFA'
00046 #define AFS_GENERIC_MEMORY_4_TAG     '4GFA'
00047 #define AFS_GENERIC_MEMORY_5_TAG     '5GFA'
00048 #define AFS_GENERIC_MEMORY_6_TAG     '6GFA'
00049 #define AFS_GENERIC_MEMORY_7_TAG     '7GFA'
00050 #define AFS_GENERIC_MEMORY_8_TAG     '8GFA'
00051 #define AFS_GENERIC_MEMORY_9_TAG     '9GFA'
00052 #define AFS_GENERIC_MEMORY_10_TAG    'AGFA'
00053 #define AFS_GENERIC_MEMORY_11_TAG    'BGFA'
00054 #define AFS_GENERIC_MEMORY_12_TAG    'CGFA'
00055 #define AFS_GENERIC_MEMORY_13_TAG    'DGFA'
00056 #define AFS_GENERIC_MEMORY_14_TAG    'EGFA'
00057 #define AFS_GENERIC_MEMORY_15_TAG    'FGFA'
00058 #define AFS_GENERIC_MEMORY_16_TAG    'GGFA'
00059 #define AFS_GENERIC_MEMORY_17_TAG    'HGFA'
00060 #define AFS_GENERIC_MEMORY_18_TAG    'IGFA'
00061 #define AFS_GENERIC_MEMORY_19_TAG    'JGFA'
00062 #define AFS_GENERIC_MEMORY_20_TAG    'KGFA'
00063 #define AFS_GENERIC_MEMORY_21_TAG    'LGFA'
00064 #define AFS_GENERIC_MEMORY_22_TAG    'MGFA'
00065 #define AFS_GENERIC_MEMORY_23_TAG    'NGFA'
00066 #define AFS_GENERIC_MEMORY_24_TAG    'OGFA'
00067 #define AFS_GENERIC_MEMORY_25_TAG    'PGFA'
00068 #define AFS_GENERIC_MEMORY_26_TAG    'QGFA'
00069 #define AFS_GENERIC_MEMORY_27_TAG    'RGFA'
00070 #define AFS_GENERIC_MEMORY_28_TAG    'SGFA'
00071 #define AFS_GENERIC_MEMORY_29_TAG    'TGFA'
00072 #define AFS_GENERIC_MEMORY_30_TAG    'UGFA'
00073 #define AFS_GENERIC_MEMORY_31_TAG    'VGFA'
00074 #define AFS_GENERIC_MEMORY_32_TAG    'WGFA'
00075 #define AFS_FCB_ALLOCATION_TAG       'AFFA'
00076 #define AFS_FCB_NP_ALLOCATION_TAG    'NFFA'
00077 #define AFS_VCB_ALLOCATION_TAG       'CVFA'
00078 #define AFS_VCB_NP_ALLOCATION_TAG    'NVFA'
00079 #define AFS_CCB_ALLOCATION_TAG       'CCFA'
00080 #define AFS_CCB_NP_ALLOCATION_TAG    'NCFA'
00081 #define AFS_WORKER_CB_TAG            'CWFA'
00082 #define AFS_WORK_ITEM_TAG            'IWFA'
00083 #define AFS_POOL_ENTRY_TAG           'EPFA'
00084 #define AFS_PROCESS_CB_TAG           'CPFA'
00085 #define AFS_DIR_BUFFER_TAG           'BDFA'
00086 #define AFS_DIR_ENTRY_TAG            'EDFA'
00087 #define AFS_NAME_BUFFER_ONE_TAG      '1NFA'
00088 #define AFS_NAME_BUFFER_TWO_TAG      '2NFA'
00089 #define AFS_NAME_BUFFER_THREE_TAG    '3NFA'
00090 #define AFS_NAME_BUFFER_FOUR_TAG     '4NFA'
00091 #define AFS_NAME_BUFFER_FIVE_TAG     '5NFA'
00092 #define AFS_NAME_BUFFER_SIX_TAG      '6NFA'
00093 #define AFS_NAME_BUFFER_SEVEN_TAG    '7NFA'
00094 #define AFS_NAME_BUFFER_EIGHT_TAG    '8NFA'
00095 #define AFS_NAME_BUFFER_NINE_TAG     '9NFA'
00096 #define AFS_NAME_BUFFER_TEN_TAG      'ANFA'
00097 #define AFS_SUBST_BUFFER_TAG         'SBFA'
00098 #define AFS_FILE_CREATE_BUFFER_TAG   'CFFA'
00099 #define AFS_RENAME_REQUEST_TAG       'RFFA'
00100 #define AFS_DIR_ENTRY_NP_TAG         'NDFA'
00101 #define AFS_PROVIDER_CB              'PNFA'
00102 #define AFS_EXTENT_TAG               'xSFA'
00103 #define AFS_EXTENT_REQUEST_TAG       'XSFA'
00104 #define AFS_EXTENT_RELEASE_TAG       'LSFA'
00105 #define AFS_IO_RUN_TAG               'iSFA'
00106 #define AFS_GATHER_TAG               'gSFA'
00107 #define AFS_UPDATE_RESULT_TAG        'RUFA'
00108 #define AFS_EXTENTS_RESULT_TAG       'XEFA'
00109 #define AFS_SYS_NAME_NODE_TAG        'NSFA'
00110 #define AFS_REPARSE_NAME_TAG         'NRFA'
00111 #define AFS_NAME_ARRAY_TAG           'ANFA'
00112 #define AFS_OBJECT_INFO_TAG          'IOFA'
00113 #define AFS_NP_OBJECT_INFO_TAG       'ONFA'
00114 #define AFS_DIR_SNAPSHOT_TAG         'SSFA'
00115 #define AFS_LIBRARY_QUEUE_TAG        'QLFA'
00116 #define AFS_NETWORK_PROVIDER_1_TAG   '1ZFA'
00117 #define AFS_NETWORK_PROVIDER_2_TAG   '2ZFA'
00118 #define AFS_NETWORK_PROVIDER_3_TAG   '3ZFA'
00119 #define AFS_NETWORK_PROVIDER_4_TAG   '4ZFA'
00120 #define AFS_NETWORK_PROVIDER_5_TAG   '5ZFA'
00121 #define AFS_NETWORK_PROVIDER_6_TAG   '6ZFA'
00122 #define AFS_NETWORK_PROVIDER_7_TAG   '7ZFA'
00123 #define AFS_NETWORK_PROVIDER_8_TAG   '8ZFA'
00124 #define AFS_NETWORK_PROVIDER_9_TAG   '9ZFA'
00125 #define AFS_NETWORK_PROVIDER_10_TAG  'AZFA'
00126 #define AFS_NETWORK_PROVIDER_11_TAG  'BZFA'
00127 #define AFS_AG_ENTRY_CB_TAG          'GAFA'
00128 #define AFS_PROCESS_AG_CB_TAG        'APFA'
00129 #define AFS_BYTERANGE_TAG            '_RBA'
00130 #define __Enter
00131 
00132 #define try_return(S) { S; goto try_exit; }
00133 
00134 //
00135 // Object types allocated
00136 //
00137 
00138 #define AFS_FILE_FCB                            0x0001
00139 #define AFS_DIRECTORY_FCB                       0x0002
00140 #define AFS_NON_PAGED_FCB                       0x0003
00141 #define AFS_CCB                                 0x0004
00142 #define AFS_ROOT_FCB                            0x0006
00143 #define AFS_VCB                                 0x0007
00144 #define AFS_NON_PAGED_VCB                       0x0008
00145 #define AFS_ROOT_ALL                            0x0009
00146 #define AFS_IOCTL_FCB                           0x000A
00147 #define AFS_MOUNT_POINT_FCB                     0x000B
00148 #define AFS_SYMBOLIC_LINK_FCB                   0x000C
00149 #define AFS_SPECIAL_SHARE_FCB                   0x000D
00150 #define AFS_DFS_LINK_FCB                        0x000E
00151 #define AFS_REDIRECTOR_FCB                      0x000F
00152 
00153 #define AFS_INVALID_FCB                         0x00FF
00154 
00155 //
00156 // Debug information
00157 //
00158 
00159 #define AFS_DBG_FLAG_BREAK_ON_ENTRY     0x00000001   // Only enabled in checked build
00160 #define AFS_DBG_TRACE_TO_DEBUGGER       0x00000002
00161 #define AFS_DBG_FLAG_ENABLE_FORCE_CRASH 0x00000004   // Only enabled in checked build
00162 #define AFS_DBG_BUGCHECK_EXCEPTION      0x00000008
00163 #define AFS_DBG_CLEAN_SHUTDOWN          0x00000010
00164 #define AFS_DBG_REQUIRE_CLEAN_SHUTDOWN  0x00000020
00165 
00166 //
00167 // Pool state
00168 //
00169 
00170 #define POOL_UNKNOWN            0
00171 #define POOL_INACTIVE           1
00172 #define POOL_ACTIVE             2
00173 
00174 //
00175 // Volume flags
00176 //
00177 
00178 #define AFS_VOLUME_FLAGS_OFFLINE                        0x00000001
00179 #define AFS_VOLUME_PRIVATE_WOKER_INITIALIZED            0x00000002
00180 #define AFS_VOLUME_INSERTED_HASH_TREE                   0x00000004
00181 #define AFS_VOLUME_ACTIVE_GLOBAL_ROOT                   0x00000008
00182 
00183 //
00184 // Need this to handle the break point definition
00185 //
00186 
00187 typedef
00188 void
00189 (*PAFSDumpTraceFiles)( void);
00190 
00191 extern PAFSDumpTraceFiles  AFSDumpTraceFilesFnc;
00192 
00193 //
00194 // Debug information
00195 //
00196 
00197 static inline void AFS_ASSERT() {
00198     AFSDumpTraceFilesFnc();
00199 }
00200 
00201 #if DBG
00202 
00203 //#define AFS_VALIDATE_EXTENTS            0
00204 
00205 static inline void AFSBreakPoint() {
00206 #if !defined(KD_DEBUGGER_ENABLED)
00207 #define KD_DEBUGGER_ENABLED DBG
00208 #endif // KD_DEBUGGER_ENABLED
00209 
00210 #if (NTDDI_VERSION >= NTDDI_WS03)
00211     KdRefreshDebuggerNotPresent();
00212 #endif
00213 
00214 #if defined(KD_DEBUGGER_NOT_PRESENT)
00215     if (KD_DEBUGGER_NOT_PRESENT == FALSE)
00216         DbgBreakPoint();
00217 #endif // KD_DEBUGGER_NOT_PRESENT
00218 }
00219 
00220 #define AFSPrint        DbgPrint
00221 
00222 #else
00223 
00224 static inline void AFSBreakPoint() {
00225     NOTHING;
00226 }
00227 
00228 #define AFSPrint
00229 
00230 #endif
00231 
00232 //
00233 // Library control device name
00234 //
00235 
00236 #define AFS_LIBRARY_CONTROL_DEVICE_NAME     L"\\Device\\AFSLibraryControlDevice"
00237 
00238 #define AFS_REDIR_LIBRARY_SERVICE_ENTRY     L"\\Registry\\Machine\\System\\CurrentControlSet\\Services\\AFSLibrary"
00239 
00240 //
00241 // Common Device flags
00242 //
00243 
00244 #define AFS_DEVICE_FLAG_HIDE_DOT_NAMES          0x00000001
00245 #define AFS_DEVICE_FLAG_REDIRECTOR_SHUTDOWN     0x00000002
00246 #define AFS_DEVICE_FLAG_DISABLE_SHORTNAMES      0x00000004
00247 
00248 #endif
00249 
 All Data Structures Files Functions Variables