Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * ecma_167.h |
| 3 | * |
| 4 | * This file is based on ECMA-167 3rd edition (June 1997) |
Alexander A. Klimov | 248727a | 2020-07-13 22:07:38 +0200 | [diff] [blame] | 5 | * https://www.ecma.ch |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | * |
Pali Rohár | 6146446 | 2020-01-07 22:29:04 +0100 | [diff] [blame] | 7 | * Copyright (c) 2001-2002 Ben Fennema |
Pali Rohár | 149ed3d4 | 2020-04-10 14:34:00 -0700 | [diff] [blame] | 8 | * Copyright (c) 2017-2019 Pali Rohár <pali@kernel.org> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | * All rights reserved. |
| 10 | * |
| 11 | * Redistribution and use in source and binary forms, with or without |
| 12 | * modification, are permitted provided that the following conditions |
| 13 | * are met: |
| 14 | * 1. Redistributions of source code must retain the above copyright |
| 15 | * notice, this list of conditions, and the following disclaimer, |
| 16 | * without modification. |
| 17 | * 2. The name of the author may not be used to endorse or promote products |
| 18 | * derived from this software without specific prior written permission. |
| 19 | * |
| 20 | * Alternatively, this software may be distributed under the terms of the |
| 21 | * GNU Public License ("GPL"). |
| 22 | * |
| 23 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND |
| 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR |
| 27 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | * SUCH DAMAGE. |
| 34 | */ |
| 35 | |
Pali Rohár | 6146446 | 2020-01-07 22:29:04 +0100 | [diff] [blame] | 36 | /** |
| 37 | * @file |
| 38 | * ECMA-167r3 defines and structure definitions |
| 39 | */ |
| 40 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | #include <linux/types.h> |
| 42 | |
| 43 | #ifndef _ECMA_167_H |
| 44 | #define _ECMA_167_H 1 |
| 45 | |
Pali Rohár | 6146446 | 2020-01-07 22:29:04 +0100 | [diff] [blame] | 46 | /* Character sets and coding - d-characters (ECMA 167r3 1/7.2) */ |
| 47 | typedef uint8_t dchars; |
| 48 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 49 | /* Character set specification (ECMA 167r3 1/7.2.1) */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 50 | struct charspec { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 51 | uint8_t charSetType; |
| 52 | uint8_t charSetInfo[63]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 53 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | |
| 55 | /* Character Set Type (ECMA 167r3 1/7.2.1.1) */ |
| 56 | #define CHARSPEC_TYPE_CS0 0x00 /* (1/7.2.2) */ |
| 57 | #define CHARSPEC_TYPE_CS1 0x01 /* (1/7.2.3) */ |
| 58 | #define CHARSPEC_TYPE_CS2 0x02 /* (1/7.2.4) */ |
| 59 | #define CHARSPEC_TYPE_CS3 0x03 /* (1/7.2.5) */ |
| 60 | #define CHARSPEC_TYPE_CS4 0x04 /* (1/7.2.6) */ |
| 61 | #define CHARSPEC_TYPE_CS5 0x05 /* (1/7.2.7) */ |
| 62 | #define CHARSPEC_TYPE_CS6 0x06 /* (1/7.2.8) */ |
| 63 | #define CHARSPEC_TYPE_CS7 0x07 /* (1/7.2.9) */ |
| 64 | #define CHARSPEC_TYPE_CS8 0x08 /* (1/7.2.10) */ |
| 65 | |
Pali Rohár | 6146446 | 2020-01-07 22:29:04 +0100 | [diff] [blame] | 66 | /* Fixed-length character fields - d-string (EMCA 167r3 1/7.2.12) */ |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 67 | typedef uint8_t dstring; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | |
| 69 | /* Timestamp (ECMA 167r3 1/7.3) */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 70 | struct timestamp { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 71 | __le16 typeAndTimezone; |
| 72 | __le16 year; |
| 73 | uint8_t month; |
| 74 | uint8_t day; |
| 75 | uint8_t hour; |
| 76 | uint8_t minute; |
| 77 | uint8_t second; |
| 78 | uint8_t centiseconds; |
| 79 | uint8_t hundredsOfMicroseconds; |
| 80 | uint8_t microseconds; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 81 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 83 | /* Type and Time Zone (ECMA 167r3 1/7.3.1) */ |
| 84 | #define TIMESTAMP_TYPE_MASK 0xF000 |
| 85 | #define TIMESTAMP_TYPE_CUT 0x0000 |
| 86 | #define TIMESTAMP_TYPE_LOCAL 0x1000 |
| 87 | #define TIMESTAMP_TYPE_AGREEMENT 0x2000 |
| 88 | #define TIMESTAMP_TIMEZONE_MASK 0x0FFF |
| 89 | |
| 90 | /* Entity identifier (ECMA 167r3 1/7.4) */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 91 | struct regid { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 92 | uint8_t flags; |
| 93 | uint8_t ident[23]; |
| 94 | uint8_t identSuffix[8]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 95 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | |
| 97 | /* Flags (ECMA 167r3 1/7.4.1) */ |
Pali Rohár | 49be68c | 2020-01-12 23:13:53 +0100 | [diff] [blame] | 98 | #define ENTITYID_FLAGS_DIRTY 0x01 |
| 99 | #define ENTITYID_FLAGS_PROTECTED 0x02 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 100 | |
| 101 | /* Volume Structure Descriptor (ECMA 167r3 2/9.1) */ |
| 102 | #define VSD_STD_ID_LEN 5 |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 103 | struct volStructDesc { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 104 | uint8_t structType; |
| 105 | uint8_t stdIdent[VSD_STD_ID_LEN]; |
| 106 | uint8_t structVersion; |
| 107 | uint8_t structData[2041]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 108 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 109 | |
| 110 | /* Standard Identifier (EMCA 167r2 2/9.1.2) */ |
| 111 | #define VSD_STD_ID_NSR02 "NSR02" /* (3/9.1) */ |
| 112 | |
| 113 | /* Standard Identifier (ECMA 167r3 2/9.1.2) */ |
| 114 | #define VSD_STD_ID_BEA01 "BEA01" /* (2/9.2) */ |
| 115 | #define VSD_STD_ID_BOOT2 "BOOT2" /* (2/9.4) */ |
| 116 | #define VSD_STD_ID_CD001 "CD001" /* (ECMA-119) */ |
| 117 | #define VSD_STD_ID_CDW02 "CDW02" /* (ECMA-168) */ |
| 118 | #define VSD_STD_ID_NSR03 "NSR03" /* (3/9.1) */ |
| 119 | #define VSD_STD_ID_TEA01 "TEA01" /* (2/9.3) */ |
| 120 | |
| 121 | /* Beginning Extended Area Descriptor (ECMA 167r3 2/9.2) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 122 | struct beginningExtendedAreaDesc { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 123 | uint8_t structType; |
| 124 | uint8_t stdIdent[VSD_STD_ID_LEN]; |
| 125 | uint8_t structVersion; |
| 126 | uint8_t structData[2041]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 127 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | |
| 129 | /* Terminating Extended Area Descriptor (ECMA 167r3 2/9.3) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 130 | struct terminatingExtendedAreaDesc { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 131 | uint8_t structType; |
| 132 | uint8_t stdIdent[VSD_STD_ID_LEN]; |
| 133 | uint8_t structVersion; |
| 134 | uint8_t structData[2041]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 135 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | |
| 137 | /* Boot Descriptor (ECMA 167r3 2/9.4) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 138 | struct bootDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 139 | uint8_t structType; |
| 140 | uint8_t stdIdent[VSD_STD_ID_LEN]; |
| 141 | uint8_t structVersion; |
| 142 | uint8_t reserved1; |
| 143 | struct regid archType; |
| 144 | struct regid bootIdent; |
| 145 | __le32 bootExtLocation; |
| 146 | __le32 bootExtLength; |
| 147 | __le64 loadAddress; |
| 148 | __le64 startAddress; |
| 149 | struct timestamp descCreationDateAndTime; |
| 150 | __le16 flags; |
| 151 | uint8_t reserved2[32]; |
| 152 | uint8_t bootUse[1906]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 153 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 154 | |
| 155 | /* Flags (ECMA 167r3 2/9.4.12) */ |
| 156 | #define BOOT_FLAGS_ERASE 0x01 |
| 157 | |
| 158 | /* Extent Descriptor (ECMA 167r3 3/7.1) */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 159 | struct extent_ad { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 160 | __le32 extLength; |
| 161 | __le32 extLocation; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 162 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 163 | |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 164 | struct kernel_extent_ad { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 165 | uint32_t extLength; |
| 166 | uint32_t extLocation; |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 167 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 168 | |
| 169 | /* Descriptor Tag (ECMA 167r3 3/7.2) */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 170 | struct tag { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 171 | __le16 tagIdent; |
| 172 | __le16 descVersion; |
| 173 | uint8_t tagChecksum; |
| 174 | uint8_t reserved; |
| 175 | __le16 tagSerialNum; |
| 176 | __le16 descCRC; |
| 177 | __le16 descCRCLength; |
| 178 | __le32 tagLocation; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 179 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 180 | |
| 181 | /* Tag Identifier (ECMA 167r3 3/7.2.1) */ |
| 182 | #define TAG_IDENT_PVD 0x0001 |
| 183 | #define TAG_IDENT_AVDP 0x0002 |
| 184 | #define TAG_IDENT_VDP 0x0003 |
| 185 | #define TAG_IDENT_IUVD 0x0004 |
| 186 | #define TAG_IDENT_PD 0x0005 |
| 187 | #define TAG_IDENT_LVD 0x0006 |
| 188 | #define TAG_IDENT_USD 0x0007 |
| 189 | #define TAG_IDENT_TD 0x0008 |
| 190 | #define TAG_IDENT_LVID 0x0009 |
| 191 | |
| 192 | /* NSR Descriptor (ECMA 167r3 3/9.1) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 193 | struct NSRDesc { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 194 | uint8_t structType; |
| 195 | uint8_t stdIdent[VSD_STD_ID_LEN]; |
| 196 | uint8_t structVersion; |
| 197 | uint8_t reserved; |
| 198 | uint8_t structData[2040]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 199 | } __packed; |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 200 | |
Pali Rohár | 6146446 | 2020-01-07 22:29:04 +0100 | [diff] [blame] | 201 | /* Generic Descriptor */ |
| 202 | struct genericDesc { |
| 203 | struct tag descTag; |
| 204 | __le32 volDescSeqNum; |
| 205 | uint8_t reserved[492]; |
| 206 | } __packed; |
| 207 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 208 | /* Primary Volume Descriptor (ECMA 167r3 3/10.1) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 209 | struct primaryVolDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 210 | struct tag descTag; |
| 211 | __le32 volDescSeqNum; |
| 212 | __le32 primaryVolDescNum; |
| 213 | dstring volIdent[32]; |
| 214 | __le16 volSeqNum; |
| 215 | __le16 maxVolSeqNum; |
| 216 | __le16 interchangeLvl; |
| 217 | __le16 maxInterchangeLvl; |
| 218 | __le32 charSetList; |
| 219 | __le32 maxCharSetList; |
| 220 | dstring volSetIdent[128]; |
| 221 | struct charspec descCharSet; |
| 222 | struct charspec explanatoryCharSet; |
| 223 | struct extent_ad volAbstract; |
| 224 | struct extent_ad volCopyright; |
| 225 | struct regid appIdent; |
| 226 | struct timestamp recordingDateAndTime; |
| 227 | struct regid impIdent; |
| 228 | uint8_t impUse[64]; |
| 229 | __le32 predecessorVolDescSeqLocation; |
| 230 | __le16 flags; |
| 231 | uint8_t reserved[22]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 232 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 233 | |
| 234 | /* Flags (ECMA 167r3 3/10.1.21) */ |
| 235 | #define PVD_FLAGS_VSID_COMMON 0x0001 |
| 236 | |
| 237 | /* Anchor Volume Descriptor Pointer (ECMA 167r3 3/10.2) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 238 | struct anchorVolDescPtr { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 239 | struct tag descTag; |
| 240 | struct extent_ad mainVolDescSeqExt; |
| 241 | struct extent_ad reserveVolDescSeqExt; |
| 242 | uint8_t reserved[480]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 243 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 244 | |
| 245 | /* Volume Descriptor Pointer (ECMA 167r3 3/10.3) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 246 | struct volDescPtr { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 247 | struct tag descTag; |
| 248 | __le32 volDescSeqNum; |
| 249 | struct extent_ad nextVolDescSeqExt; |
| 250 | uint8_t reserved[484]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 251 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | |
| 253 | /* Implementation Use Volume Descriptor (ECMA 167r3 3/10.4) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 254 | struct impUseVolDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 255 | struct tag descTag; |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 256 | __le32 volDescSeqNum; |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 257 | struct regid impIdent; |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 258 | uint8_t impUse[460]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 259 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | |
| 261 | /* Partition Descriptor (ECMA 167r3 3/10.5) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 262 | struct partitionDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 263 | struct tag descTag; |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 264 | __le32 volDescSeqNum; |
| 265 | __le16 partitionFlags; |
| 266 | __le16 partitionNumber; |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 267 | struct regid partitionContents; |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 268 | uint8_t partitionContentsUse[128]; |
| 269 | __le32 accessType; |
| 270 | __le32 partitionStartingLocation; |
| 271 | __le32 partitionLength; |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 272 | struct regid impIdent; |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 273 | uint8_t impUse[128]; |
| 274 | uint8_t reserved[156]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 275 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 276 | |
| 277 | /* Partition Flags (ECMA 167r3 3/10.5.3) */ |
| 278 | #define PD_PARTITION_FLAGS_ALLOC 0x0001 |
| 279 | |
| 280 | /* Partition Contents (ECMA 167r2 3/10.5.3) */ |
| 281 | #define PD_PARTITION_CONTENTS_NSR02 "+NSR02" |
| 282 | |
| 283 | /* Partition Contents (ECMA 167r3 3/10.5.5) */ |
| 284 | #define PD_PARTITION_CONTENTS_FDC01 "+FDC01" |
| 285 | #define PD_PARTITION_CONTENTS_CD001 "+CD001" |
| 286 | #define PD_PARTITION_CONTENTS_CDW02 "+CDW02" |
| 287 | #define PD_PARTITION_CONTENTS_NSR03 "+NSR03" |
| 288 | |
| 289 | /* Access Type (ECMA 167r3 3/10.5.7) */ |
| 290 | #define PD_ACCESS_TYPE_NONE 0x00000000 |
| 291 | #define PD_ACCESS_TYPE_READ_ONLY 0x00000001 |
| 292 | #define PD_ACCESS_TYPE_WRITE_ONCE 0x00000002 |
| 293 | #define PD_ACCESS_TYPE_REWRITABLE 0x00000003 |
| 294 | #define PD_ACCESS_TYPE_OVERWRITABLE 0x00000004 |
| 295 | |
| 296 | /* Logical Volume Descriptor (ECMA 167r3 3/10.6) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 297 | struct logicalVolDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 298 | struct tag descTag; |
| 299 | __le32 volDescSeqNum; |
| 300 | struct charspec descCharSet; |
| 301 | dstring logicalVolIdent[128]; |
| 302 | __le32 logicalBlockSize; |
| 303 | struct regid domainIdent; |
| 304 | uint8_t logicalVolContentsUse[16]; |
| 305 | __le32 mapTableLength; |
| 306 | __le32 numPartitionMaps; |
| 307 | struct regid impIdent; |
| 308 | uint8_t impUse[128]; |
| 309 | struct extent_ad integritySeqExt; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 310 | uint8_t partitionMaps[]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 311 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | |
| 313 | /* Generic Partition Map (ECMA 167r3 3/10.7.1) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 314 | struct genericPartitionMap { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 315 | uint8_t partitionMapType; |
| 316 | uint8_t partitionMapLength; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 317 | uint8_t partitionMapping[]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 318 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | |
| 320 | /* Partition Map Type (ECMA 167r3 3/10.7.1.1) */ |
| 321 | #define GP_PARTITION_MAP_TYPE_UNDEF 0x00 |
Pali Rohár | 6146446 | 2020-01-07 22:29:04 +0100 | [diff] [blame] | 322 | #define GP_PARTITION_MAP_TYPE_1 0x01 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | #define GP_PARTITION_MAP_TYPE_2 0x02 |
| 324 | |
| 325 | /* Type 1 Partition Map (ECMA 167r3 3/10.7.2) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 326 | struct genericPartitionMap1 { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 327 | uint8_t partitionMapType; |
| 328 | uint8_t partitionMapLength; |
| 329 | __le16 volSeqNum; |
| 330 | __le16 partitionNum; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 331 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | |
| 333 | /* Type 2 Partition Map (ECMA 167r3 3/10.7.3) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 334 | struct genericPartitionMap2 { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 335 | uint8_t partitionMapType; |
| 336 | uint8_t partitionMapLength; |
| 337 | uint8_t partitionIdent[62]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 338 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | |
| 340 | /* Unallocated Space Descriptor (ECMA 167r3 3/10.8) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 341 | struct unallocSpaceDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 342 | struct tag descTag; |
| 343 | __le32 volDescSeqNum; |
| 344 | __le32 numAllocDescs; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 345 | struct extent_ad allocDescs[]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 346 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 347 | |
| 348 | /* Terminating Descriptor (ECMA 167r3 3/10.9) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 349 | struct terminatingDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 350 | struct tag descTag; |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 351 | uint8_t reserved[496]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 352 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 353 | |
| 354 | /* Logical Volume Integrity Descriptor (ECMA 167r3 3/10.10) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 355 | struct logicalVolIntegrityDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 356 | struct tag descTag; |
| 357 | struct timestamp recordingDateAndTime; |
| 358 | __le32 integrityType; |
| 359 | struct extent_ad nextIntegrityExt; |
| 360 | uint8_t logicalVolContentsUse[32]; |
| 361 | __le32 numOfPartitions; |
| 362 | __le32 lengthOfImpUse; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 363 | __le32 freeSpaceTable[]; |
| 364 | /* __le32 sizeTable[]; */ |
| 365 | /* uint8_t impUse[]; */ |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 366 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 367 | |
| 368 | /* Integrity Type (ECMA 167r3 3/10.10.3) */ |
| 369 | #define LVID_INTEGRITY_TYPE_OPEN 0x00000000 |
| 370 | #define LVID_INTEGRITY_TYPE_CLOSE 0x00000001 |
| 371 | |
| 372 | /* Recorded Address (ECMA 167r3 4/7.1) */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 373 | struct lb_addr { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 374 | __le32 logicalBlockNum; |
| 375 | __le16 partitionReferenceNum; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 376 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 377 | |
| 378 | /* ... and its in-core analog */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 379 | struct kernel_lb_addr { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 380 | uint32_t logicalBlockNum; |
| 381 | uint16_t partitionReferenceNum; |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 382 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | |
| 384 | /* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 385 | struct short_ad { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 386 | __le32 extLength; |
| 387 | __le32 extPosition; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 388 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 389 | |
| 390 | /* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 391 | struct long_ad { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 392 | __le32 extLength; |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 393 | struct lb_addr extLocation; |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 394 | uint8_t impUse[6]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 395 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 396 | |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 397 | struct kernel_long_ad { |
| 398 | uint32_t extLength; |
| 399 | struct kernel_lb_addr extLocation; |
| 400 | uint8_t impUse[6]; |
| 401 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | |
| 403 | /* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 404 | struct ext_ad { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 405 | __le32 extLength; |
| 406 | __le32 recordedLength; |
| 407 | __le32 informationLength; |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 408 | struct lb_addr extLocation; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 409 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 411 | struct kernel_ext_ad { |
| 412 | uint32_t extLength; |
| 413 | uint32_t recordedLength; |
| 414 | uint32_t informationLength; |
| 415 | struct kernel_lb_addr extLocation; |
| 416 | }; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 417 | |
| 418 | /* Descriptor Tag (ECMA 167r3 4/7.2 - See 3/7.2) */ |
| 419 | |
| 420 | /* Tag Identifier (ECMA 167r3 4/7.2.1) */ |
| 421 | #define TAG_IDENT_FSD 0x0100 |
| 422 | #define TAG_IDENT_FID 0x0101 |
| 423 | #define TAG_IDENT_AED 0x0102 |
| 424 | #define TAG_IDENT_IE 0x0103 |
| 425 | #define TAG_IDENT_TE 0x0104 |
| 426 | #define TAG_IDENT_FE 0x0105 |
| 427 | #define TAG_IDENT_EAHD 0x0106 |
| 428 | #define TAG_IDENT_USE 0x0107 |
| 429 | #define TAG_IDENT_SBD 0x0108 |
| 430 | #define TAG_IDENT_PIE 0x0109 |
| 431 | #define TAG_IDENT_EFE 0x010A |
| 432 | |
| 433 | /* File Set Descriptor (ECMA 167r3 4/14.1) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 434 | struct fileSetDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 435 | struct tag descTag; |
| 436 | struct timestamp recordingDateAndTime; |
| 437 | __le16 interchangeLvl; |
| 438 | __le16 maxInterchangeLvl; |
| 439 | __le32 charSetList; |
| 440 | __le32 maxCharSetList; |
| 441 | __le32 fileSetNum; |
| 442 | __le32 fileSetDescNum; |
| 443 | struct charspec logicalVolIdentCharSet; |
| 444 | dstring logicalVolIdent[128]; |
| 445 | struct charspec fileSetCharSet; |
| 446 | dstring fileSetIdent[32]; |
| 447 | dstring copyrightFileIdent[32]; |
| 448 | dstring abstractFileIdent[32]; |
| 449 | struct long_ad rootDirectoryICB; |
| 450 | struct regid domainIdent; |
| 451 | struct long_ad nextExt; |
| 452 | struct long_ad streamDirectoryICB; |
| 453 | uint8_t reserved[32]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 454 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | |
| 456 | /* Partition Header Descriptor (ECMA 167r3 4/14.3) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 457 | struct partitionHeaderDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 458 | struct short_ad unallocSpaceTable; |
| 459 | struct short_ad unallocSpaceBitmap; |
| 460 | struct short_ad partitionIntegrityTable; |
| 461 | struct short_ad freedSpaceTable; |
| 462 | struct short_ad freedSpaceBitmap; |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 463 | uint8_t reserved[88]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 464 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 465 | |
| 466 | /* File Identifier Descriptor (ECMA 167r3 4/14.4) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 467 | struct fileIdentDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 468 | struct tag descTag; |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 469 | __le16 fileVersionNum; |
| 470 | uint8_t fileCharacteristics; |
| 471 | uint8_t lengthFileIdent; |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 472 | struct long_ad icb; |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 473 | __le16 lengthOfImpUse; |
Jan Kara | 979a6e2 | 2021-05-03 11:54:24 +0200 | [diff] [blame] | 474 | uint8_t impUse[]; |
| 475 | /* uint8_t fileIdent[]; */ |
| 476 | /* uint8_t padding[]; */ |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 477 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 478 | |
| 479 | /* File Characteristics (ECMA 167r3 4/14.4.3) */ |
| 480 | #define FID_FILE_CHAR_HIDDEN 0x01 |
| 481 | #define FID_FILE_CHAR_DIRECTORY 0x02 |
| 482 | #define FID_FILE_CHAR_DELETED 0x04 |
| 483 | #define FID_FILE_CHAR_PARENT 0x08 |
| 484 | #define FID_FILE_CHAR_METADATA 0x10 |
| 485 | |
| 486 | /* Allocation Ext Descriptor (ECMA 167r3 4/14.5) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 487 | struct allocExtDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 488 | struct tag descTag; |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 489 | __le32 previousAllocExtLocation; |
| 490 | __le32 lengthAllocDescs; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 491 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 492 | |
| 493 | /* ICB Tag (ECMA 167r3 4/14.6) */ |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 494 | struct icbtag { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 495 | __le32 priorRecordedNumDirectEntries; |
| 496 | __le16 strategyType; |
| 497 | __le16 strategyParameter; |
| 498 | __le16 numEntries; |
| 499 | uint8_t reserved; |
| 500 | uint8_t fileType; |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 501 | struct lb_addr parentICBLocation; |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 502 | __le16 flags; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 503 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 504 | |
| 505 | /* Strategy Type (ECMA 167r3 4/14.6.2) */ |
| 506 | #define ICBTAG_STRATEGY_TYPE_UNDEF 0x0000 |
| 507 | #define ICBTAG_STRATEGY_TYPE_1 0x0001 |
| 508 | #define ICBTAG_STRATEGY_TYPE_2 0x0002 |
| 509 | #define ICBTAG_STRATEGY_TYPE_3 0x0003 |
| 510 | #define ICBTAG_STRATEGY_TYPE_4 0x0004 |
| 511 | |
| 512 | /* File Type (ECMA 167r3 4/14.6.6) */ |
| 513 | #define ICBTAG_FILE_TYPE_UNDEF 0x00 |
| 514 | #define ICBTAG_FILE_TYPE_USE 0x01 |
| 515 | #define ICBTAG_FILE_TYPE_PIE 0x02 |
| 516 | #define ICBTAG_FILE_TYPE_IE 0x03 |
| 517 | #define ICBTAG_FILE_TYPE_DIRECTORY 0x04 |
| 518 | #define ICBTAG_FILE_TYPE_REGULAR 0x05 |
| 519 | #define ICBTAG_FILE_TYPE_BLOCK 0x06 |
| 520 | #define ICBTAG_FILE_TYPE_CHAR 0x07 |
| 521 | #define ICBTAG_FILE_TYPE_EA 0x08 |
| 522 | #define ICBTAG_FILE_TYPE_FIFO 0x09 |
| 523 | #define ICBTAG_FILE_TYPE_SOCKET 0x0A |
| 524 | #define ICBTAG_FILE_TYPE_TE 0x0B |
| 525 | #define ICBTAG_FILE_TYPE_SYMLINK 0x0C |
| 526 | #define ICBTAG_FILE_TYPE_STREAMDIR 0x0D |
| 527 | |
| 528 | /* Flags (ECMA 167r3 4/14.6.8) */ |
| 529 | #define ICBTAG_FLAG_AD_MASK 0x0007 |
| 530 | #define ICBTAG_FLAG_AD_SHORT 0x0000 |
| 531 | #define ICBTAG_FLAG_AD_LONG 0x0001 |
| 532 | #define ICBTAG_FLAG_AD_EXTENDED 0x0002 |
| 533 | #define ICBTAG_FLAG_AD_IN_ICB 0x0003 |
| 534 | #define ICBTAG_FLAG_SORTED 0x0008 |
| 535 | #define ICBTAG_FLAG_NONRELOCATABLE 0x0010 |
| 536 | #define ICBTAG_FLAG_ARCHIVE 0x0020 |
| 537 | #define ICBTAG_FLAG_SETUID 0x0040 |
| 538 | #define ICBTAG_FLAG_SETGID 0x0080 |
| 539 | #define ICBTAG_FLAG_STICKY 0x0100 |
| 540 | #define ICBTAG_FLAG_CONTIGUOUS 0x0200 |
| 541 | #define ICBTAG_FLAG_SYSTEM 0x0400 |
| 542 | #define ICBTAG_FLAG_TRANSFORMED 0x0800 |
| 543 | #define ICBTAG_FLAG_MULTIVERSIONS 0x1000 |
| 544 | #define ICBTAG_FLAG_STREAM 0x2000 |
| 545 | |
| 546 | /* Indirect Entry (ECMA 167r3 4/14.7) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 547 | struct indirectEntry { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 548 | struct tag descTag; |
| 549 | struct icbtag icbTag; |
| 550 | struct long_ad indirectICB; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 551 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | |
| 553 | /* Terminal Entry (ECMA 167r3 4/14.8) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 554 | struct terminalEntry { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 555 | struct tag descTag; |
| 556 | struct icbtag icbTag; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 557 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 558 | |
| 559 | /* File Entry (ECMA 167r3 4/14.9) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 560 | struct fileEntry { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 561 | struct tag descTag; |
| 562 | struct icbtag icbTag; |
| 563 | __le32 uid; |
| 564 | __le32 gid; |
| 565 | __le32 permissions; |
| 566 | __le16 fileLinkCount; |
| 567 | uint8_t recordFormat; |
| 568 | uint8_t recordDisplayAttr; |
| 569 | __le32 recordLength; |
| 570 | __le64 informationLength; |
| 571 | __le64 logicalBlocksRecorded; |
| 572 | struct timestamp accessTime; |
| 573 | struct timestamp modificationTime; |
| 574 | struct timestamp attrTime; |
| 575 | __le32 checkpoint; |
| 576 | struct long_ad extendedAttrICB; |
| 577 | struct regid impIdent; |
| 578 | __le64 uniqueID; |
| 579 | __le32 lengthExtendedAttr; |
| 580 | __le32 lengthAllocDescs; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 581 | uint8_t extendedAttr[]; |
| 582 | /* uint8_t allocDescs[]; */ |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 583 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 584 | |
| 585 | /* Permissions (ECMA 167r3 4/14.9.5) */ |
| 586 | #define FE_PERM_O_EXEC 0x00000001U |
| 587 | #define FE_PERM_O_WRITE 0x00000002U |
| 588 | #define FE_PERM_O_READ 0x00000004U |
| 589 | #define FE_PERM_O_CHATTR 0x00000008U |
| 590 | #define FE_PERM_O_DELETE 0x00000010U |
| 591 | #define FE_PERM_G_EXEC 0x00000020U |
| 592 | #define FE_PERM_G_WRITE 0x00000040U |
| 593 | #define FE_PERM_G_READ 0x00000080U |
| 594 | #define FE_PERM_G_CHATTR 0x00000100U |
| 595 | #define FE_PERM_G_DELETE 0x00000200U |
| 596 | #define FE_PERM_U_EXEC 0x00000400U |
| 597 | #define FE_PERM_U_WRITE 0x00000800U |
| 598 | #define FE_PERM_U_READ 0x00001000U |
| 599 | #define FE_PERM_U_CHATTR 0x00002000U |
| 600 | #define FE_PERM_U_DELETE 0x00004000U |
| 601 | |
| 602 | /* Record Format (ECMA 167r3 4/14.9.7) */ |
| 603 | #define FE_RECORD_FMT_UNDEF 0x00 |
| 604 | #define FE_RECORD_FMT_FIXED_PAD 0x01 |
| 605 | #define FE_RECORD_FMT_FIXED 0x02 |
| 606 | #define FE_RECORD_FMT_VARIABLE8 0x03 |
| 607 | #define FE_RECORD_FMT_VARIABLE16 0x04 |
| 608 | #define FE_RECORD_FMT_VARIABLE16_MSB 0x05 |
| 609 | #define FE_RECORD_FMT_VARIABLE32 0x06 |
| 610 | #define FE_RECORD_FMT_PRINT 0x07 |
| 611 | #define FE_RECORD_FMT_LF 0x08 |
| 612 | #define FE_RECORD_FMT_CR 0x09 |
| 613 | #define FE_RECORD_FMT_CRLF 0x0A |
| 614 | #define FE_RECORD_FMT_LFCR 0x0B |
| 615 | |
| 616 | /* Record Display Attributes (ECMA 167r3 4/14.9.8) */ |
| 617 | #define FE_RECORD_DISPLAY_ATTR_UNDEF 0x00 |
| 618 | #define FE_RECORD_DISPLAY_ATTR_1 0x01 |
| 619 | #define FE_RECORD_DISPLAY_ATTR_2 0x02 |
| 620 | #define FE_RECORD_DISPLAY_ATTR_3 0x03 |
| 621 | |
| 622 | /* Extended Attribute Header Descriptor (ECMA 167r3 4/14.10.1) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 623 | struct extendedAttrHeaderDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 624 | struct tag descTag; |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 625 | __le32 impAttrLocation; |
| 626 | __le32 appAttrLocation; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 627 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 628 | |
| 629 | /* Generic Format (ECMA 167r3 4/14.10.2) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 630 | struct genericFormat { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 631 | __le32 attrType; |
| 632 | uint8_t attrSubtype; |
| 633 | uint8_t reserved[3]; |
| 634 | __le32 attrLength; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 635 | uint8_t attrData[]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 636 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 637 | |
| 638 | /* Character Set Information (ECMA 167r3 4/14.10.3) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 639 | struct charSetInfo { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 640 | __le32 attrType; |
| 641 | uint8_t attrSubtype; |
| 642 | uint8_t reserved[3]; |
| 643 | __le32 attrLength; |
| 644 | __le32 escapeSeqLength; |
| 645 | uint8_t charSetType; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 646 | uint8_t escapeSeq[]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 647 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 648 | |
| 649 | /* Alternate Permissions (ECMA 167r3 4/14.10.4) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 650 | struct altPerms { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 651 | __le32 attrType; |
| 652 | uint8_t attrSubtype; |
| 653 | uint8_t reserved[3]; |
| 654 | __le32 attrLength; |
| 655 | __le16 ownerIdent; |
| 656 | __le16 groupIdent; |
| 657 | __le16 permission; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 658 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 659 | |
| 660 | /* File Times Extended Attribute (ECMA 167r3 4/14.10.5) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 661 | struct fileTimesExtAttr { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 662 | __le32 attrType; |
| 663 | uint8_t attrSubtype; |
| 664 | uint8_t reserved[3]; |
| 665 | __le32 attrLength; |
| 666 | __le32 dataLength; |
| 667 | __le32 fileTimeExistence; |
| 668 | uint8_t fileTimes; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 669 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 670 | |
| 671 | /* FileTimeExistence (ECMA 167r3 4/14.10.5.6) */ |
| 672 | #define FTE_CREATION 0x00000001 |
| 673 | #define FTE_DELETION 0x00000004 |
| 674 | #define FTE_EFFECTIVE 0x00000008 |
| 675 | #define FTE_BACKUP 0x00000002 |
| 676 | |
| 677 | /* Information Times Extended Attribute (ECMA 167r3 4/14.10.6) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 678 | struct infoTimesExtAttr { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 679 | __le32 attrType; |
| 680 | uint8_t attrSubtype; |
| 681 | uint8_t reserved[3]; |
| 682 | __le32 attrLength; |
| 683 | __le32 dataLength; |
| 684 | __le32 infoTimeExistence; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 685 | uint8_t infoTimes[]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 686 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 687 | |
| 688 | /* Device Specification (ECMA 167r3 4/14.10.7) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 689 | struct deviceSpec { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 690 | __le32 attrType; |
| 691 | uint8_t attrSubtype; |
| 692 | uint8_t reserved[3]; |
| 693 | __le32 attrLength; |
| 694 | __le32 impUseLength; |
| 695 | __le32 majorDeviceIdent; |
| 696 | __le32 minorDeviceIdent; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 697 | uint8_t impUse[]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 698 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 699 | |
| 700 | /* Implementation Use Extended Attr (ECMA 167r3 4/14.10.8) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 701 | struct impUseExtAttr { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 702 | __le32 attrType; |
| 703 | uint8_t attrSubtype; |
| 704 | uint8_t reserved[3]; |
| 705 | __le32 attrLength; |
| 706 | __le32 impUseLength; |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 707 | struct regid impIdent; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 708 | uint8_t impUse[]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 709 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 710 | |
| 711 | /* Application Use Extended Attribute (ECMA 167r3 4/14.10.9) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 712 | struct appUseExtAttr { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 713 | __le32 attrType; |
| 714 | uint8_t attrSubtype; |
| 715 | uint8_t reserved[3]; |
| 716 | __le32 attrLength; |
| 717 | __le32 appUseLength; |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 718 | struct regid appIdent; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 719 | uint8_t appUse[]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 720 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 721 | |
| 722 | #define EXTATTR_CHAR_SET 1 |
| 723 | #define EXTATTR_ALT_PERMS 3 |
| 724 | #define EXTATTR_FILE_TIMES 5 |
| 725 | #define EXTATTR_INFO_TIMES 6 |
| 726 | #define EXTATTR_DEV_SPEC 12 |
| 727 | #define EXTATTR_IMP_USE 2048 |
| 728 | #define EXTATTR_APP_USE 65536 |
Pali Rohár | 6146446 | 2020-01-07 22:29:04 +0100 | [diff] [blame] | 729 | #define EXTATTR_SUBTYPE 1 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 730 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 731 | /* Unallocated Space Entry (ECMA 167r3 4/14.11) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 732 | struct unallocSpaceEntry { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 733 | struct tag descTag; |
| 734 | struct icbtag icbTag; |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 735 | __le32 lengthAllocDescs; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 736 | uint8_t allocDescs[]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 737 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 738 | |
| 739 | /* Space Bitmap Descriptor (ECMA 167r3 4/14.12) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 740 | struct spaceBitmapDesc { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 741 | struct tag descTag; |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 742 | __le32 numOfBits; |
| 743 | __le32 numOfBytes; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 744 | uint8_t bitmap[]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 745 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 746 | |
| 747 | /* Partition Integrity Entry (ECMA 167r3 4/14.13) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 748 | struct partitionIntegrityEntry { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 749 | struct tag descTag; |
| 750 | struct icbtag icbTag; |
| 751 | struct timestamp recordingDateAndTime; |
| 752 | uint8_t integrityType; |
| 753 | uint8_t reserved[175]; |
| 754 | struct regid impIdent; |
| 755 | uint8_t impUse[256]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 756 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 757 | |
| 758 | /* Short Allocation Descriptor (ECMA 167r3 4/14.14.1) */ |
| 759 | |
| 760 | /* Extent Length (ECMA 167r3 4/14.14.1.1) */ |
Pali Rohár | 6146446 | 2020-01-07 22:29:04 +0100 | [diff] [blame] | 761 | #define EXT_LENGTH_MASK 0x3FFFFFFF |
| 762 | #define EXT_TYPE_MASK 0xC0000000 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 763 | #define EXT_RECORDED_ALLOCATED 0x00000000 |
| 764 | #define EXT_NOT_RECORDED_ALLOCATED 0x40000000 |
| 765 | #define EXT_NOT_RECORDED_NOT_ALLOCATED 0x80000000 |
Pali Rohár | 800552c | 2020-01-07 22:29:02 +0100 | [diff] [blame] | 766 | #define EXT_NEXT_EXTENT_ALLOCDESCS 0xC0000000 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 767 | |
| 768 | /* Long Allocation Descriptor (ECMA 167r3 4/14.14.2) */ |
| 769 | |
| 770 | /* Extended Allocation Descriptor (ECMA 167r3 4/14.14.3) */ |
| 771 | |
| 772 | /* Logical Volume Header Descriptor (ECMA 167r3 4/14.15) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 773 | struct logicalVolHeaderDesc { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 774 | __le64 uniqueID; |
| 775 | uint8_t reserved[24]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 776 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 777 | |
| 778 | /* Path Component (ECMA 167r3 4/14.16.1) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 779 | struct pathComponent { |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 780 | uint8_t componentType; |
| 781 | uint8_t lengthComponentIdent; |
| 782 | __le16 componentFileVersionNum; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 783 | dchars componentIdent[]; |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 784 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 785 | |
| 786 | /* File Entry (ECMA 167r3 4/14.17) */ |
Cyrill Gorcunov | cb00ea3 | 2007-07-19 01:47:43 -0700 | [diff] [blame] | 787 | struct extendedFileEntry { |
Pekka Enberg | 5ca4e4b | 2008-10-15 12:28:03 +0200 | [diff] [blame] | 788 | struct tag descTag; |
| 789 | struct icbtag icbTag; |
| 790 | __le32 uid; |
| 791 | __le32 gid; |
| 792 | __le32 permissions; |
| 793 | __le16 fileLinkCount; |
| 794 | uint8_t recordFormat; |
| 795 | uint8_t recordDisplayAttr; |
| 796 | __le32 recordLength; |
| 797 | __le64 informationLength; |
| 798 | __le64 objectSize; |
| 799 | __le64 logicalBlocksRecorded; |
| 800 | struct timestamp accessTime; |
| 801 | struct timestamp modificationTime; |
| 802 | struct timestamp createTime; |
| 803 | struct timestamp attrTime; |
| 804 | __le32 checkpoint; |
| 805 | __le32 reserved; |
| 806 | struct long_ad extendedAttrICB; |
| 807 | struct long_ad streamDirectoryICB; |
| 808 | struct regid impIdent; |
| 809 | __le64 uniqueID; |
| 810 | __le32 lengthExtendedAttr; |
| 811 | __le32 lengthAllocDescs; |
Jan Kara | b3c8c98 | 2021-05-03 11:50:38 +0200 | [diff] [blame] | 812 | uint8_t extendedAttr[]; |
| 813 | /* uint8_t allocDescs[]; */ |
Fabian Frederick | 75f2713 | 2017-01-06 21:53:49 +0100 | [diff] [blame] | 814 | } __packed; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 815 | |
Cyrill Gorcunov | 28de794 | 2007-07-21 04:37:18 -0700 | [diff] [blame] | 816 | #endif /* _ECMA_167_H */ |