1 ////////////////////////////////////////////////////////////////////
2 // Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine
4 // This file was released under the GPLv2 on June 2015.
5 ////////////////////////////////////////////////////////////////////
10 /* based on ECMA 167 structure definitions */
15 /* -------- Basic types and constants ----------- */
16 /* UDF character set (UDF 1.50 2.1.2) */
17 #define UDF_CHAR_SET_TYPE 0
18 #define UDF_CHAR_SET_INFO "OSTA Compressed Unicode"
20 #define UDF_ID_DEVELOPER ("*WINNT " VER_STR_PRODUCT_NAME " UDF")
22 #define UDF_ID_DEVELOPER_ADAPTEC "*Adaptec DirectCD"
24 /* UDF 1.02 2.2.6.4 */
25 struct LogicalVolIntegrityDescImpUse
31 uint16 minUDFWriteRev
;
32 uint16 maxUDFWriteRev
;
35 /* UDF 1.02 2.2.7.2 */
36 /* LVInformation may be present in ImpUseVolDesc.impUse */
37 struct ImpUseVolDescImpUse
40 dstring logicalVolIdent
[128];
48 struct UdfPartitionMap2
50 uint8 partitionMapType
;
51 uint8 partitionMapLength
;
60 struct VirtualPartitionMap
62 uint8 partitionMapType
; /* 2 */
63 uint8 partitionMapLength
; /* 64 */
64 uint8 reserved1
[2]; /* #00 */
68 uint8 reserved2
[24]; /* #00 */
71 #define UDF_VAT_FREE_ENTRY 0xffffffff
74 typedef struct _SPARABLE_PARTITION_MAP
76 uint8 partitionMapType
; /* 2 */
77 uint8 partitionMapLength
; /* 64 */
78 uint8 reserved1
[2]; /* #00 */
79 EntityID partIdent
; /* Flags = 0 */
80 /* Id = UDF_ID_SPARABLE */
84 uint16 packetLength
; /* 32 */
85 uint8 numSparingTables
;
86 uint8 reserved2
[1]; /* #00 */
87 uint32 sizeSparingTable
;
88 // uint32 locSparingTable[0];
90 } SPARABLE_PARTITION_MAP
, *PSPARABLE_PARTITION_MAP
;
92 #define UDF_TYPE1_MAP15 0x1511U
93 #define UDF_VIRTUAL_MAP15 0x1512U
94 #define UDF_VIRTUAL_MAP20 0x2012U
95 #define UDF_SPARABLE_MAP15 0x1522U
96 #define UDF_METADATA_MAP25 0x2522U
98 #ifndef PACKETSIZE_UDF
99 #define PACKETSIZE_UDF 32
100 #endif //PACKETSIZE_UDF
103 typedef struct _METADATA_PARTITION_MAP
105 uint8 partitionMapType
; /* 2 */
106 uint8 partitionMapLength
; /* 64 */
107 uint8 reserved1
[2]; /* #00 */
108 EntityID partIdent
; /* Flags = 0 */
109 /* Id = UDF_ID_METADATA */
110 /* IdSuf = 2.1.5.3 */
113 uint32 metadataFELocation
;
114 uint32 metadataMirrorFELocation
;
115 uint32 metadataBitmapFELocation
;
116 uint32 allocationUnit
; /* blocks */
117 uint16 alignmentUnit
; /* blocks */
120 } METADATA_PARTITION_MAP
, *PMETADATA_PARTITION_MAP
;
122 #define UDF_METADATA_DUPLICATED 0x01U
124 /* DVD Copyright Management Info, see UDF 1.02 3.3.4.5.1.2 */
125 /* when ImpUseExtendedAttr.impIdent= "*UDF DVD CGMS Info" */
126 struct DVDCopyrightImpUse
{
127 uint16 headerChecksum
;
130 uint8 protectionSystemInfo
[4];
133 /* the impUse of long_ad used in AllocDescs - UDF 1.02 2.3.10.1 */
140 /* the impUse of long_ad used in AllocDescs - UDF 1.02 2.3.10.1 */
147 /* UDF 1.02 2.3.10.1 */
148 #define UDF_EXTENT_LENGTH_MASK 0x3FFFFFFF
149 #define UDF_EXTENT_FLAG_MASK 0xc0000000
150 #define UDF_EXTENT_FLAG_ERASED 0x40000000
153 * Important! VirtualAllocationTables are
154 * very different between 1.5 and 2.0!
157 /* ----------- 1.5 ------------- */
159 #define UDF_FILE_TYPE_VAT15 0x0U
161 /* UDF 1.5 2.2.10 - VAT layout: */
162 struct VirtualAllocationTable15
{
163 /* uint32 VirtualSector[0];*/
165 uint32 previousVATICB
;
167 /* where number of VirtualSector's is (VATSize-36)/4 */
169 /* ----------- 2.0 ------------- */
171 #define UDF_FILE_TYPE_VAT20 0xf8U
173 /* UDF 2.0 2.2.10 (different from 1.5!) */
174 struct VirtualAllocationTable20
{
177 dstring logicalVolIdent
[128];
178 uint32 previousVatICBLoc
;
180 uint32 numFIDSDirectories
; /* non-parent */
181 uint16 minReadRevision
;
182 uint16 minWriteRevision
;
183 uint16 maxWriteRevision
;
185 /* uint8 impUse[0];*/
186 /* uint32 vatEntry[0];*/
189 /* Sparing maps, see UDF 1.5 2.2.11 */
190 typedef struct _SparingEntry
{
192 uint32 mappedLocation
;
195 #define SPARING_LOC_AVAILABLE 0xffffffff
196 #define SPARING_LOC_CORRUPTED 0xfffffff0
198 typedef SparingEntry SPARING_ENTRY
;
199 typedef SPARING_ENTRY
* PSPARING_ENTRY
;
201 typedef SPARING_ENTRY SPARING_MAP
;
202 typedef PSPARING_ENTRY PSPARING_MAP
;
204 /* sparing maps, see UDF 2.0 2.2.11 */
205 typedef struct _SPARING_TABLE
{
207 EntityID sparingIdent
; /* *UDF Sparing Table */
208 uint16 reallocationTableLen
;
209 uint16 reserved
; /* #00 */
211 // SparingEntry mapEntry[0];
212 } SPARING_TABLE
, *PSPARING_TABLE
;
214 /* Identifier Suffixes, see EntityID */
222 #define ENTITYID_FLAGS_HARD_RO 0x01U
223 #define ENTITYID_FLAGS_SOFT_RO 0x02U
238 /* Unique ID maps, see UDF 2.0 2.2.11 */
242 uint32 parentLogicalBlock
;
243 uint32 objectLogicalBlock
;
244 uint16 parentPartitionReferenceNum
;
245 uint16 objectPartitionReferenceNum
;
248 typedef UniqueIDEntry UID_MAPPING_ENTRY
;
249 typedef UID_MAPPING_ENTRY
* PUID_MAPPING_ENTRY
;
256 // UniqueIDEntry mapEntry[0];
257 } UniqueIDMappingData
;
259 typedef UniqueIDMappingData UID_MAPPING_TABLE
;
260 typedef UID_MAPPING_TABLE
* PUID_MAPPING_TABLE
;
262 /* Entity Identifiers (UDF 1.50 6.1) */
263 #define UDF_ID_COMPLIANT "*OSTA UDF Compliant"
264 #define UDF_ID_LV_INFO "*UDF LV Info"
265 #define UDF_ID_FREE_EA "*UDF FreeEASpace"
266 #define UDF_ID_FREE_APP_EA "*UDF FreeAppEASpace"
267 #define UDF_ID_DVD_CGMS "*UDF DVD CGMS Info"
268 #define UDF_ID_OS2_EA "*UDF OS/2 EA"
269 #define UDF_ID_OS2_EA_LENGTH "*UDF OS/2 EALength"
270 #define UDF_ID_OS400_DIRINFO "*UDF OS/400 DirInfo"
271 #define UDF_ID_MAC_VOLUME "*UDF Mac VolumeInfo"
272 #define UDF_ID_MAC_FINDER "*UDF Mac FinderInfo"
273 #define UDF_ID_MAC_UNIQUE "*UDF Mac UniqueIDTable"
274 #define UDF_ID_MAC_RESOURCE "*UDF Mac ResourceFork"
275 #define UDF_ID_VIRTUAL "*UDF Virtual Partition"
276 #define UDF_ID_SPARABLE "*UDF Sparable Partition"
277 #define UDF_ID_METADATA "*UDF Metadata Partition"
278 #define UDF_ID_ALLOC "*UDF Virtual Alloc Tbl"
279 #define UDF_ID_SPARING "*UDF Sparing Table"
281 /* Operating System Identifiers (UDF 1.50 6.3) */
282 #define UDF_OS_CLASS_UNDEF 0x00U
283 #define UDF_OS_CLASS_DOS 0x01U
284 #define UDF_OS_CLASS_OS2 0x02U
285 #define UDF_OS_CLASS_MAC 0x03U
286 #define UDF_OS_CLASS_UNIX 0x04U
287 #define UDF_OS_CLASS_WIN95 0x05U
288 #define UDF_OS_CLASS_WINNT 0x06U
289 #define UDF_OS_CLASS_OS400 0x07U
290 #define UDF_OS_CLASS_BEOS 0x08U
291 #define UDF_OS_CLASS_WINCE 0x09U
293 #define UDF_OS_ID_GENERIC 0x00U
294 #define UDF_OS_ID_UNDEF 0x00U
295 #define UDF_OS_ID_DOS 0x00U
296 #define UDF_OS_ID_OS2 0x00U
297 #define UDF_OS_ID_MAC 0x00U
298 #define UDF_OS_ID_UNIX 0x00U
299 #define UDF_OS_ID_WIN95 0x00U
300 #define UDF_OS_ID_WINNT 0x00U
301 #define UDF_OS_ID_OS400 0x00U
302 #define UDF_OS_ID_BEOS 0x00U
304 #define UDF_OS_ID_AIX 0x01U
305 #define UDF_OS_ID_SOLARIS 0x02U
306 #define UDF_OS_ID_HPUX 0x03U
307 #define UDF_OS_ID_IRIX 0x04U
308 #define UDF_OS_ID_LINUX 0x05U
309 #define UDF_OS_ID_MKLINUX 0x06U
310 #define UDF_OS_ID_FREEBSD 0x07U
311 #define UDF_OS_ID_NETBSD 0x08U
313 #define UDF_NAME_PAD 4
314 #define UDF_NAME_LEN 255
315 #define UDF_EXT_SIZE 5 // ???
316 #define UDF_PATH_LEN 1023
317 #define UDF_VOL_LABEL_LEN 32
319 /* Reserved file names */
321 #define UDF_FN_NON_ALLOCATABLE L"Non-Allocatable Space"
322 #define UDF_FN_NON_ALLOCATABLE_2 L"Non-Allocatable List"
324 #define UDF_FN_NON_ALLOCATABLE_USER "Non-Allocatable Space"
325 #define UDF_FN_NON_ALLOCATABLE_2_USER "Non-Allocatable List"
327 /* Reserved system stream names */
328 /* METADATA bit shall be set to 1 */
330 #define UDF_SN_UID_MAPPING L"*UDF Unique ID Mapping Data"
331 #define UDF_SN_NON_ALLOCATABLE L"*UDF Non-Allocatable Space"
332 #define UDF_SN_POWER_CAL_TABLE L"*UDF Power Cal Table"
333 #define UDF_SN_BACKUP L"*UDF Backup"
335 /* Reserved non-system stream names */
336 /* METADATA bit shall be set to 0 */
338 #define UDF_SN_MAC_RESOURCE_FORK L"*UDF Macintosh Resource Fork"
339 #define UDF_SN_OS2_EA L"*UDF OS/2 EA"
340 #define UDF_SN_NT_ACL L"*UDF NT ACL"
341 #define UDF_SN_UNIX_ACL L"*UDF UNIX ACL"
343 #define UDF_RESERVED_NAME_HDR L"*UDF "
345 /* ----------- 2.01 ------------ */
347 #define UDF_FILE_TYPE_REALTIME 0xf9U
349 #define TID_ADAPTEC_LOGICAL_VOL_DESC 0x9999U
353 #endif /* _OSTA_MISC_H */