VirtualBox

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

Last change on this file since 104212 was 101586, checked in by vboxsync, 13 months ago

IPRT/formats/udf.h: Docs fixes. bugref:10517

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