ReactOS 0.4.16-dev-297-gc569aee
udf_rel.h
Go to the documentation of this file.
1
2// Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine
3// All rights reserved
4// This file was released under the GPLv2 on June 2015.
6/*
7
8 Module Name: udf_rel.h
9
10 Abstract:
11
12 Contains udf related structures.
13
14 Environment:
15
16 Both kernel and user mode
17
18*/
19
20#ifndef _UDF_REL_H_
21#define _UDF_REL_H_
22
23#include "Include/platform.h"
24#include "ecma_167.h"
25
26#ifdef UDF_LIMIT_DIR_SIZE
27typedef uint8 uint_di;
28#else //UDF_LIMIT_DIR_SIZE
30#endif //UDF_LIMIT_DIR_SIZE
31
32typedef struct _UDFTrackMap {
41
43#define TrackMap_AllowCopyBit_variated 0x01
44#define TrackMap_CopyBit_variated 0x02
45#define TrackMap_Try_variation 0x04
46#define TrackMap_Use_variation 0x08
47#define TrackMap_FixFPAddressing 0x10
48#define TrackMap_FixMRWAddressing 0x20
49
50 // are used only if FixFPAddressing is enabled
53
55
56typedef struct _UDFSparingData
57{
61
62#define PACK_MAPPING_THRESHOLD (sizeof(EXTENT_MAP)*8)
63
64typedef struct _EXTENT_INFO {
67 int64 Length; // user data
68 BOOLEAN Modified; // mapping
70/*
71 UCHAR Reserved[2];
72 PVOID Cache;
73*/
75
76#define EXTENT_FLAG_ALLOC_STD 0x00
77#define EXTENT_FLAG_ALLOC_SEQUENTIAL 0x01
78#define EXTENT_FLAG_ALLOC_MASK 0x03
79#define EXTENT_FLAG_PREALLOCATED 0x80
80#define EXTENT_FLAG_CUT_PREALLOCATED 0x40
81#define EXTENT_FLAG_VERIFY 0x20
82#define EXTENT_FLAG_2K_COMPAT 0x10
83
84typedef struct _UDFPartMap
85{
95
96
97#define VDS_POS_PRIMARY_VOL_DESC 0
98#define VDS_POS_UNALLOC_SPACE_DESC 1
99#define VDS_POS_LOGICAL_VOL_DESC 2
100#define VDS_POS_PARTITION_DESC 3
101#define VDS_POS_IMP_USE_VOL_DESC 4
102#define VDS_POS_VOL_DESC_PTR 5
103#define VDS_POS_TERMINATING_DESC 6
104#define VDS_POS_RECURSION_COUNTER 7
105#define VDS_POS_LENGTH 8
106
107typedef struct _UDF_VDS_RECORD {
111
112#define VRS_NSR02_FOUND 0x0001
113#define VRS_NSR03_FOUND 0x0002
114#define VRS_ISO9660_FOUND 0x0004
115
116#define EXTENT_MAP_GRAN (8*sizeof(LONG_AD))
117#define DIR_INDEX_MAP_GRAN (8*sizeof(DIR_INDEX))
118#define SHORT_AD_GRAN (8*sizeof(SHORT_AD))
119#define RELOC_MAP_GRAN (8*sizeof(EXT_RELOCATION_ENTRY))
120#define ALLOC_DESC_MAX_RECURSE 256
121
122struct _UDF_FILE_INFO;
123struct _DIR_INDEX_ITEM;
124
125#define UDF_DIR_INDEX_MT PagedPool
126#define UDF_FILENAME_MT PagedPool
127
128typedef struct _HASH_ENTRY {
129 uint32 hDos; // hash for Dos-name
130 uint32 hLfn; // hash for Upcased Lfn
131 uint32 hPosix; // hash for Posix Lfn
133
134typedef struct _DIR_INDEX_HDR {
140 EXTENT_INFO FECharge; // file entry charge
141 EXTENT_INFO FEChargeSDir; // file entry charge for streams
143// struct _DIR_INDEX_ITEM* FrameList[0];
145
146// Initial location of directory data extent in IN_ICB
147#define UDF_DI_FLAG_INIT_IN_ICB (0x01)
148
155typedef struct _DIR_INDEX_ITEM {
156 // FSD-specific data
161 uint32 Offset; // File Ident offset in extent
168 uint32 Length; // Its length
178 lb_addr FileEntryLoc; // pointer to FileEntry
199 uint8 FI_Flags; // FileIdent-related flags
204 struct _UDF_FILE_INFO* FileInfo; // associated FileInfo (if opened)
205 // search hashes
207 // attributes (System-specific format)
217#define UDF_FI_FLAG_FI_MODIFIED (0x01)
219#define UDF_FI_FLAG_SYS_ATTR (0x02)// cached flags in system-specific format
221#define UDF_FI_FLAG_FI_INTERNAL (0x04)
223#define UDF_FI_FLAG_LINKED (0x08)
224
225#define UDF_FI_FLAG_DOS (0x10)// Lfn-style name is equal to DOS-style (case insensetive)
226#define UDF_FI_FLAG_KEEP_NAME (0x20)
227
228#define UDF_DATALOC_INFO_MT PagedPool
229
249typedef struct _UDF_DATALOC_INFO {
250
255 struct _UDFNTRequiredFCB* CommonFcb; // pointer to corresponding NtReqFcb
262 EXTENT_INFO DataLoc; // user data
274 EXTENT_INFO AllocLoc; // allocation descriptors (if any)
279 EXTENT_INFO FELoc; // file entry location
285 tag* FileEntry; // file entry data
299 uint32 FE_Flags; // FileEntry flags
312 PDIR_INDEX_HDR DirIndex; // for Directory objects only
321
323#define UDF_FE_FLAG_FE_MODIFIED (0x01)
325#define UDF_FE_FLAG_HAS_SDIR (0x02)
327#define UDF_FE_FLAG_IS_SDIR (0x04)
329#define UDF_FE_FLAG_DIR_MODIFIED (0x08)
331#define UDF_FE_FLAG_HAS_DEL_SDIR (0x10)
333#define UDF_FE_FLAG_IS_DEL_SDIR (0x20)
335#define UDF_FE_FLAG_UNDER_INIT (0x40)
336
337
338#define UDF_FILE_INFO_MT PagedPool
339
340
346typedef struct _UDF_FILE_INFO {
347#ifdef VALIDATE_STRUCTURES
353 uint32 IntegrityTag;
354#endif
362 struct _UDFFileControlBlock* Fcb; // pointer to corresponding Fcb (null if absent)
367 PUDF_DATALOC_INFO Dloc; // actual data location descriptor
372 PFILE_IDENT_DESC FileIdent; // file ident data
381 struct _UDF_FILE_INFO* ParentFile; // parent (directory) if any
392 uint_di Index; // index in parent directory
399 uint32 RefCount; // number of references
407 uint32 OpenCount; // number of opened files in Dir
410
413
414typedef struct _FE_LIST_ENTRY {
418
419#define DOS_NAME_LEN 8
420#define DOS_EXT_LEN 3
421#define ILLEGAL_CHAR_MARK 0x005F
422#define UNICODE_CRC_MARK 0x0023
423#define UNICODE_PERIOD 0x002E
424#define UNICODE_SPACE 0x0020
425
426#define LBA_OUT_OF_EXTENT ((ULONG)(-1))
427#define LBA_NOT_ALLOCATED ((ULONG)(-2))
428
429typedef struct _EXT_RELOCATION_ENTRY {
434
435typedef struct _UDF_DATALOC_INDEX {
439
440typedef struct _UDF_DIR_SCAN_CONTEXT {
449
452
458
459/*
460#define MEM_DIR_HDR_TAG (ULONG)"DirHdr"
461#define MEM_DIR_NDX_TAG (ULONG)"DirNdx"
462#define MEM_DLOC_NDX_TAG (ULONG)"DlocNdx"
463#define MEM_DLOC_INF_TAG (ULONG)"DlocInf"
464#define MEM_FNAME_TAG (ULONG)"FName"
465#define MEM_FNAME16_TAG (ULONG)"FName16"
466#define MEM_FNAMECPY_TAG (ULONG)"FNameC"
467#define MEM_FE_TAG (ULONG)"FE"
468#define MEM_XFE_TAG (ULONG)"xFE"
469#define MEM_FID_TAG (ULONG)"FID"
470#define MEM_FINF_TAG (ULONG)"FInf"
471#define MEM_VATFINF_TAG (ULONG)"FInfVat"
472#define MEM_SDFINF_TAG (ULONG)"SDirFInf"
473#define MEM_EXTMAP_TAG (ULONG)"ExtMap"
474#define MEM_ALLOCDESC_TAG (ULONG)"AllocDesc"
475#define MEM_SHAD_TAG (ULONG)"SHAD"
476#define MEM_LNGAD_TAG (ULONG)"LNGAD"
477*/
478
479#define MEM_DIR_HDR_TAG 'DirH'
480#define MEM_DIR_NDX_TAG 'DirN'
481#define MEM_DLOC_NDX_TAG 'Dloc'
482#define MEM_DLOC_INF_TAG 'Dloc'
483#define MEM_FNAME_TAG 'FNam'
484#define MEM_FNAME16_TAG 'FNam'
485#define MEM_FNAMECPY_TAG 'FNam'
486#define MEM_FE_TAG 'FE'
487#define MEM_XFE_TAG 'xFE"'
488#define MEM_FID_TAG 'FID'
489#define MEM_FINF_TAG 'FInf'
490#define MEM_VATFINF_TAG 'FInf'
491#define MEM_SDFINF_TAG 'SDir'
492#define MEM_EXTMAP_TAG 'ExtM'
493#define MEM_ALLOCDESC_TAG 'Allo'
494#define MEM_SHAD_TAG 'SHAD'
495#define MEM_LNGAD_TAG 'LNGA'
496#define MEM_ALLOC_CACHE_TAG 'hcCA'
497
498#define UDF_DEFAULT_LAST_LBA_CD 276159
499#define UDF_DEFAULT_LAST_LBA_DVD 0x23053f
500#define UDF_DEFAULT_FE_CHARGE 128
501#define UDF_DEFAULT_FE_CHARGE_SDIR 1
502#define UDF_WRITE_MAX_RETRY 4
503#define UDF_READ_MAX_RETRY 4
504#define UDF_READY_MAX_RETRY 5
505
506#define ICB_FLAG_AD_DEFAULT_ALLOC_MODE (UCHAR)(0xff)
507
508#define UDF_INVALID_LINK_COUNT 0xffff
509#define UDF_MAX_LINK_COUNT 0x7fff
510
511#define UDF_MAX_EXTENT_LENGTH (UDF_EXTENT_LENGTH_MASK & ~(2048-1))
512
513#define UDF_MAX_READ_REVISION 0x0260
514#define UDF_MAX_WRITE_REVISION 0x0201
515
516#define UDF_MAX_LVID_CHAIN_LENGTH 1024
517#define UDF_LVID_TTL 1024
518
519#define UDF_NO_EXTENT_MAP ((PEXTENT_MAP)(ULONG_PTR)~0ULL)
520
521#define UDF_FLUSH_FLAGS_LITE (0x80000000)
522
523#if defined UDF_DBG || defined _CONSOLE
524//#define UDF_CHECK_DISK_ALLOCATION
525
526//#define UDF_TRACK_ONDISK_ALLOCATION
527
528//#define UDF_TRACK_ONDISK_ALLOCATION_OWNERS
529//#define UDF_TRACK_ONDISK_ALLOCATION_OWNERS_INTERNAL
530
531//#define UDF_TRACK_EXTENT_TO_MAPPING
532
533//#define UDF_TRACK_ALLOC_FREE_EXTENT
534
535//#define UDF_CHECK_EXTENT_SIZE_ALIGNMENT
536
537// dependences:
538
539#ifdef UDF_TRACK_ALLOC_FREE_EXTENT
540 #define UDF_TRACK_EXTENT_TO_MAPPING
541#endif //UDF_TRACK_ALLOC_FREE_EXTENT
542
543#endif //UDF_DBG
544
545typedef struct _UDF_VERIFY_CTX {
546 uint8* StoredBitMap;
547 ULONG ItemCount;
548 LIST_ENTRY vrfList;
549 ERESOURCE VerifyLock;
550 KEVENT vrfEvent;
551 uint32 WaiterCount;
552 uint32 QueuedCount;
553 BOOLEAN VInited;
554} UDF_VERIFY_CTX, *PUDF_VERIFY_CTX;
555
556#endif /* _UDF_REL_H_ */
unsigned char BOOLEAN
unsigned short uint16
Definition: types.h:30
unsigned int uint32
Definition: types.h:32
unsigned char uint8
Definition: types.h:28
uint32 lba_t
Definition: platform.h:20
long long int64
Definition: platform.h:13
uint_di FirstFree
Definition: udf_rel.h:135
EXTENT_INFO FECharge
Definition: udf_rel.h:140
EXTENT_INFO FEChargeSDir
Definition: udf_rel.h:141
uint_di LastUsed
Definition: udf_rel.h:136
uint_di FrameCount
Definition: udf_rel.h:137
uint_di LastFrameCount
Definition: udf_rel.h:138
ULONG DIFlags
Definition: udf_rel.h:142
uint_di DelCount
Definition: udf_rel.h:139
UNICODE_STRING FName
Definition: udf_rel.h:173
int64 AllocationSize
Definition: udf_rel.h:214
struct _UDF_FILE_INFO * FileInfo
Definition: udf_rel.h:204
int64 CreationTime
Definition: udf_rel.h:209
int64 LastAccessTime
Definition: udf_rel.h:211
uint8 FI_Flags
Definition: udf_rel.h:199
uint32 Offset
Definition: udf_rel.h:161
uint32 SysAttr
Definition: udf_rel.h:208
lb_addr FileEntryLoc
Definition: udf_rel.h:178
uint8 FileCharacteristics
Definition: udf_rel.h:182
uint32 Length
Definition: udf_rel.h:168
int64 LastWriteTime
Definition: udf_rel.h:210
int64 FileSize
Definition: udf_rel.h:213
int64 ChangeTime
Definition: udf_rel.h:212
HASH_ENTRY hashes
Definition: udf_rel.h:206
PEXTENT_MAP Mapping
Definition: udf_rel.h:66
int64 Length
Definition: udf_rel.h:67
UCHAR Flags
Definition: udf_rel.h:69
BOOLEAN Modified
Definition: udf_rel.h:68
uint32 Offset
Definition: udf_rel.h:65
Definition: udf_rel.h:429
uint32 extLocation
Definition: udf_rel.h:431
uint32 extLength
Definition: udf_rel.h:430
uint32 extRedir
Definition: udf_rel.h:432
Definition: udf_rel.h:414
ULONG EntryRefCount
Definition: udf_rel.h:416
PUDF_FILE_INFO FileInfo
Definition: udf_rel.h:415
Definition: udf_rel.h:128
uint32 hLfn
Definition: udf_rel.h:130
uint32 hDos
Definition: udf_rel.h:129
uint32 hPosix
Definition: udf_rel.h:131
uint32 UspaceBitmap
Definition: udf_rel.h:86
uint16 PartitionType
Definition: udf_rel.h:91
uint32 AccessType
Definition: udf_rel.h:88
uint16 PartitionNum
Definition: udf_rel.h:92
uint32 PartitionLen
Definition: udf_rel.h:90
uint16 VolumeSeqNum
Definition: udf_rel.h:93
uint32 PartitionRoot
Definition: udf_rel.h:89
uint32 FspaceBitmap
Definition: udf_rel.h:87
uint16 SparingPLength
Definition: udf_rel.h:59
uint32 SparingLocation
Definition: udf_rel.h:58
uint8 Flags
Definition: udf_rel.h:42
uint8 DataParam
Definition: udf_rel.h:39
uint32 FirstLba
Definition: udf_rel.h:33
uint8 NWA_V
Definition: udf_rel.h:40
uint32 PacketFPOffset
Definition: udf_rel.h:52
uint32 TrackFPOffset
Definition: udf_rel.h:51
uint32 Session
Definition: udf_rel.h:37
uint8 TrackParam
Definition: udf_rel.h:38
uint32 PacketSize
Definition: udf_rel.h:36
uint32 NWA
Definition: udf_rel.h:35
uint32 LastLba
Definition: udf_rel.h:34
PUDF_DATALOC_INFO Dloc
Definition: udf_rel.h:437
uint32 FE_Flags
Definition: udf_rel.h:299
struct _UDF_FILE_INFO * SDirInfo
Definition: udf_rel.h:319
EXTENT_INFO FELoc
Definition: udf_rel.h:279
EXTENT_INFO DataLoc
Definition: udf_rel.h:262
struct _UDFNTRequiredFCB * CommonFcb
Definition: udf_rel.h:255
uint32 LinkRefCount
Definition: udf_rel.h:306
EXTENT_INFO AllocLoc
Definition: udf_rel.h:274
uint32 FileEntryLen
Definition: udf_rel.h:286
PDIR_INDEX_HDR DirIndex
Definition: udf_rel.h:312
struct _UDF_FILE_INFO * LinkedFileInfo
Definition: udf_rel.h:313
PDIR_INDEX_ITEM DirNdx
Definition: udf_rel.h:443
PUDF_FILE_INFO DirInfo
Definition: udf_rel.h:441
PDIR_INDEX_HDR hDirNdx
Definition: udf_rel.h:442
struct _FE_LIST_ENTRY * ListPtr
Definition: udf_rel.h:411
uint32 FileIdentLen
Definition: udf_rel.h:376
struct _UDF_FILE_INFO * PrevLinkedFile
Definition: udf_rel.h:409
uint32 OpenCount
Definition: udf_rel.h:407
PUDF_DATALOC_INFO Dloc
Definition: udf_rel.h:367
struct _UDFFileControlBlock * Fcb
Definition: udf_rel.h:362
uint32 RefCount
Definition: udf_rel.h:399
struct _UDF_FILE_INFO * ParentFile
Definition: udf_rel.h:381
uint_di Index
Definition: udf_rel.h:392
PFILE_IDENT_DESC FileIdent
Definition: udf_rel.h:372
struct _UDF_FILE_INFO * NextLinkedFile
Definition: udf_rel.h:408
uint32 volDescSeqNum
Definition: udf_rel.h:109
uint32 block
Definition: udf_rel.h:108
Definition: ecma_167.h:138
uint32_t ULONG
Definition: typedefs.h:59
struct _DIR_INDEX_HDR * PDIR_INDEX_HDR
struct _FE_LIST_ENTRY FE_LIST_ENTRY
struct _UDFPartMap UDFPartMap
PEXT_RELOCATION_ENTRY PEXT_RELOC_MAP
Definition: udf_rel.h:451
struct _UDF_DATALOC_INDEX UDF_DATALOC_INDEX
struct _UDFPartMap * PUDFPartMap
struct _UDF_DATALOC_INFO UDF_DATALOC_INFO
struct _UDFSparingData UDFSparingData
struct _UDFTrackMap UDFTrackMap
uint32 uint_di
Definition: udf_rel.h:29
struct _DIR_INDEX_ITEM * PDIR_INDEX_ITEM
struct _EXTENT_INFO * PEXTENT_INFO
EXT_RELOCATION_ENTRY EXT_RELOC_MAP
Definition: udf_rel.h:450
struct _UDF_ALLOCATION_CACHE_ITEM UDF_ALLOCATION_CACHE_ITEM
struct _FE_LIST_ENTRY * PFE_LIST_ENTRY
struct _UDF_DIR_SCAN_CONTEXT UDF_DIR_SCAN_CONTEXT
struct _UDF_DIR_SCAN_CONTEXT * PUDF_DIR_SCAN_CONTEXT
struct _HASH_ENTRY HASH_ENTRY
struct _UDF_DATALOC_INDEX * PUDF_DATALOC_INDEX
struct _DIR_INDEX_HDR DIR_INDEX_HDR
struct _UDF_FILE_INFO UDF_FILE_INFO
struct _UDF_VDS_RECORD UDF_VDS_RECORD
struct _UDFSparingData * PUDFSparingData
struct _UDFTrackMap * PUDFTrackMap
struct _UDF_VDS_RECORD * PUDF_VDS_RECORD
struct _EXT_RELOCATION_ENTRY * PEXT_RELOCATION_ENTRY
struct _UDF_ALLOCATION_CACHE_ITEM * PUDF_ALLOCATION_CACHE_ITEM
struct _EXTENT_INFO EXTENT_INFO
struct _DIR_INDEX_ITEM DIR_INDEX_ITEM
struct _EXT_RELOCATION_ENTRY EXT_RELOCATION_ENTRY
struct _HASH_ENTRY * PHASH_ENTRY
struct _UDF_FILE_INFO * PUDF_FILE_INFO
struct _UDF_DATALOC_INFO * PUDF_DATALOC_INFO
unsigned char UCHAR
Definition: xmlstorage.h:181