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