VirtualBox

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

Last change on this file since 77807 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

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