Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

udfdata.h

Go to the documentation of this file.
00001 /*++ 00002 00003 Copyright (c) 1989 Microsoft Corporation 00004 00005 Module Name: 00006 00007 UdfData.h 00008 00009 Abstract: 00010 00011 This module declares the global data used by the Udfs file system. 00012 00013 Author: 00014 00015 Dan Lovinger [DanLo] 20-May-1996 00016 00017 Revision History: 00018 00019 --*/ 00020 00021 #ifndef _UDFDATA_ 00022 #define _UDFDATA_ 00023 00024 // 00025 // Global data structures 00026 // 00027 00028 extern UDF_DATA UdfData; 00029 extern FAST_IO_DISPATCH UdfFastIoDispatch; 00030 00031 // 00032 // Global constants 00033 // 00034 00035 // 00036 // These are the number of times a mounted Vcb will be referenced on behalf 00037 // of the system. The counts include the following references. 00038 // 00039 // 1 reference - shows the volume is mounted 00040 // 1 reference - 1 for VolumeDasdFcb. 00041 // 2 references - 1 for RootIndexFcb, 1 for internal stream. 00042 // 2 references - 1 for MetadataFcb, 1 for internal stream. 00043 // 00044 // AND THEN, IF THIS IS CD-UDF 00045 // 00046 // 2 references - 1 for the VatFcb, 1 for the internal stream. 00047 // 00048 // For user references we add one for the reference in each of the internal 00049 // Fcbs. 00050 // 00051 00052 #define UDFS_BASE_RESIDUAL_REFERENCE (6) 00053 #define UDFS_BASE_RESIDUAL_USER_REFERENCE (3) 00054 00055 #define UDFS_CDUDF_RESIDUAL_REFERENCE (2) 00056 #define UDFS_CDUDF_RESIDUAL_USER_REFERENCE (1) 00057 00058 // 00059 // The UDFS signature for thread contexts 00060 // 00061 00062 #define UDFS_SIGNATURE 0x53464455 00063 00064 // 00065 // Reserved directory strings 00066 // 00067 00068 #define SELF_ENTRY 0 00069 #define PARENT_ENTRY 1 00070 00071 extern WCHAR UdfUnicodeSelfArray[]; 00072 extern WCHAR UdfUnicodeParentArray[]; 00073 00074 extern UNICODE_STRING UdfUnicodeDirectoryNames[]; 00075 00076 // 00077 // Static Identifier strings 00078 // 00079 00080 extern STRING UdfCS0Identifier; 00081 extern STRING UdfDomainIdentifier; 00082 extern STRING UdfVirtualPartitionDomainIdentifier; 00083 extern STRING UdfVatTableIdentifier; 00084 extern STRING UdfSparablePartitionDomainIdentifier; 00085 extern STRING UdfSparingTableIdentifier; 00086 extern STRING UdfNSR02Identifier; 00087 00088 // 00089 // Lookup tables for rudimentary parsing of strings we will 00090 // discover in on-disk structures 00091 // 00092 00093 extern PARSE_KEYVALUE VsdIdentParseTable[]; 00094 extern PARSE_KEYVALUE NsrPartContIdParseTable[]; 00095 00096 // 00097 // Lookaside lists 00098 // 00099 00100 extern NPAGED_LOOKASIDE_LIST UdfFcbNonPagedLookasideList; 00101 extern NPAGED_LOOKASIDE_LIST UdfIrpContextLookasideList; 00102 00103 extern PAGED_LOOKASIDE_LIST UdfCcbLookasideList; 00104 extern PAGED_LOOKASIDE_LIST UdfFcbIndexLookasideList; 00105 extern PAGED_LOOKASIDE_LIST UdfFcbDataLookasideList; 00106 extern PAGED_LOOKASIDE_LIST UdfLcbLookasideList; 00107 00108 // 00109 // 16bit CRC table 00110 // 00111 00112 extern PUSHORT UdfCrcTable; 00113 00114 // 00115 // Turn on pseudo-asserts if UDFS_FREE_ASSERTS is defined. 00116 // 00117 00118 #if (!DBG && defined( UDFS_FREE_ASSERTS )) || defined( UDFSDBG ) 00119 #undef ASSERT 00120 #undef ASSERTMSG 00121 #define ASSERT(exp) \ 00122 ((exp) ? TRUE : \ 00123 (DbgPrint( "%s:%d %s\n",__FILE__,__LINE__,#exp ), \ 00124 DbgBreakPoint(), \ 00125 TRUE)) 00126 #define ASSERTMSG(msg,exp) \ 00127 ((exp) ? TRUE : \ 00128 (DbgPrint( "%s:%d %s %s\n",__FILE__,__LINE__,msg,#exp ), \ 00129 DbgBreakPoint(), \ 00130 TRUE)) 00131 #endif 00132 00133 00134 // 00135 // McDebugging Stuff 00136 // 00137 00138 // 00139 // The following assertion macros ensure that the indicated structure 00140 // is valid 00141 // 00142 // ASSERT_STRUCT( IN PVOID Struct, IN CSHORT NodeType ); 00143 // ASSERT_OPTIONAL_STRUCT( IN PVOID Struct OPTIONAL, IN CSHORT NodeType ); 00144 // 00145 // ASSERT_VCB( IN PVCB Vcb ); 00146 // ASSERT_OPTIONAL_VCB( IN PVCB Vcb OPTIONAL ); 00147 // 00148 // ASSERT_FCB( IN PFCB Fcb ); 00149 // ASSERT_OPTIONAL_FCB( IN PFCB Fcb OPTIONAL ); 00150 // 00151 // ASSERT_LCB( IN PLCB Lcb ); 00152 // ASSERT_OPTIONAL_LCB( IN PLCB Lcb OPTIONAL ); 00153 // 00154 // ASSERT_PCB( IN PFCB Pcb ); 00155 // ASSERT_OPTIONAL_PCB( IN PPCB Pcb OPTIONAL ); 00156 // 00157 // ASSERT_FCB_NONPAGED( IN PFCB_NONPAGED FcbNonpaged ); 00158 // ASSERT_OPTIONAL_FCB( IN PFCB_NONPAGED FcbNonpaged OPTIONAL ); 00159 // 00160 // ASSERT_CCB( IN PSCB Ccb ); 00161 // ASSERT_OPTIONAL_CCB( IN PSCB Ccb OPTIONAL ); 00162 // 00163 // ASSERT_IRP_CONTEXT( IN PIRP_CONTEXT IrpContext ); 00164 // ASSERT_OPTIONAL_IRP_CONTEXT( IN PIRP_CONTEXT IrpContext OPTIONAL ); 00165 // 00166 // ASSERT_IRP( IN PIRP Irp ); 00167 // ASSERT_OPTIONAL_IRP( IN PIRP Irp OPTIONAL ); 00168 // 00169 // ASSERT_FILE_OBJECT( IN PFILE_OBJECT FileObject ); 00170 // ASSERT_OPTIONAL_FILE_OBJECT( IN PFILE_OBJECT FileObject OPTIONAL ); 00171 // 00172 // The following macros are used to check the current thread owns 00173 // the indicated resource 00174 // 00175 // ASSERT_EXCLUSIVE_RESOURCE( IN PERESOURCE Resource ); 00176 // 00177 // ASSERT_SHARED_RESOURCE( IN PERESOURCE Resource ); 00178 // 00179 // ASSERT_RESOURCE_NOT_MINE( IN PERESOURCE Resource ); 00180 // 00181 // The following macros are used to check whether the current thread 00182 // owns the resoures in the given structures. 00183 // 00184 // ASSERT_EXCLUSIVE_CDDATA 00185 // 00186 // ASSERT_EXCLUSIVE_VCB( IN PVCB Vcb ); 00187 // 00188 // ASSERT_SHARED_VCB( IN PVCB Vcb ); 00189 // 00190 // ASSERT_EXCLUSIVE_FCB( IN PFCB Fcb ); 00191 // 00192 // ASSERT_SHARED_FCB( IN PFCB Fcb ); 00193 // 00194 // ASSERT_EXCLUSIVE_FILE( IN PFCB Fcb ); 00195 // 00196 // ASSERT_SHARED_FILE( IN PFCB Fcb ); 00197 // 00198 // ASSERT_LOCKED_VCB( IN PVCB Vcb ); 00199 // 00200 // ASSERT_NOT_LOCKED_VCB( IN PVCB Vcb ); 00201 // 00202 // ASSERT_LOCKED_FCB( IN PFCB Fcb ); 00203 // 00204 // ASSERT_NOT_LOCKED_FCB( IN PFCB Fcb ); 00205 // 00206 00207 // 00208 // Turn on the sanity checks if this is DBG or UDF_FREE_ASSERTS 00209 // 00210 00211 #if DBG || UDF_FREE_ASSERTS 00212 #undef UDF_SANITY 00213 #define UDF_SANITY 00214 #endif 00215 00216 #ifdef UDF_SANITY 00217 00218 extern LONG UdfDebugTraceLevel; 00219 extern LONG UdfDebugTraceIndent; 00220 extern BOOLEAN UdfNoisyVerifyDescriptor; 00221 extern BOOLEAN UdfTestRaisedStatus; 00222 00223 BOOLEAN 00224 UdfDebugTrace ( 00225 LONG IndentIncrement, 00226 ULONG TraceMask, 00227 PCHAR Format, 00228 ... 00229 ); 00230 00231 #define DebugTrace(x) UdfDebugTrace x 00232 00233 #define DebugUnwind(X) { \ 00234 if (AbnormalTermination()) { \ 00235 DebugTrace(( -1, UDFS_DEBUG_LEVEL_UNWIND, #X ", Abnormal termination.\n" )); \ 00236 } \ 00237 } 00238 00239 #define DebugBreakOnStatus(S) { \ 00240 if (UdfTestRaisedStatus) { \ 00241 if ((S) == STATUS_DISK_CORRUPT_ERROR || \ 00242 (S) == STATUS_FILE_CORRUPT_ERROR || \ 00243 (S) == STATUS_CRC_ERROR) { \ 00244 DbgPrint( "UDFS: Breaking on interesting raised status (%08x)\n", (S) ); \ 00245 DbgPrint( "UDFS: Set UdfTestRaisedStatus @ %08x to 0 to disable\n", \ 00246 &UdfTestRaisedStatus ); \ 00247 DbgBreakPoint(); \ 00248 } \ 00249 } \ 00250 } 00251 00252 #define ASSERT_STRUCT(S,T) ASSERT( SafeNodeType( S ) == (T) ) 00253 #define ASSERT_OPTIONAL_STRUCT(S,T) ASSERT( ((S) == NULL) || (SafeNodeType( S ) == (T)) ) 00254 00255 #define ASSERT_VCB(V) ASSERT_STRUCT( (V), UDFS_NTC_VCB ) 00256 #define ASSERT_OPTIONAL_VCB(V) ASSERT_OPTIONAL_STRUCT( (V), UDFS_NTC_VCB ) 00257 00258 #define ASSERT_FCB(F) \ 00259 ASSERT( (SafeNodeType( F ) == UDFS_NTC_FCB_DATA ) || \ 00260 (SafeNodeType( F ) == UDFS_NTC_FCB_INDEX ) ) 00261 00262 #define ASSERT_OPTIONAL_FCB(F) \ 00263 ASSERT( ((F) == NULL) || \ 00264 (SafeNodeType( F ) == UDFS_NTC_FCB_DATA ) || \ 00265 (SafeNodeType( F ) == UDFS_NTC_FCB_INDEX ) ) 00266 00267 #define ASSERT_FCB_DATA(F) ASSERT( (SafeNodeType( F ) == UDFS_NTC_FCB_DATA ) ) 00268 00269 #define ASSERT_OPTIONAL_FCB_DATA(F) \ 00270 ASSERT( ((F) == NULL) || \ 00271 (SafeNodeType( F ) == UDFS_NTC_FCB_DATA ) ) 00272 00273 #define ASSERT_FCB_INDEX(F) ASSERT( (SafeNodeType( F ) == UDFS_NTC_FCB_INDEX ) ) 00274 00275 #define ASSERT_OPTIONAL_FCB_INDEX(F) \ 00276 ASSERT( ((F) == NULL) || \ 00277 (SafeNodeType( F ) == UDFS_NTC_FCB_INDEX ) ) 00278 00279 #define ASSERT_FCB_NONPAGED(FN) ASSERT_STRUCT( (FN), UDFS_NTC_FCB_NONPAGED ) 00280 #define ASSERT_OPTIONAL_FCB_NONPAGED(FN) ASSERT_OPTIONAL_STRUCT( (FN), UDFS_NTC_FCB_NONPAGED ) 00281 00282 #define ASSERT_CCB(C) ASSERT_STRUCT( (C), UDFS_NTC_CCB ) 00283 #define ASSERT_OPTIONAL_CCB(C) ASSERT_OPTIONAL_STRUCT( (C), UDFS_NTC_CCB ) 00284 00285 #define ASSERT_PCB(C) ASSERT_STRUCT( (C), UDFS_NTC_PCB ) 00286 #define ASSERT_OPTIONAL_PCB(C) ASSERT_OPTIONAL_STRUCT( (C), UDFS_NTC_PCB ) 00287 00288 #define ASSERT_LCB(C) ASSERT_STRUCT( (C), UDFS_NTC_LCB ) 00289 #define ASSERT_OPTIONAL_LCB(C) ASSERT_OPTIONAL_STRUCT( (C), UDFS_NTC_LCB ) 00290 00291 #define ASSERT_IRP_CONTEXT(IC) ASSERT_STRUCT( (IC), UDFS_NTC_IRP_CONTEXT ) 00292 #define ASSERT_OPTIONAL_IRP_CONTEXT(IC) ASSERT_OPTIONAL_STRUCT( (IC), UDFS_NTC_IRP_CONTEXT ) 00293 00294 #define ASSERT_IRP_CONTEXT_LITE(IC) ASSERT_STRUCT( (IC), UDFS_NTC_IRP_CONTEXT_LITE ) 00295 #define ASSERT_OPTIONAL_IRP_CONTEXT_LITE(IC) ASSERT_OPTIONAL_STRUCT( (IC), UDFS_NTC_IRP_CONTEXT_LITE ) 00296 00297 #define ASSERT_IRP(I) ASSERT_STRUCT( (I), IO_TYPE_IRP ) 00298 #define ASSERT_OPTIONAL_IRP(I) ASSERT_OPTIONAL_STRUCT( (I), IO_TYPE_IRP ) 00299 00300 #define ASSERT_FILE_OBJECT(FO) ASSERT_STRUCT( (FO), IO_TYPE_FILE ) 00301 #define ASSERT_OPTIONAL_FILE_OBJECT(FO) ASSERT_OPTIONAL_STRUCT( (FO), IO_TYPE_FILE ) 00302 00303 #define ASSERT_EXCLUSIVE_RESOURCE(R) ASSERT( ExIsResourceAcquiredExclusive( R )) 00304 00305 #define ASSERT_SHARED_RESOURCE(R) ASSERT( ExIsResourceAcquiredShared( R )) 00306 00307 #define ASSERT_RESOURCE_NOT_MINE(R) ASSERT( !ExIsResourceAcquiredShared( R )) 00308 00309 #define ASSERT_EXCLUSIVE_UDFDATA ASSERT( ExIsResourceAcquiredExclusive( &UdfData.DataResource )) 00310 #define ASSERT_EXCLUSIVE_VCB(V) ASSERT( ExIsResourceAcquiredExclusive( &(V)->VcbResource )) 00311 #define ASSERT_SHARED_VCB(V) ASSERT( ExIsResourceAcquiredShared( &(V)->VcbResource )) 00312 00313 #define ASSERT_EXCLUSIVE_FCB_OR_VCB(F) ASSERT( ExIsResourceAcquiredExclusive( &(F)->FcbNonpaged->FcbResource ) || \ 00314 ExIsResourceAcquiredExclusive( &(F)->Vcb->VcbResource )) 00315 00316 #define ASSERT_EXCLUSIVE_FCB(F) ASSERT( ExIsResourceAcquiredExclusive( &(F)->FcbNonpaged->FcbResource )) 00317 #define ASSERT_SHARED_FCB(F) ASSERT( ExIsResourceAcquiredShared( &(F)->FcbNonpaged->FcbResource )) 00318 00319 #define ASSERT_EXCLUSIVE_FILE(F) ASSERT( ExIsResourceAcquiredExclusive( (F)->Resource )) 00320 #define ASSERT_SHARED_FILE(F) ASSERT( ExIsResourceAcquiredShared( (F)->Resource )) 00321 00322 #define ASSERT_LOCKED_VCB(V) ASSERT( (V)->VcbLockThread == PsGetCurrentThread() ) 00323 #define ASSERT_NOT_LOCKED_VCB(V) ASSERT( (V)->VcbLockThread != PsGetCurrentThread() ) 00324 00325 #define ASSERT_LOCKED_FCB(F) ASSERT( (F)->FcbLockThread == PsGetCurrentThread() ) 00326 #define ASSERT_NOT_LOCKED_FCB(F) ASSERT( (F)->FcbLockThread != PsGetCurrentThread() ) 00327 00328 #else 00329 00330 #define DebugTrace(X) TRUE 00331 #define DebugUnwind(X) { NOTHING; } 00332 #define DebugBreakOnStatus(S) { NOTHING; } 00333 00334 #define ASSERT_STRUCT(S,T) { NOTHING; } 00335 #define ASSERT_OPTIONAL_STRUCT(S,T) { NOTHING; } 00336 #define ASSERT_VCB(V) { NOTHING; } 00337 #define ASSERT_OPTIONAL_VCB(V) { NOTHING; } 00338 #define ASSERT_FCB(F) { NOTHING; } 00339 #define ASSERT_OPTIONAL_FCB(F) { NOTHING; } 00340 #define ASSERT_FCB_DATA { NOTHING; } 00341 #define ASSERT_OPTIONAL_FCB_DATA(F) { NOTHING; } 00342 #define ASSERT_FCB_INDEX(F) { NOTHING; } 00343 #define ASSERT_OPTIONAL_FCB_INDEX(F) { NOTHING; } 00344 #define ASSERT_FCB_NONPAGED(FN) { NOTHING; } 00345 #define ASSERT_OPTIONAL_FCB_NONPAGED(FN) { NOTHING; } 00346 #define ASSERT_CCB(C) { NOTHING; } 00347 #define ASSERT_OPTIONAL_CCB(C) { NOTHING; } 00348 #define ASSERT_PCB(C) { NOTHING; } 00349 #define ASSERT_OPTIONAL_PCB(C) { NOTHING; } 00350 #define ASSERT_LCB(C) { NOTHING; } 00351 #define ASSERT_OPTIONAL_LCB(C) { NOTHING; } 00352 #define ASSERT_IRP_CONTEXT(IC) { NOTHING; } 00353 #define ASSERT_OPTIONAL_IRP_CONTEXT(IC) { NOTHING; } 00354 #define ASSERT_IRP_CONTEXT_LITE(IC) { NOTHING; } 00355 #define ASSERT_OPTIONAL_IRP_CONTEXT_LITE(IC) { NOTHING; } 00356 #define ASSERT_IRP(I) { NOTHING; } 00357 #define ASSERT_OPTIONAL_IRP(I) { NOTHING; } 00358 #define ASSERT_FILE_OBJECT(FO) { NOTHING; } 00359 #define ASSERT_OPTIONAL_FILE_OBJECT(FO) { NOTHING; } 00360 #define ASSERT_EXCLUSIVE_RESOURCE(R) { NOTHING; } 00361 #define ASSERT_SHARED_RESOURCE(R) { NOTHING; } 00362 #define ASSERT_RESOURCE_NOT_MINE(R) { NOTHING; } 00363 #define ASSERT_EXCLUSIVE_UDFDATA { NOTHING; } 00364 #define ASSERT_EXCLUSIVE_VCB(V) { NOTHING; } 00365 #define ASSERT_SHARED_VCB(V) { NOTHING; } 00366 #define ASSERT_EXCLUSIVE_FCB_OR_VCB(F) { NOTHING; } 00367 #define ASSERT_EXCLUSIVE_FCB(F) { NOTHING; } 00368 #define ASSERT_SHARED_FCB(F) { NOTHING; } 00369 #define ASSERT_EXCLUSIVE_FILE(F) { NOTHING; } 00370 #define ASSERT_SHARED_FILE(F) { NOTHING; } 00371 #define ASSERT_LOCKED_VCB(V) { NOTHING; } 00372 #define ASSERT_NOT_LOCKED_VCB(V) { NOTHING; } 00373 #define ASSERT_LOCKED_FCB(F) { NOTHING; } 00374 #define ASSERT_NOT_LOCKED_FCB(F) { NOTHING; } 00375 00376 #endif 00377 00378 #endif // _UDFDATA_ 00379

Generated on Sat May 15 19:42:10 2004 for test by doxygen 1.3.7