3 Copyright (c) 1989-2000 Microsoft Corporation
11 This module declares the global data used by the Cdfs file system.
20 // Global data structures
23 extern CD_DATA CdData
;
24 extern FAST_IO_DISPATCH CdFastIoDispatch
;
31 // This is the number of times a mounted Vcb will be referenced on behalf
32 // of the system. The counts include the following references.
34 // 1 reference - shows the volume is mounted
35 // 1 reference - 1 for VolumeDasdFcb.
36 // 2 references - 1 for RootIndexFcb, 1 for internal stream.
37 // 2 references - 1 for PathTableFcb, 1 for internal stream.
39 // For user references we add one for the reference in each of the internal
43 #define CDFS_RESIDUAL_REFERENCE (6)
44 #define CDFS_RESIDUAL_USER_REFERENCE (3)
47 // Reserved directory strings
50 extern WCHAR CdUnicodeSelfArray
[];
51 extern WCHAR CdUnicodeParentArray
[];
53 extern UNICODE_STRING CdUnicodeDirectoryNames
[];
56 // Volume descriptor identifier strings.
59 extern CHAR CdHsgId
[];
60 extern CHAR CdIsoId
[];
64 // Volume label for audio disks.
67 extern WCHAR CdAudioLabel
[];
68 extern USHORT CdAudioLabelLength
;
71 // Pseudo file names for audio disks.
74 extern CHAR CdAudioFileName
[];
75 extern UCHAR CdAudioFileNameLength
;
76 extern ULONG CdAudioDirentSize
;
77 extern ULONG CdAudioDirentsPerSector
;
78 extern ULONG CdAudioSystemUseOffset
;
80 #define AUDIO_NAME_ONES_OFFSET (6)
81 #define AUDIO_NAME_TENS_OFFSET (5)
84 // Escape sequences for mounting Unicode volumes.
87 extern PCHAR CdJolietEscape
[];
90 // Hardcoded header for RIFF files.
93 extern LONG CdXAFileHeader
[];
94 extern LONG CdAudioPlayHeader
[];
95 extern LONG CdXAAudioPhileHeader
[];
99 // Turn on pseudo-asserts if CD_FREE_ASSERTS is defined.
103 #ifdef CD_FREE_ASSERTS
106 #define ASSERT(exp) if (!(exp)) { extern BOOLEAN KdDebuggerEnabled; DbgPrint("%s:%d %s\n",__FILE__,__LINE__,#exp); if (KdDebuggerEnabled) { DbgBreakPoint(); } }
107 #define ASSERTMSG(msg,exp) if (!(exp)) { extern BOOLEAN KdDebuggerEnabled; DbgPrint("%s:%d %s %s\n",__FILE__,__LINE__,msg,#exp); if (KdDebuggerEnabled) { DbgBreakPoint(); } }
113 // The following assertion macros ensure that the indicated structure
116 // ASSERT_STRUCT( IN PVOID Struct, IN CSHORT NodeType );
117 // ASSERT_OPTIONAL_STRUCT( IN PVOID Struct OPTIONAL, IN CSHORT NodeType );
119 // ASSERT_VCB( IN PVCB Vcb );
120 // ASSERT_OPTIONAL_VCB( IN PVCB Vcb OPTIONAL );
122 // ASSERT_FCB( IN PFCB Fcb );
123 // ASSERT_OPTIONAL_FCB( IN PFCB Fcb OPTIONAL );
125 // ASSERT_FCB_NONPAGED( IN PFCB_NONPAGED FcbNonpaged );
126 // ASSERT_OPTIONAL_FCB( IN PFCB_NONPAGED FcbNonpaged OPTIONAL );
128 // ASSERT_CCB( IN PSCB Ccb );
129 // ASSERT_OPTIONAL_CCB( IN PSCB Ccb OPTIONAL );
131 // ASSERT_IRP_CONTEXT( IN PIRP_CONTEXT IrpContext );
132 // ASSERT_OPTIONAL_IRP_CONTEXT( IN PIRP_CONTEXT IrpContext OPTIONAL );
134 // ASSERT_IRP( IN PIRP Irp );
135 // ASSERT_OPTIONAL_IRP( IN PIRP Irp OPTIONAL );
137 // ASSERT_FILE_OBJECT( IN PFILE_OBJECT FileObject );
138 // ASSERT_OPTIONAL_FILE_OBJECT( IN PFILE_OBJECT FileObject OPTIONAL );
140 // The following macros are used to check the current thread owns
141 // the indicated resource
143 // ASSERT_EXCLUSIVE_RESOURCE( IN PERESOURCE Resource );
145 // ASSERT_SHARED_RESOURCE( IN PERESOURCE Resource );
147 // ASSERT_RESOURCE_NOT_MINE( IN PERESOURCE Resource );
149 // The following macros are used to check whether the current thread
150 // owns the resource in the given structures.
152 // ASSERT_EXCLUSIVE_CDDATA
154 // ASSERT_EXCLUSIVE_VCB( IN PVCB Vcb );
156 // ASSERT_SHARED_VCB( IN PVCB Vcb );
158 // ASSERT_EXCLUSIVE_FCB( IN PFCB Fcb );
160 // ASSERT_SHARED_FCB( IN PFCB Fcb );
162 // ASSERT_EXCLUSIVE_FILE( IN PFCB Fcb );
164 // ASSERT_SHARED_FILE( IN PFCB Fcb );
166 // ASSERT_LOCKED_VCB( IN PVCB Vcb );
168 // ASSERT_NOT_LOCKED_VCB( IN PVCB Vcb );
170 // ASSERT_LOCKED_FCB( IN PFCB Fcb );
172 // ASSERT_NOT_LOCKED_FCB( IN PFCB Fcb );
176 // Turn on the sanity checks if this is DBG or CD_FREE_ASSERTS
186 #define ASSERT_STRUCT(S,T) ASSERT( SafeNodeType( S ) == (T) )
187 #define ASSERT_OPTIONAL_STRUCT(S,T) ASSERT( ((S) == NULL) || (SafeNodeType( S ) == (T)) )
189 #define ASSERT_VCB(V) ASSERT_STRUCT( (V), CDFS_NTC_VCB )
190 #define ASSERT_OPTIONAL_VCB(V) ASSERT_OPTIONAL_STRUCT( (V), CDFS_NTC_VCB )
192 #define ASSERT_FCB(F) \
193 ASSERT( (SafeNodeType( F ) == CDFS_NTC_FCB_DATA ) || \
194 (SafeNodeType( F ) == CDFS_NTC_FCB_INDEX ) || \
195 (SafeNodeType( F ) == CDFS_NTC_FCB_PATH_TABLE ) )
197 #define ASSERT_OPTIONAL_FCB(F) \
198 ASSERT( ((F) == NULL) || \
199 (SafeNodeType( F ) == CDFS_NTC_FCB_DATA ) || \
200 (SafeNodeType( F ) == CDFS_NTC_FCB_INDEX ) || \
201 (SafeNodeType( F ) == CDFS_NTC_FCB_PATH_TABLE ) )
203 #define ASSERT_FCB_NONPAGED(FN) ASSERT_STRUCT( (FN), CDFS_NTC_FCB_NONPAGED )
204 #define ASSERT_OPTIONAL_FCB_NONPAGED(FN) ASSERT_OPTIONAL_STRUCT( (FN), CDFS_NTC_FCB_NONPAGED )
206 #define ASSERT_CCB(C) ASSERT_STRUCT( (C), CDFS_NTC_CCB )
207 #define ASSERT_OPTIONAL_CCB(C) ASSERT_OPTIONAL_STRUCT( (C), CDFS_NTC_CCB )
209 #define ASSERT_IRP_CONTEXT(IC) ASSERT_STRUCT( (IC), CDFS_NTC_IRP_CONTEXT )
210 #define ASSERT_OPTIONAL_IRP_CONTEXT(IC) ASSERT_OPTIONAL_STRUCT( (IC), CDFS_NTC_IRP_CONTEXT )
212 #define ASSERT_IRP(I) ASSERT_STRUCT( (I), IO_TYPE_IRP )
213 #define ASSERT_OPTIONAL_IRP(I) ASSERT_OPTIONAL_STRUCT( (I), IO_TYPE_IRP )
215 #define ASSERT_FILE_OBJECT(FO) ASSERT_STRUCT( (FO), IO_TYPE_FILE )
216 #define ASSERT_OPTIONAL_FILE_OBJECT(FO) ASSERT_OPTIONAL_STRUCT( (FO), IO_TYPE_FILE )
218 #define ASSERT_EXCLUSIVE_RESOURCE(R) ASSERT( ExIsResourceAcquiredExclusiveLite( R ))
220 #define ASSERT_SHARED_RESOURCE(R) ASSERT( ExIsResourceAcquiredSharedLite( R ))
222 #define ASSERT_RESOURCE_NOT_MINE(R) ASSERT( !ExIsResourceAcquiredSharedLite( R ))
224 #define ASSERT_EXCLUSIVE_CDDATA ASSERT( ExIsResourceAcquiredExclusiveLite( &CdData.DataResource ))
225 #define ASSERT_EXCLUSIVE_VCB(V) ASSERT( ExIsResourceAcquiredExclusiveLite( &(V)->VcbResource ))
226 #define ASSERT_SHARED_VCB(V) ASSERT( ExIsResourceAcquiredSharedLite( &(V)->VcbResource ))
228 #define ASSERT_EXCLUSIVE_FCB(F) ASSERT( ExIsResourceAcquiredExclusiveLite( &(F)->FcbNonpaged->FcbResource ))
229 #define ASSERT_SHARED_FCB(F) ASSERT( ExIsResourceAcquiredSharedLite( &(F)->FcbNonpaged->FcbResource ))
231 #define ASSERT_EXCLUSIVE_FILE(F) ASSERT( ExIsResourceAcquiredExclusiveLite( (F)->Resource ))
232 #define ASSERT_SHARED_FILE(F) ASSERT( ExIsResourceAcquiredSharedLite( (F)->Resource ))
234 #define ASSERT_LOCKED_VCB(V) ASSERT( (V)->VcbLockThread == PsGetCurrentThread() )
235 #define ASSERT_NOT_LOCKED_VCB(V) ASSERT( (V)->VcbLockThread != PsGetCurrentThread() )
237 #define ASSERT_LOCKED_FCB(F) ASSERT( !FlagOn( (F)->FcbState, FCB_STATE_IN_FCB_TABLE) || ((F)->FcbLockThread == PsGetCurrentThread()))
238 #define ASSERT_NOT_LOCKED_FCB(F) ASSERT( (F)->FcbLockThread != PsGetCurrentThread() )
242 #define DebugBreakOnStatus(S) { NOTHING; }
244 #define ASSERT_STRUCT(S,T) { NOTHING; }
245 #define ASSERT_OPTIONAL_STRUCT(S,T) { NOTHING; }
246 #define ASSERT_VCB(V) { NOTHING; }
247 #define ASSERT_OPTIONAL_VCB(V) { NOTHING; }
248 #define ASSERT_FCB(F) { NOTHING; }
249 #define ASSERT_OPTIONAL_FCB(F) { NOTHING; }
250 #define ASSERT_FCB_NONPAGED(FN) { NOTHING; }
251 #define ASSERT_OPTIONAL_FCB(FN) { NOTHING; }
252 #define ASSERT_CCB(C) { NOTHING; }
253 #define ASSERT_OPTIONAL_CCB(C) { NOTHING; }
254 #define ASSERT_IRP_CONTEXT(IC) { NOTHING; }
255 #define ASSERT_OPTIONAL_IRP_CONTEXT(IC) { NOTHING; }
256 #define ASSERT_IRP(I) { NOTHING; }
257 #define ASSERT_OPTIONAL_IRP(I) { NOTHING; }
258 #define ASSERT_FILE_OBJECT(FO) { NOTHING; }
259 #define ASSERT_OPTIONAL_FILE_OBJECT(FO) { NOTHING; }
260 #define ASSERT_EXCLUSIVE_RESOURCE(R) { NOTHING; }
261 #define ASSERT_SHARED_RESOURCE(R) { NOTHING; }
262 #define ASSERT_RESOURCE_NOT_MINE(R) { NOTHING; }
263 #define ASSERT_EXCLUSIVE_CDDATA { NOTHING; }
264 #define ASSERT_EXCLUSIVE_VCB(V) { NOTHING; }
265 #define ASSERT_SHARED_VCB(V) { NOTHING; }
266 #define ASSERT_EXCLUSIVE_FCB(F) { NOTHING; }
267 #define ASSERT_SHARED_FCB(F) { NOTHING; }
268 #define ASSERT_EXCLUSIVE_FILE(F) { NOTHING; }
269 #define ASSERT_SHARED_FILE(F) { NOTHING; }
270 #define ASSERT_LOCKED_VCB(V) { NOTHING; }
271 #define ASSERT_NOT_LOCKED_VCB(V) { NOTHING; }
272 #define ASSERT_LOCKED_FCB(F) { NOTHING; }
273 #define ASSERT_NOT_LOCKED_FCB(F) { NOTHING; }