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