Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * osta_udf.h
0003  *
0004  * This file is based on OSTA UDF(tm) 2.60 (March 1, 2005)
0005  * http://www.osta.org
0006  *
0007  * Copyright (c) 2001-2004  Ben Fennema
0008  * Copyright (c) 2017-2019  Pali Rohár <pali@kernel.org>
0009  * All rights reserved.
0010  *
0011  * Redistribution and use in source and binary forms, with or without
0012  * modification, are permitted provided that the following conditions
0013  * are met:
0014  * 1. Redistributions of source code must retain the above copyright
0015  *    notice, this list of conditions, and the following disclaimer,
0016  *    without modification.
0017  * 2. The name of the author may not be used to endorse or promote products
0018  *    derived from this software without specific prior written permission.
0019  *
0020  * Alternatively, this software may be distributed under the terms of the
0021  * GNU Public License ("GPL").
0022  *
0023  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
0024  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0025  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0026  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
0027  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
0028  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
0029  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
0030  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
0031  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
0032  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
0033  * SUCH DAMAGE.
0034  */
0035 
0036 /**
0037  * @file
0038  * OSTA-UDF defines and structure definitions
0039  */
0040 
0041 #include "ecma_167.h"
0042 
0043 #ifndef _OSTA_UDF_H
0044 #define _OSTA_UDF_H 1
0045 
0046 /* OSTA CS0 Charspec (UDF 2.60 2.1.2) */
0047 #define UDF_CHAR_SET_TYPE       0
0048 #define UDF_CHAR_SET_INFO       "OSTA Compressed Unicode"
0049 
0050 /* Entity Identifier (UDF 2.60 2.1.5) */
0051 /* Identifiers (UDF 2.60 2.1.5.2) */
0052 /* Implementation Use Extended Attribute (UDF 2.60 3.3.4.5) */
0053 /* Virtual Allocation Table (UDF 1.50 2.2.10) */
0054 /* Logical Volume Extended Information (UDF 1.50 Errata, DCN 5003, 3.3.4.5.1.3) */
0055 /* OS2EA (UDF 1.50 3.3.4.5.3.1) */
0056 /* MacUniqueIDTable (UDF 1.50 3.3.4.5.4.3) */
0057 /* MacResourceFork (UDF 1.50 3.3.4.5.4.4) */
0058 #define UDF_ID_DEVELOPER        "*Linux UDFFS"
0059 #define UDF_ID_COMPLIANT        "*OSTA UDF Compliant"
0060 #define UDF_ID_LV_INFO          "*UDF LV Info"
0061 #define UDF_ID_FREE_EA          "*UDF FreeEASpace"
0062 #define UDF_ID_FREE_APP_EA      "*UDF FreeAppEASpace"
0063 #define UDF_ID_DVD_CGMS         "*UDF DVD CGMS Info"
0064 #define UDF_ID_VAT_LVEXTENSION      "*UDF VAT LVExtension"
0065 #define UDF_ID_OS2_EA           "*UDF OS/2 EA"
0066 #define UDF_ID_OS2_EA_LENGTH        "*UDF OS/2 EALength"
0067 #define UDF_ID_MAC_VOLUME       "*UDF Mac VolumeInfo"
0068 #define UDF_ID_MAC_FINDER       "*UDF Mac FinderInfo"
0069 #define UDF_ID_MAC_UNIQUE       "*UDF Mac UniqueIDTable"
0070 #define UDF_ID_MAC_RESOURCE     "*UDF Mac ResourceFork"
0071 #define UDF_ID_OS400_DIRINFO        "*UDF OS/400 DirInfo"
0072 #define UDF_ID_VIRTUAL          "*UDF Virtual Partition"
0073 #define UDF_ID_SPARABLE         "*UDF Sparable Partition"
0074 #define UDF_ID_ALLOC            "*UDF Virtual Alloc Tbl"
0075 #define UDF_ID_SPARING          "*UDF Sparing Table"
0076 #define UDF_ID_METADATA         "*UDF Metadata Partition"
0077 
0078 /* Identifier Suffix (UDF 2.60 2.1.5.3) */
0079 #define DOMAIN_FLAGS_HARD_WRITE_PROTECT 0x01
0080 #define DOMAIN_FLAGS_SOFT_WRITE_PROTECT 0x02
0081 
0082 struct domainIdentSuffix {
0083     __le16      UDFRevision;
0084     uint8_t     domainFlags;
0085     uint8_t     reserved[5];
0086 } __packed;
0087 
0088 struct UDFIdentSuffix {
0089     __le16      UDFRevision;
0090     uint8_t     OSClass;
0091     uint8_t     OSIdentifier;
0092     uint8_t     reserved[4];
0093 } __packed;
0094 
0095 struct impIdentSuffix {
0096     uint8_t     OSClass;
0097     uint8_t     OSIdentifier;
0098     uint8_t     impUse[6];
0099 } __packed;
0100 
0101 struct appIdentSuffix {
0102     uint8_t     impUse[8];
0103 } __packed;
0104 
0105 /* Logical Volume Integrity Descriptor (UDF 2.60 2.2.6) */
0106 /* Implementation Use (UDF 2.60 2.2.6.4) */
0107 struct logicalVolIntegrityDescImpUse {
0108     struct regid    impIdent;
0109     __le32      numFiles;
0110     __le32      numDirs;
0111     __le16      minUDFReadRev;
0112     __le16      minUDFWriteRev;
0113     __le16      maxUDFWriteRev;
0114     uint8_t     impUse[];
0115 } __packed;
0116 
0117 /* Implementation Use Volume Descriptor (UDF 2.60 2.2.7) */
0118 /* Implementation Use (UDF 2.60 2.2.7.2) */
0119 struct impUseVolDescImpUse {
0120     struct charspec LVICharset;
0121     dstring     logicalVolIdent[128];
0122     dstring     LVInfo1[36];
0123     dstring     LVInfo2[36];
0124     dstring     LVInfo3[36];
0125     struct regid    impIdent;
0126     uint8_t     impUse[128];
0127 } __packed;
0128 
0129 struct udfPartitionMap2 {
0130     uint8_t     partitionMapType;
0131     uint8_t     partitionMapLength;
0132     uint8_t     reserved1[2];
0133     struct regid    partIdent;
0134     __le16      volSeqNum;
0135     __le16      partitionNum;
0136 } __packed;
0137 
0138 /* Virtual Partition Map (UDF 2.60 2.2.8) */
0139 struct virtualPartitionMap {
0140     uint8_t     partitionMapType;
0141     uint8_t     partitionMapLength;
0142     uint8_t     reserved1[2];
0143     struct regid    partIdent;
0144     __le16      volSeqNum;
0145     __le16      partitionNum;
0146     uint8_t     reserved2[24];
0147 } __packed;
0148 
0149 /* Sparable Partition Map (UDF 2.60 2.2.9) */
0150 struct sparablePartitionMap {
0151     uint8_t partitionMapType;
0152     uint8_t partitionMapLength;
0153     uint8_t reserved1[2];
0154     struct regid partIdent;
0155     __le16 volSeqNum;
0156     __le16 partitionNum;
0157     __le16 packetLength;
0158     uint8_t numSparingTables;
0159     uint8_t reserved2[1];
0160     __le32 sizeSparingTable;
0161     __le32 locSparingTable[4];
0162 } __packed;
0163 
0164 /* Metadata Partition Map (UDF 2.60 2.2.10) */
0165 struct metadataPartitionMap {
0166     uint8_t     partitionMapType;
0167     uint8_t     partitionMapLength;
0168     uint8_t     reserved1[2];
0169     struct regid    partIdent;
0170     __le16      volSeqNum;
0171     __le16      partitionNum;
0172     __le32      metadataFileLoc;
0173     __le32      metadataMirrorFileLoc;
0174     __le32      metadataBitmapFileLoc;
0175     __le32      allocUnitSize;
0176     __le16      alignUnitSize;
0177     uint8_t     flags;
0178     uint8_t     reserved2[5];
0179 } __packed;
0180 
0181 /* Virtual Allocation Table (UDF 2.60 2.2.11) */
0182 struct virtualAllocationTable20 {
0183     __le16      lengthHeader;
0184     __le16      lengthImpUse;
0185     dstring     logicalVolIdent[128];
0186     __le32      previousVATICBLoc;
0187     __le32      numFiles;
0188     __le32      numDirs;
0189     __le16      minUDFReadRev;
0190     __le16      minUDFWriteRev;
0191     __le16      maxUDFWriteRev;
0192     __le16      reserved;
0193     uint8_t     impUse[];
0194     /* __le32   vatEntry[]; */
0195 } __packed;
0196 
0197 #define ICBTAG_FILE_TYPE_VAT20      0xF8U
0198 
0199 /* Sparing Table (UDF 2.60 2.2.12) */
0200 struct sparingEntry {
0201     __le32      origLocation;
0202     __le32      mappedLocation;
0203 } __packed;
0204 
0205 struct sparingTable {
0206     struct tag  descTag;
0207     struct regid    sparingIdent;
0208     __le16      reallocationTableLen;
0209     __le16      reserved;
0210     __le32      sequenceNum;
0211     struct sparingEntry mapEntry[];
0212 } __packed;
0213 
0214 /* Metadata File (and Metadata Mirror File) (UDF 2.60 2.2.13.1) */
0215 #define ICBTAG_FILE_TYPE_MAIN       0xFA
0216 #define ICBTAG_FILE_TYPE_MIRROR     0xFB
0217 #define ICBTAG_FILE_TYPE_BITMAP     0xFC
0218 
0219 /* struct long_ad ICB - ADImpUse (UDF 2.60 2.2.4.3) */
0220 struct allocDescImpUse {
0221     __le16      flags;
0222     uint8_t     impUse[4];
0223 } __packed;
0224 
0225 #define AD_IU_EXT_ERASED        0x0001
0226 
0227 /* Real-Time Files (UDF 2.60 6.11) */
0228 #define ICBTAG_FILE_TYPE_REALTIME   0xF9U
0229 
0230 /* Implementation Use Extended Attribute (UDF 2.60 3.3.4.5) */
0231 /* FreeEASpace (UDF 2.60 3.3.4.5.1.1) */
0232 struct freeEaSpace {
0233     __le16      headerChecksum;
0234     uint8_t     freeEASpace[];
0235 } __packed;
0236 
0237 /* DVD Copyright Management Information (UDF 2.60 3.3.4.5.1.2) */
0238 struct DVDCopyrightImpUse {
0239     __le16      headerChecksum;
0240     uint8_t     CGMSInfo;
0241     uint8_t     dataType;
0242     uint8_t     protectionSystemInfo[4];
0243 } __packed;
0244 
0245 /* Logical Volume Extended Information (UDF 1.50 Errata, DCN 5003, 3.3.4.5.1.3) */
0246 struct LVExtensionEA {
0247     __le16      headerChecksum;
0248     __le64      verificationID;
0249     __le32      numFiles;
0250     __le32      numDirs;
0251     dstring     logicalVolIdent[128];
0252 } __packed;
0253 
0254 /* Application Use Extended Attribute (UDF 2.60 3.3.4.6) */
0255 /* FreeAppEASpace (UDF 2.60 3.3.4.6.1) */
0256 struct freeAppEASpace {
0257     __le16      headerChecksum;
0258     uint8_t     freeEASpace[];
0259 } __packed;
0260 
0261 /* UDF Defined System Stream (UDF 2.60 3.3.7) */
0262 #define UDF_ID_UNIQUE_ID        "*UDF Unique ID Mapping Data"
0263 #define UDF_ID_NON_ALLOC        "*UDF Non-Allocatable Space"
0264 #define UDF_ID_POWER_CAL        "*UDF Power Cal Table"
0265 #define UDF_ID_BACKUP           "*UDF Backup"
0266 
0267 /* UDF Defined Non-System Streams (UDF 2.60 3.3.8) */
0268 #define UDF_ID_MAC_RESOURCE_FORK_STREAM "*UDF Macintosh Resource Fork"
0269 /* #define UDF_ID_OS2_EA        "*UDF OS/2 EA" */
0270 #define UDF_ID_NT_ACL           "*UDF NT ACL"
0271 #define UDF_ID_UNIX_ACL         "*UDF UNIX ACL"
0272 
0273 /* Operating System Identifiers (UDF 2.60 6.3) */
0274 #define UDF_OS_CLASS_UNDEF      0x00U
0275 #define UDF_OS_CLASS_DOS        0x01U
0276 #define UDF_OS_CLASS_OS2        0x02U
0277 #define UDF_OS_CLASS_MAC        0x03U
0278 #define UDF_OS_CLASS_UNIX       0x04U
0279 #define UDF_OS_CLASS_WIN9X      0x05U
0280 #define UDF_OS_CLASS_WINNT      0x06U
0281 #define UDF_OS_CLASS_OS400      0x07U
0282 #define UDF_OS_CLASS_BEOS       0x08U
0283 #define UDF_OS_CLASS_WINCE      0x09U
0284 
0285 #define UDF_OS_ID_UNDEF         0x00U
0286 #define UDF_OS_ID_DOS           0x00U
0287 #define UDF_OS_ID_OS2           0x00U
0288 #define UDF_OS_ID_MAC           0x00U
0289 #define UDF_OS_ID_MAX_OSX       0x01U
0290 #define UDF_OS_ID_UNIX          0x00U
0291 #define UDF_OS_ID_AIX           0x01U
0292 #define UDF_OS_ID_SOLARIS       0x02U
0293 #define UDF_OS_ID_HPUX          0x03U
0294 #define UDF_OS_ID_IRIX          0x04U
0295 #define UDF_OS_ID_LINUX         0x05U
0296 #define UDF_OS_ID_MKLINUX       0x06U
0297 #define UDF_OS_ID_FREEBSD       0x07U
0298 #define UDF_OS_ID_NETBSD        0x08U
0299 #define UDF_OS_ID_WIN9X         0x00U
0300 #define UDF_OS_ID_WINNT         0x00U
0301 #define UDF_OS_ID_OS400         0x00U
0302 #define UDF_OS_ID_BEOS          0x00U
0303 #define UDF_OS_ID_WINCE         0x00U
0304 
0305 #endif /* _OSTA_UDF_H */