VirtualBox

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

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

iprt: udf updates

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 81.9 KB
Line 
1/* $Id: udf.h 69029 2017-10-10 20:33:05Z 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 number (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: Reserved \#2. */
850 uint8_t abReserved2[24];
851} UDFPARTMAPTYPE2;
852AssertCompileSize(UDFPARTMAPTYPE2, 64);
853/** Pointer to a type 2 partition map. */
854typedef UDFPARTMAPTYPE2 *PUDFPARTMAPTYPE2;
855/** Pointer to a const type 2 partition map1. */
856typedef UDFPARTMAPTYPE2 const *PCUDFPARTMAPTYPE2;
857
858
859/**
860 * UDF unallocated space descriptor (USD) (@ecma167{3,10.8,61}, @udf260{2.2.5,32}).
861 *
862 * @note Variable length.
863 */
864typedef struct UDFUNALLOCATEDSPACEDESC
865{
866 /** 0x00: The descriptor tag (UDF_TAG_ID_UNALLOCATED_SPACE_DESC). */
867 UDFTAG Tag;
868 /** 0x10: Volume descriptor sequence number. */
869 uint32_t uVolumeDescSeqNo;
870 /** 0x14: Number of allocation descriptors in the array below. */
871 uint32_t cAllocationDescriptors;
872 /** 0x18: Allocation descriptors (variable length). */
873 UDFEXTENTAD aAllocationDescriptors[RT_FLEXIBLE_ARRAY];
874} UDFUNALLOCATEDSPACEDESC;
875AssertCompileMemberOffset(UDFUNALLOCATEDSPACEDESC, aAllocationDescriptors, 0x18);
876/** Pointer to an UDF unallocated space descriptor. */
877typedef UDFUNALLOCATEDSPACEDESC *PUDFUNALLOCATEDSPACEDESC;
878/** Pointer to a const UDF unallocated space descriptor. */
879typedef UDFUNALLOCATEDSPACEDESC const *PCUDFUNALLOCATEDSPACEDESC;
880
881
882/**
883 * UDF terminating descriptor (@ecma167{3,10.9,62}, @ecma167{4,14.2,62}).
884 */
885typedef struct UDFTERMINATINGDESC
886{
887 /** 0x00: The descriptor tag (UDF_TAG_ID_TERMINATING_DESC). */
888 UDFTAG Tag;
889 /** 0x10: Reserved, MBZ. */
890 uint8_t abReserved[496];
891} UDFTERMINATINGDESC;
892/** Pointer to an UDF terminating descriptor. */
893typedef UDFTERMINATINGDESC *PUDFTERMINATINGDESC;
894/** Pointer to a const UDF terminating descriptor. */
895typedef UDFTERMINATINGDESC const *PCUDFTERMINATINGDESC;
896
897
898/**
899 * UDF logical volume integrity descriptor (LVID) (@ecma167{3,10.10,62},
900 * @udf260{2.2.6,32}).
901 */
902typedef struct UDFLOGICALVOLINTEGRITYDESC
903{
904 /** 0x00: The descriptor tag (UDF_TAG_ID_TERMINATING_DESC). */
905 UDFTAG Tag;
906 /** 0x10: Recording timestamp. */
907 UDFTIMESTAMP RecordingTimestamp;
908 /** 0x1c: Integrity type (UDF_LVID_TYPE_XXX). */
909 uint32_t uIntegrityType;
910 /** 0x20: The next integrity extent. */
911 UDFEXTENTAD NextIntegrityExtent;
912 /** 0x28: Number of partitions. */
913 uint32_t cPartitions;
914 /** 0x2c: Length of implementation use. */
915 uint32_t cbImplementationUse;
916 /**
917 * There are two tables each @a cPartitions in size. The first is the free
918 * space table. The second the size table.
919 *
920 * Following these tables there are @a cbImplementationUse bytes of space for
921 * the implementation to use.
922 */
923 uint32_t aTables[RT_FLEXIBLE_ARRAY];
924} UDFLOGICALVOLINTEGRITYDESC;
925AssertCompileMemberOffset(UDFLOGICALVOLINTEGRITYDESC, cbImplementationUse, 0x2c);
926AssertCompileMemberOffset(UDFLOGICALVOLINTEGRITYDESC, aTables, 0x30);
927/** Pointer to an UDF logical volume integrity descriptor. */
928typedef UDFLOGICALVOLINTEGRITYDESC *PUDFLOGICALVOLINTEGRITYDESC;
929/** Pointer to a const UDF logical volume integrity descriptor. */
930typedef UDFLOGICALVOLINTEGRITYDESC const *PCUDFLOGICALVOLINTEGRITYDESC;
931
932/** @name UDF_LVID_TYPE_XXX - Integirty types.
933 * @{ */
934#define UDF_LVID_TYPE_OPEN UINT32_C(0x00000000)
935#define UDF_LVID_TYPE_CLOSE UINT32_C(0x00000001)
936/** @} */
937
938/**
939 * UDF file set descriptor (FSD) (@ecma167{4,14.1,86}, @udf260{2.3.2,54}).
940 */
941typedef struct UDFFILESETDESC
942{
943 /** 0x000: The descriptor tag (UDF_TAG_ID_FILE_SET_DESC). */
944 UDFTAG Tag;
945 /** 0x010: Recording timestamp. */
946 UDFTIMESTAMP RecordingTimestamp;
947 /** 0x01c: Interchange level. */
948 uint16_t uInterchangeLevel;
949 /** 0x01e: Maximum interchange level. */
950 uint16_t uMaxInterchangeLevel;
951 /** 0x020: Character set bitmask (aka list). Each bit correspond to a
952 * character set number. */
953 uint32_t fCharacterSets;
954 /** 0x024: Maximum character set bitmask (aka list). */
955 uint32_t fMaxCharacterSets;
956 /** 0x028: File set number. */
957 uint32_t uFileSetNo;
958 /** 0x02c: File set descriptor number. */
959 uint32_t uFileSetDescNo;
960 /** 0x030: Logical volume identifier character set. */
961 UDFCHARSPEC LogicalVolumeIDCharSet;
962 /** 0x070: Logical volume identifier string. */
963 UDFDSTRING achLogicalVolumeID[128];
964 /** 0x0e0: File set character set. */
965 UDFCHARSPEC FileSetCharSet;
966 /** 0x130: Identifier string for this file set. */
967 UDFDSTRING achFileSetID[32];
968 /** 0x150: Names a root file containing copyright info. Optional. */
969 UDFDSTRING achCopyrightFile[32];
970 /** 0x170: Names a root file containing an abstract for the file set. Optional. */
971 UDFDSTRING achAbstractFile[32];
972 /** 0x190: Root directory information control block location (ICB).
973 * An ICB is a sequence made up of UDF_TAG_ID_FILE_ENTRY,
974 * UDF_TAG_ID_INDIRECT_ENTRY, and UDF_TAG_ID_TERMINAL_ENTRY descriptors. */
975 UDFLONGAD RootDirIcb;
976 /** 0x1a0: Domain identifier (UDF_ENTITY_FSD_LVD_DOMAIN). Optional. */
977 UDFENTITYID idDomain;
978 /** 0x1c0: Next location with file set descriptors location, 0 if none. */
979 UDFLONGAD NextExtent;
980 /** 0x1d0: Location of the system stream directory associated with the
981 * file set. Optional. */
982 UDFLONGAD SystemStreamDirIcb;
983 /** 0x1e0: Reserved, MBZ. */
984 uint8_t abReserved[32];
985} UDFFILESETDESC;
986AssertCompileSize(UDFFILESETDESC, 512);
987/** Pointer to an UDF file set descriptor. */
988typedef UDFFILESETDESC *PUDFFILESETDESC;
989/** Pointer to a const UDF file set descriptor. */
990typedef UDFFILESETDESC const *PCUDFFILESETDESC;
991
992
993/**
994 * UDF file identifier descriptor (FID) (@ecma167{4,14.4,91}, @udf260{2.3.4,57}).
995 */
996typedef struct UDFFILEIDDESC
997{
998 /** 0x00: The descriptor tag (UDF_TAG_ID_FILE_ID_DESC). */
999 UDFTAG Tag;
1000 /** 0x10: File version number (1..32767). Always set to 1. */
1001 uint16_t uVersion;
1002 /** 0x12: File characteristics (UDF_FILE_FLAGS_XXX). */
1003 uint8_t fFlags;
1004 /** 0x13: File identifier (name) length. */
1005 uint8_t cbName;
1006 /** 0x14: Location of an information control block describing the file.
1007 * Can be null if marked deleted. The implementation defined part of
1008 * this contains additional flags and a unique ID. */
1009 UDFLONGAD Icb;
1010 /** 0x24: Length of implementation use field (in bytes). This can be zero.
1011 *
1012 * It can be used to prevent the following FID from spanning a block
1013 * boundrary, in which case it will be 32 bytes or more, and the it will
1014 * start with an UDFENTITYID identifying who last wrote it.
1015 *
1016 * The latter padding fun is a requirement from write-once media. */
1017 uint16_t cbImplementationUse;
1018 /** 0x26: Two variable sized fields followed by padding to make the
1019 * actual structure size 4 byte aligned. The first field in an
1020 * implementation use field with length given by @a cbImplementationUse.
1021 * After that is a d-string field with the name of the file, length
1022 * specified by @a cbName. */
1023 uint8_t abImplementationUse[RT_FLEXIBLE_ARRAY];
1024} UDFFILEIDDESC;
1025AssertCompileMemberOffset(UDFFILEIDDESC, fFlags, 0x12);
1026AssertCompileMemberOffset(UDFFILEIDDESC, cbName, 0x13);
1027AssertCompileMemberOffset(UDFFILEIDDESC, Icb, 0x14);
1028AssertCompileMemberOffset(UDFFILEIDDESC, abImplementationUse, 0x26);
1029/** Pointer to an UDF file set descriptor */
1030typedef UDFFILEIDDESC *PUDFFILEIDDESC;
1031/** Pointer to a const UDF file set descriptor */
1032typedef UDFFILEIDDESC const *PCUDFFILEIDDESC;
1033
1034/** Get the pointer to the name field. */
1035#define UDFFILEIDDESC_2_NAME(a_pFid) ((char *)(&(a_pFid)->abImplementationUse[(a_pFid)->cbImplementationUse]))
1036/** Calculates the total size the size of a record. */
1037#define UDFFILEIDDESC_CALC_SIZE_EX(cbImplementationUse, cbName) \
1038 RT_ALIGN_Z(RT_UOFFSETOF(UDFFILEIDDESC, abImplementationUse) + cbImplementationUse + cbName, 4)
1039/** Gets the actual size of a record. */
1040#define UDFFILEIDDESC_GET_SIZE(a_pFid) UDFFILEIDDESC_CALC_SIZE_EX((a_pFid)->cbImplementationUse + (a_pFid)->cbName)
1041
1042/** @name UDF_FILE_FLAGS_XXX
1043 * @{ */
1044/** Existence - Hide the file from the user. */
1045#define UDF_FILE_FLAGS_HIDDEN UINT8_C(0x01)
1046/** Directory - Indicates a directory as apposed to some kind of file or symlink or something (0). */
1047#define UDF_FILE_FLAGS_DIRECTORY UINT8_C(0x02)
1048/** Deleted - Indicate that the file has been deleted. Assoicated descriptors may still be valid, though. */
1049#define UDF_FILE_FLAGS_DELETED UINT8_C(0x04)
1050/** Parent - Indicate the ICB field refers to the parent directory (or mabye
1051 * a file in case of streaming directory). */
1052#define UDF_FILE_FLAGS_PARENT UINT8_C(0x08)
1053/** Metadata - Zero means user data, one means implementation specific metadata.
1054 * Only allowed used in stream directory. */
1055#define UDF_FILE_FLAGS_METADATA UINT8_C(0x10)
1056/** Reserved bits that should be zer. */
1057#define UDF_FILE_FLAGS_RESERVED_MASK UINT8_C(0xe0)
1058/** @} */
1059
1060
1061/**
1062 * UDF allocation extent descriptor (@ecma167{4,14.5,93}, @udf260{2.3.11,67}).
1063 */
1064typedef struct UDFALLOCATIONEXTENTDESC
1065{
1066 /** 0x00: The descriptor tag (UDF_TAG_ID_ALLOCATION_EXTENT_DESC). */
1067 UDFTAG Tag;
1068 /** 0x10: Previous allocation extent location (logical block in current
1069 * partition). */
1070 uint32_t offPrevExtent;
1071 /** 0x14: Size of the following allocation descriptors (in bytes). */
1072 uint32_t cbAllocDescs;
1073 /** 0x18: Allocation descriptors. */
1074 union
1075 {
1076 UDFSHORTAD aShortADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1077 UDFLONGAD aLongADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1078 UDFEXTAD aExtADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1079 } u;
1080} UDFALLOCATIONEXTENTDESC;
1081AssertCompileMemberOffset(UDFALLOCATIONEXTENTDESC, u, 0x18);
1082/** Pointer to an UDF allocation extent descriptor. */
1083typedef UDFALLOCATIONEXTENTDESC *PUDFALLOCATIONEXTENTDESC;
1084/** Pointer to a const UDF allocation extent descriptor. */
1085typedef UDFALLOCATIONEXTENTDESC const *PCUDFALLOCATIONEXTENTDESC;
1086
1087/**
1088 * UDF information control block tag (@ecma167{4,14.6,93}, @udf260{2.3.5,60}).
1089 */
1090typedef struct UDFICBTAG
1091{
1092 /** 0x00: Number of direct entries in this ICB prior to this one. */
1093 uint32_t cEntiresBeforeThis;
1094 /** 0x04: ICB hierarchy building strategy type (UDF_ICB_STRATEGY_TYPE_XXX). */
1095 uint16_t uStrategyType;
1096 /** 0x06: Type specific parameters. */
1097 uint8_t abStrategyParams[2];
1098 /** 0x08: Max number of direct and indirect entries that MAY be recorded in this ICB. */
1099 uint16_t cMaxEntries;
1100 /** 0x0a: Reserved, MBZ. */
1101 uint8_t bReserved;
1102 /** 0x0b: File type (UDF_FILE_TYPE_XXX). */
1103 uint8_t bFileType;
1104 /** 0x0c: Parent ICB location. */
1105 UDFLBADDR ParentIcb;
1106 /** 0x12: Parent ICB location (UDF_ICB_FLAGS_XXX). */
1107 uint16_t fFlags;
1108} UDFICBTAG;
1109AssertCompileSize(UDFICBTAG, 20);
1110typedef UDFICBTAG *PUDFICBTAG;
1111typedef UDFICBTAG const *PCUDFICBTAG;
1112
1113/** @name UDF_ICB_STRATEGY_TYPE_XXX - ICB hierarchy building strategies
1114 *
1115 * See @ecma167{4,14.6.2,94}, @udf260{6.6,121}
1116 *
1117 * @{ */
1118/** Strategy not specified. */
1119#define UDF_ICB_STRATEGY_TYPE_NOT_SPECIFIED UINT16_C(0x0000)
1120/** See @ecma167{4,A.2,129}. */
1121#define UDF_ICB_STRATEGY_TYPE_1 UINT16_C(0x0001)
1122/** See @ecma167{4,A.3,131}. */
1123#define UDF_ICB_STRATEGY_TYPE_2 UINT16_C(0x0002)
1124/** See @ecma167{4,A.4,131}. */
1125#define UDF_ICB_STRATEGY_TYPE_3 UINT16_C(0x0003)
1126/** See @ecma167{4,A.5,131}. */
1127#define UDF_ICB_STRATEGY_TYPE_4 UINT16_C(0x0004)
1128/** Defined by the UDF spec, see @udf260{6.6,121}. */
1129#define UDF_ICB_STRATEGY_TYPE_4096 UINT16_C(0x1000)
1130/** @} */
1131
1132/** @name UDF_ICB_FLAGS_XXX - ICB flags
1133 *
1134 * See @ecma167{4,14.6.8,95}, @udf260{2.3.5.4,61}
1135 *
1136 * @{ */
1137/** Using UDFSHORTAD. */
1138#define UDF_ICB_FLAGS_AD_TYPE_SHORT UINT16_C(0x0000)
1139/** Using UDFLONGAD. */
1140#define UDF_ICB_FLAGS_AD_TYPE_LONG UINT16_C(0x0001)
1141/** Using UDFEXTAD. */
1142#define UDF_ICB_FLAGS_AD_TYPE_EXTENDED UINT16_C(0x0002)
1143/** File content is embedded in the allocation descriptor area. */
1144#define UDF_ICB_FLAGS_AD_TYPE_EMBEDDED UINT16_C(0x0003)
1145/** Allocation type mask. */
1146#define UDF_ICB_FLAGS_AD_TYPE_MASK UINT16_C(0x0007)
1147/** Set on directories that are sorted (according to @ecma167{4,8.6.1,78}).
1148 * @note Directories are never sorted in UDF. */
1149#define UDF_ICB_FLAGS_SORTED_DIRECTORY UINT16_C(0x0008)
1150/** Not relocatable. */
1151#define UDF_ICB_FLAGS_NON_RELOCATABLE UINT16_C(0x0010)
1152/** Indicate that the file needs backing up (DOS attribute). */
1153#define UDF_ICB_FLAGS_ARCHIVE UINT16_C(0x0020)
1154/** Set UID bit (UNIX). */
1155#define UDF_ICB_FLAGS_SET_UID UINT16_C(0x0040)
1156/** Set GID bit (UNIX). */
1157#define UDF_ICB_FLAGS_SET_GID UINT16_C(0x0080)
1158/** Set sticky bit (UNIX). */
1159#define UDF_ICB_FLAGS_STICKY UINT16_C(0x0100)
1160/** Extents are contiguous. */
1161#define UDF_ICB_FLAGS_CONTIGUOUS UINT16_C(0x0200)
1162/** System bit, reserved for implementation use. */
1163#define UDF_ICB_FLAGS_SYSTEM UINT16_C(0x0400)
1164/** Data has been transformed in some way.
1165 * @note UDF shall not set this bit. */
1166#define UDF_ICB_FLAGS_TRANSFORMED UINT16_C(0x0800)
1167/** Directory may contain multi-versioned files.
1168 * @note UDF shall not set this bit. */
1169#define UDF_ICB_FLAGS_MULTI_VERSIONS UINT16_C(0x1000)
1170/** Is a stream in a stream directory. */
1171#define UDF_ICB_FLAGS_STREAM UINT16_C(0x2000)
1172/** Reserved mask. */
1173#define UDF_ICB_FLAGS_RESERVED_MASK UINT16_C(0xc000)
1174/** @} */
1175
1176/** @name UDF_FILE_TYPE_XXX - File types
1177 *
1178 * See @ecma167{4,14.6.6,94}, @udf260{2.3.5.2,60}
1179 *
1180 * @{ */
1181#define UDF_FILE_TYPE_NOT_SPECIFIED UINT8_C(0x00) /**< Not specified by this field. */
1182#define UDF_FILE_TYPE_UNALLOCATED_SPACE_ENTRY UINT8_C(0x01)
1183#define UDF_FILE_TYPE_PARTITION_INTEGRITY_ENTRY UINT8_C(0x02)
1184#define UDF_FILE_TYPE_INDIRECT_ENTRY UINT8_C(0x03)
1185#define UDF_FILE_TYPE_DIRECTORY UINT8_C(0x04)
1186#define UDF_FILE_TYPE_REGULAR_FILE UINT8_C(0x05)
1187#define UDF_FILE_TYPE_BLOCK_DEVICE UINT8_C(0x06)
1188#define UDF_FILE_TYPE_CHARACTER_DEVICE UINT8_C(0x07)
1189#define UDF_FILE_TYPE_EXTENDED_ATTRIBUTES UINT8_C(0x08)
1190#define UDF_FILE_TYPE_FIFO UINT8_C(0x09)
1191#define UDF_FILE_TYPE_SOCKET UINT8_C(0x0a)
1192#define UDF_FILE_TYPE_TERMINAL_ENTRY UINT8_C(0x0b)
1193#define UDF_FILE_TYPE_SYMBOLIC_LINK UINT8_C(0x0c)
1194#define UDF_FILE_TYPE_STREAM_DIRECTORY UINT8_C(0x0d)
1195#define UDF_FILE_TYPE_VAT UINT8_C(0xf8)
1196#define UDF_FILE_TYPE_REAL_TIME_FILE UINT8_C(0xf9)
1197#define UDF_FILE_TYPE_METADATA_FILE UINT8_C(0xfa)
1198#define UDF_FILE_TYPE_METADATA_MIRROR_FILE UINT8_C(0xfb)
1199#define UDF_FILE_TYPE_METADATA_BITMAP_FILE UINT8_C(0xfc)
1200/** @} */
1201
1202
1203/**
1204 * UDF ICB header (derived structure).
1205 */
1206typedef struct UDFICBHDR
1207{
1208 /** 0x00: The descriptor tag (UDF_TAG_ID_INDIRECT_ENTRY). */
1209 UDFTAG Tag;
1210 /** 0x10: ICB Tag. */
1211 UDFICBTAG IcbTag;
1212} UDFICBHDR;
1213AssertCompileSize(UDFICBHDR, 36);
1214/** Pointer to an UDF ICB header. */
1215typedef UDFICBHDR *PUDFICBHDR;
1216/** Pointer to a const UDF ICB header. */
1217typedef UDFICBHDR const *PCUDFICBHDR;
1218
1219
1220/**
1221 * UDF indirect entry (@ecma167{4,14.7,96}).
1222 */
1223typedef struct UDFINDIRECTENTRY
1224{
1225 /** 0x00: The descriptor tag (UDF_TAG_ID_INDIRECT_ENTRY). */
1226 UDFTAG Tag;
1227 /** 0x10: ICB Tag. */
1228 UDFICBTAG IcbTag;
1229 /** 0x24: Indirect ICB location. */
1230 UDFLONGAD IndirectIcb;
1231} UDFINDIRECTENTRY;
1232AssertCompileSize(UDFINDIRECTENTRY, 52);
1233/** Pointer to an UDF indirect entry. */
1234typedef UDFINDIRECTENTRY *PUDFINDIRECTENTRY;
1235/** Pointer to a const UDF indirect entry. */
1236typedef UDFINDIRECTENTRY const *PCUDFINDIRECTENTRY;
1237
1238
1239/**
1240 * UDF terminal entry (@ecma167{4,14.8,97}).
1241 */
1242typedef struct UDFTERMINALENTRY
1243{
1244 /** 0x00: The descriptor tag (UDF_TAG_ID_TERMINAL_ENTRY). */
1245 UDFTAG Tag;
1246 /** 0x10: ICB Tag (UDF_FILE_TYPE_TERMINAL_ENTRY). */
1247 UDFICBTAG IcbTag;
1248} UDFTERMINALENTRY;
1249AssertCompileSize(UDFTERMINALENTRY, 36);
1250/** Pointer to an UDF terminal entry. */
1251typedef UDFTERMINALENTRY *PUDFTERMINALENTRY;
1252/** Pointer to a const UDF terminal entry. */
1253typedef UDFTERMINALENTRY const *PCUDFTERMINALENTRY;
1254
1255
1256/**
1257 * UDF file entry (FE) (@ecma167{4,14.8,97}, @udf260{2.3.6,62}).
1258 *
1259 * @note Total length shall not exceed one logical block.
1260 */
1261typedef struct UDFFILEENTRY
1262{
1263 /** 0x00: The descriptor tag (UDF_TAG_ID_FILE_ENTRY). */
1264 UDFTAG Tag;
1265 /** 0x10: ICB Tag. */
1266 UDFICBTAG IcbTag;
1267 /** 0x24: User ID (UNIX). */
1268 uint32_t uid;
1269 /** 0x28: Group ID (UNIX). */
1270 uint32_t gid;
1271 /** 0x2c: Permission (UDF_PERM_XXX). */
1272 uint32_t fPermissions;
1273 /** 0x30: Number hard links. */
1274 uint16_t cHardlinks;
1275 /** 0x32: Record format (UDF_REC_FMT_XXX). */
1276 uint8_t uRecordFormat;
1277 /** 0x33: Record format (UDF_REC_ATTR_XXX). */
1278 uint8_t fRecordDisplayAttribs;
1279 /** 0x34: Record length (in bytes).
1280 * @note Must be zero according to the UDF specification. */
1281 uint32_t cbRecord;
1282 /** 0x38: Information length in bytes (file size). */
1283 uint64_t cbData;
1284 /** 0x40: Number of logical blocks allocated (for file data). */
1285 uint64_t cLogicalBlocks;
1286 /** 0x48: Time of last access (prior to recording the file entry). */
1287 UDFTIMESTAMP AccessTime;
1288 /** 0x54: Time of last data modification. */
1289 UDFTIMESTAMP ModificationTime;
1290 /** 0x60: Time of last attribute/status modification. */
1291 UDFTIMESTAMP ChangeTime;
1292 /** 0x6c: Checkpoint number (defaults to 1). */
1293 uint32_t uCheckpoint;
1294 /** 0x70: Extended attribute information control block location. */
1295 UDFLONGAD ExtAttribIcb;
1296 /** 0x80: Implementation identifier ("*Developer ID"). */
1297 UDFENTITYID idImplementation;
1298 /** 0xa0: Unique ID. */
1299 uint64_t INodeId;
1300 /** 0xa8: Length of extended attributes in bytes, multiple of four. */
1301 uint32_t cbExtAttribs;
1302 /** 0xac: Length of allocation descriptors in bytes, multiple of four. */
1303 uint32_t cbAllocDescs;
1304 /** 0xb0: Two variable sized fields. First @a cbExtAttribs bytes of extended
1305 * attributes, then @a cbAllocDescs bytes of allocation descriptors. */
1306 uint8_t abExtAttribs[RT_FLEXIBLE_ARRAY];
1307} UDFFILEENTRY;
1308AssertCompileMemberOffset(UDFFILEENTRY, abExtAttribs, 0xb0);
1309/** Pointer to an UDF file entry. */
1310typedef UDFFILEENTRY *PUDFFILEENTRY;
1311/** Pointer to a const UDF file entry. */
1312typedef UDFFILEENTRY const *PCUDFFILEENTRY;
1313
1314/** @name UDF_PERM_XXX - UDFFILEENTRY::fPermissions
1315 * See @ecma167{4,14.9.5,99}.
1316 * @{ */
1317#define UDF_PERM_OTH_EXEC UINT32_C(0x00000001)
1318#define UDF_PERM_OTH_WRITE UINT32_C(0x00000002)
1319#define UDF_PERM_OTH_READ UINT32_C(0x00000004)
1320#define UDF_PERM_OTH_ATTRIB UINT32_C(0x00000008)
1321#define UDF_PERM_OTH_DELETE UINT32_C(0x00000010)
1322#define UDF_PERM_OTH_MASK UINT32_C(0x0000001f)
1323
1324#define UDF_PERM_GRP_EXEC UINT32_C(0x00000020)
1325#define UDF_PERM_GRP_WRITE UINT32_C(0x00000040)
1326#define UDF_PERM_GRP_READ UINT32_C(0x00000080)
1327#define UDF_PERM_GRP_ATTRIB UINT32_C(0x00000100)
1328#define UDF_PERM_GRP_DELETE UINT32_C(0x00000200)
1329#define UDF_PERM_GRP_MASK UINT32_C(0x000003e0)
1330
1331#define UDF_PERM_USR_EXEC UINT32_C(0x00000400)
1332#define UDF_PERM_USR_WRITE UINT32_C(0x00000800)
1333#define UDF_PERM_USR_READ UINT32_C(0x00001000)
1334#define UDF_PERM_USR_ATTRIB UINT32_C(0x00002000)
1335#define UDF_PERM_USR_DELETE UINT32_C(0x00004000)
1336#define UDF_PERM_USR_MASK UINT32_C(0x00007c00)
1337
1338#define UDF_PERM_USR_RESERVED_MASK UINT32_C(0xffff8000)
1339/** @} */
1340
1341/** @name UDF_REC_FMT_XXX - Record format.
1342 * See @ecma167{4,14.9.7,100}.
1343 * @{ */
1344/** Not record format specified.
1345 * @note The only allowed value according to the UDF specification. */
1346#define UDF_REC_FMT_NOT_SPECIFIED UINT8_C(0x00)
1347/** @} */
1348
1349/** @name UDF_REC_ATTR_XXX - Record display attributes.
1350 * See @ecma167{4,14.9.8,100}.
1351 * @{ */
1352/** Manner of record display not specified.
1353 * @note The only allowed value according to the UDF specification. */
1354#define UDF_REC_ATTR_NOT_SPECIFIED UINT8_C(0x00)
1355/** @} */
1356
1357
1358/**
1359 * UDF extended attribute header descriptor (@ecma167{4,14.10.1,102},
1360 * @udf260{3.3.4,79}).
1361 */
1362typedef struct UDFEXTATTRIBHDRDESC
1363{
1364 /** 0x00: The descriptor tag (UDF_TAG_ID_EXTENDED_ATTRIB_HDR_DESC). */
1365 UDFTAG Tag;
1366 /** 0x10: Implementation attributes location (byte offset) into the EA space.
1367 * This typically set to UINT32_MAX if not present, though any value larger
1368 * than the EA space will do. */
1369 uint32_t offImplementationAttribs;
1370 /** 0x14: Application attributes location (byte offset) into the EA space.
1371 * This typically set to UINT32_MAX if not present, though any value larger
1372 * than the EA space will do. */
1373 uint32_t offApplicationAttribs;
1374} UDFEXTATTRIBHDRDESC;
1375AssertCompileSize(UDFEXTATTRIBHDRDESC, 24);
1376/** Pointer to an UDF extended attribute header descriptor. */
1377typedef UDFEXTATTRIBHDRDESC *PUDFEXTATTRIBHDRDESC;
1378/** Pointer to a const UDF extended attribute header descriptor. */
1379typedef UDFEXTATTRIBHDRDESC const *PCUDFEXTATTRIBHDRDESC;
1380
1381/**
1382 * UDF character set info EA data (@ecma167{4,14.10.3,104}).
1383 *
1384 * Not needed by UDF.
1385 */
1386typedef struct UDFEADATACHARSETINFO
1387{
1388 /** 0x00/0x0c: The length of the escape sequences (in bytes). */
1389 uint32_t cbEscSeqs;
1390 /** 0x04/0x10: The character set type (UDF_CHAR_SET_TYPE_XXX). */
1391 uint8_t bType;
1392 /** 0x05/0x11: Escape sequences. */
1393 uint8_t abEscSeqs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1394} UDFEADATACHARSETINFO;
1395/** Pointer to UDF character set info EA data. */
1396typedef UDFEADATACHARSETINFO *PUDFEADATACHARSETINFO;
1397/** Pointer to const UDF character set info EA data. */
1398typedef UDFEADATACHARSETINFO const *PCUDFEADATACHARSETINFO;
1399/** UDFGEA::uAttribType value for UDFEADATACHARSETINFO.*/
1400#define UDFEADATACHARSETINFO_ATTRIB_TYPE UINT32_C(0x00000001)
1401/** UDFGEA::uAttribSubtype value for UDFEADATACHARSETINFO. */
1402#define UDFEADATACHARSETINFO_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1403
1404/**
1405 * UDF alternate permissions EA data (@ecma167{4,14.10.4,105}, @udf260{3.3.4.2,80}).
1406 * @note Not recorded according to the UDF specification.
1407 */
1408typedef struct UDFEADATAALTPERM
1409{
1410 /** 0x00/0x0c: Alternative owner ID. */
1411 uint16_t idOwner;
1412 /** 0x02/0x0e: Alternative group ID. */
1413 uint16_t idGroup;
1414 /** 0x04/0x10: Alternative permissions. */
1415 uint16_t fPermission;
1416} UDFEADATAALTPERM;
1417/** Pointer to UDF alternative permissions EA data. */
1418typedef UDFEADATAALTPERM *PUDFEADATAALTPERM;
1419/** Pointer to const UDF alternative permissions EA data. */
1420typedef UDFEADATAALTPERM const *PCUDFEADATAALTPERM;
1421/** UDFGEA::uAttribType value for UDFEADATAALTPERM. */
1422#define UDFEADATAALTPERM_ATTRIB_TYPE UINT32_C(0x00000003)
1423/** UDFGEA::uAttribSubtype value for UDFEADATAALTPERM. */
1424#define UDFEADATAALTPERM_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1425
1426/**
1427 * UDF file times EA data (@ecma167{4,14.10.5,108}, @udf260{3.3.4.3,80}).
1428 * (This is a bit reminiscent of ISO9660RRIPTF.)
1429 */
1430typedef struct UDFEADATAFILETIMES
1431{
1432 /** 0x00/0x0c: Timestamp length. */
1433 uint32_t cbTimestamps;
1434 /** 0x04/0x10: Indicates which timestamps are present
1435 * (UDF_FILE_TIMES_EA_F_XXX). */
1436 uint32_t fFlags;
1437 /** 0x08/0x14: Timestamps. */
1438 UDFTIMESTAMP aTimestamps[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1439} UDFEADATAFILETIMES;
1440/** Pointer to UDF file times EA data. */
1441typedef UDFEADATAFILETIMES *PUDFEADATAFILETIMES;
1442/** Pointer to const UDF file times EA data. */
1443typedef UDFEADATAFILETIMES const *PCUDFEADATAFILETIMES;
1444/** UDFGEA::uAttribType value for UDFEADATAFILETIMES. */
1445#define UDFEADATAFILETIMES_ATTRIB_TYPE UINT32_C(0x00000005)
1446/** UDFGEA::uAttribSubtype value for UDFEADATAFILETIMES. */
1447#define UDFEADATAFILETIMES_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1448
1449/** @name UDF_FILE_TIMES_EA_F_XXX - File times existence flags.
1450 * See @ecma167{4,14.10.5.6,109}
1451 * @{ */
1452#define UDF_FILE_TIMES_EA_F_BIRTH UINT8_C(0x01) /**< Birth (creation) timestamp is recorded. */
1453#define UDF_FILE_TIMES_EA_F_DELETE UINT8_C(0x04) /**< Deletion timestamp is recorded. */
1454#define UDF_FILE_TIMES_EA_F_EFFECTIVE UINT8_C(0x08) /**< Effective timestamp is recorded. */
1455#define UDF_FILE_TIMES_EA_F_BACKUP UINT8_C(0x20) /**< Backup timestamp is recorded. */
1456#define UDF_FILE_TIMES_EA_F_RESERVED_MASK UINT8_C(0xd2)
1457/** @} */
1458
1459/**
1460 * UDF information times EA data (@ecma167{4,14.10.6,109}).
1461 */
1462typedef struct UDFEADATAINFOTIMES
1463{
1464 /** 0x00/0x0c: Timestamp length. */
1465 uint32_t cbTimestamps;
1466 /** 0x04/0x10: Indicates which timestamps are present
1467 * (UDF_INFO_TIMES_EA_F_XXX). */
1468 uint32_t fFlags;
1469 /** 0x08/0x14: Timestamps. */
1470 UDFTIMESTAMP aTimestamps[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1471} UDFEADATAINFOTIMES;
1472/** Pointer to UDF information times EA data. */
1473typedef UDFEADATAINFOTIMES *PUDFEADATAINFOTIMES;
1474/** Pointer to const UDF information times EA data. */
1475typedef UDFEADATAINFOTIMES const *PCUDFEADATAINFOTIMES;
1476/** UDFGEA::uAttribType value for UDFEADATAINFOTIMES. */
1477#define UDFEADATAINFOTIMES_ATTRIB_TYPE UINT32_C(0x00000006)
1478/** UDFGEA::uAttribSubtype value for UDFEADATAINFOTIMES. */
1479#define UDFEADATAINFOTIMES_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1480
1481/** @name UDF_INFO_TIMES_EA_F_XXX - Information times existence flags.
1482 * See @ecma167{4,14.10.6.6,110}
1483 * @{ */
1484#define UDF_INFO_TIMES_EA_F_BIRTH UINT8_C(0x01) /**< Birth (creation) timestamp is recorded. */
1485#define UDF_INFO_TIMES_EA_F_MODIFIED UINT8_C(0x02) /**< Last (data) modified timestamp is recorded. */
1486#define UDF_INFO_TIMES_EA_F_EXPIRE UINT8_C(0x04) /**< Expiration (deletion) timestamp is recorded. */
1487#define UDF_INFO_TIMES_EA_F_EFFECTIVE UINT8_C(0x08) /**< Effective timestamp is recorded. */
1488#define UDF_INFO_TIMES_EA_F_RESERVED_MASK UINT8_C(0xf0)
1489/** @} */
1490
1491/**
1492 * UDF device specification EA data (@ecma167{4,14.10.7,110}, @udf260{3.3.4.4,81}).
1493 */
1494typedef struct UDFEADATADEVICESPEC
1495{
1496 /** 0x00/0x0c: Length of implementation use field. */
1497 uint32_t cbImplementationUse;
1498 /** 0x04/0x10: Major device number. */
1499 uint32_t uMajorDeviceNo;
1500 /** 0x08/0x14: Minor device number. */
1501 uint32_t uMinorDeviceNo;
1502 /** 0x0c/0x18: Implementation use field (variable length).
1503 * UDF specficiation expects UDFENTITYID with a "*Developer ID" as first part
1504 * here. */
1505 uint8_t abImplementationUse[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1506} UDFEADATADEVICESPEC;
1507/** Pointer to UDF device specification EA data. */
1508typedef UDFEADATADEVICESPEC *PUDFEADATADEVICESPEC;
1509/** Pointer to const UDF device specification EA data. */
1510typedef UDFEADATADEVICESPEC const *PCUDFEADATADEVICESPEC;
1511/** UDFGEA::uAttribType value for UDFEADATADEVICESPEC. */
1512#define UDFEADATADEVICESPEC_ATTRIB_TYPE UINT32_C(0x0000000c)
1513/** UDFGEA::uAttribSubtype value for UDFEADATADEVICESPEC. */
1514#define UDFEADATADEVICESPEC_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1515
1516/**
1517 * UDF free EA space payload for implementation and application use EAs
1518 * (@udf260{3.3.4.5.1.1,82}, @udf260{3.3.4.6.1.1,88}).
1519 *
1520 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_FREE_EA_SPACE.
1521 * UDFEADATAAPPUSE::idImplementation is UDF_ENTITY_ID_AUEA_FREE_EA_SPACE.
1522 */
1523typedef struct UDFFREEEASPACE
1524{
1525 /** 0x00/0x30: Header checksum.
1526 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1527 uint16_t uChecksum;
1528 /** 0x02/0x32: Free space. */
1529 uint8_t abFree[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1530} UDFFREEEASPACE;
1531/** Pointer to UDF free EA space impl/app use payload. */
1532typedef UDFFREEEASPACE *PUDFFREEEASPACE;
1533/** Pointer to const UDF free EA space impl/app use payload. */
1534typedef UDFFREEEASPACE const *PCUDFFREEEASPACE;
1535
1536/**
1537 * UDF DVD copyright management information implementation use EA payload
1538 * (@udf260{3.3.4.5.1.2,83}).
1539 *
1540 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_DVD_CGMS_INFO.
1541 */
1542typedef struct UDFIUEADVDCGMSINFO
1543{
1544 /** 0x00/0x30: Header checksum.
1545 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1546 uint16_t uChecksum;
1547 /** 0x02/0x32: The CGMS information (whatever that is). */
1548 uint8_t bInfo;
1549 /** 0x03/0x33: Data structure type (whatever that is). */
1550 uint8_t bType;
1551 /** 0x04/0x34: Production system information, probably dependend on the
1552 * values of previous fields. */
1553 uint8_t abProtSysInfo[4];
1554} UDFIUEADVDCGMSINFO;
1555/** Pointer to UDF DVD copyright management information implementation use EA payload. */
1556typedef UDFIUEADVDCGMSINFO *PUDFIUEADVDCGMSINFO;
1557/** Pointer to const UDF DVD copyright management information implementation use EA payload. */
1558typedef UDFIUEADVDCGMSINFO const *PCUDFIUEADVDCGMSINFO;
1559
1560/**
1561 * UDF OS/2 EA length implementation use EA payload (@udf260{3.3.4.5.3.1,84}).
1562 *
1563 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_OS2_EA_LENGTH.
1564 */
1565#pragma pack(2)
1566typedef struct UDFIUEAOS2EALENGTH
1567{
1568 /** 0x00/0x30: Header checksum.
1569 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1570 uint16_t uChecksum;
1571 /** 0x02/0x32: The CGMS information (whatever that is). */
1572 uint32_t cbEAs;
1573} UDFIUEAOS2EALENGTH;
1574#pragma pack()
1575AssertCompileMemberOffset(UDFIUEAOS2EALENGTH, cbEAs, 2);
1576/** Pointer to UDF OS/2 EA length implementation use EA payload. */
1577typedef UDFIUEAOS2EALENGTH *PUDFIUEAOS2EALENGTH;
1578/** Pointer to const UDF OS/2 EA length implementation use EA payload. */
1579typedef UDFIUEAOS2EALENGTH const *PCUDFIUEAOS2EALENGTH;
1580
1581/**
1582 * UDF Mac volume info implementation use EA payload (@udf260{3.3.4.5.4.1,84}).
1583 *
1584 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_MAC_VOLUME_INFO.
1585 */
1586#pragma pack(2)
1587typedef struct UDFIUEAMACVOLINFO
1588{
1589 /** 0x00/0x30: Header checksum.
1590 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1591 uint16_t uChecksum;
1592 /** 0x02/0x32: Last modification time. */
1593 UDFTIMESTAMP LastModificationTime;
1594 /** 0x0e/0x3e: Last backup time. */
1595 UDFTIMESTAMP LastBackupTime;
1596 /** 0x1a/0x4e: Volume finder information. */
1597 uint32_t au32FinderInfo[8];
1598} UDFIUEAMACVOLINFO;
1599#pragma pack()
1600AssertCompileMemberOffset(UDFIUEAMACVOLINFO, au32FinderInfo, 0x1a);
1601/** Pointer to UDF Mac volume info implementation use EA payload. */
1602typedef UDFIUEAMACVOLINFO *PUDFIUEAMACVOLINFO;
1603/** Pointer to const UDF Mac volume info implementation use EA payload. */
1604typedef UDFIUEAMACVOLINFO const *PCUDFIUEAMACVOLINFO;
1605
1606/**
1607 * UDF point for use in Mac EAs (@udf260{3.3.4.5.4.2,86}).
1608 */
1609typedef struct UDFMACPOINT
1610{
1611 /** X coordinate. */
1612 int16_t x;
1613 /** Y coordinate. */
1614 int16_t y;
1615} UDFMACPOINT;
1616
1617/**
1618 * UDF rectangle for using Mac EAs (@udf260{3.3.4.5.4.2,86}).
1619 */
1620typedef struct UDFMACRECT
1621{
1622 /** top Y coordinate. */
1623 int16_t yTop;
1624 /** left X coordinate. */
1625 int16_t xLeft;
1626 /** bottom Y coordinate. (exclusive?) */
1627 int16_t yBottom;
1628 /** right X coordinate. (exclusive?) */
1629 int16_t xRight;
1630} UDFMACRECT;
1631
1632/**
1633 * UDF finder directory info for Mac EAs (@udf260{3.3.4.5.4.2,86}).
1634 */
1635typedef struct UDFMACFDINFO
1636{
1637 UDFMACRECT FrRect;
1638 int16_t FrFlags;
1639 UDFMACPOINT FrLocation;
1640 int16_t FrView;
1641} UDFMACFDINFO;
1642AssertCompileSize(UDFMACFDINFO, 16);
1643
1644/**
1645 * UDF finder directory extended info for Mac EAs (@udf260{3.3.4.5.4.2,86}).
1646 */
1647typedef struct UDFMACFDXINFO
1648{
1649 UDFMACPOINT FrScroll;
1650 int32_t FrOpenChain;
1651 uint8_t FrScript;
1652 uint8_t FrXFlags;
1653 uint16_t FrComment;
1654 uint32_t FrPutAway;
1655} UDFMACFDXINFO;
1656AssertCompileSize(UDFMACFDXINFO, 16);
1657
1658/**
1659 * UDF Mac finder info implementation use EA payload (@udf260{3.3.4.5.4.1,84}),
1660 * directory edition.
1661 *
1662 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_MAC_FINDER_INFO.
1663 */
1664typedef struct UDFIUEAMACFINDERINFODIR
1665{
1666 /** 0x00/0x30: Header checksum.
1667 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1668 uint16_t uChecksum;
1669 /** 0x02/0x32: Explicit alignment padding, MBZ. */
1670 uint16_t uPadding;
1671 /** 0x04/0x34: Parent directory ID. */
1672 uint32_t idParentDir;
1673 /** 0x08/0x38: Dir information. */
1674 UDFMACFDINFO DirInfo;
1675 /** 0x18/0x48: Dir extended information. */
1676 UDFMACFDXINFO DirExInfo;
1677} UDFIUEAMACFINDERINFODIR;
1678AssertCompileMemberOffset(UDFIUEAMACFINDERINFODIR, DirInfo, 0x08);
1679AssertCompileMemberOffset(UDFIUEAMACFINDERINFODIR, DirExInfo, 0x18);
1680AssertCompileSize(UDFIUEAMACFINDERINFODIR, 0x28);
1681/** Pointer to UDF Mac finder info for dir implementation use EA payload. */
1682typedef UDFIUEAMACFINDERINFODIR *PUDFIUEAMACFINDERINFODIR;
1683/** Pointer to const UDF Mac finder info for dir implementation use EA payload. */
1684typedef UDFIUEAMACFINDERINFODIR const *PCUDFIUEAMACFINDERINFODIR;
1685
1686/**
1687 * UDF finder file info for Mac EAs (@udf260{3.3.4.5.4.2,86}).
1688 */
1689typedef struct UDFMACFFINFO
1690{
1691 uint32_t FrType;
1692 uint32_t FrCreator;
1693 uint16_t FrFlags;
1694 UDFMACPOINT FrLocation;
1695 int16_t FrFldr;
1696} UDFMACFFINFO;
1697AssertCompileSize(UDFMACFFINFO, 16);
1698
1699/**
1700 * UDF finder file extended info for Mac EAs (@udf260{3.3.4.5.4.2,86}).
1701 */
1702typedef struct UDFMACFFXINFO
1703{
1704 int16_t FrIconID;
1705 uint8_t FdUnused[6];
1706 uint8_t FrScript;
1707 uint8_t FrXFlags;
1708 uint16_t FrComment;
1709 uint32_t FrPutAway;
1710} UDFMACFFXINFO;
1711AssertCompileSize(UDFMACFFXINFO, 16);
1712
1713/**
1714 * UDF Mac finder info implementation use EA payload (@udf260{3.3.4.5.4.1,84}),
1715 * file edition.
1716 *
1717 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_MAC_FINDER_INFO.
1718 */
1719typedef struct UDFIUEAMACFINDERINFOFILE
1720{
1721 /** 0x00/0x30: Header checksum.
1722 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1723 uint16_t uChecksum;
1724 /** 0x02/0x32: Explicit alignment padding, MBZ. */
1725 uint16_t uPadding;
1726 /** 0x04/0x34: Parent directory ID. */
1727 uint32_t idParentDir;
1728 /** 0x08/0x38: File information. */
1729 UDFMACFFINFO FileInfo;
1730 /** 0x18/0x48: File extended information. */
1731 UDFMACFFXINFO FileExInfo;
1732 /** 0x28/0x58: The size of the fork data (in bytes). */
1733 uint32_t cbForkData;
1734 /** 0x2c/0x5c: The size of the fork allocation (in bytes). */
1735 uint32_t cbForkAlloc;
1736} UDFIUEAMACFINDERINFOFILE;
1737AssertCompileMemberOffset(UDFIUEAMACFINDERINFOFILE, FileInfo, 0x08);
1738AssertCompileMemberOffset(UDFIUEAMACFINDERINFOFILE, FileExInfo, 0x18);
1739AssertCompileMemberOffset(UDFIUEAMACFINDERINFOFILE, cbForkData, 0x28);
1740AssertCompileSize(UDFIUEAMACFINDERINFOFILE, 0x30);
1741/** Pointer to UDF Mac finder info for file implementation use EA payload. */
1742typedef UDFIUEAMACFINDERINFOFILE *PUDFIUEAMACFINDERINFOFILE;
1743/** Pointer to const UDF Mac finder info for file implementation use EA payload. */
1744typedef UDFIUEAMACFINDERINFOFILE const *PCUDFIUEAMACFINDERINFOFILE;
1745
1746/**
1747 * UDF OS/400 directory info implementation use EA payload (@udf260{3.3.4.5.6.1,87})
1748 *
1749 * UDFEADATAIMPLUSE::idImplementation is UDF_ENTITY_ID_IUEA_OS400_DIR_INFO.
1750 */
1751typedef struct UDFIUEAOS400DIRINFO
1752{
1753 /** 0x00/0x30: Header checksum.
1754 * @note 16-bit checksum of UDFGEA up thru u.ImplUse.idImplementation. */
1755 uint16_t uChecksum;
1756 /** 0x02/0x32: Explicit alignment padding, MBZ. */
1757 uint16_t uPadding;
1758 /** 0x04/0x34: The directory info, format documented elsewhere. */
1759 uint8_t abDirInfo[44];
1760} UDFIUEAOS400DIRINFO;
1761AssertCompileSize(UDFIUEAOS400DIRINFO, 0x30);
1762/** Pointer to UDF Mac finder info for file implementation use EA payload. */
1763typedef UDFIUEAOS400DIRINFO *PUDFIUEAOS400DIRINFO;
1764/** Pointer to const UDF Mac finder info for file implementation use EA payload. */
1765typedef UDFIUEAOS400DIRINFO const *PCUDFIUEAOS400DIRINFO;
1766
1767
1768/**
1769 * UDF implementation use EA data (@ecma167{4,14.10.8,111}, @udf260{3.3.4.5,82}).
1770 */
1771typedef struct UDFEADATAIMPLUSE
1772{
1773 /** 0x00/0x0c: Length uData in bytes. */
1774 uint32_t cbData;
1775 /** 0x04/0x10: Implementation identifier (UDF_ENTITY_ID_IUEA_XXX). */
1776 UDFENTITYID idImplementation;
1777 /** 0x24/0x30: Implementation use field (variable length). */
1778 union
1779 {
1780 /** Generic byte view. */
1781 uint8_t abData[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1782 /** Free EA space (UDF_ENTITY_ID_IUEA_FREE_EA_SPACE). */
1783 UDFFREEEASPACE FreeEaSpace;
1784 /** DVD copyright management information (UDF_ENTITY_ID_IUEA_DVD_CGMS_INFO). */
1785 UDFIUEADVDCGMSINFO DvdCgmsInfo;
1786 /** OS/2 EA length (UDF_ENTITY_ID_IUEA_OS2_EA_LENGTH). */
1787 UDFIUEAOS2EALENGTH Os2EaLength;
1788 /** Mac volume info (UDF_ENTITY_ID_IUEA_MAC_VOLUME_INFO). */
1789 UDFIUEAMACVOLINFO MacVolInfo;
1790 /** Mac finder info, directory edition (UDF_ENTITY_ID_IUEA_MAC_FINDER_INFO). */
1791 UDFIUEAMACFINDERINFODIR MacFinderInfoDir;
1792 /** Mac finder info, file edition (UDF_ENTITY_ID_IUEA_MAC_FINDER_INFO). */
1793 UDFIUEAMACFINDERINFOFILE MacFinderInfoFile;
1794 /** OS/400 directory info (UDF_ENTITY_ID_IUEA_OS400_DIR_INFO). */
1795 UDFIUEAOS400DIRINFO Os400DirInfo;
1796 } u;
1797} UDFEADATAIMPLUSE;
1798/** Pointer to UDF implementation use EA data. */
1799typedef UDFEADATAIMPLUSE *PUDFEADATAIMPLUSE;
1800/** Pointer to const UDF implementation use EA data. */
1801typedef UDFEADATAIMPLUSE const *PCUDFEADATAIMPLUSE;
1802/** UDFGEA::uAttribType value for UDFEADATAIMPLUSE. */
1803#define UDFEADATAIMPLUSE_ATTRIB_TYPE UINT32_C(0x00000800)
1804/** UDFGEA::uAttribSubtype value for UDFEADATAIMPLUSE. */
1805#define UDFEADATAIMPLUSE_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1806
1807/**
1808 * UDF application use EA data (@ecma167{4,14.10.9,112}, @udf260{3.3.4.6,88}).
1809 */
1810typedef struct UDFEADATAAPPUSE
1811{
1812 /** 0x0c: Length uData in bytes. */
1813 uint32_t cbData;
1814 /** 0x10: Application identifier (UDF_ENTITY_ID_AUEA_FREE_EA_SPACE). */
1815 UDFENTITYID idApplication;
1816 /** 0x30: Application use field (variable length). */
1817 union
1818 {
1819 /** Generic byte view. */
1820 uint8_t ab[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1821 /** Free EA space (UDF_ENTITY_ID_AUEA_FREE_EA_SPACE). */
1822 UDFFREEEASPACE FreeEaSpace;
1823 } uData;
1824} UDFEADATAAPPUSE;
1825/** Pointer to UDF application use EA data. */
1826typedef UDFEADATAAPPUSE *PUDFEADATAAPPUSE;
1827/** Pointer to const UDF application use EA data. */
1828typedef UDFEADATAAPPUSE const *PCUDFEADATAAPPUSE;
1829/** UDFGEA::uAttribType value for UDFEADATAAPPUSE. */
1830#define UDFEADATAAPPUSE_ATTRIB_TYPE UINT32_C(0x00010000)
1831/** UDFGEA::uAttribSubtype value for UDFEADATAAPPUSE. */
1832#define UDFEADATAAPPUSE_ATTRIB_SUBTYPE UINT32_C(0x00000001)
1833
1834/**
1835 * UDF generic extended attribute (@ecma167{4,14.10.2,103}).
1836 */
1837typedef struct UDFGEA
1838{
1839 /** 0x00: Attribute type (UDFXXX_ATTRIB_TYPE). */
1840 uint32_t uAttribType;
1841 /** 0x04: Attribute subtype (UDFXXX_ATTRIB_SUBTYPE). */
1842 uint8_t uAttribSubtype;
1843 /** 0x05: Reserved padding bytes, MBZ. */
1844 uint8_t abReserved[3];
1845 /** 0x08: Size of the whole extended attribute.
1846 * Multiple of four is recommended. */
1847 uint32_t cbAttrib;
1848 /** 0x0c: Attribute data union. */
1849 union
1850 {
1851 /** Generic byte view (variable size). */
1852 uint8_t abData[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1853 /** Character set information (@ecma167{4,14.10.3,104}). */
1854 UDFEADATACHARSETINFO CharSetInfo;
1855 /** Alternate permissions (@ecma167{4,14.10.4,105}, @udf260{3.3.4.2,80}).
1856 * @note Not recorded according to the UDF specification. */
1857 UDFEADATAALTPERM AltPerm;
1858 /** File times (@ecma167{4,14.10.5,108}, @udf260{3.3.4.3,80}).
1859 * (This is a bit reminiscent of ISO9660RRIPTF.) */
1860 UDFEADATAFILETIMES FileTimes;
1861 /** Information times (@ecma167{4,14.10.6,109}). */
1862 UDFEADATAINFOTIMES InfoTimes;
1863 /** Device specification (@ecma167{4,14.10.7,110}, @udf260{3.3.4.4,81}). */
1864 UDFEADATADEVICESPEC DeviceSpec;
1865 /** Implementation use (@ecma167{4,14.10.8,111}, @udf260{3.3.4.5,82}). */
1866 UDFEADATAIMPLUSE ImplUse;
1867 /** Application use (@ecma167{4,14.10.9,112}, @udf260{3.3.4.6,88}). */
1868 UDFEADATAAPPUSE AppUse;
1869 } u;
1870} UDFGEA;
1871AssertCompileMemberOffset(UDFGEA, u, 0x0c);
1872/** Pointer to a UDF extended attribute. */
1873typedef UDFGEA *PUDFGEA;
1874/** Pointer to a const UDF extended attribute. */
1875typedef UDFGEA const *PCUDFGEA;
1876
1877
1878/**
1879 * UDF unallocated space entry (@ecma167{4,14.11,113}, @udf260{2.3.7,64}).
1880 *
1881 * @note Total length shall not exceed one logical block.
1882 */
1883typedef struct UDFUNALLOCATEDSPACEENTRY
1884{
1885 /** 0x00: The descriptor tag (UDF_TAG_ID_UNALLOCATED_SPACE_ENTRY). */
1886 UDFTAG Tag;
1887 /** 0x10: ICB Tag. */
1888 UDFICBTAG IcbTag;
1889 /** 0x24: Size of the allocation desciptors in bytes. */
1890 uint32_t cbAllocDescs;
1891 /** 0x28: Allocation desciptors, type given by IcbTag::fFlags. */
1892 union
1893 {
1894 UDFSHORTAD aShortADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1895 UDFLONGAD aLongADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1896 UDFEXTAD aExtADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1897 UDFEXTENTAD SingleAD;
1898 } u;
1899} UDFUNALLOCATEDSPACEENTRY;
1900AssertCompileMemberOffset(UDFUNALLOCATEDSPACEENTRY, u, 0x28);
1901/** Pointer to an UDF unallocated space entry. */
1902typedef UDFUNALLOCATEDSPACEENTRY *PUDFUNALLOCATEDSPACEENTRY;
1903/** Pointer to a const UDF unallocated space entry. */
1904typedef UDFUNALLOCATEDSPACEENTRY const *PCUDFUNALLOCATEDSPACEENTRY;
1905
1906
1907/**
1908 * UDF space bitmap descriptor (SBD) (@ecma167{4,14.12,114}, @udf260{2.3.8,65}).
1909 */
1910typedef struct UDFSPACEBITMAPDESC
1911{
1912 /** 0x00: The descriptor tag (UDF_TAG_ID_SPACE_BITMAP_DESC). */
1913 UDFTAG Tag;
1914 /** 0x10: Number of bits in the bitmap. */
1915 uint32_t cBits;
1916 /** 0x14: The bitmap size in bytes. */
1917 uint32_t cbBitmap;
1918 /** 0x18: The bitmap. */
1919 uint8_t abBitmap[RT_FLEXIBLE_ARRAY];
1920} UDFSPACEBITMAPDESC;
1921AssertCompileMemberOffset(UDFSPACEBITMAPDESC, abBitmap, 0x18);
1922/** Pointer to an UDF space bitmap descriptor. */
1923typedef UDFSPACEBITMAPDESC *PUDFSPACEBITMAPDESC;
1924/** Pointer to a const UDF space bitmap descriptor. */
1925typedef UDFSPACEBITMAPDESC const *PCUDFSPACEBITMAPDESC;
1926
1927
1928/**
1929 * UDF partition integrity descriptor (@ecma167{4,14.3,115}, @udf260{2.3.9,65}).
1930 *
1931 * @note Not needed by UDF.
1932 */
1933typedef struct UDFPARTITIONINTEGRITYDESC
1934{
1935 /** 0x000: The descriptor tag (UDF_TAG_ID_PARTITION_INTEGERITY_DESC). */
1936 UDFTAG Tag;
1937 /** 0x010: ICB Tag. */
1938 UDFICBTAG IcbTag;
1939 /** 0x024: Recording timestamp. */
1940 UDFTIMESTAMP RecordingTimestamp;
1941 /** 0x030: Interity type (UDF_PARTITION_INTEGRITY_TYPE_XXX). */
1942 uint8_t bType;
1943 /** 0x031: Reserved. */
1944 uint8_t abReserved[175];
1945 /** 0x0e0: Implementation identifier. */
1946 UDFENTITYID idImplementation;
1947 /** 0x100: Implementation use data. */
1948 uint8_t abImplementationUse[RT_FLEXIBLE_ARRAY];
1949} UDFPARTITIONINTEGRITYDESC;
1950AssertCompileMemberOffset(UDFPARTITIONINTEGRITYDESC, abImplementationUse, 0x100);
1951/** Pointer to an UDF partition integrity descriptor. */
1952typedef UDFPARTITIONINTEGRITYDESC *PUDFPARTITIONINTEGRITYDESC;
1953/** Pointer to a const UDF partition integrity descriptor. */
1954typedef UDFPARTITIONINTEGRITYDESC const *PCUDFPARTITIONINTEGRITYDESC;
1955
1956
1957/**
1958 * UDF extended file entry (EFE) (@ecma167{4,14.17,120}, @udf260{3.3.5,83}).
1959 *
1960 * @note Total length shall not exceed one logical block.
1961 */
1962typedef struct UDFEXFILEENTRY
1963{
1964 /** 0x00: The descriptor tag (UDF_TAG_ID_EXTENDED_FILE_ENTRY). */
1965 UDFTAG Tag;
1966 /** 0x10: ICB Tag. */
1967 UDFICBTAG IcbTag;
1968 /** 0x24: User ID (UNIX). */
1969 uint32_t uid;
1970 /** 0x28: Group ID (UNIX). */
1971 uint32_t gid;
1972 /** 0x2c: Permission (UDF_PERM_XXX). */
1973 uint32_t fPermissions;
1974 /** 0x30: Number hard links. */
1975 uint16_t cHardlinks;
1976 /** 0x32: Record format (UDF_REC_FMT_XXX). */
1977 uint8_t uRecordFormat;
1978 /** 0x33: Record format (UDF_REC_FMT_XXX). */
1979 uint8_t fRecordDisplayAttribs;
1980 /** 0x34: Record length (in bytes).
1981 * @note Must be zero according to the UDF specification. */
1982 uint32_t cbRecord;
1983 /** 0x38: Information length in bytes (file size). */
1984 uint64_t cbData;
1985 /** 0x40: The size of all streams. Same as cbData if no additional streams. */
1986 uint64_t cbObject;
1987 /** 0x48: Number of logical blocks allocated (for file data). */
1988 uint64_t cLogicalBlocks;
1989 /** 0x50: Time of last access (prior to recording the file entry). */
1990 UDFTIMESTAMP AccessTime;
1991 /** 0x5c: Time of last data modification. */
1992 UDFTIMESTAMP ModificationTime;
1993 /** 0x68: Birth (creation) time. */
1994 UDFTIMESTAMP BirthTime;
1995 /** 0x74: Time of last attribute/status modification. */
1996 UDFTIMESTAMP ChangeTime;
1997 /** 0x80: Checkpoint number (defaults to 1). */
1998 uint32_t uCheckpoint;
1999 /** 0x84: Reserved, MBZ. */
2000 uint32_t uReserved;
2001 /** 0x88: Extended attribute information control block location. */
2002 UDFLONGAD ExtAttribIcb;
2003 /** 0x98: Stream directory information control block location. */
2004 UDFLONGAD StreamDirIcb;
2005 /** 0xa8: Implementation identifier (UDF_ENTITY_ID_FE_IMPLEMENTATION). */
2006 UDFENTITYID idImplementation;
2007 /** 0xc8: Unique ID. */
2008 uint64_t INodeId;
2009 /** 0xd0: Length of extended attributes in bytes, multiple of four. */
2010 uint32_t cbExtAttribs;
2011 /** 0xd4: Length of allocation descriptors in bytes, multiple of four. */
2012 uint32_t cbAllocDescs;
2013 /** 0xd8: Two variable sized fields. First @a cbExtAttribs bytes of extended
2014 * attributes, then @a cbAllocDescs bytes of allocation descriptors. */
2015 uint8_t abExtAttribs[RT_FLEXIBLE_ARRAY];
2016} UDFEXFILEENTRY;
2017AssertCompileMemberOffset(UDFEXFILEENTRY, abExtAttribs, 0xd8);
2018/** Pointer to an UDF extended file entry. */
2019typedef UDFEXFILEENTRY *PUDFEXFILEENTRY;
2020/** Pointer to a const UDF extended file entry. */
2021typedef UDFEXFILEENTRY const *PCUDFEXFILEENTRY;
2022
2023
2024
2025/** @name UDF Volume Recognition Sequence (VRS)
2026 *
2027 * The recognition sequence usually follows the CD001 descriptor sequence at
2028 * sector 16 and is there to indicate that the medium (also) contains a UDF file
2029 * system and which standards are involved.
2030 *
2031 * See @ecma167{2,8,31}, @ecma167{2,9,32}, @udf260{2.1.7,25}.
2032 *
2033 * @{ */
2034
2035/** The type value used for all the extended UDF volume descriptors
2036 * (ISO9660VOLDESCHDR::bDescType). */
2037#define UDF_EXT_VOL_DESC_TYPE 0
2038/** The version value used for all the extended UDF volume descriptors
2039 * (ISO9660VOLDESCHDR::bDescVersion). */
2040#define UDF_EXT_VOL_DESC_VERSION 1
2041
2042/** Standard ID for UDFEXTVOLDESCBEGIN. */
2043#define UDF_EXT_VOL_DESC_STD_ID_BEGIN "BEA01"
2044/** Standard ID for UDFEXTVOLDESCTERM. */
2045#define UDF_EXT_VOL_DESC_STD_ID_TERM "TEA01"
2046/** Standard ID for UDFEXTVOLDESCNSR following ECMA-167 2nd edition. */
2047#define UDF_EXT_VOL_DESC_STD_ID_NSR_02 "NSR02"
2048/** Standard ID for UDFEXTVOLDESCNSR following ECMA-167 3rd edition. */
2049#define UDF_EXT_VOL_DESC_STD_ID_NSR_03 "NSR03"
2050/** Standard ID for UDFEXTVOLDESCBOOT. */
2051#define UDF_EXT_VOL_DESC_STD_ID_BOOT "BOOT2"
2052
2053
2054/**
2055 * Begin UDF extended volume descriptor area (@ecma167{2,9.2,33}).
2056 */
2057typedef struct UDFEXTVOLDESCBEGIN
2058{
2059 /** The volume descriptor header.
2060 * The standard identifier is UDF_EXT_VOL_DESC_STD_ID_BEGIN. */
2061 ISO9660VOLDESCHDR Hdr;
2062 /** Zero payload. */
2063 uint8_t abZero[2041];
2064} UDFEXTVOLDESCBEGIN;
2065AssertCompileSize(UDFEXTVOLDESCBEGIN, 2048);
2066/** Pointer to an UDF extended volume descriptor indicating the start of the
2067 * extended descriptor area. */
2068typedef UDFEXTVOLDESCBEGIN *PUDFEXTVOLDESCBEGIN;
2069/** Pointer to a const UDF extended volume descriptor indicating the start of
2070 * the extended descriptor area. */
2071typedef UDFEXTVOLDESCBEGIN const *PCUDFEXTVOLDESCBEGIN;
2072
2073
2074/**
2075 * Terminate UDF extended volume descriptor area (@ecma167{2,9.3,33}).
2076 */
2077typedef struct UDFEXTVOLDESCTERM
2078{
2079 /** The volume descriptor header.
2080 * The standard identifier is UDF_EXT_VOL_DESC_STD_ID_TERM. */
2081 ISO9660VOLDESCHDR Hdr;
2082 /** Zero payload. */
2083 uint8_t abZero[2041];
2084} UDFEXTVOLDESCTERM;
2085AssertCompileSize(UDFEXTVOLDESCTERM, 2048);
2086/** Pointer to an UDF extended volume descriptor indicating the end of the
2087 * extended descriptor area. */
2088typedef UDFEXTVOLDESCTERM *PUDFEXTVOLDESCTERM;
2089/** Pointer to a const UDF extended volume descriptor indicating the end of
2090 * the extended descriptor area. */
2091typedef UDFEXTVOLDESCTERM const *PCUDFEXTVOLDESCTERM;
2092
2093
2094/**
2095 * UDF NSR extended volume descriptor (@ecma167{3,9.1,50}).
2096 *
2097 * This gives the ECMA standard version.
2098 */
2099typedef struct UDFEXTVOLDESCNSR
2100{
2101 /** The volume descriptor header.
2102 * The standard identifier is UDF_EXT_VOL_DESC_STD_ID_NSR_02, or
2103 * UDF_EXT_VOL_DESC_STD_ID_NSR_03. */
2104 ISO9660VOLDESCHDR Hdr;
2105 /** Zero payload. */
2106 uint8_t abZero[2041];
2107} UDFEXTVOLDESCNSR;
2108AssertCompileSize(UDFEXTVOLDESCNSR, 2048);
2109/** Pointer to an extended volume descriptor giving the UDF standard version. */
2110typedef UDFEXTVOLDESCNSR *PUDFEXTVOLDESCNSR;
2111/** Pointer to a const extended volume descriptor giving the UDF standard version. */
2112typedef UDFEXTVOLDESCNSR const *PCUDFEXTVOLDESCNSR;
2113
2114
2115/**
2116 * UDF boot extended volume descriptor (@ecma167{2,9.4,34}).
2117 *
2118 * @note Probably entirely unused.
2119 */
2120typedef struct UDFEXTVOLDESCBOOT
2121{
2122 /** 0x00: The volume descriptor header.
2123 * The standard identifier is UDF_EXT_VOL_DESC_STD_ID_BOOT. */
2124 ISO9660VOLDESCHDR Hdr;
2125 /** 0x07: Reserved/alignment, MBZ. */
2126 uint8_t bReserved1;
2127 /** 0x08: The architecture type. */
2128 UDFENTITYID ArchType;
2129 /** 0x28: The boot identifier. */
2130 UDFENTITYID idBoot;
2131 /** 0x48: Logical sector number of load the boot loader from. */
2132 uint32_t offBootExtent;
2133 /** 0x4c: Number of bytes to load. */
2134 uint32_t cbBootExtent;
2135 /** 0x50: The load address (in memory). */
2136 uint64_t uLoadAddress;
2137 /** 0x58: The start address (in memory). */
2138 uint64_t uStartAddress;
2139 /** 0x60: The descriptor creation timestamp. */
2140 UDFTIMESTAMP CreationTimestamp;
2141 /** 0x6c: Flags. */
2142 uint16_t fFlags;
2143 /** 0x6e: Reserved, MBZ. */
2144 uint8_t abReserved2[32];
2145 /** 0x8e: Implementation use. */
2146 uint8_t abBootUse[1906];
2147} UDFEXTVOLDESCBOOT;
2148AssertCompileSize(UDFEXTVOLDESCBOOT, 2048);
2149/** Pointer to a boot extended volume descriptor. */
2150typedef UDFEXTVOLDESCBOOT *PUDFEXTVOLDESCBOOT;
2151/** Pointer to a const boot extended volume descriptor. */
2152typedef UDFEXTVOLDESCBOOT const *PCUDFEXTVOLDESCBOOT;
2153
2154/** @} */
2155
2156
2157/** @} */
2158
2159#endif
2160
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