| .. | .. |
|---|
| 1 | 1 | /* |
|---|
| 2 | 2 | * osta_udf.h |
|---|
| 3 | 3 | * |
|---|
| 4 | | - * This file is based on OSTA UDF(tm) 2.50 (April 30, 2003) |
|---|
| 4 | + * This file is based on OSTA UDF(tm) 2.60 (March 1, 2005) |
|---|
| 5 | 5 | * http://www.osta.org |
|---|
| 6 | 6 | * |
|---|
| 7 | | - * Copyright (c) 2001-2004 Ben Fennema <bfennema@falcon.csc.calpoly.edu> |
|---|
| 7 | + * Copyright (c) 2001-2004 Ben Fennema |
|---|
| 8 | + * Copyright (c) 2017-2019 Pali Rohár <pali@kernel.org> |
|---|
| 8 | 9 | * All rights reserved. |
|---|
| 9 | 10 | * |
|---|
| 10 | 11 | * Redistribution and use in source and binary forms, with or without |
|---|
| .. | .. |
|---|
| 32 | 33 | * SUCH DAMAGE. |
|---|
| 33 | 34 | */ |
|---|
| 34 | 35 | |
|---|
| 36 | +/** |
|---|
| 37 | + * @file |
|---|
| 38 | + * OSTA-UDF defines and structure definitions |
|---|
| 39 | + */ |
|---|
| 40 | + |
|---|
| 35 | 41 | #include "ecma_167.h" |
|---|
| 36 | 42 | |
|---|
| 37 | 43 | #ifndef _OSTA_UDF_H |
|---|
| 38 | 44 | #define _OSTA_UDF_H 1 |
|---|
| 39 | 45 | |
|---|
| 40 | | -/* OSTA CS0 Charspec (UDF 2.50 2.1.2) */ |
|---|
| 46 | +/* OSTA CS0 Charspec (UDF 2.60 2.1.2) */ |
|---|
| 41 | 47 | #define UDF_CHAR_SET_TYPE 0 |
|---|
| 42 | 48 | #define UDF_CHAR_SET_INFO "OSTA Compressed Unicode" |
|---|
| 43 | 49 | |
|---|
| 44 | | -/* Entity Identifier (UDF 2.50 2.1.5) */ |
|---|
| 45 | | -/* Identifiers (UDF 2.50 2.1.5.2) */ |
|---|
| 50 | +/* Entity Identifier (UDF 2.60 2.1.5) */ |
|---|
| 51 | +/* Identifiers (UDF 2.60 2.1.5.2) */ |
|---|
| 52 | +/* Implementation Use Extended Attribute (UDF 2.60 3.3.4.5) */ |
|---|
| 53 | +/* Virtual Allocation Table (UDF 1.50 2.2.10) */ |
|---|
| 54 | +/* Logical Volume Extended Information (UDF 1.50 Errata, DCN 5003, 3.3.4.5.1.3) */ |
|---|
| 55 | +/* OS2EA (UDF 1.50 3.3.4.5.3.1) */ |
|---|
| 56 | +/* MacUniqueIDTable (UDF 1.50 3.3.4.5.4.3) */ |
|---|
| 57 | +/* MacResourceFork (UDF 1.50 3.3.4.5.4.4) */ |
|---|
| 46 | 58 | #define UDF_ID_DEVELOPER "*Linux UDFFS" |
|---|
| 47 | 59 | #define UDF_ID_COMPLIANT "*OSTA UDF Compliant" |
|---|
| 48 | 60 | #define UDF_ID_LV_INFO "*UDF LV Info" |
|---|
| 49 | 61 | #define UDF_ID_FREE_EA "*UDF FreeEASpace" |
|---|
| 50 | 62 | #define UDF_ID_FREE_APP_EA "*UDF FreeAppEASpace" |
|---|
| 51 | 63 | #define UDF_ID_DVD_CGMS "*UDF DVD CGMS Info" |
|---|
| 64 | +#define UDF_ID_VAT_LVEXTENSION "*UDF VAT LVExtension" |
|---|
| 52 | 65 | #define UDF_ID_OS2_EA "*UDF OS/2 EA" |
|---|
| 53 | 66 | #define UDF_ID_OS2_EA_LENGTH "*UDF OS/2 EALength" |
|---|
| 54 | 67 | #define UDF_ID_MAC_VOLUME "*UDF Mac VolumeInfo" |
|---|
| 55 | 68 | #define UDF_ID_MAC_FINDER "*UDF Mac FinderInfo" |
|---|
| 56 | 69 | #define UDF_ID_MAC_UNIQUE "*UDF Mac UniqueIDTable" |
|---|
| 57 | 70 | #define UDF_ID_MAC_RESOURCE "*UDF Mac ResourceFork" |
|---|
| 71 | +#define UDF_ID_OS400_DIRINFO "*UDF OS/400 DirInfo" |
|---|
| 58 | 72 | #define UDF_ID_VIRTUAL "*UDF Virtual Partition" |
|---|
| 59 | 73 | #define UDF_ID_SPARABLE "*UDF Sparable Partition" |
|---|
| 60 | 74 | #define UDF_ID_ALLOC "*UDF Virtual Alloc Tbl" |
|---|
| 61 | 75 | #define UDF_ID_SPARING "*UDF Sparing Table" |
|---|
| 62 | 76 | #define UDF_ID_METADATA "*UDF Metadata Partition" |
|---|
| 63 | 77 | |
|---|
| 64 | | -/* Identifier Suffix (UDF 2.50 2.1.5.3) */ |
|---|
| 65 | | -#define IS_DF_HARD_WRITE_PROTECT 0x01 |
|---|
| 66 | | -#define IS_DF_SOFT_WRITE_PROTECT 0x02 |
|---|
| 78 | +/* Identifier Suffix (UDF 2.60 2.1.5.3) */ |
|---|
| 79 | +#define DOMAIN_FLAGS_HARD_WRITE_PROTECT 0x01 |
|---|
| 80 | +#define DOMAIN_FLAGS_SOFT_WRITE_PROTECT 0x02 |
|---|
| 81 | + |
|---|
| 82 | +struct domainIdentSuffix { |
|---|
| 83 | + __le16 UDFRevision; |
|---|
| 84 | + uint8_t domainFlags; |
|---|
| 85 | + uint8_t reserved[5]; |
|---|
| 86 | +} __packed; |
|---|
| 67 | 87 | |
|---|
| 68 | 88 | struct UDFIdentSuffix { |
|---|
| 69 | 89 | __le16 UDFRevision; |
|---|
| .. | .. |
|---|
| 75 | 95 | struct impIdentSuffix { |
|---|
| 76 | 96 | uint8_t OSClass; |
|---|
| 77 | 97 | uint8_t OSIdentifier; |
|---|
| 78 | | - uint8_t reserved[6]; |
|---|
| 98 | + uint8_t impUse[6]; |
|---|
| 79 | 99 | } __packed; |
|---|
| 80 | 100 | |
|---|
| 81 | 101 | struct appIdentSuffix { |
|---|
| 82 | 102 | uint8_t impUse[8]; |
|---|
| 83 | 103 | } __packed; |
|---|
| 84 | 104 | |
|---|
| 85 | | -/* Logical Volume Integrity Descriptor (UDF 2.50 2.2.6) */ |
|---|
| 86 | | -/* Implementation Use (UDF 2.50 2.2.6.4) */ |
|---|
| 105 | +/* Logical Volume Integrity Descriptor (UDF 2.60 2.2.6) */ |
|---|
| 106 | +/* Implementation Use (UDF 2.60 2.2.6.4) */ |
|---|
| 87 | 107 | struct logicalVolIntegrityDescImpUse { |
|---|
| 88 | 108 | struct regid impIdent; |
|---|
| 89 | 109 | __le32 numFiles; |
|---|
| .. | .. |
|---|
| 94 | 114 | uint8_t impUse[0]; |
|---|
| 95 | 115 | } __packed; |
|---|
| 96 | 116 | |
|---|
| 97 | | -/* Implementation Use Volume Descriptor (UDF 2.50 2.2.7) */ |
|---|
| 98 | | -/* Implementation Use (UDF 2.50 2.2.7.2) */ |
|---|
| 117 | +/* Implementation Use Volume Descriptor (UDF 2.60 2.2.7) */ |
|---|
| 118 | +/* Implementation Use (UDF 2.60 2.2.7.2) */ |
|---|
| 99 | 119 | struct impUseVolDescImpUse { |
|---|
| 100 | 120 | struct charspec LVICharset; |
|---|
| 101 | 121 | dstring logicalVolIdent[128]; |
|---|
| .. | .. |
|---|
| 115 | 135 | __le16 partitionNum; |
|---|
| 116 | 136 | } __packed; |
|---|
| 117 | 137 | |
|---|
| 118 | | -/* Virtual Partition Map (UDF 2.50 2.2.8) */ |
|---|
| 138 | +/* Virtual Partition Map (UDF 2.60 2.2.8) */ |
|---|
| 119 | 139 | struct virtualPartitionMap { |
|---|
| 120 | 140 | uint8_t partitionMapType; |
|---|
| 121 | 141 | uint8_t partitionMapLength; |
|---|
| .. | .. |
|---|
| 126 | 146 | uint8_t reserved2[24]; |
|---|
| 127 | 147 | } __packed; |
|---|
| 128 | 148 | |
|---|
| 129 | | -/* Sparable Partition Map (UDF 2.50 2.2.9) */ |
|---|
| 149 | +/* Sparable Partition Map (UDF 2.60 2.2.9) */ |
|---|
| 130 | 150 | struct sparablePartitionMap { |
|---|
| 131 | 151 | uint8_t partitionMapType; |
|---|
| 132 | 152 | uint8_t partitionMapLength; |
|---|
| .. | .. |
|---|
| 141 | 161 | __le32 locSparingTable[4]; |
|---|
| 142 | 162 | } __packed; |
|---|
| 143 | 163 | |
|---|
| 144 | | -/* Metadata Partition Map (UDF 2.4.0 2.2.10) */ |
|---|
| 164 | +/* Metadata Partition Map (UDF 2.60 2.2.10) */ |
|---|
| 145 | 165 | struct metadataPartitionMap { |
|---|
| 146 | 166 | uint8_t partitionMapType; |
|---|
| 147 | 167 | uint8_t partitionMapLength; |
|---|
| .. | .. |
|---|
| 160 | 180 | |
|---|
| 161 | 181 | /* Virtual Allocation Table (UDF 1.5 2.2.10) */ |
|---|
| 162 | 182 | struct virtualAllocationTable15 { |
|---|
| 163 | | - __le32 VirtualSector[0]; |
|---|
| 183 | + __le32 vatEntry[0]; |
|---|
| 164 | 184 | struct regid vatIdent; |
|---|
| 165 | 185 | __le32 previousVATICBLoc; |
|---|
| 166 | 186 | } __packed; |
|---|
| 167 | 187 | |
|---|
| 168 | 188 | #define ICBTAG_FILE_TYPE_VAT15 0x00U |
|---|
| 169 | 189 | |
|---|
| 170 | | -/* Virtual Allocation Table (UDF 2.50 2.2.11) */ |
|---|
| 190 | +/* Virtual Allocation Table (UDF 2.60 2.2.11) */ |
|---|
| 171 | 191 | struct virtualAllocationTable20 { |
|---|
| 172 | 192 | __le16 lengthHeader; |
|---|
| 173 | 193 | __le16 lengthImpUse; |
|---|
| .. | .. |
|---|
| 175 | 195 | __le32 previousVATICBLoc; |
|---|
| 176 | 196 | __le32 numFiles; |
|---|
| 177 | 197 | __le32 numDirs; |
|---|
| 178 | | - __le16 minReadRevision; |
|---|
| 179 | | - __le16 minWriteRevision; |
|---|
| 180 | | - __le16 maxWriteRevision; |
|---|
| 198 | + __le16 minUDFReadRev; |
|---|
| 199 | + __le16 minUDFWriteRev; |
|---|
| 200 | + __le16 maxUDFWriteRev; |
|---|
| 181 | 201 | __le16 reserved; |
|---|
| 182 | 202 | uint8_t impUse[0]; |
|---|
| 183 | 203 | __le32 vatEntry[0]; |
|---|
| .. | .. |
|---|
| 185 | 205 | |
|---|
| 186 | 206 | #define ICBTAG_FILE_TYPE_VAT20 0xF8U |
|---|
| 187 | 207 | |
|---|
| 188 | | -/* Sparing Table (UDF 2.50 2.2.12) */ |
|---|
| 208 | +/* Sparing Table (UDF 2.60 2.2.12) */ |
|---|
| 189 | 209 | struct sparingEntry { |
|---|
| 190 | 210 | __le32 origLocation; |
|---|
| 191 | 211 | __le32 mappedLocation; |
|---|
| .. | .. |
|---|
| 201 | 221 | mapEntry[0]; |
|---|
| 202 | 222 | } __packed; |
|---|
| 203 | 223 | |
|---|
| 204 | | -/* Metadata File (and Metadata Mirror File) (UDF 2.50 2.2.13.1) */ |
|---|
| 224 | +/* Metadata File (and Metadata Mirror File) (UDF 2.60 2.2.13.1) */ |
|---|
| 205 | 225 | #define ICBTAG_FILE_TYPE_MAIN 0xFA |
|---|
| 206 | 226 | #define ICBTAG_FILE_TYPE_MIRROR 0xFB |
|---|
| 207 | 227 | #define ICBTAG_FILE_TYPE_BITMAP 0xFC |
|---|
| 208 | 228 | |
|---|
| 209 | | -/* struct struct long_ad ICB - ADImpUse (UDF 2.50 2.2.4.3) */ |
|---|
| 229 | +/* struct long_ad ICB - ADImpUse (UDF 2.60 2.2.4.3) */ |
|---|
| 210 | 230 | struct allocDescImpUse { |
|---|
| 211 | 231 | __le16 flags; |
|---|
| 212 | 232 | uint8_t impUse[4]; |
|---|
| .. | .. |
|---|
| 214 | 234 | |
|---|
| 215 | 235 | #define AD_IU_EXT_ERASED 0x0001 |
|---|
| 216 | 236 | |
|---|
| 217 | | -/* Real-Time Files (UDF 2.50 6.11) */ |
|---|
| 237 | +/* Real-Time Files (UDF 2.60 6.11) */ |
|---|
| 218 | 238 | #define ICBTAG_FILE_TYPE_REALTIME 0xF9U |
|---|
| 219 | 239 | |
|---|
| 220 | | -/* Implementation Use Extended Attribute (UDF 2.50 3.3.4.5) */ |
|---|
| 221 | | -/* FreeEASpace (UDF 2.50 3.3.4.5.1.1) */ |
|---|
| 240 | +/* Implementation Use Extended Attribute (UDF 2.60 3.3.4.5) */ |
|---|
| 241 | +/* FreeEASpace (UDF 2.60 3.3.4.5.1.1) */ |
|---|
| 222 | 242 | struct freeEaSpace { |
|---|
| 223 | 243 | __le16 headerChecksum; |
|---|
| 224 | 244 | uint8_t freeEASpace[0]; |
|---|
| 225 | 245 | } __packed; |
|---|
| 226 | 246 | |
|---|
| 227 | | -/* DVD Copyright Management Information (UDF 2.50 3.3.4.5.1.2) */ |
|---|
| 247 | +/* DVD Copyright Management Information (UDF 2.60 3.3.4.5.1.2) */ |
|---|
| 228 | 248 | struct DVDCopyrightImpUse { |
|---|
| 229 | 249 | __le16 headerChecksum; |
|---|
| 230 | 250 | uint8_t CGMSInfo; |
|---|
| .. | .. |
|---|
| 232 | 252 | uint8_t protectionSystemInfo[4]; |
|---|
| 233 | 253 | } __packed; |
|---|
| 234 | 254 | |
|---|
| 235 | | -/* Application Use Extended Attribute (UDF 2.50 3.3.4.6) */ |
|---|
| 236 | | -/* FreeAppEASpace (UDF 2.50 3.3.4.6.1) */ |
|---|
| 255 | +/* Logical Volume Extended Information (UDF 1.50 Errata, DCN 5003, 3.3.4.5.1.3) */ |
|---|
| 256 | +struct LVExtensionEA { |
|---|
| 257 | + __le16 headerChecksum; |
|---|
| 258 | + __le64 verificationID; |
|---|
| 259 | + __le32 numFiles; |
|---|
| 260 | + __le32 numDirs; |
|---|
| 261 | + dstring logicalVolIdent[128]; |
|---|
| 262 | +} __packed; |
|---|
| 263 | + |
|---|
| 264 | +/* Application Use Extended Attribute (UDF 2.60 3.3.4.6) */ |
|---|
| 265 | +/* FreeAppEASpace (UDF 2.60 3.3.4.6.1) */ |
|---|
| 237 | 266 | struct freeAppEASpace { |
|---|
| 238 | 267 | __le16 headerChecksum; |
|---|
| 239 | 268 | uint8_t freeEASpace[0]; |
|---|
| 240 | 269 | } __packed; |
|---|
| 241 | 270 | |
|---|
| 242 | | -/* UDF Defined System Stream (UDF 2.50 3.3.7) */ |
|---|
| 271 | +/* UDF Defined System Stream (UDF 2.60 3.3.7) */ |
|---|
| 243 | 272 | #define UDF_ID_UNIQUE_ID "*UDF Unique ID Mapping Data" |
|---|
| 244 | 273 | #define UDF_ID_NON_ALLOC "*UDF Non-Allocatable Space" |
|---|
| 245 | 274 | #define UDF_ID_POWER_CAL "*UDF Power Cal Table" |
|---|
| 246 | 275 | #define UDF_ID_BACKUP "*UDF Backup" |
|---|
| 247 | 276 | |
|---|
| 248 | | -/* Operating System Identifiers (UDF 2.50 6.3) */ |
|---|
| 277 | +/* UDF Defined Non-System Streams (UDF 2.60 3.3.8) */ |
|---|
| 278 | +#define UDF_ID_MAC_RESOURCE_FORK_STREAM "*UDF Macintosh Resource Fork" |
|---|
| 279 | +/* #define UDF_ID_OS2_EA "*UDF OS/2 EA" */ |
|---|
| 280 | +#define UDF_ID_NT_ACL "*UDF NT ACL" |
|---|
| 281 | +#define UDF_ID_UNIX_ACL "*UDF UNIX ACL" |
|---|
| 282 | + |
|---|
| 283 | +/* Operating System Identifiers (UDF 2.60 6.3) */ |
|---|
| 249 | 284 | #define UDF_OS_CLASS_UNDEF 0x00U |
|---|
| 250 | 285 | #define UDF_OS_CLASS_DOS 0x01U |
|---|
| 251 | 286 | #define UDF_OS_CLASS_OS2 0x02U |
|---|
| .. | .. |
|---|
| 270 | 305 | #define UDF_OS_ID_LINUX 0x05U |
|---|
| 271 | 306 | #define UDF_OS_ID_MKLINUX 0x06U |
|---|
| 272 | 307 | #define UDF_OS_ID_FREEBSD 0x07U |
|---|
| 308 | +#define UDF_OS_ID_NETBSD 0x08U |
|---|
| 273 | 309 | #define UDF_OS_ID_WIN9X 0x00U |
|---|
| 274 | 310 | #define UDF_OS_ID_WINNT 0x00U |
|---|
| 275 | 311 | #define UDF_OS_ID_OS400 0x00U |
|---|