Changeset 68397 in vbox
- Timestamp:
- Aug 11, 2017 2:47:48 PM (7 years ago)
- File:
-
- 1 edited
-
trunk/include/iprt/formats/udf.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/formats/udf.h
r68385 r68397 139 139 * UDF long allocation descriptor (@ecma167{4,14.14.2,116}). 140 140 */ 141 #pragma pack(2) 141 142 typedef struct UDFLONGAD 142 143 { … … 155 156 UDFLBADDR Location; 156 157 /** Implementation use area. */ 157 uint8_t abImplementationUse[6]; 158 union 159 { 160 /** Generic view. */ 161 uint8_t ab[6]; 162 /** Used in FIDs. 163 * See @udf260{2.3.10.1,66}, @udf260{2.3.4.3,58}. 164 */ 165 struct 166 { 167 /** Flags (UDF_AD_IMP_USE_FLAGS_XXX). */ 168 uint16_t fFlags; 169 /** Unique ID. */ 170 uint32_t idUnique; 171 } Fid; 172 } ImplementationUse; 158 173 } UDFLONGAD; 174 #pragma pack() 159 175 AssertCompileSize(UDFLONGAD, 16); 160 176 /** Pointer to an UDF long allocation descriptor. */ … … 162 178 /** Pointer to a const UDF long allocation descriptor. */ 163 179 typedef UDFLONGAD const *PCUDFLONGAD; 180 181 /** @name UDF_AD_IMP_USE_FLAGS_XXX - UDFLONGAD::ImplementationUse::Fid::fFlags values 182 * See @udf260{2.3.10.1,66}. 183 * @{ */ 184 /** Set if erased and the extend is of the type UDF_AD_TYPE_ONLY_ALLOCATED. */ 185 #define UDF_AD_IMP_USE_FLAGS_ERASED UINT16_C(0x0001) 186 /** Valid mask. */ 187 #define UDF_AD_IMP_USE_FLAGS_VALID_MASK UINT16_C(0x0001) 188 /** @} */ 164 189 165 190 /** … … 471 496 /** @name UDF_TAG_ID_XXX - UDF descriptor tag IDs. 472 497 * @{ */ 473 #define UDF_TAG_ID_PRIMARY_VOL_DESC UINT16_C(0x0001) 498 #define UDF_TAG_ID_PRIMARY_VOL_DESC UINT16_C(0x0001) /**< UDFPRIMARYVOLUMEDESC */ 474 499 #define UDF_TAG_ID_ANCHOR_VOLUME_DESC_PTR UINT16_C(0x0002) /**< UDFANCHORVOLUMEDESCPTR */ 475 #define UDF_TAG_ID_VOLUME_DESC_PTR UINT16_C(0x0003) 476 #define UDF_TAG_ID_IMPLEMENATION_USE_VOLUME_DESC UINT16_C(0x0004) 477 #define UDF_TAG_ID_PARTITION_DESC UINT16_C(0x0005) 478 #define UDF_TAG_ID_LOGICAL_VOLUME_DESC UINT16_C(0x0006) 479 #define UDF_TAG_ID_UNALLOCATED_SPACE_DESC UINT16_C(0x0007) 480 #define UDF_TAG_ID_TERMINATING_DESC UINT16_C(0x0008) 481 #define UDF_TAG_ID_LOGICAL_VOLUME_INTEGRITY_DESC UINT16_C(0x0009) 500 #define UDF_TAG_ID_VOLUME_DESC_PTR UINT16_C(0x0003) /**< UDFVOLUMEDESCPTR */ 501 #define UDF_TAG_ID_IMPLEMENATION_USE_VOLUME_DESC UINT16_C(0x0004) /**< UDFIMPLEMENTATIONUSEVOLUMEDESC */ 502 #define UDF_TAG_ID_PARTITION_DESC UINT16_C(0x0005) /**< UDFPARTITIONDESC */ 503 #define UDF_TAG_ID_LOGICAL_VOLUME_DESC UINT16_C(0x0006) /**< UDFLOGICALVOLUMEDESC */ 504 #define UDF_TAG_ID_UNALLOCATED_SPACE_DESC UINT16_C(0x0007) /**< UDFUNALLOCATEDSPACEDESC */ 505 #define UDF_TAG_ID_TERMINATING_DESC UINT16_C(0x0008) /**< UDFTERMINATINGDESC */ 506 #define UDF_TAG_ID_LOGICAL_VOLUME_INTEGRITY_DESC UINT16_C(0x0009) /**< UDFLOGICALVOLINTEGRITYDESC */ 507 #define UDF_TAG_ID_FILE_SET_DESC UINT16_C(0x0100) 508 #define UDF_TAG_ID_FILE_ID_DESC UINT16_C(0x0101) 509 #define UDF_TAG_ID_ALLOCATION_EXTENT_DESC UINT16_C(0x0102) 510 #define UDF_TAG_ID_INDIRECT_ENTRY UINT16_C(0x0103) 511 #define UDF_TAG_ID_TERMINAL_ENTRY UINT16_C(0x0104) 512 #define UDF_TAG_ID_FILE_ENTRY UINT16_C(0x0105) 513 #define UDF_TAG_ID_EXTENDED_ATTRIB_HDR_DESC UINT16_C(0x0106) 514 #define UDF_TAG_ID_UNALLOCATED_SPACE_ENTRY UINT16_C(0x0107) 515 #define UDF_TAG_ID_SPACE_BITMAP_DESC UINT16_C(0x0108) 516 #define UDF_TAG_ID_PARTITION_INTEGERITY_DESC UINT16_C(0x0109) 517 #define UDF_TAG_ID_EXTENDED_FILE_ENTRY UINT16_C(0x010a) 482 518 /** @} */ 483 519 … … 815 851 816 852 /** 817 * UDF terminating descriptor (@ecma167{3,10.9,62} ).853 * UDF terminating descriptor (@ecma167{3,10.9,62}, @ecma167{4,14.2,62}). 818 854 */ 819 855 typedef struct UDFTERMINATINGDESC … … 869 905 #define UDF_LVID_TYPE_CLOSE UINT32_C(0x00000001) 870 906 /** @} */ 907 908 /** 909 * UDF file set descriptor (FSD) (@ecma167{4,14.1,86}, @udf260{2.3.2,54}). 910 */ 911 typedef struct UDFFILESETDESC 912 { 913 /** 0x000: The descriptor tag (UDF_TAG_ID_FILE_SET_DESC). */ 914 UDFTAG Tag; 915 /** 0x010: Recording timestamp. */ 916 UDFTIMESTAMP RecordingTimestamp; 917 /** 0x01c: Interchange level. */ 918 uint16_t uInterchangeLevel; 919 /** 0x01e: Maximum interchange level. */ 920 uint16_t uMaxInterchangeLevel; 921 /** 0x020: Character set bitmask (aka list). Each bit correspond to a 922 * character set number. */ 923 uint32_t fCharacterSets; 924 /** 0x024: Maximum character set bitmask (aka list). */ 925 uint32_t fMaxCharacterSets; 926 /** 0x028: File set number. */ 927 uint32_t uFileSetNo; 928 /** 0x02c: File set descriptor number. */ 929 uint32_t uFileSetDescNo; 930 /** 0x030: Logical volume identifier character set. */ 931 UDFCHARSPEC LogicalVolumeIDCharSet; 932 /** 0x070: Logical volume identifier string. */ 933 UDFDSTRING achLogicalVolumeID[128]; 934 /** 0x0e0: File set character set. */ 935 UDFCHARSPEC FileSetCharSet; 936 /** 0x130: Identifier string for this file set. */ 937 UDFDSTRING achFileSetID[32]; 938 /** 0x150: Names a root file containing copyright info. Optional. */ 939 UDFDSTRING achCopyrightFile[32]; 940 /** 0x170: Names a root file containing an abstract for the file set. Optional. */ 941 UDFDSTRING achAbstractFile[32]; 942 /** 0x190: Root directory information control block location (ICB). 943 * An ICB is a sequence made up of UDF_TAG_ID_FILE_ENTRY, 944 * UDF_TAG_ID_INDIRECT_ENTRY, and UDF_TAG_ID_TERMINAL_ENTRY descriptors. */ 945 UDFLONGAD RootDirIcb; 946 /** 0x1a0: Domain identifier (UDF_ENTITY_FSD_LVD_DOMAIN). Optional. */ 947 UDFENTITYID idDomain; 948 /** 0x1c0: Next location with file set descriptors location, 0 if none. */ 949 UDFLONGAD NextExtent; 950 /** 0x1d0: Location of the system stream directory associated with the 951 * file set. Optional. */ 952 UDFLONGAD SystemStreamDirIcb; 953 /** 0x1e0: Reserved, MBZ. */ 954 uint8_t abReserved[32]; 955 } UDFFILESETDESC; 956 AssertCompileSize(UDFFILESETDESC, 512); 957 /** Pointer to an UDF file set descriptor. */ 958 typedef UDFFILESETDESC *PUDFFILESETDESC; 959 /** Pointer to a const UDF file set descriptor. */ 960 typedef UDFFILESETDESC const *PCUDFFILESETDESC; 961 962 963 /** 964 * UDF file identifier descriptor (FID) (@ecma167{4,14.4,91}, @udf260{2.3.4,57}). 965 */ 966 typedef struct UDFFILEIDDESC 967 { 968 /** 0x00: The descriptor tag (UDF_TAG_ID_FILE_ID_DESC). */ 969 UDFTAG Tag; 970 /** 0x10: File version number (1..32767). Always set to 1. */ 971 uint16_t uVersion; 972 /** 0x12: File characteristics (UDF_FILE_FLAGS_XXX). */ 973 uint8_t fFlags; 974 /** 0x13: File identifier (name) length. */ 975 uint8_t cbName; 976 /** 0x14: Location of an information control block describing the file. 977 * Can be null if marked deleted. The implementation defined part of 978 * this contains additional flags and a unique ID. */ 979 UDFLONGAD Icb; 980 /** 0x24: Length of implementation use field (in bytes). This can be zero. 981 * 982 * It can be used to prevent the following FID from spanning a block 983 * boundrary, in which case it will be 32 bytes or more, and the it will 984 * start with an UDFENTITYID identifying who last wrote it. 985 * 986 * The latter padding fun is a requirement from write-once media. */ 987 uint16_t cbImplementationUse; 988 /** 0x26: Two variable sized fields followed by padding to make the 989 * actual structure size 4 byte aligned. The first field in an 990 * implementation use field with length given by @a cbImplementationUse. 991 * After that is a d-string field with the name of the file, length 992 * specified by @a cbName. */ 993 uint8_t abImplementationUse[RT_FLEXIBLE_ARRAY]; 994 } UDFFILEIDDESC; 995 AssertCompileMemberOffset(UDFFILEIDDESC, fFlags, 0x12); 996 AssertCompileMemberOffset(UDFFILEIDDESC, cbName, 0x13); 997 AssertCompileMemberOffset(UDFFILEIDDESC, Icb, 0x14); 998 AssertCompileMemberOffset(UDFFILEIDDESC, abImplementationUse, 0x26); 999 /** Pointer to an UDF file set descriptor */ 1000 typedef UDFFILEIDDESC *PUDFFILEIDDESC; 1001 1002 /** Get the pointer to the name field. */ 1003 #define UDFFILEIDDESC_2_NAME(a_pFid) ((char *)(&(a_pFid)->abImplementationUse[(a_pFid)->cbImplementationUse])) 1004 /** Calculates the total size the size of a record. */ 1005 #define UDFFILEIDDESC_CALC_SIZE_EX(cbImplementationUse, cbName) \ 1006 RT_ALIGN_Z(RT_UOFFSETOF(UDFFILEIDDESC, abImplementationUse) + cbImplementationUse + cbName, 4) 1007 /** Gets the actual size of a record. */ 1008 #define UDFFILEIDDESC_GET_SIZE(a_pFid) UDFFILEIDDESC_CALC_SIZE_EX((a_pFid)->cbImplementationUse + (a_pFid)->cbName) 1009 1010 /** @name UDF_FILE_FLAGS_XXX 1011 * @{ */ 1012 /** Existence - Hide the file from the user. */ 1013 #define UDF_FILE_FLAGS_HIDDEN UINT8_C(0x01) 1014 /** Directory - Indicates a directory as apposed to some kind of file or symlink or something (0). */ 1015 #define UDF_FILE_FLAGS_DIRECTORY UINT8_C(0x02) 1016 /** Deleted - Indicate that the file has been deleted. Assoicated descriptors may still be valid, though. */ 1017 #define UDF_FILE_FLAGS_DELETED UINT8_C(0x04) 1018 /** Parent - Indicate the ICB field refers to the parent directory (or mabye 1019 * a file in case of streaming directory). */ 1020 #define UDF_FILE_FLAGS_PARENT UINT8_C(0x08) 1021 /** Metadata - Zero means user data, one means implementation specific metadata. 1022 * Only allowed used in stream directory. */ 1023 #define UDF_FILE_FLAGS_METADATA UINT8_C(0x10) 1024 /** Reserved bits that should be zer. */ 1025 #define UDF_FILE_FLAGS_RESERVED_MASK UINT8_C(0xe0) 1026 /** @} */ 1027 1028 1029 /** 1030 * UDF allocation extent descriptor (@ecma167{4,14.5,93}, @udf256{2.3.11,67}). 1031 */ 1032 typedef struct UDFALLOCATIONEXTENTDESC 1033 { 1034 /** 0x00: The descriptor tag (UDF_TAG_ID_ALLOCATION_EXTENT_DESC). */ 1035 UDFTAG Tag; 1036 /** 0x10: Previous allocation extent location (logical block in current 1037 * partition). */ 1038 uint32_t offPrevExtent; 1039 /** 0x14: Size of the following allocation descriptors (in bytes). */ 1040 uint32_t cbAllocationDescriptors; 1041 /** 0x18: Allocation descriptors. 1042 * @todo verify format... */ 1043 union 1044 { 1045 UDFSHORTAD aShortADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION]; 1046 UDFLONGAD aLongADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION]; 1047 UDFEXTAD aExtADs[RT_FLEXIBLE_ARRAY_IN_NESTED_UNION]; 1048 } u; 1049 } UDFALLOCATIONEXTENTDESC; 1050 AssertCompileMemberOffset(UDFALLOCATIONEXTENTDESC, u, 0x18); 1051 /** Pointer to an UDF allocation extent descriptor. */ 1052 typedef UDFALLOCATIONEXTENTDESC *PUDFALLOCATIONEXTENTDESC; 1053 /** Pointer to a const UDF allocation extent descriptor. */ 1054 typedef UDFALLOCATIONEXTENTDESC const *PCUDFALLOCATIONEXTENTDESC; 1055 1056 /** 1057 * UDF information control block tag (@ecma167{4,14.6,93}, @udf260{2.3.5,60}). 1058 */ 1059 typedef struct UDFICBTAG 1060 { 1061 /** 0x00: Number of direct entries in this ICB prior to this one. */ 1062 uint32_t cEntiresBeforeThis; 1063 /** 0x04: ICB hierarchy building strategy type (UDF_ICB_STRATEGY_TYPE_XXX). */ 1064 uint16_t uStrategyType; 1065 /** 0x06: Type specific parameters. */ 1066 uint8_t abStrategyParams[2]; 1067 /** 0x08: Max number of direct and indirect entries that MAY be recorded in this ICB. */ 1068 uint16_t cMaxEntries; 1069 /** 0x0a: Reserved, MBZ. */ 1070 uint8_t bReserved; 1071 /** 0x0b: File type (UDF_FILE_TYPE_XXX). */ 1072 uint8_t bFileType; 1073 /** 0x0c: Parent ICB location. */ 1074 UDFLBADDR ParentIcb; 1075 /** 0x12: Parent ICB location (UDF_ICB_FLAGS_XXX). */ 1076 uint16_t fFlags; 1077 } UDFICBTAG; 1078 AssertCompileSize(UDFICBTAG, 20); 1079 typedef UDFICBTAG *PUDFICBTAG; 1080 typedef UDFICBTAG const *PCUDFICBTAG; 1081 1082 /** @name UDF_ICB_STRATEGY_TYPE_XXX - ICB hierarchy building strategies 1083 * 1084 * See @ecma167{4,14.6.2,94}, @udf260{6.6,121} 1085 * 1086 * @{ */ 1087 /** Strategy not specified. */ 1088 #define UDF_ICB_STRATEGY_TYPE_NOT_SPECIFIED UINT16_C(0x0000) 1089 /** See @ecma167{4,A.2,129}. */ 1090 #define UDF_ICB_STRATEGY_TYPE_1 UINT16_C(0x0001) 1091 /** See @ecma167{4,A.3,131}. */ 1092 #define UDF_ICB_STRATEGY_TYPE_2 UINT16_C(0x0002) 1093 /** See @ecma167{4,A.4,131}. */ 1094 #define UDF_ICB_STRATEGY_TYPE_3 UINT16_C(0x0003) 1095 /** See @ecma167{4,A.5,131}. */ 1096 #define UDF_ICB_STRATEGY_TYPE_4 UINT16_C(0x0004) 1097 /** Defined by the UDF spec, see @udf260{6.6,121}. */ 1098 #define UDF_ICB_STRATEGY_TYPE_4096 UINT16_C(0x1000) 1099 /** @} */ 1100 1101 /** @name UDF_ICB_FLAGS_XXX - ICB flags 1102 * 1103 * See @ecma167{4,14.6.8,95}, @udf260{2.3.5.4,61} 1104 * 1105 * @{ */ 1106 /** Using UDFSHORTAD. */ 1107 #define UDF_ICB_FLAGS_AD_TYPE_SHORT UINT16_C(0x0000) 1108 /** Using UDFLONGAD. */ 1109 #define UDF_ICB_FLAGS_AD_TYPE_LONG UINT16_C(0x0001) 1110 /** Using UDFEXTAD. */ 1111 #define UDF_ICB_FLAGS_AD_TYPE_EXTENDED UINT16_C(0x0002) 1112 /** Single descriptor. */ 1113 #define UDF_ICB_FLAGS_AD_TYPE_SINGLE UINT16_C(0x0003) 1114 /** Allocation type mask. */ 1115 #define UDF_ICB_FLAGS_AD_TYPE_MASK UINT16_C(0x0007) 1116 /** Set on directories that are sorted (according to @ecma167{4,8.6.1,78}). 1117 * @note Directories are never sorted in UDF. */ 1118 #define UDF_ICB_FLAGS_SORTED_DIRECTORY UINT16_C(0x0008) 1119 /** Not relocatable. */ 1120 #define UDF_ICB_FLAGS_NON_RELOCATABLE UINT16_C(0x0010) 1121 /** Indicate that the file needs backing up (DOS attribute). */ 1122 #define UDF_ICB_FLAGS_ARCHIVE UINT16_C(0x0020) 1123 /** Set UID bit (UNIX). */ 1124 #define UDF_ICB_FLAGS_SET_UID UINT16_C(0x0040) 1125 /** Set GID bit (UNIX). */ 1126 #define UDF_ICB_FLAGS_SET_GID UINT16_C(0x0080) 1127 /** Set sticky bit (UNIX). */ 1128 #define UDF_ICB_FLAGS_STICKY UINT16_C(0x0100) 1129 /** Extents are contiguous. */ 1130 #define UDF_ICB_FLAGS_CONTIGUOUS UINT16_C(0x0200) 1131 /** System bit, reserved for implementation use. */ 1132 #define UDF_ICB_FLAGS_SYSTEM UINT16_C(0x0400) 1133 /** Data has been transformed in some way. 1134 * @note UDF shall not set this bit. */ 1135 #define UDF_ICB_FLAGS_TRANSFORMED UINT16_C(0x0800) 1136 /** Directory may contain multi-versioned files. 1137 * @note UDF shall not set this bit. */ 1138 #define UDF_ICB_FLAGS_MULTI_VERSIONS UINT16_C(0x1000) 1139 /** Is a stream in a stream directory. */ 1140 #define UDF_ICB_FLAGS_STREAM UINT16_C(0x2000) 1141 /** Reserved mask. */ 1142 #define UDF_ICB_FLAGS_RESERVED_MASK UINT16_C(0xc000) 1143 /** @} */ 1144 1145 /** @name UDF_FILE_TYPE_XXX - File types 1146 * 1147 * See @ecma167{4,14.6.6,94}, @udf260{2.3.5.2,60} 1148 * 1149 * @{ */ 1150 #define UDF_FILE_TYPE_NOT_SPECIFIED UINT8_C(0x00) /**< Not specified by this field. */ 1151 #define UDF_FILE_TYPE_UNALLOCATED_SPACE_ENTRY UINT8_C(0x01) 1152 #define UDF_FILE_TYPE_PARTITION_INTEGRITY_ENTRY UINT8_C(0x02) 1153 #define UDF_FILE_TYPE_INDIRECT_ENTRY UINT8_C(0x03) 1154 #define UDF_FILE_TYPE_DIRECTORY UINT8_C(0x04) 1155 #define UDF_FILE_TYPE_REGULAR_FILE UINT8_C(0x05) 1156 #define UDF_FILE_TYPE_BLOCK_DEVICE UINT8_C(0x06) 1157 #define UDF_FILE_TYPE_CHARACTER_DEVICE UINT8_C(0x07) 1158 #define UDF_FILE_TYPE_EXTENDED_ATTRIBUTES UINT8_C(0x08) 1159 #define UDF_FILE_TYPE_FIFO UINT8_C(0x09) 1160 #define UDF_FILE_TYPE_SOCKET UINT8_C(0x0a) 1161 #define UDF_FILE_TYPE_TERMINAL_ENTRY UINT8_C(0x0b) 1162 #define UDF_FILE_TYPE_SYMBOLIC_LINK UINT8_C(0x0c) 1163 #define UDF_FILE_TYPE_STREAM_DIRECTORY UINT8_C(0x0d) 1164 #define UDF_FILE_TYPE_VAT UINT8_C(0xf8) 1165 #define UDF_FILE_TYPE_REAL_TIME_FILE UINT8_C(0xf9) 1166 #define UDF_FILE_TYPE_METADATA_FILE UINT8_C(0xfa) 1167 #define UDF_FILE_TYPE_METADATA_MIRROR_FILE UINT8_C(0xfb) 1168 #define UDF_FILE_TYPE_METADATA_BITMAP_FILE UINT8_C(0xfc) 1169 /** @} */ 1170 1171 1172 /** 1173 * UDF indirect entry (@ecma167{4,14.7,96}). 1174 */ 1175 typedef struct UDFINDIRECTENTRY 1176 { 1177 /** 0x00: The descriptor tag (UDF_TAG_ID_INDIRECT_ENTRY). */ 1178 UDFTAG Tag; 1179 /** 0x10: ICB Tag. */ 1180 UDFICBTAG IcbTag; 1181 /** 0x24: Indirect ICB location. */ 1182 UDFLONGAD IndirectIcb; 1183 } UDFINDIRECTENTRY; 1184 AssertCompileSize(UDFINDIRECTENTRY, 52); 1185 /** Pointer to an UDF indirect entry. */ 1186 typedef UDFINDIRECTENTRY *PUDFINDIRECTENTRY; 1187 /** Pointer to a const UDF indirect entry. */ 1188 typedef UDFINDIRECTENTRY const *PCUDFINDIRECTENTRY; 1189 1190 //#define UDF_TAG_ID_TERMINAL_ENTRY UINT16_C(0x0104) 1191 //#define UDF_TAG_ID_FILE_ENTRY UINT16_C(0x0105) 1192 //#define UDF_TAG_ID_EXTENDED_ATTRIB_HDR_DESC UINT16_C(0x0106) 1193 //#define UDF_TAG_ID_UNALLOCATED_SPACE_ENTRY UINT16_C(0x0107) 1194 //#define UDF_TAG_ID_SPACE_BITMAP_DESC UINT16_C(0x0108) 1195 //#define UDF_TAG_ID_PARTITION_INTEGERITY_DESC UINT16_C(0x0109) 1196 //#define UDF_TAG_ID_EXTENDED_FILE_ENTRY UINT16_C(0x010a) 1197 871 1198 872 1199
Note:
See TracChangeset
for help on using the changeset viewer.

