ReactOS  0.4.14-dev-114-gc8cbd56
udf_rel.h
Go to the documentation of this file.
1 // 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
27 typedef uint8 uint_di;
28 #else //UDF_LIMIT_DIR_SIZE
29 typedef uint32 uint_di;
30 #endif //UDF_LIMIT_DIR_SIZE
31 
32 typedef 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 
56 typedef struct _UDFSparingData
57 {
61 
62 #define PACK_MAPPING_THRESHOLD (sizeof(EXTENT_MAP)*8)
63 
64 typedef 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 
84 typedef 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 
107 typedef 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 
122 struct _UDF_FILE_INFO;
123 struct _DIR_INDEX_ITEM;
124 
125 #define UDF_DIR_INDEX_MT PagedPool
126 #define UDF_FILENAME_MT PagedPool
127 
128 typedef 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 
134 typedef struct _DIR_INDEX_HDR {
138  uint_di LastFrameCount; // in items
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 
155 typedef struct _DIR_INDEX_ITEM {
156  // FSD-specific data
161  uint32 Offset; // File Ident offset in extent
168  uint32 Length; // Its length
173  UNICODE_STRING FName; // Filename
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)
218 #define UDF_FI_FLAG_SYS_ATTR (0x02)// cached flags in system-specific format
220 #define UDF_FI_FLAG_FI_INTERNAL (0x04)
222 #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 
249 typedef 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)
324 #define UDF_FE_FLAG_HAS_SDIR (0x02)
326 #define UDF_FE_FLAG_IS_SDIR (0x04)
328 #define UDF_FE_FLAG_DIR_MODIFIED (0x08)
330 #define UDF_FE_FLAG_HAS_DEL_SDIR (0x10)
332 #define UDF_FE_FLAG_IS_DEL_SDIR (0x20)
334 #define UDF_FE_FLAG_UNDER_INIT (0x40)
336 
337 
338 #define UDF_FILE_INFO_MT PagedPool
339 
340 
346 typedef struct _UDF_FILE_INFO {
347 #ifdef VALIDATE_STRUCTURES
348 
353  uint32 IntegrityTag;
354 #endif
355 
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 
414 typedef 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 
429 typedef struct _EXT_RELOCATION_ENTRY {
434 
435 typedef struct _UDF_DATALOC_INDEX {
439 
440 typedef 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 
545 typedef struct _UDF_VERIFY_CTX {
555 
556 #endif /* _UDF_REL_H_ */
struct _UDF_ALLOCATION_CACHE_ITEM UDF_ALLOCATION_CACHE_ITEM
struct _UDF_ALLOCATION_CACHE_ITEM * PUDF_ALLOCATION_CACHE_ITEM
struct _UDF_DIR_SCAN_CONTEXT UDF_DIR_SCAN_CONTEXT
UNICODE_STRING FName
Definition: udf_rel.h:173
struct _UDF_FILE_INFO UDF_FILE_INFO
uint32 extRedir
Definition: udf_rel.h:432
struct _UDFTrackMap * PUDFTrackMap
EXTENT_INFO AllocLoc
Definition: udf_rel.h:274
ULONG EntryRefCount
Definition: udf_rel.h:416
struct _UDF_FILE_INFO * LinkedFileInfo
Definition: udf_rel.h:313
BOOLEAN Modified
Definition: udf_rel.h:68
uint16 PartitionNum
Definition: udf_rel.h:92
Definition: udf_rel.h:414
ERESOURCE VerifyLock
Definition: udf_rel.h:549
struct _UDF_VERIFY_CTX * PUDF_VERIFY_CTX
unsigned int uint32
Definition: types.h:32
PDIR_INDEX_HDR DirIndex
Definition: udf_rel.h:312
uint32 extLength
Definition: udf_rel.h:430
struct _UDF_DATALOC_INFO UDF_DATALOC_INFO
struct _FE_LIST_ENTRY * PFE_LIST_ENTRY
uint32 PacketFPOffset
Definition: udf_rel.h:52
Definition: udf_rel.h:128
Definition: ecma_167.h:138
uint_di FrameCount
Definition: udf_rel.h:137
uint32 FE_Flags
Definition: udf_rel.h:299
PUDF_DATALOC_INFO Dloc
Definition: udf_rel.h:367
EXTENT_INFO FEChargeSDir
Definition: udf_rel.h:141
lb_addr FileEntryLoc
Definition: udf_rel.h:178
uint32 extLocation
Definition: udf_rel.h:431
long long int64
Definition: platform.h:13
int64 Length
Definition: udf_rel.h:67
uint32 FirstLba
Definition: udf_rel.h:33
uint32 QueuedCount
Definition: udf_rel.h:552
uint32 uint_di
Definition: udf_rel.h:29
PEXTENT_MAP Mapping
Definition: udf_rel.h:66
uint16 VolumeSeqNum
Definition: udf_rel.h:93
uint32 LastLba
Definition: udf_rel.h:34
uint_di LastFrameCount
Definition: udf_rel.h:138
uint16 SparingPLength
Definition: udf_rel.h:59
uint_di DelCount
Definition: udf_rel.h:139
struct _UDF_FILE_INFO * NextLinkedFile
Definition: udf_rel.h:408
uint32 Session
Definition: udf_rel.h:37
Definition: udf_rel.h:429
struct _DIR_INDEX_HDR DIR_INDEX_HDR
uint32 volDescSeqNum
Definition: udf_rel.h:109
LIST_ENTRY vrfList
Definition: udf_rel.h:548
unsigned char BOOLEAN
EXTENT_INFO FELoc
Definition: udf_rel.h:279
uint8 FileCharacteristics
Definition: udf_rel.h:182
ULONG DIFlags
Definition: udf_rel.h:142
struct _HASH_ENTRY HASH_ENTRY
uint8 DataParam
Definition: udf_rel.h:39
struct _HASH_ENTRY * PHASH_ENTRY
int64 FileSize
Definition: udf_rel.h:213
uint8 NWA_V
Definition: udf_rel.h:40
int64 LastAccessTime
Definition: udf_rel.h:211
uint_di FirstFree
Definition: udf_rel.h:135
PDIR_INDEX_HDR hDirNdx
Definition: udf_rel.h:442
uint32 PartitionLen
Definition: udf_rel.h:90
KEVENT vrfEvent
Definition: udf_rel.h:550
EXTENT_INFO FECharge
Definition: udf_rel.h:140
uint32 block
Definition: udf_rel.h:108
UCHAR Flags
Definition: udf_rel.h:69
uint32 FileEntryLen
Definition: udf_rel.h:286
int64 CreationTime
Definition: udf_rel.h:209
EXTENT_INFO DataLoc
Definition: udf_rel.h:262
uint32 OpenCount
Definition: udf_rel.h:407
uint_di Index
Definition: udf_rel.h:392
uint8 TrackParam
Definition: udf_rel.h:38
struct _DIR_INDEX_ITEM * PDIR_INDEX_ITEM
HASH_ENTRY hashes
Definition: udf_rel.h:206
struct _FE_LIST_ENTRY * ListPtr
Definition: udf_rel.h:411
struct _UDFSparingData UDFSparingData
ULONG ItemCount
Definition: udf_rel.h:547
struct _UDF_VERIFY_CTX UDF_VERIFY_CTX
struct _UDFSparingData * PUDFSparingData
struct _UDF_FILE_INFO * PrevLinkedFile
Definition: udf_rel.h:409
struct _FE_LIST_ENTRY FE_LIST_ENTRY
unsigned char uint8
Definition: types.h:28
int64 AllocationSize
Definition: udf_rel.h:214
struct _UDF_FILE_INFO * ParentFile
Definition: udf_rel.h:381
BOOLEAN VInited
Definition: udf_rel.h:553
struct _UDF_FILE_INFO * SDirInfo
Definition: udf_rel.h:319
struct _UDF_DATALOC_INDEX UDF_DATALOC_INDEX
int64 ChangeTime
Definition: udf_rel.h:212
struct _EXT_RELOCATION_ENTRY EXT_RELOCATION_ENTRY
unsigned char UCHAR
Definition: xmlstorage.h:181
uint32 Offset
Definition: udf_rel.h:65
struct _UDF_DIR_SCAN_CONTEXT * PUDF_DIR_SCAN_CONTEXT
uint16 PartitionType
Definition: udf_rel.h:91
struct _UDFPartMap * PUDFPartMap
struct _UDF_VDS_RECORD UDF_VDS_RECORD
struct _UDFNTRequiredFCB * CommonFcb
Definition: udf_rel.h:255
PUDF_DATALOC_INFO Dloc
Definition: udf_rel.h:437
Definition: typedefs.h:117
uint32 LinkRefCount
Definition: udf_rel.h:306
struct _UDF_DATALOC_INFO * PUDF_DATALOC_INFO
uint32 Offset
Definition: udf_rel.h:161
struct _UDFPartMap UDFPartMap
struct _UDF_FILE_INFO * PUDF_FILE_INFO
int64 LastWriteTime
Definition: udf_rel.h:210
PUDF_FILE_INFO DirInfo
Definition: udf_rel.h:441
uint32 hPosix
Definition: udf_rel.h:131
uint32 NWA
Definition: udf_rel.h:35
struct _EXTENT_INFO EXTENT_INFO
unsigned short uint16
Definition: types.h:30
struct _EXT_RELOCATION_ENTRY * PEXT_RELOCATION_ENTRY
uint32 UspaceBitmap
Definition: udf_rel.h:86
struct _UDF_FILE_INFO * FileInfo
Definition: udf_rel.h:204
uint32 AccessType
Definition: udf_rel.h:88
PEXT_RELOCATION_ENTRY PEXT_RELOC_MAP
Definition: udf_rel.h:451
PFILE_IDENT_DESC FileIdent
Definition: udf_rel.h:372
uint32 Length
Definition: udf_rel.h:168
uint32 TrackFPOffset
Definition: udf_rel.h:51
uint8 * StoredBitMap
Definition: udf_rel.h:546
uint32 PartitionRoot
Definition: udf_rel.h:89
uint32 SparingLocation
Definition: udf_rel.h:58
uint8 Flags
Definition: udf_rel.h:42
ULONG ERESOURCE
Definition: env_spec_w32.h:594
unsigned int ULONG
Definition: retypes.h:1
EXT_RELOCATION_ENTRY EXT_RELOC_MAP
Definition: udf_rel.h:450
uint_di LastUsed
Definition: udf_rel.h:136
struct _DIR_INDEX_HDR * PDIR_INDEX_HDR
uint32 lba_t
Definition: platform.h:20
uint32 hDos
Definition: udf_rel.h:129
PDIR_INDEX_ITEM DirNdx
Definition: udf_rel.h:443
struct _UDFFileControlBlock * Fcb
Definition: udf_rel.h:362
struct _DIR_INDEX_ITEM DIR_INDEX_ITEM
uint32 WaiterCount
Definition: udf_rel.h:551
uint32 hLfn
Definition: udf_rel.h:130
uint8 FI_Flags
Definition: udf_rel.h:199
struct _UDFTrackMap UDFTrackMap
PUDF_FILE_INFO FileInfo
Definition: udf_rel.h:415
struct _UDF_VDS_RECORD * PUDF_VDS_RECORD
struct _EXTENT_INFO * PEXTENT_INFO
uint32 SysAttr
Definition: udf_rel.h:208
struct _UDF_DATALOC_INDEX * PUDF_DATALOC_INDEX
uint32 FspaceBitmap
Definition: udf_rel.h:87
uint32 FileIdentLen
Definition: udf_rel.h:376
uint32 PacketSize
Definition: udf_rel.h:36
uint32 RefCount
Definition: udf_rel.h:399