grub2: bring back build of aros-side grub2 tools
[AROS.git] / rom / filesys / cdfs / iso9660.h
blob55700e035d3527a9de02440979895d17af820a8b
1 /*
2 * Copyright (C) 2013, The AROS Development Team
3 * All right reserved.
4 * Author: Jason S. McMullan <jason.mcmullan@gmail.com>
6 * Licensed under the AROS PUBLIC LICENSE (APL) Version 1.1
7 */
9 #ifndef ISO9660_H
10 #define ISO9660_H
12 #include <exec/types.h>
13 #include <dos/filehandler.h>
15 #ifndef __packed
16 #define __packed __attribute__((__packed__))
17 #endif
19 typedef UBYTE int8;
20 typedef TEXT strA; /* ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_
21 * !"%&'()*+,-./:;<=>?
23 typedef TEXT strD; /* ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_ */
24 typedef struct { ULONG LSB; ULONG MSB; } int32LM;
25 typedef struct { UWORD LSB; UWORD MSB;} int16LM;
26 typedef ULONG int32L;
27 typedef ULONG int32M;
28 typedef ULONG int32;
29 typedef UWORD int16;
30 typedef struct {
31 strD Year[4];
32 strD Month[2];
33 strD Day[2];
34 strD Hour[2];
35 strD Minute[2];
36 strD Second[2];
37 strD Hundredth[2];
38 int8 TimeZone; /* 0 = GMT-12, 1 = GMT-11:45, 2 = GMT-11:30, etc */
39 } ascDate;
41 typedef struct {
42 int8 Years; /* 1900 + Year */
43 int8 Month; /* Base 1 */
44 int8 Day; /* Base 1 */
45 int8 Hour; /* Base 0 */
46 int8 Minute; /* Base 0 */
47 int8 Second; /* Base 0 */
48 int8 TimeZone; /* 0 = GMT-12, 1 = GMT-11:45, 2 = GMT-11:30, etc */
49 } binDate;
51 struct isoVolume {
52 int8 Type;
53 #define ISO_Volume_Boot 0
54 #define ISO_Volume_Primary 1
55 #define ISO_Volume_Supplementary 2
56 #define ISO_Volume_Partition 3
57 #define ISO_Volume_Terminator 255
58 strA Identifier[5];
59 int8 Version;
60 union {
61 UBYTE Data[2041];
62 struct isoVolumeBoot {
63 strA BootSystemIdentifier[32];
64 strA BootIdentifier[32];
65 UBYTE BootSystemUse[1977];
66 } __packed Boot;
67 struct isoVolumePrimary {
68 UBYTE Unused_1[1];
69 strA SystemIdentifier[32];
70 strD VolumeIdentifier[32];
71 UBYTE Unused_2[8];
72 int32LM VolumeSpaceSize;
73 UBYTE Unused_3[32];
74 int16LM VolumeSetSize;
75 int16LM VolumeSequenceNumber;
76 int16LM LogicalBlockSize;
77 int32LM PathTableSize;
78 int32L TypeLPathTable;
79 int32L TypeLOptionalPathTable;
80 int32M TypeMPathTable;
81 int32M TypeMOptionalPathTable;
82 UBYTE RootDirectoryEntry[34];
83 strD VolumeSetIdentifier[128];
84 strA PublisherIdentifier[128];
85 strA DataPreparerIdentifier[128];
86 strA ApplicationIdentifier[128];
87 strD CopyrightFileIdentifier[38];
88 strD AbstractFileIdentifier[36];
89 strD BibliographicFileIdentifier[37];
90 ascDate VolumeCreation;
91 ascDate VolumeModification;
92 ascDate VolumeExpiration;
93 ascDate VolumeEffective;
94 int8 FileStructureVersion;
95 UBYTE Unused_4[1];
96 UBYTE Application[512];
97 UBYTE Reserved[653];
98 } __packed Primary;
99 struct {
100 } __packed Terminator;
104 struct isoPathTable {
105 int8 DirectoryIdentifierLength;
106 int8 ExtendedAttributeLength;
107 int32 ExtentLocation; /* LBA */
108 int16 ParentDirectory;
109 strD DirectoryIdentifier[0]; /* Padded to an even number */
110 } __packed;
112 struct isoDirectory {
113 int8 DirectoryLength;
114 int8 ExtendedAttributeLength;
115 int32LM ExtentLocation; /* LBA */
116 int32LM DataLength; /* In bytes */
117 binDate RecordingDate;
118 int8 Flags;
119 #define ISO_Directory_HIDDEN (1 << 0) /* Hidden file */
120 #define ISO_Directory_ISDIR (1 << 1) /* Is a directrory node */
121 #define ISO_Directory_ASSOC (1 << 2) /* Associated File */
122 #define ISO_Directory_EXTFORMAT (1 << 3) /* Extended Attribute has format info */
123 #define ISO_Directory_EXTPERM (1 << 4) /* Extended Attribute has permission info */
124 #define ISO_Directory_CONTINUED (1 << 5) /* File continued in another entry */
125 int8 InterleaveSize;
126 int8 InterleaveGap;
127 int16LM VolumeSequence;
128 int8 FileIdentifierLength;
129 strD FileIdentifier[0]; /* Padded to an even length */
130 /* System Use area follows the FileIdentifier */
131 } __packed;
133 /* Rock-Ridge and Amiga extensions */
135 struct rrSystemUse {
136 int16 Signature; /* Always treat as MSB */
137 int8 Length;
138 int8 Version;
139 union {
140 #define RR_SystemUse_SP 0x5350 /* System Use Sharing Protocol */
141 #define RR_SystemUse_SP_VERSION 1
142 struct {
143 UBYTE CheckBytes[2]; /* 0xBE 0xEF */
144 int8 BytesSkipped;
145 } __packed SP;
146 #define RR_SystemUse_ST 0x5354 /* System Use Sharing Termination */
147 #define RR_SystemUse_ST_VERSION 1
148 struct {
149 } __packed ST;
150 #define RR_SystemUse_CE 0x4345 /* Continuation Entry */
151 #define RR_SystemUse_CE_VERSION 1
152 struct {
153 int32LM Location;
154 int32LM Offset;
155 int32LM Length;
156 } __packed CE;
157 #define RR_SystemUse_ER 0x4552 /* Extension Reference */
158 #define RR_SystemUse_ER_VERSION 1
159 struct {
160 int8 IdentifierLength; /* LEN_ID */
161 int8 DescriptorLength; /* LEN_DES */
162 int8 SourceLength; /* LEN_SRC */
163 int8 ExtensionVersion; /* EXT_VER */
164 UBYTE Data[0]; /* LEN_ID + LEN_DES + LEN_SRC */
165 } ER;
166 #define RR_SystemUse_AS 0x4153 /* Amiga */
167 #define RR_SystemUse_AS_VERSION 1
168 struct {
169 int8 Flags;
170 #define RR_AS_PROTECTION (1 << 0) /* Protection bits present */
171 #define RR_AS_COMMENT (1 << 1) /* Comment field present */
172 #define RR_AS_COMMENT_CONTINUE (1 << 2) /* Comment continues in next SUA */
173 UBYTE Data[];
174 } __packed AS;
175 #define RR_SystemUse_RR 0x5252 /* RockRidge capabilities */
176 #define RR_SystemUse_RR_VERSION 1
177 struct {
178 int8 Flags;
179 #define RR_RR_FLAGS_PX (1 << 0) /* PX Flag is valid */
180 #define RR_RR_FLAGS_PN (1 << 0) /* PX Flag is valid */
181 #define RR_RR_FLAGS_SL (1 << 0) /* PX Flag is valid */
182 #define RR_RR_FLAGS_NM (1 << 0) /* PX Flag is valid */
183 #define RR_RR_FLAGS_CL (1 << 0) /* PX Flag is valid */
184 #define RR_RR_FLAGS_PL (1 << 0) /* PX Flag is valid */
185 #define RR_RR_FLAGS_RE (1 << 0) /* PX Flag is valid */
186 #define RR_RR_FLAGS_TF (1 << 0) /* PX Flag is valid */
187 } RR;
188 #define RR_SystemUse_PX 0x5058 /* POSIX */
189 #define RR_SystemUse_PX_VERSION 1
190 struct {
191 int32LM st_mode;
192 #define S_IRUSR 0000400
193 #define S_IWUSR 0000200
194 #define S_IXUSR 0000100
195 #define S_IRGRP 0000040
196 #define S_IWGRP 0000020
197 #define S_IXGRP 0000010
198 #define S_IROTH 0000004
199 #define S_IWOTH 0000002
200 #define S_IXOTH 0000001
201 #define S_ISUID 0004000
202 #define S_ISGID 0002000
203 #define S_ENFMT 0002000
204 #define S_ISVTX 0001000
205 #define S_IFSOCK 0140000
206 #define S_IFLINK 0120000
207 #define S_IFREG 0100000
208 #define S_IFBLK 0060000
209 #define S_IFCHR 0020000
210 #define S_IFDIR 0040000
211 #define S_IFIFO 0010000
212 int32LM st_nlink;
213 int32LM st_uid;
214 int32LM st_gid;
215 int32LM st_ino;
216 } __packed PX;
217 #define RR_SystemUse_PN 0x504e
218 #define RR_SystemUse_PN_VERISON 1
219 struct {
220 int32LM dev_t_High;
221 int32LM dev_t_Low;
222 } __packed PN;
223 #define RR_SystemUse_SL 0x534c
224 #define RR_SystemUse_SL_VERSION 1
225 struct {
226 int8 Flags;
227 #define RR_SL_CONTINUE (1 << 0)
228 union {
229 TEXT Component[0];
230 struct rrSL_Component {
231 int8 Flags;
232 #define RR_SL_COMPONENT_CONTINUE (1 << 0)
233 #define RR_SL_COMPONENT_CURRENT (1 << 1)
234 #define RR_SL_COMPONENT_PARENT (1 << 2)
235 #define RR_SL_COMPONENT_ROOT (1 << 3)
236 #define RR_SL_COMPONENT_VOLUME (1 << 4) /* Obsolete */
237 #define RR_SL_COMPONENT_HOSTNAME (1 << 5) /* Obsolete */
238 int8 ContentLength;
239 TEXT Content[0];
240 } __packed SL_Component;
242 } __packed SL;
243 #define RR_SystemUse_NM 0x4e4d
244 #define RR_SystemUse_NM_VERSION 1
245 struct {
246 int8 Flags;
247 #define RR_NM_COMPONENT_CONTINUE (1 << 0)
248 #define RR_NM_COMPONENT_CURRENT (1 << 1)
249 #define RR_NM_COMPONENT_PARENT (1 << 2)
250 TEXT Content[0];
251 } __packed NM;
252 #define RR_SystemUse_CL 0x434c
253 #define RR_SystemUse_CL_VERSION 1
254 struct {
255 int32LM ChildDirectory; /* LBA */
256 } __packed CL;
257 #define RR_SystemUse_PL 0x504c
258 #define RR_SystemUse_PL_VERSION 1
259 struct {
260 int32LM ParentDirectory; /* LBA */
261 } __packed PL;
262 #define RR_SystemUse_RE 0x524c
263 #define RR_SystemUse_RE_VERSION 1
264 struct {
265 } __packed RE;
266 #define RR_SystemUse_TF 0x5446
267 #define RR_SystemUse_TF_VERSION 1
268 struct {
269 int8 Flags;
270 #define RR_TF_CREATION (1 << 0)
271 #define RR_TF_MODIFY (1 << 1)
272 #define RR_TF_ACCESS (1 << 2)
273 #define RR_TF_ATTRIBUTES (1 << 3)
274 #define RR_TF_BACKUP (1 << 4)
275 #define RR_TF_EXPIRATION (1 << 5)
276 #define RR_TF_EFFECTIVE (1 << 6)
277 #define RR_TF_LONG_FORM (1 << 7)
278 UBYTE Data[]; /* Array of ascDate or binDate format */
279 } __packed TF;
280 #define RR_SystemUse_SF 0x5346
281 #define RR_SystemUse_SF_VERSION 1
282 struct {
283 int32LM st_size_High;
284 int32LM st_size_Low;
285 int8 TableDepth;
286 } __packed SF;
291 struct rrSparseFileTable {
292 int32LM TableEntry[256];
293 #define RR_SFT_BLOCK(x) ((x) & 0x00ffffff) /* LBA */
294 #define RR_SFT_TABLE (1 << 30)
295 #define RR_SFT_EMPTY (1 << 31)
296 } __packed;
300 struct SystemUseASProtection {
301 UBYTE User;
302 UBYTE Zero;
303 UBYTE MultiUser;
304 UBYTE Protection;
305 } __packed;
307 struct SystemUseASComment {
308 UBYTE Length;
309 TEXT Comment[];
310 } __packed;
312 extern const struct CDFSOps ISO9660_Ops;
314 #endif /* ISO9660_H */