📄 udf_167.h
字号:
#if !defined(_UDF_167_H)
#define _UDF_167_H
/*
* udf_167.h
*
* DESCRIPTION
* Definitions from the ECMA 167 standard.
* http://www.ecma.ch/
*
* These abbreviations are used to keep the symbols short:
* Alloc Allocation
* App Application
* Attr Attribute
* Char Characters
* Desc Descriptor
* Descs Descriptors
* Ext Extent
* Ident Identifier
* Imp Implementation
* Lvl Level
* Max Maximum
* Num Number
* Ptr Pointer
* Seq Sequence
* Std Standard
* Struct Structure
* Vol Volume
* The symbols are otherwise identical to the standard, and the
* sections of the standard to refer to are indicated.
*
* CONTACTS
* E-mail regarding any portion of the Linux UDF file system should be
* directed to the development team mailing list (run by majordomo):
* linux_udf@hootie.lvld.hp.com
*
* COPYRIGHT
* This file is distributed under the terms of the GNU General Public
* License (GPL). Copies of the GPL can be obtained from:
* ftp://prep.ai.mit.edu/pub/gnu/GPL
* Each contributing author retains all rights to their own work.
*
* HISTORY
* July 12, 1997 - Andrew E. Mileski
* Adapted from the ECMA-167 standard.
*
* 10/2/98 dgb Adaptation
* 10/4/98 Changes by HJA Sandkuyl
* 10/7/98 Changed FILE_EXISTENCE to FILE_HIDDEN, per UDF 2.0 spec
* 11/26/98 Modifed some entries for UDF 1.5/2.0
* 11/26/98 bf Fixed typos, non-linux types, more structures
* 12/5/98 dgb Adjusted structure and content of include files.
*/
#include "types.h"
typedef UINT8 dstring;
/* make sure all structures are packed! */
/* CS0 Charspec (ECMA 167 1/7.2.1) */
typedef struct {
UINT8 charSetType __attribute__ ((packed));
UINT8 charSetInfo[63] __attribute__ ((packed));
} charspec;
/* Timestamp (ECMA 167 1/7.3) */
typedef struct {
UINT16 typeAndTimezone __attribute__ ((packed));
UINT16 year __attribute__ ((packed));
UINT8 month __attribute__ ((packed));
UINT8 day __attribute__ ((packed));
UINT8 hour __attribute__ ((packed));
UINT8 minute __attribute__ ((packed));
UINT8 second __attribute__ ((packed));
UINT8 centiseconds __attribute__ ((packed));
UINT8 hundredsOfMicroseconds __attribute__ ((packed));
UINT8 microseconds __attribute__ ((packed));
} timestamp;
/* Timestamp types (ECMA 167 1/7.3.1) */
#define TIMESTAMP_TYPE_CUT 0x0000U
#define TIMESTAMP_TYPE_LOCAL 0x0001U
#define TIMESTAMP_TYPE_AGREEMENT 0x0002U
/* Entity Identifier (ECMA 167 1/7.4) */
typedef struct {
UINT8 flags __attribute__ ((packed));
UINT8 ident[23] __attribute__ ((packed));
UINT8 identSuffix[8] __attribute__ ((packed));
} EntityID;
#define regid EntityID
/* Entity identifier flags (ECMA 167 1/7.4.1) */
#define ENTITYID_FLAGS_DIRTY 0x01U
#define ENTITYID_FLAGS_PROTECTED 0x02U
/* Volume Structure Descriptor (ECMA 167 2/9.1) */
#define STD_ID_LEN 5
struct VolStructDesc {
UINT8 structType __attribute__ ((packed));
UINT8 stdIdent[STD_ID_LEN] __attribute__ ((packed));
UINT8 structVersion __attribute__ ((packed));
UINT8 structData[2041] __attribute__ ((packed));
};
/* Std structure identifiers (ECMA 167 2/9.1.2) */
#define STD_ID_BEA01 "BEA01"
#define STD_ID_BOOT2 "BOOT2"
#define STD_ID_CD001 "CD001"
#define STD_ID_CDW02 "CDW02"
#define STD_ID_NSR02 "NSR02"
#define STD_ID_NSR03 "NSR03"
#define STD_ID_TEA01 "TEA01"
/* Beginning Extended Area Descriptor (ECMA 167 2/9.2) */
struct BeginningExtendedAreaDesc {
UINT8 structType __attribute__ ((packed));
UINT8 stdIdent[STD_ID_LEN] __attribute__ ((packed));
UINT8 structVersion __attribute__ ((packed));
UINT8 structData[2041] __attribute__ ((packed));
};
/* Terminating Extended Area Descriptor (ECMA 167 2/9.3) */
struct TerminatingExtendedAreaDesc {
UINT8 structType __attribute__ ((packed));
UINT8 stdIdent[STD_ID_LEN] __attribute__ ((packed));
UINT8 structVersion __attribute__ ((packed));
UINT8 structData[2041] __attribute__ ((packed));
};
/* Boot Descriptor (ECMA 167 2/9.4) */
struct BootDesc {
UINT8 structType __attribute__ ((packed));
UINT8 stdIdent[STD_ID_LEN] __attribute__ ((packed));
UINT8 structVersion __attribute__ ((packed));
UINT8 reserved1 __attribute__ ((packed));
EntityID architectureType __attribute__ ((packed));
EntityID bootIdent __attribute__ ((packed));
UINT32 bootExtLocation __attribute__ ((packed));
UINT32 bootExtLength __attribute__ ((packed));
UINT8 loadAddress[8] __attribute__ ((packed));
UINT8 startAddress[8] __attribute__ ((packed));
timestamp descCreationDateAndTime __attribute__ ((packed));
UINT16 flags __attribute__ ((packed));
UINT8 reserved2[32] __attribute__ ((packed));
UINT8 bootUse[1906] __attribute__ ((packed));
};
/* Boot flags (ECMA 167 2/9.4.12) */
#define BOOT_FLAGS_ERASE 1
/* Extent Descriptor (ECMA 167 3/7.1) */
typedef struct {
UINT32 extLength __attribute__ ((packed));
UINT32 extLocation __attribute__ ((packed));
} extent_ad;
/* Descriptor Tag (ECMA 167 3/7.2) */
typedef struct {
UINT16 tagIdent __attribute__ ((packed));
UINT16 descVersion __attribute__ ((packed));
UINT8 tagChecksum __attribute__ ((packed));
UINT8 reserved __attribute__ ((packed));
UINT16 tagSerialNum __attribute__ ((packed));
UINT16 descCRC __attribute__ ((packed));
UINT16 descCRCLength __attribute__ ((packed));
UINT32 tagLocation __attribute__ ((packed));
} tag;
/* Tag Identifiers (ECMA 167 3/7.2.1) */
#define TID_UNUSED_DESC 0x0000U
#define TID_PRIMARY_VOL_DESC 0x0001U
#define TID_ANCHOR_VOL_DESC_PTR 0x0002U
#define TID_VOL_DESC_PTR 0x0003U
#define TID_IMP_USE_VOL_DESC 0x0004U
#define TID_PARTITION_DESC 0x0005U
#define TID_LOGICAL_VOL_DESC 0x0006U
#define TID_UNALLOC_SPACE_DESC 0x0007U
#define TID_TERMINATING_DESC 0x0008U
#define TID_LOGICAL_VOL_INTEGRITY_DESC 0x0009U
/* Tag Identifiers (ECMA 167 4/7.2.1) */
#define TID_FILE_SET_DESC 0x0100U
#define TID_FILE_IDENT_DESC 0x0101U
#define TID_ALLOC_EXTENT_DESC 0x0102U
#define TID_INDIRECT_ENTRY 0x0103U
#define TID_TERMINAL_ENTRY 0x0104U
#define TID_FILE_ENTRY 0x0105U
#define TID_EXTENDED_ATTRE_HEADER_DESC 0x0106U
#define TID_UNALLOCATED_SPACE_ENTRY 0x0107U
#define TID_SPACE_BITMAP_DESC 0x0108U
#define TID_PARTITION_INTEGRITY_ENTRY 0x0109U
#define TID_EXTENDED_FILE_ENTRY 0x010AU
/* NSR Descriptor (ECMA 167 3/9.1) */
struct NSRDesc {
UINT8 structType __attribute__ ((packed));
UINT8 stdIdent[STD_ID_LEN] __attribute__ ((packed));
UINT8 structVersion __attribute__ ((packed));
UINT8 reserved __attribute__ ((packed));
UINT8 structData[2040] __attribute__ ((packed));
};
/* Primary Volume Descriptor (ECMA 167 3/10.1) */
struct PrimaryVolDesc {
tag descTag __attribute__ ((packed));
UINT32 volDescSeqNum __attribute__ ((packed));
UINT32 primaryVolDescNum __attribute__ ((packed));
dstring volIdent[32] __attribute__ ((packed));
UINT16 volSeqNum __attribute__ ((packed));
UINT16 maxVolSeqNum __attribute__ ((packed));
UINT16 interchangeLvl __attribute__ ((packed));
UINT16 maxInterchangeLvl __attribute__ ((packed));
UINT32 charSetList __attribute__ ((packed));
UINT32 maxCharSetList __attribute__ ((packed));
dstring volSetIdent[128] __attribute__ ((packed));
charspec descCharSet __attribute__ ((packed));
charspec explanatoryCharSet __attribute__ ((packed));
extent_ad volAbstract __attribute__ ((packed));
extent_ad volCopyright __attribute__ ((packed));
EntityID appIdent __attribute__ ((packed));
timestamp recordingDateAndTime __attribute__ ((packed));
EntityID impIdent __attribute__ ((packed));
UINT8 impUse[64] __attribute__ ((packed));
UINT32 predecessorVolDescSeqLocation __attribute__ ((packed));
UINT16 flags __attribute__ ((packed));
UINT8 reserved[22] __attribute__ ((packed));
};
/* Primary volume descriptor flags (ECMA 167 3/10.1.21) */
#define VOL_SET_IDENT 1
/* Anchor Volume Descriptor Pointer (ECMA 167 3/10.2) */
struct AnchorVolDescPtr {
tag descTag __attribute__ ((packed));
extent_ad mainVolDescSeqExt __attribute__ ((packed));
extent_ad reserveVolDescSeqExt __attribute__ ((packed));
UINT8 reserved[480] __attribute__ ((packed));
};
/* Volume Descriptor Pointer (ECMA 167 3/10.3) */
struct VolDescPtr {
tag descTag __attribute__ ((packed));
UINT32 volDescSeqNum __attribute__ ((packed));
extent_ad nextVolDescSeqExt __attribute__ ((packed));
UINT8 reserved[484] __attribute__ ((packed));
};
/* Implementation Use Volume Descriptor (ECMA 167 3/10.4) */
struct ImpUseVolDesc {
tag descTag __attribute__ ((packed));
UINT32 volDescSeqNum __attribute__ ((packed));
EntityID impIdent __attribute__ ((packed));
UINT8 impUse[460] __attribute__ ((packed));
};
/* Partition Descriptor (ECMA 167 3/10.5) */
struct PartitionDesc {
tag descTag __attribute__ ((packed));
UINT32 volDescSeqNum __attribute__ ((packed));
UINT16 partitionFlags __attribute__ ((packed));
UINT16 partitionNumber __attribute__ ((packed));
EntityID partitionContents __attribute__ ((packed));
UINT8 partitionContentsUse[128] __attribute__ ((packed));
UINT32 accessType __attribute__ ((packed));
UINT32 partitionStartingLocation __attribute__ ((packed));
UINT32 partitionLength __attribute__ ((packed));
EntityID impIdent __attribute__ ((packed));
UINT8 impUse[128] __attribute__ ((packed));
UINT8 reserved[156] __attribute__ ((packed));
};
/* Partition Flags (ECMA 167 3/10.5.3) */
#define PARTITION_FLAGS_ALLOC 1
/* Partition Contents (ECMA 167 3/10.5.5) */
#define PARTITION_CONTENTS_FDC01 "+FDC01"
#define PARTITION_CONTENTS_CD001 "+CD001"
#define PARTITION_CONTENTS_CDW02 "+CDW02"
#define PARTITION_CONTENTS_NSR02 "+NSR02"
#define PARTITION_CONTENTS_NSR03 "+NSR03"
/* Partition Access Types (ECMA 167 3/10.5.7) */
#define PARTITION_ACCESS_NONE 0
#define PARTITION_ACCESS_R 1
#define PARTITION_ACCESS_WO 2
#define PARTITION_ACCESS_RW 3
#define PARTITION_ACCESS_OW 4
/* Logical Volume Descriptor (ECMA 167 3/10.6) */
struct LogicalVolDesc {
tag descTag __attribute__ ((packed));
UINT32 volDescSeqNum __attribute__ ((packed));
charspec descCharSet __attribute__ ((packed));
dstring logicalVolIdent[128] __attribute__ ((packed));
UINT32 logicalBlockSize __attribute__ ((packed));
EntityID domainIdent __attribute__ ((packed));
UINT8 logicalVolContentsUse[16] __attribute__ ((packed)); /* used to find fileset */
UINT32 mapTableLength __attribute__ ((packed));
UINT32 numPartitionMaps __attribute__ ((packed));
EntityID impIdent __attribute__ ((packed));
UINT8 impUse[128] __attribute__ ((packed));
extent_ad integritySeqExt __attribute__ ((packed));
};
/* Generic Partition Map (ECMA 167 3/10.7.1) */
struct GenericPartitionMap {
UINT8 partitionMapType __attribute__ ((packed));
UINT8 partitionMapLength __attribute__ ((packed));
};
/* Partition Map Type (ECMA 167 3/10.7.1.1) */
#define PARTITION_MAP_TYPE_NONE 0
#define PARTITION_MAP_TYPE_1 1
#define PARTITION_MAP_TYPE_2 2
/* Type 1 Partition Map (ECMA 167 3/10.7.2) */
struct GenericPartitionMap1 {
UINT8 partitionMapType __attribute__ ((packed));
UINT8 partitionMapLength __attribute__ ((packed));
UINT16 volSeqNum __attribute__ ((packed));
UINT16 partitionNum __attribute__ ((packed));
};
/* Type 2 Partition Map (ECMA 167 3/10.7.3) */
struct GenericPartitionMap2 {
UINT8 partitionMapType __attribute__ ((packed)); /* 2 */
UINT8 partitionMapLength __attribute__ ((packed));
UINT8 partitionIdent[62] __attribute__ ((packed));
};
/* Unallocated Space Descriptor (ECMA 167 3/10.8) */
struct UnallocatedSpaceDesc {
tag descTag __attribute__ ((packed));
UINT32 volDescSeqNum __attribute__ ((packed));
UINT32 numAllocDescs __attribute__ ((packed));
};
/* Terminating Descriptor (ECMA 3/10.9) */
struct TerminatingDesc {
tag descTag __attribute__ ((packed));
UINT8 reserved[496] __attribute__ ((packed));
};
struct GenericDesc
{
tag descTag __attribute__ ((packed));
UINT32 volDescSeqNum __attribute__ ((packed));
};
/* Logical Volume Integrity Descriptor (ECMA 167 3/10.10) */
struct LogicalVolIntegrityDesc {
tag descTag __attribute__ ((packed));
timestamp recordingDateAndTime __attribute__ ((packed));
UINT32 integrityType __attribute__ ((packed));
extent_ad nextIntegrityExt __attribute__ ((packed));
UINT8 logicalVolContentsUse[32] __attribute__ ((packed));
UINT32 numOfPartitions __attribute__ ((packed));
UINT32 lengthOfImpUse __attribute__ ((packed));
};
/* Integrity Types (ECMA 167 3/10.10.3) */
#define INTEGRITY_TYPE_OPEN 0
#define INTEGRITY_TYPE_CLOSE 1
/* Recorded Address (ECMA 167 4/7.1) */
typedef struct {
UINT32 logicalBlockNum __attribute__ ((packed));
UINT16 partitionReferenceNum __attribute__ ((packed));
} lb_addr;
/* Extent interpretation (ECMA 167 4/14.14.1.1) */
#define EXTENT_RECORDED_ALLOCATED 0x00
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -