VirtualBox

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

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

scm --update-copyright-year

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