reactos/drivers/filesystems/cdfs_new/cddata.h
Joachim Henze 688875e411 [0.4.7][CDFS_NEW/NTOSKRNL/NDK] Switch from our old CDFS to MS-PL CDFS_NEW
The main motivation to switch to that newer driver is, that our old one
simply can not read all isos. Especially complex ones made trouble and were
only shown as empty in explorer.
It is still possible to build and use the old driver when needed, only thing
that needs to be done for that is to revert 0.4.8-dev-164-g ec6b3ecbe4

Porting back the state up to 0.4.8-release-100-g8f947b5 implies:

Fixing the following JIRA-IDs (or avoid introducing them):
CORE-18029 "Mute noisy DPRINT 'SectionObject has ImageSection'"
CORE-17405 "Fix a macro-copy-paste and shrink the binary size"
CORE-15659 "Unable to build the gcc Release version in Windows using RosBE 2.1.6 (module cdfs fails)"
CORE-14315 "CDFS_NEW assertion during first stage setup due to new CcPerformReadAhead"
CORE-14128 "Avast! Free Antivirus 7.0 hangs the system when trying to detect a newly created virus"
CORE-14067 "CDFS_NEW assertions and exceptions"
CORE-14003 "Shutting down LiveCD asserts since introduction of MS PL CDFS_NEW"
CORE-13184 "Restore ability to install from disk-image"

by picking the following commits:
0.4.8-release-100-g 8f947b5322 [NTOSKRNL] Mute noisy DPRINT 'SectionObject has ImageSection' CORE-18029
0.4.8-release-80-g eb1ea19588 [CDFS_NEW] == 0.4.15-dev-1456-g 889eab7 CORE-17405
0.4.8-release-62-g 8c07aad4a8 [CDFS_NEW/XDK] == 0.4.11-dev-39-g a2f9762 + 0.4.11-dev-40-g 6d7ec8c CORE-14067
0.4.8-release-3-g 5d976d04e8 [CDFS_NEW] == 0.4.12-dev-431-g bccad87f3c + 0.4.12-dev-432-g 3463b2db9f CORE-15659
0.4.8-RC-3-g 51f9494d48 [CDFS_NEW] superseded later by the proper fix 0.4.8-release-62-g 8c07aad4a8 CORE-14067
0.4.8-dev-1069-g a5e89014dc [CDFS_NEW] CORE-14315
0.4.8-dev-475-g a59d4674de [NTOSKRNL] io/iomgr/device.c (forgotten assert) CORE-14128
0.4.8-dev-221-g 9d67a24799 [CDFS_NEW]
0.4.8-dev-220-g 67a7e45e35 [CDFS_NEW/DOC]
0.4.8-dev-219-g 6a3bbf24e0 [CDFS_NEW]
0.4.8-dev-218-g ec26cde4a1 [CDFS_NEW]
0.4.8-dev-217-g bc2378a356 [CDFS_NEW]
0.4.8-dev-216-g 5429771b99 [CDFS_NEW]
0.4.8-dev-215-g fd34548263 [CDFS_NEW] Sync with MS-PL driver
0.4.8-dev-164-g ec6b3ecbe4 [FILESYSTEMS] switch from CDFS to CDFS_NEW in CMakeLists.txt
0.4.8-dev-160-g 2b217e4ecf [NTOSKRNL] Mute spam CcSetReadAheadGranularity()
0.4.8-dev-159-g 64cb138a67 [NTOSKRNL] Mute spam CcPurgeCacheSection()
0.4.8-dev-150-g f723d230a0 [CDFS_NEW]
0.4.8-dev-133-g faee3753ea [CDFS_NEW] CORE-14003
0.4.8-dev-132-g 1d777ffab5 [NTOSKRNL] iofunc.c CORE-14003
0.4.8-dev-131-g c3d5a3f2bd [NTOSKRNL] iofunc.c CORE-14003
0.4.8-dev-130-g 3b64f7f8fb [NTOSKRNL] ob/obref.c & co CORE-14003
0.4.8-dev-129-g 7eefe70294 [NTOSKRNL] io/iomgr.c & co CORE-14003
0.4.8-dev-127-g 5f255827d3 [CDFS_NEW]
0.4.8-dev-126-g 1bef48796e [NTOSKRNL] just a comment, superseded later
0.4.8-dev-125-g cbf0430b56 [CDFS_NEW]
0.4.8-dev-123-g f88fe43abd [NTOSKRNL] io/iomgr/device.c (forbidden DPRINT)
0.4.8-dev-122-g 6c73385625 [CDFS_NEW] CORE-13184
0.4.8-dev-97-g 94298313c0 [CDFS_NEW]
0.4.8-dev-95-g e88eeb21af [CDFS_NEW/NTOSKRNL] CcWaitForCurrentLazyWriterActivity() stub return Success
0.4.8-dev-94-g 03d5be6437 [CDFS_NEW]
0.4.8-dev-93-g fa1c60db50 [CDFS_NEW]
0.4.8-dev-92-g 8b2fd60829 [CDFS_NEW]
0.4.8-dev-91-g e4da7ecc50 [CDFS_NEW]
0.4.8-dev-90-g 7b19676e2b [CDFS_NEW]
0.4.8-dev-89-g 3d4b8783fd [CDFS_NEW]
0.4.8-dev-88-g 818025ecc8 [CDFS_NEW]
0.4.8-dev-87-g 2639dd6736 [CDFS_NEW]
0.4.8-dev-86-g 755bdb5d0b [CDFS_NEW]
0.4.8-dev-85-g 3cbcb1bade [CDFS_NEW]

