3 * @author Lunaixsky (zelong56@gmail.com)
4 * @brief ISO9660 File system header file. (Reference: ECMA-119, 4th ed.)
8 * @copyright Copyright (c) 2022
12 #ifndef __LUNAIX_ISO9660_H
13 #define __LUNAIX_ISO9660_H
15 #include <lunaix/types.h>
18 #define ISO_VOLBOOT 0 // Boot Record
19 #define ISO_VOLPRIM 1 // Primary
20 #define ISO_VOLSUPP 2 // Supplementary
21 #define ISO_VOLPART 3 // Partition
22 #define ISO_VOLTERM 255 // Volume descriptor set terminator
24 #define ISO_FHIDDEN 0x1 // a hidden file
25 #define ISO_FDIR 0x2 // a directory file
26 #define ISO_FASSOC 0x4 // a associated file
27 #define ISO_FRECORD 0x8 // file store in iso record fashion
28 #define ISO_FPROTECT 0x10 // file being protected by access control
29 #define ISO_FEXTENTS 0x80 // the extent by this record is a file partial
32 // Each Descriptor sized 1 logical block (2048 bytes in common cases)
33 // ISO9660 store number in both-byte order. That is, for a d-bits number, it
34 // will result in 2d bits of storage. The lower d-bits are little-endian and
35 // upper d-bits are big-endian.
40 u8_t std_id[5]; // CD001
46 struct iso_vol header;
49 u8_t reserved; // align to data line width
64 // (8.4) Describe a primary volume space
65 struct iso_vol_primary
67 struct iso_vol header;
72 u32_t sz_lo; // (8.4.8) only lower portion is valid.
78 u32_t path_tbl_sz_lo; // lower partition - LE.
80 u32_t lpath_tbl_ptr; // Type L Path table location (LBA)
81 u32_t reserved_3[3]; // use type M if big endian machine.
84 u8_t publisher_id[128];
85 u8_t preparer_id[128];
87 u8_t copyright_id[128];
88 u8_t asbtract_id[128];
90 struct iso_datetime ctime; // creation
91 struct iso_datetime mtime; // modification
92 struct iso_datetime ex_time; // expiration
93 struct iso_datetime ef_time; // effective
94 u8_t fstruct_ver; // file structure version, don't care!
95 } PACKED; // size 1124
97 // Layout for Supplementary Vol. is almost identical to primary vol.
98 // We ignore it for now. (see section 8.5, table 6)
100 // (8.6) Describe a volume partition within a volume space
103 struct iso_vol header;
107 u32_t part_addr_lo; // (8.6.7) only lower portion is valid.
109 u32_t part_sz_lo; // (8.6.8) only lower portion is valid.
113 // (6.10.4) MDU with variable record
120 // (9.1) Directory Record [Embedded into Variable MDU]
124 u32_t extent_lo; // location of extent, lower 32 bits is valid.
126 u32_t data_sz_lo; // size of extent, lower 32 bits is valid.
136 } PACKED mktime; // Time the record is made, see 9.1.5
138 u8_t fu_sz; // size of file unit (FU)
139 u8_t gap_sz; // size of gap if FU is interleaved.
141 struct iso_var_mdu name;
144 // (9.4) Path Table Record. [Embedded into Variable MDU]
149 u8_t parent; // indexed into path table
150 u8_t id[0]; // length = iso_var_mdu::len
158 struct iso_datetime ctime;
159 struct iso_datetime mtime;
160 struct iso_datetime ex_time;
161 struct iso_datetime ef_time;
172 // There is also a escape sequence after payload,
173 // It however marked as optional, hence we ignore it.
176 #endif /* __LUNAIX_ISO9660_H */