VirtualBox

source: vbox/trunk/include/iprt/formats/udf.h@ 73886

Last change on this file since 73886 was 69059, checked in by vboxsync, 7 years ago

UDF: Some more structures.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 83.8 KB
Line 
1/* $Id: udf.h 69059 2017-10-12 12:31:42Z vboxsync $ */
2/** @file
3 * IPRT, Universal Disk Format (UDF).
4 */
5
6/*
7 * Copyright (C) 2017 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#ifndef ___iprt_formats_udf_h
28#define ___iprt_formats_udf_h
29
30#include <iprt/types.h>
31#include <iprt/assertcompile.h>
32#include <iprt/formats/iso9660.h>
33
34
35/** @defgroup grp_rt_formats_udf Universal Disk Format (UDF) structures and definitions
36 * @ingroup grp_rt_formats
37 *
38 * References:
39 * - https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-167.pdf
40 * - http://www.osta.org/specs/pdf/udf260.pdf
41 * - http://wiki.osdev.org/UDF
42 * - https://sites.google.com/site/udfintro/
43 *
44 * @{
45 */
46
47/**
48 * UDF d-character string (@ecma167{1,7.2.12,25}).
49 *
50 * This is mainly to mark what's d-strings and what's not.
51 */
52typedef char UDFDSTRING;
53/** Pointer to an UDF dstring. */
54typedef UDFDSTRING *PUDFDSTRING;
55/** Pointer to a const UDF dstring. */
56typedef UDFDSTRING const *PCUDFDSTRING;
57
58/**
59 * UDF extent allocation descriptor (AD) (@ecma167{3,7.1,42}).
60 */
61typedef struct UDFEXTENTAD
62{
63 /** Extent length in bytes. */
64 uint32_t cb;
65 /** Extent offset (logical sector number).
66 * If @a cb is zero, this is also zero. */
67 uint32_t off;
68} UDFEXTENTAD;
69AssertCompileSize(UDFEXTENTAD, 8);
70/** Pointer to an UDF extent descriptor. */
71typedef UDFEXTENTAD *PUDFEXTENTAD;
72/** Pointer to a const UDF extent descriptor. */
73typedef UDFEXTENTAD const *PCUDFEXTENTAD;
74
75
76/**
77 * UDF logical block address (@ecma167{4,7.1,73}).
78 */
79#pragma pack(2)
80typedef struct UDFLBADDR
81{
82 /** Logical block number, relative to the start of the given partition. */
83 uint32_t off;
84 /** Partition reference number. */
85 uint16_t uPartitionNo;
86} UDFLBADDR;
87#pragma pack()
88AssertCompileSize(UDFLBADDR, 6);
89/** Pointer to an UDF logical block address. */
90typedef UDFLBADDR *PUDFLBADDR;
91/** Pointer to a const UDF logical block address. */
92typedef UDFLBADDR const *PCUDFLBADDR;
93
94
95/** @name UDF_AD_TYPE_XXX - Allocation descriptor types.
96 *
97 * Used by UDFSHORTAD::uType, UDFLONGAD::uType and UDFEXTAD::uType.
98 *
99 * See @ecma167{4,14.14.1.1,116}.
100 *
101 * @{ */
102/** Recorded and allocated.
103 * Also used for zero length descriptors. */
104#define UDF_AD_TYPE_RECORDED_AND_ALLOCATED 0
105/** Allocated but not recorded. */
106#define UDF_AD_TYPE_ONLY_ALLOCATED 1
107/** Not recorded nor allocated. */
108#define UDF_AD_TYPE_FREE 2
109/** Go figure. */
110#define UDF_AD_TYPE_NEXT 3
111/** @} */
112
113/**
114 * UDF short allocation descriptor (@ecma167{4,14.14.1,116}).
115 */
116typedef struct UDFSHORTAD
117{
118#ifdef RT_BIG_ENDIAN
119 /** Extent type (UDF_AD_TYPE_XXX). */
120 uint32_t uType : 2;
121 /** Extent length in bytes, top 2 bits . */
122 uint32_t cb : 30;
123#else
124 /** Extent length in bytes. */
125 uint32_t cb : 30;
126 /** Extent type (UDF_AD_TYPE_XXX). */
127 uint32_t uType : 2;
128#endif
129 /** Extent offset (logical sector number). */
130 uint32_t off;
131} UDFSHORTAD;
132AssertCompileSize(UDFSHORTAD, 8);
133/** Pointer to an UDF short allocation descriptor. */
134typedef UDFSHORTAD *PUDFSHORTAD;
135/** Pointer to a const UDF short allocation descriptor. */
136typedef UDFSHORTAD const *PCUDFSHORTAD;
137
138/**
139 * UDF long allocation descriptor (@ecma167{4,14.14.2,116}).
140 */
141#pragma pack(2)
142typedef struct UDFLONGAD
143{
144#ifdef RT_BIG_ENDIAN
145 /** Extent type (UDF_AD_TYPE_XXX). */
146 uint32_t uType : 2;
147 /** Extent length in bytes, top 2 bits . */
148 uint32_t cb : 30;
149#else
150 /** Extent length in bytes. */
151 uint32_t cb : 30;
152 /** Extent type (UDF_AD_TYPE_XXX). */
153 uint32_t uType : 2;
154#endif
155 /** Extent location. */
156 UDFLBADDR Location;
157 /** Implementation use area. */
158 union
159 {
160 /** Generic view. */
161 uint8_t ab[6];
162 /** Used in FIDs.
163 * See @udf260{2.3.10.1,66}, @udf260{2.3.4.3,58}.
164 */
165 struct
166 {
167 /** Flags (UDF_AD_IMP_USE_FLAGS_XXX). */
168 uint16_t fFlags;
169 /** Unique ID. */
170 uint32_t idUnique;
171 } Fid;
172 } ImplementationUse;
173} UDFLONGAD;
174#pragma pack()
175AssertCompileSize(UDFLONGAD, 16);
176/** Pointer to an UDF long allocation descriptor. */
177typedef UDFLONGAD *PUDFLONGAD;
178/** Pointer to a const UDF long allocation descriptor. */
179typedef UDFLONGAD const *PCUDFLONGAD;
180
181/** @name UDF_AD_IMP_USE_FLAGS_XXX - UDFLONGAD::ImplementationUse::Fid::fFlags values
182 * See @udf260{2.3.10.1,66}.
183 * @{ */
184/** Set if erased and the extend is of the type UDF_AD_TYPE_ONLY_ALLOCATED. */
185#define UDF_AD_IMP_USE_FLAGS_ERASED UINT16_C(0x0001)
186/** Valid mask. */
187#define UDF_AD_IMP_USE_FLAGS_VALID_MASK UINT16_C(0x0001)
188/** @} */
189
190/**
191 * UDF extended allocation descriptor (@ecma167{4,14.14.3,117}).
192 */
193typedef struct UDFEXTAD
194{
195#ifdef RT_BIG_ENDIAN
196 /** 0x00: Extent type (UDF_AD_TYPE_XXX). */
197 uint32_t uType : 2;
198 /** 0x00: Extent length in bytes, top 2 bits . */
199 uint32_t cb : 30;
200 /** 0x04: Reserved, MBZ. */
201 uint32_t uReserved : 2;
202 /** 0x04: Number of bytes recorded. */
203 uint32_t cbRecorded : 30;
204#else
205 /** 0x00: Extent length in bytes. */
206 uint32_t cb : 30;
207 /** 0x00: Extent type (UDF_AD_TYPE_XXX). */
208 uint32_t uType : 2;
209 /** 0x04: Number of bytes recorded. */
210 uint32_t cbRecorded : 30;
211 /** 0x04: Reserved, MBZ. */
212 uint32_t uReserved : 2;
213#endif
214 /** 0x08: Number of bytes of information (from first byte). */
215 uint32_t cbInformation;
216 /** 0x0c: Extent location. */
217 UDFLBADDR Location;
218 /** 0x12: Implementation use area. */
219 uint8_t abImplementationUse[2];
220} UDFEXTAD;
221AssertCompileSize(UDFEXTAD, 20);
222/** Pointer to an UDF extended allocation descriptor. */
223typedef UDFEXTAD *PUDFEXTAD;
224/** Pointer to a const UDF extended allocation descriptor. */
225typedef UDFEXTAD const *PCUDFEXTAD;
226
227
228/**
229 * UDF timestamp (@ecma167{1,7.3,25}, @udf260{2.1.4,19}).
230 */
231typedef struct UDFTIMESTAMP
232{
233#ifdef RT_BIG_ENDIAN
234 /** 0x00: Type (UDFTIMESTAMP_T_XXX). */
235 uint16_t fType : 4;
236 /** 0x00: Time zone offset in minutes.
237 * For EST this will be -300, whereas for CET it will be 60. */
238 int16_t offUtcInMin : 12;
239#else
240 /** 0x00: Time zone offset in minutes.
241 * For EST this will be -300, whereas for CET it will be 60. */
242 int16_t offUtcInMin : 12;
243 /** 0x00: Type (UDFTIMESTAMP_T_XXX). */
244 uint16_t fType : 4;
245#endif
246 /** 0x02: The year. */
247 int16_t iYear;
248 /** 0x04: Month of year (1-12). */
249 uint8_t uMonth;
250 /** 0x05: Day of month (1-31). */
251 uint8_t uDay;
252 /** 0x06: Hour of day (0-23). */
253 uint8_t uHour;
254 /** 0x07: Minute of hour (0-59). */
255 uint8_t uMinute;
256 /** 0x08: Second of minute (0-60 if type 2, otherwise 0-59). */
257 uint8_t uSecond;
258 /** 0x09: Number of Centiseconds (0-99). */
259 uint8_t cCentiseconds;
260 /** 0x0a: Number of hundreds of microseconds (0-99). Unit is 100us. */
261 uint8_t cHundredsOfMicroseconds;
262 /** 0x0b: Number of microseconds (0-99). */
263 uint8_t cMicroseconds;
264} UDFTIMESTAMP;
265AssertCompileSize(UDFTIMESTAMP, 12);
266/** Pointer to an UDF timestamp. */
267typedef UDFTIMESTAMP *PUDFTIMESTAMP;
268/** Pointer to a const UDF timestamp. */
269typedef UDFTIMESTAMP const *PCUDFTIMESTAMP;
270
271/** @name UDFTIMESTAMP_T_XXX
272 * @{ */
273/** Local time. */
274#define UDFTIMESTAMP_T_LOCAL 1
275/** @} */
276
277/** No time zone specified. */
278#define UDFTIMESTAMP_NO_TIME_ZONE (-2047)
279
280
281/**
282 * UDF character set specficiation (@ecma167{1,7.2.1,21}, @udf260{2.1.2,18}).
283 */
284typedef struct UDFCHARSPEC
285{
286 /** The character set type (UDF_CHAR_SET_TYPE_XXX) */
287 uint8_t uType;
288 /** Character set information. */
289 uint8_t abInfo[63];
290} UDFCHARSPEC;
291AssertCompileSize(UDFCHARSPEC, 64);
292/** Pointer to UDF character set specification. */
293typedef UDFCHARSPEC *PUDFCHARSPEC;
294/** Pointer to const UDF character set specification. */
295typedef UDFCHARSPEC const *PCUDFCHARSPEC;
296
297/** @name UDF_CHAR_SET_TYPE_XXX - Character set types.
298 * @{ */
299/** CS0: By agreement between the medium producer and consumer.
300 * See UDF_CHAR_SET_OSTA_COMPRESSED_UNICODE. */
301#define UDF_CHAR_SET_TYPE_BY_AGREEMENT UINT8_C(0x00)
302/** CS1: ASCII (ECMA-6) with all or part of the specified graphic characters. */
303#define UDF_CHAR_SET_TYPE_ASCII UINT8_C(0x01)
304/** CS5: Latin-1 (ECMA-94) with all graphical characters. */
305#define UDF_CHAR_SET_TYPE_LATIN_1 UINT8_C(0x05)
306/* there are more defined here, but they are mostly useless, since UDF only uses CS0. */
307
308/** The CS0 definition used by the UDF specification. */
309#define UDF_CHAR_SET_OSTA_COMPRESSED_UNICODE UDF_CHAR_SET_TYPE_BY_AGREEMENT
310/** String to put in the UDFCHARSEPC::abInfo field for UDF CS0. */
311#define UDF_CHAR_SET_OSTA_COMPRESSED_UNICODE_INFO "OSTA Compressed Unicode"
312/** @} */
313
314
315/**
316 * UDF entity identifier (@ecma167{1,7.4,26}, @udf260{2.1.5,20}).
317 */
318typedef struct UDFENTITYID
319{
320 /** 0x00: Flags (UDFENTITYID_FLAGS_XXX). */
321 uint8_t fFlags;
322 /** 0x01: Identifier string (see UDF_ENTITY_ID_XXX). */
323 char achIdentifier[23];
324 /** 0x18: Identifier suffix. */
325 union
326 {
327 /** Domain ID suffix. */
328 struct
329 {
330 uint16_t uUdfRevision;
331 uint8_t fDomain;
332 uint8_t abReserved[5];
333 } Domain;
334
335 /** UDF ID suffix. */
336 struct
337 {
338 uint16_t uUdfRevision;
339 uint8_t bOsClass;
340 uint8_t idOS;
341 uint8_t abReserved[4];
342 } Udf;
343
344
345 /** Implementation ID suffix. */
346 struct
347 {
348 uint8_t bOsClass;
349 uint8_t idOS;
350 uint8_t achImplUse[6];
351 } Implementation;
352
353 /** Application ID suffix / generic. */
354 uint8_t abApplication[8];
355 } Suffix;
356} UDFENTITYID;
357AssertCompileSize(UDFENTITYID, 32);
358/** Pointer to UDF entity identifier. */
359typedef UDFENTITYID *PUDFENTITYID;
360/** Pointer to const UDF entity identifier. */
361typedef UDFENTITYID const *PCUDFENTITYID;
362
363/** @name UDF_ENTITY_ID_XXX - UDF identifier strings
364 *
365 * See @udf260{2.1.5.2,21}.
366 *
367 * @{ */
368/** Implementation use volume descriptor, implementation ID field.
369 * UDF ID suffix. */
370#define UDF_ENTITY_ID_IUVD_IMPLEMENTATION "*UDF LV Info"
371
372/** Partition descriptor, partition contents field, set to indicate UDF
373 * (ECMA-167 3rd edition). Application ID suffix. */
374#define UDF_ENTITY_ID_PD_PARTITION_CONTENTS_UDF "+NSR03"
375/** Partition descriptor, partition contents field, set to indicate ISO-9660
376 * (ECMA-119). Application ID suffix. */
377#define UDF_ENTITY_ID_PD_PARTITION_CONTENTS_ISO9660 "+CD001"
378/** Partition descriptor, partition contents field, set to indicate ECMA-168.
379 * Application ID suffix. */
380#define UDF_ENTITY_ID_PD_PARTITION_CONTENTS_CDW "+CDW02"
381/** Partition descriptor, partition contents field, set to indicate FAT
382 * (ECMA-107). Application ID suffix. */
383#define UDF_ENTITY_ID_PD_PARTITION_CONTENTS_FAT "+FDC01"
384
385/** Logical volume descriptor, domain ID field.
386 * Domain ID suffix. */
387#define UDF_ENTITY_ID_LVD_DOMAIN "*OSTA UDF Compliant"
388
389/** File set descriptor, domain ID field.
390 * Domain ID suffix. */
391#define UDF_ENTITY_FSD_LVD_DOMAIN "*OSTA UDF Compliant"
392
393/** UDF implementation use extended attribute, implementation ID field, set
394 * to free EA space. UDF ID suffix. */
395#define UDF_ENTITY_ID_IUEA_FREE_EA_SPACE "*UDF FreeEASpace"
396/** UDF implementation use extended attribute, implementation ID field, set
397 * to DVD copyright management information. UDF ID suffix. */
398#define UDF_ENTITY_ID_IUEA_DVD_CGMS_INFO "*UDF DVD CGMS Info"
399/** UDF implementation use extended attribute, implementation ID field, set
400 * to OS/2 extended attribute length. UDF ID suffix. */
401#define UDF_ENTITY_ID_IUEA_OS2_EA_LENGTH "*UDF OS/2 EALength"
402/** UDF implementation use extended attribute, implementation ID field, set
403 * to Machintosh OS volume information. UDF ID suffix. */
404#define UDF_ENTITY_ID_IUEA_MAC_VOLUME_INFO "*UDF Mac VolumeInfo"
405/** UDF implementation use extended attribute, implementation ID field, set
406 * to Machintosh Finder Info. UDF ID suffix. */
407#define UDF_ENTITY_ID_IUEA_MAC_FINDER_INFO "*UDF Mac FinderInfo"
408/** UDF implementation use extended attribute, implementation ID field, set
409 * to OS/400 extended directory information. UDF ID suffix. */
410#define UDF_ENTITY_ID_IUEA_OS400_DIR_INFO "*UDF OS/400 DirInfo"
411
412/** UDF application use extended attribute, application ID field, set
413 * to free application use EA space. UDF ID suffix. */
414#define UDF_ENTITY_ID_AUEA_FREE_EA_SPACE "*UDF FreeAppEASpace"
415
416/** Virtual partition map, partition type field.
417 * UDF ID suffix. */
418#define UDF_ENTITY_ID_VPM_PARTITION_TYPE "*UDF Virtual Partition"
419
420/** Sparable partition map, partition type field.
421 * UDF ID suffix. */
422#define UDF_ENTITY_ID_SPM_PARTITION_TYPE "*UDF Sparable Partition"
423
424/** Metadata partition map, partition type field.
425 * UDF ID suffix. */
426#define UDF_ENTITY_ID_MPM_PARTITION_TYPE "*UDF Metadata Partition"
427
428/** Sparing table, sparing identifier field.
429 * UDF ID suffix. */
430#define UDF_ENTITY_ID_ST_SPARING "*UDF Sparting Table"
431
432/** @} */
433
434
435/**
436 * UDF descriptor tag (@ecma167{3,7.2,42}, @udf260{2.2.1,26}).
437 */
438typedef struct UDFTAG
439{
440 /** Tag identifier (UDF_TAG_ID_XXX). */
441 uint16_t idTag;
442 /** Descriptor version. */
443 uint16_t uVersion;
444 /** Tag checksum.
445 * Sum of each byte in the structure with this field as zero. */
446 uint8_t uChecksum;
447 /** Reserved, MBZ. */
448 uint8_t bReserved;
449 /** Tag serial number. */
450 uint16_t uTagSerialNo;
451 /** Descriptor CRC. */
452 uint16_t uDescriptorCrc;
453 /** Descriptor CRC length. */
454 uint16_t cbDescriptorCrc;
455 /** The tag location (logical sector number). */
456 uint32_t offTag;
457} UDFTAG;
458AssertCompileSize(UDFTAG, 16);
459/** Pointer to an UDF descriptor tag. */
460typedef UDFTAG *PUDFTAG;
461/** Pointer to a const UDF descriptor tag. */
462typedef UDFTAG const *PCUDFTAG;
463
464/** @name UDF_TAG_ID_XXX - UDF descriptor tag IDs.
465 * @{ */
466#define UDF_TAG_ID_PRIMARY_VOL_DESC UINT16_C(0x0001) /**< See UDFPRIMARYVOLUMEDESC */
467#define UDF_TAG_ID_ANCHOR_VOLUME_DESC_PTR UINT16_C(0x0002) /**< See UDFANCHORVOLUMEDESCPTR */
468#define UDF_TAG_ID_VOLUME_DESC_PTR UINT16_C(0x0003) /**< See UDFVOLUMEDESCPTR */
469#define UDF_TAG_ID_IMPLEMENTATION_USE_VOLUME_DESC UINT16_C(0x0004) /**< See UDFIMPLEMENTATIONUSEVOLUMEDESC */
470#define UDF_TAG_ID_PARTITION_DESC UINT16_C(0x0005) /**< See UDFPARTITIONDESC */
471#define UDF_TAG_ID_LOGICAL_VOLUME_DESC UINT16_C(0x0006) /**< See UDFLOGICALVOLUMEDESC */
472#define UDF_TAG_ID_UNALLOCATED_SPACE_DESC UINT16_C(0x0007) /**< See UDFUNALLOCATEDSPACEDESC */
473#define UDF_TAG_ID_TERMINATING_DESC UINT16_C(0x0008) /**< See UDFTERMINATINGDESC */
474#define UDF_TAG_ID_LOGICAL_VOLUME_INTEGRITY_DESC UINT16_C(0x0009) /**< See UDFLOGICALVOLINTEGRITYDESC */
475#define UDF_TAG_ID_FILE_SET_DESC UINT16_C(0x0100) /**< See UDFFILESETDESC */
476#define UDF_TAG_ID_FILE_ID_DESC UINT16_C(0x0101) /**< See UDFFILEIDDESC */
477#define UDF_TAG_ID_ALLOCATION_EXTENT_DESC UINT16_C(0x0102) /**< See UDFALLOCATIONEXTENTDESC */
478#define UDF_TAG_ID_INDIRECT_ENTRY UINT16_C(0x0103) /**< See UDFINDIRECTENTRY */
479#define UDF_TAG_ID_TERMINAL_ENTRY UINT16_C(0x0104) /**< See UDFTERMINALENTRY */
480#define UDF_TAG_ID_FILE_ENTRY UINT16_C(0x0105) /**< See UDFFILEENTRY */
481#define UDF_TAG_ID_EXTENDED_ATTRIB_HDR_DESC UINT16_C(0x0106) /**< See UDFEXTATTRIBHDRDESC */
482#define UDF_TAG_ID_UNALLOCATED_SPACE_ENTRY UINT16_C(0x0107) /**< See UDFUNALLOCATEDSPACEENTRY */
483#define UDF_TAG_ID_SPACE_BITMAP_DESC UINT16_C(0x0108) /**< See UDFSPACEBITMAPDESC */
484#define UDF_TAG_ID_PARTITION_INTEGERITY_DESC UINT16_C(0x0109) /**< See UDFPARTITIONINTEGRITYDESC */
485#define UDF_TAG_ID_EXTENDED_FILE_ENTRY UINT16_C(0x010a) /**< See UDFEXFILEENTRY */
486/** @} */
487
488
489/**
490 * UDF primary volume descriptor (PVD) (@ecma167{3,10.1,50},
491 * @udf260{2.2.2,27}).
492 */
493typedef struct UDFPRIMARYVOLUMEDESC
494{
495 /** 0x000: The descriptor tag (UDF_TAG_ID_PRIMARY_VOL_DESC). */
496 UDFTAG Tag;
497 /** 0x010: Volume descriptor sequence number. */
498 uint32_t uVolumeDescSeqNo;
499 /** 0x014: Primary volume descriptor number. */
500 uint32_t uPrimaryVolumeDescNo;
501 /** 0x018: Volume identifier (dstring). */
502 UDFDSTRING achVolumeID[32];
503 /** 0x038: Volume sequence number. */
504 uint16_t uVolumeSeqNo;
505 /** 0x03a: Maximum volume sequence number. */
506 uint16_t uMaxVolumeSeqNo;
507 /** 0x03c: Interchange level. */
508 uint16_t uInterchangeLevel;
509 /** 0x03e: Maximum interchange level. */
510 uint16_t uMaxInterchangeLevel;
511 /** 0x040: Character set bitmask (aka list). Each bit correspond to a
512 * character set number. */
513 uint32_t fCharacterSets;
514 /** 0x044: Maximum character set bitmask (aka list). */
515 uint32_t fMaxCharacterSets;
516 /** 0x048: Volume set identifier (dstring). This starts with 16 unique
517 * characters, the first 8 being the hex representation of a time value. */
518 UDFDSTRING achVolumeSetID[128];
519 /** 0x0c8: Descriptor character set.
520 * For achVolumeSetID and achVolumeID. */
521 UDFCHARSPEC DescCharSet;
522 /** 0x108: Explanatory character set.
523 * For VolumeAbstract and VolumeCopyrightNotice data. */
524 UDFCHARSPEC ExplanatoryCharSet;
525 /** 0x148: Volume abstract. */
526 UDFEXTENTAD VolumeAbstract;
527 /** 0x150: Volume copyright notice. */
528 UDFEXTENTAD VolumeCopyrightNotice;
529 /** 0x158: Application identifier ("*Application ID"). */
530 UDFENTITYID idApplication;
531 /** 0x178: Recording date and time. */
532 UDFTIMESTAMP RecordingTimestamp;
533 /** 0x184: Implementation identifier ("*Developer ID"). */
534 UDFENTITYID idImplementation;
535 /** 0x1a4: Implementation use. */
536 uint8_t abImplementationUse[64];
537 /** 0x1e4: Predecessor volume descriptor sequence location. */
538 uint32_t offPredecessorVolDescSeq;
539 /** 0x1e8: Flags (UDF_PVD_FLAGS_XXX). */
540 uint16_t fFlags;
541 /** 0x1ea: Reserved. */
542 uint8_t abReserved[22];
543} UDFPRIMARYVOLUMEDESC;
544AssertCompileSize(UDFPRIMARYVOLUMEDESC, 512);
545/** Pointer to a UDF primary volume descriptor. */
546typedef UDFPRIMARYVOLUMEDESC *PUDFPRIMARYVOLUMEDESC;
547/** Pointer to a const UDF primary volume descriptor. */
548typedef UDFPRIMARYVOLUMEDESC const *PCUDFPRIMARYVOLUMEDESC;
549
550/** @name UDF_PVD_FLAGS_XXX - Flags for UDFPRIMARYVOLUMEDESC::fFlags.
551 * @{ */
552/** Indicates that the volume set ID is common to all members of the set. */
553#define UDF_PVD_FLAGS_COMMON_VOLUME_SET_ID UINT16_C(0x0001)
554/** @} */
555
556
557/**
558 * UDF anchor volume descriptor pointer (AVDP) (@ecma167{3,10.2,53},
559 * @udf260{2.2.3,29}).
560 *
561 * This is stored at least two of these locations:
562 * - logical sector 256
563 * - logical sector N - 256.
564 * - logical sector N.
565 */
566typedef struct UDFANCHORVOLUMEDESCPTR
567{
568 /** 0x00: The descriptor tag (UDF_TAG_ID_ANCHOR_VOLUME_DESC_PTR). */
569 UDFTAG Tag;
570 /** 0x10: The extent descripting the main volume descriptor sequence. */
571 UDFEXTENTAD MainVolumeDescSeq;
572 /** 0x18: Location of the backup descriptor sequence. */
573 UDFEXTENTAD ReserveVolumeDescSeq;
574 /** 0x20: Reserved, probably must be zeros. */
575 uint8_t abReserved[0x1e0];
576} UDFANCHORVOLUMEDESCPTR;
577AssertCompileSize(UDFANCHORVOLUMEDESCPTR, 512);
578/** Pointer to UDF anchor volume descriptor pointer. */
579typedef UDFANCHORVOLUMEDESCPTR *PUDFANCHORVOLUMEDESCPTR;
580/** Pointer to const UDF anchor volume descriptor pointer. */
581typedef UDFANCHORVOLUMEDESCPTR const *PCUDFANCHORVOLUMEDESCPTR;
582
583
584/**
585 * UDF volume descriptor pointer (VDP) (@ecma167{3,10.3,53}).
586 */
587typedef struct UDFVOLUMEDESCPTR
588{
589 /** 0x00: The descriptor tag (UDF_TAG_ID_VOLUME_DESC_PTR). */
590 UDFTAG Tag;
591 /** 0x10: Volume descriptor sequence number. */
592 uint32_t uVolumeDescSeqNo;
593 /** 0x14: Location of the next volume descriptor sequence. */
594 UDFEXTENTAD NextVolumeDescSeq;
595 /** 0x1c: Reserved, probably must be zeros. */
596 uint8_t abReserved[484];
597} UDFVOLUMEDESCPTR;
598AssertCompileSize(UDFVOLUMEDESCPTR, 512);
599/** Pointer to UDF volume descriptor pointer. */
600typedef UDFVOLUMEDESCPTR *PUDFVOLUMEDESCPTR;
601/** Pointer to const UDF volume descriptor pointer. */
602typedef UDFVOLUMEDESCPTR const *PCUDFVOLUMEDESCPTR;
603
604
605/**
606 * UDF implementation use volume descriptor (IUVD) (@ecma167{3,10.4,55},
607 * @udf260{2.2.7,35}).
608 */
609typedef struct UDFIMPLEMENTATIONUSEVOLUMEDESC
610{
611 /** 0x00: The descriptor tag (UDF_TAG_ID_IMPLEMENTATION_USE_VOLUME_DESC). */
612 UDFTAG Tag;
613 /** 0x10: Volume descriptor sequence number. */
614 uint32_t uVolumeDescSeqNo;
615 /** 0x14: The implementation identifier (UDF_ENTITY_ID_IUVD_IMPLEMENTATION). */
616 UDFENTITYID idImplementation;
617 /** 0x34: The implementation use area. */
618 union
619 {
620 /** Generic view. */
621 uint8_t ab[460];
622 /** Logical volume information (@udf260{2.2.7.2,35}). */
623 struct
624 {
625 /** 0x034: The character set used in this sub-structure. */
626 UDFCHARSPEC Charset;
627 /** 0x074: Logical volume identifier. */
628 UDFDSTRING achVolumeID[128];
629 /** 0x0f4: Info string \#1. */
630 UDFDSTRING achInfo1[36];
631 /** 0x118: Info string \#2. */
632 UDFDSTRING achInfo2[36];
633 /** 0x13c: Info string \#3. */
634 UDFDSTRING achInfo3[36];
635 /** 0x160: The implementation identifier ("*Developer ID"). */
636 UDFENTITYID idImplementation;
637 /** 0x180: Additional use bytes. */
638 uint8_t abUse[128];
639 } Lvi;
640 } ImplementationUse;
641} UDFIMPLEMENTATIONUSEVOLUMEDESC;
642AssertCompileSize(UDFIMPLEMENTATIONUSEVOLUMEDESC, 512);
643AssertCompileMemberOffset(UDFIMPLEMENTATIONUSEVOLUMEDESC, ImplementationUse.Lvi.Charset, 0x034);
644AssertCompileMemberOffset(UDFIMPLEMENTATIONUSEVOLUMEDESC, ImplementationUse.Lvi.achVolumeID, 0x074);
645AssertCompileMemberOffset(UDFIMPLEMENTATIONUSEVOLUMEDESC, ImplementationUse.Lvi.achInfo1, 0x0f4);
646AssertCompileMemberOffset(UDFIMPLEMENTATIONUSEVOLUMEDESC, ImplementationUse.Lvi.achInfo2, 0x118);
647AssertCompileMemberOffset(UDFIMPLEMENTATIONUSEVOLUMEDESC, ImplementationUse.Lvi.achInfo3, 0x13c);
648AssertCompileMemberOffset(UDFIMPLEMENTATIONUSEVOLUMEDESC, ImplementationUse.Lvi.idImplementation, 0x160);
649/** Pointer to an UDF implementation use volume descriptor. */
650typedef UDFIMPLEMENTATIONUSEVOLUMEDESC *PUDFIMPLEMENTATIONUSEVOLUMEDESC;
651/** Pointer to a const UDF implementation use volume descriptor. */
652typedef UDFIMPLEMENTATIONUSEVOLUMEDESC const *PCUDFIMPLEMENTATIONUSEVOLUMEDESC;
653
654
655/**
656 * UDF partition header descriptor (@ecma167{4,14.3,90}, @udf260{2.3.3,56}).
657 *
658 * This is found in UDFPARTITIONDESC::ContentsUse.
659 */
660typedef struct UDFPARTITIONHDRDESC
661{
662 /** 0x00: Unallocated space table location. Zero length means no table. */
663 UDFSHORTAD UnallocatedSpaceTable;
664 /** 0x08: Unallocated space bitmap location. Zero length means no bitmap. */
665 UDFSHORTAD UnallocatedSpaceBitmap;
666 /** 0x10: Partition integrity table location. Zero length means no table. */
667 UDFSHORTAD PartitionIntegrityTable;
668 /** 0x18: Freed space table location. Zero length means no table. */
669 UDFSHORTAD FreedSpaceTable;
670 /** 0x20: Freed space bitmap location. Zero length means no bitmap. */
671 UDFSHORTAD FreedSpaceBitmap;
672 /** 0x28: Reserved, MBZ. */
673 uint8_t abReserved[88];
674} UDFPARTITIONHDRDESC;
675AssertCompileSize(UDFPARTITIONHDRDESC, 128);
676AssertCompileMemberOffset(UDFPARTITIONHDRDESC, PartitionIntegrityTable, 0x10);
677AssertCompileMemberOffset(UDFPARTITIONHDRDESC, abReserved, 0x28);
678/** Pointer to an UDF partition header descriptor. */
679typedef UDFPARTITIONHDRDESC *PUDFPARTITIONHDRDESC;
680/** Pointer to a const UDF partition header descriptor. */
681typedef UDFPARTITIONHDRDESC const *PCUDFPARTITIONHDRDESC;
682
683
684/**
685 * UDF partition descriptor (PD) (@ecma167{3,10.5,55}, @udf260{2.2.14,51}).
686 */
687typedef struct UDFPARTITIONDESC
688{
689 /** 0x000: The descriptor tag (UDF_TAG_ID_PARTITION_DESC). */
690 UDFTAG Tag;
691 /** 0x010: Volume descriptor sequence number. */
692 uint32_t uVolumeDescSeqNo;
693 /** 0x014: The partition flags (UDF_PARTITION_FLAGS_XXX). */
694 uint16_t fFlags;
695 /** 0x016: The partition number. */
696 uint16_t uPartitionNo;
697 /** 0x018: Partition contents (UDF_ENTITY_ID_PD_PARTITION_CONTENTS_XXX). */
698 UDFENTITYID PartitionContents;
699 /** 0x038: partition contents use (depends on the PartitionContents field). */
700 union
701 {
702 /** Generic view. */
703 uint8_t ab[128];
704 /** UDF partition header descriptor (UDF_ENTITY_ID_PD_PARTITION_CONTENTS_UDF). */
705 UDFPARTITIONHDRDESC Hdr;
706 } ContentsUse;
707 /** 0x0b8: Access type (UDF_PART_ACCESS_TYPE_XXX). */
708 uint32_t uAccessType;
709 /** 0x0bc: Partition starting location (logical sector number). */
710 uint32_t offLocation;
711 /** 0x0c0: Partition length in sectors. */
712 uint32_t cSectors;
713 /** 0x0c4: Implementation identifier ("*Developer ID"). */
714 UDFENTITYID idImplementation;
715 /** 0x0e4: Implementation use bytes. */
716 union
717 {
718 /** Generic view. */
719 uint8_t ab[128];
720 } ImplementationUse;
721 /** 0x164: Reserved. */
722 uint8_t abReserved[156];
723} UDFPARTITIONDESC;
724AssertCompileSize(UDFPARTITIONDESC, 512);
725/** Pointer to an UDF partitions descriptor. */
726typedef UDFPARTITIONDESC *PUDFPARTITIONDESC;
727/** Pointer to a const UDF partitions descriptor. */
728typedef const UDFPARTITIONDESC *PCUDFPARTITIONDESC;
729
730/** @name UDF_PART_ACCESS_TYPE_XXX - UDF partition access types
731 *
732 * See @ecma167{3,10.5.7,57}, @udf260{2.2.14.2,51}.
733 *
734 * @{ */
735/** Access not specified by this field. */
736#define UDF_PART_ACCESS_TYPE_NOT_SPECIFIED UINT32_C(0x00000000)
737/** Read only: No writes. */
738#define UDF_PART_ACCESS_TYPE_READ_ONLY UINT32_C(0x00000001)
739/** Write once: Sectors can only be written once. */
740#define UDF_PART_ACCESS_TYPE_WRITE_ONCE UINT32_C(0x00000002)
741/** Rewritable: Logical sectors may require preprocessing before writing. */
742#define UDF_PART_ACCESS_TYPE_REWRITABLE UINT32_C(0x00000003)
743/** Overwritable: No restrictions on writing. */
744#define UDF_PART_ACCESS_TYPE_OVERWRITABLE UINT32_C(0x00000004)
745/** @} */
746
747
748/**
749 * Logical volume descriptor (LVD) (@ecma167{3,10.6,58}, @udf260{2.2.4,30}).
750 *
751 * @note Variable length.
752 */
753typedef struct UDFLOGICALVOLUMEDESC
754{
755 /** 0x000: The descriptor tag (UDF_TAG_ID_LOGICAL_VOLUME_DESC). */
756 UDFTAG Tag;
757 /** 0x010: Volume descriptor sequence number. */
758 uint32_t uVolumeDescSeqNo;
759 /** 0x014: Character set used in the achLogicalVolumeID field. */
760 UDFCHARSPEC DescCharSet;
761 /** 0x054: The logical volume ID (label). */
762 UDFDSTRING achLogicalVolumeID[128];
763 /** 0x0d4: Logical block size (in bytes). */
764 uint32_t cbLogicalBlock;
765 /** 0x0d8: Domain identifier (UDF_ENTITY_ID_LVD_DOMAIN). */
766 UDFENTITYID idDomain;
767 /** 0x0f8: Logical volume contents use. */
768 union
769 {
770 /** Byte view. */
771 uint8_t ab[16];
772 /** The extent containing the file set descriptor. */
773 UDFLONGAD FileSetDescriptor;
774 } ContentsUse;
775 /** 0x108: Map table length (in bytes). */
776 uint32_t cbMapTable;
777 /** 0x10c: Number of partition maps. */
778 uint32_t cPartitionMaps;
779 /** 0x110: Implementation identifier ("*Developer ID"). */
780 UDFENTITYID idImplementation;
781 /** 0x130: Implementation use. */
782 union
783 {
784 /** Byte view. */
785 uint8_t ab[128];
786 } ImplementationUse;
787 /** 0x1b0: Integrity sequence extent. Can be zero if cPartitionMaps is zero. */
788 UDFEXTENTAD IntegritySeqExtent;
789 /** 0x1b8: Partition maps (length given by @a cbMapTable), data format is
790 * defined by UDFPARTMAPHDR, UDFPARTMAPTYPE1 and UDFPARTMAPTYPE2. */
791 uint8_t abPartitionMaps[RT_FLEXIBLE_ARRAY];
792} UDFLOGICALVOLUMEDESC;
793AssertCompileMemberOffset(UDFLOGICALVOLUMEDESC, abPartitionMaps, 0x1b8);
794/** Pointer to an UDF logical volume descriptor. */
795typedef UDFLOGICALVOLUMEDESC *PUDFLOGICALVOLUMEDESC;
796/** Pointer to a const UDF logical volume descriptor. */
797typedef UDFLOGICALVOLUMEDESC const *PCUDFLOGICALVOLUMEDESC;
798
799/**
800 * Partition map header (UDFLOGICALVOLUMEDESC::abPartitionMaps).
801 */
802typedef struct UDFPARTMAPHDR
803{
804 /** 0x00: The partition map type. */
805 uint8_t bType;
806 /** 0x01: The partition map length (header included). */
807 uint8_t cb;
808} UDFPARTMAPHDR;
809AssertCompileSize(UDFPARTMAPHDR, 2);
810/** Pointer to a partition map header. */
811typedef UDFPARTMAPHDR *PUDFPARTMAPHDR;
812/** Pointer to a const partition map header. */
813typedef UDFPARTMAPHDR const *PCUDFPARTMAPHDR;
814
815/**
816 * Partition map type 1 (UDFLOGICALVOLUMEDESC::abPartitionMaps).
817 */
818typedef struct UDFPARTMAPTYPE1
819{
820 /** 0x00: Header (uType=1, cb=6). */
821 UDFPARTMAPHDR Hdr;
822 /** 0x02: Volume sequence number. */
823 uint16_t uVolumeSeqNo;
824 /** 0x04: Partition number. */
825 uint16_t uPartitionNo;
826} UDFPARTMAPTYPE1;
827AssertCompileSize(UDFPARTMAPTYPE1, 6);
828/** Pointer to a type 1 partition map. */
829typedef UDFPARTMAPTYPE1 *PUDFPARTMAPTYPE1;
830/** Pointer to a const type 1 partition map. */
831typedef UDFPARTMAPTYPE1 const *PCUDFPARTMAPTYPE1;
832
833/**
834 * Partition map type 2 (UDFLOGICALVOLUMEDESC::abPartitionMaps).
835 */
836typedef struct UDFPARTMAPTYPE2
837{
838 /** 0x00: Header (uType=2, cb=64). */
839 UDFPARTMAPHDR Hdr;
840 /** 0x02: Reserved \#1. */
841 uint16_t uReserved1;
842 /** 0x04: Partition ID type (UDF_ENTITY_ID_VPM_PARTITION_TYPE,
843 * UDF_ENTITY_ID_SPM_PARTITION_TYPE, or UDF_ENTITY_ID_MPM_PARTITION_TYPE). */
844 UDFENTITYID idPartitionType;
845 /** 0x24: Volume sequence number. */
846 uint16_t uVolumeSeqNo;
847 /** 0x26: Partition number. */
848 uint16_t uPartitionNo;
849 /** 0x28: Data specific to the partition ID type. */
850 union
851 {
852 /** 0x28: Generic view. */
853 uint8_t ab[24];
854
855 /** UDF_ENTITY_ID_VPM_PARTITION_TYPE. */
856 struct
857 {
858 /** 0x28: Reserved. */
859 uint8_t abReserved2[24];
860 } Vpm;
861
862 /** UDF_ENTITY_ID_SPM_PARTITION_TYPE. */
863 struct
864 {
865 /** 0x28: Packet length in blocks. */
866 uint16_t cBlocksPerPacket;
867 /** 0x2a: Number of sparing tables. */
868 uint8_t cSparingTables;
869 /** 0x2b: Reserved padding byte. */
870 uint8_t bReserved2;
871 /** 0x2c: The size of each sparing table. */
872 uint32_t cbSparingTable;
873 /** 0x30: The sparing table locations (logical block). */
874 uint32_t aoffSparingTables[4];
875 } Spm;
876
877 /** UDF_ENTITY_ID_MPM_PARTITION_TYPE. */
878 struct
879 {
880 /** 0x28: Metadata file entry location (logical block). */
881 uint32_t offMetadataFile;
882 /** 0x2c: Metadata mirror file entry location (logical block). */
883 uint32_t offMetadataMirrorFile;
884 /** 0x30: Metadata bitmap file entry location (logical block). */
885 uint32_t offMetadataBitmapFile;
886 /** 0x34: The metadata allocation unit (logical blocks) */
887 uint32_t cBlocksAllocationUnit;
888 /** 0x38: The metadata allocation unit alignment (logical blocks). */
889 uint16_t cBlocksAlignmentUnit;
890 /** 0x3a: Flags, UDFPARTMAPMETADATA_F_XXX. */
891 uint8_t fFlags;
892 /** 0x3b: Reserved. */
893 uint8_t abReserved2[5];
894 } Mpm;
895 } u;
896} UDFPARTMAPTYPE2;
897AssertCompileSize(UDFPARTMAPTYPE2, 64);
898/** Pointer to a type 2 partition map. */
899typedef UDFPARTMAPTYPE2 *PUDFPARTMAPTYPE2;
900/** Pointer to a const type 2 partition map. */
901typedef UDFPARTMAPTYPE2 const *PCUDFPARTMAPTYPE2;
902
903/** @name UDFPARTMAPMETADATA_F_XXX
904 * @{ */
905/** Indicates that the metadata is mirrored too, not just the file entry. */
906#define UDFPARTMAPMETADATA_F_DATA_MIRRORED UINT8_C(1)
907/** @} */
908
909
910/**
911 * UDF unallocated space descriptor (USD) (@ecma167{3,10.8,61}, @udf260{2.2.5,32}).
912 *
913 * @note Variable length.
914 */
915typedef struct UDFUNALLOCATEDSPACEDESC
916{
917 /** 0x00: The descriptor tag (UDF_TAG_ID_UNALLOCATED_SPACE_DESC). */
918 UDFTAG Tag;
919 /** 0x10: Volume descriptor sequence number. */
920 uint32_t uVolumeDescSeqNo;
921 /** 0x14: Number of allocation descriptors in the array below. */
922 uint32_t cAllocationDescriptors;
923 /** 0x18: Allocation descriptors (variable length). */
924 UDFEXTENTAD aAllocationDescriptors[RT_FLEXIBLE_ARRAY];
925} UDFUNALLOCATEDSPACEDESC;
926AssertCompileMemberOffset(UDFUNALLOCATEDSPACEDESC, aAllocationDescriptors, 0x18);
927/** Pointer to an UDF unallocated space descriptor. */
928typedef UDFUNALLOCATEDSPACEDESC *PUDFUNALLOCATEDSPACEDESC;
929/** Pointer to a const UDF unallocated space descriptor. */
930typedef UDFUNALLOCATEDSPACEDESC const *PCUDFUNALLOCATEDSPACEDESC;
931
932
933/**
934 * UDF terminating descriptor (@ecma167{3,10.9,62}, @ecma167{4,14.2,62}).
935 */
936typedef struct UDFTERMINATINGDESC
937{
938 /** 0x00: The descriptor tag (UDF_TAG_ID_TERMINATING_DESC). */
939 UDFTAG Tag;
940 /** 0x10: Reserved, MBZ. */
941 uint8_t abReserved[496];
942} UDFTERMINATINGDESC;
943/** Pointer to an UDF terminating descriptor. */
944typedef UDFTERMINATINGDESC *PUDFTERMINATINGDESC;
945/** Pointer to a const UDF terminating descriptor. */
946typedef UDFTERMINATINGDESC const *PCUDFTERMINATINGDESC;
947
948
949/**
950 * UDF logical volume integrity descriptor (LVID) (@ecma167{3,10.10,62},
951 * @udf260{2.2.6,32}).
952 */
953typedef struct UDFLOGICALVOLINTEGRITYDESC
954{
955 /** 0x00: The descriptor tag (UDF_TAG_ID_TERMINATING_DESC). */
956 UDFTAG Tag;
957 /** 0x10: Recording timestamp. */
958 UDFTIMESTAMP RecordingTimestamp;
959 /** 0x1c: Integrity type (UDF_LVID_TYPE_XXX). */
960 uint32_t uIntegrityType;
961 /** 0x20: The next integrity extent. */
962 UDFEXTENTAD NextIntegrityExtent;
963 /** 0x28: Number of partitions. */
964 uint32_t cPartitions;
965 /** 0x2c: Length of implementation use. */
966 uint32_t cbImplementationUse;
967 /**
968 * There are two tables each @a cPartitions in size. The first is the free
969 * space table. The second the size table.
970 *
971 * Following these tables there are @a cbImplementationUse bytes of space for
972 * the implementation to use.
973 */
974 uint32_t aTables[RT_FLEXIBLE_ARRAY];
975} UDFLOGICALVOLINTEGRITYDESC;
976AssertCompileMemberOffset(UDFLOGICALVOLINTEGRITYDESC, cbImplementationUse, 0x2c);
977AssertCompileMemberOffset(UDFLOGICALVOLINTEGRITYDESC, aTables, 0x30);
978/** Pointer to an UDF logical volume integrity descriptor. */
979typedef UDFLOGICALVOLINTEGRITYDESC *PUDFLOGICALVOLINTEGRITYDESC;
980/** Pointer to a const UDF logical volume integrity descriptor. */
981typedef UDFLOGICALVOLINTEGRITYDESC const *PCUDFLOGICALVOLINTEGRITYDESC;
982
983/** @name UDF_LVID_TYPE_XXX - Integirty types.
984 * @{ */
985#define UDF_LVID_TYPE_OPEN UINT32_C(0x00000000)
986#define UDF_LVID_TYPE_CLOSE UINT32_C(0x00000001)
987/** @} */
988
989/**
990 * UDF file set descriptor (FSD) (@ecma167{4,14.1,86}, @udf260{2.3.2,54}).
991 */
992typedef struct UDFFILESETDESC
993{
994 /** 0x000: The descriptor tag (UDF_TAG_ID_FILE_SET_DESC). */
995 UDFTAG Tag;
996 /** 0x010: Recording timestamp. */
997 UDFTIMESTAMP RecordingTimestamp;
998 /** 0x01c: Interchange level. */
999 uint16_t uInterchangeLevel;
1000 /** 0x01e: Maximum interchange level. */
1001 uint16_t uMaxInterchangeLevel;
1002 /** 0x020: Character set bitmask (aka list). Each bit correspond to a
1003 * character set number. */
1004 uint32_t fCharacterSets;
1005 /** 0x024: Maximum character set bitmask (aka list). */
1006 uint32_t fMaxCharacterSets;
1007 /** 0x028: File set number. */
1008 uint32_t uFileSetNo;
1009 /** 0x02c: File set descriptor number. */
1010 uint32_t uFileSetDescNo;
1011 /** 0x030: Logical volume identifier character set. */
1012 UDFCHARSPEC LogicalVolumeIDCharSet;
1013 /** 0x070: Logical volume identifier string. */
1014 UDFDSTRING achLogicalVolumeID[128];
1015 /** 0x0e0: File set character set. */
1016 UDFCHARSPEC FileSetCharSet;
1017 /** 0x130: Identifier string for this file set. */
1018 UDFDSTRING achFileSetID[32];
1019 /** 0x150: Names a root file containing copyright info. Optional. */
1020 UDFDSTRING achCopyrightFile[32];
1021 /** 0x170: Names a root file containing an abstract for the file set. Optional. */
1022 UDFDSTRING achAbstractFile[32];
1023 /** 0x190: Root directory information control block location (ICB).
1024 * An ICB is a sequence made up of UDF_TAG_ID_FILE_ENTRY,
1025 * UDF_TAG_ID_INDIRECT_ENTRY, and UDF_TAG_ID_TERMINAL_ENTRY descriptors. */
1026 UDFLONGAD RootDirIcb;
1027 /** 0x1a0: Domain identifier (UDF_ENTITY_FSD_LVD_DOMAIN). Optional. */
1028 UDFENTITYID idDomain;
1029 /** 0x1c0: Next location with file set descriptors location, 0 if none. */
1030 UDFLONGAD NextExtent;
1031 /** 0x1d0: Location of the system stream directory associated with the
1032 * file set. Optional. */
1033 UDFLONGAD SystemStreamDirIcb;
1034 /** 0x1e0: Reserved, MBZ. */
1035 uint8_t abReserved[32];
1036} UDFFILESETDESC;
1037AssertCompileSize(UDFFILESETDESC, 512);
1038/** Pointer to an UDF file set descriptor. */
1039typedef UDFFILESETDESC *PUDFFILESETDESC;
1040/** Pointer to a const UDF file set descriptor. */
1041typedef UDFFILESETDESC const *PCUDFFILESETDESC;
1042
1043
1044/**
1045 * UDF file identifier descriptor (FID) (@ecma167{4,14.4,91}, @udf260{2.3.4,57}).
1046 */
1047typedef struct UDFFILEIDDESC
1048{
1049 /** 0x00: The descriptor tag (UDF_TAG_ID_FILE_ID_DESC). */
1050 UDFTAG Tag;
1051 /** 0x10: File version number (1..32767). Always set to 1. */
1052 uint16_t uVersion;
1053 /** 0x12: File characteristics (UDF_FILE_FLAGS_XXX). */
1054 uint8_t fFlags;
1055 /** 0x13: File identifier (name) length. */
1056 uint8_t cbName;
1057 /** 0x14: Location of an information control block describing the file.
1058 * Can be null if marked deleted. The implementation defined part of
1059 * this contains additional flags and a unique ID. */
1060 UDFLONGAD Icb;
1061 /** 0x24: Length of implementation use field (in bytes). This can be zero.
1062 *
1063 * It can be used to prevent the following FID from spanning a block
1064 * boundrary, in which case it will be 32 bytes or more, and the it will
1065 * start with an UDFENTITYID identifying who last wrote it.
1066 *
1067 * The latter padding fun is a requirement from write-once media. */
1068 uint16_t cbImplementationUse;
1069 /** 0x26: Two variable sized fields followed by padding to make the
1070 * actual structure size 4 byte aligned. The first field in an
1071 * implementation use field with length given by @a cbImplementationUse.
1072 * After that is a d-string field with the name of the file, length
1073 * specified by @a cbName. */
1074 uint8_t abImplementationUse[RT_FLEXIBLE_ARRAY];
1075} UDFFILEIDDESC;
1076AssertCompileMemberOffset(UDFFILEIDDESC, fFlags, 0x12);
1077AssertCompileMemberOffset(UDFFILEIDDESC, cbName, 0x13);
1078AssertCompileMemberOffset(UDFFILEIDDESC, Icb, 0x14);
1079AssertCompileMemberOffset(UDFFILEIDDESC, abImplementationUse, 0x26);
1080/** Pointer to an UDF file set descriptor */
1081typedef UDFFILEIDDESC *PUDFFILEIDDESC;
1082/** Pointer to a const UDF file set descriptor */
1083typedef UDFFILEIDDESC const *PCUDFFILEIDDESC;
1084
1085/** Get the pointer to the name field. */
1086#define UDFFILEIDDESC_2_NAME(a_pFid) ((uint8_t const *)(&(a_pFid)->abImplementationUse[(a_pFid)->cbImplementationUse]))
1087/** Calculates the total size the size of a record. */
1088#define UDFFILEIDDESC_CALC_SIZE_EX(cbImplementationUse, cbName) \
1089 RT_ALIGN_32((uint32_t)RT_UOFFSETOF(UDFFILEIDDESC, abImplementationUse) + cbImplementationUse + cbName, 4)
1090/** Gets the actual size of a record. */
1091#define UDFFILEIDDESC_GET_SIZE(a_pFid) UDFFILEIDDESC_CALC_SIZE_EX((a_pFid)->cbImplementationUse, (a_pFid)->cbName)
1092
1093/** @name UDF_FILE_FLAGS_XXX
1094 * @{ */
1095/** Existence - Hide the file from the user. */
1096#define UDF_FILE_FLAGS_HIDDEN UINT8_C(0x01)
1097/** Directory - Indicates a directory as apposed to some kind of file or symlink or something (0). */
1098#define UDF_FILE_FLAGS_DIRECTORY UINT8_C(0x02)
1099/** Deleted - Indicate that the file has been deleted. Assoicated descriptors may still be valid, though. */
1100#define UDF_FILE_FLAGS_DELETED UINT8_C(0x04)
1101/** Parent - Indicate the ICB field refers to the parent directory (or maybe
1102 * a file in case of streaming directory). */
1103#define UDF_FILE_FLAGS_PARENT UINT8_C(0x08)
1104/** Metadata - Zero means user data, one means implementation specific metadata.
1105 * Only allowed used in stream directory. */
1106#define UDF_FILE_FLAGS_METADATA UINT8_C(0x10)
1107/** Reserved bits that should be zer. */
1108#define UDF_FILE_FLAGS_RESERVED_MASK UINT8_C(0xe0)
1109/** @} */
1110
1111
1112/**
1113 * UDF allocation extent descriptor (@ecma167{4,14.5,93}, @udf260{2.3.11,67}).
1114 */
1115typedef struct UDFALLOCATIONEXTENTDESC
1116{
1117 /** 0x00: The descriptor tag (UDF_TAG_ID_ALLOCATION_EXTENT_DESC). */
1118 UDFTAG Tag;
1119 /** 0x10: Previous allocation extent location (logical block in current
1120 * partition). */
1121 uint32_t offPrevExtent;
1122 /** 0x14: Size of the following allocation descriptors (in bytes). */
1123 uint32_t cbAllocDescs;
1124 /** 0x18: Allocation descriptors. */
1125 union
1126 {
1127 UDFSHORTAD aShortADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1128 UDFLONGAD aLongADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1129 UDFEXTAD aExtADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1130 } u;
1131} UDFALLOCATIONEXTENTDESC;
1132AssertCompileMemberOffset(UDFALLOCATIONEXTENTDESC, u, 0x18);
1133/** Pointer to an UDF allocation extent descriptor. */
1134typedef UDFALLOCATIONEXTENTDESC *PUDFALLOCATIONEXTENTDESC;
1135/** Pointer to a const UDF allocation extent descriptor. */
1136typedef UDFALLOCATIONEXTENTDESC const *PCUDFALLOCATIONEXTENTDESC;
1137
1138/**
1139 * UDF information control block tag (@ecma167{4,14.6,93}, @udf260{2.3.5,60}).
1140 */
1141typedef struct UDFICBTAG
1142{
1143 /** 0x00: Number of direct entries in this ICB prior to this one. */
1144 uint32_t cEntiresBeforeThis;
1145 /** 0x04: ICB hierarchy building strategy type (UDF_ICB_STRATEGY_TYPE_XXX). */
1146 uint16_t uStrategyType;
1147 /** 0x06: Type specific parameters. */
1148 uint8_t abStrategyParams[2];
1149 /** 0x08: Max number of direct and indirect entries that MAY be recorded in this ICB. */
1150 uint16_t cMaxEntries;
1151 /** 0x0a: Reserved, MBZ. */
1152 uint8_t bReserved;
1153 /** 0x0b: File type (UDF_FILE_TYPE_XXX). */
1154 uint8_t bFileType;
1155 /** 0x0c: Parent ICB location. */
1156 UDFLBADDR ParentIcb;
1157 /** 0x12: Parent ICB location (UDF_ICB_FLAGS_XXX). */
1158 uint16_t fFlags;
1159} UDFICBTAG;
1160AssertCompileSize(UDFICBTAG, 20);
1161typedef UDFICBTAG *PUDFICBTAG;
1162typedef UDFICBTAG const *PCUDFICBTAG;
1163
1164/** @name UDF_ICB_STRATEGY_TYPE_XXX - ICB hierarchy building strategies
1165 *
1166 * See @ecma167{4,14.6.2,94}, @udf260{6.6,121}
1167 *
1168 * @{ */
1169/** Strategy not specified. */
1170#define UDF_ICB_STRATEGY_TYPE_NOT_SPECIFIED UINT16_C(0x0000)
1171/** See @ecma167{4,A.2,129}. */
1172#define UDF_ICB_STRATEGY_TYPE_1 UINT16_C(0x0001)
1173/** See @ecma167{4,A.3,131}. */
1174#define UDF_ICB_STRATEGY_TYPE_2 UINT16_C(0x0002)
1175/** See @ecma167{4,A.4,131}. */
1176#define UDF_ICB_STRATEGY_TYPE_3 UINT16_C(0x0003)
1177/** See @ecma167{4,A.5,131}. */
1178#define UDF_ICB_STRATEGY_TYPE_4 UINT16_C(0x0004)
1179/** Defined by the UDF spec, see @udf260{6.6,121}. */
1180#define UDF_ICB_STRATEGY_TYPE_4096 UINT16_C(0x1000)
1181/** @} */
1182
1183/** @name UDF_ICB_FLAGS_XXX - ICB flags
1184 *
1185 * See @ecma167{4,14.6.8,95}, @udf260{2.3.5.4,61}
1186 *
1187 * @{ */
1188/** Using UDFSHORTAD. */
1189#define UDF_ICB_FLAGS_AD_TYPE_SHORT UINT16_C(0x0000)
1190/** Using UDFLONGAD. */
1191#define UDF_ICB_FLAGS_AD_TYPE_LONG UINT16_C(0x0001)
1192/** Using UDFEXTAD. */
1193#define UDF_ICB_FLAGS_AD_TYPE_EXTENDED UINT16_C(0x0002)
1194/** File content is embedded in the allocation descriptor area. */
1195#define UDF_ICB_FLAGS_AD_TYPE_EMBEDDED UINT16_C(0x0003)
1196/** Allocation type mask. */
1197#define UDF_ICB_FLAGS_AD_TYPE_MASK UINT16_C(0x0007)
1198/** Set on directories that are sorted (according to @ecma167{4,8.6.1,78}).
1199 * @note Directories are never sorted in UDF. */
1200#define UDF_ICB_FLAGS_SORTED_DIRECTORY UINT16_C(0x0008)
1201/** Not relocatable. */
1202#define UDF_ICB_FLAGS_NON_RELOCATABLE UINT16_C(0x0010)
1203/** Indicate that the file needs backing up (DOS attribute). */
1204#define UDF_ICB_FLAGS_ARCHIVE UINT16_C(0x0020)
1205/** Set UID bit (UNIX). */
1206#define UDF_ICB_FLAGS_SET_UID UINT16_C(0x0040)
1207/** Set GID bit (UNIX). */
1208#define UDF_ICB_FLAGS_SET_GID UINT16_C(0x0080)
1209/** Set sticky bit (UNIX). */
1210#define UDF_ICB_FLAGS_STICKY UINT16_C(0x0100)
1211/** Extents are contiguous. */
1212#define UDF_ICB_FLAGS_CONTIGUOUS UINT16_C(0x0200)
1213/** System bit, reserved for implementation use. */
1214#define UDF_ICB_FLAGS_SYSTEM UINT16_C(0x0400)
1215/** Data has been transformed in some way.
1216 * @note UDF shall not set this bit. */
1217#define UDF_ICB_FLAGS_TRANSFORMED UINT16_C(0x0800)
1218/** Directory may contain multi-versioned files.
1219 * @note UDF shall not set this bit. */
1220#define UDF_ICB_FLAGS_MULTI_VERSIONS UINT16_C(0x1000)
1221/** Is a stream in a stream directory. */
1222#define UDF_ICB_FLAGS_STREAM UINT16_C(0x2000)
1223/** Reserved mask. */
1224#define UDF_ICB_FLAGS_RESERVED_MASK UINT16_C(0xc000)
1225/** @} */
1226
1227/** @name UDF_FILE_TYPE_XXX - File types
1228 *
1229 * See @ecma167{4,14.6.6,94}, @udf260{2.3.5.2,60}
1230 *
1231 * @{ */
1232#define UDF_FILE_TYPE_NOT_SPECIFIED UINT8_C(0x00) /**< Not specified by this field. */
1233#define UDF_FILE_TYPE_UNALLOCATED_SPACE_ENTRY UINT8_C(0x01)
1234#define UDF_FILE_TYPE_PARTITION_INTEGRITY_ENTRY UINT8_C(0x02)
1235#define UDF_FILE_TYPE_INDIRECT_ENTRY UINT8_C(0x03)
1236#define UDF_FILE_TYPE_DIRECTORY UINT8_C(0x04)
1237#define UDF_FILE_TYPE_REGULAR_FILE UINT8_C(0x05)
1238#define UDF_FILE_TYPE_BLOCK_DEVICE UINT8_C(0x06)
1239#define UDF_FILE_TYPE_CHARACTER_DEVICE UINT8_C(0x07)
1240#define UDF_FILE_TYPE_EXTENDED_ATTRIBUTES UINT8_C(0x08)
1241#define UDF_FILE_TYPE_FIFO UINT8_C(0x09)
1242#define UDF_FILE_TYPE_SOCKET UINT8_C(0x0a)
1243#define UDF_FILE_TYPE_TERMINAL_ENTRY UINT8_C(0x0b)
1244#define UDF_FILE_TYPE_SYMBOLIC_LINK UINT8_C(0x0c)
1245#define UDF_FILE_TYPE_STREAM_DIRECTORY UINT8_C(0x0d)
1246#define UDF_FILE_TYPE_VAT UINT8_C(0xf8)
1247#define UDF_FILE_TYPE_REAL_TIME_FILE UINT8_C(0xf9)
1248#define UDF_FILE_TYPE_METADATA_FILE UINT8_C(0xfa)
1249#define UDF_FILE_TYPE_METADATA_MIRROR_FILE UINT8_C(0xfb)
1250#define UDF_FILE_TYPE_METADATA_BITMAP_FILE UINT8_C(0xfc)
1251/** @} */
1252
1253
1254/**
1255 * UDF ICB header (derived structure).
1256 */
1257typedef struct UDFICBHDR
1258{
1259 /** 0x00: The descriptor tag (UDF_TAG_ID_INDIRECT_ENTRY). */
1260 UDFTAG Tag;
1261 /** 0x10: ICB Tag. */
1262 UDFICBTAG IcbTag;
1263} UDFICBHDR;
1264AssertCompileSize(UDFICBHDR, 36);
1265/** Pointer to an UDF ICB header. */
1266typedef UDFICBHDR *PUDFICBHDR;
1267/** Pointer to a const UDF ICB header. */
1268typedef UDFICBHDR const *PCUDFICBHDR;
1269
1270
1271/**
1272 * UDF indirect entry (@ecma167{4,14.7,96}).
1273 */
1274typedef struct UDFINDIRECTENTRY
1275{
1276 /** 0x00: The descriptor tag (UDF_TAG_ID_INDIRECT_ENTRY). */
1277 UDFTAG Tag;
1278 /** 0x10: ICB Tag. */
1279 UDFICBTAG IcbTag;
1280 /** 0x24: Indirect ICB location. */
1281 UDFLONGAD IndirectIcb;
1282} UDFINDIRECTENTRY;
1283AssertCompileSize(UDFINDIRECTENTRY, 52);
1284/** Pointer to an UDF indirect entry. */
1285typedef UDFINDIRECTENTRY *PUDFINDIRECTENTRY;
1286/** Pointer to a const UDF indirect entry. */
1287typedef UDFINDIRECTENTRY const *PCUDFINDIRECTENTRY;
1288
1289
1290/**
1291 * UDF terminal entry (@ecma167{4,14.8,97}).
1292 */
1293typedef struct UDFTERMINALENTRY
1294{
1295 /** 0x00: The descriptor tag (UDF_TAG_ID_TERMINAL_ENTRY). */
1296 UDFTAG Tag;
1297 /** 0x10: ICB Tag (UDF_FILE_TYPE_TERMINAL_ENTRY). */
1298 UDFICBTAG IcbTag;
1299} UDFTERMINALENTRY;
1300AssertCompileSize(UDFTERMINALENTRY, 36);
1301/** Pointer to an UDF terminal entry. */
1302typedef UDFTERMINALENTRY *PUDFTERMINALENTRY;
1303/** Pointer to a const UDF terminal entry. */
1304typedef UDFTERMINALENTRY const *PCUDFTERMINALENTRY;
1305
1306
1307/**
1308 * UDF file entry (FE) (@ecma167{4,14.8,97}, @udf260{2.3.6,62}).
1309 *
1310 * @note Total length shall not exceed one logical block.
1311 */
1312typedef struct UDFFILEENTRY
1313{
1314 /** 0x00: The descriptor tag (UDF_TAG_ID_FILE_ENTRY). */
1315 UDFTAG Tag;
1316 /** 0x10: ICB Tag. */
1317 UDFICBTAG IcbTag;
1318 /** 0x24: User ID (UNIX). */
1319 uint32_t uid;
1320 /** 0x28: Group ID (UNIX). */
1321 uint32_t gid;
1322 /** 0x2c: Permission (UDF_PERM_XXX). */
1323 uint32_t fPermissions;
1324 /** 0x30: Number hard links. */
1325 uint16_t cHardlinks;
1326 /** 0x32: Record format (UDF_REC_FMT_XXX). */
1327 uint8_t uRecordFormat;
1328 /** 0x33: Record format (UDF_REC_ATTR_XXX). */
1329 uint8_t fRecordDisplayAttribs;
1330 /** 0x34: Record length (in bytes).
1331 * @note Must be zero according to the UDF specification. */
1332 uint32_t cbRecord;
1333 /** 0x38: Information length in bytes (file size). */
1334 uint64_t cbData;
1335 /** 0x40: Number of logical blocks allocated (for file data). */
1336 uint64_t cLogicalBlocks;
1337 /** 0x48: Time of last access (prior to recording the file entry). */
1338 UDFTIMESTAMP AccessTime;
1339 /** 0x54: Time of last data modification. */
1340 UDFTIMESTAMP ModificationTime;
1341 /** 0x60: Time of last attribute/status modification. */
1342 UDFTIMESTAMP ChangeTime;
1343 /** 0x6c: Checkpoint number (defaults to 1). */
1344 uint32_t uCheckpoint;
1345 /** 0x70: Extended attribute information control block location. */
1346 UDFLONGAD ExtAttribIcb;
1347 /** 0x80: Implementation identifier ("*Developer ID"). */
1348 UDFENTITYID idImplementation;
1349 /** 0xa0: Unique ID. */
1350 uint64_t INodeId;
1351 /** 0xa8: Length of extended attributes in bytes, multiple of four. */
1352 uint32_t cbExtAttribs;
1353 /** 0xac: Length of allocation descriptors in bytes, multiple of four. */
1354 uint32_t cbAllocDescs;
1355 /** 0xb0: Two variable sized fields. First @a cbExtAttribs bytes of extended
1356 * attributes, then @a cbAllocDescs bytes of allocation descriptors. */
1357 uint8_t abExtAttribs[RT_FLEXIBLE_ARRAY];
1358} UDFFILEENTRY;
1359AssertCompileMemberOffset(UDFFILEENTRY, abExtAttribs, 0xb0);
1360/** Pointer to an UDF file entry. */
1361typedef UDFFILEENTRY *PUDFFILEENTRY;
1362/** Pointer to a const UDF file entry. */
1363typedef UDFFILEENTRY const *PCUDFFILEENTRY;
1364
1365/** @name UDF_PERM_XXX - UDFFILEENTRY::fPermissions
1366 * See @ecma167{4,14.9.5,99}.
1367 * @{ */
1368#define UDF_PERM_OTH_EXEC UINT32_C(0x00000001)
1369#define UDF_PERM_OTH_WRITE UINT32_C(0x00000002)
1370#define UDF_PERM_OTH_READ UINT32_C(0x00000004)
1371#define UDF_PERM_OTH_ATTRIB UINT32_C(0x00000008)
1372#define UDF_PERM_OTH_DELETE UINT32_C(0x00000010)
1373#define UDF_PERM_OTH_MASK UINT32_C(0x0000001f)
1374
1375#define UDF_PERM_GRP_EXEC UINT32_C(0x00000020)
1376#define UDF_PERM_GRP_WRITE UINT32_C(0x00000040)
1377#define UDF_PERM_GRP_READ UINT32_C(0x00000080)
1378#define UDF_PERM_GRP_ATTRIB UINT32_C(0x00000100)
1379#define UDF_PERM_GRP_DELETE UINT32_C(0x00000200)
1380#define UDF_PERM_GRP_MASK UINT32_C(0x000003e0)
1381
1382#define UDF_PERM_USR_EXEC UINT32_C(0x00000400)
1383#define UDF_PERM_USR_WRITE UINT32_C(0x00000800)
1384#define UDF_PERM_USR_READ UINT32_C(0x00001000)
1385#define UDF_PERM_USR_ATTRIB UINT32_C(0x00002000)
1386#define UDF_PERM_USR_DELETE UINT32_C(0x00004000)
1387#define UDF_PERM_USR_MASK UINT32_C(0x00007c00)
1388
1389#define UDF_PERM_USR_RESERVED_MASK UINT32_C(0xffff8000)
1390/** @} */
1391
1392/** @name UDF_REC_FMT_XXX - Record format.
1393 * See @ecma167{4,14.9.7,100}.
1394 * @{ */
1395/** Not record format specified.
1396 * @note The only allowed value according to the UDF specification. */
1397#define UDF_REC_FMT_NOT_SPECIFIED UINT8_C(0x00)
1398/** @} */
1399
1400/** @name UDF_REC_ATTR_XXX - Record display attributes.
1401 * See @ecma167{4,14.9.8,100}.
1402 * @{ */
1403/** Manner of record display not specified.
1404 * @note The only allowed value according to the UDF specification. */
1405#define UDF_REC_ATTR_NOT_SPECIFIED UINT8_C(0x00)
1406/** @} */
1407
1408
1409/**
1410 * UDF extended attribute header descriptor (@ecma167{4,14.10.1,102},
1411 * @udf260{3.3.4,79}).
1412 */
1413typedef struct UDFEXTATTRIBHDRDESC
1414{
1415 /** 0x00: The descriptor tag (UDF_TAG_ID_EXTENDED_ATTRIB_HDR_DESC). */
1416 UDFTAG Tag;
1417 /** 0x10: Implementation attributes location (byte offset) into the EA space.
1418 * This typically set to UINT32_MAX if not present, though any value larger
1419 * than the EA space will do. */
1420 uint32_t offImplementationAttribs;
1421 /** 0x14: Application attributes location (byte offset) into the EA space.
1422 * This typically set to UINT32_MAX if not present, though any value larger
1423 * than the EA space will do. */
1424 uint32_t offApplicationAttribs;
1425} UDFEXTATTRIBHDRDESC;
1426AssertCompileSize(UDFEXTATTRIBHDRDESC, 24);
1427/** Pointer to an UDF extended attribute header descriptor. */
1428typedef UDFEXTATTRIBHDRDESC *PUDFEXTATTRIBHDRDESC;
1429/** Pointer to a const UDF extended attribute header descriptor. */
1430typedef UDFEXTATTRIBHDRDESC const *PCUDFEXTATTRIBHDRDESC;
1431
1432/**
1433 * UDF character set info EA data (@ecma167{4,14.10.3,104}).
1434 *
1435 * Not needed by UDF.
1436 */
1437typedef struct UDFEADATACHARSETINFO
1438{
1439 /** 0x00/0x0c: The length of the escape sequences (in bytes). */
1440 uint32_t cbEscSeqs;
1441 /** 0x04/0x10: The character set type (UDF_CHAR_SET_TYPE_XXX). */
1442 uint8_t bType;
1443 /** 0x05/0x11: Escape sequences. */
1444 uint8_t abEscSeqs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1445} UDFEADATACHARSETINFO;
1446/** Pointer to UDF character set info EA data. */
1447typedef UDFEADATACHARSETINFO *PUDFEADATACHARSETINFO;
1448/** Pointer to const UDF character set info EA data. */
1449typedef UDFEADATACHARSETINFO const *PCUDFEADATACHARSETINFO;
1450/** UDFGEA::uAttribType value for UDFEADATACHARSETINFO.*/
1451#define UDFEADATACHARSETINFO_ATTRIB_TYPE UINT32_C(0x00000001)
1452/** UDFGEA::uAttribSubtype value for UDFEADATACHARSETINFO. */
1453#define UDFEADATACHARSETINFO_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1454
1455/**
1456 * UDF alternate permissions EA data (@ecma167{4,14.10.4,105}, @udf260{3.3.4.2,80}).
1457 * @note Not recorded according to the UDF specification.
1458 */
1459typedef struct UDFEADATAALTPERM
1460{
1461 /** 0x00/0x0c: Alternative owner ID. */
1462 uint16_t idOwner;
1463 /** 0x02/0x0e: Alternative group ID. */
1464 uint16_t idGroup;
1465 /** 0x04/0x10: Alternative permissions. */
1466 uint16_t fPermission;
1467} UDFEADATAALTPERM;
1468/** Pointer to UDF alternative permissions EA data. */
1469typedef UDFEADATAALTPERM *PUDFEADATAALTPERM;
1470/** Pointer to const UDF alternative permissions EA data. */
1471typedef UDFEADATAALTPERM const *PCUDFEADATAALTPERM;
1472/** UDFGEA::uAttribType value for UDFEADATAALTPERM. */
1473#define UDFEADATAALTPERM_ATTRIB_TYPE UINT32_C(0x00000003)
1474/** UDFGEA::uAttribSubtype value for UDFEADATAALTPERM. */
1475#define UDFEADATAALTPERM_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1476
1477/**
1478 * UDF file times EA data (@ecma167{4,14.10.5,108}, @udf260{3.3.4.3,80}).
1479 * (This is a bit reminiscent of ISO9660RRIPTF.)
1480 */
1481typedef struct UDFEADATAFILETIMES
1482{
1483 /** 0x00/0x0c: Timestamp length. */
1484 uint32_t cbTimestamps;
1485 /** 0x04/0x10: Indicates which timestamps are present
1486 * (UDF_FILE_TIMES_EA_F_XXX). */
1487 uint32_t fFlags;
1488 /** 0x08/0x14: Timestamps. */
1489 UDFTIMESTAMP aTimestamps[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1490} UDFEADATAFILETIMES;
1491/** Pointer to UDF file times EA data. */
1492typedef UDFEADATAFILETIMES *PUDFEADATAFILETIMES;
1493/** Pointer to const UDF file times EA data. */
1494typedef UDFEADATAFILETIMES const *PCUDFEADATAFILETIMES;
1495/** UDFGEA::uAttribType value for UDFEADATAFILETIMES. */
1496#define UDFEADATAFILETIMES_ATTRIB_TYPE UINT32_C(0x00000005)
1497/** UDFGEA::uAttribSubtype value for UDFEADATAFILETIMES. */
1498#define UDFEADATAFILETIMES_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1499
1500/** @name UDF_FILE_TIMES_EA_F_XXX - File times existence flags.
1501 * See @ecma167{4,14.10.5.6,109}
1502 * @{ */
1503#define UDF_FILE_TIMES_EA_F_BIRTH UINT8_C(0x01) /**< Birth (creation) timestamp is recorded. */
1504#define UDF_FILE_TIMES_EA_F_DELETE UINT8_C(0x04) /**< Deletion timestamp is recorded. */
1505#define UDF_FILE_TIMES_EA_F_EFFECTIVE UINT8_C(0x08) /**< Effective timestamp is recorded. */
1506#define UDF_FILE_TIMES_EA_F_BACKUP UINT8_C(0x20) /**< Backup timestamp is recorded. */
1507#define UDF_FILE_TIMES_EA_F_RESERVED_MASK UINT8_C(0xd2)
1508/** @} */
1509
1510/**
1511 * UDF information times EA data (@ecma167{4,14.10.6,109}).
1512 */
1513typedef struct UDFEADATAINFOTIMES
1514{
1515 /** 0x00/0x0c: Timestamp length. */
1516 uint32_t cbTimestamps;
1517 /** 0x04/0x10: Indicates which timestamps are present
1518 * (UDF_INFO_TIMES_EA_F_XXX). */
1519 uint32_t fFlags;
1520 /** 0x08/0x14: Timestamps. */
1521 UDFTIMESTAMP aTimestamps[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1522} UDFEADATAINFOTIMES;
1523/** Pointer to UDF information times EA data. */
1524typedef UDFEADATAINFOTIMES *PUDFEADATAINFOTIMES;
1525/** Pointer to const UDF information times EA data. */
1526typedef UDFEADATAINFOTIMES const *PCUDFEADATAINFOTIMES;
1527/** UDFGEA::uAttribType value for UDFEADATAINFOTIMES. */
1528#define UDFEADATAINFOTIMES_ATTRIB_TYPE UINT32_C(0x00000006)
1529/** UDFGEA::uAttribSubtype value for UDFEADATAINFOTIMES. */
1530#define UDFEADATAINFOTIMES_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1531
1532/** @name UDF_INFO_TIMES_EA_F_XXX - Information times existence flags.
1533 * See @ecma167{4,14.10.6.6,110}
1534 * @{ */
1535#define UDF_INFO_TIMES_EA_F_BIRTH UINT8_C(0x01) /**< Birth (creation) timestamp is recorded. */
1536#define UDF_INFO_TIMES_EA_F_MODIFIED UINT8_C(0x02) /**< Last (data) modified timestamp is recorded. */
1537#define UDF_INFO_TIMES_EA_F_EXPIRE UINT8_C(0x04) /**< Expiration (deletion) timestamp is recorded. */
1538#define UDF_INFO_TIMES_EA_F_EFFECTIVE UINT8_C(0x08) /**< Effective timestamp is recorded. */
1539#define UDF_INFO_TIMES_EA_F_RESERVED_MASK UINT8_C(0xf0)
1540/** @} */
1541
1542/**
1543 * UDF device specification EA data (@ecma167{4,14.10.7,110}, @udf260{3.3.4.4,81}).
1544 */
1545typedef struct UDFEADATADEVICESPEC
1546{
1547 /** 0x00/0x0c: Length of implementation use field. */
1548 uint32_t cbImplementationUse;
1549 /** 0x04/0x10: Major device number. */
1550 uint32_t uMajorDeviceNo;
1551 /** 0x08/0x14: Minor device number. */
1552 uint32_t uMinorDeviceNo;
1553 /** 0x0c/0x18: Implementation use field (variable length).
1554 * UDF specficiation expects UDFENTITYID with a "*Developer ID" as first part
1555 * here. */
1556 uint8_t abImplementationUse[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1557} UDFEADATADEVICESPEC;
1558/** Pointer to UDF device specification EA data. */
1559typedef UDFEADATADEVICESPEC *PUDFEADATADEVICESPEC;
1560/** Pointer to const UDF device specification EA data. */
1561typedef UDFEADATADEVICESPEC const *PCUDFEADATADEVICESPEC;
1562/** UDFGEA::uAttribType value for UDFEADATADEVICESPEC. */
1563#define UDFEADATADEVICESPEC_ATTRIB_TYPE UINT32_C(0x0000000c)
1564/** UDFGEA::uAttribSubtype value for UDFEADATADEVICESPEC. */
1565#define UDFEADATADEVICESPEC_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1566
1567/**
1568 * UDF free EA space payload for implementation and application use EAs
1569 * (@udf260{3.3.4.5.1.1,82}, @udf260{3.3.4.6.1.1,88}).
1570 *
1571 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_FREE_EA_SPACE.
1572 * UDFEADATAAPPUSE::idImplementation is UDF_ENTITY_ID_AUEA_FREE_EA_SPACE.
1573 */
1574typedef struct UDFFREEEASPACE
1575{
1576 /** 0x00/0x30: Header checksum.
1577 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1578 uint16_t uChecksum;
1579 /** 0x02/0x32: Free space. */
1580 uint8_t abFree[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1581} UDFFREEEASPACE;
1582/** Pointer to UDF free EA space impl/app use payload. */
1583typedef UDFFREEEASPACE *PUDFFREEEASPACE;
1584/** Pointer to const UDF free EA space impl/app use payload. */
1585typedef UDFFREEEASPACE const *PCUDFFREEEASPACE;
1586
1587/**
1588 * UDF DVD copyright management information implementation use EA payload
1589 * (@udf260{3.3.4.5.1.2,83}).
1590 *
1591 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_DVD_CGMS_INFO.
1592 */
1593typedef struct UDFIUEADVDCGMSINFO
1594{
1595 /** 0x00/0x30: Header checksum.
1596 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1597 uint16_t uChecksum;
1598 /** 0x02/0x32: The CGMS information (whatever that is). */
1599 uint8_t bInfo;
1600 /** 0x03/0x33: Data structure type (whatever that is). */
1601 uint8_t bType;
1602 /** 0x04/0x34: Production system information, probably dependend on the
1603 * values of previous fields. */
1604 uint8_t abProtSysInfo[4];
1605} UDFIUEADVDCGMSINFO;
1606/** Pointer to UDF DVD copyright management information implementation use EA payload. */
1607typedef UDFIUEADVDCGMSINFO *PUDFIUEADVDCGMSINFO;
1608/** Pointer to const UDF DVD copyright management information implementation use EA payload. */
1609typedef UDFIUEADVDCGMSINFO const *PCUDFIUEADVDCGMSINFO;
1610
1611/**
1612 * UDF OS/2 EA length implementation use EA payload (@udf260{3.3.4.5.3.1,84}).
1613 *
1614 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_OS2_EA_LENGTH.
1615 */
1616#pragma pack(2)
1617typedef struct UDFIUEAOS2EALENGTH
1618{
1619 /** 0x00/0x30: Header checksum.
1620 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1621 uint16_t uChecksum;
1622 /** 0x02/0x32: The CGMS information (whatever that is). */
1623 uint32_t cbEAs;
1624} UDFIUEAOS2EALENGTH;
1625#pragma pack()
1626AssertCompileMemberOffset(UDFIUEAOS2EALENGTH, cbEAs, 2);
1627/** Pointer to UDF OS/2 EA length implementation use EA payload. */
1628typedef UDFIUEAOS2EALENGTH *PUDFIUEAOS2EALENGTH;
1629/** Pointer to const UDF OS/2 EA length implementation use EA payload. */
1630typedef UDFIUEAOS2EALENGTH const *PCUDFIUEAOS2EALENGTH;
1631
1632/**
1633 * UDF Mac volume info implementation use EA payload (@udf260{3.3.4.5.4.1,84}).
1634 *
1635 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_MAC_VOLUME_INFO.
1636 */
1637#pragma pack(2)
1638typedef struct UDFIUEAMACVOLINFO
1639{
1640 /** 0x00/0x30: Header checksum.
1641 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1642 uint16_t uChecksum;
1643 /** 0x02/0x32: Last modification time. */
1644 UDFTIMESTAMP LastModificationTime;
1645 /** 0x0e/0x3e: Last backup time. */
1646 UDFTIMESTAMP LastBackupTime;
1647 /** 0x1a/0x4e: Volume finder information. */
1648 uint32_t au32FinderInfo[8];
1649} UDFIUEAMACVOLINFO;
1650#pragma pack()
1651AssertCompileMemberOffset(UDFIUEAMACVOLINFO, au32FinderInfo, 0x1a);
1652/** Pointer to UDF Mac volume info implementation use EA payload. */
1653typedef UDFIUEAMACVOLINFO *PUDFIUEAMACVOLINFO;
1654/** Pointer to const UDF Mac volume info implementation use EA payload. */
1655typedef UDFIUEAMACVOLINFO const *PCUDFIUEAMACVOLINFO;
1656
1657/**
1658 * UDF point for use in Mac EAs (@udf260{3.3.4.5.4.2,86}).
1659 */
1660typedef struct UDFMACPOINT
1661{
1662 /** X coordinate. */
1663 int16_t x;
1664 /** Y coordinate. */
1665 int16_t y;
1666} UDFMACPOINT;
1667
1668/**
1669 * UDF rectangle for using Mac EAs (@udf260{3.3.4.5.4.2,86}).
1670 */
1671typedef struct UDFMACRECT
1672{
1673 /** top Y coordinate. */
1674 int16_t yTop;
1675 /** left X coordinate. */
1676 int16_t xLeft;
1677 /** bottom Y coordinate. (exclusive?) */
1678 int16_t yBottom;
1679 /** right X coordinate. (exclusive?) */
1680 int16_t xRight;
1681} UDFMACRECT;
1682
1683/**
1684 * UDF finder directory info for Mac EAs (@udf260{3.3.4.5.4.2,86}).
1685 */
1686typedef struct UDFMACFDINFO
1687{
1688 UDFMACRECT FrRect;
1689 int16_t FrFlags;
1690 UDFMACPOINT FrLocation;
1691 int16_t FrView;
1692} UDFMACFDINFO;
1693AssertCompileSize(UDFMACFDINFO, 16);
1694
1695/**
1696 * UDF finder directory extended info for Mac EAs (@udf260{3.3.4.5.4.2,86}).
1697 */
1698typedef struct UDFMACFDXINFO
1699{
1700 UDFMACPOINT FrScroll;
1701 int32_t FrOpenChain;
1702 uint8_t FrScript;
1703 uint8_t FrXFlags;
1704 uint16_t FrComment;
1705 uint32_t FrPutAway;
1706} UDFMACFDXINFO;
1707AssertCompileSize(UDFMACFDXINFO, 16);
1708
1709/**
1710 * UDF Mac finder info implementation use EA payload (@udf260{3.3.4.5.4.1,84}),
1711 * directory edition.
1712 *
1713 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_MAC_FINDER_INFO.
1714 */
1715typedef struct UDFIUEAMACFINDERINFODIR
1716{
1717 /** 0x00/0x30: Header checksum.
1718 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1719 uint16_t uChecksum;
1720 /** 0x02/0x32: Explicit alignment padding, MBZ. */
1721 uint16_t uPadding;
1722 /** 0x04/0x34: Parent directory ID. */
1723 uint32_t idParentDir;
1724 /** 0x08/0x38: Dir information. */
1725 UDFMACFDINFO DirInfo;
1726 /** 0x18/0x48: Dir extended information. */
1727 UDFMACFDXINFO DirExInfo;
1728} UDFIUEAMACFINDERINFODIR;
1729AssertCompileMemberOffset(UDFIUEAMACFINDERINFODIR, DirInfo, 0x08);
1730AssertCompileMemberOffset(UDFIUEAMACFINDERINFODIR, DirExInfo, 0x18);
1731AssertCompileSize(UDFIUEAMACFINDERINFODIR, 0x28);
1732/** Pointer to UDF Mac finder info for dir implementation use EA payload. */
1733typedef UDFIUEAMACFINDERINFODIR *PUDFIUEAMACFINDERINFODIR;
1734/** Pointer to const UDF Mac finder info for dir implementation use EA payload. */
1735typedef UDFIUEAMACFINDERINFODIR const *PCUDFIUEAMACFINDERINFODIR;
1736
1737/**
1738 * UDF finder file info for Mac EAs (@udf260{3.3.4.5.4.2,86}).
1739 */
1740typedef struct UDFMACFFINFO
1741{
1742 uint32_t FrType;
1743 uint32_t FrCreator;
1744 uint16_t FrFlags;
1745 UDFMACPOINT FrLocation;
1746 int16_t FrFldr;
1747} UDFMACFFINFO;
1748AssertCompileSize(UDFMACFFINFO, 16);
1749
1750/**
1751 * UDF finder file extended info for Mac EAs (@udf260{3.3.4.5.4.2,86}).
1752 */
1753typedef struct UDFMACFFXINFO
1754{
1755 int16_t FrIconID;
1756 uint8_t FdUnused[6];
1757 uint8_t FrScript;
1758 uint8_t FrXFlags;
1759 uint16_t FrComment;
1760 uint32_t FrPutAway;
1761} UDFMACFFXINFO;
1762AssertCompileSize(UDFMACFFXINFO, 16);
1763
1764/**
1765 * UDF Mac finder info implementation use EA payload (@udf260{3.3.4.5.4.1,84}),
1766 * file edition.
1767 *
1768 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_MAC_FINDER_INFO.
1769 */
1770typedef struct UDFIUEAMACFINDERINFOFILE
1771{
1772 /** 0x00/0x30: Header checksum.
1773 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1774 uint16_t uChecksum;
1775 /** 0x02/0x32: Explicit alignment padding, MBZ. */
1776 uint16_t uPadding;
1777 /** 0x04/0x34: Parent directory ID. */
1778 uint32_t idParentDir;
1779 /** 0x08/0x38: File information. */
1780 UDFMACFFINFO FileInfo;
1781 /** 0x18/0x48: File extended information. */
1782 UDFMACFFXINFO FileExInfo;
1783 /** 0x28/0x58: The size of the fork data (in bytes). */
1784 uint32_t cbForkData;
1785 /** 0x2c/0x5c: The size of the fork allocation (in bytes). */
1786 uint32_t cbForkAlloc;
1787} UDFIUEAMACFINDERINFOFILE;
1788AssertCompileMemberOffset(UDFIUEAMACFINDERINFOFILE, FileInfo, 0x08);
1789AssertCompileMemberOffset(UDFIUEAMACFINDERINFOFILE, FileExInfo, 0x18);
1790AssertCompileMemberOffset(UDFIUEAMACFINDERINFOFILE, cbForkData, 0x28);
1791AssertCompileSize(UDFIUEAMACFINDERINFOFILE, 0x30);
1792/** Pointer to UDF Mac finder info for file implementation use EA payload. */
1793typedef UDFIUEAMACFINDERINFOFILE *PUDFIUEAMACFINDERINFOFILE;
1794/** Pointer to const UDF Mac finder info for file implementation use EA payload. */
1795typedef UDFIUEAMACFINDERINFOFILE const *PCUDFIUEAMACFINDERINFOFILE;
1796
1797/**
1798 * UDF OS/400 directory info implementation use EA payload (@udf260{3.3.4.5.6.1,87})
1799 *
1800 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_OS400_DIR_INFO.
1801 */
1802typedef struct UDFIUEAOS400DIRINFO
1803{
1804 /** 0x00/0x30: Header checksum.
1805 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1806 uint16_t uChecksum;
1807 /** 0x02/0x32: Explicit alignment padding, MBZ. */
1808 uint16_t uPadding;
1809 /** 0x04/0x34: The directory info, format documented elsewhere. */
1810 uint8_t abDirInfo[44];
1811} UDFIUEAOS400DIRINFO;
1812AssertCompileSize(UDFIUEAOS400DIRINFO, 0x30);
1813/** Pointer to UDF Mac finder info for file implementation use EA payload. */
1814typedef UDFIUEAOS400DIRINFO *PUDFIUEAOS400DIRINFO;
1815/** Pointer to const UDF Mac finder info for file implementation use EA payload. */
1816typedef UDFIUEAOS400DIRINFO const *PCUDFIUEAOS400DIRINFO;
1817
1818
1819/**
1820 * UDF implementation use EA data (@ecma167{4,14.10.8,111}, @udf260{3.3.4.5,82}).
1821 */
1822typedef struct UDFEADATAIMPLUSE
1823{
1824 /** 0x00/0x0c: Length uData in bytes. */
1825 uint32_t cbData;
1826 /** 0x04/0x10: Implementation identifier (UDF_ENTITY_ID_IUEA_XXX). */
1827 UDFENTITYID idImplementation;
1828 /** 0x24/0x30: Implementation use field (variable length). */
1829 union
1830 {
1831 /** Generic byte view. */
1832 uint8_t abData[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1833 /** Free EA space (UDF_ENTITY_ID_IUEA_FREE_EA_SPACE). */
1834 UDFFREEEASPACE FreeEaSpace;
1835 /** DVD copyright management information (UDF_ENTITY_ID_IUEA_DVD_CGMS_INFO). */
1836 UDFIUEADVDCGMSINFO DvdCgmsInfo;
1837 /** OS/2 EA length (UDF_ENTITY_ID_IUEA_OS2_EA_LENGTH). */
1838 UDFIUEAOS2EALENGTH Os2EaLength;
1839 /** Mac volume info (UDF_ENTITY_ID_IUEA_MAC_VOLUME_INFO). */
1840 UDFIUEAMACVOLINFO MacVolInfo;
1841 /** Mac finder info, directory edition (UDF_ENTITY_ID_IUEA_MAC_FINDER_INFO). */
1842 UDFIUEAMACFINDERINFODIR MacFinderInfoDir;
1843 /** Mac finder info, file edition (UDF_ENTITY_ID_IUEA_MAC_FINDER_INFO). */
1844 UDFIUEAMACFINDERINFOFILE MacFinderInfoFile;
1845 /** OS/400 directory info (UDF_ENTITY_ID_IUEA_OS400_DIR_INFO). */
1846 UDFIUEAOS400DIRINFO Os400DirInfo;
1847 } u;
1848} UDFEADATAIMPLUSE;
1849/** Pointer to UDF implementation use EA data. */
1850typedef UDFEADATAIMPLUSE *PUDFEADATAIMPLUSE;
1851/** Pointer to const UDF implementation use EA data. */
1852typedef UDFEADATAIMPLUSE const *PCUDFEADATAIMPLUSE;
1853/** UDFGEA::uAttribType value for UDFEADATAIMPLUSE. */
1854#define UDFEADATAIMPLUSE_ATTRIB_TYPE UINT32_C(0x00000800)
1855/** UDFGEA::uAttribSubtype value for UDFEADATAIMPLUSE. */
1856#define UDFEADATAIMPLUSE_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1857
1858/**
1859 * UDF application use EA data (@ecma167{4,14.10.9,112}, @udf260{3.3.4.6,88}).
1860 */
1861typedef struct UDFEADATAAPPUSE
1862{
1863 /** 0x0c: Length uData in bytes. */
1864 uint32_t cbData;
1865 /** 0x10: Application identifier (UDF_ENTITY_ID_AUEA_FREE_EA_SPACE). */
1866 UDFENTITYID idApplication;
1867 /** 0x30: Application use field (variable length). */
1868 union
1869 {
1870 /** Generic byte view. */
1871 uint8_t ab[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1872 /** Free EA space (UDF_ENTITY_ID_AUEA_FREE_EA_SPACE). */
1873 UDFFREEEASPACE FreeEaSpace;
1874 } uData;
1875} UDFEADATAAPPUSE;
1876/** Pointer to UDF application use EA data. */
1877typedef UDFEADATAAPPUSE *PUDFEADATAAPPUSE;
1878/** Pointer to const UDF application use EA data. */
1879typedef UDFEADATAAPPUSE const *PCUDFEADATAAPPUSE;
1880/** UDFGEA::uAttribType value for UDFEADATAAPPUSE. */
1881#define UDFEADATAAPPUSE_ATTRIB_TYPE UINT32_C(0x00010000)
1882/** UDFGEA::uAttribSubtype value for UDFEADATAAPPUSE. */
1883#define UDFEADATAAPPUSE_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1884
1885/**
1886 * UDF generic extended attribute (@ecma167{4,14.10.2,103}).
1887 */
1888typedef struct UDFGEA
1889{
1890 /** 0x00: Attribute type (UDFXXX_ATTRIB_TYPE). */
1891 uint32_t uAttribType;
1892 /** 0x04: Attribute subtype (UDFXXX_ATTRIB_SUBTYPE). */
1893 uint8_t uAttribSubtype;
1894 /** 0x05: Reserved padding bytes, MBZ. */
1895 uint8_t abReserved[3];
1896 /** 0x08: Size of the whole extended attribute.
1897 * Multiple of four is recommended. */
1898 uint32_t cbAttrib;
1899 /** 0x0c: Attribute data union. */
1900 union
1901 {
1902 /** Generic byte view (variable size). */
1903 uint8_t abData[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1904 /** Character set information (@ecma167{4,14.10.3,104}). */
1905 UDFEADATACHARSETINFO CharSetInfo;
1906 /** Alternate permissions (@ecma167{4,14.10.4,105}, @udf260{3.3.4.2,80}).
1907 * @note Not recorded according to the UDF specification. */
1908 UDFEADATAALTPERM AltPerm;
1909 /** File times (@ecma167{4,14.10.5,108}, @udf260{3.3.4.3,80}).
1910 * (This is a bit reminiscent of ISO9660RRIPTF.) */
1911 UDFEADATAFILETIMES FileTimes;
1912 /** Information times (@ecma167{4,14.10.6,109}). */
1913 UDFEADATAINFOTIMES InfoTimes;
1914 /** Device specification (@ecma167{4,14.10.7,110}, @udf260{3.3.4.4,81}). */
1915 UDFEADATADEVICESPEC DeviceSpec;
1916 /** Implementation use (@ecma167{4,14.10.8,111}, @udf260{3.3.4.5,82}). */
1917 UDFEADATAIMPLUSE ImplUse;
1918 /** Application use (@ecma167{4,14.10.9,112}, @udf260{3.3.4.6,88}). */
1919 UDFEADATAAPPUSE AppUse;
1920 } u;
1921} UDFGEA;
1922AssertCompileMemberOffset(UDFGEA, u, 0x0c);
1923/** Pointer to a UDF extended attribute. */
1924typedef UDFGEA *PUDFGEA;
1925/** Pointer to a const UDF extended attribute. */
1926typedef UDFGEA const *PCUDFGEA;
1927
1928
1929/**
1930 * UDF unallocated space entry (@ecma167{4,14.11,113}, @udf260{2.3.7,64}).
1931 *
1932 * @note Total length shall not exceed one logical block.
1933 */
1934typedef struct UDFUNALLOCATEDSPACEENTRY
1935{
1936 /** 0x00: The descriptor tag (UDF_TAG_ID_UNALLOCATED_SPACE_ENTRY). */
1937 UDFTAG Tag;
1938 /** 0x10: ICB Tag. */
1939 UDFICBTAG IcbTag;
1940 /** 0x24: Size of the allocation desciptors in bytes. */
1941 uint32_t cbAllocDescs;
1942 /** 0x28: Allocation desciptors, type given by IcbTag::fFlags. */
1943 union
1944 {
1945 UDFSHORTAD aShortADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1946 UDFLONGAD aLongADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1947 UDFEXTAD aExtADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1948 UDFEXTENTAD SingleAD;
1949 } u;
1950} UDFUNALLOCATEDSPACEENTRY;
1951AssertCompileMemberOffset(UDFUNALLOCATEDSPACEENTRY, u, 0x28);
1952/** Pointer to an UDF unallocated space entry. */
1953typedef UDFUNALLOCATEDSPACEENTRY *PUDFUNALLOCATEDSPACEENTRY;
1954/** Pointer to a const UDF unallocated space entry. */
1955typedef UDFUNALLOCATEDSPACEENTRY const *PCUDFUNALLOCATEDSPACEENTRY;
1956
1957
1958/**
1959 * UDF space bitmap descriptor (SBD) (@ecma167{4,14.12,114}, @udf260{2.3.8,65}).
1960 */
1961typedef struct UDFSPACEBITMAPDESC
1962{
1963 /** 0x00: The descriptor tag (UDF_TAG_ID_SPACE_BITMAP_DESC). */
1964 UDFTAG Tag;
1965 /** 0x10: Number of bits in the bitmap. */
1966 uint32_t cBits;
1967 /** 0x14: The bitmap size in bytes. */
1968 uint32_t cbBitmap;
1969 /** 0x18: The bitmap. */
1970 uint8_t abBitmap[RT_FLEXIBLE_ARRAY];
1971} UDFSPACEBITMAPDESC;
1972AssertCompileMemberOffset(UDFSPACEBITMAPDESC, abBitmap, 0x18);
1973/** Pointer to an UDF space bitmap descriptor. */
1974typedef UDFSPACEBITMAPDESC *PUDFSPACEBITMAPDESC;
1975/** Pointer to a const UDF space bitmap descriptor. */
1976typedef UDFSPACEBITMAPDESC const *PCUDFSPACEBITMAPDESC;
1977
1978
1979/**
1980 * UDF partition integrity descriptor (@ecma167{4,14.3,115}, @udf260{2.3.9,65}).
1981 *
1982 * @note Not needed by UDF.
1983 */
1984typedef struct UDFPARTITIONINTEGRITYDESC
1985{
1986 /** 0x000: The descriptor tag (UDF_TAG_ID_PARTITION_INTEGERITY_DESC). */
1987 UDFTAG Tag;
1988 /** 0x010: ICB Tag. */
1989 UDFICBTAG IcbTag;
1990 /** 0x024: Recording timestamp. */
1991 UDFTIMESTAMP RecordingTimestamp;
1992 /** 0x030: Interity type (UDF_PARTITION_INTEGRITY_TYPE_XXX). */
1993 uint8_t bType;
1994 /** 0x031: Reserved. */
1995 uint8_t abReserved[175];
1996 /** 0x0e0: Implementation identifier. */
1997 UDFENTITYID idImplementation;
1998 /** 0x100: Implementation use data. */
1999 uint8_t abImplementationUse[RT_FLEXIBLE_ARRAY];
2000} UDFPARTITIONINTEGRITYDESC;
2001AssertCompileMemberOffset(UDFPARTITIONINTEGRITYDESC, abImplementationUse, 0x100);
2002/** Pointer to an UDF partition integrity descriptor. */
2003typedef UDFPARTITIONINTEGRITYDESC *PUDFPARTITIONINTEGRITYDESC;
2004/** Pointer to a const UDF partition integrity descriptor. */
2005typedef UDFPARTITIONINTEGRITYDESC const *PCUDFPARTITIONINTEGRITYDESC;
2006
2007
2008/**
2009 * UDF extended file entry (EFE) (@ecma167{4,14.17,120}, @udf260{3.3.5,83}).
2010 *
2011 * @note Total length shall not exceed one logical block.
2012 */
2013typedef struct UDFEXFILEENTRY
2014{
2015 /** 0x00: The descriptor tag (UDF_TAG_ID_EXTENDED_FILE_ENTRY). */
2016 UDFTAG Tag;
2017 /** 0x10: ICB Tag. */
2018 UDFICBTAG IcbTag;
2019 /** 0x24: User ID (UNIX). */
2020 uint32_t uid;
2021 /** 0x28: Group ID (UNIX). */
2022 uint32_t gid;
2023 /** 0x2c: Permission (UDF_PERM_XXX). */
2024 uint32_t fPermissions;
2025 /** 0x30: Number hard links. */
2026 uint16_t cHardlinks;
2027 /** 0x32: Record format (UDF_REC_FMT_XXX). */
2028 uint8_t uRecordFormat;
2029 /** 0x33: Record format (UDF_REC_FMT_XXX). */
2030 uint8_t fRecordDisplayAttribs;
2031 /** 0x34: Record length (in bytes).
2032 * @note Must be zero according to the UDF specification. */
2033 uint32_t cbRecord;
2034 /** 0x38: Information length in bytes (file size). */
2035 uint64_t cbData;
2036 /** 0x40: The size of all streams. Same as cbData if no additional streams. */
2037 uint64_t cbObject;
2038 /** 0x48: Number of logical blocks allocated (for file data). */
2039 uint64_t cLogicalBlocks;
2040 /** 0x50: Time of last access (prior to recording the file entry). */
2041 UDFTIMESTAMP AccessTime;
2042 /** 0x5c: Time of last data modification. */
2043 UDFTIMESTAMP ModificationTime;
2044 /** 0x68: Birth (creation) time. */
2045 UDFTIMESTAMP BirthTime;
2046 /** 0x74: Time of last attribute/status modification. */
2047 UDFTIMESTAMP ChangeTime;
2048 /** 0x80: Checkpoint number (defaults to 1). */
2049 uint32_t uCheckpoint;
2050 /** 0x84: Reserved, MBZ. */
2051 uint32_t uReserved;
2052 /** 0x88: Extended attribute information control block location. */
2053 UDFLONGAD ExtAttribIcb;
2054 /** 0x98: Stream directory information control block location. */
2055 UDFLONGAD StreamDirIcb;
2056 /** 0xa8: Implementation identifier (UDF_ENTITY_ID_FE_IMPLEMENTATION). */
2057 UDFENTITYID idImplementation;
2058 /** 0xc8: Unique ID. */
2059 uint64_t INodeId;
2060 /** 0xd0: Length of extended attributes in bytes, multiple of four. */
2061 uint32_t cbExtAttribs;
2062 /** 0xd4: Length of allocation descriptors in bytes, multiple of four. */
2063 uint32_t cbAllocDescs;
2064 /** 0xd8: Two variable sized fields. First @a cbExtAttribs bytes of extended
2065 * attributes, then @a cbAllocDescs bytes of allocation descriptors. */
2066 uint8_t abExtAttribs[RT_FLEXIBLE_ARRAY];
2067} UDFEXFILEENTRY;
2068AssertCompileMemberOffset(UDFEXFILEENTRY, abExtAttribs, 0xd8);
2069/** Pointer to an UDF extended file entry. */
2070typedef UDFEXFILEENTRY *PUDFEXFILEENTRY;
2071/** Pointer to a const UDF extended file entry. */
2072typedef UDFEXFILEENTRY const *PCUDFEXFILEENTRY;
2073
2074
2075
2076/** @name UDF Volume Recognition Sequence (VRS)
2077 *
2078 * The recognition sequence usually follows the CD001 descriptor sequence at
2079 * sector 16 and is there to indicate that the medium (also) contains a UDF file
2080 * system and which standards are involved.
2081 *
2082 * See @ecma167{2,8,31}, @ecma167{2,9,32}, @udf260{2.1.7,25}.
2083 *
2084 * @{ */
2085
2086/** The type value used for all the extended UDF volume descriptors
2087 * (ISO9660VOLDESCHDR::bDescType). */
2088#define UDF_EXT_VOL_DESC_TYPE 0
2089/** The version value used for all the extended UDF volume descriptors
2090 * (ISO9660VOLDESCHDR::bDescVersion). */
2091#define UDF_EXT_VOL_DESC_VERSION 1
2092
2093/** Standard ID for UDFEXTVOLDESCBEGIN. */
2094#define UDF_EXT_VOL_DESC_STD_ID_BEGIN "BEA01"
2095/** Standard ID for UDFEXTVOLDESCTERM. */
2096#define UDF_EXT_VOL_DESC_STD_ID_TERM "TEA01"
2097/** Standard ID for UDFEXTVOLDESCNSR following ECMA-167 2nd edition. */
2098#define UDF_EXT_VOL_DESC_STD_ID_NSR_02 "NSR02"
2099/** Standard ID for UDFEXTVOLDESCNSR following ECMA-167 3rd edition. */
2100#define UDF_EXT_VOL_DESC_STD_ID_NSR_03 "NSR03"
2101/** Standard ID for UDFEXTVOLDESCBOOT. */
2102#define UDF_EXT_VOL_DESC_STD_ID_BOOT "BOOT2"
2103
2104
2105/**
2106 * Begin UDF extended volume descriptor area (@ecma167{2,9.2,33}).
2107 */
2108typedef struct UDFEXTVOLDESCBEGIN
2109{
2110 /** The volume descriptor header.
2111 * The standard identifier is UDF_EXT_VOL_DESC_STD_ID_BEGIN. */
2112 ISO9660VOLDESCHDR Hdr;
2113 /** Zero payload. */
2114 uint8_t abZero[2041];
2115} UDFEXTVOLDESCBEGIN;
2116AssertCompileSize(UDFEXTVOLDESCBEGIN, 2048);
2117/** Pointer to an UDF extended volume descriptor indicating the start of the
2118 * extended descriptor area. */
2119typedef UDFEXTVOLDESCBEGIN *PUDFEXTVOLDESCBEGIN;
2120/** Pointer to a const UDF extended volume descriptor indicating the start of
2121 * the extended descriptor area. */
2122typedef UDFEXTVOLDESCBEGIN const *PCUDFEXTVOLDESCBEGIN;
2123
2124
2125/**
2126 * Terminate UDF extended volume descriptor area (@ecma167{2,9.3,33}).
2127 */
2128typedef struct UDFEXTVOLDESCTERM
2129{
2130 /** The volume descriptor header.
2131 * The standard identifier is UDF_EXT_VOL_DESC_STD_ID_TERM. */
2132 ISO9660VOLDESCHDR Hdr;
2133 /** Zero payload. */
2134 uint8_t abZero[2041];
2135} UDFEXTVOLDESCTERM;
2136AssertCompileSize(UDFEXTVOLDESCTERM, 2048);
2137/** Pointer to an UDF extended volume descriptor indicating the end of the
2138 * extended descriptor area. */
2139typedef UDFEXTVOLDESCTERM *PUDFEXTVOLDESCTERM;
2140/** Pointer to a const UDF extended volume descriptor indicating the end of
2141 * the extended descriptor area. */
2142typedef UDFEXTVOLDESCTERM const *PCUDFEXTVOLDESCTERM;
2143
2144
2145/**
2146 * UDF NSR extended volume descriptor (@ecma167{3,9.1,50}).
2147 *
2148 * This gives the ECMA standard version.
2149 */
2150typedef struct UDFEXTVOLDESCNSR
2151{
2152 /** The volume descriptor header.
2153 * The standard identifier is UDF_EXT_VOL_DESC_STD_ID_NSR_02, or
2154 * UDF_EXT_VOL_DESC_STD_ID_NSR_03. */
2155 ISO9660VOLDESCHDR Hdr;
2156 /** Zero payload. */
2157 uint8_t abZero[2041];
2158} UDFEXTVOLDESCNSR;
2159AssertCompileSize(UDFEXTVOLDESCNSR, 2048);
2160/** Pointer to an extended volume descriptor giving the UDF standard version. */
2161typedef UDFEXTVOLDESCNSR *PUDFEXTVOLDESCNSR;
2162/** Pointer to a const extended volume descriptor giving the UDF standard version. */
2163typedef UDFEXTVOLDESCNSR const *PCUDFEXTVOLDESCNSR;
2164
2165
2166/**
2167 * UDF boot extended volume descriptor (@ecma167{2,9.4,34}).
2168 *
2169 * @note Probably entirely unused.
2170 */
2171typedef struct UDFEXTVOLDESCBOOT
2172{
2173 /** 0x00: The volume descriptor header.
2174 * The standard identifier is UDF_EXT_VOL_DESC_STD_ID_BOOT. */
2175 ISO9660VOLDESCHDR Hdr;
2176 /** 0x07: Reserved/alignment, MBZ. */
2177 uint8_t bReserved1;
2178 /** 0x08: The architecture type. */
2179 UDFENTITYID ArchType;
2180 /** 0x28: The boot identifier. */
2181 UDFENTITYID idBoot;
2182 /** 0x48: Logical sector number of load the boot loader from. */
2183 uint32_t offBootExtent;
2184 /** 0x4c: Number of bytes to load. */
2185 uint32_t cbBootExtent;
2186 /** 0x50: The load address (in memory). */
2187 uint64_t uLoadAddress;
2188 /** 0x58: The start address (in memory). */
2189 uint64_t uStartAddress;
2190 /** 0x60: The descriptor creation timestamp. */
2191 UDFTIMESTAMP CreationTimestamp;
2192 /** 0x6c: Flags. */
2193 uint16_t fFlags;
2194 /** 0x6e: Reserved, MBZ. */
2195 uint8_t abReserved2[32];
2196 /** 0x8e: Implementation use. */
2197 uint8_t abBootUse[1906];
2198} UDFEXTVOLDESCBOOT;
2199AssertCompileSize(UDFEXTVOLDESCBOOT, 2048);
2200/** Pointer to a boot extended volume descriptor. */
2201typedef UDFEXTVOLDESCBOOT *PUDFEXTVOLDESCBOOT;
2202/** Pointer to a const boot extended volume descriptor. */
2203typedef UDFEXTVOLDESCBOOT const *PCUDFEXTVOLDESCBOOT;
2204
2205/** @} */
2206
2207
2208/** @} */
2209
2210#endif
2211
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette