18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * ecma_167.h 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * This file is based on ECMA-167 3rd edition (June 1997) 58c2ecf20Sopenharmony_ci * https://www.ecma.ch 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Copyright (c) 2001-2002 Ben Fennema 88c2ecf20Sopenharmony_ci * Copyright (c) 2017-2019 Pali Rohár <pali@kernel.org> 98c2ecf20Sopenharmony_ci * All rights reserved. 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * Redistribution and use in source and binary forms, with or without 128c2ecf20Sopenharmony_ci * modification, are permitted provided that the following conditions 138c2ecf20Sopenharmony_ci * are met: 148c2ecf20Sopenharmony_ci * 1. Redistributions of source code must retain the above copyright 158c2ecf20Sopenharmony_ci * notice, this list of conditions, and the following disclaimer, 168c2ecf20Sopenharmony_ci * without modification. 178c2ecf20Sopenharmony_ci * 2. The name of the author may not be used to endorse or promote products 188c2ecf20Sopenharmony_ci * derived from this software without specific prior written permission. 198c2ecf20Sopenharmony_ci * 208c2ecf20Sopenharmony_ci * Alternatively, this software may be distributed under the terms of the 218c2ecf20Sopenharmony_ci * GNU Public License ("GPL"). 228c2ecf20Sopenharmony_ci * 238c2ecf20Sopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 248c2ecf20Sopenharmony_ci * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 258c2ecf20Sopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 268c2ecf20Sopenharmony_ci * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 278c2ecf20Sopenharmony_ci * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 288c2ecf20Sopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 298c2ecf20Sopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 308c2ecf20Sopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 318c2ecf20Sopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 328c2ecf20Sopenharmony_ci * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 338c2ecf20Sopenharmony_ci * SUCH DAMAGE. 348c2ecf20Sopenharmony_ci */ 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci/** 378c2ecf20Sopenharmony_ci * @file 388c2ecf20Sopenharmony_ci * ECMA-167r3 defines and structure definitions 398c2ecf20Sopenharmony_ci */ 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci#include <linux/types.h> 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#ifndef _ECMA_167_H 448c2ecf20Sopenharmony_ci#define _ECMA_167_H 1 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci/* Character sets and coding - d-characters (ECMA 167r3 1/7.2) */ 478c2ecf20Sopenharmony_citypedef uint8_t dchars; 488c2ecf20Sopenharmony_ci 498c2ecf20Sopenharmony_ci/* Character set specification (ECMA 167r3 1/7.2.1) */ 508c2ecf20Sopenharmony_cistruct charspec { 518c2ecf20Sopenharmony_ci uint8_t charSetType; 528c2ecf20Sopenharmony_ci uint8_t charSetInfo[63]; 538c2ecf20Sopenharmony_ci} __packed; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci/* Character Set Type (ECMA 167r3 1/7.2.1.1) */ 568c2ecf20Sopenharmony_ci#define CHARSPEC_TYPE_CS0 0x00 /* (1/7.2.2) */ 578c2ecf20Sopenharmony_ci#define CHARSPEC_TYPE_CS1 0x01 /* (1/7.2.3) */ 588c2ecf20Sopenharmony_ci#define CHARSPEC_TYPE_CS2 0x02 /* (1/7.2.4) */ 598c2ecf20Sopenharmony_ci#define CHARSPEC_TYPE_CS3 0x03 /* (1/7.2.5) */ 608c2ecf20Sopenharmony_ci#define CHARSPEC_TYPE_CS4 0x04 /* (1/7.2.6) */ 618c2ecf20Sopenharmony_ci#define CHARSPEC_TYPE_CS5 0x05 /* (1/7.2.7) */ 628c2ecf20Sopenharmony_ci#define CHARSPEC_TYPE_CS6 0x06 /* (1/7.2.8) */ 638c2ecf20Sopenharmony_ci#define CHARSPEC_TYPE_CS7 0x07 /* (1/7.2.9) */ 648c2ecf20Sopenharmony_ci#define CHARSPEC_TYPE_CS8 0x08 /* (1/7.2.10) */ 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci/* Fixed-length character fields - d-string (EMCA 167r3 1/7.2.12) */ 678c2ecf20Sopenharmony_citypedef uint8_t dstring; 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci/* Timestamp (ECMA 167r3 1/7.3) */ 708c2ecf20Sopenharmony_cistruct timestamp { 718c2ecf20Sopenharmony_ci __le16 typeAndTimezone; 728c2ecf20Sopenharmony_ci __le16 year; 738c2ecf20Sopenharmony_ci uint8_t month; 748c2ecf20Sopenharmony_ci uint8_t day; 758c2ecf20Sopenharmony_ci uint8_t hour; 768c2ecf20Sopenharmony_ci uint8_t minute; 778c2ecf20Sopenharmony_ci uint8_t second; 788c2ecf20Sopenharmony_ci uint8_t centiseconds; 798c2ecf20Sopenharmony_ci uint8_t hundredsOfMicroseconds; 808c2ecf20Sopenharmony_ci uint8_t microseconds; 818c2ecf20Sopenharmony_ci} __packed; 828c2ecf20Sopenharmony_ci 838c2ecf20Sopenharmony_ci/* Type and Time Zone (ECMA 167r3 1/7.3.1) */ 848c2ecf20Sopenharmony_ci#define TIMESTAMP_TYPE_MASK 0xF000 858c2ecf20Sopenharmony_ci#define TIMESTAMP_TYPE_CUT 0x0000 868c2ecf20Sopenharmony_ci#define TIMESTAMP_TYPE_LOCAL 0x1000 878c2ecf20Sopenharmony_ci#define TIMESTAMP_TYPE_AGREEMENT 0x2000 888c2ecf20Sopenharmony_ci#define TIMESTAMP_TIMEZONE_MASK 0x0FFF 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci/* Entity identifier (ECMA 167r3 1/7.4) */ 918c2ecf20Sopenharmony_cistruct regid { 928c2ecf20Sopenharmony_ci uint8_t flags; 938c2ecf20Sopenharmony_ci uint8_t ident[23]; 948c2ecf20Sopenharmony_ci uint8_t identSuffix[8]; 958c2ecf20Sopenharmony_ci} __packed; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_ci/* Flags (ECMA 167r3 1/7.4.1) */ 988c2ecf20Sopenharmony_ci#define ENTITYID_FLAGS_DIRTY 0x01 998c2ecf20Sopenharmony_ci#define ENTITYID_FLAGS_PROTECTED 0x02 1008c2ecf20Sopenharmony_ci 1018c2ecf20Sopenharmony_ci/* Volume Structure Descriptor (ECMA 167r3 2/9.1) */ 1028c2ecf20Sopenharmony_ci#define VSD_STD_ID_LEN 5 1038c2ecf20Sopenharmony_cistruct volStructDesc { 1048c2ecf20Sopenharmony_ci uint8_t structType; 1058c2ecf20Sopenharmony_ci uint8_t stdIdent[VSD_STD_ID_LEN]; 1068c2ecf20Sopenharmony_ci uint8_t structVersion; 1078c2ecf20Sopenharmony_ci uint8_t structData[2041]; 1088c2ecf20Sopenharmony_ci} __packed; 1098c2ecf20Sopenharmony_ci 1108c2ecf20Sopenharmony_ci/* Standard Identifier (EMCA 167r2 2/9.1.2) */ 1118c2ecf20Sopenharmony_ci#define VSD_STD_ID_NSR02 "NSR02" /* (3/9.1) */ 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci/* Standard Identifier (ECMA 167r3 2/9.1.2) */ 1148c2ecf20Sopenharmony_ci#define VSD_STD_ID_BEA01 "BEA01" /* (2/9.2) */ 1158c2ecf20Sopenharmony_ci#define VSD_STD_ID_BOOT2 "BOOT2" /* (2/9.4) */ 1168c2ecf20Sopenharmony_ci#define VSD_STD_ID_CD001 "CD001" /* (ECMA-119) */ 1178c2ecf20Sopenharmony_ci#define VSD_STD_ID_CDW02 "CDW02" /* (ECMA-168) */ 1188c2ecf20Sopenharmony_ci#define VSD_STD_ID_NSR03 "NSR03" /* (3/9.1) */ 1198c2ecf20Sopenharmony_ci#define VSD_STD_ID_TEA01 "TEA01" /* (2/9.3) */ 1208c2ecf20Sopenharmony_ci 1218c2ecf20Sopenharmony_ci/* Beginning Extended Area Descriptor (ECMA 167r3 2/9.2) */ 1228c2ecf20Sopenharmony_cistruct beginningExtendedAreaDesc { 1238c2ecf20Sopenharmony_ci uint8_t structType; 1248c2ecf20Sopenharmony_ci uint8_t stdIdent[VSD_STD_ID_LEN]; 1258c2ecf20Sopenharmony_ci uint8_t structVersion; 1268c2ecf20Sopenharmony_ci uint8_t structData[2041]; 1278c2ecf20Sopenharmony_ci} __packed; 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_ci/* Terminating Extended Area Descriptor (ECMA 167r3 2/9.3) */ 1308c2ecf20Sopenharmony_cistruct terminatingExtendedAreaDesc { 1318c2ecf20Sopenharmony_ci uint8_t structType; 1328c2ecf20Sopenharmony_ci uint8_t stdIdent[VSD_STD_ID_LEN]; 1338c2ecf20Sopenharmony_ci uint8_t structVersion; 1348c2ecf20Sopenharmony_ci uint8_t structData[2041]; 1358c2ecf20Sopenharmony_ci} __packed; 1368c2ecf20Sopenharmony_ci 1378c2ecf20Sopenharmony_ci/* Boot Descriptor (ECMA 167r3 2/9.4) */ 1388c2ecf20Sopenharmony_cistruct bootDesc { 1398c2ecf20Sopenharmony_ci uint8_t structType; 1408c2ecf20Sopenharmony_ci uint8_t stdIdent[VSD_STD_ID_LEN]; 1418c2ecf20Sopenharmony_ci uint8_t structVersion; 1428c2ecf20Sopenharmony_ci uint8_t reserved1; 1438c2ecf20Sopenharmony_ci struct regid archType; 1448c2ecf20Sopenharmony_ci struct regid bootIdent; 1458c2ecf20Sopenharmony_ci __le32 bootExtLocation; 1468c2ecf20Sopenharmony_ci __le32 bootExtLength; 1478c2ecf20Sopenharmony_ci __le64 loadAddress; 1488c2ecf20Sopenharmony_ci __le64 startAddress; 1498c2ecf20Sopenharmony_ci struct timestamp descCreationDateAndTime; 1508c2ecf20Sopenharmony_ci __le16 flags; 1518c2ecf20Sopenharmony_ci uint8_t reserved2[32]; 1528c2ecf20Sopenharmony_ci uint8_t bootUse[1906]; 1538c2ecf20Sopenharmony_ci} __packed; 1548c2ecf20Sopenharmony_ci 1558c2ecf20Sopenharmony_ci/* Flags (ECMA 167r3 2/9.4.12) */ 1568c2ecf20Sopenharmony_ci#define BOOT_FLAGS_ERASE 0x01 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci/* Extent Descriptor (ECMA 167r3 3/7.1) */ 1598c2ecf20Sopenharmony_cistruct extent_ad { 1608c2ecf20Sopenharmony_ci __le32 extLength; 1618c2ecf20Sopenharmony_ci __le32 extLocation; 1628c2ecf20Sopenharmony_ci} __packed; 1638c2ecf20Sopenharmony_ci 1648c2ecf20Sopenharmony_cistruct kernel_extent_ad { 1658c2ecf20Sopenharmony_ci uint32_t extLength; 1668c2ecf20Sopenharmony_ci uint32_t extLocation; 1678c2ecf20Sopenharmony_ci}; 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci/* Descriptor Tag (ECMA 167r3 3/7.2) */ 1708c2ecf20Sopenharmony_cistruct tag { 1718c2ecf20Sopenharmony_ci __le16 tagIdent; 1728c2ecf20Sopenharmony_ci __le16 descVersion; 1738c2ecf20Sopenharmony_ci uint8_t tagChecksum; 1748c2ecf20Sopenharmony_ci uint8_t reserved; 1758c2ecf20Sopenharmony_ci __le16 tagSerialNum; 1768c2ecf20Sopenharmony_ci __le16 descCRC; 1778c2ecf20Sopenharmony_ci __le16 descCRCLength; 1788c2ecf20Sopenharmony_ci __le32 tagLocation; 1798c2ecf20Sopenharmony_ci} __packed; 1808c2ecf20Sopenharmony_ci 1818c2ecf20Sopenharmony_ci/* Tag Identifier (ECMA 167r3 3/7.2.1) */ 1828c2ecf20Sopenharmony_ci#define TAG_IDENT_PVD 0x0001 1838c2ecf20Sopenharmony_ci#define TAG_IDENT_AVDP 0x0002 1848c2ecf20Sopenharmony_ci#define TAG_IDENT_VDP 0x0003 1858c2ecf20Sopenharmony_ci#define TAG_IDENT_IUVD 0x0004 1868c2ecf20Sopenharmony_ci#define TAG_IDENT_PD 0x0005 1878c2ecf20Sopenharmony_ci#define TAG_IDENT_LVD 0x0006 1888c2ecf20Sopenharmony_ci#define TAG_IDENT_USD 0x0007 1898c2ecf20Sopenharmony_ci#define TAG_IDENT_TD 0x0008 1908c2ecf20Sopenharmony_ci#define TAG_IDENT_LVID 0x0009 1918c2ecf20Sopenharmony_ci 1928c2ecf20Sopenharmony_ci/* NSR Descriptor (ECMA 167r3 3/9.1) */ 1938c2ecf20Sopenharmony_cistruct NSRDesc { 1948c2ecf20Sopenharmony_ci uint8_t structType; 1958c2ecf20Sopenharmony_ci uint8_t stdIdent[VSD_STD_ID_LEN]; 1968c2ecf20Sopenharmony_ci uint8_t structVersion; 1978c2ecf20Sopenharmony_ci uint8_t reserved; 1988c2ecf20Sopenharmony_ci uint8_t structData[2040]; 1998c2ecf20Sopenharmony_ci} __packed; 2008c2ecf20Sopenharmony_ci 2018c2ecf20Sopenharmony_ci/* Generic Descriptor */ 2028c2ecf20Sopenharmony_cistruct genericDesc { 2038c2ecf20Sopenharmony_ci struct tag descTag; 2048c2ecf20Sopenharmony_ci __le32 volDescSeqNum; 2058c2ecf20Sopenharmony_ci uint8_t reserved[492]; 2068c2ecf20Sopenharmony_ci} __packed; 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci/* Primary Volume Descriptor (ECMA 167r3 3/10.1) */ 2098c2ecf20Sopenharmony_cistruct primaryVolDesc { 2108c2ecf20Sopenharmony_ci struct tag descTag; 2118c2ecf20Sopenharmony_ci __le32 volDescSeqNum; 2128c2ecf20Sopenharmony_ci __le32 primaryVolDescNum; 2138c2ecf20Sopenharmony_ci dstring volIdent[32]; 2148c2ecf20Sopenharmony_ci __le16 volSeqNum; 2158c2ecf20Sopenharmony_ci __le16 maxVolSeqNum; 2168c2ecf20Sopenharmony_ci __le16 interchangeLvl; 2178c2ecf20Sopenharmony_ci __le16 maxInterchangeLvl; 2188c2ecf20Sopenharmony_ci __le32 charSetList; 2198c2ecf20Sopenharmony_ci __le32 maxCharSetList; 2208c2ecf20Sopenharmony_ci dstring volSetIdent[128]; 2218c2ecf20Sopenharmony_ci struct charspec descCharSet; 2228c2ecf20Sopenharmony_ci struct charspec explanatoryCharSet; 2238c2ecf20Sopenharmony_ci struct extent_ad volAbstract; 2248c2ecf20Sopenharmony_ci struct extent_ad volCopyright; 2258c2ecf20Sopenharmony_ci struct regid appIdent; 2268c2ecf20Sopenharmony_ci struct timestamp recordingDateAndTime; 2278c2ecf20Sopenharmony_ci struct regid impIdent; 2288c2ecf20Sopenharmony_ci uint8_t impUse[64]; 2298c2ecf20Sopenharmony_ci __le32 predecessorVolDescSeqLocation; 2308c2ecf20Sopenharmony_ci __le16 flags; 2318c2ecf20Sopenharmony_ci uint8_t reserved[22]; 2328c2ecf20Sopenharmony_ci} __packed; 2338c2ecf20Sopenharmony_ci 2348c2ecf20Sopenharmony_ci/* Flags (ECMA 167r3 3/10.1.21) */ 2358c2ecf20Sopenharmony_ci#define PVD_FLAGS_VSID_COMMON 0x0001 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ci/* Anchor Volume Descriptor Pointer (ECMA 167r3 3/10.2) */ 2388c2ecf20Sopenharmony_cistruct anchorVolDescPtr { 2398c2ecf20Sopenharmony_ci struct tag descTag; 2408c2ecf20Sopenharmony_ci struct extent_ad mainVolDescSeqExt; 2418c2ecf20Sopenharmony_ci struct extent_ad reserveVolDescSeqExt; 2428c2ecf20Sopenharmony_ci uint8_t reserved[480]; 2438c2ecf20Sopenharmony_ci} __packed; 2448c2ecf20Sopenharmony_ci 2458c2ecf20Sopenharmony_ci/* Volume Descriptor Pointer (ECMA 167r3 3/10.3) */ 2468c2ecf20Sopenharmony_cistruct volDescPtr { 2478c2ecf20Sopenharmony_ci struct tag descTag; 2488c2ecf20Sopenharmony_ci __le32 volDescSeqNum; 2498c2ecf20Sopenharmony_ci struct extent_ad nextVolDescSeqExt; 2508c2ecf20Sopenharmony_ci uint8_t reserved[484]; 2518c2ecf20Sopenharmony_ci} __packed; 2528c2ecf20Sopenharmony_ci 2538c2ecf20Sopenharmony_ci/* Implementation Use Volume Descriptor (ECMA 167r3 3/10.4) */ 2548c2ecf20Sopenharmony_cistruct impUseVolDesc { 2558c2ecf20Sopenharmony_ci struct tag descTag; 2568c2ecf20Sopenharmony_ci __le32 volDescSeqNum; 2578c2ecf20Sopenharmony_ci struct regid impIdent; 2588c2ecf20Sopenharmony_ci uint8_t impUse[460]; 2598c2ecf20Sopenharmony_ci} __packed; 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci/* Partition Descriptor (ECMA 167r3 3/10.5) */ 2628c2ecf20Sopenharmony_cistruct partitionDesc { 2638c2ecf20Sopenharmony_ci struct tag descTag; 2648c2ecf20Sopenharmony_ci __le32 volDescSeqNum; 2658c2ecf20Sopenharmony_ci __le16 partitionFlags; 2668c2ecf20Sopenharmony_ci __le16 partitionNumber; 2678c2ecf20Sopenharmony_ci struct regid partitionContents; 2688c2ecf20Sopenharmony_ci uint8_t partitionContentsUse[128]; 2698c2ecf20Sopenharmony_ci __le32 accessType; 2708c2ecf20Sopenharmony_ci __le32 partitionStartingLocation; 2718c2ecf20Sopenharmony_ci __le32 partitionLength; 2728c2ecf20Sopenharmony_ci struct regid impIdent; 2738c2ecf20Sopenharmony_ci uint8_t impUse[128]; 2748c2ecf20Sopenharmony_ci uint8_t reserved[156]; 2758c2ecf20Sopenharmony_ci} __packed; 2768c2ecf20Sopenharmony_ci 2778c2ecf20Sopenharmony_ci/* Partition Flags (ECMA 167r3 3/10.5.3) */ 2788c2ecf20Sopenharmony_ci#define PD_PARTITION_FLAGS_ALLOC 0x0001 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci/* Partition Contents (ECMA 167r2 3/10.5.3) */ 2818c2ecf20Sopenharmony_ci#define PD_PARTITION_CONTENTS_NSR02 "+NSR02" 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci/* Partition Contents (ECMA 167r3 3/10.5.5) */ 2848c2ecf20Sopenharmony_ci#define PD_PARTITION_CONTENTS_FDC01 "+FDC01" 2858c2ecf20Sopenharmony_ci#define PD_PARTITION_CONTENTS_CD001 "+CD001" 2868c2ecf20Sopenharmony_ci#define PD_PARTITION_CONTENTS_CDW02 "+CDW02" 2878c2ecf20Sopenharmony_ci#define PD_PARTITION_CONTENTS_NSR03 "+NSR03" 2888c2ecf20Sopenharmony_ci 2898c2ecf20Sopenharmony_ci/* Access Type (ECMA 167r3 3/10.5.7) */ 2908c2ecf20Sopenharmony_ci#define PD_ACCESS_TYPE_NONE 0x00000000 2918c2ecf20Sopenharmony_ci#define PD_ACCESS_TYPE_READ_ONLY 0x00000001 2928c2ecf20Sopenharmony_ci#define PD_ACCESS_TYPE_WRITE_ONCE 0x00000002 2938c2ecf20Sopenharmony_ci#define PD_ACCESS_TYPE_REWRITABLE 0x00000003 2948c2ecf20Sopenharmony_ci#define PD_ACCESS_TYPE_OVERWRITABLE 0x00000004 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci/* Logical Volume Descriptor (ECMA 167r3 3/10.6) */ 2978c2ecf20Sopenharmony_cistruct logicalVolDesc { 2988c2ecf20Sopenharmony_ci struct tag descTag; 2998c2ecf20Sopenharmony_ci __le32 volDescSeqNum; 3008c2ecf20Sopenharmony_ci struct charspec descCharSet; 3018c2ecf20Sopenharmony_ci dstring logicalVolIdent[128]; 3028c2ecf20Sopenharmony_ci __le32 logicalBlockSize; 3038c2ecf20Sopenharmony_ci struct regid domainIdent; 3048c2ecf20Sopenharmony_ci uint8_t logicalVolContentsUse[16]; 3058c2ecf20Sopenharmony_ci __le32 mapTableLength; 3068c2ecf20Sopenharmony_ci __le32 numPartitionMaps; 3078c2ecf20Sopenharmony_ci struct regid impIdent; 3088c2ecf20Sopenharmony_ci uint8_t impUse[128]; 3098c2ecf20Sopenharmony_ci struct extent_ad integritySeqExt; 3108c2ecf20Sopenharmony_ci uint8_t partitionMaps[0]; 3118c2ecf20Sopenharmony_ci} __packed; 3128c2ecf20Sopenharmony_ci 3138c2ecf20Sopenharmony_ci/* Generic Partition Map (ECMA 167r3 3/10.7.1) */ 3148c2ecf20Sopenharmony_cistruct genericPartitionMap { 3158c2ecf20Sopenharmony_ci uint8_t partitionMapType; 3168c2ecf20Sopenharmony_ci uint8_t partitionMapLength; 3178c2ecf20Sopenharmony_ci uint8_t partitionMapping[0]; 3188c2ecf20Sopenharmony_ci} __packed; 3198c2ecf20Sopenharmony_ci 3208c2ecf20Sopenharmony_ci/* Partition Map Type (ECMA 167r3 3/10.7.1.1) */ 3218c2ecf20Sopenharmony_ci#define GP_PARTITION_MAP_TYPE_UNDEF 0x00 3228c2ecf20Sopenharmony_ci#define GP_PARTITION_MAP_TYPE_1 0x01 3238c2ecf20Sopenharmony_ci#define GP_PARTITION_MAP_TYPE_2 0x02 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci/* Type 1 Partition Map (ECMA 167r3 3/10.7.2) */ 3268c2ecf20Sopenharmony_cistruct genericPartitionMap1 { 3278c2ecf20Sopenharmony_ci uint8_t partitionMapType; 3288c2ecf20Sopenharmony_ci uint8_t partitionMapLength; 3298c2ecf20Sopenharmony_ci __le16 volSeqNum; 3308c2ecf20Sopenharmony_ci __le16 partitionNum; 3318c2ecf20Sopenharmony_ci} __packed; 3328c2ecf20Sopenharmony_ci 3338c2ecf20Sopenharmony_ci/* Type 2 Partition Map (ECMA 167r3 3/10.7.3) */ 3348c2ecf20Sopenharmony_cistruct genericPartitionMap2 { 3358c2ecf20Sopenharmony_ci uint8_t partitionMapType; 3368c2ecf20Sopenharmony_ci uint8_t partitionMapLength; 3378c2ecf20Sopenharmony_ci uint8_t partitionIdent[62]; 3388c2ecf20Sopenharmony_ci} __packed; 3398c2ecf20Sopenharmony_ci 3408c2ecf20Sopenharmony_ci/* Unallocated Space Descriptor (ECMA 167r3 3/10.8) */ 3418c2ecf20Sopenharmony_cistruct unallocSpaceDesc { 3428c2ecf20Sopenharmony_ci struct tag descTag; 3438c2ecf20Sopenharmony_ci __le32 volDescSeqNum; 3448c2ecf20Sopenharmony_ci __le32 numAllocDescs; 3458c2ecf20Sopenharmony_ci struct extent_ad allocDescs[0]; 3468c2ecf20Sopenharmony_ci} __packed; 3478c2ecf20Sopenharmony_ci 3488c2ecf20Sopenharmony_ci/* Terminating Descriptor (ECMA 167r3 3/10.9) */ 3498c2ecf20Sopenharmony_cistruct terminatingDesc { 3508c2ecf20Sopenharmony_ci struct tag descTag; 3518c2ecf20Sopenharmony_ci uint8_t reserved[496]; 3528c2ecf20Sopenharmony_ci} __packed; 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_ci/* Logical Volume Integrity Descriptor (ECMA 167r3 3/10.10) */ 3558c2ecf20Sopenharmony_cistruct logicalVolIntegrityDesc { 3568c2ecf20Sopenharmony_ci struct tag descTag; 3578c2ecf20Sopenharmony_ci struct timestamp recordingDateAndTime; 3588c2ecf20Sopenharmony_ci __le32 integrityType; 3598c2ecf20Sopenharmony_ci struct extent_ad nextIntegrityExt; 3608c2ecf20Sopenharmony_ci uint8_t logicalVolContentsUse[32]; 3618c2ecf20Sopenharmony_ci __le32 numOfPartitions; 3628c2ecf20Sopenharmony_ci __le32 lengthOfImpUse; 3638c2ecf20Sopenharmony_ci __le32 freeSpaceTable[0]; 3648c2ecf20Sopenharmony_ci __le32 sizeTable[0]; 3658c2ecf20Sopenharmony_ci uint8_t impUse[0]; 3668c2ecf20Sopenharmony_ci} __packed; 3678c2ecf20Sopenharmony_ci 3688c2ecf20Sopenharmony_ci/* Integrity Type (ECMA 167r3 3/10.10.3) */ 3698c2ecf20Sopenharmony_ci#define LVID_INTEGRITY_TYPE_OPEN 0x00000000 3708c2ecf20Sopenharmony_ci#define LVID_INTEGRITY_TYPE_CLOSE 0x00000001 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_ci/* Recorded Address (ECMA 167r3 4/7.1) */ 3738c2ecf20Sopenharmony_cistruct lb_addr { 3748c2ecf20Sopenharmony_ci __le32 logicalBlockNum; 3758c2ecf20Sopenharmony_ci __le16 partitionReferenceNum; 3768c2ecf20Sopenharmony_ci} __packed; 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ci/* ... and its in-core analog */ 3798c2ecf20Sopenharmony_cistruct kernel_lb_addr { 3808c2ecf20Sopenharmony_ci uint32_t logicalBlockNum; 3818c2ecf20Sopenharmony_ci uint16_t partitionReferenceNum; 3828c2ecf20Sopenharmony_ci}; 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_ci/* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */ 3858c2ecf20Sopenharmony_cistruct short_ad { 3868c2ecf20Sopenharmony_ci __le32 extLength; 3878c2ecf20Sopenharmony_ci __le32 extPosition; 3888c2ecf20Sopenharmony_ci} __packed; 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_ci/* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */ 3918c2ecf20Sopenharmony_cistruct long_ad { 3928c2ecf20Sopenharmony_ci __le32 extLength; 3938c2ecf20Sopenharmony_ci struct lb_addr extLocation; 3948c2ecf20Sopenharmony_ci uint8_t impUse[6]; 3958c2ecf20Sopenharmony_ci} __packed; 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_cistruct kernel_long_ad { 3988c2ecf20Sopenharmony_ci uint32_t extLength; 3998c2ecf20Sopenharmony_ci struct kernel_lb_addr extLocation; 4008c2ecf20Sopenharmony_ci uint8_t impUse[6]; 4018c2ecf20Sopenharmony_ci}; 4028c2ecf20Sopenharmony_ci 4038c2ecf20Sopenharmony_ci/* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */ 4048c2ecf20Sopenharmony_cistruct ext_ad { 4058c2ecf20Sopenharmony_ci __le32 extLength; 4068c2ecf20Sopenharmony_ci __le32 recordedLength; 4078c2ecf20Sopenharmony_ci __le32 informationLength; 4088c2ecf20Sopenharmony_ci struct lb_addr extLocation; 4098c2ecf20Sopenharmony_ci} __packed; 4108c2ecf20Sopenharmony_ci 4118c2ecf20Sopenharmony_cistruct kernel_ext_ad { 4128c2ecf20Sopenharmony_ci uint32_t extLength; 4138c2ecf20Sopenharmony_ci uint32_t recordedLength; 4148c2ecf20Sopenharmony_ci uint32_t informationLength; 4158c2ecf20Sopenharmony_ci struct kernel_lb_addr extLocation; 4168c2ecf20Sopenharmony_ci}; 4178c2ecf20Sopenharmony_ci 4188c2ecf20Sopenharmony_ci/* Descriptor Tag (ECMA 167r3 4/7.2 - See 3/7.2) */ 4198c2ecf20Sopenharmony_ci 4208c2ecf20Sopenharmony_ci/* Tag Identifier (ECMA 167r3 4/7.2.1) */ 4218c2ecf20Sopenharmony_ci#define TAG_IDENT_FSD 0x0100 4228c2ecf20Sopenharmony_ci#define TAG_IDENT_FID 0x0101 4238c2ecf20Sopenharmony_ci#define TAG_IDENT_AED 0x0102 4248c2ecf20Sopenharmony_ci#define TAG_IDENT_IE 0x0103 4258c2ecf20Sopenharmony_ci#define TAG_IDENT_TE 0x0104 4268c2ecf20Sopenharmony_ci#define TAG_IDENT_FE 0x0105 4278c2ecf20Sopenharmony_ci#define TAG_IDENT_EAHD 0x0106 4288c2ecf20Sopenharmony_ci#define TAG_IDENT_USE 0x0107 4298c2ecf20Sopenharmony_ci#define TAG_IDENT_SBD 0x0108 4308c2ecf20Sopenharmony_ci#define TAG_IDENT_PIE 0x0109 4318c2ecf20Sopenharmony_ci#define TAG_IDENT_EFE 0x010A 4328c2ecf20Sopenharmony_ci 4338c2ecf20Sopenharmony_ci/* File Set Descriptor (ECMA 167r3 4/14.1) */ 4348c2ecf20Sopenharmony_cistruct fileSetDesc { 4358c2ecf20Sopenharmony_ci struct tag descTag; 4368c2ecf20Sopenharmony_ci struct timestamp recordingDateAndTime; 4378c2ecf20Sopenharmony_ci __le16 interchangeLvl; 4388c2ecf20Sopenharmony_ci __le16 maxInterchangeLvl; 4398c2ecf20Sopenharmony_ci __le32 charSetList; 4408c2ecf20Sopenharmony_ci __le32 maxCharSetList; 4418c2ecf20Sopenharmony_ci __le32 fileSetNum; 4428c2ecf20Sopenharmony_ci __le32 fileSetDescNum; 4438c2ecf20Sopenharmony_ci struct charspec logicalVolIdentCharSet; 4448c2ecf20Sopenharmony_ci dstring logicalVolIdent[128]; 4458c2ecf20Sopenharmony_ci struct charspec fileSetCharSet; 4468c2ecf20Sopenharmony_ci dstring fileSetIdent[32]; 4478c2ecf20Sopenharmony_ci dstring copyrightFileIdent[32]; 4488c2ecf20Sopenharmony_ci dstring abstractFileIdent[32]; 4498c2ecf20Sopenharmony_ci struct long_ad rootDirectoryICB; 4508c2ecf20Sopenharmony_ci struct regid domainIdent; 4518c2ecf20Sopenharmony_ci struct long_ad nextExt; 4528c2ecf20Sopenharmony_ci struct long_ad streamDirectoryICB; 4538c2ecf20Sopenharmony_ci uint8_t reserved[32]; 4548c2ecf20Sopenharmony_ci} __packed; 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_ci/* Partition Header Descriptor (ECMA 167r3 4/14.3) */ 4578c2ecf20Sopenharmony_cistruct partitionHeaderDesc { 4588c2ecf20Sopenharmony_ci struct short_ad unallocSpaceTable; 4598c2ecf20Sopenharmony_ci struct short_ad unallocSpaceBitmap; 4608c2ecf20Sopenharmony_ci struct short_ad partitionIntegrityTable; 4618c2ecf20Sopenharmony_ci struct short_ad freedSpaceTable; 4628c2ecf20Sopenharmony_ci struct short_ad freedSpaceBitmap; 4638c2ecf20Sopenharmony_ci uint8_t reserved[88]; 4648c2ecf20Sopenharmony_ci} __packed; 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_ci/* File Identifier Descriptor (ECMA 167r3 4/14.4) */ 4678c2ecf20Sopenharmony_cistruct fileIdentDesc { 4688c2ecf20Sopenharmony_ci struct tag descTag; 4698c2ecf20Sopenharmony_ci __le16 fileVersionNum; 4708c2ecf20Sopenharmony_ci uint8_t fileCharacteristics; 4718c2ecf20Sopenharmony_ci uint8_t lengthFileIdent; 4728c2ecf20Sopenharmony_ci struct long_ad icb; 4738c2ecf20Sopenharmony_ci __le16 lengthOfImpUse; 4748c2ecf20Sopenharmony_ci uint8_t impUse[0]; 4758c2ecf20Sopenharmony_ci uint8_t fileIdent[0]; 4768c2ecf20Sopenharmony_ci uint8_t padding[0]; 4778c2ecf20Sopenharmony_ci} __packed; 4788c2ecf20Sopenharmony_ci 4798c2ecf20Sopenharmony_ci/* File Characteristics (ECMA 167r3 4/14.4.3) */ 4808c2ecf20Sopenharmony_ci#define FID_FILE_CHAR_HIDDEN 0x01 4818c2ecf20Sopenharmony_ci#define FID_FILE_CHAR_DIRECTORY 0x02 4828c2ecf20Sopenharmony_ci#define FID_FILE_CHAR_DELETED 0x04 4838c2ecf20Sopenharmony_ci#define FID_FILE_CHAR_PARENT 0x08 4848c2ecf20Sopenharmony_ci#define FID_FILE_CHAR_METADATA 0x10 4858c2ecf20Sopenharmony_ci 4868c2ecf20Sopenharmony_ci/* Allocation Ext Descriptor (ECMA 167r3 4/14.5) */ 4878c2ecf20Sopenharmony_cistruct allocExtDesc { 4888c2ecf20Sopenharmony_ci struct tag descTag; 4898c2ecf20Sopenharmony_ci __le32 previousAllocExtLocation; 4908c2ecf20Sopenharmony_ci __le32 lengthAllocDescs; 4918c2ecf20Sopenharmony_ci} __packed; 4928c2ecf20Sopenharmony_ci 4938c2ecf20Sopenharmony_ci/* ICB Tag (ECMA 167r3 4/14.6) */ 4948c2ecf20Sopenharmony_cistruct icbtag { 4958c2ecf20Sopenharmony_ci __le32 priorRecordedNumDirectEntries; 4968c2ecf20Sopenharmony_ci __le16 strategyType; 4978c2ecf20Sopenharmony_ci __le16 strategyParameter; 4988c2ecf20Sopenharmony_ci __le16 numEntries; 4998c2ecf20Sopenharmony_ci uint8_t reserved; 5008c2ecf20Sopenharmony_ci uint8_t fileType; 5018c2ecf20Sopenharmony_ci struct lb_addr parentICBLocation; 5028c2ecf20Sopenharmony_ci __le16 flags; 5038c2ecf20Sopenharmony_ci} __packed; 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_ci/* Strategy Type (ECMA 167r3 4/14.6.2) */ 5068c2ecf20Sopenharmony_ci#define ICBTAG_STRATEGY_TYPE_UNDEF 0x0000 5078c2ecf20Sopenharmony_ci#define ICBTAG_STRATEGY_TYPE_1 0x0001 5088c2ecf20Sopenharmony_ci#define ICBTAG_STRATEGY_TYPE_2 0x0002 5098c2ecf20Sopenharmony_ci#define ICBTAG_STRATEGY_TYPE_3 0x0003 5108c2ecf20Sopenharmony_ci#define ICBTAG_STRATEGY_TYPE_4 0x0004 5118c2ecf20Sopenharmony_ci 5128c2ecf20Sopenharmony_ci/* File Type (ECMA 167r3 4/14.6.6) */ 5138c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_UNDEF 0x00 5148c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_USE 0x01 5158c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_PIE 0x02 5168c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_IE 0x03 5178c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_DIRECTORY 0x04 5188c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_REGULAR 0x05 5198c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_BLOCK 0x06 5208c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_CHAR 0x07 5218c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_EA 0x08 5228c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_FIFO 0x09 5238c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_SOCKET 0x0A 5248c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_TE 0x0B 5258c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_SYMLINK 0x0C 5268c2ecf20Sopenharmony_ci#define ICBTAG_FILE_TYPE_STREAMDIR 0x0D 5278c2ecf20Sopenharmony_ci 5288c2ecf20Sopenharmony_ci/* Flags (ECMA 167r3 4/14.6.8) */ 5298c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_AD_MASK 0x0007 5308c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_AD_SHORT 0x0000 5318c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_AD_LONG 0x0001 5328c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_AD_EXTENDED 0x0002 5338c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_AD_IN_ICB 0x0003 5348c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_SORTED 0x0008 5358c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_NONRELOCATABLE 0x0010 5368c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_ARCHIVE 0x0020 5378c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_SETUID 0x0040 5388c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_SETGID 0x0080 5398c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_STICKY 0x0100 5408c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_CONTIGUOUS 0x0200 5418c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_SYSTEM 0x0400 5428c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_TRANSFORMED 0x0800 5438c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_MULTIVERSIONS 0x1000 5448c2ecf20Sopenharmony_ci#define ICBTAG_FLAG_STREAM 0x2000 5458c2ecf20Sopenharmony_ci 5468c2ecf20Sopenharmony_ci/* Indirect Entry (ECMA 167r3 4/14.7) */ 5478c2ecf20Sopenharmony_cistruct indirectEntry { 5488c2ecf20Sopenharmony_ci struct tag descTag; 5498c2ecf20Sopenharmony_ci struct icbtag icbTag; 5508c2ecf20Sopenharmony_ci struct long_ad indirectICB; 5518c2ecf20Sopenharmony_ci} __packed; 5528c2ecf20Sopenharmony_ci 5538c2ecf20Sopenharmony_ci/* Terminal Entry (ECMA 167r3 4/14.8) */ 5548c2ecf20Sopenharmony_cistruct terminalEntry { 5558c2ecf20Sopenharmony_ci struct tag descTag; 5568c2ecf20Sopenharmony_ci struct icbtag icbTag; 5578c2ecf20Sopenharmony_ci} __packed; 5588c2ecf20Sopenharmony_ci 5598c2ecf20Sopenharmony_ci/* File Entry (ECMA 167r3 4/14.9) */ 5608c2ecf20Sopenharmony_cistruct fileEntry { 5618c2ecf20Sopenharmony_ci struct tag descTag; 5628c2ecf20Sopenharmony_ci struct icbtag icbTag; 5638c2ecf20Sopenharmony_ci __le32 uid; 5648c2ecf20Sopenharmony_ci __le32 gid; 5658c2ecf20Sopenharmony_ci __le32 permissions; 5668c2ecf20Sopenharmony_ci __le16 fileLinkCount; 5678c2ecf20Sopenharmony_ci uint8_t recordFormat; 5688c2ecf20Sopenharmony_ci uint8_t recordDisplayAttr; 5698c2ecf20Sopenharmony_ci __le32 recordLength; 5708c2ecf20Sopenharmony_ci __le64 informationLength; 5718c2ecf20Sopenharmony_ci __le64 logicalBlocksRecorded; 5728c2ecf20Sopenharmony_ci struct timestamp accessTime; 5738c2ecf20Sopenharmony_ci struct timestamp modificationTime; 5748c2ecf20Sopenharmony_ci struct timestamp attrTime; 5758c2ecf20Sopenharmony_ci __le32 checkpoint; 5768c2ecf20Sopenharmony_ci struct long_ad extendedAttrICB; 5778c2ecf20Sopenharmony_ci struct regid impIdent; 5788c2ecf20Sopenharmony_ci __le64 uniqueID; 5798c2ecf20Sopenharmony_ci __le32 lengthExtendedAttr; 5808c2ecf20Sopenharmony_ci __le32 lengthAllocDescs; 5818c2ecf20Sopenharmony_ci uint8_t extendedAttr[0]; 5828c2ecf20Sopenharmony_ci uint8_t allocDescs[0]; 5838c2ecf20Sopenharmony_ci} __packed; 5848c2ecf20Sopenharmony_ci 5858c2ecf20Sopenharmony_ci/* Permissions (ECMA 167r3 4/14.9.5) */ 5868c2ecf20Sopenharmony_ci#define FE_PERM_O_EXEC 0x00000001U 5878c2ecf20Sopenharmony_ci#define FE_PERM_O_WRITE 0x00000002U 5888c2ecf20Sopenharmony_ci#define FE_PERM_O_READ 0x00000004U 5898c2ecf20Sopenharmony_ci#define FE_PERM_O_CHATTR 0x00000008U 5908c2ecf20Sopenharmony_ci#define FE_PERM_O_DELETE 0x00000010U 5918c2ecf20Sopenharmony_ci#define FE_PERM_G_EXEC 0x00000020U 5928c2ecf20Sopenharmony_ci#define FE_PERM_G_WRITE 0x00000040U 5938c2ecf20Sopenharmony_ci#define FE_PERM_G_READ 0x00000080U 5948c2ecf20Sopenharmony_ci#define FE_PERM_G_CHATTR 0x00000100U 5958c2ecf20Sopenharmony_ci#define FE_PERM_G_DELETE 0x00000200U 5968c2ecf20Sopenharmony_ci#define FE_PERM_U_EXEC 0x00000400U 5978c2ecf20Sopenharmony_ci#define FE_PERM_U_WRITE 0x00000800U 5988c2ecf20Sopenharmony_ci#define FE_PERM_U_READ 0x00001000U 5998c2ecf20Sopenharmony_ci#define FE_PERM_U_CHATTR 0x00002000U 6008c2ecf20Sopenharmony_ci#define FE_PERM_U_DELETE 0x00004000U 6018c2ecf20Sopenharmony_ci 6028c2ecf20Sopenharmony_ci/* Record Format (ECMA 167r3 4/14.9.7) */ 6038c2ecf20Sopenharmony_ci#define FE_RECORD_FMT_UNDEF 0x00 6048c2ecf20Sopenharmony_ci#define FE_RECORD_FMT_FIXED_PAD 0x01 6058c2ecf20Sopenharmony_ci#define FE_RECORD_FMT_FIXED 0x02 6068c2ecf20Sopenharmony_ci#define FE_RECORD_FMT_VARIABLE8 0x03 6078c2ecf20Sopenharmony_ci#define FE_RECORD_FMT_VARIABLE16 0x04 6088c2ecf20Sopenharmony_ci#define FE_RECORD_FMT_VARIABLE16_MSB 0x05 6098c2ecf20Sopenharmony_ci#define FE_RECORD_FMT_VARIABLE32 0x06 6108c2ecf20Sopenharmony_ci#define FE_RECORD_FMT_PRINT 0x07 6118c2ecf20Sopenharmony_ci#define FE_RECORD_FMT_LF 0x08 6128c2ecf20Sopenharmony_ci#define FE_RECORD_FMT_CR 0x09 6138c2ecf20Sopenharmony_ci#define FE_RECORD_FMT_CRLF 0x0A 6148c2ecf20Sopenharmony_ci#define FE_RECORD_FMT_LFCR 0x0B 6158c2ecf20Sopenharmony_ci 6168c2ecf20Sopenharmony_ci/* Record Display Attributes (ECMA 167r3 4/14.9.8) */ 6178c2ecf20Sopenharmony_ci#define FE_RECORD_DISPLAY_ATTR_UNDEF 0x00 6188c2ecf20Sopenharmony_ci#define FE_RECORD_DISPLAY_ATTR_1 0x01 6198c2ecf20Sopenharmony_ci#define FE_RECORD_DISPLAY_ATTR_2 0x02 6208c2ecf20Sopenharmony_ci#define FE_RECORD_DISPLAY_ATTR_3 0x03 6218c2ecf20Sopenharmony_ci 6228c2ecf20Sopenharmony_ci/* Extended Attribute Header Descriptor (ECMA 167r3 4/14.10.1) */ 6238c2ecf20Sopenharmony_cistruct extendedAttrHeaderDesc { 6248c2ecf20Sopenharmony_ci struct tag descTag; 6258c2ecf20Sopenharmony_ci __le32 impAttrLocation; 6268c2ecf20Sopenharmony_ci __le32 appAttrLocation; 6278c2ecf20Sopenharmony_ci} __packed; 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_ci/* Generic Format (ECMA 167r3 4/14.10.2) */ 6308c2ecf20Sopenharmony_cistruct genericFormat { 6318c2ecf20Sopenharmony_ci __le32 attrType; 6328c2ecf20Sopenharmony_ci uint8_t attrSubtype; 6338c2ecf20Sopenharmony_ci uint8_t reserved[3]; 6348c2ecf20Sopenharmony_ci __le32 attrLength; 6358c2ecf20Sopenharmony_ci uint8_t attrData[0]; 6368c2ecf20Sopenharmony_ci} __packed; 6378c2ecf20Sopenharmony_ci 6388c2ecf20Sopenharmony_ci/* Character Set Information (ECMA 167r3 4/14.10.3) */ 6398c2ecf20Sopenharmony_cistruct charSetInfo { 6408c2ecf20Sopenharmony_ci __le32 attrType; 6418c2ecf20Sopenharmony_ci uint8_t attrSubtype; 6428c2ecf20Sopenharmony_ci uint8_t reserved[3]; 6438c2ecf20Sopenharmony_ci __le32 attrLength; 6448c2ecf20Sopenharmony_ci __le32 escapeSeqLength; 6458c2ecf20Sopenharmony_ci uint8_t charSetType; 6468c2ecf20Sopenharmony_ci uint8_t escapeSeq[0]; 6478c2ecf20Sopenharmony_ci} __packed; 6488c2ecf20Sopenharmony_ci 6498c2ecf20Sopenharmony_ci/* Alternate Permissions (ECMA 167r3 4/14.10.4) */ 6508c2ecf20Sopenharmony_cistruct altPerms { 6518c2ecf20Sopenharmony_ci __le32 attrType; 6528c2ecf20Sopenharmony_ci uint8_t attrSubtype; 6538c2ecf20Sopenharmony_ci uint8_t reserved[3]; 6548c2ecf20Sopenharmony_ci __le32 attrLength; 6558c2ecf20Sopenharmony_ci __le16 ownerIdent; 6568c2ecf20Sopenharmony_ci __le16 groupIdent; 6578c2ecf20Sopenharmony_ci __le16 permission; 6588c2ecf20Sopenharmony_ci} __packed; 6598c2ecf20Sopenharmony_ci 6608c2ecf20Sopenharmony_ci/* File Times Extended Attribute (ECMA 167r3 4/14.10.5) */ 6618c2ecf20Sopenharmony_cistruct fileTimesExtAttr { 6628c2ecf20Sopenharmony_ci __le32 attrType; 6638c2ecf20Sopenharmony_ci uint8_t attrSubtype; 6648c2ecf20Sopenharmony_ci uint8_t reserved[3]; 6658c2ecf20Sopenharmony_ci __le32 attrLength; 6668c2ecf20Sopenharmony_ci __le32 dataLength; 6678c2ecf20Sopenharmony_ci __le32 fileTimeExistence; 6688c2ecf20Sopenharmony_ci uint8_t fileTimes; 6698c2ecf20Sopenharmony_ci} __packed; 6708c2ecf20Sopenharmony_ci 6718c2ecf20Sopenharmony_ci/* FileTimeExistence (ECMA 167r3 4/14.10.5.6) */ 6728c2ecf20Sopenharmony_ci#define FTE_CREATION 0x00000001 6738c2ecf20Sopenharmony_ci#define FTE_DELETION 0x00000004 6748c2ecf20Sopenharmony_ci#define FTE_EFFECTIVE 0x00000008 6758c2ecf20Sopenharmony_ci#define FTE_BACKUP 0x00000002 6768c2ecf20Sopenharmony_ci 6778c2ecf20Sopenharmony_ci/* Information Times Extended Attribute (ECMA 167r3 4/14.10.6) */ 6788c2ecf20Sopenharmony_cistruct infoTimesExtAttr { 6798c2ecf20Sopenharmony_ci __le32 attrType; 6808c2ecf20Sopenharmony_ci uint8_t attrSubtype; 6818c2ecf20Sopenharmony_ci uint8_t reserved[3]; 6828c2ecf20Sopenharmony_ci __le32 attrLength; 6838c2ecf20Sopenharmony_ci __le32 dataLength; 6848c2ecf20Sopenharmony_ci __le32 infoTimeExistence; 6858c2ecf20Sopenharmony_ci uint8_t infoTimes[0]; 6868c2ecf20Sopenharmony_ci} __packed; 6878c2ecf20Sopenharmony_ci 6888c2ecf20Sopenharmony_ci/* Device Specification (ECMA 167r3 4/14.10.7) */ 6898c2ecf20Sopenharmony_cistruct deviceSpec { 6908c2ecf20Sopenharmony_ci __le32 attrType; 6918c2ecf20Sopenharmony_ci uint8_t attrSubtype; 6928c2ecf20Sopenharmony_ci uint8_t reserved[3]; 6938c2ecf20Sopenharmony_ci __le32 attrLength; 6948c2ecf20Sopenharmony_ci __le32 impUseLength; 6958c2ecf20Sopenharmony_ci __le32 majorDeviceIdent; 6968c2ecf20Sopenharmony_ci __le32 minorDeviceIdent; 6978c2ecf20Sopenharmony_ci uint8_t impUse[0]; 6988c2ecf20Sopenharmony_ci} __packed; 6998c2ecf20Sopenharmony_ci 7008c2ecf20Sopenharmony_ci/* Implementation Use Extended Attr (ECMA 167r3 4/14.10.8) */ 7018c2ecf20Sopenharmony_cistruct impUseExtAttr { 7028c2ecf20Sopenharmony_ci __le32 attrType; 7038c2ecf20Sopenharmony_ci uint8_t attrSubtype; 7048c2ecf20Sopenharmony_ci uint8_t reserved[3]; 7058c2ecf20Sopenharmony_ci __le32 attrLength; 7068c2ecf20Sopenharmony_ci __le32 impUseLength; 7078c2ecf20Sopenharmony_ci struct regid impIdent; 7088c2ecf20Sopenharmony_ci uint8_t impUse[0]; 7098c2ecf20Sopenharmony_ci} __packed; 7108c2ecf20Sopenharmony_ci 7118c2ecf20Sopenharmony_ci/* Application Use Extended Attribute (ECMA 167r3 4/14.10.9) */ 7128c2ecf20Sopenharmony_cistruct appUseExtAttr { 7138c2ecf20Sopenharmony_ci __le32 attrType; 7148c2ecf20Sopenharmony_ci uint8_t attrSubtype; 7158c2ecf20Sopenharmony_ci uint8_t reserved[3]; 7168c2ecf20Sopenharmony_ci __le32 attrLength; 7178c2ecf20Sopenharmony_ci __le32 appUseLength; 7188c2ecf20Sopenharmony_ci struct regid appIdent; 7198c2ecf20Sopenharmony_ci uint8_t appUse[0]; 7208c2ecf20Sopenharmony_ci} __packed; 7218c2ecf20Sopenharmony_ci 7228c2ecf20Sopenharmony_ci#define EXTATTR_CHAR_SET 1 7238c2ecf20Sopenharmony_ci#define EXTATTR_ALT_PERMS 3 7248c2ecf20Sopenharmony_ci#define EXTATTR_FILE_TIMES 5 7258c2ecf20Sopenharmony_ci#define EXTATTR_INFO_TIMES 6 7268c2ecf20Sopenharmony_ci#define EXTATTR_DEV_SPEC 12 7278c2ecf20Sopenharmony_ci#define EXTATTR_IMP_USE 2048 7288c2ecf20Sopenharmony_ci#define EXTATTR_APP_USE 65536 7298c2ecf20Sopenharmony_ci#define EXTATTR_SUBTYPE 1 7308c2ecf20Sopenharmony_ci 7318c2ecf20Sopenharmony_ci/* Unallocated Space Entry (ECMA 167r3 4/14.11) */ 7328c2ecf20Sopenharmony_cistruct unallocSpaceEntry { 7338c2ecf20Sopenharmony_ci struct tag descTag; 7348c2ecf20Sopenharmony_ci struct icbtag icbTag; 7358c2ecf20Sopenharmony_ci __le32 lengthAllocDescs; 7368c2ecf20Sopenharmony_ci uint8_t allocDescs[0]; 7378c2ecf20Sopenharmony_ci} __packed; 7388c2ecf20Sopenharmony_ci 7398c2ecf20Sopenharmony_ci/* Space Bitmap Descriptor (ECMA 167r3 4/14.12) */ 7408c2ecf20Sopenharmony_cistruct spaceBitmapDesc { 7418c2ecf20Sopenharmony_ci struct tag descTag; 7428c2ecf20Sopenharmony_ci __le32 numOfBits; 7438c2ecf20Sopenharmony_ci __le32 numOfBytes; 7448c2ecf20Sopenharmony_ci uint8_t bitmap[0]; 7458c2ecf20Sopenharmony_ci} __packed; 7468c2ecf20Sopenharmony_ci 7478c2ecf20Sopenharmony_ci/* Partition Integrity Entry (ECMA 167r3 4/14.13) */ 7488c2ecf20Sopenharmony_cistruct partitionIntegrityEntry { 7498c2ecf20Sopenharmony_ci struct tag descTag; 7508c2ecf20Sopenharmony_ci struct icbtag icbTag; 7518c2ecf20Sopenharmony_ci struct timestamp recordingDateAndTime; 7528c2ecf20Sopenharmony_ci uint8_t integrityType; 7538c2ecf20Sopenharmony_ci uint8_t reserved[175]; 7548c2ecf20Sopenharmony_ci struct regid impIdent; 7558c2ecf20Sopenharmony_ci uint8_t impUse[256]; 7568c2ecf20Sopenharmony_ci} __packed; 7578c2ecf20Sopenharmony_ci 7588c2ecf20Sopenharmony_ci/* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */ 7598c2ecf20Sopenharmony_ci 7608c2ecf20Sopenharmony_ci/* Extent Length (ECMA 167r3 4/14.14.1.1) */ 7618c2ecf20Sopenharmony_ci#define EXT_LENGTH_MASK 0x3FFFFFFF 7628c2ecf20Sopenharmony_ci#define EXT_TYPE_MASK 0xC0000000 7638c2ecf20Sopenharmony_ci#define EXT_RECORDED_ALLOCATED 0x00000000 7648c2ecf20Sopenharmony_ci#define EXT_NOT_RECORDED_ALLOCATED 0x40000000 7658c2ecf20Sopenharmony_ci#define EXT_NOT_RECORDED_NOT_ALLOCATED 0x80000000 7668c2ecf20Sopenharmony_ci#define EXT_NEXT_EXTENT_ALLOCDESCS 0xC0000000 7678c2ecf20Sopenharmony_ci 7688c2ecf20Sopenharmony_ci/* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */ 7698c2ecf20Sopenharmony_ci 7708c2ecf20Sopenharmony_ci/* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */ 7718c2ecf20Sopenharmony_ci 7728c2ecf20Sopenharmony_ci/* Logical Volume Header Descriptor (ECMA 167r3 4/14.15) */ 7738c2ecf20Sopenharmony_cistruct logicalVolHeaderDesc { 7748c2ecf20Sopenharmony_ci __le64 uniqueID; 7758c2ecf20Sopenharmony_ci uint8_t reserved[24]; 7768c2ecf20Sopenharmony_ci} __packed; 7778c2ecf20Sopenharmony_ci 7788c2ecf20Sopenharmony_ci/* Path Component (ECMA 167r3 4/14.16.1) */ 7798c2ecf20Sopenharmony_cistruct pathComponent { 7808c2ecf20Sopenharmony_ci uint8_t componentType; 7818c2ecf20Sopenharmony_ci uint8_t lengthComponentIdent; 7828c2ecf20Sopenharmony_ci __le16 componentFileVersionNum; 7838c2ecf20Sopenharmony_ci dchars componentIdent[0]; 7848c2ecf20Sopenharmony_ci} __packed; 7858c2ecf20Sopenharmony_ci 7868c2ecf20Sopenharmony_ci/* File Entry (ECMA 167r3 4/14.17) */ 7878c2ecf20Sopenharmony_cistruct extendedFileEntry { 7888c2ecf20Sopenharmony_ci struct tag descTag; 7898c2ecf20Sopenharmony_ci struct icbtag icbTag; 7908c2ecf20Sopenharmony_ci __le32 uid; 7918c2ecf20Sopenharmony_ci __le32 gid; 7928c2ecf20Sopenharmony_ci __le32 permissions; 7938c2ecf20Sopenharmony_ci __le16 fileLinkCount; 7948c2ecf20Sopenharmony_ci uint8_t recordFormat; 7958c2ecf20Sopenharmony_ci uint8_t recordDisplayAttr; 7968c2ecf20Sopenharmony_ci __le32 recordLength; 7978c2ecf20Sopenharmony_ci __le64 informationLength; 7988c2ecf20Sopenharmony_ci __le64 objectSize; 7998c2ecf20Sopenharmony_ci __le64 logicalBlocksRecorded; 8008c2ecf20Sopenharmony_ci struct timestamp accessTime; 8018c2ecf20Sopenharmony_ci struct timestamp modificationTime; 8028c2ecf20Sopenharmony_ci struct timestamp createTime; 8038c2ecf20Sopenharmony_ci struct timestamp attrTime; 8048c2ecf20Sopenharmony_ci __le32 checkpoint; 8058c2ecf20Sopenharmony_ci __le32 reserved; 8068c2ecf20Sopenharmony_ci struct long_ad extendedAttrICB; 8078c2ecf20Sopenharmony_ci struct long_ad streamDirectoryICB; 8088c2ecf20Sopenharmony_ci struct regid impIdent; 8098c2ecf20Sopenharmony_ci __le64 uniqueID; 8108c2ecf20Sopenharmony_ci __le32 lengthExtendedAttr; 8118c2ecf20Sopenharmony_ci __le32 lengthAllocDescs; 8128c2ecf20Sopenharmony_ci uint8_t extendedAttr[0]; 8138c2ecf20Sopenharmony_ci uint8_t allocDescs[0]; 8148c2ecf20Sopenharmony_ci} __packed; 8158c2ecf20Sopenharmony_ci 8168c2ecf20Sopenharmony_ci#endif /* _ECMA_167_H */ 817