Merge tag 'sound-fix-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[linux-2.6-block.git] / fs / udf / ecma_167.h
CommitLineData
1da177e4
LT
1/*
2 * ecma_167.h
3 *
4 * This file is based on ECMA-167 3rd edition (June 1997)
5 * http://www.ecma.ch
6 *
7 * Copyright (c) 2001-2002 Ben Fennema <bfennema@falcon.csc.calpoly.edu>
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions, and the following disclaimer,
15 * without modification.
16 * 2. The name of the author may not be used to endorse or promote products
17 * derived from this software without specific prior written permission.
18 *
19 * Alternatively, this software may be distributed under the terms of the
20 * GNU Public License ("GPL").
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
26 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 */
34
35#include <linux/types.h>
36
37#ifndef _ECMA_167_H
38#define _ECMA_167_H 1
39
40/* Character set specification (ECMA 167r3 1/7.2.1) */
5ca4e4be 41struct charspec {
28de7948
CG
42 uint8_t charSetType;
43 uint8_t charSetInfo[63];
75f27138 44} __packed;
1da177e4
LT
45
46/* Character Set Type (ECMA 167r3 1/7.2.1.1) */
47#define CHARSPEC_TYPE_CS0 0x00 /* (1/7.2.2) */
48#define CHARSPEC_TYPE_CS1 0x01 /* (1/7.2.3) */
49#define CHARSPEC_TYPE_CS2 0x02 /* (1/7.2.4) */
50#define CHARSPEC_TYPE_CS3 0x03 /* (1/7.2.5) */
51#define CHARSPEC_TYPE_CS4 0x04 /* (1/7.2.6) */
52#define CHARSPEC_TYPE_CS5 0x05 /* (1/7.2.7) */
53#define CHARSPEC_TYPE_CS6 0x06 /* (1/7.2.8) */
54#define CHARSPEC_TYPE_CS7 0x07 /* (1/7.2.9) */
55#define CHARSPEC_TYPE_CS8 0x08 /* (1/7.2.10) */
56
28de7948 57typedef uint8_t dstring;
1da177e4
LT
58
59/* Timestamp (ECMA 167r3 1/7.3) */
5ca4e4be 60struct timestamp {
28de7948
CG
61 __le16 typeAndTimezone;
62 __le16 year;
63 uint8_t month;
64 uint8_t day;
65 uint8_t hour;
66 uint8_t minute;
67 uint8_t second;
68 uint8_t centiseconds;
69 uint8_t hundredsOfMicroseconds;
70 uint8_t microseconds;
75f27138 71} __packed;
1da177e4 72
1da177e4
LT
73/* Type and Time Zone (ECMA 167r3 1/7.3.1) */
74#define TIMESTAMP_TYPE_MASK 0xF000
75#define TIMESTAMP_TYPE_CUT 0x0000
76#define TIMESTAMP_TYPE_LOCAL 0x1000
77#define TIMESTAMP_TYPE_AGREEMENT 0x2000
78#define TIMESTAMP_TIMEZONE_MASK 0x0FFF
79
80/* Entity identifier (ECMA 167r3 1/7.4) */
5ca4e4be 81struct regid {
28de7948
CG
82 uint8_t flags;
83 uint8_t ident[23];
84 uint8_t identSuffix[8];
75f27138 85} __packed;
1da177e4
LT
86
87/* Flags (ECMA 167r3 1/7.4.1) */
88#define ENTITYID_FLAGS_DIRTY 0x00
89#define ENTITYID_FLAGS_PROTECTED 0x01
90
2dee5aac
JK
91/* OSTA UDF 2.1.5.2 */
92#define UDF_ID_COMPLIANT "*OSTA UDF Compliant"
93
94/* OSTA UDF 2.1.5.3 */
95struct domainEntityIDSuffix {
96 uint16_t revision;
97 uint8_t flags;
98 uint8_t reserved[5];
99};
100
101/* OSTA UDF 2.1.5.3 */
102#define ENTITYIDSUFFIX_FLAGS_HARDWRITEPROTECT 0
103#define ENTITYIDSUFFIX_FLAGS_SOFTWRITEPROTECT 1
104
1da177e4
LT
105/* Volume Structure Descriptor (ECMA 167r3 2/9.1) */
106#define VSD_STD_ID_LEN 5
cb00ea35 107struct volStructDesc {
28de7948
CG
108 uint8_t structType;
109 uint8_t stdIdent[VSD_STD_ID_LEN];
110 uint8_t structVersion;
111 uint8_t structData[2041];
75f27138 112} __packed;
1da177e4
LT
113
114/* Standard Identifier (EMCA 167r2 2/9.1.2) */
115#define VSD_STD_ID_NSR02 "NSR02" /* (3/9.1) */
116
117/* Standard Identifier (ECMA 167r3 2/9.1.2) */
118#define VSD_STD_ID_BEA01 "BEA01" /* (2/9.2) */
119#define VSD_STD_ID_BOOT2 "BOOT2" /* (2/9.4) */
120#define VSD_STD_ID_CD001 "CD001" /* (ECMA-119) */
121#define VSD_STD_ID_CDW02 "CDW02" /* (ECMA-168) */
122#define VSD_STD_ID_NSR03 "NSR03" /* (3/9.1) */
123#define VSD_STD_ID_TEA01 "TEA01" /* (2/9.3) */
124
125/* Beginning Extended Area Descriptor (ECMA 167r3 2/9.2) */
cb00ea35 126struct beginningExtendedAreaDesc {
28de7948
CG
127 uint8_t structType;
128 uint8_t stdIdent[VSD_STD_ID_LEN];
129 uint8_t structVersion;
130 uint8_t structData[2041];
75f27138 131} __packed;
1da177e4
LT
132
133/* Terminating Extended Area Descriptor (ECMA 167r3 2/9.3) */
cb00ea35 134struct terminatingExtendedAreaDesc {
28de7948
CG
135 uint8_t structType;
136 uint8_t stdIdent[VSD_STD_ID_LEN];
137 uint8_t structVersion;
138 uint8_t structData[2041];
75f27138 139} __packed;
1da177e4
LT
140
141/* Boot Descriptor (ECMA 167r3 2/9.4) */
cb00ea35 142struct bootDesc {
5ca4e4be
PE
143 uint8_t structType;
144 uint8_t stdIdent[VSD_STD_ID_LEN];
145 uint8_t structVersion;
146 uint8_t reserved1;
147 struct regid archType;
148 struct regid bootIdent;
149 __le32 bootExtLocation;
150 __le32 bootExtLength;
151 __le64 loadAddress;
152 __le64 startAddress;
153 struct timestamp descCreationDateAndTime;
154 __le16 flags;
155 uint8_t reserved2[32];
156 uint8_t bootUse[1906];
75f27138 157} __packed;
1da177e4
LT
158
159/* Flags (ECMA 167r3 2/9.4.12) */
160#define BOOT_FLAGS_ERASE 0x01
161
162/* Extent Descriptor (ECMA 167r3 3/7.1) */
5ca4e4be 163struct extent_ad {
28de7948
CG
164 __le32 extLength;
165 __le32 extLocation;
75f27138 166} __packed;
1da177e4 167
5ca4e4be 168struct kernel_extent_ad {
28de7948
CG
169 uint32_t extLength;
170 uint32_t extLocation;
5ca4e4be 171};
1da177e4
LT
172
173/* Descriptor Tag (ECMA 167r3 3/7.2) */
5ca4e4be 174struct tag {
28de7948
CG
175 __le16 tagIdent;
176 __le16 descVersion;
177 uint8_t tagChecksum;
178 uint8_t reserved;
179 __le16 tagSerialNum;
180 __le16 descCRC;
181 __le16 descCRCLength;
182 __le32 tagLocation;
75f27138 183} __packed;
1da177e4
LT
184
185/* Tag Identifier (ECMA 167r3 3/7.2.1) */
186#define TAG_IDENT_PVD 0x0001
187#define TAG_IDENT_AVDP 0x0002
188#define TAG_IDENT_VDP 0x0003
189#define TAG_IDENT_IUVD 0x0004
190#define TAG_IDENT_PD 0x0005
191#define TAG_IDENT_LVD 0x0006
192#define TAG_IDENT_USD 0x0007
193#define TAG_IDENT_TD 0x0008
194#define TAG_IDENT_LVID 0x0009
195
196/* NSR Descriptor (ECMA 167r3 3/9.1) */
cb00ea35 197struct NSRDesc {
28de7948
CG
198 uint8_t structType;
199 uint8_t stdIdent[VSD_STD_ID_LEN];
200 uint8_t structVersion;
201 uint8_t reserved;
202 uint8_t structData[2040];
75f27138 203} __packed;
cb00ea35 204
1da177e4 205/* Primary Volume Descriptor (ECMA 167r3 3/10.1) */
cb00ea35 206struct primaryVolDesc {
5ca4e4be
PE
207 struct tag descTag;
208 __le32 volDescSeqNum;
209 __le32 primaryVolDescNum;
210 dstring volIdent[32];
211 __le16 volSeqNum;
212 __le16 maxVolSeqNum;
213 __le16 interchangeLvl;
214 __le16 maxInterchangeLvl;
215 __le32 charSetList;
216 __le32 maxCharSetList;
217 dstring volSetIdent[128];
218 struct charspec descCharSet;
219 struct charspec explanatoryCharSet;
220 struct extent_ad volAbstract;
221 struct extent_ad volCopyright;
222 struct regid appIdent;
223 struct timestamp recordingDateAndTime;
224 struct regid impIdent;
225 uint8_t impUse[64];
226 __le32 predecessorVolDescSeqLocation;
227 __le16 flags;
228 uint8_t reserved[22];
75f27138 229} __packed;
1da177e4
LT
230
231/* Flags (ECMA 167r3 3/10.1.21) */
232#define PVD_FLAGS_VSID_COMMON 0x0001
233
234/* Anchor Volume Descriptor Pointer (ECMA 167r3 3/10.2) */
cb00ea35 235struct anchorVolDescPtr {
5ca4e4be
PE
236 struct tag descTag;
237 struct extent_ad mainVolDescSeqExt;
238 struct extent_ad reserveVolDescSeqExt;
239 uint8_t reserved[480];
75f27138 240} __packed;
1da177e4
LT
241
242/* Volume Descriptor Pointer (ECMA 167r3 3/10.3) */
cb00ea35 243struct volDescPtr {
5ca4e4be
PE
244 struct tag descTag;
245 __le32 volDescSeqNum;
246 struct extent_ad nextVolDescSeqExt;
247 uint8_t reserved[484];
75f27138 248} __packed;
1da177e4
LT
249
250/* Implementation Use Volume Descriptor (ECMA 167r3 3/10.4) */
cb00ea35 251struct impUseVolDesc {
5ca4e4be 252 struct tag descTag;
28de7948 253 __le32 volDescSeqNum;
5ca4e4be 254 struct regid impIdent;
28de7948 255 uint8_t impUse[460];
75f27138 256} __packed;
1da177e4
LT
257
258/* Partition Descriptor (ECMA 167r3 3/10.5) */
cb00ea35 259struct partitionDesc {
5ca4e4be 260 struct tag descTag;
cb00ea35
CG
261 __le32 volDescSeqNum;
262 __le16 partitionFlags;
263 __le16 partitionNumber;
5ca4e4be 264 struct regid partitionContents;
cb00ea35
CG
265 uint8_t partitionContentsUse[128];
266 __le32 accessType;
267 __le32 partitionStartingLocation;
268 __le32 partitionLength;
5ca4e4be 269 struct regid impIdent;
cb00ea35
CG
270 uint8_t impUse[128];
271 uint8_t reserved[156];
75f27138 272} __packed;
1da177e4
LT
273
274/* Partition Flags (ECMA 167r3 3/10.5.3) */
275#define PD_PARTITION_FLAGS_ALLOC 0x0001
276
277/* Partition Contents (ECMA 167r2 3/10.5.3) */
278#define PD_PARTITION_CONTENTS_NSR02 "+NSR02"
279
280/* Partition Contents (ECMA 167r3 3/10.5.5) */
281#define PD_PARTITION_CONTENTS_FDC01 "+FDC01"
282#define PD_PARTITION_CONTENTS_CD001 "+CD001"
283#define PD_PARTITION_CONTENTS_CDW02 "+CDW02"
284#define PD_PARTITION_CONTENTS_NSR03 "+NSR03"
285
286/* Access Type (ECMA 167r3 3/10.5.7) */
287#define PD_ACCESS_TYPE_NONE 0x00000000
288#define PD_ACCESS_TYPE_READ_ONLY 0x00000001
289#define PD_ACCESS_TYPE_WRITE_ONCE 0x00000002
290#define PD_ACCESS_TYPE_REWRITABLE 0x00000003
291#define PD_ACCESS_TYPE_OVERWRITABLE 0x00000004
292
293/* Logical Volume Descriptor (ECMA 167r3 3/10.6) */
cb00ea35 294struct logicalVolDesc {
5ca4e4be
PE
295 struct tag descTag;
296 __le32 volDescSeqNum;
297 struct charspec descCharSet;
298 dstring logicalVolIdent[128];
299 __le32 logicalBlockSize;
300 struct regid domainIdent;
301 uint8_t logicalVolContentsUse[16];
302 __le32 mapTableLength;
303 __le32 numPartitionMaps;
304 struct regid impIdent;
305 uint8_t impUse[128];
306 struct extent_ad integritySeqExt;
307 uint8_t partitionMaps[0];
75f27138 308} __packed;
1da177e4
LT
309
310/* Generic Partition Map (ECMA 167r3 3/10.7.1) */
cb00ea35 311struct genericPartitionMap {
28de7948
CG
312 uint8_t partitionMapType;
313 uint8_t partitionMapLength;
314 uint8_t partitionMapping[0];
75f27138 315} __packed;
1da177e4
LT
316
317/* Partition Map Type (ECMA 167r3 3/10.7.1.1) */
318#define GP_PARTITION_MAP_TYPE_UNDEF 0x00
319#define GP_PARTIITON_MAP_TYPE_1 0x01
320#define GP_PARTITION_MAP_TYPE_2 0x02
321
322/* Type 1 Partition Map (ECMA 167r3 3/10.7.2) */
cb00ea35 323struct genericPartitionMap1 {
28de7948
CG
324 uint8_t partitionMapType;
325 uint8_t partitionMapLength;
326 __le16 volSeqNum;
327 __le16 partitionNum;
75f27138 328} __packed;
1da177e4
LT
329
330/* Type 2 Partition Map (ECMA 167r3 3/10.7.3) */
cb00ea35 331struct genericPartitionMap2 {
28de7948
CG
332 uint8_t partitionMapType;
333 uint8_t partitionMapLength;
334 uint8_t partitionIdent[62];
75f27138 335} __packed;
1da177e4
LT
336
337/* Unallocated Space Descriptor (ECMA 167r3 3/10.8) */
cb00ea35 338struct unallocSpaceDesc {
5ca4e4be
PE
339 struct tag descTag;
340 __le32 volDescSeqNum;
341 __le32 numAllocDescs;
342 struct extent_ad allocDescs[0];
75f27138 343} __packed;
1da177e4
LT
344
345/* Terminating Descriptor (ECMA 167r3 3/10.9) */
cb00ea35 346struct terminatingDesc {
5ca4e4be 347 struct tag descTag;
28de7948 348 uint8_t reserved[496];
75f27138 349} __packed;
1da177e4
LT
350
351/* Logical Volume Integrity Descriptor (ECMA 167r3 3/10.10) */
cb00ea35 352struct logicalVolIntegrityDesc {
5ca4e4be
PE
353 struct tag descTag;
354 struct timestamp recordingDateAndTime;
355 __le32 integrityType;
356 struct extent_ad nextIntegrityExt;
357 uint8_t logicalVolContentsUse[32];
358 __le32 numOfPartitions;
359 __le32 lengthOfImpUse;
360 __le32 freeSpaceTable[0];
361 __le32 sizeTable[0];
362 uint8_t impUse[0];
75f27138 363} __packed;
1da177e4
LT
364
365/* Integrity Type (ECMA 167r3 3/10.10.3) */
366#define LVID_INTEGRITY_TYPE_OPEN 0x00000000
367#define LVID_INTEGRITY_TYPE_CLOSE 0x00000001
368
369/* Recorded Address (ECMA 167r3 4/7.1) */
5ca4e4be 370struct lb_addr {
28de7948
CG
371 __le32 logicalBlockNum;
372 __le16 partitionReferenceNum;
75f27138 373} __packed;
1da177e4
LT
374
375/* ... and its in-core analog */
5ca4e4be 376struct kernel_lb_addr {
28de7948
CG
377 uint32_t logicalBlockNum;
378 uint16_t partitionReferenceNum;
5ca4e4be 379};
1da177e4
LT
380
381/* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */
5ca4e4be 382struct short_ad {
28de7948
CG
383 __le32 extLength;
384 __le32 extPosition;
75f27138 385} __packed;
1da177e4
LT
386
387/* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */
5ca4e4be 388struct long_ad {
28de7948 389 __le32 extLength;
5ca4e4be 390 struct lb_addr extLocation;
28de7948 391 uint8_t impUse[6];
75f27138 392} __packed;
1da177e4 393
5ca4e4be
PE
394struct kernel_long_ad {
395 uint32_t extLength;
396 struct kernel_lb_addr extLocation;
397 uint8_t impUse[6];
398};
1da177e4
LT
399
400/* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */
5ca4e4be 401struct ext_ad {
28de7948
CG
402 __le32 extLength;
403 __le32 recordedLength;
404 __le32 informationLength;
5ca4e4be 405 struct lb_addr extLocation;
75f27138 406} __packed;
1da177e4 407
5ca4e4be
PE
408struct kernel_ext_ad {
409 uint32_t extLength;
410 uint32_t recordedLength;
411 uint32_t informationLength;
412 struct kernel_lb_addr extLocation;
413};
1da177e4
LT
414
415/* Descriptor Tag (ECMA 167r3 4/7.2 - See 3/7.2) */
416
417/* Tag Identifier (ECMA 167r3 4/7.2.1) */
418#define TAG_IDENT_FSD 0x0100
419#define TAG_IDENT_FID 0x0101
420#define TAG_IDENT_AED 0x0102
421#define TAG_IDENT_IE 0x0103
422#define TAG_IDENT_TE 0x0104
423#define TAG_IDENT_FE 0x0105
424#define TAG_IDENT_EAHD 0x0106
425#define TAG_IDENT_USE 0x0107
426#define TAG_IDENT_SBD 0x0108
427#define TAG_IDENT_PIE 0x0109
428#define TAG_IDENT_EFE 0x010A
429
430/* File Set Descriptor (ECMA 167r3 4/14.1) */
cb00ea35 431struct fileSetDesc {
5ca4e4be
PE
432 struct tag descTag;
433 struct timestamp recordingDateAndTime;
434 __le16 interchangeLvl;
435 __le16 maxInterchangeLvl;
436 __le32 charSetList;
437 __le32 maxCharSetList;
438 __le32 fileSetNum;
439 __le32 fileSetDescNum;
440 struct charspec logicalVolIdentCharSet;
441 dstring logicalVolIdent[128];
442 struct charspec fileSetCharSet;
443 dstring fileSetIdent[32];
444 dstring copyrightFileIdent[32];
445 dstring abstractFileIdent[32];
446 struct long_ad rootDirectoryICB;
447 struct regid domainIdent;
448 struct long_ad nextExt;
449 struct long_ad streamDirectoryICB;
450 uint8_t reserved[32];
75f27138 451} __packed;
1da177e4
LT
452
453/* Partition Header Descriptor (ECMA 167r3 4/14.3) */
cb00ea35 454struct partitionHeaderDesc {
5ca4e4be
PE
455 struct short_ad unallocSpaceTable;
456 struct short_ad unallocSpaceBitmap;
457 struct short_ad partitionIntegrityTable;
458 struct short_ad freedSpaceTable;
459 struct short_ad freedSpaceBitmap;
28de7948 460 uint8_t reserved[88];
75f27138 461} __packed;
1da177e4
LT
462
463/* File Identifier Descriptor (ECMA 167r3 4/14.4) */
cb00ea35 464struct fileIdentDesc {
5ca4e4be 465 struct tag descTag;
28de7948
CG
466 __le16 fileVersionNum;
467 uint8_t fileCharacteristics;
468 uint8_t lengthFileIdent;
5ca4e4be 469 struct long_ad icb;
28de7948
CG
470 __le16 lengthOfImpUse;
471 uint8_t impUse[0];
472 uint8_t fileIdent[0];
473 uint8_t padding[0];
75f27138 474} __packed;
1da177e4
LT
475
476/* File Characteristics (ECMA 167r3 4/14.4.3) */
477#define FID_FILE_CHAR_HIDDEN 0x01
478#define FID_FILE_CHAR_DIRECTORY 0x02
479#define FID_FILE_CHAR_DELETED 0x04
480#define FID_FILE_CHAR_PARENT 0x08
481#define FID_FILE_CHAR_METADATA 0x10
482
483/* Allocation Ext Descriptor (ECMA 167r3 4/14.5) */
cb00ea35 484struct allocExtDesc {
5ca4e4be 485 struct tag descTag;
28de7948
CG
486 __le32 previousAllocExtLocation;
487 __le32 lengthAllocDescs;
75f27138 488} __packed;
1da177e4
LT
489
490/* ICB Tag (ECMA 167r3 4/14.6) */
5ca4e4be 491struct icbtag {
28de7948
CG
492 __le32 priorRecordedNumDirectEntries;
493 __le16 strategyType;
494 __le16 strategyParameter;
495 __le16 numEntries;
496 uint8_t reserved;
497 uint8_t fileType;
5ca4e4be 498 struct lb_addr parentICBLocation;
28de7948 499 __le16 flags;
75f27138 500} __packed;
1da177e4
LT
501
502/* Strategy Type (ECMA 167r3 4/14.6.2) */
503#define ICBTAG_STRATEGY_TYPE_UNDEF 0x0000
504#define ICBTAG_STRATEGY_TYPE_1 0x0001
505#define ICBTAG_STRATEGY_TYPE_2 0x0002
506#define ICBTAG_STRATEGY_TYPE_3 0x0003
507#define ICBTAG_STRATEGY_TYPE_4 0x0004
508
509/* File Type (ECMA 167r3 4/14.6.6) */
510#define ICBTAG_FILE_TYPE_UNDEF 0x00
511#define ICBTAG_FILE_TYPE_USE 0x01
512#define ICBTAG_FILE_TYPE_PIE 0x02
513#define ICBTAG_FILE_TYPE_IE 0x03
514#define ICBTAG_FILE_TYPE_DIRECTORY 0x04
515#define ICBTAG_FILE_TYPE_REGULAR 0x05
516#define ICBTAG_FILE_TYPE_BLOCK 0x06
517#define ICBTAG_FILE_TYPE_CHAR 0x07
518#define ICBTAG_FILE_TYPE_EA 0x08
519#define ICBTAG_FILE_TYPE_FIFO 0x09
520#define ICBTAG_FILE_TYPE_SOCKET 0x0A
521#define ICBTAG_FILE_TYPE_TE 0x0B
522#define ICBTAG_FILE_TYPE_SYMLINK 0x0C
523#define ICBTAG_FILE_TYPE_STREAMDIR 0x0D
524
525/* Flags (ECMA 167r3 4/14.6.8) */
526#define ICBTAG_FLAG_AD_MASK 0x0007
527#define ICBTAG_FLAG_AD_SHORT 0x0000
528#define ICBTAG_FLAG_AD_LONG 0x0001
529#define ICBTAG_FLAG_AD_EXTENDED 0x0002
530#define ICBTAG_FLAG_AD_IN_ICB 0x0003
531#define ICBTAG_FLAG_SORTED 0x0008
532#define ICBTAG_FLAG_NONRELOCATABLE 0x0010
533#define ICBTAG_FLAG_ARCHIVE 0x0020
534#define ICBTAG_FLAG_SETUID 0x0040
535#define ICBTAG_FLAG_SETGID 0x0080
536#define ICBTAG_FLAG_STICKY 0x0100
537#define ICBTAG_FLAG_CONTIGUOUS 0x0200
538#define ICBTAG_FLAG_SYSTEM 0x0400
539#define ICBTAG_FLAG_TRANSFORMED 0x0800
540#define ICBTAG_FLAG_MULTIVERSIONS 0x1000
541#define ICBTAG_FLAG_STREAM 0x2000
542
543/* Indirect Entry (ECMA 167r3 4/14.7) */
cb00ea35 544struct indirectEntry {
5ca4e4be
PE
545 struct tag descTag;
546 struct icbtag icbTag;
547 struct long_ad indirectICB;
75f27138 548} __packed;
1da177e4
LT
549
550/* Terminal Entry (ECMA 167r3 4/14.8) */
cb00ea35 551struct terminalEntry {
5ca4e4be
PE
552 struct tag descTag;
553 struct icbtag icbTag;
75f27138 554} __packed;
1da177e4
LT
555
556/* File Entry (ECMA 167r3 4/14.9) */
cb00ea35 557struct fileEntry {
5ca4e4be
PE
558 struct tag descTag;
559 struct icbtag icbTag;
560 __le32 uid;
561 __le32 gid;
562 __le32 permissions;
563 __le16 fileLinkCount;
564 uint8_t recordFormat;
565 uint8_t recordDisplayAttr;
566 __le32 recordLength;
567 __le64 informationLength;
568 __le64 logicalBlocksRecorded;
569 struct timestamp accessTime;
570 struct timestamp modificationTime;
571 struct timestamp attrTime;
572 __le32 checkpoint;
573 struct long_ad extendedAttrICB;
574 struct regid impIdent;
575 __le64 uniqueID;
576 __le32 lengthExtendedAttr;
577 __le32 lengthAllocDescs;
578 uint8_t extendedAttr[0];
579 uint8_t allocDescs[0];
75f27138 580} __packed;
1da177e4
LT
581
582/* Permissions (ECMA 167r3 4/14.9.5) */
583#define FE_PERM_O_EXEC 0x00000001U
584#define FE_PERM_O_WRITE 0x00000002U
585#define FE_PERM_O_READ 0x00000004U
586#define FE_PERM_O_CHATTR 0x00000008U
587#define FE_PERM_O_DELETE 0x00000010U
588#define FE_PERM_G_EXEC 0x00000020U
589#define FE_PERM_G_WRITE 0x00000040U
590#define FE_PERM_G_READ 0x00000080U
591#define FE_PERM_G_CHATTR 0x00000100U
592#define FE_PERM_G_DELETE 0x00000200U
593#define FE_PERM_U_EXEC 0x00000400U
594#define FE_PERM_U_WRITE 0x00000800U
595#define FE_PERM_U_READ 0x00001000U
596#define FE_PERM_U_CHATTR 0x00002000U
597#define FE_PERM_U_DELETE 0x00004000U
598
599/* Record Format (ECMA 167r3 4/14.9.7) */
600#define FE_RECORD_FMT_UNDEF 0x00
601#define FE_RECORD_FMT_FIXED_PAD 0x01
602#define FE_RECORD_FMT_FIXED 0x02
603#define FE_RECORD_FMT_VARIABLE8 0x03
604#define FE_RECORD_FMT_VARIABLE16 0x04
605#define FE_RECORD_FMT_VARIABLE16_MSB 0x05
606#define FE_RECORD_FMT_VARIABLE32 0x06
607#define FE_RECORD_FMT_PRINT 0x07
608#define FE_RECORD_FMT_LF 0x08
609#define FE_RECORD_FMT_CR 0x09
610#define FE_RECORD_FMT_CRLF 0x0A
611#define FE_RECORD_FMT_LFCR 0x0B
612
613/* Record Display Attributes (ECMA 167r3 4/14.9.8) */
614#define FE_RECORD_DISPLAY_ATTR_UNDEF 0x00
615#define FE_RECORD_DISPLAY_ATTR_1 0x01
616#define FE_RECORD_DISPLAY_ATTR_2 0x02
617#define FE_RECORD_DISPLAY_ATTR_3 0x03
618
619/* Extended Attribute Header Descriptor (ECMA 167r3 4/14.10.1) */
cb00ea35 620struct extendedAttrHeaderDesc {
5ca4e4be 621 struct tag descTag;
28de7948
CG
622 __le32 impAttrLocation;
623 __le32 appAttrLocation;
75f27138 624} __packed;
1da177e4
LT
625
626/* Generic Format (ECMA 167r3 4/14.10.2) */
cb00ea35 627struct genericFormat {
28de7948
CG
628 __le32 attrType;
629 uint8_t attrSubtype;
630 uint8_t reserved[3];
631 __le32 attrLength;
632 uint8_t attrData[0];
75f27138 633} __packed;
1da177e4
LT
634
635/* Character Set Information (ECMA 167r3 4/14.10.3) */
cb00ea35 636struct charSetInfo {
28de7948
CG
637 __le32 attrType;
638 uint8_t attrSubtype;
639 uint8_t reserved[3];
640 __le32 attrLength;
641 __le32 escapeSeqLength;
642 uint8_t charSetType;
643 uint8_t escapeSeq[0];
75f27138 644} __packed;
1da177e4
LT
645
646/* Alternate Permissions (ECMA 167r3 4/14.10.4) */
cb00ea35 647struct altPerms {
28de7948
CG
648 __le32 attrType;
649 uint8_t attrSubtype;
650 uint8_t reserved[3];
651 __le32 attrLength;
652 __le16 ownerIdent;
653 __le16 groupIdent;
654 __le16 permission;
75f27138 655} __packed;
1da177e4
LT
656
657/* File Times Extended Attribute (ECMA 167r3 4/14.10.5) */
cb00ea35 658struct fileTimesExtAttr {
28de7948
CG
659 __le32 attrType;
660 uint8_t attrSubtype;
661 uint8_t reserved[3];
662 __le32 attrLength;
663 __le32 dataLength;
664 __le32 fileTimeExistence;
665 uint8_t fileTimes;
75f27138 666} __packed;
1da177e4
LT
667
668/* FileTimeExistence (ECMA 167r3 4/14.10.5.6) */
669#define FTE_CREATION 0x00000001
670#define FTE_DELETION 0x00000004
671#define FTE_EFFECTIVE 0x00000008
672#define FTE_BACKUP 0x00000002
673
674/* Information Times Extended Attribute (ECMA 167r3 4/14.10.6) */
cb00ea35 675struct infoTimesExtAttr {
28de7948
CG
676 __le32 attrType;
677 uint8_t attrSubtype;
678 uint8_t reserved[3];
679 __le32 attrLength;
680 __le32 dataLength;
681 __le32 infoTimeExistence;
682 uint8_t infoTimes[0];
75f27138 683} __packed;
1da177e4
LT
684
685/* Device Specification (ECMA 167r3 4/14.10.7) */
cb00ea35 686struct deviceSpec {
28de7948
CG
687 __le32 attrType;
688 uint8_t attrSubtype;
689 uint8_t reserved[3];
690 __le32 attrLength;
691 __le32 impUseLength;
692 __le32 majorDeviceIdent;
693 __le32 minorDeviceIdent;
694 uint8_t impUse[0];
75f27138 695} __packed;
1da177e4
LT
696
697/* Implementation Use Extended Attr (ECMA 167r3 4/14.10.8) */
cb00ea35 698struct impUseExtAttr {
28de7948
CG
699 __le32 attrType;
700 uint8_t attrSubtype;
701 uint8_t reserved[3];
702 __le32 attrLength;
703 __le32 impUseLength;
5ca4e4be 704 struct regid impIdent;
28de7948 705 uint8_t impUse[0];
75f27138 706} __packed;
1da177e4
LT
707
708/* Application Use Extended Attribute (ECMA 167r3 4/14.10.9) */
cb00ea35 709struct appUseExtAttr {
28de7948
CG
710 __le32 attrType;
711 uint8_t attrSubtype;
712 uint8_t reserved[3];
713 __le32 attrLength;
714 __le32 appUseLength;
5ca4e4be 715 struct regid appIdent;
28de7948 716 uint8_t appUse[0];
75f27138 717} __packed;
1da177e4
LT
718
719#define EXTATTR_CHAR_SET 1
720#define EXTATTR_ALT_PERMS 3
721#define EXTATTR_FILE_TIMES 5
722#define EXTATTR_INFO_TIMES 6
723#define EXTATTR_DEV_SPEC 12
724#define EXTATTR_IMP_USE 2048
725#define EXTATTR_APP_USE 65536
726
1da177e4 727/* Unallocated Space Entry (ECMA 167r3 4/14.11) */
cb00ea35 728struct unallocSpaceEntry {
5ca4e4be
PE
729 struct tag descTag;
730 struct icbtag icbTag;
28de7948
CG
731 __le32 lengthAllocDescs;
732 uint8_t allocDescs[0];
75f27138 733} __packed;
1da177e4
LT
734
735/* Space Bitmap Descriptor (ECMA 167r3 4/14.12) */
cb00ea35 736struct spaceBitmapDesc {
5ca4e4be 737 struct tag descTag;
28de7948
CG
738 __le32 numOfBits;
739 __le32 numOfBytes;
740 uint8_t bitmap[0];
75f27138 741} __packed;
1da177e4
LT
742
743/* Partition Integrity Entry (ECMA 167r3 4/14.13) */
cb00ea35 744struct partitionIntegrityEntry {
5ca4e4be
PE
745 struct tag descTag;
746 struct icbtag icbTag;
747 struct timestamp recordingDateAndTime;
748 uint8_t integrityType;
749 uint8_t reserved[175];
750 struct regid impIdent;
751 uint8_t impUse[256];
75f27138 752} __packed;
1da177e4
LT
753
754/* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */
755
756/* Extent Length (ECMA 167r3 4/14.14.1.1) */
757#define EXT_RECORDED_ALLOCATED 0x00000000
758#define EXT_NOT_RECORDED_ALLOCATED 0x40000000
759#define EXT_NOT_RECORDED_NOT_ALLOCATED 0x80000000
760#define EXT_NEXT_EXTENT_ALLOCDECS 0xC0000000
761
762/* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */
763
764/* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */
765
766/* Logical Volume Header Descriptor (ECMA 167r3 4/14.15) */
cb00ea35 767struct logicalVolHeaderDesc {
28de7948
CG
768 __le64 uniqueID;
769 uint8_t reserved[24];
75f27138 770} __packed;
1da177e4
LT
771
772/* Path Component (ECMA 167r3 4/14.16.1) */
cb00ea35 773struct pathComponent {
28de7948
CG
774 uint8_t componentType;
775 uint8_t lengthComponentIdent;
776 __le16 componentFileVersionNum;
777 dstring componentIdent[0];
75f27138 778} __packed;
1da177e4
LT
779
780/* File Entry (ECMA 167r3 4/14.17) */
cb00ea35 781struct extendedFileEntry {
5ca4e4be
PE
782 struct tag descTag;
783 struct icbtag icbTag;
784 __le32 uid;
785 __le32 gid;
786 __le32 permissions;
787 __le16 fileLinkCount;
788 uint8_t recordFormat;
789 uint8_t recordDisplayAttr;
790 __le32 recordLength;
791 __le64 informationLength;
792 __le64 objectSize;
793 __le64 logicalBlocksRecorded;
794 struct timestamp accessTime;
795 struct timestamp modificationTime;
796 struct timestamp createTime;
797 struct timestamp attrTime;
798 __le32 checkpoint;
799 __le32 reserved;
800 struct long_ad extendedAttrICB;
801 struct long_ad streamDirectoryICB;
802 struct regid impIdent;
803 __le64 uniqueID;
804 __le32 lengthExtendedAttr;
805 __le32 lengthAllocDescs;
806 uint8_t extendedAttr[0];
807 uint8_t allocDescs[0];
75f27138 808} __packed;
28de7948
CG
809
810#endif /* _ECMA_167_H */