1 #if !defined(_LINUX_UDF_167_H)
2 #define _LINUX_UDF_167_H
7 * Definitions from the ECMA 167 standard.
10 * These abbreviations are used to keep the symbols short:
28 * The symbols are otherwise identical to the standard, and the
29 * sections of the standard to refer to are indicated.
32 * E-mail regarding any portion of the Linux UDF file system should be
33 * directed to the development team mailing list (run by majordomo):
34 * linux_udf@hootie.lvld.hp.com
37 * This file is distributed under the terms of the GNU General Public
38 * License (GPL). Copies of the GPL can be obtained from:
39 * ftp://prep.ai.mit.edu/pub/gnu/GPL
40 * Each contributing author retains all rights to their own work.
43 * July 12, 1997 - Andrew E. Mileski
44 * Adapted from the ECMA-167 standard.
46 * 10/2/98 dgb Adaptation
47 * 10/4/98 Changes by HJA Sandkuyl
48 * 10/7/98 Changed FILE_EXISTENCE to FILE_HIDDEN, per UDF 2.0 spec
49 * 11/26/98 Modifed some entries for UDF 1.5/2.0
50 * 11/26/98 bf Fixed typos, non-linux types, more structures
51 * 12/5/98 dgb Adjusted structure and content of include files.
55 #include <linux/types.h>
60 typedef Uint8 dstring
;
62 #define Uint8 unsigned char
63 #define Uint16 unsigned short
64 #define Uint32 unsigned int
65 #define Uint64 unsigned long long
66 typedef Uint8 dstring
;
69 /* make sure all structures are packed! */
72 /* CS0 Charspec (ECMA 167 1/7.2.1) */
75 Uint8 charSetInfo
[63];
78 /* Timestamp (ECMA 167 1/7.3) */
80 Uint16 typeAndTimezone
;
88 Uint8 hundredsOfMicroseconds
;
92 /* Timestamp types (ECMA 167 1/7.3.1) */
93 #define TIMESTAMP_TYPE_CUT 0x0000U
94 #define TIMESTAMP_TYPE_LOCAL 0x0001U
95 #define TIMESTAMP_TYPE_AGREEMENT 0x0002U
97 /* Entity Identifier (ECMA 167 1/7.4) */
101 Uint8 identSuffix
[8];
103 #define regid EntityID
105 /* Entity identifier flags (ECMA 167 1/7.4.1) */
106 #define ENTITYID_FLAGS_DIRTY 0x01U
107 #define ENTITYID_FLAGS_PROTECTED 0x02U
109 /* Volume Structure Descriptor (ECMA 167 2/9.1) */
111 struct VolStructDesc
{
113 Uint8 stdIdent
[STD_ID_LEN
];
115 Uint8 structData
[2041];
118 /* Std structure identifiers (ECMA 167 2/9.1.2) */
119 #define STD_ID_BEA01 "BEA01"
120 #define STD_ID_BOOT2 "BOOT2"
121 #define STD_ID_CD001 "CD001"
122 #define STD_ID_CDW02 "CDW02"
123 #define STD_ID_NSR02 "NSR02"
124 #define STD_ID_NSR03 "NSR03"
125 #define STD_ID_TEA01 "TEA01"
127 /* Beginning Extended Area Descriptor (ECMA 167 2/9.2) */
128 struct BeginningExtendedAreaDesc
{
130 Uint8 stdIdent
[STD_ID_LEN
];
132 Uint8 structData
[2041];
135 /* Terminating Extended Area Descriptor (ECMA 167 2/9.3) */
136 struct TerminatingExtendedAreaDesc
{
138 Uint8 stdIdent
[STD_ID_LEN
];
140 Uint8 structData
[2041];
143 /* Boot Descriptor (ECMA 167 2/9.4) */
146 Uint8 stdIdent
[STD_ID_LEN
];
149 EntityID architectureType
;
151 Uint32 bootExtLocation
;
152 Uint32 bootExtLength
;
155 timestamp descCreationDateAndTime
;
161 /* Boot flags (ECMA 167 2/9.4.12) */
162 #define BOOT_FLAGS_ERASE 1
164 /* Extent Descriptor (ECMA 167 3/7.1) */
170 /* Descriptor Tag (ECMA 167 3/7.2) */
178 Uint16 descCRCLength
;
182 /* Tag Identifiers (ECMA 167 3/7.2.1) */
183 #define TID_UNUSED_DESC 0x0000U
184 #define TID_PRIMARY_VOL_DESC 0x0001U
185 #define TID_ANCHOR_VOL_DESC_PTR 0x0002U
186 #define TID_VOL_DESC_PTR 0x0003U
187 #define TID_IMP_USE_VOL_DESC 0x0004U
188 #define TID_PARTITION_DESC 0x0005U
189 #define TID_LOGICAL_VOL_DESC 0x0006U
190 #define TID_UNALLOC_SPACE_DESC 0x0007U
191 #define TID_TERMINATING_DESC 0x0008U
192 #define TID_LOGICAL_VOL_INTEGRITY_DESC 0x0009U
194 /* Tag Identifiers (ECMA 167 4/7.2.1) */
195 #define TID_FILE_SET_DESC 0x0100U
196 #define TID_FILE_IDENT_DESC 0x0101U
197 #define TID_ALLOC_EXTENT_DESC 0x0102U
198 #define TID_INDIRECT_ENTRY 0x0103U
199 #define TID_TERMINAL_ENTRY 0x0104U
200 #define TID_FILE_ENTRY 0x0105U
201 #define TID_EXTENDED_ATTRE_HEADER_DESC 0x0106U
202 #define TID_UNALLOCATED_SPACE_ENTRY 0x0107U
203 #define TID_SPACE_BITMAP_DESC 0x0108U
204 #define TID_PARTITION_INTEGRITY_ENTRY 0x0109U
205 #define TID_EXTENDED_FILE_ENTRY 0x010AU
207 /* NSR Descriptor (ECMA 167 3/9.1) */
210 Uint8 stdIdent
[STD_ID_LEN
];
213 Uint8 structData
[2040];
216 /* Primary Volume Descriptor (ECMA 167 3/10.1) */
217 struct PrimaryVolDesc
{
219 Uint32 volDescSeqNum
;
220 Uint32 primaryVolDescNum
;
221 dstring volIdent
[32];
224 Uint16 interchangeLvl
;
225 Uint16 maxInterchangeLvl
;
227 Uint32 maxCharSetList
;
228 dstring volSetIdent
[128];
229 charspec descCharSet
;
230 charspec explanatoryCharSet
;
231 extent_ad volAbstract
;
232 extent_ad volCopyright
;
234 timestamp recordingDateAndTime
;
237 Uint32 predecessorVolDescSeqLocation
;
242 /* Primary volume descriptor flags (ECMA 167 3/10.1.21) */
243 #define VOL_SET_IDENT 1
245 /* Anchor Volume Descriptor Pointer (ECMA 167 3/10.2) */
246 struct AnchorVolDescPtr
{
248 extent_ad mainVolDescSeqExt
;
249 extent_ad reserveVolDescSeqExt
;
253 /* Volume Descriptor Pointer (ECMA 167 3/10.3) */
256 Uint32 volDescSeqNum
;
257 extent_ad nextVolDescSeqExt
;
261 /* Implementation Use Volume Descriptor (ECMA 167 3/10.4) */
262 struct ImpUseVolDesc
{
264 Uint32 volDescSeqNum
;
269 /* Partition Descriptor (ECMA 167 3/10.5) */
270 struct PartitionDesc
{
272 Uint32 volDescSeqNum
;
273 Uint16 partitionFlags
;
274 Uint16 partitionNumber
;
275 EntityID partitionContents
;
276 Uint8 partitionContentsUse
[128];
278 Uint32 partitionStartingLocation
;
279 Uint32 partitionLength
;
285 /* Partition Flags (ECMA 167 3/10.5.3) */
286 #define PARTITION_FLAGS_ALLOC 1
288 /* Partition Contents (ECMA 167 3/10.5.5) */
289 #define PARTITION_CONTENTS_FDC01 "+FDC01"
290 #define PARTITION_CONTENTS_CD001 "+CD001"
291 #define PARTITION_CONTENTS_CDW02 "+CDW02"
292 #define PARTITION_CONTENTS_NSR02 "+NSR02"
293 #define PARTITION_CONTENTS_NSR03 "+NSR03"
295 /* Partition Access Types (ECMA 167 3/10.5.7) */
296 #define PARTITION_ACCESS_NONE 0
297 #define PARTITION_ACCESS_R 1
298 #define PARTITION_ACCESS_WO 2
299 #define PARTITION_ACCESS_RW 3
300 #define PARTITION_ACCESS_OW 4
302 /* Logical Volume Descriptor (ECMA 167 3/10.6) */
303 struct LogicalVolDesc
{
305 Uint32 volDescSeqNum
;
306 charspec descCharSet
;
307 dstring logicalVolIdent
[128];
308 Uint32 logicalBlockSize
;
309 EntityID domainIdent
;
310 Uint8 logicalVolContentsUse
[16]; /* used to find fileset */
311 Uint32 mapTableLength
;
312 Uint32 numPartitionMaps
;
315 extent_ad integritySeqExt
;
316 Uint8 partitionMaps
[0];
319 /* Generic Partition Map (ECMA 167 3/10.7.1) */
320 struct GenericPartitionMap
{
321 Uint8 partitionMapType
;
322 Uint8 partitionMapLength
;
323 Uint8 partitionMapping
[0];
326 /* Partition Map Type (ECMA 167 3/10.7.1.1) */
327 #define PARTITION_MAP_TYPE_NONE 0
328 #define PARTITION_MAP_TYPE_1 1
329 #define PARTITION_MAP_TYPE_2 2
331 /* Type 1 Partition Map (ECMA 167 3/10.7.2) */
332 struct GenericPartitionMap1
{
333 Uint8 partitionMapType
;
334 Uint8 partitionMapLength
;
339 /* Type 2 Partition Map (ECMA 167 3/10.7.3) */
340 struct GenericPartitionMap2
{
341 Uint8 partitionMapType
; /* 2 */
342 Uint8 partitionMapLength
;
343 Uint8 partitionIdent
[62];
346 /* Unallocated Space Descriptor (ECMA 167 3/10.8) */
347 struct UnallocatedSpaceDesc
{
349 Uint32 volDescSeqNum
;
350 Uint32 numAllocDescs
;
351 extent_ad allocDescs
[0];
354 /* Terminating Descriptor (ECMA 3/10.9) */
355 struct TerminatingDesc
{
363 Uint32 volDescSeqNum
;
366 /* Logical Volume Integrity Descriptor (ECMA 167 3/10.10) */
367 struct LogicalVolIntegrityDesc
{
369 timestamp recordingDateAndTime
;
370 Uint32 integrityType
;
371 extent_ad nextIntegrityExt
;
372 Uint8 logicalVolContentsUse
[32];
373 Uint32 numOfPartitions
;
374 Uint32 lengthOfImpUse
;
375 Uint32 freeSpaceTable
[0];
380 /* Integrity Types (ECMA 167 3/10.10.3) */
381 #define INTEGRITY_TYPE_OPEN 0
382 #define INTEGRITY_TYPE_CLOSE 1
384 /* Recorded Address (ECMA 167 4/7.1) */
386 Uint32 logicalBlockNum
;
387 Uint16 partitionReferenceNum
;
390 /* Extent interpretation (ECMA 167 4/14.14.1.1) */
391 #define EXTENT_RECORDED_ALLOCATED 0x00
392 #define EXTENT_NOT_RECORDED_ALLOCATED 0x01
393 #define EXTENT_NOT_RECORDED_NOT_ALLOCATED 0x02
394 #define EXTENT_NEXT_EXTENT_ALLOCDECS 0x03
396 /* Long Allocation Descriptor (ECMA 167 4/14.14.2) */
402 /* upper 2 bits of extLength indicate type */
404 /* File Set Descriptor (ECMA 167 4/14.1) */
407 timestamp recordingDateAndTime
;
408 Uint16 interchangeLvl
;
409 Uint16 maxInterchangeLvl
;
411 Uint32 maxCharSetList
;
413 Uint32 fileSetDescNum
;
414 charspec logicalVolIdentCharSet
;
415 dstring logicalVolIdent
[128];
416 charspec fileSetCharSet
;
417 dstring fileSetIdent
[32];
418 dstring copyrightFileIdent
[32];
419 dstring abstractFileIdent
[32];
420 long_ad rootDirectoryICB
;
421 EntityID domainIdent
;
423 long_ad streamDirectoryICB
;
427 /* Short Allocation Descriptor (ECMA 167 4/14.14.1) */
433 /* Partition Header Descriptor (ECMA 167 4/14.3) */
434 struct PartitionHeaderDesc
{
435 short_ad unallocatedSpaceTable
;
436 short_ad unallocatedSpaceBitmap
;
437 short_ad partitionIntegrityTable
;
438 short_ad freedSpaceTable
;
439 short_ad freedSpaceBitmap
;
443 /* File Identifier Descriptor (ECMA 167 4/14.4) */
447 Uint16 fileVersionNum
; /* 1 */
448 Uint8 fileCharacteristics
;
449 Uint8 lengthFileIdent
;
451 Uint16 lengthOfImpUse
;
457 /* File Characteristics (ECMA 167 4/14.4.3) */
458 #define FILE_HIDDEN 1
459 #define FILE_DIRECTORY 2
460 #define FILE_DELETED 4
461 #define FILE_PARENT 8
462 #define FILE_METADATA 0x10 /* UDF 2.0 */
464 /* Allocation Ext Descriptor (ECMA 167 4/14.5) */
468 Uint32 previousAllocExtLocation
;
469 Uint32 lengthAllocDescs
;
472 /* ICB Tag (ECMA 167 4/14.6) */
474 Uint32 priorRecordedNumDirectEntries
;
476 Uint16 strategyParameter
;
480 lb_addr parentICBLocation
;
484 /* ICB File Type (ECMA 167 4/14.6.6) */
485 #define FILE_TYPE_NONE 0x00U
486 #define FILE_TYPE_UNALLOC 0x01U
487 #define FILE_TYPE_INTEGRITY 0x02U
488 #define FILE_TYPE_INDIRECT 0x03U
489 #define FILE_TYPE_DIRECTORY 0x04U
490 #define FILE_TYPE_REGULAR 0x05U
491 #define FILE_TYPE_BLOCK 0x06U
492 #define FILE_TYPE_CHAR 0x07U
493 #define FILE_TYPE_EXTENDED 0x08U
494 #define FILE_TYPE_FIFO 0x09U
495 #define FILE_TYPE_SOCKET 0x0aU
496 #define FILE_TYPE_TERMINAL 0x0bU
497 #define FILE_TYPE_SYMLINK 0x0cU
498 #define FILE_TYPE_STREAMDIR 0x0dU /* ECMA 167 4/13 */
500 /* ICB Flags (ECMA 167 4/14.6.8) */
501 #define ICB_FLAG_ALLOC_MASK 0x0007U
502 #define ICB_FLAG_SORTED 0x0008U
503 #define ICB_FLAG_NONRELOCATABLE 0x0010U
504 #define ICB_FLAG_ARCHIVE 0x0020U
505 #define ICB_FLAG_SETUID 0x0040U
506 #define ICB_FLAG_SETGID 0x0080U
507 #define ICB_FLAG_STICKY 0x0100U
508 #define ICB_FLAG_CONTIGUOUS 0x0200U
509 #define ICB_FLAG_SYSTEM 0x0400U
510 #define ICB_FLAG_TRANSFORMED 0x0800U
511 #define ICB_FLAG_MULTIVERSIONS 0x1000U
513 /* ICB Flags Allocation type(ECMA 167 4/14.6.8) */
514 #define ICB_FLAG_AD_SHORT 0
515 #define ICB_FLAG_AD_LONG 1
516 #define ICB_FLAG_AD_EXTENDED 2
517 #define ICB_FLAG_AD_IN_ICB 3
519 /* Indirect Entry (ECMA 167 4/14.7) */
520 struct IndirectEntry
{
526 /* Terminal Entry (ECMA 167 4/14.8) */
527 struct TerminalEntry
{
532 /* File Entry (ECMA 167 4/14.9) */
539 Uint16 fileLinkCount
;
541 Uint8 recordDisplayAttr
;
543 Uint64 informationLength
;
544 Uint64 logicalBlocksRecorded
;
545 timestamp accessTime
;
546 timestamp modificationTime
;
549 long_ad extendedAttrICB
;
551 Uint64 uniqueID
; /* 0= root, 16- (2^32-1) */
552 Uint32 lengthExtendedAttr
;
553 Uint32 lengthAllocDescs
;
554 Uint8 extendedAttr
[0];
558 /* File Permissions (ECMA 167 4/14.9.5) */
559 #define PERM_O_EXEC 0x00000001U
560 #define PERM_O_WRITE 0x00000002U
561 #define PERM_O_READ 0x00000004U
562 #define PERM_O_CHATTR 0x00000008U
563 #define PERM_O_DELETE 0x00000010U
564 #define PERM_G_EXEC 0x00000020U
565 #define PERM_G_WRITE 0x00000040U
566 #define PERM_G_READ 0x00000080U
567 #define PERM_G_CHATTR 0x00000100U
568 #define PERM_G_DELETE 0x00000200U
569 #define PERM_U_EXEC 0x00000400U
570 #define PERM_U_WRITE 0x00000800U
571 #define PERM_U_READ 0x00001000U
572 #define PERM_U_CHATTR 0x00002000U
573 #define PERM_U_DELETE 0x00004000U
575 /* File Record Format (ECMA 167 4/14.9.7) */
576 #define RECORD_FMT_NONE 0
577 #define RECORD_FMT_FIXED_PAD 1
578 #define RECORD_FMT_FIXED 2
579 #define RECORD_FMT_VARIABLE8 3
580 #define RECORD_FMT_VARIABLE16 4
581 #define RECORD_FMT_VARIABLE16_MSB 5
582 #define RECORD_FMT_VARIABLE32 6
583 #define RECORD_FMT_PRINT 7
584 #define RECORD_FMT_LF 8
585 #define RECORD_FMT_CR 9
586 #define RECORD_FMT_CRLF 10
587 #define RECORD_FMT_LFCR 10
589 /* Extended Attribute Header Descriptor (ECMA 167 4/14.10.1) */
590 struct ExtendedAttrHeaderDesc
{
592 Uint32 impAttrLocation
;
593 Uint32 appAttrLocation
;
596 /* Generic Attribute Format (ECMA 4/14.10.2) */
597 struct GenericAttrFormat
{
605 /* Character Set Attribute Format (ECMA 4/14.10.3) */
606 struct CharSetAttrFormat
{
607 Uint32 attrType
; /* 1 */
608 Uint8 attrSubtype
; /* 1 */
611 Uint32 escapeSeqLength
;
616 /* Alternate Permissions (ECMA 167 4/14.10.4) */
617 struct AlternatePermissionsExtendedAttr
{
618 Uint32 attrType
; /* 3 */
619 Uint8 attrSubtype
; /* 1 */
627 /* File Times Extended Attribute (ECMA 167 4/14.10.5) */
628 struct FileTimesExtendedAttr
{
629 Uint32 attrType
; /* 5 */
630 Uint8 attrSubtype
; /* 1 */
634 Uint32 fileTimeExistence
;
638 /* FileTimeExistence (ECMA 167 4/14.10.5.6) */
639 #define FTE_CREATION 0
640 #define FTE_DELETION 2
641 #define FTE_EFFECTIVE 3
644 /* Information Times Extended Attribute (ECMA 167 4/14.10.6) */
645 struct InfoTimesExtendedAttr
{
646 Uint32 attrType
; /* 6 */
647 Uint8 attrSubtype
; /* 1 */
651 Uint32 infoTimeExistence
;
655 /* Device Specification Extended Attribute (ECMA 167 4/14.10.7) */
656 struct DeviceSpecificationExtendedAttr
{
657 Uint32 attrType
; /* 12 */
658 Uint8 attrSubtype
; /* 1 */
662 Uint32 majorDeviceIdent
;
663 Uint32 minorDeviceIdent
;
667 /* Implementation Use Extended Attr (ECMA 167 4/14.10.8) */
668 struct ImpUseExtendedAttr
{
669 Uint32 attrType
; /* 2048 */
670 Uint8 attrSubtype
; /* 1 */
678 /* Application Use Extended Attribute (ECMA 167 4/14.10.9) */
679 struct AppUseExtendedAttr
{
680 Uint32 attrType
; /* 65536 */
681 Uint8 attrSubtype
; /* 1 */
689 #define EXTATTR_CHAR_SET 1
690 #define EXTATTR_ALT_PERMS 3
691 #define EXTATTR_FILE_TIMES 5
692 #define EXTATTR_INFO_TIMES 6
693 #define EXTATTR_DEV_SPEC 12
694 #define EXTATTR_IMP_USE 2048
695 #define EXTATTR_APP_USE 65536
698 /* Unallocated Space Entry (ECMA 167 4/14.11) */
699 struct UnallocatedSpaceEntry
{
702 Uint32 lengthAllocDescs
;
706 /* Space Bitmap Descriptor (ECMA 167 4/14.12) */
707 struct SpaceBitmapDesc
{
714 /* Partition Integrity Entry (ECMA 167 4/14.13) */
715 struct PartitionIntegrityEntry
{
718 timestamp recordingDateAndTime
;
725 /* Extended Allocation Descriptor (ECMA 167 4/14.14.3) */
726 typedef struct { /* ECMA 167 4/14.14.3 */
728 Uint32 recordedLength
;
729 Uint32 informationLength
;
733 /* Logical Volume Header Descriptor (ECMA 167 4/14.5) */
734 struct LogicalVolHeaderDesc
{
739 /* Path Component (ECMA 167 4/14.16.1) */
740 struct PathComponent
{
742 Uint8 lengthComponentIdent
;
743 Uint16 componentFileVersionNum
;
744 dstring componentIdent
[0];
747 /* File Entry (ECMA 167 4/14.17) */
748 struct ExtendedFileEntry
{
754 Uint16 fileLinkCount
;
756 Uint8 recordDisplayAttr
;
758 Uint64 informationLength
;
760 Uint64 logicalBlocksRecorded
;
761 timestamp accessTime
;
762 timestamp modificationTime
;
763 timestamp createTime
;
767 long_ad extendedAttrICB
;
768 long_ad streamDirectoryICB
;
771 Uint32 lengthExtendedAttr
;
772 Uint32 lengthAllocDescs
;
773 Uint8 extendedAttr
[0];
778 #endif /* !defined(_LINUX_UDF_167_H) */