VirtualBox

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

Last change on this file since 103224 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

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