VirtualBox

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

Last change on this file since 93115 was 93115, checked in by vboxsync, 3 years ago

scm --update-copyright-year

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