#if !defined(_LINUX_UDF_167_H)
#define _LINUX_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):
 * [email protected]
 *
 * 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.
 */#ifdef __KERNEL__
#include <linux/types.h>
#define Uint8 __u8
#define Sint8 __s8
#define Uint16 __u16
#define Sint16 __s16
#define Uint32 __u32
#define Sint32 __s32
#define Uint64 __u64
#define Sint64 __s64
typedef Uint8 dstring;
#else
#define Uint8 unsigned char
#define Sint8 char
#define Uint16 unsigned short
#define Sint16 short
#define Uint32 unsigned int
#define Sint32 int
#define Uint64 __int64
#define Sint64 long long
typedef Uint8 dstring;
#endif/* make sure all structures are packed! */
#pragma pack(1)/* CS0 Charspec (ECMA 167 1/7.2.1) */
typedef struct {
Uint8 charSetType;
Uint8 charSetInfo[63];
} charspec;/* Timestamp (ECMA 167 1/7.3) */
typedef struct {
Uint16 typeAndTimezone;
Uint16 year;
Uint8 month;
Uint8 day;
Uint8 hour;
Uint8 minute;
Uint8 second;
Uint8 centiseconds;
Uint8 hundredsOfMicroseconds;
Uint8 microseconds;
} 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;
Uint8 ident[23];
Uint8 identSuffix[8];
} 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;
Uint8 stdIdent[STD_ID_LEN];
Uint8 structVersion;
Uint8 structData[2041];
};/* 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;
Uint8 stdIdent[STD_ID_LEN];
Uint8 structVersion;
Uint8 structData[2041];
};/* Terminating Extended Area Descriptor (ECMA 167 2/9.3) */
struct TerminatingExtendedAreaDesc {
Uint8 structType;
Uint8 stdIdent[STD_ID_LEN];
Uint8 structVersion;
Uint8 structData[2041];
};/* Boot Descriptor (ECMA 167 2/9.4) */
struct BootDesc {
Uint8 structType;
Uint8 stdIdent[STD_ID_LEN];
Uint8 structVersion;
Uint8 reserved1;
EntityID architectureType;
EntityID bootIdent;
Uint32 bootExtLocation;
Uint32 bootExtLength;
Uint64 loadAddress;
Uint64 startAddress;
timestamp descCreationDateAndTime;
Uint16 flags;
Uint8 reserved2[32];
Uint8 bootUse[1906];
};/* Boot flags (ECMA 167 2/9.4.12) */
#define BOOT_FLAGS_ERASE 1/* Extent Descriptor (ECMA 167 3/7.1) */
typedef struct {
Uint32 extLength;
Uint32 extLocation;
} extent_ad;/* Descriptor Tag (ECMA 167 3/7.2) */
typedef struct {
Uint16 tagIdent;
Uint16 descVersion;
Uint8 tagChecksum;
Uint8 reserved;
Uint16 tagSerialNum;
Uint16 descCRC;
Uint16 descCRCLength;
Uint32 tagLocation;
} 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;
Uint8 stdIdent[STD_ID_LEN];
Uint8 structVersion;
Uint8 reserved;
Uint8 structData[2040];
};

/* Primary Volume Descriptor (ECMA 167 3/10.1) */
struct PrimaryVolDesc {
tag descTag;
Uint32 volDescSeqNum;
Uint32 primaryVolDescNum;
dstring volIdent[32];
Uint16 volSeqNum;
Uint16 maxVolSeqNum;
Uint16 interchangeLvl;
Uint16 maxInterchangeLvl;
Uint32 charSetList;
Uint32 maxCharSetList;
dstring volSetIdent[128];
charspec descCharSet;
charspec explanatoryCharSet;
extent_ad volAbstract;
extent_ad volCopyright;
EntityID appIdent;
timestamp recordingDateAndTime;
EntityID impIdent;
Uint8 impUse[0];
Uint32 predecessorVolDescSeqLocation;
Uint16 flags;
Uint8 reserved[22];
};