and mute spam in opcode INSTEAD of picking:
0.4.8-dev-165-g 2284a457a3 [NTOSKRNL] oplock.c Fixup
0.4.8-dev-163-g d3d5853956 [NTOSKRNL] oplock.c Implement oplock-support
0.4.12-dev-232-g f488102c86 [CDFS] was also left out for now

I am aware, that the backport introduces white-space-glitches within CDFS_NEW.
I decided to live with them in favor of better sync to master and newer releases.
2022-01-27 21:11:23 +01:00

273 lines
8.8 KiB
C
Executable file

/*++
Copyright (c) 1989-2000 Microsoft Corporation
Module Name:
CdData.c
Abstract:
This module declares the global data used by the Cdfs file system.
--*/
#ifndef _CDDATA_
#define _CDDATA_
//
// Global data structures
//
extern CD_DATA CdData;
extern FAST_IO_DISPATCH CdFastIoDispatch;
//
// Global constants
//
//
// This is the number of times a mounted Vcb will be referenced on behalf
// of the system. The counts include the following references.
//
// 1 reference - shows the volume is mounted
// 1 reference - 1 for VolumeDasdFcb.
// 2 references - 1 for RootIndexFcb, 1 for internal stream.
// 2 references - 1 for PathTableFcb, 1 for internal stream.
//
// For user references we add one for the reference in each of the internal
// Fcb's.
//
#define CDFS_RESIDUAL_REFERENCE (6)
#define CDFS_RESIDUAL_USER_REFERENCE (3)
//
// Reserved directory strings
//
extern WCHAR CdUnicodeSelfArray[];
extern WCHAR CdUnicodeParentArray[];
extern UNICODE_STRING CdUnicodeDirectoryNames[];
//
// Volume descriptor identifier strings.
//
extern CHAR CdHsgId[];
extern CHAR CdIsoId[];
extern CHAR CdXaId[];
//
// Volume label for audio disks.
//
extern WCHAR CdAudioLabel[];
extern USHORT CdAudioLabelLength;
//
// Pseudo file names for audio disks.
//
extern CHAR CdAudioFileName[];
extern UCHAR CdAudioFileNameLength;
extern ULONG CdAudioDirentSize;
extern ULONG CdAudioDirentsPerSector;
extern ULONG CdAudioSystemUseOffset;
#define AUDIO_NAME_ONES_OFFSET (6)
#define AUDIO_NAME_TENS_OFFSET (5)
//
// Escape sequences for mounting Unicode volumes.
//
extern PCHAR CdJolietEscape[];
//
// Hardcoded header for RIFF files.
//
extern LONG CdXAFileHeader[];
extern LONG CdAudioPlayHeader[];
extern LONG CdXAAudioPhileHeader[];
#ifdef CDFS_TELEMETRY_DATA
//
// Globals for Telemetry data.
//
extern CDFS_TELEMETRY_DATA_CONTEXT CdTelemetryData;
#endif // CDFS_TELEMETRY_DATA
//
// The following assertion macros ensure that the indicated structure
// is valid
//
// ASSERT_STRUCT( _In_ PVOID Struct, _In_ CSHORT NodeType );
// ASSERT_OPTIONAL_STRUCT( _In_opt_ PVOID Struct, _In_ CSHORT NodeType );
//
// ASSERT_VCB( _In_ PVCB Vcb );
// ASSERT_OPTIONAL_VCB( _In_opt_ PVCB Vcb );
//
// ASSERT_FCB( _In_ PFCB Fcb );
// ASSERT_OPTIONAL_FCB( _In_opt_ PFCB Fcb );
//
// ASSERT_FCB_NONPAGED( _In_ PFCB_NONPAGED FcbNonpaged );
// ASSERT_OPTIONAL_FCB( _In_opt_ PFCB_NONPAGED FcbNonpaged );
//
// ASSERT_CCB( _In_ PSCB Ccb );
// ASSERT_OPTIONAL_CCB( _In_opt_ PSCB Ccb );
//
// ASSERT_IRP_CONTEXT( _In_ PIRP_CONTEXT IrpContext );
// ASSERT_OPTIONAL_IRP_CONTEXT( _In_opt_ PIRP_CONTEXT IrpContext );
//
// ASSERT_IRP( _In_ PIRP Irp );
// ASSERT_OPTIONAL_IRP( _In_opt_ PIRP Irp );
//
// ASSERT_FILE_OBJECT( _In_ PFILE_OBJECT FileObject );
// ASSERT_OPTIONAL_FILE_OBJECT( _In_opt_ PFILE_OBJECT FileObject );
//
// The following macros are used to check the current thread owns
// the indicated resource
//
// ASSERT_EXCLUSIVE_RESOURCE( _In_ PERESOURCE Resource );
//
// ASSERT_SHARED_RESOURCE( _In_ PERESOURCE Resource );
//
// ASSERT_RESOURCE_NOT_MINE( _In_ PERESOURCE Resource );
//
// The following macros are used to check whether the current thread
// owns the resoures in the given structures.
//
// ASSERT_EXCLUSIVE_CDDATA
//
// ASSERT_EXCLUSIVE_VCB( _In_ PVCB Vcb );
//
// ASSERT_SHARED_VCB( _In_ PVCB Vcb );
//
// ASSERT_EXCLUSIVE_FCB( _In_ PFCB Fcb );
//
// ASSERT_SHARED_FCB( _In_ PFCB Fcb );
//
// ASSERT_EXCLUSIVE_FILE( _In_ PFCB Fcb );
//
// ASSERT_SHARED_FILE( _In_ PFCB Fcb );
//
// ASSERT_LOCKED_VCB( _In_ PVCB Vcb );
//
// ASSERT_NOT_LOCKED_VCB( _In_ PVCB Vcb );
//
// ASSERT_LOCKED_FCB( _In_ PFCB Fcb );
//
// ASSERT_NOT_LOCKED_FCB( _In_ PFCB Fcb );
//
//
// Turn on the sanity checks if this is DBG or CD_FREE_ASSERTS
//
#if DBG
#undef CD_SANITY
//#define CD_SANITY
#endif
#ifdef CD_SANITY
#define ASSERT_STRUCT(S,T) NT_ASSERT( SafeNodeType( S ) == (T) )
#define ASSERT_OPTIONAL_STRUCT(S,T) NT_ASSERT( ((S) == NULL) || (SafeNodeType( S ) == (T)) )
#define ASSERT_VCB(V) ASSERT_STRUCT( (V), CDFS_NTC_VCB )
#define ASSERT_OPTIONAL_VCB(V) ASSERT_OPTIONAL_STRUCT( (V), CDFS_NTC_VCB )
#define ASSERT_FCB(F) \
NT_ASSERT( (SafeNodeType( F ) == CDFS_NTC_FCB_DATA ) || \
(SafeNodeType( F ) == CDFS_NTC_FCB_INDEX ) || \
(SafeNodeType( F ) == CDFS_NTC_FCB_PATH_TABLE ) )
#define ASSERT_OPTIONAL_FCB(F) \
NT_ASSERT( ((F) == NULL) || \
(SafeNodeType( F ) == CDFS_NTC_FCB_DATA ) || \
(SafeNodeType( F ) == CDFS_NTC_FCB_INDEX ) || \
(SafeNodeType( F ) == CDFS_NTC_FCB_PATH_TABLE ) )
#define ASSERT_FCB_NONPAGED(FN) ASSERT_STRUCT( (FN), CDFS_NTC_FCB_NONPAGED )
#define ASSERT_OPTIONAL_FCB_NONPAGED(FN) ASSERT_OPTIONAL_STRUCT( (FN), CDFS_NTC_FCB_NONPAGED )
#define ASSERT_CCB(C) ASSERT_STRUCT( (C), CDFS_NTC_CCB )
#define ASSERT_OPTIONAL_CCB(C) ASSERT_OPTIONAL_STRUCT( (C), CDFS_NTC_CCB )
#define ASSERT_IRP_CONTEXT(IC) ASSERT_STRUCT( (IC), CDFS_NTC_IRP_CONTEXT )
#define ASSERT_OPTIONAL_IRP_CONTEXT(IC) ASSERT_OPTIONAL_STRUCT( (IC), CDFS_NTC_IRP_CONTEXT )
#define ASSERT_IRP(I) ASSERT_STRUCT( (I), IO_TYPE_IRP )
#define ASSERT_OPTIONAL_IRP(I) ASSERT_OPTIONAL_STRUCT( (I), IO_TYPE_IRP )
#define ASSERT_FILE_OBJECT(FO) ASSERT_STRUCT( (FO), IO_TYPE_FILE )
#define ASSERT_OPTIONAL_FILE_OBJECT(FO) ASSERT_OPTIONAL_STRUCT( (FO), IO_TYPE_FILE )
#define ASSERT_EXCLUSIVE_RESOURCE(R) NT_ASSERT( ExIsResourceAcquiredExclusiveLite( R ))
#define ASSERT_SHARED_RESOURCE(R) NT_ASSERT( ExIsResourceAcquiredSharedLite( R ))
#define ASSERT_RESOURCE_NOT_MINE(R) NT_ASSERT( !ExIsResourceAcquiredSharedLite( R ))
#define ASSERT_EXCLUSIVE_CDDATA NT_ASSERT( ExIsResourceAcquiredExclusiveLite( &CdData.DataResource ))
#define ASSERT_EXCLUSIVE_VCB(V) NT_ASSERT( ExIsResourceAcquiredExclusiveLite( &(V)->VcbResource ))
#define ASSERT_SHARED_VCB(V) NT_ASSERT( ExIsResourceAcquiredSharedLite( &(V)->VcbResource ))
#define ASSERT_EXCLUSIVE_FCB(F) NT_ASSERT( ExIsResourceAcquiredExclusiveLite( &(F)->FcbNonpaged->FcbResource ))
#define ASSERT_SHARED_FCB(F) NT_ASSERT( ExIsResourceAcquiredSharedLite( &(F)->FcbNonpaged->FcbResource ))
#define ASSERT_EXCLUSIVE_FILE(F) NT_ASSERT( ExIsResourceAcquiredExclusiveLite( (F)->Resource ))
#define ASSERT_SHARED_FILE(F) NT_ASSERT( ExIsResourceAcquiredSharedLite( (F)->Resource ))
#define ASSERT_LOCKED_VCB(V) NT_ASSERT( (V)->VcbLockThread == PsGetCurrentThread() )
#define ASSERT_NOT_LOCKED_VCB(V) NT_ASSERT( (V)->VcbLockThread != PsGetCurrentThread() )
#define ASSERT_LOCKED_FCB(F) NT_ASSERT( !FlagOn( (F)->FcbState, FCB_STATE_IN_FCB_TABLE) || ((F)->FcbLockThread == PsGetCurrentThread()))
#define ASSERT_NOT_LOCKED_FCB(F) NT_ASSERT( (F)->FcbLockThread != PsGetCurrentThread() )
#else
#define DebugBreakOnStatus(S) { NOTHING; }
#define ASSERT_STRUCT(S,T) { NOTHING; }
#define ASSERT_OPTIONAL_STRUCT(S,T) { NOTHING; }
#define ASSERT_VCB(V) { NOTHING; }
#define ASSERT_OPTIONAL_VCB(V) { NOTHING; }
#define ASSERT_FCB(F) { NOTHING; }
#define ASSERT_FCB_NONPAGED(FN) { NOTHING; }
#define ASSERT_OPTIONAL_FCB(FN) { NOTHING; }
#define ASSERT_CCB(C) { NOTHING; }
#define ASSERT_OPTIONAL_CCB(C) { NOTHING; }
#define ASSERT_IRP_CONTEXT(IC) { NOTHING; }
#define ASSERT_OPTIONAL_IRP_CONTEXT(IC) { NOTHING; }
#define ASSERT_IRP(I) { NOTHING; }
#define ASSERT_OPTIONAL_IRP(I) { NOTHING; }
#define ASSERT_FILE_OBJECT(FO) { NOTHING; }
#define ASSERT_OPTIONAL_FILE_OBJECT(FO) { NOTHING; }
#define ASSERT_EXCLUSIVE_RESOURCE(R) { NOTHING; }
#define ASSERT_SHARED_RESOURCE(R) { NOTHING; }
#define ASSERT_RESOURCE_NOT_MINE(R) { NOTHING; }
#define ASSERT_EXCLUSIVE_CDDATA { NOTHING; }
#define ASSERT_EXCLUSIVE_VCB(V) { NOTHING; }
#define ASSERT_SHARED_VCB(V) { NOTHING; }
#define ASSERT_EXCLUSIVE_FCB(F) { NOTHING; }
#define ASSERT_SHARED_FCB(F) { NOTHING; }
#define ASSERT_EXCLUSIVE_FILE(F) { NOTHING; }
#define ASSERT_SHARED_FILE(F) { NOTHING; }
#define ASSERT_LOCKED_VCB(V) { NOTHING; }
#define ASSERT_NOT_LOCKED_VCB(V) { NOTHING; }
#define ASSERT_LOCKED_FCB(F) { NOTHING; }
#define ASSERT_NOT_LOCKED_FCB(F) { NOTHING; }
#endif
#endif // _CDDATA_