Fix remaining text file line endings in the tree. (#18)
[reactos.git] / drivers / filesystems / cdfs_new / cddata.h
1 /*++
2
3 Copyright (c) 1989-2000 Microsoft Corporation
4
5 Module Name:
6
7 CdData.c
8
9 Abstract:
10
11 This module declares the global data used by the Cdfs file system.
12
13
14 --*/
15
16 #ifndef _CDDATA_
17 #define _CDDATA_
18
19 //
20 // Global data structures
21 //
22
23 extern CD_DATA CdData;
24 extern FAST_IO_DISPATCH CdFastIoDispatch;
25
26 //
27 // Global constants
28 //
29
30 //
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.
33 //
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.
38 //
39 // For user references we add one for the reference in each of the internal
40 // Fcb's.
41 //
42
43 #define CDFS_RESIDUAL_REFERENCE (6)
44 #define CDFS_RESIDUAL_USER_REFERENCE (3)
45
46 //
47 // Reserved directory strings
48 //
49
50 extern WCHAR CdUnicodeSelfArray[];
51 extern WCHAR CdUnicodeParentArray[];
52
53 extern UNICODE_STRING CdUnicodeDirectoryNames[];
54
55 //
56 // Volume descriptor identifier strings.
57 //
58
59 extern CHAR CdHsgId[];
60 extern CHAR CdIsoId[];
61 extern CHAR CdXaId[];
62
63 //
64 // Volume label for audio disks.
65 //
66
67 extern WCHAR CdAudioLabel[];
68 extern USHORT CdAudioLabelLength;
69
70 //
71 // Pseudo file names for audio disks.
72 //
73
74 extern CHAR CdAudioFileName[];
75 extern UCHAR CdAudioFileNameLength;
76 extern ULONG CdAudioDirentSize;
77 extern ULONG CdAudioDirentsPerSector;
78 extern ULONG CdAudioSystemUseOffset;
79
80 #define AUDIO_NAME_ONES_OFFSET (6)
81 #define AUDIO_NAME_TENS_OFFSET (5)
82
83 //
84 // Escape sequences for mounting Unicode volumes.
85 //
86
87 extern PCHAR CdJolietEscape[];
88
89 //
90 // Hardcoded header for RIFF files.
91 //
92
93 extern LONG CdXAFileHeader[];
94 extern LONG CdAudioPlayHeader[];
95 extern LONG CdXAAudioPhileHeader[];
96
97 \f
98 //
99 // Turn on pseudo-asserts if CD_FREE_ASSERTS is defined.
100 //
101
102 #if !DBG
103 #ifdef CD_FREE_ASSERTS
104 #undef ASSERT
105 #undef ASSERTMSG
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(); } }
108 #endif
109 #endif
110
111 \f
112 //
113 // The following assertion macros ensure that the indicated structure
114 // is valid
115 //
116 // ASSERT_STRUCT( IN PVOID Struct, IN CSHORT NodeType );
117 // ASSERT_OPTIONAL_STRUCT( IN PVOID Struct OPTIONAL, IN CSHORT NodeType );
118 //
119 // ASSERT_VCB( IN PVCB Vcb );
120 // ASSERT_OPTIONAL_VCB( IN PVCB Vcb OPTIONAL );
121 //
122 // ASSERT_FCB( IN PFCB Fcb );
123 // ASSERT_OPTIONAL_FCB( IN PFCB Fcb OPTIONAL );
124 //
125 // ASSERT_FCB_NONPAGED( IN PFCB_NONPAGED FcbNonpaged );
126 // ASSERT_OPTIONAL_FCB( IN PFCB_NONPAGED FcbNonpaged OPTIONAL );
127 //
128 // ASSERT_CCB( IN PSCB Ccb );
129 // ASSERT_OPTIONAL_CCB( IN PSCB Ccb OPTIONAL );
130 //
131 // ASSERT_IRP_CONTEXT( IN PIRP_CONTEXT IrpContext );
132 // ASSERT_OPTIONAL_IRP_CONTEXT( IN PIRP_CONTEXT IrpContext OPTIONAL );
133 //
134 // ASSERT_IRP( IN PIRP Irp );
135 // ASSERT_OPTIONAL_IRP( IN PIRP Irp OPTIONAL );
136 //
137 // ASSERT_FILE_OBJECT( IN PFILE_OBJECT FileObject );
138 // ASSERT_OPTIONAL_FILE_OBJECT( IN PFILE_OBJECT FileObject OPTIONAL );
139 //
140 // The following macros are used to check the current thread owns
141 // the indicated resource
142 //
143 // ASSERT_EXCLUSIVE_RESOURCE( IN PERESOURCE Resource );
144 //
145 // ASSERT_SHARED_RESOURCE( IN PERESOURCE Resource );
146 //
147 // ASSERT_RESOURCE_NOT_MINE( IN PERESOURCE Resource );
148 //
149 // The following macros are used to check whether the current thread
150 // owns the resource in the given structures.
151 //
152 // ASSERT_EXCLUSIVE_CDDATA
153 //
154 // ASSERT_EXCLUSIVE_VCB( IN PVCB Vcb );
155 //
156 // ASSERT_SHARED_VCB( IN PVCB Vcb );
157 //
158 // ASSERT_EXCLUSIVE_FCB( IN PFCB Fcb );
159 //
160 // ASSERT_SHARED_FCB( IN PFCB Fcb );
161 //
162 // ASSERT_EXCLUSIVE_FILE( IN PFCB Fcb );
163 //
164 // ASSERT_SHARED_FILE( IN PFCB Fcb );
165 //
166 // ASSERT_LOCKED_VCB( IN PVCB Vcb );
167 //
168 // ASSERT_NOT_LOCKED_VCB( IN PVCB Vcb );
169 //
170 // ASSERT_LOCKED_FCB( IN PFCB Fcb );
171 //
172 // ASSERT_NOT_LOCKED_FCB( IN PFCB Fcb );
173 //
174
175 //
176 // Turn on the sanity checks if this is DBG or CD_FREE_ASSERTS
177 //
178
179 #if DBG
180 #undef CD_SANITY
181 #define CD_SANITY
182 #endif
183
184 #ifdef CD_SANITY
185
186 #define ASSERT_STRUCT(S,T) ASSERT( SafeNodeType( S ) == (T) )
187 #define ASSERT_OPTIONAL_STRUCT(S,T) ASSERT( ((S) == NULL) || (SafeNodeType( S ) == (T)) )
188
189 #define ASSERT_VCB(V) ASSERT_STRUCT( (V), CDFS_NTC_VCB )
190 #define ASSERT_OPTIONAL_VCB(V) ASSERT_OPTIONAL_STRUCT( (V), CDFS_NTC_VCB )
191
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 ) )
196
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 ) )
202
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 )
205
206 #define ASSERT_CCB(C) ASSERT_STRUCT( (C), CDFS_NTC_CCB )
207 #define ASSERT_OPTIONAL_CCB(C) ASSERT_OPTIONAL_STRUCT( (C), CDFS_NTC_CCB )
208
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 )
211
212 #define ASSERT_IRP(I) ASSERT_STRUCT( (I), IO_TYPE_IRP )
213 #define ASSERT_OPTIONAL_IRP(I) ASSERT_OPTIONAL_STRUCT( (I), IO_TYPE_IRP )
214
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 )
217
218 #define ASSERT_EXCLUSIVE_RESOURCE(R) ASSERT( ExIsResourceAcquiredExclusiveLite( R ))
219
220 #define ASSERT_SHARED_RESOURCE(R) ASSERT( ExIsResourceAcquiredSharedLite( R ))
221
222 #define ASSERT_RESOURCE_NOT_MINE(R) ASSERT( !ExIsResourceAcquiredSharedLite( R ))
223
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 ))
227
228 #define ASSERT_EXCLUSIVE_FCB(F) ASSERT( ExIsResourceAcquiredExclusiveLite( &(F)->FcbNonpaged->FcbResource ))
229 #define ASSERT_SHARED_FCB(F) ASSERT( ExIsResourceAcquiredSharedLite( &(F)->FcbNonpaged->FcbResource ))
230
231 #define ASSERT_EXCLUSIVE_FILE(F) ASSERT( ExIsResourceAcquiredExclusiveLite( (F)->Resource ))
232 #define ASSERT_SHARED_FILE(F) ASSERT( ExIsResourceAcquiredSharedLite( (F)->Resource ))
233
234 #define ASSERT_LOCKED_VCB(V) ASSERT( (V)->VcbLockThread == PsGetCurrentThread() )
235 #define ASSERT_NOT_LOCKED_VCB(V) ASSERT( (V)->VcbLockThread != PsGetCurrentThread() )
236
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() )
239
240 #else
241
242 #define DebugBreakOnStatus(S) { NOTHING; }
243
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; }
274
275 #endif
276
277 #endif // _CDDATA_
278