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