VirtualBox

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

Last change on this file since 68113 was 67861, checked in by vboxsync, 8 years ago

isomaker: Some fixes for bugs found when testing different buffer read sizes and read ordering.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 62.3 KB
Line 
1/* $Id: iso9660.h 67861 2017-07-07 16:08:36Z 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 owener ID. */
258 ISO9660U16 idOwner;
259 /** 0x004: The owener 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 wird 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, MBZ. */
485 uint8_t abAppUse[512];
486 /** 0x573: Reserved for future standardization, MBZ. */
487 uint8_t abReserved1396[653];
488} ISO9660PRIMARYVOLDESC;
489AssertCompileSize(ISO9660PRIMARYVOLDESC, ISO9660_SECTOR_SIZE);
490/** Pointer to a ISO 9660 primary volume descriptor. */
491typedef ISO9660PRIMARYVOLDESC *PISO9660PRIMARYVOLDESC;
492/** Pointer to a const ISO 9660 primary volume descriptor. */
493typedef ISO9660PRIMARYVOLDESC const *PCISO9660PRIMARYVOLDESC;
494
495/** The value of ISO9660PRIMARYVOLDESC::Hdr.uDescVersion. */
496#define ISO9660PRIMARYVOLDESC_VERSION UINT8_C(1)
497/** The value of ISO9660PRIMARYVOLDESC::bFileStructureVersion and
498 * ISO9660SUPVOLDESC::bFileStructureVersion. */
499#define ISO9660_FILE_STRUCTURE_VERSION UINT8_C(1)
500
501
502
503/**
504 * ISO 9660 supplementary volume descriptor.
505 *
506 * This is in the large parts identicial to the primary descriptor, except it
507 * have a few more fields where the primary one has reserved spaces.
508 */
509typedef struct ISO9660SUPVOLDESC
510{
511 /** 0x000: The volume descriptor header.
512 * Type is ISO9660VOLDESC_TYPE_SUPPLEMENTARY and version
513 * ISO9660SUPVOLDESC_VERSION. */
514 ISO9660VOLDESCHDR Hdr;
515 /** 0x007: Volume flags (ISO9660SUPVOLDESC_VOL_F_XXX).
516 * @note This is reserved in the primary volume descriptor. */
517 uint8_t fVolumeFlags;
518 /** 0x008: System identifier (a1-characters) of system that can act upon
519 * sectors 0 thru 15.
520 * @note Purpose differs from primary description. */
521 char achSystemId[32];
522 /** 0x028: Volume identifier (d1-characters).
523 * @note Character set differs from primary description. */
524 char achVolumeId[32];
525 /** 0x048: Unused field, zero filled. */
526 ISO9660U32 Unused73;
527 /** 0x050: Volume space size in logical blocks (cbLogicalBlock). */
528 ISO9660U32 VolumeSpaceSize;
529 /** 0x058: Escape sequences.
530 * Complicated stuff, see ISO 2022 and ECMA-35.
531 * @note This is reserved in the primary volume descriptor. */
532 uint8_t abEscapeSequences[32];
533 /** 0x078: The number of volumes in the volume set. */
534 ISO9660U16 cVolumesInSet;
535 /** 0x07c: Volume sequence number. */
536 ISO9660U16 VolumeSeqNo;
537 /** 0x080: Logical block size in bytes. */
538 ISO9660U16 cbLogicalBlock;
539 /** 0x084: Path table size. */
540 ISO9660U32 cbPathTable;
541 /** 0x08c: Type L(ittle endian) path table location (block offset). */
542 ISO9660U32LE offTypeLPathTable;
543 /** 0x090: Optional type L(ittle endian) path table location (block offset). */
544 ISO9660U32LE offOptionalTypeLPathTable;
545 /** 0x094: Type M (big endian) path table location (block offset). */
546 ISO9660U32BE offTypeMPathTable;
547 /** 0x098: Optional type M (big endian) path table location (block offset). */
548 ISO9660U32BE offOptionalTypeMPathTable;
549 /** 0x09c: Directory entry for the root directory (union). */
550 union
551 {
552 uint8_t ab[34];
553 ISO9660DIRREC DirRec;
554 } RootDir;
555 /** 0x0be: Volume set identifier (d1-characters).
556 * @note Character set differs from primary description. */
557 char achVolumeSetId[128];
558 /** 0x13e: Publisher identifier (a1-characters). Alternatively, it may refere
559 * to a file in the root dir if it starts with 0x5f and restricts itself to 8
560 * d1-characters.
561 * @note Character set differs from primary description. */
562 char achPublisherId[128];
563 /** 0x1be: Data preparer identifier (a1-characters).
564 * Same file reference alternative as previous field.
565 * @note Character set differs from primary description. */
566 char achDataPreparerId[128];
567 /** 0x23e: Application identifier (a1-characters).
568 * Same file reference alternative as previous field.
569 * @note Character set differs from primary description. */
570 char achApplicationId[128];
571 /** 0x2be: Copyright (root) file identifier (d1-characters).
572 * All spaces if none.
573 * @note Character set differs from primary description. */
574 char achCopyrightFileId[37];
575 /** 0x2e3: Abstract (root) file identifier (d1-characters).
576 * All spaces if none.
577 * @note Character set differs from primary description. */
578 char achAbstractFileId[37];
579 /** 0x308: Bibliographic file identifier (d1-characters).
580 * All spaces if none.
581 * @note Character set differs from primary description. */
582 char achBibliographicFileId[37];
583 /** 0x32d: Volume creation date and time. */
584 ISO9660TIMESTAMP BirthTime;
585 /** 0x33e: Volume modification date and time. */
586 ISO9660TIMESTAMP ModifyTime;
587 /** 0x34f: Volume (data) expiration date and time.
588 * If not specified, don't regard data as obsolete. */
589 ISO9660TIMESTAMP ExpireTime;
590 /** 0x360: Volume (data) effective date and time.
591 * If not specified, info can be used immediately. */
592 ISO9660TIMESTAMP EffectiveTime;
593 /** 0x371: File structure version (ISO9660_FILE_STRUCTURE_VERSION). */
594 uint8_t bFileStructureVersion;
595 /** 0x372: Reserve for future, MBZ. */
596 uint8_t bReserved883;
597 /** 0x373: Reserve for future, MBZ. */
598 uint8_t abAppUse[512];
599 /** 0x573: Reserved for future standardization, MBZ. */
600 uint8_t abReserved1396[653];
601} ISO9660SUPVOLDESC;
602AssertCompileSize(ISO9660SUPVOLDESC, ISO9660_SECTOR_SIZE);
603/** Pointer to a ISO 9660 supplementary volume descriptor. */
604typedef ISO9660SUPVOLDESC *PISO9660SUPVOLDESC;
605/** Pointer to a const ISO 9660 supplementary volume descriptor. */
606typedef ISO9660SUPVOLDESC const *PCISO9660SUPVOLDESC;
607/** The value of ISO9660SUPVOLDESC::Hdr.uDescVersion. */
608#define ISO9660SUPVOLDESC_VERSION UINT8_C(1)
609
610/** @name ISO9660SUPVOLDESC_VOL_F_XXX - ISO9660SUPVOLDESC::fVolumeFlags
611 * @{ */
612#define ISO9660SUPVOLDESC_VOL_F_ESC_ONLY_REG UINT8_C(0x00)
613#define ISO9660SUPVOLDESC_VOL_F_ESC_NOT_REG UINT8_C(0x01)
614/** @} */
615
616
617
618/**
619 * ISO 9660 volume partition descriptor.
620 */
621typedef struct ISO9660VOLPARTDESC
622{
623 /** 0x000: The volume descriptor header.
624 * Type is ISO9660VOLDESC_TYPE_PARTITION and version
625 * ISO9660VOLPARTDESC_VERSION. */
626 ISO9660VOLDESCHDR Hdr;
627 /** 0x007: Alignment padding. */
628 uint8_t bPadding8;
629 /** 0x008: System identifier (a-characters). */
630 char achSystemId[32];
631 /** 0x028: Volume partition identifier (d-characters). */
632 char achVolumePartitionId[32];
633 /** 0x048: The location of the partition (logical block number). */
634 ISO9660U32 offVolumePartition;
635 /** 0x050: The partition size in logical blocks (cbLogicalBlock). */
636 ISO9660U32 VolumePartitionSize;
637 /** 0x058: System specific data. */
638 uint8_t achSystemUse[1960];
639} ISO9660VOLPARTDESC;
640AssertCompileSize(ISO9660VOLPARTDESC, ISO9660_SECTOR_SIZE);
641/** Pointer to an ISO 9660 volume partition description. */
642typedef ISO9660VOLPARTDESC *PISO9660VOLPARTDESC;
643/** Pointer to a const ISO 9660 volume partition description. */
644typedef ISO9660VOLPARTDESC const *PCISO9660VOLPARTDESC;
645/** The value of ISO9660VOLPARTDESC::Hdr.uDescVersion. */
646#define ISO9660VOLPARTDESC_VERSION UINT8_C(1)
647
648
649
650/** @name Joliet escape sequence identifiers.
651 *
652 * These bytes appears in the supplementary volume descriptor field
653 * abEscapeSequences. The ISO9660SUPVOLDESC_VOL_F_ESC_NOT_REG flags will not
654 * be set.
655 *
656 * @{ */
657#define ISO9660_JOLIET_ESC_SEQ_0 UINT8_C(0x25) /**< First escape sequence byte.*/
658#define ISO9660_JOLIET_ESC_SEQ_1 UINT8_C(0x2f) /**< Second escape sequence byte.*/
659#define ISO9660_JOLIET_ESC_SEQ_2_LEVEL_1 UINT8_C(0x40) /**< Third escape sequence byte: level 1 */
660#define ISO9660_JOLIET_ESC_SEQ_2_LEVEL_2 UINT8_C(0x43) /**< Third escape sequence byte: level 2 */
661#define ISO9660_JOLIET_ESC_SEQ_2_LEVEL_3 UINT8_C(0x45) /**< Third escape sequence byte: level 3 */
662/** @} */
663
664
665/** The size of an El Torito boot catalog entry. */
666#define ISO9660_ELTORITO_ENTRY_SIZE UINT32_C(0x20)
667
668/**
669 * El Torito boot catalog: Validation entry.
670 *
671 * This is the first entry in the boot catalog. It is followed by a
672 * ISO9660ELTORITODEFAULTENTRY, which in turn is followed by a
673 * ISO9660ELTORITOSECTIONHEADER.
674 */
675typedef struct ISO9660ELTORITOVALIDATIONENTRY
676{
677 /** 0x00: The header ID (ISO9660_ELTORITO_HEADER_ID_VALIDATION_ENTRY). */
678 uint8_t bHeaderId;
679 /** 0x01: The platform ID (ISO9660_ELTORITO_PLATFORM_ID_XXX). */
680 uint8_t bPlatformId;
681 /** 0x02: Reserved, MBZ. */
682 uint16_t u16Reserved;
683 /** 0x04: String ID of the developer of the CD/DVD-ROM. */
684 char achId[24];
685 /** 0x1c: The checksum. */
686 uint16_t u16Checksum;
687 /** 0x1e: Key byte 1 (ISO9660_ELTORITO_KEY_BYTE_1). */
688 uint8_t bKey1;
689 /** 0x1f: Key byte 2 (ISO9660_ELTORITO_KEY_BYTE_2). */
690 uint8_t bKey2;
691} ISO9660ELTORITOVALIDATIONENTRY;
692AssertCompileSize(ISO9660ELTORITOVALIDATIONENTRY, ISO9660_ELTORITO_ENTRY_SIZE);
693/** Pointer to an El Torito validation entry. */
694typedef ISO9660ELTORITOVALIDATIONENTRY *PISO9660ELTORITOVALIDATIONENTRY;
695/** Pointer to a const El Torito validation entry. */
696typedef ISO9660ELTORITOVALIDATIONENTRY const *PCISO9660ELTORITOVALIDATIONENTRY;
697
698/** ISO9660ELTORITOVALIDATIONENTRY::bKey1 value. */
699#define ISO9660_ELTORITO_KEY_BYTE_1 UINT8_C(0x55)
700/** ISO9660ELTORITOVALIDATIONENTRY::bKey2 value. */
701#define ISO9660_ELTORITO_KEY_BYTE_2 UINT8_C(0xaa)
702
703
704/** @name ISO9660_ELTORITO_HEADER_ID_XXX - header IDs.
705 * @{ */
706/** Header ID for a ISO9660ELTORITOVALIDATIONENTRY. */
707#define ISO9660_ELTORITO_HEADER_ID_VALIDATION_ENTRY UINT8_C(0x01)
708/** Header ID for a ISO9660ELTORITOSECTIONHEADER. */
709#define ISO9660_ELTORITO_HEADER_ID_SECTION_HEADER UINT8_C(0x90)
710/** Header ID for the final ISO9660ELTORITOSECTIONHEADER. */
711#define ISO9660_ELTORITO_HEADER_ID_FINAL_SECTION_HEADER UINT8_C(0x91)
712/** @} */
713
714
715/** @name ISO9660_ELTORITO_PLATFORM_ID_XXX - El Torito Platform IDs
716 * @{ */
717#define ISO9660_ELTORITO_PLATFORM_ID_X86 UINT8_C(0x00) /**< 80x86 */
718#define ISO9660_ELTORITO_PLATFORM_ID_PPC UINT8_C(0x01) /**< PowerPC */
719#define ISO9660_ELTORITO_PLATFORM_ID_MAC UINT8_C(0x02) /**< Mac */
720#define ISO9660_ELTORITO_PLATFORM_ID_EFI UINT8_C(0xef) /**< UEFI */
721/** @} */
722
723
724/**
725 * El Torito boot catalog: Section header entry.
726 *
727 * A non-final section header entry is followed by
728 * ISO9660ELTORITOSECTIONHEADER::cEntries ISO9660ELTORITOSECTIONTENTRY instances.
729 */
730typedef struct ISO9660ELTORITOSECTIONHEADER
731{
732 /** 0x00: Header ID - ISO9660_ELTORITO_HEADER_ID_SECTION_HEADER or
733 * ISO9660_ELTORITO_HEADER_ID_FINAL_SECTION_HEADER (if final). */
734 uint8_t bHeaderId;
735 /** 0x01: The platform ID (ISO9660_ELTORITO_PLATFORM_ID_XXX). */
736 uint8_t bPlatformId;
737 /** 0x02: Number of entries in this section (i.e. following this header). */
738 uint16_t cEntries;
739 /** 0x04: String ID for the section. */
740 char achSectionId[28];
741} ISO9660ELTORITOSECTIONHEADER;
742AssertCompileSize(ISO9660ELTORITOSECTIONHEADER, ISO9660_ELTORITO_ENTRY_SIZE);
743/** Pointer to an El Torito section header entry. */
744typedef ISO9660ELTORITOSECTIONHEADER *PISO9660ELTORITOSECTIONHEADER;
745/** Pointer to a const El Torito section header entry. */
746typedef ISO9660ELTORITOSECTIONHEADER const *PCISO9660ELTORITOSECTIONHEADER;
747
748
749/**
750 * El Torito boot catalog: Default (initial) entry.
751 *
752 * Followed by ISO9660ELTORITOSECTIONHEADER.
753 *
754 * Differs from ISO9660ELTORITOSECTIONENTRY in that it doesn't have a
755 * selection criteria and no media flags (only type).
756 */
757typedef struct ISO9660ELTORITODEFAULTENTRY
758{
759 /** 0x00: Boot indicator (ISO9660_ELTORITO_BOOT_INDICATOR_XXX). */
760 uint8_t bBootIndicator;
761 /** 0x01: Boot media type. The first four bits are defined by
762 * ISO9660_ELTORITO_BOOT_MEDIA_TYPE_XXX, whereas the top four bits MBZ. */
763 uint8_t bBootMediaType;
764 /** 0x02: Load segment - load address divided by 0x10. */
765 uint16_t uLoadSeg;
766 /** 0x04: System type from image partition table. */
767 uint8_t bSystemType;
768 /** 0x05: Unused, MBZ. */
769 uint8_t bUnused;
770 /** 0x06: Number of emulated 512 byte sectors to load. */
771 uint16_t cEmulatedSectorsToLoad;
772 /** 0x08: Image location in the ISO (block offset), always (?) little endian. */
773 uint32_t offBootImage;
774 /** 0x0c: Reserved, MBZ */
775 uint8_t abReserved[20];
776} ISO9660ELTORITODEFAULTENTRY;
777AssertCompileSize(ISO9660ELTORITODEFAULTENTRY, ISO9660_ELTORITO_ENTRY_SIZE);
778/** Pointer to an El Torito default (initial) entry. */
779typedef ISO9660ELTORITODEFAULTENTRY *PISO9660ELTORITODEFAULTENTRY;
780/** Pointer to a const El Torito default (initial) entry. */
781typedef ISO9660ELTORITODEFAULTENTRY const *PCISO9660ELTORITODEFAULTENTRY;
782
783
784/**
785 * El Torito boot catalg: Section entry.
786 */
787typedef struct ISO9660ELTORITOSECTIONENTRY
788{
789 /** 0x00: Boot indicator (ISO9660_ELTORITO_BOOT_INDICATOR_XXX). */
790 uint8_t bBootIndicator;
791 /** 0x01: Boot media type and flags. The first four bits are defined by
792 * ISO9660_ELTORITO_BOOT_MEDIA_TYPE_XXX and the top four bits by
793 * ISO9660_ELTORITO_BOOT_MEDIA_F_XXX. */
794 uint8_t bBootMediaType;
795 /** 0x02: Load segment - load address divided by 0x10. */
796 uint16_t uLoadSeg;
797 /** 0x04: System type from image partition table. */
798 uint8_t bSystemType;
799 /** 0x05: Unused, MBZ. */
800 uint8_t bUnused;
801 /** 0x06: Number of emulated 512 byte sectors to load. */
802 uint16_t cEmulatedSectorsToLoad;
803 /** 0x08: Image location in the ISO (block offset), always (?) little endian. */
804 uint32_t offBootImage;
805 /** 0x0c: Selection criteria type (ISO9660_ELTORITO_SEL_CRIT_TYPE_XXX). */
806 uint8_t bSelectionCriteriaType;
807 /** 0x0c: Selection criteria specific data. */
808 uint8_t abSelectionCriteria[19];
809} ISO9660ELTORITOSECTIONENTRY;
810AssertCompileSize(ISO9660ELTORITOSECTIONENTRY, ISO9660_ELTORITO_ENTRY_SIZE);
811/** Pointer to an El Torito default (initial) entry. */
812typedef ISO9660ELTORITOSECTIONENTRY *PISO9660ELTORITOSECTIONENTRY;
813/** Pointer to a const El Torito default (initial) entry. */
814typedef ISO9660ELTORITOSECTIONENTRY const *PCISO9660ELTORITOSECTIONENTRY;
815
816
817/** @name ISO9660_ELTORITO_BOOT_INDICATOR_XXX - Boot indicators.
818 * @{ */
819#define ISO9660_ELTORITO_BOOT_INDICATOR_BOOTABLE UINT8_C(0x88)
820#define ISO9660_ELTORITO_BOOT_INDICATOR_NOT_BOOTABLE UINT8_C(0x00)
821/** @} */
822
823/** @name ISO9660_ELTORITO_BOOT_MEDIA_TYPE_XXX - Boot media types.
824 * @{ */
825#define ISO9660_ELTORITO_BOOT_MEDIA_TYPE_NO_EMULATION UINT8_C(0x0)
826#define ISO9660_ELTORITO_BOOT_MEDIA_TYPE_FLOPPY_1_2_MB UINT8_C(0x1)
827#define ISO9660_ELTORITO_BOOT_MEDIA_TYPE_FLOPPY_1_44_MB UINT8_C(0x2)
828#define ISO9660_ELTORITO_BOOT_MEDIA_TYPE_FLOPPY_2_88_MB UINT8_C(0x3)
829#define ISO9660_ELTORITO_BOOT_MEDIA_TYPE_HARD_DISK UINT8_C(0x4)
830#define ISO9660_ELTORITO_BOOT_MEDIA_TYPE_MASK UINT8_C(0xf) /**< The media type mask. */
831/** @} */
832
833/** @name ISO9660_ELTORITO_BOOT_MEDIA_F_XXX - Boot media flags.
834 * These only applies to the section entry, not to the default (initial) entry.
835 * @{ */
836#define ISO9660_ELTORITO_BOOT_MEDIA_F_RESERVED UINT8_C(0x10) /**< Reserved bit, MBZ. */
837#define ISO9660_ELTORITO_BOOT_MEDIA_F_CONTINUATION UINT8_C(0x20) /**< Contiunation entry follows. */
838#define ISO9660_ELTORITO_BOOT_MEDIA_F_ATAPI_DRIVER UINT8_C(0x40) /**< Image contains an ATAPI driver. */
839#define ISO9660_ELTORITO_BOOT_MEDIA_F_SCSI_DRIVERS UINT8_C(0x80) /**< Image contains SCSI drivers. */
840#define ISO9660_ELTORITO_BOOT_MEDIA_F_MASK UINT8_C(0xf0) /**< The media/entry flag mask. */
841/** @} */
842
843/** @name ISO9660_ELTORITO_SEL_CRIT_TYPE_XXX - Selection criteria type.
844 * @{ */
845#define ISO9660_ELTORITO_SEL_CRIT_TYPE_NONE UINT8_C(0x00) /**< No selection criteria */
846#define ISO9660_ELTORITO_SEL_CRIT_TYPE_LANG_AND_VERSION UINT8_C(0x01) /**< Language and version (IBM). */
847/** @} */
848
849
850/**
851 * El Torito boot catalog: Section entry extension.
852 *
853 * This is used for carrying additional selection criteria data. It follows
854 * a ISO9660ELTORITOSECTIONENTRY.
855 */
856typedef struct ISO9660ELTORITOSECTIONENTRYEXT
857{
858 /** 0x00: Extension indicator (ISO9660_ELTORITO_SECTION_ENTRY_EXT_ID). */
859 uint8_t bExtensionId;
860 /** 0x01: Selection criteria extension flags (ISO9660_ELTORITO_SECTION_ENTRY_EXT_F_XXX). */
861 uint8_t fFlags;
862 /** 0x02: Selection critiera data. */
863 uint8_t abSelectionCriteria[30];
864} ISO9660ELTORITOSECTIONENTRYEXT;
865AssertCompileSize(ISO9660ELTORITOSECTIONENTRYEXT, ISO9660_ELTORITO_ENTRY_SIZE);
866/** Pointer to an El Torito default (initial) entry. */
867typedef ISO9660ELTORITOSECTIONENTRYEXT *PISO9660ELTORITOSECTIONENTRYEXT;
868/** Pointer to a const El Torito default (initial) entry. */
869typedef ISO9660ELTORITOSECTIONENTRYEXT const *PCISO9660ELTORITOSECTIONENTRYEXT;
870
871/** Value of ISO9660ELTORITOSECTIONENTRYEXT::bExtensionId. */
872#define ISO9660_ELTORITO_SECTION_ENTRY_EXT_ID UINT8_C(0x44)
873
874/** @name ISO9660_ELTORITO_SECTION_ENTRY_EXT_F_XXX - ISO9660ELTORITOSECTIONENTRYEXT::fFlags
875 * @{ */
876#define ISO9660_ELTORITO_SECTION_ENTRY_EXT_F_MORE UINT8_C(0x20) /**< Further extension entries follows. */
877#define ISO9660_ELTORITO_SECTION_ENTRY_EXT_F_UNUSED_MASK UINT8_C(0xef) /**< Mask of all unused bits. */
878/** @} */
879
880
881/**
882 * Boot information table used by isolinux and GRUB2 El Torito boot files.
883 */
884typedef struct ISO9660SYSLINUXINFOTABLE
885{
886 /** 0x00/0x08: Offset of the primary volume descriptor (block offset). */
887 uint32_t offPrimaryVolDesc;
888 /** 0x04/0x0c: Offset of the boot file (block offset). */
889 uint32_t offBootFile;
890 /** 0x08/0x10: Size of the boot file in bytes. */
891 uint32_t cbBootFile;
892 /** 0x0c/0x14: Boot file checksum.
893 * This is the sum of all the 32-bit words in the image, start at the end of
894 * this structure (i.e. offset 64). */
895 uint32_t uChecksum;
896 /** 0x10/0x18: Reserved for future fun. */
897 uint32_t auReserved[10];
898} ISO9660SYSLINUXINFOTABLE;
899AssertCompileSize(ISO9660SYSLINUXINFOTABLE, 56);
900/** Pointer to a syslinux boot information table. */
901typedef ISO9660SYSLINUXINFOTABLE *PISO9660SYSLINUXINFOTABLE;
902/** Pointer to a const syslinux boot information table. */
903typedef ISO9660SYSLINUXINFOTABLE const *PCISO9660SYSLINUXINFOTABLE;
904
905/** The file offset of the isolinux boot info table. */
906#define ISO9660SYSLINUXINFOTABLE_OFFSET 8
907
908
909
910/**
911 * System Use Sharing Protocol Protocol (SUSP) header.
912 */
913typedef struct ISO9660SUSPHDR
914{
915 /** Signature byte 1. */
916 uint8_t bSig1;
917 /** Signature byte 2. */
918 uint8_t bSig2;
919 /** Length of the entry (including the header). */
920 uint8_t cbEntry;
921 /** Entry version number. */
922 uint8_t bVersion;
923} ISO9660SUSPHDR;
924AssertCompileSize(ISO9660SUSPHDR, 4);
925/** Pointer to a SUSP header. */
926typedef ISO9660SUSPHDR *PISO9660SUSPHDR;
927/** Pointer to a const SUSP header. */
928typedef ISO9660SUSPHDR const *PCISO9660SUSPHDR;
929
930
931/**
932 * SUSP continuation entry (CE).
933 */
934typedef struct ISO9660SUSPCE
935{
936 /** Header (ISO9660SUSPCE_SIG1, ISO9660SUSPCE_SIG2, ISO9660SUSPCE_VER). */
937 ISO9660SUSPHDR Hdr;
938 /** The offset of the continutation data block (block offset). */
939 ISO9660U32 offBlock;
940 /** The byte offset in the block of the contiuation data. */
941 ISO9660U32 offData;
942 /** The size of the continuation data. */
943 ISO9660U32 cbData;
944} ISO9660SUSPCE;
945/** Pointer to a SUSP continuation entry. */
946typedef ISO9660SUSPCE *PISO9660SUSPCE;
947/** Pointer to a const SUSP continuation entry. */
948typedef ISO9660SUSPCE const *PCISO9660SUSPCE;
949#define ISO9660SUSPCE_SIG1 'C' /**< SUSP continutation entry signature byte 1. */
950#define ISO9660SUSPCE_SIG2 'E' /**< SUSP continutation entry signature byte 2. */
951#define ISO9660SUSPCE_LEN 28 /**< SUSP continutation entry length. */
952#define ISO9660SUSPCE_VER 1 /**< SUSP continutation entry version number. */
953AssertCompileSize(ISO9660SUSPCE, ISO9660SUSPCE_LEN);
954
955
956/**
957 * SUSP padding entry (PD).
958 */
959typedef struct ISO9660SUSPPD
960{
961 /** Header (ISO9660SUSPPD_SIG1, ISO9660SUSPPD_SIG2, ISO9660SUSPPD_VER). */
962 ISO9660SUSPHDR Hdr;
963 /* Padding follows. */
964} ISO9660SUSPPD;
965AssertCompileSize(ISO9660SUSPPD, 4);
966/** Pointer to a SUSP padding entry. */
967typedef ISO9660SUSPPD *PISO9660SUSPPD;
968/** Pointer to a const SUSP padding entry. */
969typedef ISO9660SUSPPD const *PCISO9660SUSPPD;
970#define ISO9660SUSPPD_SIG1 'P' /**< SUSP padding entry signature byte 1. */
971#define ISO9660SUSPPD_SIG2 'D' /**< SUSP padding entry signature byte 2. */
972#define ISO9660SUSPPD_VER 1 /**< SUSP padding entry version number. */
973
974
975/**
976 * SUSP system use protocol entry (SP)
977 *
978 * This is only used in the '.' record of the root directory.
979 */
980typedef struct ISO9660SUSPSP
981{
982 /** Header (ISO9660SUSPSP_SIG1, ISO9660SUSPSP_SIG2,
983 * ISO9660SUSPSP_LEN, ISO9660SUSPSP_VER). */
984 ISO9660SUSPHDR Hdr;
985 /** Check byte 1 (ISO9660SUSPSP_CHECK1). */
986 uint8_t bCheck1;
987 /** Check byte 2 (ISO9660SUSPSP_CHECK2). */
988 uint8_t bCheck2;
989 /** Number of bytes to skip within the system use field of each directory
990 * entry (except the '.' entry of the root, since that's where this is). */
991 uint8_t cbSkip;
992} ISO9660SUSPSP;
993/** Pointer to a SUSP entry. */
994typedef ISO9660SUSPSP *PISO9660SUSPSP;
995/** Pointer to a const SUSP entry. */
996typedef ISO9660SUSPSP const *PCISO9660SUSPSP;
997#define ISO9660SUSPSP_SIG1 'S' /**< SUSP system use protocol entry signature byte 1. */
998#define ISO9660SUSPSP_SIG2 'P' /**< SUSP system use protocol entry signature byte 2. */
999#define ISO9660SUSPSP_VER 1 /**< SUSP system use protocol entry version number. */
1000#define ISO9660SUSPSP_LEN 7 /**< SUSP system use protocol entry length (fixed). */
1001#define ISO9660SUSPSP_CHECK1 UINT8_C(0xbe) /**< SUSP system use protocol entry check byte 1. */
1002#define ISO9660SUSPSP_CHECK2 UINT8_C(0xef) /**< SUSP system use protocol entry check byte 2. */
1003AssertCompileSize(ISO9660SUSPSP, ISO9660SUSPSP_LEN);
1004
1005
1006/**
1007 * SUSP terminator entry (ST)
1008 *
1009 * Used to terminate system use entries.
1010 */
1011typedef struct ISO9660SUSPST
1012{
1013 /** Header (ISO9660SUSPST_SIG1, ISO9660SUSPST_SIG2,
1014 * ISO9660SUSPST_LEN, ISO9660SUSPST_VER). */
1015 ISO9660SUSPHDR Hdr;
1016} ISO9660SUSPST;
1017/** Pointer to a SUSP padding entry. */
1018typedef ISO9660SUSPST *PISO9660SUSPST;
1019/** Pointer to a const SUSP padding entry. */
1020typedef ISO9660SUSPST const *PCISO9660SUSPST;
1021#define ISO9660SUSPST_SIG1 'S' /**< SUSP system use protocol entry signature byte 1. */
1022#define ISO9660SUSPST_SIG2 'T' /**< SUSP system use protocol entry signature byte 2. */
1023#define ISO9660SUSPST_VER 1 /**< SUSP system use protocol entry version number. */
1024#define ISO9660SUSPST_LEN 4 /**< SUSP system use protocol entry length (fixed). */
1025AssertCompileSize(ISO9660SUSPST, ISO9660SUSPST_LEN);
1026
1027
1028/**
1029 * SUSP extension record entry (ER)
1030 *
1031 * This is only used in the '.' record of the root directory. There can be multiple of these.
1032 */
1033typedef struct ISO9660SUSPER
1034{
1035 /** Header (ISO9660SUSPER_SIG1, ISO9660SUSPER_SIG2, ISO9660SUSPER_VER). */
1036 ISO9660SUSPHDR Hdr;
1037 /** The length of the identifier component. */
1038 uint8_t cchIdentifier;
1039 /** The length of the description component. */
1040 uint8_t cchDescription;
1041 /** The length of the source component. */
1042 uint8_t cchSource;
1043 /** The extension version number. */
1044 uint8_t bVersion;
1045 /** The payload: first @a cchIdentifier chars of identifier string, second
1046 * @a cchDescription chars of description string, thrid @a cchSource chars
1047 * of source string. Variable length. */
1048 char achPayload[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1049} ISO9660SUSPER;
1050/** Pointer to a SUSP padding entry. */
1051typedef ISO9660SUSPER *PISO9660SUSPER;
1052/** Pointer to a const SUSP padding entry. */
1053typedef ISO9660SUSPER const *PCISO9660SUSPER;
1054#define ISO9660SUSPER_SIG1 'E' /**< SUSP extension record entry signature byte 1. */
1055#define ISO9660SUSPER_SIG2 'R' /**< SUSP extension record entry signature byte 2. */
1056#define ISO9660SUSPER_VER 1 /**< SUSP extension record entry version number. */
1057#define ISO9660SUSPER_OFF_PAYLOAD 8 /**< SUSP extension record entry payload member offset. */
1058AssertCompileMemberOffset(ISO9660SUSPER, achPayload, ISO9660SUSPER_OFF_PAYLOAD);
1059
1060/**
1061 * SUSP extension sequence entry (ES)
1062 *
1063 * This is only used in the '.' record of the root directory.
1064 */
1065typedef struct ISO9660SUSPES
1066{
1067 /** Header (ISO9660SUSPES_SIG1, ISO9660SUSPES_SIG2, ISO9660SUSPES_VER). */
1068 ISO9660SUSPHDR Hdr;
1069 /** The ER entry sequence number of the extension comming first. */
1070 uint8_t iFirstExtension;
1071} ISO9660SUSPES;
1072/** Pointer to a SUSP padding entry. */
1073typedef ISO9660SUSPES *PISO9660SUSPES;
1074/** Pointer to a const SUSP padding entry. */
1075typedef ISO9660SUSPES const *PCISO9660SUSPES;
1076#define ISO9660SUSPES_SIG1 'E' /**< SUSP extension sequence entry signature byte 1. */
1077#define ISO9660SUSPES_SIG2 'S' /**< SUSP extension sequence entry signature byte 2. */
1078#define ISO9660SUSPES_VER 1 /**< SUSP extension sequence entry version number. */
1079#define ISO9660SUSPES_LEN 5 /**< SUSP extension sequence entry length (fixed). */
1080AssertCompileSize(ISO9660SUSPES, ISO9660SUSPES_LEN);
1081
1082
1083/** RRIP ER identifier string from Rock Ridge Interchange Protocol v1.10 specs. */
1084#define ISO9660_RRIP_ID "RRIP_1991A"
1085/** RRIP ER recommended description string (from RRIP v1.10 specs). */
1086#define ISO9660_RRIP_DESC "THE ROCK RIDGE INTERCHANGE PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS"
1087/** RRIP ER recommended source string (from RRIP v1.10 specs). */
1088#define ISO9660_RRIP_SRC "PLEASE CONTACT DISC PUBLISHER FOR SPECIFICATION SOURCE. SEE PUBLISHER IDENTIFIER IN PRIMARY VOLUME DESCRIPTOR FOR CONTACT INFORMATION."
1089/** RRIP ER version field value from the Rock Ridge Interchange Protocol v1.10 specs. */
1090#define ISO9660_RRIP_VER 1
1091/** The length of a RRIP v1.10 ER record.
1092 * The record must be constructed using ISO9660_RRIP_ID, ISO9660_RRIP_DESC
1093 * and ISO9660_RRIP_SRC. */
1094#define ISO9660_RRIP_ER_LEN ((uint8_t)( ISO9660SUSPER_OFF_PAYLOAD \
1095 + sizeof(ISO9660_RRIP_ID) - 1 \
1096 + sizeof(ISO9660_RRIP_DESC) - 1 \
1097 + sizeof(ISO9660_RRIP_SRC) - 1 ))
1098
1099/** RRIP ER identifier string from RRIP IEEE P1282 v1.12 draft. */
1100#define ISO9660_RRIP_1_12_ID "IEEE_P1282"
1101/** RRIP ER recommended description string (RRIP IEEE P1282 v1.12 draft). */
1102#define ISO9660_RRIP_1_12_DESC "THE IEEE P1282 PROTOCOL PROVIDES SUPPORT FOR POSIX FILE SYSTEM SEMANTICS."
1103/** RRIP ER recommended source string (RRIP IEEE P1282 v1.12 draft). */
1104#define ISO9660_RRIP_1_12_SRC "PLEASE CONTACT THE IEEE STANDARDS DEPARTMENT, PISCATAWAY, NJ, USA FOR THE P1282 SPECIFICATION."
1105/** RRIP ER version field value from the Rock Ridge Interchange Protocol v1.12 specs. */
1106#define ISO9660_RRIP_1_12_VER 1
1107/** The length of a RRIP v1.12 ER record.
1108 * The record must be constructed using ISO9660_RRIP_1_12_ID,
1109 * ISO9660_RRIP_1_12_DESC and ISO9660_RRIP_1_12_SRC. */
1110#define ISO9660_RRIP_1_12_ER_LEN ((uint8_t)( ISO9660SUSPER_OFF_PAYLOAD \
1111 + sizeof(ISO9660_RRIP_1_12_ID) - 1 \
1112 + sizeof(ISO9660_RRIP_1_12_DESC) - 1 \
1113 + sizeof(ISO9660_RRIP_1_12_SRC) - 1 ))
1114
1115
1116/**
1117 * Rock ridge interchange protocol - RR.
1118 */
1119typedef struct ISO9660RRIPRR
1120{
1121 /** Header (ISO9660RRIPRR_SIG1, ISO9660RRIPRR_SIG2,
1122 * ISO9660RRIPRR_LEN, ISO9660RRIPRR_VER). */
1123 ISO9660SUSPHDR Hdr;
1124 /** Flags indicating which RRIP entries are present (). */
1125 uint8_t fFlags;
1126} ISO9660RRIPRR;
1127/** Pointer to a RRIP RR entry. */
1128typedef ISO9660RRIPRR *PISO9660RRIPRR;
1129/** Pointer to a const RRIP RR entry. */
1130typedef ISO9660RRIPRR const *PCISO9660RRIPRR;
1131#define ISO9660RRIPRR_SIG1 'R' /**< RRIP RR entry signature byte 1. */
1132#define ISO9660RRIPRR_SIG2 'R' /**< RRIP RR entry signature byte 2. */
1133#define ISO9660RRIPRR_VER 1 /**< RRIP RR entry version number. */
1134#define ISO9660RRIPRR_LEN 5 /**< RRIP RR entry length (fixed). */
1135AssertCompileSize(ISO9660RRIPRR, ISO9660RRIPRR_LEN);
1136
1137/** @name ISO9660RRIP_RR_F_XXX - Indicates which RRIP entries are present.
1138 * @{ */
1139#define ISO9660RRIP_RR_F_PX UINT8_C(0x01)
1140#define ISO9660RRIP_RR_F_PN UINT8_C(0x02)
1141#define ISO9660RRIP_RR_F_SL UINT8_C(0x04)
1142#define ISO9660RRIP_RR_F_NM UINT8_C(0x08)
1143#define ISO9660RRIP_RR_F_CL UINT8_C(0x10)
1144#define ISO9660RRIP_RR_F_PL UINT8_C(0x20)
1145#define ISO9660RRIP_RR_F_RE UINT8_C(0x40)
1146#define ISO9660RRIP_RR_F_TF UINT8_C(0x80)
1147/** @} */
1148
1149/**
1150 * Rock ridge interchange protocol - posix attribute entry (PX).
1151 */
1152typedef struct ISO9660RRIPPX
1153{
1154 /** Header (ISO9660RRIPPX_SIG1, ISO9660RRIPPX_SIG2,
1155 * ISO9660RRIPPX_LEN, ISO9660RRIPPX_VER). */
1156 ISO9660SUSPHDR Hdr;
1157 /** The file mode (RTFS_UNIX_XXX, RTFS_TYPE_XXX). */
1158 ISO9660U32 fMode;
1159 /** Number of hardlinks. */
1160 ISO9660U32 cHardlinks;
1161 /** User ID. */
1162 ISO9660U32 uid;
1163 /** Group ID. */
1164 ISO9660U32 gid;
1165 /** Inode number. */
1166 ISO9660U32 INode;
1167} ISO9660RRIPPX;
1168/** Pointer to a RRIP posix attribute entry. */
1169typedef ISO9660RRIPPX *PISO9660RRIPPX;
1170/** Pointer to a const RRIP posix attribute entry. */
1171typedef ISO9660RRIPPX const *PCISO9660RRIPPX;
1172#define ISO9660RRIPPX_SIG1 'P' /**< RRIP posix attribute entry signature byte 1. */
1173#define ISO9660RRIPPX_SIG2 'X' /**< RRIP posix attribute entry signature byte 2. */
1174#define ISO9660RRIPPX_VER 1 /**< RRIP posix attribute entry version number. */
1175#define ISO9660RRIPPX_LEN 44 /**< RRIP posix attribute entry length (fixed). */
1176AssertCompileSize(ISO9660RRIPPX, ISO9660RRIPPX_LEN);
1177#define ISO9660RRIPPX_LEN_NO_INODE 36 /**< RRIP posix attribute entry length without inode (fixed). */
1178
1179
1180/**
1181 * Rock ridge interchange protocol - timestamp entry (TF).
1182 */
1183typedef struct ISO9660RRIPTF
1184{
1185 /** Header (ISO9660RRIPTF_SIG1, ISO9660RRIPTF_SIG2, ISO9660RRIPTF_VER). */
1186 ISO9660SUSPHDR Hdr;
1187 /** Flags, ISO9660RRIPTF_F_XXX. */
1188 uint8_t fFlags;
1189 /** Timestamp payload bytes (variable size and format). */
1190 uint8_t abPayload[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1191} ISO9660RRIPTF;
1192AssertCompileMemberOffset(ISO9660RRIPTF, abPayload, 5);
1193/** Pointer to a RRIP timestamp entry. */
1194typedef ISO9660RRIPTF *PISO9660RRIPTF;
1195/** Pointer to a const RRIP timestamp entry. */
1196typedef ISO9660RRIPTF const *PCISO9660RRIPTF;
1197#define ISO9660RRIPTF_SIG1 'T' /**< RRIP child link entry signature byte 1. */
1198#define ISO9660RRIPTF_SIG2 'F' /**< RRIP child link entry signature byte 2. */
1199#define ISO9660RRIPTF_VER 1 /**< RRIP child link entry version number. */
1200
1201/** @name ISO9660RRIPTF_F_XXX - Timestmap flags.
1202 * @{ */
1203#define ISO9660RRIPTF_F_BIRTH UINT8_C(0x01) /**< Birth (creation) timestamp is recorded. */
1204#define ISO9660RRIPTF_F_MODIFY UINT8_C(0x02) /**< Modification timestamp is recorded. */
1205#define ISO9660RRIPTF_F_ACCESS UINT8_C(0x04) /**< Accessed timestamp is recorded. */
1206#define ISO9660RRIPTF_F_CHANGE UINT8_C(0x08) /**< Attribute change timestamp is recorded. */
1207#define ISO9660RRIPTF_F_BACKUP UINT8_C(0x10) /**< Backup timestamp is recorded. */
1208#define ISO9660RRIPTF_F_EXPIRATION UINT8_C(0x20) /**< Expiration timestamp is recorded. */
1209#define ISO9660RRIPTF_F_EFFECTIVE UINT8_C(0x40) /**< Effective timestamp is recorded. */
1210#define ISO9660RRIPTF_F_LONG_FORM UINT8_C(0x80) /**< If set ISO9660TIMESTAMP is used, otherwise ISO9660RECTIMESTAMP. */
1211/** @} */
1212
1213/**
1214 * Calculates the length of a 'TF' entry given the flags.
1215 *
1216 * @returns Length in bytes.
1217 * @param fFlags The flags (ISO9660RRIPTF_F_XXX).
1218 */
1219DECLINLINE(uint8_t) Iso9660RripTfCalcLength(uint8_t fFlags)
1220{
1221 unsigned cTimestamps = ((fFlags & ISO9660RRIPTF_F_BIRTH) != 0)
1222 + ((fFlags & ISO9660RRIPTF_F_MODIFY) != 0)
1223 + ((fFlags & ISO9660RRIPTF_F_ACCESS) != 0)
1224 + ((fFlags & ISO9660RRIPTF_F_CHANGE) != 0)
1225 + ((fFlags & ISO9660RRIPTF_F_BACKUP) != 0)
1226 + ((fFlags & ISO9660RRIPTF_F_EXPIRATION) != 0)
1227 + ((fFlags & ISO9660RRIPTF_F_EFFECTIVE) != 0);
1228 return (uint8_t)( cTimestamps * (fFlags & ISO9660RRIPTF_F_LONG_FORM ? sizeof(ISO9660TIMESTAMP) : sizeof(ISO9660RECTIMESTAMP))
1229 + RT_OFFSETOF(ISO9660RRIPTF, abPayload));
1230}
1231
1232
1233/**
1234 * Rock ridge interchange protocol - posix device number entry (PN).
1235 *
1236 * Mandatory for block or character devices.
1237 */
1238typedef struct ISO9660RRIPPN
1239{
1240 /** Header (ISO9660RRIPPN_SIG1, ISO9660RRIPPN_SIG2,
1241 * ISO9660RRIPPN_LEN, ISO9660RRIPPN_VER). */
1242 ISO9660SUSPHDR Hdr;
1243 /** The major device number. */
1244 ISO9660U32 Major;
1245 /** The minor device number. */
1246 ISO9660U32 Minor;
1247} ISO9660RRIPPN;
1248/** Pointer to a RRIP posix attribute entry. */
1249typedef ISO9660RRIPPN *PISO9660RRIPPN;
1250/** Pointer to a const RRIP posix attribute entry. */
1251typedef ISO9660RRIPPN const *PCISO9660RRIPPN;
1252#define ISO9660RRIPPN_SIG1 'P' /**< RRIP posix device number entry signature byte 1. */
1253#define ISO9660RRIPPN_SIG2 'N' /**< RRIP posix device number entry signature byte 2. */
1254#define ISO9660RRIPPN_VER 1 /**< RRIP posix device number entry version number. */
1255#define ISO9660RRIPPN_LEN 20 /**< RRIP posix device number entry length (fixed). */
1256AssertCompileSize(ISO9660RRIPPN, ISO9660RRIPPN_LEN);
1257
1258/**
1259 * Rock ridge interchange protocol - symlink entry (SL).
1260 *
1261 * Mandatory for symbolic links.
1262 */
1263typedef struct ISO9660RRIPSL
1264{
1265 /** Header (ISO9660RRIPSL_SIG1, ISO9660RRIPSL_SIG2, ISO9660RRIPSL_VER). */
1266 ISO9660SUSPHDR Hdr;
1267 /** Flags (0 or ISO9660RRIP_SL_F_CONTINUE). */
1268 uint8_t fFlags;
1269 /** Variable length of components. First byte in each component is a
1270 * combination of ISO9660RRIP_SL_C_XXX flag values. The second byte the
1271 * length of character data following it. */
1272 uint8_t abComponents[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1273} ISO9660RRIPSL;
1274AssertCompileMemberOffset(ISO9660RRIPSL, abComponents, 5);
1275/** Pointer to a RRIP symbolic link entry. */
1276typedef ISO9660RRIPSL *PISO9660RRIPSL;
1277/** Pointer to a const RRIP symbolic link entry. */
1278typedef ISO9660RRIPSL const *PCISO9660RRIPSL;
1279#define ISO9660RRIPSL_SIG1 'S' /**< RRIP symbolic link entry signature byte 1. */
1280#define ISO9660RRIPSL_SIG2 'L' /**< RRIP symbolic link entry signature byte 2. */
1281#define ISO9660RRIPSL_VER 1 /**< RRIP symbolic link entry version number. */
1282/** ISO9660RRIPSL.fFlags - When set another symlink entry follows this one. */
1283#define ISO9660RRIP_SL_F_CONTINUE UINT8_C(0x01)
1284/** @name ISO9660RRIP_SL_C_XXX - Symlink component flags.
1285 * @note These matches ISO9660RRIP_NM_F_XXX.
1286 * @{ */
1287/** Indicates that the component continues in the next entry. */
1288#define ISO9660RRIP_SL_C_CONTINUE UINT8_C(0x01)
1289/** Refer to '.' (the current dir). */
1290#define ISO9660RRIP_SL_C_CURRENT UINT8_C(0x02)
1291/** Refer to '..' (the parent dir). */
1292#define ISO9660RRIP_SL_C_PARENT UINT8_C(0x04)
1293/** Refer to '/' (the root dir). */
1294#define ISO9660RRIP_SL_C_ROOT UINT8_C(0x08)
1295/** Reserved / historically was mount point reference. */
1296#define ISO9660RRIP_SL_C_MOUNT_POINT UINT8_C(0x10)
1297/** Reserved / historically was uname network node name. */
1298#define ISO9660RRIP_SL_C_UNAME UINT8_C(0x20)
1299/** Reserved mask (considers historically bits reserved). */
1300#define ISO9660RRIP_SL_C_RESERVED_MASK UINT8_C(0xf0)
1301/** @} */
1302
1303
1304/**
1305 * Rock ridge interchange protocol - name entry (NM).
1306 */
1307typedef struct ISO9660RRIPNM
1308{
1309 /** Header (ISO9660RRIPNM_SIG1, ISO9660RRIPNM_SIG2, ISO9660RRIPNM_VER). */
1310 ISO9660SUSPHDR Hdr;
1311 /** Flags (ISO9660RRIP_NM_F_XXX). */
1312 uint8_t fFlags;
1313 /** The name part (if any). */
1314 char achName[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION];
1315} ISO9660RRIPNM;
1316AssertCompileMemberOffset(ISO9660RRIPNM, achName, 5);
1317/** Pointer to a RRIP name entry. */
1318typedef ISO9660RRIPNM *PISO9660RRIPNM;
1319/** Pointer to a const RRIP name entry. */
1320typedef ISO9660RRIPNM const *PCISO9660RRIPNM;
1321#define ISO9660RRIPNM_SIG1 'N' /**< RRIP name entry signature byte 1. */
1322#define ISO9660RRIPNM_SIG2 'M' /**< RRIP name entry signature byte 2. */
1323#define ISO9660RRIPNM_VER 1 /**< RRIP name entry version number. */
1324/** @name ISO9660RRIP_NM_F_XXX - Name flags.
1325 * @note These matches ISO9660RRIP_SL_C_XXX.
1326 * @{ */
1327/** Indicates there are more 'NM' entries. */
1328#define ISO9660RRIP_NM_F_CONTINUE UINT8_C(0x01)
1329/** Refer to '.' (the current dir). */
1330#define ISO9660RRIP_NM_F_CURRENT UINT8_C(0x02)
1331/** Refer to '..' (the parent dir). */
1332#define ISO9660RRIP_NM_F_PARENT UINT8_C(0x04)
1333/** Reserved / historically was uname network node name. */
1334#define ISO9660RRIP_NM_F_UNAME UINT8_C(0x20)
1335/** Reserved mask (considers historically bits reserved). */
1336#define ISO9660RRIP_NM_F_RESERVED_MASK UINT8_C(0xf8)
1337/** @} */
1338
1339/** Maximum name length in one 'NM' entry. */
1340#define ISO9660RRIPNM_MAX_NAME_LEN 250
1341
1342
1343/**
1344 * Rock ridge interchange protocol - child link entry (CL).
1345 *
1346 * This is used for relocated directories. Relocated directries are employed
1347 * to bypass the ISO 9660 maximum tree depth of 8.
1348 *
1349 * The size of the directory and everything else is found in the '.' entry in
1350 * the specified location. Only the name (NM or dir rec) and this link record
1351 * should be used.
1352 */
1353typedef struct ISO9660RRIPCL
1354{
1355 /** Header (ISO9660RRIPCL_SIG1, ISO9660RRIPCL_SIG2,
1356 * ISO9660RRIPCL_LEN, ISO9660RRIPCL_VER). */
1357 ISO9660SUSPHDR Hdr;
1358 /** The offset of the directory data (block offset). */
1359 ISO9660U32 offExtend;
1360} ISO9660RRIPCL;
1361/** Pointer to a RRIP child link entry. */
1362typedef ISO9660RRIPCL *PISO9660RRIPCL;
1363/** Pointer to a const RRIP child link entry. */
1364typedef ISO9660RRIPCL const *PCISO9660RRIPCL;
1365#define ISO9660RRIPCL_SIG1 'C' /**< RRIP child link entry signature byte 1. */
1366#define ISO9660RRIPCL_SIG2 'L' /**< RRIP child link entry signature byte 2. */
1367#define ISO9660RRIPCL_VER 1 /**< RRIP child link entry version number. */
1368#define ISO9660RRIPCL_LEN 12 /**< RRIP child link entry length. */
1369AssertCompileSize(ISO9660RRIPCL, ISO9660RRIPCL_LEN);
1370
1371
1372/**
1373 * Rock ridge interchange protocol - parent link entry (PL).
1374 *
1375 * This is used in relocated directories. Relocated directries are employed
1376 * to bypass the ISO 9660 maximum tree depth of 8.
1377 *
1378 * The size of the directory and everything else is found in the '.' entry in
1379 * the specified location. Only the name (NM or dir rec) and this link record
1380 * should be used.
1381 */
1382typedef struct ISO9660RRIPPL
1383{
1384 /** Header (ISO9660RRIPPL_SIG1, ISO9660RRIPPL_SIG2,
1385 * ISO9660RRIPPL_LEN, ISO9660RRIPPL_VER). */
1386 ISO9660SUSPHDR Hdr;
1387 /** The offset of the directory data (block offset). */
1388 ISO9660U32 offExtend;
1389} ISO9660RRIPPL;
1390/** Pointer to a RRIP parent link entry. */
1391typedef ISO9660RRIPPL *PISO9660RRIPPL;
1392/** Pointer to a const RRIP parent link entry. */
1393typedef ISO9660RRIPPL const *PCISO9660RRIPPL;
1394#define ISO9660RRIPPL_SIG1 'P' /**< RRIP parent link entry signature byte 1. */
1395#define ISO9660RRIPPL_SIG2 'L' /**< RRIP parent link entry signature byte 2. */
1396#define ISO9660RRIPPL_VER 1 /**< RRIP parent link entry version number. */
1397#define ISO9660RRIPPL_LEN 12 /**< RRIP parent link entry length. */
1398AssertCompileSize(ISO9660RRIPPL, ISO9660RRIPPL_LEN);
1399
1400
1401/**
1402 * Rock ridge interchange protocol - relocated entry (RE).
1403 *
1404 * This is used in the directory record for a relocated directory in the
1405 * holding place high up in the directory hierarchy. The system may choose to
1406 * ignore/hide entries with this entry present.
1407 */
1408typedef struct ISO9660RRIPRE
1409{
1410 /** Header (ISO9660RRIPRE_SIG1, ISO9660RRIPRE_SIG2,
1411 * ISO9660RRIPRE_LEN, ISO9660RRIPRE_VER). */
1412 ISO9660SUSPHDR Hdr;
1413} ISO9660RRIPRE;
1414/** Pointer to a RRIP parent link entry. */
1415typedef ISO9660RRIPRE *PISO9660RRIPRE;
1416/** Pointer to a const RRIP parent link entry. */
1417typedef ISO9660RRIPRE const *PCISO9660RRIPRE;
1418#define ISO9660RRIPRE_SIG1 'R' /**< RRIP relocated entry signature byte 1. */
1419#define ISO9660RRIPRE_SIG2 'E' /**< RRIP relocated entry signature byte 2. */
1420#define ISO9660RRIPRE_VER 1 /**< RRIP relocated entry version number. */
1421#define ISO9660RRIPRE_LEN 4 /**< RRIP relocated entry length. */
1422AssertCompileSize(ISO9660RRIPRE, ISO9660RRIPRE_LEN);
1423
1424
1425/**
1426 * Rock ridge interchange protocol - sparse file entry (SF).
1427 */
1428#pragma pack(1)
1429typedef struct ISO9660RRIPSF
1430{
1431 /** Header (ISO9660RRIPSF_SIG1, ISO9660RRIPSF_SIG2,
1432 * ISO9660RRIPSF_LEN, ISO9660RRIPSF_VER). */
1433 ISO9660SUSPHDR Hdr;
1434 /** The high 32-bits of the 64-bit sparse file size. */
1435 ISO9660U32 cbSparseHi;
1436 /** The low 32-bits of the 64-bit sparse file size. */
1437 ISO9660U32 cbSparseLo;
1438 /** The table depth. */
1439 uint8_t cDepth;
1440} ISO9660RRIPSF;
1441#pragma pack()
1442/** Pointer to a RRIP symbolic link entry. */
1443typedef ISO9660RRIPSF *PISO9660RRIPSF;
1444/** Pointer to a const RRIP symbolic link entry. */
1445typedef ISO9660RRIPSF const *PCISO9660RRIPSF;
1446#define ISO9660RRIPSF_SIG1 'S' /**< RRIP spare file entry signature byte 1. */
1447#define ISO9660RRIPSF_SIG2 'F' /**< RRIP spare file entry signature byte 2. */
1448#define ISO9660RRIPSF_VER 1 /**< RRIP spare file entry version number. */
1449#define ISO9660RRIPSF_LEN 21 /**< RRIP spare file entry length. */
1450AssertCompileSize(ISO9660RRIPSF, ISO9660RRIPSF_LEN);
1451
1452/** @name ISO9660RRIP_SF_TAB_F_XXX - Sparse table format.
1453 * @{ */
1454/** The 24-bit logical block number mask.
1455 * This is somewhat complicated, see docs. MBZ for EMPTY. */
1456#define ISO9660RRIP_SF_TAB_F_BLOCK_MASK UINT32_C(0x00ffffff)
1457/** Reserved bits, MBZ. */
1458#define ISO9660RRIP_SF_TAB_F_RESERVED RT_BIT_32()
1459/** References a sub-table with 256 entries (ISO9660U32). */
1460#define ISO9660RRIP_SF_TAB_F_TABLE RT_BIT_32(30)
1461/** Zero data region. */
1462#define ISO9660RRIP_SF_TAB_F_EMPTY RT_BIT_32(31)
1463/** @} */
1464
1465
1466/**
1467 * SUSP and RRIP union.
1468 */
1469typedef union ISO9660SUSPUNION
1470{
1471 ISO9660SUSPHDR Hdr; /**< SUSP header . */
1472 ISO9660SUSPCE CE; /**< SUSP continuation entry. */
1473 ISO9660SUSPPD PD; /**< SUSP padding entry. */
1474 ISO9660SUSPSP SP; /**< SUSP system use protocol entry. */
1475 ISO9660SUSPST ST; /**< SUSP terminator entry. */
1476 ISO9660SUSPER ER; /**< SUSP extension record entry. */
1477 ISO9660SUSPES ES; /**< SUSP extension sequence entry. */
1478 ISO9660RRIPRR RR; /**< RRIP optimization entry. */
1479 ISO9660RRIPPX PX; /**< RRIP posix attribute entry. */
1480 ISO9660RRIPTF TF; /**< RRIP timestamp entry. */
1481 ISO9660RRIPPN PN; /**< RRIP posix device number entry. */
1482 ISO9660RRIPSF SF; /**< RRIP sparse file entry. */
1483 ISO9660RRIPSL SL; /**< RRIP symbolic link entry. */
1484 ISO9660RRIPNM NM; /**< RRIP name entry. */
1485 ISO9660RRIPCL CL; /**< RRIP child link entry. */
1486 ISO9660RRIPPL PL; /**< RRIP parent link entry. */
1487 ISO9660RRIPRE RE; /**< RRIP relocated entry. */
1488} ISO9660SUSPUNION;
1489/** Pointer to a SUSP and RRIP union. */
1490typedef ISO9660SUSPUNION *PISO9660SUSPUNION;
1491/** Pointer to a const SUSP and RRIP union. */
1492typedef ISO9660SUSPUNION *PCISO9660SUSPUNION;
1493
1494
1495/** @} */
1496
1497#endif
1498
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