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