VirtualBox

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

Last change on this file since 68926 was 68920, checked in by vboxsync, 8 years ago

iprt: udf reading updates

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

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