VirtualBox

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

Last change on this file since 77807 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

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