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