VirtualBox

source: vbox/trunk/include/iprt/formats/iso9660.h@ 68675

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

iprt/formats/udf.h: More UDF structures.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 62.4 KB
Line 
1/* $Id: iso9660.h 68399 2017-08-11 18:09:08Z vboxsync $ */
2/** @file
3 * IPRT, ISO 9660 File System
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_iso9660_h
28#define ___iprt_formats_iso9660_h
29
30#include <iprt/types.h>
31#include <iprt/assert.h>
32
33
34/** @defgroup grp_rt_formats_iso9660 ISO 9660 structures and definitions
35 * @ingroup grp_rt_formats
36 * @{
37 */
38
39
40/** The (default) logical sectors size of ISO 9660. */
41#define ISO9660_SECTOR_SIZE 2048
42/** The (default) sector offset mask of ISO 9660. */
43#define ISO9660_SECTOR_OFFSET_MASK 2047
44/** Maximum filename length (level 2 & 3). */
45#define ISO9660_MAX_NAME_LEN 30
46
47
48/** Accessor for ISO9660U16 and ISO9660U32 that retrievs the member value for
49 * the host endianess. */
50#ifdef RT_BIG_ENDIAN
51# define ISO9660_GET_ENDIAN(a_pInt) ((a_pInt)->be)
52#else
53# define ISO9660_GET_ENDIAN(a_pInt) ((a_pInt)->le)
54#endif
55
56
57/**
58 * ISO 9660 16-bit unsigned integer type.
59 */
60typedef struct ISO9660U16
61{
62 /** Little endian. */
63 uint16_t le;
64 /** Big endian. */
65 uint16_t be;
66} ISO9660U16;
67/** Pointer to an ISO 9660 16-bit unsigned integer type. */
68typedef ISO9660U16 *PISO9660U16;
69/** Pointer to a const ISO 9660 16-bit unsigned integer type. */
70typedef ISO9660U16 const *PCISO9660U16;
71
72/** ISO 9660 big endian 16-bit unsigned integer. */
73typedef uint16_t ISO9660U16BE;
74
75
76/**
77 * ISO 9660 32-bit unsigned integer type.
78 */
79typedef struct ISO9660U32
80{
81 /** Little endian. */
82 uint32_t le;
83 /** Big endian. */
84 uint32_t be;
85} ISO9660U32;
86/** Pointer to an ISO 9660 32-bit unsigned integer type. */
87typedef ISO9660U32 *PISO9660U32;
88/** Pointer to a const ISO 9660 32-bit unsigned integer type. */
89typedef ISO9660U32 const *PCISO9660U32;
90
91/** ISO 9660 little endian 32-bit unsigned integer. */
92typedef uint32_t ISO9660U32LE;
93/** ISO 9660 big endian 32-bit unsigned integer. */
94typedef uint32_t ISO9660U32BE;
95
96/**
97 * ISO 9660 timestamp (date & time).
98 */
99typedef struct ISO9660TIMESTAMP
100{
101 /** 0x00: For digit year (0001-9999). */
102 char achYear[4];
103 /** 0x04: Month of the year (01-12). */
104 char achMonth[2];
105 /** 0x06: Day of month (01-31). */
106 char achDay[2];
107 /** 0x08: Hour of day (00-23). */
108 char achHour[2];
109 /** 0x0a: Minute of hour (00-59). */
110 char achMinute[2];
111 /** 0x0c: Second of minute (00-59). */
112 char achSecond[2];
113 /** 0x0e: Hundreth of second (00-99). */
114 char achCentisecond[2];
115 /** 0x10: The UTC (GMT) offset in 15 min units. */
116 int8_t offUtc;
117} ISO9660TIMESTAMP;
118AssertCompileSize(ISO9660TIMESTAMP, 17);
119/** Pointer to an ISO 9660 timestamp. */
120typedef ISO9660TIMESTAMP *PISO9660TIMESTAMP;
121/** Pointer to a const ISO 9660 timestamp. */
122typedef ISO9660TIMESTAMP const *PCISO9660TIMESTAMP;
123
124/**
125 * ISO 9660 record timestamp (date & time).
126 */
127typedef struct ISO9660RECTIMESTAMP
128{
129 /** 0: Years since 1900. */
130 uint8_t bYear;
131 /** 1: Month of year (1-12). */
132 uint8_t bMonth;
133 /** 2: Day of month (1-31). */
134 uint8_t bDay;
135 /** 3: Hour of day (0-23). */
136 uint8_t bHour;
137 /** 4: Minute of hour (0-59). */
138 uint8_t bMinute;
139 /** 5: Second of minute (0-59). */
140 uint8_t bSecond;
141 /** 6: The UTC (GMT) offset in 15 min units. */
142 int8_t offUtc;
143} ISO9660RECTIMESTAMP;
144AssertCompileSize(ISO9660RECTIMESTAMP, 7);
145/** Pointer to an ISO 9660 record timestamp. */
146typedef ISO9660RECTIMESTAMP *PISO9660RECTIMESTAMP;
147/** Pointer to a const ISO 9660 record timestamp. */
148typedef ISO9660RECTIMESTAMP const *PCISO9660RECTIMESTAMP;
149
150
151/**
152 * ISO 9660 directory record.
153 */
154#pragma pack(1)
155typedef struct ISO9660DIRREC
156{
157 /** 0x00: Length of this record in bytes. */
158 uint8_t cbDirRec;
159 /** 0x01: Extended attribute record length in logical blocks. */
160 uint8_t cExtAttrBlocks;
161 /** 0x02: Location of extent (logical block number).
162 * @note Misaligned. */
163 ISO9660U32 offExtent;
164 /** 0x0a: Size of the data (file section). Does not include EAs.
165 * @note Misaligned. */
166 ISO9660U32 cbData;
167 /** 0x12: Recording time and date. */
168 ISO9660RECTIMESTAMP RecTime;
169 /** 0x19: File flags (ISO9660_FILE_FLAGS_XXX). */
170 uint8_t fFileFlags;
171 /** 0x1a: File unit size for interlaved mode. */
172 uint8_t bFileUnitSize;
173 /** 0x1b: Interlave gap size. */
174 uint8_t bInterleaveGapSize;
175 /** 0x1c: Volume sequence number where the extent resides. */
176 ISO9660U16 VolumeSeqNo;
177 /** 0x20: Length of file identifier field. */
178 uint8_t bFileIdLength;
179 /** 0x21: File identifier (d-characters or d1-characters). */
180 char achFileId[1];
181 /* There are more fields following:
182 * - one byte optional padding so the following field is at an even boundrary.
183 * - system use field until cbDirRec is reached.
184 */
185} ISO9660DIRREC;
186#pragma pack()
187AssertCompileMemberOffset(ISO9660DIRREC, offExtent, 0x02);
188AssertCompileMemberOffset(ISO9660DIRREC, cbData, 0x0a);
189AssertCompileMemberOffset(ISO9660DIRREC, RecTime, 0x12);
190AssertCompileMemberOffset(ISO9660DIRREC, fFileFlags, 0x19);
191AssertCompileMemberOffset(ISO9660DIRREC, bFileIdLength, 0x20);
192AssertCompileMemberOffset(ISO9660DIRREC, achFileId, 0x21);
193/** Pointer to an ISO 9660 directory record. */
194typedef ISO9660DIRREC *PISO9660DIRREC;
195/** Pointer to a const ISO 9660 directory record. */
196typedef ISO9660DIRREC const *PCISO9660DIRREC;
197
198/** @name ISO9660_FILE_FLAGS_XXX
199 * @{ */
200/** Existence - Hide the file from the user. */
201#define ISO9660_FILE_FLAGS_HIDDEN UINT8_C(0x01)
202/** Directory - Indicates a directory as apposed to a regular file (0). */
203#define ISO9660_FILE_FLAGS_DIRECTORY UINT8_C(0x02)
204/** Assocated File - Indicates that the file is an associated file. */
205#define ISO9660_FILE_FLAGS_ASSOCIATED_FILE UINT8_C(0x04)
206/** Record - Indicates specified file content record format (see EAs). */
207#define ISO9660_FILE_FLAGS_RECORD UINT8_C(0x08)
208/** Protection - Indicates owner/group or permission protection in EAs. */
209#define ISO9660_FILE_FLAGS_PROTECTION UINT8_C(0x10)
210/** Reserved bit, MBZ. */
211#define ISO9660_FILE_FLAGS_RESERVED_5 UINT8_C(0x20)
212/** Reserved bit, MBZ. */
213#define ISO9660_FILE_FLAGS_RESERVED_6 UINT8_C(0x40)
214/** Multi-extend - Indicates that this isn't the final record for the file.
215 * @remarks Use for working around 4 GiB file size limitation. */
216#define ISO9660_FILE_FLAGS_MULTI_EXTENT UINT8_C(0x80)
217/** @} */
218
219
220/**
221 * ISO 9660 path table record.
222 */
223#pragma pack(1)
224typedef struct ISO9660PATHREC
225{
226 /** 0x00: Length of the achDirId field in bytes. */
227 uint8_t cbDirId;
228 /** 0x01: Extended attribute record length in bytes? */
229 uint8_t cbExtAttr;
230 /** 0x02: Location of extent (logical block number).
231 * @note Endianess depends on table.
232 * @note Misaligned. */
233 uint32_t offExtent;
234 /** 0x06: Parent directory number.
235 * @note Endianess depends on table. */
236 uint16_t idParentRec;
237 /** 0x08: Directory identifier (d-characters or d1-characters). */
238 char achDirId[RT_FLEXIBLE_ARRAY];
239 /* There will be a zero padding byte following if the directory identifier length is odd. */
240} ISO9660PATHREC;
241#pragma pack()
242AssertCompileMemberOffset(ISO9660PATHREC, cbExtAttr, 0x01);
243AssertCompileMemberOffset(ISO9660PATHREC, offExtent, 0x02);
244AssertCompileMemberOffset(ISO9660PATHREC, idParentRec, 0x06);
245AssertCompileMemberOffset(ISO9660PATHREC, achDirId, 0x08);
246/** Pointer to an ISO 9660 path table record. */
247typedef ISO9660PATHREC *PISO9660PATHREC;
248/** Pointer to a const ISO 9660 path table record. */
249typedef ISO9660PATHREC const *PCISO9660PATHREC;
250
251
252/**
253 * ISO 9660 extended attribute record.
254 */
255typedef struct ISO9660EXATTRREC
256{
257 /** 0x000: The owner ID. */
258 ISO9660U16 idOwner;
259 /** 0x004: The group ID. */
260 ISO9660U16 idGroup;
261 /** 0x008: File permissions (ISO9660_PERM_XXX). */
262 ISO9660U16BE fPermissions;
263 /** 0x00a: File creation timestamp. */
264 ISO9660TIMESTAMP BirthTimestamp;
265 /** 0x01b: File modification timestamp. */
266 ISO9660TIMESTAMP ModifyTimestamp;
267 /** 0x02c: File expiration timestamp. */
268 ISO9660TIMESTAMP ExpireTimestamp;
269 /** 0x03d: File effective timestamp. */
270 ISO9660TIMESTAMP EffectiveTimestamp;
271 /** 0x04e: Record format. */
272 uint8_t bRecordFormat;
273 /** 0x04f: Record attributes. */
274 uint8_t fRecordAttrib;
275 /** 0x050: Record length. */
276 ISO9660U16 RecordLength;
277 /** 0x054: System identifier (a-characters or a1-characters). */
278 char achSystemId[0x20];
279 /** 0x074: System specific bytes. */
280 uint8_t abSystemUse[64];
281 /** 0x0b4: Extended attribute record version (ISO9660EXATTRREC_VERSION). */
282 uint8_t bExtRecVersion;
283 /** 0x0b5: Length of escape sequences. */
284 uint8_t cbEscapeSequences;
285 /** 0x0b6: Reserved for the future, MBZ. */
286 uint8_t abReserved183[64];
287 /** 0x0f6: Length of the application use field. */
288 ISO9660U16 cbAppUse;
289 /** 0x0fa: Variable sized application use field. */
290 uint8_t abAppUse[RT_FLEXIBLE_ARRAY];
291 /* This is followed by escape sequences with length given by cbEscapeSequnces. */
292} ISO9660EXATTRREC;
293AssertCompileMemberOffset(ISO9660EXATTRREC, EffectiveTimestamp, 0x03d);
294AssertCompileMemberOffset(ISO9660EXATTRREC, cbAppUse, 0x0f6);
295
296/** The ISO9660EXATTRREC::bExtRecVersion value. */
297#define ISO9660EXATTRREC_VERSION UINT8_C(0x01)
298
299/** @name ISO9660_PERM_XXX - ISO9660EXATTRREC::fPermissions
300 * @{ */
301/** @todo figure out this weird permission stuff... */
302/** @} */
303
304
305/**
306 * ISO 9660 volume descriptor header.
307 */
308typedef struct ISO9660VOLDESCHDR
309{
310 /** Descriptor type ISO9660VOLDESC_TYPE_XXX. */
311 uint8_t bDescType;
312 /** Standard identifier 'CD001' */
313 uint8_t achStdId[5];
314 /** The descriptor version. */
315 uint8_t bDescVersion;
316 /* (This is followed by the descriptor specific data). */
317} ISO9660VOLDESCHDR;
318AssertCompileSize(ISO9660VOLDESCHDR, 7);
319/** Pointer to a volume descriptor header. */
320typedef ISO9660VOLDESCHDR *PISO9660VOLDESCHDR;
321/** Pointer to a const volume descriptor header. */
322typedef ISO9660VOLDESCHDR const *PCISO9660VOLDESCHDR;
323
324/** @name ISO9660VOLDESC_TYPE_XXX - volume descriptor types
325 * @{ */
326/** See ISO9660BOOTRECORD. */
327#define ISO9660VOLDESC_TYPE_BOOT_RECORD UINT8_C(0x00)
328/** See ISO9660PRIMARYVOLDESC. */
329#define ISO9660VOLDESC_TYPE_PRIMARY UINT8_C(0x01)
330/** See ISO9660SUPVOLDESC. */
331#define ISO9660VOLDESC_TYPE_SUPPLEMENTARY UINT8_C(0x02)
332/** See ISO9660VOLPARTDESC. */
333#define ISO9660VOLDESC_TYPE_PARTITION UINT8_C(0x03)
334/** Terminates the volume descriptor set. Has no data (zeros), version is 1. */
335#define ISO9660VOLDESC_TYPE_TERMINATOR UINT8_C(0xff)
336/** @} */
337
338/** The value of ISO9660VOLDESCHDR::achStdId */
339#define ISO9660VOLDESC_STD_ID "CD001"
340#define ISO9660VOLDESC_STD_ID_0 'C'
341#define ISO9660VOLDESC_STD_ID_1 'D'
342#define ISO9660VOLDESC_STD_ID_2 '0'
343#define ISO9660VOLDESC_STD_ID_3 '0'
344#define ISO9660VOLDESC_STD_ID_4 '1'
345
346
347
348/**
349 * ISO 9660 boot record (volume descriptor).
350 */
351typedef struct ISO9660BOOTRECORD
352{
353 /** The volume descriptor header.
354 * Type is ISO9660VOLDESC_TYPE_BOOT_RECORD and version
355 * ISO9660BOOTRECORD_VERSION. */
356 ISO9660VOLDESCHDR Hdr;
357 /** Boot system identifier string (a-characters). */
358 char achBootSystemId[32];
359 /** Boot identifier (a-characters). */
360 char achBootId[32];
361 /** Boot system specific content. */
362 uint8_t abBootSystemSpecific[1977];
363} ISO9660BOOTRECORD;
364AssertCompileSize(ISO9660BOOTRECORD, ISO9660_SECTOR_SIZE);
365/** Pointer to an ISO 9660 boot record. */
366typedef ISO9660BOOTRECORD *PISO9660BOOTRECORD;
367/** Pointer to a const ISO 9660 boot record. */
368typedef ISO9660BOOTRECORD const *PCISO9660BOOTRECORD;
369
370/** The value of ISO9660BOOTRECORD::Hdr.uDescVersion. */
371#define ISO9660BOOTRECORD_VERSION UINT8_C(1)
372
373
374/**
375 * ISO 9660 boot record (volume descriptor), El Torito variant.
376 */
377#pragma pack(1)
378typedef struct ISO9660BOOTRECORDELTORITO
379{
380 /** 0x000: The volume descriptor header.
381 * Type is ISO9660VOLDESC_TYPE_BOOT_RECORD and version
382 * ISO9660BOOTRECORD_VERSION. */
383 ISO9660VOLDESCHDR Hdr;
384 /** 0x007: Boot system identifier string,
385 * zero padded ISO9660BOOTRECORDELTORITO_BOOT_SYSTEM_ID. */
386 char achBootSystemId[32];
387 /** 0x027: Boot identifier - all zeros. */
388 char achBootId[32];
389 /** 0x047: Boot catalog location (block offset), always (?) little endian.
390 * @note Misaligned. */
391 uint32_t offBootCatalog;
392 /** 0x04b: Unused - all zeros. */
393 uint8_t abBootSystemSpecific[1973];
394} ISO9660BOOTRECORDELTORITO;
395#pragma pack()
396AssertCompileSize(ISO9660BOOTRECORDELTORITO, ISO9660_SECTOR_SIZE);
397/** Pointer to an ISO 9660 El Torito boot record. */
398typedef ISO9660BOOTRECORDELTORITO *PISO9660BOOTRECORDELTORITO;
399/** Pointer to a const ISO 9660 El Torito boot record. */
400typedef ISO9660BOOTRECORDELTORITO const *PCISO9660BOOTRECORDELTORITO;
401
402/** The value of ISO9660BOOTRECORDELTORITO::achBootSystemId (zero padded). */
403#define ISO9660BOOTRECORDELTORITO_BOOT_SYSTEM_ID "EL TORITO SPECIFICATION"
404
405
406/**
407 * ISO 9660 primary volume descriptor.
408 */
409typedef struct ISO9660PRIMARYVOLDESC
410{
411 /** 0x000: The volume descriptor header.
412 * Type is ISO9660VOLDESC_TYPE_PRIMARY and version
413 * ISO9660PRIMARYVOLDESC_VERSION. */
414 ISO9660VOLDESCHDR Hdr;
415 /** 0x007: Explicit alignment zero padding. */
416 uint8_t bPadding8;
417 /** 0x008: System identifier (a-characters). */
418 char achSystemId[32];
419 /** 0x028: Volume identifier (d-characters). */
420 char achVolumeId[32];
421 /** 0x048: Unused field, zero filled. */
422 ISO9660U32 Unused73;
423 /** 0x050: Volume space size in logical blocks (cbLogicalBlock). */
424 ISO9660U32 VolumeSpaceSize;
425 /** 0x058: Unused field(s), zero filled. */
426 uint8_t abUnused89[32];
427 /** 0x078: The number of volumes in the volume set. */
428 ISO9660U16 cVolumesInSet;
429 /** 0x07c: Volume sequence number. */
430 ISO9660U16 VolumeSeqNo;
431 /** 0x080: Logical block size in bytes. */
432 ISO9660U16 cbLogicalBlock;
433 /** 0x084: Path table size. */
434 ISO9660U32 cbPathTable;
435 /** 0x08c: Type L(ittle endian) path table location (block offset). */
436 ISO9660U32LE offTypeLPathTable;
437 /** 0x090: Optional type L(ittle endian) path table location (block offset). */
438 ISO9660U32LE offOptionalTypeLPathTable;
439 /** 0x094: Type M (big endian) path table location (block offset). */
440 ISO9660U32BE offTypeMPathTable;
441 /** 0x098: Optional type M (big endian) path table location (block offset). */
442 ISO9660U32BE offOptionalTypeMPathTable;
443 /** 0x09c: Directory entry for the root directory (union). */
444 union
445 {
446 uint8_t ab[34];
447 ISO9660DIRREC DirRec;
448 } RootDir;
449 /** 0x0be: Volume set identifier (d-characters). */
450 char achVolumeSetId[128];
451 /** 0x13e: Publisher identifier (a-characters). Alternatively, it may refere to
452 * a file in the root dir if it starts with 0x5f and restricts itself to 8
453 * d-characters. */
454 char achPublisherId[128];
455 /** 0x1be: Data preparer identifier (a-characters).
456 * Same file reference alternative as previous field. */
457 char achDataPreparerId[128];
458 /** 0x23e: Application identifier (a-characters).
459 * Same file reference alternative as previous field. */
460 char achApplicationId[128];
461 /** 0x2be: Copyright (root) file identifier (d-characters).
462 * All spaces if none. */
463 char achCopyrightFileId[37];
464 /** 0x2e3: Abstract (root) file identifier (d-characters).
465 * All spaces if none. */
466 char achAbstractFileId[37];
467 /** 0x308: Bibliographic file identifier (d-characters).
468 * All spaces if none. */
469 char achBibliographicFileId[37];
470 /** 0x32d: Volume creation date and time. */
471 ISO9660TIMESTAMP BirthTime;
472 /** 0x33e: Volume modification date and time. */
473 ISO9660TIMESTAMP ModifyTime;
474 /** 0x34f: Volume (data) expiration date and time.
475 * If not specified, don't regard data as obsolete. */
476 ISO9660TIMESTAMP ExpireTime;
477 /** 0x360: Volume (data) effective date and time.
478 * If not specified, info can be used immediately. */
479 ISO9660TIMESTAMP EffectiveTime;
480 /** 0x371: File structure version (ISO9660_FILE_STRUCTURE_VERSION). */
481 uint8_t bFileStructureVersion;
482 /** 0x372: Reserve for future, MBZ. */
483 uint8_t bReserved883;
484 /** 0x373: Reserve for future.
485 * mkisofs & genisoimage & libisofs seems to space pad this most of the time.
486 * Microsoft image (2.56) zero pads it. isomd5sum uses it to store checksum
487 * info for the iso and space pads it. */
488 uint8_t abAppUse[512];
489 /** 0x573: Reserved for future standardization, MBZ. */
490 uint8_t abReserved1396[653];
491} ISO9660PRIMARYVOLDESC;
492AssertCompileSize(ISO9660PRIMARYVOLDESC, ISO9660_SECTOR_SIZE);
493/** Pointer to a ISO 9660 primary volume descriptor. */
494typedef ISO9660PRIMARYVOLDESC *PISO9660PRIMARYVOLDESC;
495/** Pointer to a const ISO 9660 primary volume descriptor. */
496typedef ISO9660PRIMARYVOLDESC const *PCISO9660PRIMARYVOLDESC;
497
498/** The value of ISO9660PRIMARYVOLDESC::Hdr.uDescVersion. */
499#define ISO9660PRIMARYVOLDESC_VERSION UINT8_C(1)
500/** The value of ISO9660PRIMARYVOLDESC::bFileStructureVersion and
501 * ISO9660SUPVOLDESC::bFileStructureVersion. */
502#define ISO9660_FILE_STRUCTURE_VERSION UINT8_C(1)
503
504
505
506/**
507 * ISO 9660 supplementary volume descriptor.
508 *
509 * This is in the large parts identicial to the primary descriptor, except it
510 * have a few more fields where the primary one has reserved spaces.
511 */
512typedef struct ISO9660SUPVOLDESC
513{
514 /** 0x000: The volume descriptor header.
515 * Type is ISO9660VOLDESC_TYPE_SUPPLEMENTARY and version
516 * ISO9660SUPVOLDESC_VERSION. */
517 ISO9660VOLDESCHDR Hdr;
518 /** 0x007: Volume flags (ISO9660SUPVOLDESC_VOL_F_XXX).
519 * @note This is reserved in the primary volume descriptor. */
520 uint8_t fVolumeFlags;
521 /** 0x008: System identifier (a1-characters) of system that can act upon
522 * sectors 0 thru 15.
523 * @note Purpose differs from primary description. */
524 char achSystemId[32];
525 /** 0x028: Volume identifier (d1-characters).
526 * @note Character set differs from primary description. */
527 char achVolumeId[32];
528 /** 0x048: Unused field, zero filled. */
529 ISO9660U32 Unused73;
530 /** 0x050: Volume space size in logical blocks (cbLogicalBlock). */
531 ISO9660U32 VolumeSpaceSize;
532 /** 0x058: Escape sequences.
533 * Complicated stuff, see ISO 2022 and ECMA-35.
534 * @note This is reserved in the primary volume descriptor. */
535 uint8_t abEscapeSequences[32];
536 /** 0x078: The number of volumes in the volume set. */
537 ISO9660U16 cVolumesInSet;
538 /** 0x07c: Volume sequence number. */
539 ISO9660U16 VolumeSeqNo;
540 /** 0x080: Logical block size in bytes. */
541 ISO9660U16 cbLogicalBlock;
542 /** 0x084: Path table size. */
543 ISO9660U32 cbPathTable;
544 /** 0x08c: Type L(ittle endian) path table location (block offset). */
545 ISO9660U32LE offTypeLPathTable;
546 /** 0x090: Optional type L(ittle endian) path table location (block offset). */
547 ISO9660U32LE offOptionalTypeLPathTable;
548 /** 0x094: Type M (big endian) path table location (block offset). */
549 ISO9660U32BE offTypeMPathTable;
550 /** 0x098: Optional type M (big endian) path table location (block offset). */
551 ISO9660U32BE offOptionalTypeMPathTable;
552 /** 0x09c: Directory entry for the root directory (union). */
553 union
554 {
555 uint8_t ab[34];
556 ISO9660DIRREC DirRec;
557 } RootDir;
558 /** 0x0be: Volume set identifier (d1-characters).
559 * @note Character set differs from primary description. */
560 char achVolumeSetId[128];
561 /** 0x13e: Publisher identifier (a1-characters). Alternatively, it may refere
562 * to a file in the root dir if it starts with 0x5f and restricts itself to 8
563 * d1-characters.
564 * @note Character set differs from primary description. */
565 char achPublisherId[128];
566 /** 0x1be: Data preparer identifier (a1-characters).
567 * Same file reference alternative as previous field.
568 * @note Character set differs from primary description. */
569 char achDataPreparerId[128];
570 /** 0x23e: Application identifier (a1-characters).
571 * Same file reference alternative as previous field.
572 * @note Character set differs from primary description. */
573 char achApplicationId[128];
574 /** 0x2be: Copyright (root) file identifier (d1-characters).
575 * All spaces if none.
576 * @note Character set differs from primary description. */
577 char achCopyrightFileId[37];
578 /** 0x2e3: Abstract (root) file identifier (d1-characters).
579 * All spaces if none.
580 * @note Character set differs from primary description. */
581 char achAbstractFileId[37];
582 /** 0x308: Bibliographic file identifier (d1-characters).
583 * All spaces if none.
584 * @note Character set differs from primary description. */
585 char achBibliographicFileId[37];
586 /** 0x32d: Volume creation date and time. */
587 ISO9660TIMESTAMP BirthTime;
588 /** 0x33e: Volume modification date and time. */
589 ISO9660TIMESTAMP ModifyTime;
590 /** 0x34f: Volume (data) expiration date and time.
591 * If not specified, don't regard data as obsolete. */
592 ISO9660TIMESTAMP ExpireTime;
593 /** 0x360: Volume (data) effective date and time.
594 * If not specified, info can be used immediately. */
595 ISO9660TIMESTAMP EffectiveTime;
596 /** 0x371: File structure version (ISO9660_FILE_STRUCTURE_VERSION). */
597 uint8_t bFileStructureVersion;
598 /** 0x372: Reserve for future, MBZ. */
599 uint8_t bReserved883;
600 /** 0x373: Reserve for future, MBZ. */
601 uint8_t abAppUse[512];
602 /** 0x573: Reserved for future standardization, MBZ. */
603 uint8_t abReserved1396[653];
604} ISO9660SUPVOLDESC;
605AssertCompileSize(ISO9660SUPVOLDESC, ISO9660_SECTOR_SIZE);
606/** Pointer to a ISO 9660 supplementary volume descriptor. */
607typedef ISO9660SUPVOLDESC *PISO9660SUPVOLDESC;
608/** Pointer to a const ISO 9660 supplementary volume descriptor. */
609typedef ISO9660SUPVOLDESC const *PCISO9660SUPVOLDESC;
610/** The value of ISO9660SUPVOLDESC::Hdr.uDescVersion. */
611#define ISO9660SUPVOLDESC_VERSION UINT8_C(1)
612
613/** @name ISO9660SUPVOLDESC_VOL_F_XXX - ISO9660SUPVOLDESC::fVolumeFlags
614 * @{ */
615#define ISO9660SUPVOLDESC_VOL_F_ESC_ONLY_REG UINT8_C(0x00)
616#define ISO9660SUPVOLDESC_VOL_F_ESC_NOT_REG UINT8_C(0x01)
617/** @} */
618
619
620
621/**
622 * ISO 9660 volume partition descriptor.
623 */
624typedef struct ISO9660VOLPARTDESC
625{
626 /** 0x000: The volume descriptor header.
627 * Type is ISO9660VOLDESC_TYPE_PARTITION and version
628 * ISO9660VOLPARTDESC_VERSION. */
629 ISO9660VOLDESCHDR Hdr;
630 /** 0x007: Alignment padding. */
631 uint8_t bPadding8;
632 /** 0x008: System identifier (a-characters). */
633 char achSystemId[32];
634 /** 0x028: Volume partition identifier (d-characters). */
635 char achVolumePartitionId[32];
636 /** 0x048: The location of the partition (logical block number). */
637 ISO9660U32 offVolumePartition;
638 /** 0x050: The partition size in logical blocks (cbLogicalBlock). */
639 ISO9660U32 VolumePartitionSize;
640 /** 0x058: System specific data. */
641 uint8_t achSystemUse[1960];
642} ISO9660VOLPARTDESC;
643AssertCompileSize(ISO9660VOLPARTDESC, ISO9660_SECTOR_SIZE);
644/** Pointer to an ISO 9660 volume partition description. */
645typedef ISO9660VOLPARTDESC *PISO9660VOLPARTDESC;
646/** Pointer to a const ISO 9660 volume partition description. */
647typedef ISO9660VOLPARTDESC const *PCISO9660VOLPARTDESC;
648/** The value of ISO9660VOLPARTDESC::Hdr.uDescVersion. */
649#define ISO9660VOLPARTDESC_VERSION UINT8_C(1)
650
651
652
653/** @name Joliet escape sequence identifiers.
654 *
655 * These bytes appears in the supplementary volume descriptor field
656 * abEscapeSequences. The ISO9660SUPVOLDESC_VOL_F_ESC_NOT_REG flags will not
657 * be set.
658 *
659 * @{ */
660#define ISO9660_JOLIET_ESC_SEQ_0 UINT8_C(0x25) /**< First escape sequence byte.*/
661#define ISO9660_JOLIET_ESC_SEQ_1 UINT8_C(0x2f) /**< Second escape sequence byte.*/
662#define ISO9660_JOLIET_ESC_SEQ_2_LEVEL_1 UINT8_C(0x40) /**< Third escape sequence byte: level 1 */
663#define ISO9660_JOLIET_ESC_SEQ_2_LEVEL_2 UINT8_C(0x43) /**< Third escape sequence byte: level 2 */
664#define ISO9660_JOLIET_ESC_SEQ_2_LEVEL_3 UINT8_C(0x45) /**< Third escape sequence byte: level 3 */
665/** @} */
666
667
668/** The size of an El Torito boot catalog entry. */
669#define ISO9660_ELTORITO_ENTRY_SIZE UINT32_C(0x20)
670
671/**
672 * El Torito boot catalog: Validation entry.
673 *
674 * This is the first entry in the boot catalog. It is followed by a
675 * ISO9660ELTORITODEFAULTENTRY, which in turn is followed by a
676 * ISO9660ELTORITOSECTIONHEADER.
677 */
678typedef struct ISO9660ELTORITOVALIDATIONENTRY
679{
680 /** 0x00: The header ID (ISO9660_ELTORITO_HEADER_ID_VALIDATION_ENTRY). */
681 uint8_t bHeaderId;
682 /** 0x01: The platform ID (ISO9660_ELTORITO_PLATFORM_ID_XXX). */
683 uint8_t bPlatformId;
684 /** 0x02: Reserved, MBZ. */
685 uint16_t u16Reserved;
686 /** 0x04: String ID of the developer of the CD/DVD-ROM. */
687 char achId[24];
688 /** 0x1c: The checksum. */
689 uint16_t u16Checksum;
690 /** 0x1e: Key byte 1 (ISO9660_ELTORITO_KEY_BYTE_1). */
691 uint8_t bKey1;
692 /** 0x1f: Key byte 2 (ISO9660_ELTORITO_KEY_BYTE_2). */
693 uint8_t bKey2;
694} ISO9660ELTORITOVALIDATIONENTRY;
695AssertCompileSize(ISO9660ELTORITOVALIDATIONENTRY, ISO9660_ELTORITO_ENTRY_SIZE);
696/** Pointer to an El Torito validation entry. */
697typedef ISO9660ELTORITOVALIDATIONENTRY *PISO9660ELTORITOVALIDATIONENTRY;
698/** Pointer to a const El Torito validation entry. */
699typedef ISO9660ELTORITOVALIDATIONENTRY const *PCISO9660ELTORITOVALIDATIONENTRY;
700
701/** ISO9660ELTORITOVALIDATIONENTRY::bKey1 value. */
702#define ISO9660_ELTORITO_KEY_BYTE_1 UINT8_C(0x55)
703/** ISO9660ELTORITOVALIDATIONENTRY::bKey2 value. */
704#define ISO9660_ELTORITO_KEY_BYTE_2 UINT8_C(0xaa)
705
706
707/** @name ISO9660_ELTORITO_HEADER_ID_XXX - header IDs.
708 * @{ */
709/** Header ID for a ISO9660ELTORITOVALIDATIONENTRY. */
710#define ISO9660_ELTORITO_HEADER_ID_VALIDATION_ENTRY UINT8_C(0x01)
711/** Header ID for a ISO9660ELTORITOSECTIONHEADER. */
712#define ISO9660_ELTORITO_HEADER_ID_SECTION_HEADER UINT8_C(0x90)
713/** Header ID for the final ISO9660ELTORITOSECTIONHEADER. */
714#define ISO9660_ELTORITO_HEADER_ID_FINAL_SECTION_HEADER UINT8_C(0x91)
715/** @} */
716
717
718/** @name ISO9660_ELTORITO_PLATFORM_ID_XXX - El Torito Platform IDs
719 * @{ */
720#define ISO9660_ELTORITO_PLATFORM_ID_X86 UINT8_C(0x00) /**< 80x86 */
721#define ISO9660_ELTORITO_PLATFORM_ID_PPC UINT8_C(0x01) /**< PowerPC */
722#define ISO9660_ELTORITO_PLATFORM_ID_MAC UINT8_C(0x02) /**< Mac */
723#define ISO9660_ELTORITO_PLATFORM_ID_EFI UINT8_C(0xef) /**< UEFI */
724/** @} */
725
726
727/**
728 * El Torito boot catalog: Section header entry.
729 *
730 * A non-final section header entry is followed by
731 * ISO9660ELTORITOSECTIONHEADER::cEntries ISO9660ELTORITOSECTIONTENTRY instances.
732 */
733typedef struct ISO9660ELTORITOSECTIONHEADER
734{
735 /** 0x00: Header ID - ISO9660_ELTORITO_HEADER_ID_SECTION_HEADER or
736 * ISO9660_ELTORITO_HEADER_ID_FINAL_SECTION_HEADER (if final). */
737 uint8_t bHeaderId;
738 /** 0x01: The platform ID (ISO9660_ELTORITO_PLATFORM_ID_XXX). */
739 uint8_t bPlatformId;
740 /** 0x02: Number of entries in this section (i.e. following this header). */
741 uint16_t cEntries;
742 /** 0x04: String ID for the section. */
743 char achSectionId[28];
744} ISO9660ELTORITOSECTIONHEADER;
745AssertCompileSize(ISO9660ELTORITOSECTIONHEADER, ISO9660_ELTORITO_ENTRY_SIZE);
746/** Pointer to an El Torito section header entry. */
747typedef ISO9660ELTORITOSECTIONHEADER *PISO9660ELTORITOSECTIONHEADER;
748/** Pointer to a const El Torito section header entry. */
749typedef ISO9660ELTORITOSECTIONHEADER const *PCISO9660ELTORITOSECTIONHEADER;
750
751
752/**
753 * El Torito boot catalog: Default (initial) entry.
754 *
755 * Followed by ISO9660ELTORITOSECTIONHEADER.
756 *
757 * Differs from ISO9660ELTORITOSECTIONENTRY in that it doesn't have a
758 * selection criteria and no media flags (only type).
759 */
760typedef struct ISO9660ELTORITODEFAULTENTRY
761{
762 /** 0x00: Boot indicator (ISO9660_ELTORITO_BOOT_INDICATOR_XXX). */
763 uint8_t bBootIndicator;
764 /** 0x01: Boot media type. The first four bits are defined by
765 * ISO9660_ELTORITO_BOOT_MEDIA_TYPE_XXX, whereas the top four bits MBZ. */
766 uint8_t bBootMediaType;
767 /** 0x02: Load segment - load address divided by 0x10. */
768 uint16_t uLoadSeg;
769 /** 0x04: System type from image partition table. */
770 uint8_t bSystemType;
771 /** 0x05: Unused, MBZ. */
772 uint8_t bUnused;
773 /** 0x06: Number of emulated 512 byte sectors to load. */
774 uint16_t cEmulatedSectorsToLoad;
775 /** 0x08: Image location in the ISO (block offset), always (?) little endian. */
776 uint32_t offBootImage;
777 /** 0x0c: Reserved, MBZ */
778 uint8_t abReserved[20];
779} ISO9660ELTORITODEFAULTENTRY;
780AssertCompileSize(ISO9660ELTORITODEFAULTENTRY, ISO9660_ELTORITO_ENTRY_SIZE);
781/** Pointer to an El Torito default (initial) entry. */
782typedef ISO9660ELTORITODEFAULTENTRY *PISO9660ELTORITODEFAULTENTRY;
783/** Pointer to a const El Torito default (initial) entry. */
784typedef ISO9660ELTORITODEFAULTENTRY const *PCISO9660ELTORITODEFAULTENTRY;
785
786
787/**
788 * El Torito boot catalg: Section entry.
789 */
790typedef struct ISO9660ELTORITOSECTIONENTRY
791{
792 /** 0x00: Boot indicator (ISO9660_ELTORITO_BOOT_INDICATOR_XXX). */
793 uint8_t bBootIndicator;
794 /** 0x01: Boot media type and flags. The first four bits are defined by
795 * ISO9660_ELTORITO_BOOT_MEDIA_TYPE_XXX and the top four bits by
796 * ISO9660_ELTORITO_BOOT_MEDIA_F_XXX. */
797 uint8_t bBootMediaType;
798 /** 0x02: Load segment - load address divided by 0x10. */
799 uint16_t uLoadSeg;
800 /** 0x04: System type from image partition table. */
801 uint8_t bSystemType;
802 /** 0x05: Unused, MBZ. */
803 uint8_t bUnused;
804 /** 0x06: Number of emulated 512 byte sectors to load. */
805 uint16_t cEmulatedSectorsToLoad;
806 /** 0x08: Image location in the ISO (block offset), always (?) little endian. */
807 uint32_t offBootImage;
808 /** 0x0c: Selection criteria type (ISO9660_ELTORITO_SEL_CRIT_TYPE_XXX). */
809 uint8_t bSelectionCriteriaType;
810 /** 0x0c: Selection criteria specific data. */
811 uint8_t abSelectionCriteria[19];
812} ISO9660ELTORITOSECTIONENTRY;
813AssertCompileSize(ISO9660ELTORITOSECTIONENTRY, ISO9660_ELTORITO_ENTRY_SIZE);
814/** Pointer to an El Torito default (initial) entry. */
815typedef ISO9660ELTORITOSECTIONENTRY *PISO9660ELTORITOSECTIONENTRY;
816/** Pointer to a const El Torito default (initial) entry. */
817typedef ISO9660ELTORITOSECTIONENTRY const *PCISO9660ELTORITOSECTIONENTRY;
818
819
820/** @name ISO9660_ELTORITO_BOOT_INDICATOR_XXX - Boot indicators.
821 * @{ */
822#define ISO9660_ELTORITO_BOOT_INDICATOR_BOOTABLE UINT8_C(0x88)
823#define ISO9660_ELTORITO_BOOT_INDICATOR_NOT_BOOTABLE UINT8_C(0x00)
824/** @} */
825
826/** @name ISO9660_ELTORITO_BOOT_MEDIA_TYPE_XXX - Boot media types.
827 * @{ */
828#define ISO9660_ELTORITO_BOOT_MEDIA_TYPE_NO_EMULATION UINT8_C(0x0)
829#define ISO9660_ELTORITO_BOOT_MEDIA_TYPE_FLOPPY_1_2_MB UINT8_C(0x1)
830#define ISO9660_ELTORITO_BOOT_MEDIA_TYPE_FLOPPY_1_44_MB UINT8_C(0x2)
831#define ISO9660_ELTORITO_BOOT_MEDIA_TYPE_FLOPPY_2_88_MB UINT8_C(0x3)
832#define ISO9660_ELTORITO_BOOT_MEDIA_TYPE_HARD_DISK UINT8_C(0x4)
833#define ISO9660_ELTORITO_BOOT_MEDIA_TYPE_MASK UINT8_C(0xf) /**< The media type mask. */
834/** @} */
835
836/** @name ISO9660_ELTORITO_BOOT_MEDIA_F_XXX - Boot media flags.
837 * These only applies to the section entry, not to the default (initial) entry.
838 * @{ */
839#define ISO9660_ELTORITO_BOOT_MEDIA_F_RESERVED UINT8_C(0x10) /**< Reserved bit, MBZ. */
840#define ISO9660_ELTORITO_BOOT_MEDIA_F_CONTINUATION UINT8_C(0x20) /**< Contiunation entry follows. */
841#define ISO9660_ELTORITO_BOOT_MEDIA_F_ATAPI_DRIVER UINT8_C(0x40) /**< Image contains an ATAPI driver. */
842#define ISO9660_ELTORITO_BOOT_MEDIA_F_SCSI_DRIVERS UINT8_C(0x80) /**< Image contains SCSI drivers. */
843#define ISO9660_ELTORITO_BOOT_MEDIA_F_MASK UINT8_C(0xf0) /**< The media/entry flag mask. */
844/** @} */
845
846/** @name ISO9660_ELTORITO_SEL_CRIT_TYPE_XXX - Selection criteria type.
847 * @{ */
848#define ISO9660_ELTORITO_SEL_CRIT_TYPE_NONE UINT8_C(0x00) /**< No selection criteria */
849#define ISO9660_ELTORITO_SEL_CRIT_TYPE_LANG_AND_VERSION UINT8_C(0x01) /**< Language and version (IBM). */
850/** @} */
851
852
853/**
854 * El Torito boot catalog: Section entry extension.
855 *
856 * This is used for carrying additional selection criteria data. It follows
857 * a ISO9660ELTORITOSECTIONENTRY.
858 */
859typedef struct ISO9660ELTORITOSECTIONENTRYEXT
860{
861 /** 0x00: Extension indicator (ISO9660_ELTORITO_SECTION_ENTRY_EXT_ID). */
862 uint8_t bExtensionId;
863 /** 0x01: Selection criteria extension flags (ISO9660_ELTORITO_SECTION_ENTRY_EXT_F_XXX). */
864 uint8_t fFlags;
865 /** 0x02: Selection critiera data. */
866 uint8_t abSelectionCriteria[30];
867} ISO9660ELTORITOSECTIONENTRYEXT;
868AssertCompileSize(ISO9660ELTORITOSECTIONENTRYEXT, ISO9660_ELTORITO_ENTRY_SIZE);
869/** Pointer to an El Torito default (initial) entry. */
870typedef ISO9660ELTORITOSECTIONENTRYEXT *PISO9660ELTORITOSECTIONENTRYEXT;
871/** Pointer to a const El Torito default (initial) entry. */
872typedef ISO9660ELTORITOSECTIONENTRYEXT const *PCISO9660ELTORITOSECTIONENTRYEXT;
873
874/** Value of ISO9660ELTORITOSECTIONENTRYEXT::bExtensionId. */
875#define ISO9660_ELTORITO_SECTION_ENTRY_EXT_ID UINT8_C(0x44)
876
877/** @name ISO9660_ELTORITO_SECTION_ENTRY_EXT_F_XXX - ISO9660ELTORITOSECTIONENTRYEXT::fFlags
878 * @{ */
879#define ISO9660_ELTORITO_SECTION_ENTRY_EXT_F_MORE UINT8_C(0x20) /**< Further extension entries follows. */
880#define ISO9660_ELTORITO_SECTION_ENTRY_EXT_F_UNUSED_MASK UINT8_C(0xef) /**< Mask of all unused bits. */
881/** @} */
882
883
884/**
885 * Boot information table used by isolinux and GRUB2 El Torito boot files.
886 */
887typedef struct ISO9660SYSLINUXINFOTABLE
888{
889 /** 0x00/0x08: Offset of the primary volume descriptor (block offset). */
890 uint32_t offPrimaryVolDesc;
891 /** 0x04/0x0c: Offset of the boot file (block offset). */
892 uint32_t offBootFile;
893 /** 0x08/0x10: Size of the boot file in bytes. */
894 uint32_t cbBootFile;
895 /** 0x0c/0x14: Boot file checksum.
896 * This is the sum of all the 32-bit words in the image, start at the end of
897 * this structure (i.e. offset 64). */
898 uint32_t uChecksum;
899 /** 0x10/0x18: Reserved for future fun. */
900 uint32_t auReserved[10];
901} ISO9660SYSLINUXINFOTABLE;
902AssertCompileSize(ISO9660SYSLINUXINFOTABLE, 56);
903/** Pointer to a syslinux boot information table. */
904typedef ISO9660SYSLINUXINFOTABLE *PISO9660SYSLINUXINFOTABLE;
905/** Pointer to a const syslinux boot information table. */
906typedef ISO9660SYSLINUXINFOTABLE const *PCISO9660SYSLINUXINFOTABLE;
907
908/** The file offset of the isolinux boot info table. */
909#define ISO9660SYSLINUXINFOTABLE_OFFSET 8
910
911
912
913/**
914 * System Use Sharing Protocol Protocol (SUSP) header.
915 */
916typedef struct ISO9660SUSPHDR
917{
918 /** Signature byte 1. */
919 uint8_t bSig1;
920 /** Signature byte 2. */
921 uint8_t bSig2;
922 /** Length of the entry (including the header). */
923 uint8_t cbEntry;
924 /** Entry version number. */
925 uint8_t bVersion;
926} ISO9660SUSPHDR;
927AssertCompileSize(ISO9660SUSPHDR, 4);
928/** Pointer to a SUSP header. */
929typedef ISO9660SUSPHDR *PISO9660SUSPHDR;
930/** Pointer to a const SUSP header. */
931typedef ISO9660SUSPHDR const *PCISO9660SUSPHDR;
932
933
934/**
935 * SUSP continuation entry (CE).
936 */
937typedef struct ISO9660SUSPCE
938{
939 /** Header (ISO9660SUSPCE_SIG1, ISO9660SUSPCE_SIG2, ISO9660SUSPCE_VER). */
940 ISO9660SUSPHDR Hdr;
941 /** The offset of the continutation data block (block offset). */
942 ISO9660U32 offBlock;
943 /** The byte offset in the block of the contiuation data. */
944 ISO9660U32 offData;
945 /** The size of the continuation data. */
946 ISO9660U32 cbData;
947} ISO9660SUSPCE;
948/** Pointer to a SUSP continuation entry. */
949typedef ISO9660SUSPCE *PISO9660SUSPCE;
950/** Pointer to a const SUSP continuation entry. */
951typedef ISO9660SUSPCE const *PCISO9660SUSPCE;
952#define ISO9660SUSPCE_SIG1 'C' /**< SUSP continutation entry signature byte 1. */
953#define ISO9660SUSPCE_SIG2 'E' /**< SUSP continutation entry signature byte 2. */
954#define ISO9660SUSPCE_LEN 28 /**< SUSP continutation entry length. */
955#define ISO9660SUSPCE_VER 1 /**< SUSP continutation entry version number. */
956AssertCompileSize(ISO9660SUSPCE, ISO9660SUSPCE_LEN);
957
958
959/**
960 * SUSP padding entry (PD).
961 */
962typedef struct ISO9660SUSPPD
963{
964 /** Header (ISO9660SUSPPD_SIG1, ISO9660SUSPPD_SIG2, ISO9660SUSPPD_VER). */
965 ISO9660SUSPHDR Hdr;
966 /* Padding follows. */
967} ISO9660SUSPPD;
968AssertCompileSize(ISO9660SUSPPD, 4);
969/** Pointer to a SUSP padding entry. */
970typedef ISO9660SUSPPD *PISO9660SUSPPD;
971/** Pointer to a const SUSP padding entry. */
972typedef ISO9660SUSPPD const *PCISO9660SUSPPD;
973#define ISO9660SUSPPD_SIG1 'P' /**< SUSP padding entry signature byte 1. */
974#define ISO9660SUSPPD_SIG2 'D' /**< SUSP padding entry signature byte 2. */
975#define ISO9660SUSPPD_VER 1 /**< SUSP padding entry version number. */
976
977
978/**
979 * SUSP system use protocol entry (SP)
980 *
981 * This is only used in the '.' record of the root directory.
982 */
983typedef struct ISO9660SUSPSP
984{
985 /** Header (ISO9660SUSPSP_SIG1, ISO9660SUSPSP_SIG2,
986 * ISO9660SUSPSP_LEN, ISO9660SUSPSP_VER). */
987 ISO9660SUSPHDR Hdr;
988 /** Check byte 1 (ISO9660SUSPSP_CHECK1). */
989 uint8_t bCheck1;
990 /** Check byte 2 (ISO9660SUSPSP_CHECK2). */
991 uint8_t bCheck2;
992 /** Number of bytes to skip within the system use field of each directory
993 * entry (except the '.' entry of the root, since that's where this is). */
994 uint8_t cbSkip;
995} ISO9660SUSPSP;
996/** Pointer to a SUSP entry. */
997typedef ISO9660SUSPSP *PISO9660SUSPSP;
998/** Pointer to a const SUSP entry. */
999typedef ISO9660SUSPSP const *PCISO9660SUSPSP;
1000#define ISO9660SUSPSP_SIG1 'S' /**< SUSP system use protocol entry signature byte 1. */
1001#define ISO9660SUSPSP_SIG2 'P' /**< SUSP system use protocol entry signature byte 2. */
1002#define ISO9660SUSPSP_VER 1 /**< SUSP system use protocol entry version number. */
1003#define ISO9660SUSPSP_LEN 7 /**< SUSP system use protocol entry length (fixed). */
1004#define ISO9660SUSPSP_CHECK1 UINT8_C(0xbe) /**< SUSP system use protocol entry check byte 1. */
1005#define ISO9660SUSPSP_CHECK2 UINT8_C(0xef) /**< SUSP system use protocol entry check byte 2. */
1006AssertCompileSize(ISO9660SUSPSP, ISO9660SUSPSP_LEN);
1007
1008
1009/**
1010 * SUSP terminator entry (ST)
1011 *
1012 * Used to terminate system use entries.
1013 */
1014typedef struct ISO9660SUSPST
1015{
1016 /** Header (ISO9660SUSPST_SIG1, ISO9660SUSPST_SIG2,
1017 * ISO9660SUSPST_LEN, ISO9660SUSPST_VER). */
1018 ISO9660SUSPHDR Hdr;
1019} ISO9660SUSPST;
1020/** Pointer to a SUSP padding entry. */
1021typedef ISO9660SUSPST *PISO9660SUSPST;
1022/** Pointer to a const SUSP padding entry. */
1023typedef ISO9660SUSPST const *PCISO9660SUSPST;
1024#define ISO9660SUSPST_SIG1 'S' /**< SUSP system use protocol entry signature byte 1. */
1025#define ISO9660SUSPST_SIG2 'T' /**< SUSP system use protocol entry signature byte 2. */
1026#define ISO9660SUSPST_VER 1 /**< SUSP system use protocol entry version number. */
1027#define ISO9660SUSPST_LEN 4 /**< SUSP system use protocol entry length (fixed). */
1028AssertCompileSize(ISO9660SUSPST, ISO9660SUSPST_LEN);
1029
1030
1031/**
1032 * SUSP extension record entry (ER)
1033 *
1034 * This is only used in the '.' record of the root directory. There can be multiple of these.
1035 */
1036typedef struct ISO9660SUSPER
1037{
1038 /** Header (ISO9660SUSPER_SIG1, ISO9660SUSPER_SIG2, ISO9660SUSPER_VER). */
1039 ISO9660SUSPHDR Hdr;
1040 /** The length of the identifier component. */
1041 uint8_t cchIdentifier;
1042 /** The length of the description component. */
1043 uint8_t cchDescription;
1044 /** The length of the source component. */
1045 uint8_t cchSource;
1046 /** The extension version number. */
1047 uint8_t bVersion;
1048 /** The payload: first @a cchIdentifier chars of identifier string, second
1049 * @a cchDescription chars of description string, thrid @a cchSource chars
1050 * of source string. Variable length. */
1051 char achPayload[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1052} ISO9660SUSPER;
1053/** Pointer to a SUSP padding entry. */
1054typedef ISO9660SUSPER *PISO9660SUSPER;
1055/** Pointer to a const SUSP padding entry. */
1056typedef ISO9660SUSPER const *PCISO9660SUSPER;
1057#define ISO9660SUSPER_SIG1 'E' /**< SUSP extension record entry signature byte 1. */
1058#define ISO9660SUSPER_SIG2 'R' /**< SUSP extension record entry signature byte 2. */
1059#define ISO9660SUSPER_VER 1 /**< SUSP extension record entry version number. */
1060#define ISO9660SUSPER_OFF_PAYLOAD 8 /**< SUSP extension record entry payload member offset. */
1061AssertCompileMemberOffset(ISO9660SUSPER, achPayload, ISO9660SUSPER_OFF_PAYLOAD);
1062
1063/**
1064 * SUSP extension sequence entry (ES)
1065 *
1066 * This is only used in the '.' record of the root directory.
1067 */
1068typedef struct ISO9660SUSPES
1069{
1070 /** Header (ISO9660SUSPES_SIG1, ISO9660SUSPES_SIG2, ISO9660SUSPES_VER). */
1071 ISO9660SUSPHDR Hdr;
1072 /** The ER entry sequence number of the extension comming first. */
1073 uint8_t iFirstExtension;
1074} ISO9660SUSPES;
1075/** Pointer to a SUSP padding entry. */
1076typedef ISO9660SUSPES *PISO9660SUSPES;
1077/** Pointer to a const SUSP padding entry. */
1078typedef ISO9660SUSPES const *PCISO9660SUSPES;
1079#define ISO9660SUSPES_SIG1 'E' /**< SUSP extension sequence entry signature byte 1. */
1080#define ISO9660SUSPES_SIG2 'S' /**< SUSP extension sequence entry signature byte 2. */
1081#define ISO9660SUSPES_VER 1 /**< SUSP extension sequence entry version number. */
1082#define ISO9660SUSPES_LEN 5 /**< SUSP extension sequence entry length (fixed). */
1083AssertCompileSize(ISO9660SUSPES, ISO9660SUSPES_LEN);
1084
1085
1086/** RRIP ER identifier string from Rock Ridge Interchange Protocol v1.10 specs. */
1087#define ISO9660_RRIP_ID "RRIP_1991A"
1088/** RRIP ER recommended description string (from RRIP v1.10 specs). */
1089#define ISO9660_RRIP_DESC "THE ROCK RIDGE INTERCHANGE PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS"
1090/** RRIP ER recommended source string (from RRIP v1.10 specs). */
1091#define ISO9660_RRIP_SRC "PLEASE CONTACT DISC PUBLISHER FOR SPECIFICATION SOURCE. SEE PUBLISHER IDENTIFIER IN PRIMARY VOLUME DESCRIPTOR FOR CONTACT INFORMATION."
1092/** RRIP ER version field value from the Rock Ridge Interchange Protocol v1.10 specs. */
1093#define ISO9660_RRIP_VER 1
1094/** The length of a RRIP v1.10 ER record.
1095 * The record must be constructed using ISO9660_RRIP_ID, ISO9660_RRIP_DESC
1096 * and ISO9660_RRIP_SRC. */
1097#define ISO9660_RRIP_ER_LEN ((uint8_t)( ISO9660SUSPER_OFF_PAYLOAD \
1098 + sizeof(ISO9660_RRIP_ID) - 1 \
1099 + sizeof(ISO9660_RRIP_DESC) - 1 \
1100 + sizeof(ISO9660_RRIP_SRC) - 1 ))
1101
1102/** RRIP ER identifier string from RRIP IEEE P1282 v1.12 draft. */
1103#define ISO9660_RRIP_1_12_ID "IEEE_P1282"
1104/** RRIP ER recommended description string (RRIP IEEE P1282 v1.12 draft). */
1105#define ISO9660_RRIP_1_12_DESC "THE IEEE P1282 PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS."
1106/** RRIP ER recommended source string (RRIP IEEE P1282 v1.12 draft). */
1107#define ISO9660_RRIP_1_12_SRC "PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT, PISCATAWAY, NJ, USA FOR THE P1282 SPECIFICATION."
1108/** RRIP ER version field value from the Rock Ridge Interchange Protocol v1.12 specs. */
1109#define ISO9660_RRIP_1_12_VER 1
1110/** The length of a RRIP v1.12 ER record.
1111 * The record must be constructed using ISO9660_RRIP_1_12_ID,
1112 * ISO9660_RRIP_1_12_DESC and ISO9660_RRIP_1_12_SRC. */
1113#define ISO9660_RRIP_1_12_ER_LEN ((uint8_t)( ISO9660SUSPER_OFF_PAYLOAD \
1114 + sizeof(ISO9660_RRIP_1_12_ID) - 1 \
1115 + sizeof(ISO9660_RRIP_1_12_DESC) - 1 \
1116 + sizeof(ISO9660_RRIP_1_12_SRC) - 1 ))
1117
1118
1119/**
1120 * Rock ridge interchange protocol - RR.
1121 */
1122typedef struct ISO9660RRIPRR
1123{
1124 /** Header (ISO9660RRIPRR_SIG1, ISO9660RRIPRR_SIG2,
1125 * ISO9660RRIPRR_LEN, ISO9660RRIPRR_VER). */
1126 ISO9660SUSPHDR Hdr;
1127 /** Flags indicating which RRIP entries are present (). */
1128 uint8_t fFlags;
1129} ISO9660RRIPRR;
1130/** Pointer to a RRIP RR entry. */
1131typedef ISO9660RRIPRR *PISO9660RRIPRR;
1132/** Pointer to a const RRIP RR entry. */
1133typedef ISO9660RRIPRR const *PCISO9660RRIPRR;
1134#define ISO9660RRIPRR_SIG1 'R' /**< RRIP RR entry signature byte 1. */
1135#define ISO9660RRIPRR_SIG2 'R' /**< RRIP RR entry signature byte 2. */
1136#define ISO9660RRIPRR_VER 1 /**< RRIP RR entry version number. */
1137#define ISO9660RRIPRR_LEN 5 /**< RRIP RR entry length (fixed). */
1138AssertCompileSize(ISO9660RRIPRR, ISO9660RRIPRR_LEN);
1139
1140/** @name ISO9660RRIP_RR_F_XXX - Indicates which RRIP entries are present.
1141 * @{ */
1142#define ISO9660RRIP_RR_F_PX UINT8_C(0x01)
1143#define ISO9660RRIP_RR_F_PN UINT8_C(0x02)
1144#define ISO9660RRIP_RR_F_SL UINT8_C(0x04)
1145#define ISO9660RRIP_RR_F_NM UINT8_C(0x08)
1146#define ISO9660RRIP_RR_F_CL UINT8_C(0x10)
1147#define ISO9660RRIP_RR_F_PL UINT8_C(0x20)
1148#define ISO9660RRIP_RR_F_RE UINT8_C(0x40)
1149#define ISO9660RRIP_RR_F_TF UINT8_C(0x80)
1150/** @} */
1151
1152/**
1153 * Rock ridge interchange protocol - posix attribute entry (PX).
1154 */
1155typedef struct ISO9660RRIPPX
1156{
1157 /** Header (ISO9660RRIPPX_SIG1, ISO9660RRIPPX_SIG2,
1158 * ISO9660RRIPPX_LEN, ISO9660RRIPPX_VER). */
1159 ISO9660SUSPHDR Hdr;
1160 /** The file mode (RTFS_UNIX_XXX, RTFS_TYPE_XXX). */
1161 ISO9660U32 fMode;
1162 /** Number of hardlinks. */
1163 ISO9660U32 cHardlinks;
1164 /** User ID. */
1165 ISO9660U32 uid;
1166 /** Group ID. */
1167 ISO9660U32 gid;
1168 /** Inode number. */
1169 ISO9660U32 INode;
1170} ISO9660RRIPPX;
1171/** Pointer to a RRIP posix attribute entry. */
1172typedef ISO9660RRIPPX *PISO9660RRIPPX;
1173/** Pointer to a const RRIP posix attribute entry. */
1174typedef ISO9660RRIPPX const *PCISO9660RRIPPX;
1175#define ISO9660RRIPPX_SIG1 'P' /**< RRIP posix attribute entry signature byte 1. */
1176#define ISO9660RRIPPX_SIG2 'X' /**< RRIP posix attribute entry signature byte 2. */
1177#define ISO9660RRIPPX_VER 1 /**< RRIP posix attribute entry version number. */
1178#define ISO9660RRIPPX_LEN 44 /**< RRIP posix attribute entry length (fixed). */
1179AssertCompileSize(ISO9660RRIPPX, ISO9660RRIPPX_LEN);
1180#define ISO9660RRIPPX_LEN_NO_INODE 36 /**< RRIP posix attribute entry length without inode (fixed). */
1181
1182
1183/**
1184 * Rock ridge interchange protocol - timestamp entry (TF).
1185 */
1186typedef struct ISO9660RRIPTF
1187{
1188 /** Header (ISO9660RRIPTF_SIG1, ISO9660RRIPTF_SIG2, ISO9660RRIPTF_VER). */
1189 ISO9660SUSPHDR Hdr;
1190 /** Flags, ISO9660RRIPTF_F_XXX. */
1191 uint8_t fFlags;
1192 /** Timestamp payload bytes (variable size and format). */
1193 uint8_t abPayload[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1194} ISO9660RRIPTF;
1195AssertCompileMemberOffset(ISO9660RRIPTF, abPayload, 5);
1196/** Pointer to a RRIP timestamp entry. */
1197typedef ISO9660RRIPTF *PISO9660RRIPTF;
1198/** Pointer to a const RRIP timestamp entry. */
1199typedef ISO9660RRIPTF const *PCISO9660RRIPTF;
1200#define ISO9660RRIPTF_SIG1 'T' /**< RRIP child link entry signature byte 1. */
1201#define ISO9660RRIPTF_SIG2 'F' /**< RRIP child link entry signature byte 2. */
1202#define ISO9660RRIPTF_VER 1 /**< RRIP child link entry version number. */
1203
1204/** @name ISO9660RRIPTF_F_XXX - Timestmap flags.
1205 * @{ */
1206#define ISO9660RRIPTF_F_BIRTH UINT8_C(0x01) /**< Birth (creation) timestamp is recorded. */
1207#define ISO9660RRIPTF_F_MODIFY UINT8_C(0x02) /**< Modification timestamp is recorded. */
1208#define ISO9660RRIPTF_F_ACCESS UINT8_C(0x04) /**< Accessed timestamp is recorded. */
1209#define ISO9660RRIPTF_F_CHANGE UINT8_C(0x08) /**< Attribute change timestamp is recorded. */
1210#define ISO9660RRIPTF_F_BACKUP UINT8_C(0x10) /**< Backup timestamp is recorded. */
1211#define ISO9660RRIPTF_F_EXPIRATION UINT8_C(0x20) /**< Expiration timestamp is recorded. */
1212#define ISO9660RRIPTF_F_EFFECTIVE UINT8_C(0x40) /**< Effective timestamp is recorded. */
1213#define ISO9660RRIPTF_F_LONG_FORM UINT8_C(0x80) /**< If set ISO9660TIMESTAMP is used, otherwise ISO9660RECTIMESTAMP. */
1214/** @} */
1215
1216/**
1217 * Calculates the length of a 'TF' entry given the flags.
1218 *
1219 * @returns Length in bytes.
1220 * @param fFlags The flags (ISO9660RRIPTF_F_XXX).
1221 */
1222DECLINLINE(uint8_t) Iso9660RripTfCalcLength(uint8_t fFlags)
1223{
1224 unsigned cTimestamps = ((fFlags & ISO9660RRIPTF_F_BIRTH) != 0)
1225 + ((fFlags & ISO9660RRIPTF_F_MODIFY) != 0)
1226 + ((fFlags & ISO9660RRIPTF_F_ACCESS) != 0)
1227 + ((fFlags & ISO9660RRIPTF_F_CHANGE) != 0)
1228 + ((fFlags & ISO9660RRIPTF_F_BACKUP) != 0)
1229 + ((fFlags & ISO9660RRIPTF_F_EXPIRATION) != 0)
1230 + ((fFlags & ISO9660RRIPTF_F_EFFECTIVE) != 0);
1231 return (uint8_t)( cTimestamps * (fFlags & ISO9660RRIPTF_F_LONG_FORM ? sizeof(ISO9660TIMESTAMP) : sizeof(ISO9660RECTIMESTAMP))
1232 + RT_OFFSETOF(ISO9660RRIPTF, abPayload));
1233}
1234
1235
1236/**
1237 * Rock ridge interchange protocol - posix device number entry (PN).
1238 *
1239 * Mandatory for block or character devices.
1240 */
1241typedef struct ISO9660RRIPPN
1242{
1243 /** Header (ISO9660RRIPPN_SIG1, ISO9660RRIPPN_SIG2,
1244 * ISO9660RRIPPN_LEN, ISO9660RRIPPN_VER). */
1245 ISO9660SUSPHDR Hdr;
1246 /** The major device number. */
1247 ISO9660U32 Major;
1248 /** The minor device number. */
1249 ISO9660U32 Minor;
1250} ISO9660RRIPPN;
1251/** Pointer to a RRIP posix attribute entry. */
1252typedef ISO9660RRIPPN *PISO9660RRIPPN;
1253/** Pointer to a const RRIP posix attribute entry. */
1254typedef ISO9660RRIPPN const *PCISO9660RRIPPN;
1255#define ISO9660RRIPPN_SIG1 'P' /**< RRIP posix device number entry signature byte 1. */
1256#define ISO9660RRIPPN_SIG2 'N' /**< RRIP posix device number entry signature byte 2. */
1257#define ISO9660RRIPPN_VER 1 /**< RRIP posix device number entry version number. */
1258#define ISO9660RRIPPN_LEN 20 /**< RRIP posix device number entry length (fixed). */
1259AssertCompileSize(ISO9660RRIPPN, ISO9660RRIPPN_LEN);
1260
1261/**
1262 * Rock ridge interchange protocol - symlink entry (SL).
1263 *
1264 * Mandatory for symbolic links.
1265 */
1266typedef struct ISO9660RRIPSL
1267{
1268 /** Header (ISO9660RRIPSL_SIG1, ISO9660RRIPSL_SIG2, ISO9660RRIPSL_VER). */
1269 ISO9660SUSPHDR Hdr;
1270 /** Flags (0 or ISO9660RRIP_SL_F_CONTINUE). */
1271 uint8_t fFlags;
1272 /** Variable length of components. First byte in each component is a
1273 * combination of ISO9660RRIP_SL_C_XXX flag values. The second byte the
1274 * length of character data following it. */
1275 uint8_t abComponents[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1276} ISO9660RRIPSL;
1277AssertCompileMemberOffset(ISO9660RRIPSL, abComponents, 5);
1278/** Pointer to a RRIP symbolic link entry. */
1279typedef ISO9660RRIPSL *PISO9660RRIPSL;
1280/** Pointer to a const RRIP symbolic link entry. */
1281typedef ISO9660RRIPSL const *PCISO9660RRIPSL;
1282#define ISO9660RRIPSL_SIG1 'S' /**< RRIP symbolic link entry signature byte 1. */
1283#define ISO9660RRIPSL_SIG2 'L' /**< RRIP symbolic link entry signature byte 2. */
1284#define ISO9660RRIPSL_VER 1 /**< RRIP symbolic link entry version number. */
1285/** ISO9660RRIPSL.fFlags - When set another symlink entry follows this one. */
1286#define ISO9660RRIP_SL_F_CONTINUE UINT8_C(0x01)
1287/** @name ISO9660RRIP_SL_C_XXX - Symlink component flags.
1288 * @note These matches ISO9660RRIP_NM_F_XXX.
1289 * @{ */
1290/** Indicates that the component continues in the next entry. */
1291#define ISO9660RRIP_SL_C_CONTINUE UINT8_C(0x01)
1292/** Refer to '.' (the current dir). */
1293#define ISO9660RRIP_SL_C_CURRENT UINT8_C(0x02)
1294/** Refer to '..' (the parent dir). */
1295#define ISO9660RRIP_SL_C_PARENT UINT8_C(0x04)
1296/** Refer to '/' (the root dir). */
1297#define ISO9660RRIP_SL_C_ROOT UINT8_C(0x08)
1298/** Reserved / historically was mount point reference. */
1299#define ISO9660RRIP_SL_C_MOUNT_POINT UINT8_C(0x10)
1300/** Reserved / historically was uname network node name. */
1301#define ISO9660RRIP_SL_C_UNAME UINT8_C(0x20)
1302/** Reserved mask (considers historically bits reserved). */
1303#define ISO9660RRIP_SL_C_RESERVED_MASK UINT8_C(0xf0)
1304/** @} */
1305
1306
1307/**
1308 * Rock ridge interchange protocol - name entry (NM).
1309 */
1310typedef struct ISO9660RRIPNM
1311{
1312 /** Header (ISO9660RRIPNM_SIG1, ISO9660RRIPNM_SIG2, ISO9660RRIPNM_VER). */
1313 ISO9660SUSPHDR Hdr;
1314 /** Flags (ISO9660RRIP_NM_F_XXX). */
1315 uint8_t fFlags;
1316 /** The name part (if any). */
1317 char achName[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1318} ISO9660RRIPNM;
1319AssertCompileMemberOffset(ISO9660RRIPNM, achName, 5);
1320/** Pointer to a RRIP name entry. */
1321typedef ISO9660RRIPNM *PISO9660RRIPNM;
1322/** Pointer to a const RRIP name entry. */
1323typedef ISO9660RRIPNM const *PCISO9660RRIPNM;
1324#define ISO9660RRIPNM_SIG1 'N' /**< RRIP name entry signature byte 1. */
1325#define ISO9660RRIPNM_SIG2 'M' /**< RRIP name entry signature byte 2. */
1326#define ISO9660RRIPNM_VER 1 /**< RRIP name entry version number. */
1327/** @name ISO9660RRIP_NM_F_XXX - Name flags.
1328 * @note These matches ISO9660RRIP_SL_C_XXX.
1329 * @{ */
1330/** Indicates there are more 'NM' entries. */
1331#define ISO9660RRIP_NM_F_CONTINUE UINT8_C(0x01)
1332/** Refer to '.' (the current dir). */
1333#define ISO9660RRIP_NM_F_CURRENT UINT8_C(0x02)
1334/** Refer to '..' (the parent dir). */
1335#define ISO9660RRIP_NM_F_PARENT UINT8_C(0x04)
1336/** Reserved / historically was uname network node name. */
1337#define ISO9660RRIP_NM_F_UNAME UINT8_C(0x20)
1338/** Reserved mask (considers historically bits reserved). */
1339#define ISO9660RRIP_NM_F_RESERVED_MASK UINT8_C(0xf8)
1340/** @} */
1341
1342/** Maximum name length in one 'NM' entry. */
1343#define ISO9660RRIPNM_MAX_NAME_LEN 250
1344
1345
1346/**
1347 * Rock ridge interchange protocol - child link entry (CL).
1348 *
1349 * This is used for relocated directories. Relocated directries are employed
1350 * to bypass the ISO 9660 maximum tree depth of 8.
1351 *
1352 * The size of the directory and everything else is found in the '.' entry in
1353 * the specified location. Only the name (NM or dir rec) and this link record
1354 * should be used.
1355 */
1356typedef struct ISO9660RRIPCL
1357{
1358 /** Header (ISO9660RRIPCL_SIG1, ISO9660RRIPCL_SIG2,
1359 * ISO9660RRIPCL_LEN, ISO9660RRIPCL_VER). */
1360 ISO9660SUSPHDR Hdr;
1361 /** The offset of the directory data (block offset). */
1362 ISO9660U32 offExtend;
1363} ISO9660RRIPCL;
1364/** Pointer to a RRIP child link entry. */
1365typedef ISO9660RRIPCL *PISO9660RRIPCL;
1366/** Pointer to a const RRIP child link entry. */
1367typedef ISO9660RRIPCL const *PCISO9660RRIPCL;
1368#define ISO9660RRIPCL_SIG1 'C' /**< RRIP child link entry signature byte 1. */
1369#define ISO9660RRIPCL_SIG2 'L' /**< RRIP child link entry signature byte 2. */
1370#define ISO9660RRIPCL_VER 1 /**< RRIP child link entry version number. */
1371#define ISO9660RRIPCL_LEN 12 /**< RRIP child link entry length. */
1372AssertCompileSize(ISO9660RRIPCL, ISO9660RRIPCL_LEN);
1373
1374
1375/**
1376 * Rock ridge interchange protocol - parent link entry (PL).
1377 *
1378 * This is used in relocated directories. Relocated directries are employed
1379 * to bypass the ISO 9660 maximum tree depth of 8.
1380 *
1381 * The size of the directory and everything else is found in the '.' entry in
1382 * the specified location. Only the name (NM or dir rec) and this link record
1383 * should be used.
1384 */
1385typedef struct ISO9660RRIPPL
1386{
1387 /** Header (ISO9660RRIPPL_SIG1, ISO9660RRIPPL_SIG2,
1388 * ISO9660RRIPPL_LEN, ISO9660RRIPPL_VER). */
1389 ISO9660SUSPHDR Hdr;
1390 /** The offset of the directory data (block offset). */
1391 ISO9660U32 offExtend;
1392} ISO9660RRIPPL;
1393/** Pointer to a RRIP parent link entry. */
1394typedef ISO9660RRIPPL *PISO9660RRIPPL;
1395/** Pointer to a const RRIP parent link entry. */
1396typedef ISO9660RRIPPL const *PCISO9660RRIPPL;
1397#define ISO9660RRIPPL_SIG1 'P' /**< RRIP parent link entry signature byte 1. */
1398#define ISO9660RRIPPL_SIG2 'L' /**< RRIP parent link entry signature byte 2. */
1399#define ISO9660RRIPPL_VER 1 /**< RRIP parent link entry version number. */
1400#define ISO9660RRIPPL_LEN 12 /**< RRIP parent link entry length. */
1401AssertCompileSize(ISO9660RRIPPL, ISO9660RRIPPL_LEN);
1402
1403
1404/**
1405 * Rock ridge interchange protocol - relocated entry (RE).
1406 *
1407 * This is used in the directory record for a relocated directory in the
1408 * holding place high up in the directory hierarchy. The system may choose to
1409 * ignore/hide entries with this entry present.
1410 */
1411typedef struct ISO9660RRIPRE
1412{
1413 /** Header (ISO9660RRIPRE_SIG1, ISO9660RRIPRE_SIG2,
1414 * ISO9660RRIPRE_LEN, ISO9660RRIPRE_VER). */
1415 ISO9660SUSPHDR Hdr;
1416} ISO9660RRIPRE;
1417/** Pointer to a RRIP parent link entry. */
1418typedef ISO9660RRIPRE *PISO9660RRIPRE;
1419/** Pointer to a const RRIP parent link entry. */
1420typedef ISO9660RRIPRE const *PCISO9660RRIPRE;
1421#define ISO9660RRIPRE_SIG1 'R' /**< RRIP relocated entry signature byte 1. */
1422#define ISO9660RRIPRE_SIG2 'E' /**< RRIP relocated entry signature byte 2. */
1423#define ISO9660RRIPRE_VER 1 /**< RRIP relocated entry version number. */
1424#define ISO9660RRIPRE_LEN 4 /**< RRIP relocated entry length. */
1425AssertCompileSize(ISO9660RRIPRE, ISO9660RRIPRE_LEN);
1426
1427
1428/**
1429 * Rock ridge interchange protocol - sparse file entry (SF).
1430 */
1431#pragma pack(1)
1432typedef struct ISO9660RRIPSF
1433{
1434 /** Header (ISO9660RRIPSF_SIG1, ISO9660RRIPSF_SIG2,
1435 * ISO9660RRIPSF_LEN, ISO9660RRIPSF_VER). */
1436 ISO9660SUSPHDR Hdr;
1437 /** The high 32-bits of the 64-bit sparse file size. */
1438 ISO9660U32 cbSparseHi;
1439 /** The low 32-bits of the 64-bit sparse file size. */
1440 ISO9660U32 cbSparseLo;
1441 /** The table depth. */
1442 uint8_t cDepth;
1443} ISO9660RRIPSF;
1444#pragma pack()
1445/** Pointer to a RRIP symbolic link entry. */
1446typedef ISO9660RRIPSF *PISO9660RRIPSF;
1447/** Pointer to a const RRIP symbolic link entry. */
1448typedef ISO9660RRIPSF const *PCISO9660RRIPSF;
1449#define ISO9660RRIPSF_SIG1 'S' /**< RRIP spare file entry signature byte 1. */
1450#define ISO9660RRIPSF_SIG2 'F' /**< RRIP spare file entry signature byte 2. */
1451#define ISO9660RRIPSF_VER 1 /**< RRIP spare file entry version number. */
1452#define ISO9660RRIPSF_LEN 21 /**< RRIP spare file entry length. */
1453AssertCompileSize(ISO9660RRIPSF, ISO9660RRIPSF_LEN);
1454
1455/** @name ISO9660RRIP_SF_TAB_F_XXX - Sparse table format.
1456 * @{ */
1457/** The 24-bit logical block number mask.
1458 * This is somewhat complicated, see docs. MBZ for EMPTY. */
1459#define ISO9660RRIP_SF_TAB_F_BLOCK_MASK UINT32_C(0x00ffffff)
1460/** Reserved bits, MBZ. */
1461#define ISO9660RRIP_SF_TAB_F_RESERVED RT_BIT_32()
1462/** References a sub-table with 256 entries (ISO9660U32). */
1463#define ISO9660RRIP_SF_TAB_F_TABLE RT_BIT_32(30)
1464/** Zero data region. */
1465#define ISO9660RRIP_SF_TAB_F_EMPTY RT_BIT_32(31)
1466/** @} */
1467
1468
1469/**
1470 * SUSP and RRIP union.
1471 */
1472typedef union ISO9660SUSPUNION
1473{
1474 ISO9660SUSPHDR Hdr; /**< SUSP header . */
1475 ISO9660SUSPCE CE; /**< SUSP continuation entry. */
1476 ISO9660SUSPPD PD; /**< SUSP padding entry. */
1477 ISO9660SUSPSP SP; /**< SUSP system use protocol entry. */
1478 ISO9660SUSPST ST; /**< SUSP terminator entry. */
1479 ISO9660SUSPER ER; /**< SUSP extension record entry. */
1480 ISO9660SUSPES ES; /**< SUSP extension sequence entry. */
1481 ISO9660RRIPRR RR; /**< RRIP optimization entry. */
1482 ISO9660RRIPPX PX; /**< RRIP posix attribute entry. */
1483 ISO9660RRIPTF TF; /**< RRIP timestamp entry. */
1484 ISO9660RRIPPN PN; /**< RRIP posix device number entry. */
1485 ISO9660RRIPSF SF; /**< RRIP sparse file entry. */
1486 ISO9660RRIPSL SL; /**< RRIP symbolic link entry. */
1487 ISO9660RRIPNM NM; /**< RRIP name entry. */
1488 ISO9660RRIPCL CL; /**< RRIP child link entry. */
1489 ISO9660RRIPPL PL; /**< RRIP parent link entry. */
1490 ISO9660RRIPRE RE; /**< RRIP relocated entry. */
1491} ISO9660SUSPUNION;
1492/** Pointer to a SUSP and RRIP union. */
1493typedef ISO9660SUSPUNION *PISO9660SUSPUNION;
1494/** Pointer to a const SUSP and RRIP union. */
1495typedef ISO9660SUSPUNION *PCISO9660SUSPUNION;
1496
1497
1498/** @} */
1499
1500#endif
1501
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