From 697b755b1e6a8ac0d7e41da1e47cf68a60e9dc8a Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 11 Oct 2025 01:35:43 +0100 Subject: [PATCH] Add doxygen documentation --- docs/html/README_8md.html | 113 + docs/html/aaru_8h.html | 889 ++ docs/html/aaru_8h.js | 586 ++ docs/html/aaru_8h_source.html | 1516 +++ docs/html/aaruformat_8h.html | 169 + docs/html/aaruformat_8h.js | 5 + docs/html/aaruformat_8h_source.html | 154 + docs/html/annotated.html | 158 + docs/html/annotated_dup.js | 52 + docs/html/arm__vmull_8c.html | 115 + docs/html/arm__vmull_8c_source.html | 274 + docs/html/arm__vmull_8h.html | 115 + docs/html/arm__vmull_8h_source.html | 138 + docs/html/blocks_2dump_8c.html | 291 + docs/html/blocks_2dump_8c.js | 7 + docs/html/blocks_2dump_8c_source.html | 517 + docs/html/blocks_2metadata_8c.html | 343 + docs/html/blocks_2metadata_8c.js | 7 + docs/html/blocks_2metadata_8c_source.html | 620 ++ docs/html/checksum_8c.html | 169 + docs/html/checksum_8c.js | 4 + docs/html/checksum_8c_source.html | 325 + docs/html/checksum_8h.html | 179 + docs/html/checksum_8h.js | 7 + docs/html/checksum_8h_source.html | 159 + docs/html/classes.html | 147 + docs/html/clipboard.js | 61 + docs/html/close_8c.html | 2071 ++++ docs/html/close_8c.js | 27 + docs/html/close_8c_source.html | 3119 ++++++ docs/html/consts_8h.html | 438 + docs/html/consts_8h.js | 16 + docs/html/consts_8h_source.html | 159 + docs/html/context_8h.html | 326 + docs/html/context_8h.js | 22 + docs/html/context_8h_source.html | 562 ++ docs/html/cookie.js | 58 + docs/html/crc64_8c.html | 342 + docs/html/crc64_8c.js | 9 + docs/html/crc64_8c_source.html | 269 + docs/html/crc64_8h.html | 229 + docs/html/crc64_8h.js | 7 + docs/html/crc64_8h_source.html | 356 + docs/html/crc64__clmul_8c.html | 115 + docs/html/crc64__clmul_8c_source.html | 324 + docs/html/crc64__vmull_8c.html | 115 + docs/html/crc64__vmull_8c_source.html | 296 + docs/html/create_8c.html | 433 + docs/html/create_8c.js | 5 + docs/html/create_8c_source.html | 601 ++ docs/html/cst_8c.html | 215 + docs/html/cst_8c.js | 5 + docs/html/cst_8c_source.html | 426 + docs/html/data_8c.html | 199 + docs/html/data_8c.js | 4 + docs/html/data_8c_source.html | 579 ++ docs/html/data_8h.html | 179 + docs/html/data_8h.js | 7 + docs/html/data_8h_source.html | 173 + docs/html/ddt_8h.html | 177 + docs/html/ddt_8h.js | 7 + docs/html/ddt_8h_source.html | 204 + docs/html/ddt__v1_8c.html | 313 + docs/html/ddt__v1_8c.js | 5 + docs/html/ddt__v1_8c_source.html | 504 + docs/html/ddt__v2_8c.html | 961 ++ docs/html/ddt__v2_8c.js | 11 + docs/html/ddt__v2_8c_source.html | 1616 +++ docs/html/decls_8h.html | 8858 +++++++++++++++++ docs/html/decls_8h.js | 111 + docs/html/decls_8h_source.html | 486 + .../dir_19ac67bde96fa7098d9c89fb8e36db69.html | 120 + .../dir_19ac67bde96fa7098d9c89fb8e36db69.js | 6 + .../dir_40ed6a89610fc2370cf3ffcd6469b940.html | 120 + .../dir_40ed6a89610fc2370cf3ffcd6469b940.js | 6 + .../dir_6387aeb6e475a334d8dc12d69f21999e.html | 139 + .../dir_6387aeb6e475a334d8dc12d69f21999e.js | 14 + .../dir_68267d1309a1af8e8297ef4c3efbcdba.html | 142 + .../dir_68267d1309a1af8e8297ef4c3efbcdba.js | 23 + .../dir_6b3196bdf3f485a11a190486a5644c9a.html | 123 + .../dir_6b3196bdf3f485a11a190486a5644c9a.js | 9 + .../dir_a6e99c46e07b25cfb1b3942f86972439.html | 120 + .../dir_a6e99c46e07b25cfb1b3942f86972439.js | 6 + .../dir_aeff2545c9dfcfc842fe9d84b123cb31.html | 138 + .../dir_aeff2545c9dfcfc842fe9d84b123cb31.js | 17 + .../dir_b2e0cd1ddd0a904cb261e9b68779deb4.html | 123 + .../dir_b2e0cd1ddd0a904cb261e9b68779deb4.js | 9 + .../dir_b86b57f9d61b104fa8483aa475f863ae.html | 122 + .../dir_b86b57f9d61b104fa8483aa475f863ae.js | 8 + .../dir_d44c64559bbebec7f509842c48db8b23.html | 129 + .../dir_d44c64559bbebec7f509842c48db8b23.js | 11 + docs/html/doxygen.css | 2461 +++++ docs/html/doxygen.svg | 28 + docs/html/doxygen_crawl.html | 1978 ++++ docs/html/dump_8c.html | 560 ++ docs/html/dump_8c.js | 7 + docs/html/dump_8c_source.html | 559 ++ docs/html/dump_8h.html | 195 + docs/html/dump_8h.js | 7 + docs/html/dump_8h_source.html | 175 + docs/html/dynsections.js | 198 + docs/html/ecc__cd_8c.html | 681 ++ docs/html/ecc__cd_8c.js | 13 + docs/html/ecc__cd_8c_source.html | 619 ++ docs/html/endian_8h.html | 190 + docs/html/endian_8h.js | 6 + docs/html/endian_8h_source.html | 199 + docs/html/enums_8h.html | 825 ++ docs/html/enums_8h.js | 168 + docs/html/enums_8h_source.html | 497 + docs/html/errors_8h.html | 931 ++ docs/html/errors_8h.js | 38 + docs/html/errors_8h_source.html | 267 + docs/html/files.html | 190 + docs/html/files_dup.js | 5 + docs/html/flac_8c.html | 492 + docs/html/flac_8c.js | 9 + docs/html/flac_8c_source.html | 392 + docs/html/flac_8h.html | 120 + docs/html/flac_8h.js | 4 + docs/html/flac_8h_source.html | 149 + docs/html/functions.html | 113 + docs/html/functions_b.html | 122 + docs/html/functions_c.html | 141 + docs/html/functions_d.html | 135 + docs/html/functions_dup.js | 25 + docs/html/functions_e.html | 115 + docs/html/functions_f.html | 116 + docs/html/functions_g.html | 108 + docs/html/functions_h.html | 123 + docs/html/functions_i.html | 119 + docs/html/functions_j.html | 108 + docs/html/functions_k.html | 108 + docs/html/functions_l.html | 118 + docs/html/functions_m.html | 142 + docs/html/functions_n.html | 112 + docs/html/functions_o.html | 108 + docs/html/functions_p.html | 113 + docs/html/functions_r.html | 113 + docs/html/functions_s.html | 153 + docs/html/functions_t.html | 117 + docs/html/functions_u.html | 110 + docs/html/functions_v.html | 111 + docs/html/functions_vars.html | 113 + docs/html/functions_vars.js | 25 + docs/html/functions_vars_b.html | 122 + docs/html/functions_vars_c.html | 141 + docs/html/functions_vars_d.html | 135 + docs/html/functions_vars_e.html | 115 + docs/html/functions_vars_f.html | 116 + docs/html/functions_vars_g.html | 108 + docs/html/functions_vars_h.html | 123 + docs/html/functions_vars_i.html | 119 + docs/html/functions_vars_j.html | 108 + docs/html/functions_vars_k.html | 108 + docs/html/functions_vars_l.html | 118 + docs/html/functions_vars_m.html | 142 + docs/html/functions_vars_n.html | 112 + docs/html/functions_vars_o.html | 108 + docs/html/functions_vars_p.html | 113 + docs/html/functions_vars_r.html | 113 + docs/html/functions_vars_s.html | 153 + docs/html/functions_vars_t.html | 117 + docs/html/functions_vars_u.html | 110 + docs/html/functions_vars_v.html | 111 + docs/html/functions_vars_w.html | 110 + docs/html/functions_w.html | 110 + docs/html/globals.html | 107 + docs/html/globals_a.html | 323 + docs/html/globals_b.html | 137 + docs/html/globals_c.html | 201 + docs/html/globals_d.html | 235 + docs/html/globals_defs.html | 289 + docs/html/globals_dup.js | 29 + docs/html/globals_e.html | 169 + docs/html/globals_enum.html | 117 + docs/html/globals_eval.html | 170 + docs/html/globals_eval.js | 27 + docs/html/globals_eval_b.html | 127 + docs/html/globals_eval_c.html | 182 + docs/html/globals_eval_d.html | 223 + docs/html/globals_eval_e.html | 166 + docs/html/globals_eval_f.html | 123 + docs/html/globals_eval_g.html | 115 + docs/html/globals_eval_h.html | 125 + docs/html/globals_eval_i.html | 124 + docs/html/globals_eval_j.html | 109 + docs/html/globals_eval_l.html | 128 + docs/html/globals_eval_m.html | 151 + docs/html/globals_eval_n.html | 126 + docs/html/globals_eval_o.html | 109 + docs/html/globals_eval_p.html | 131 + docs/html/globals_eval_q.html | 121 + docs/html/globals_eval_r.html | 143 + docs/html/globals_eval_s.html | 193 + docs/html/globals_eval_t.html | 127 + docs/html/globals_eval_u.html | 116 + docs/html/globals_eval_v.html | 116 + docs/html/globals_eval_w.html | 109 + docs/html/globals_eval_x.html | 120 + docs/html/globals_eval_z.html | 111 + docs/html/globals_f.html | 140 + docs/html/globals_func.html | 107 + docs/html/globals_func.js | 20 + docs/html/globals_func_a.html | 210 + docs/html/globals_func_b.html | 110 + docs/html/globals_func_c.html | 110 + docs/html/globals_func_d.html | 110 + docs/html/globals_func_e.html | 108 + docs/html/globals_func_f.html | 114 + docs/html/globals_func_g.html | 107 + docs/html/globals_func_i.html | 107 + docs/html/globals_func_l.html | 107 + docs/html/globals_func_m.html | 107 + docs/html/globals_func_p.html | 128 + docs/html/globals_func_r.html | 111 + docs/html/globals_func_s.html | 115 + docs/html/globals_func_u.html | 107 + docs/html/globals_func_v.html | 109 + docs/html/globals_func_w.html | 130 + docs/html/globals_g.html | 120 + docs/html/globals_h.html | 130 + docs/html/globals_i.html | 132 + docs/html/globals_j.html | 109 + docs/html/globals_k.html | 107 + docs/html/globals_l.html | 134 + docs/html/globals_m.html | 169 + docs/html/globals_n.html | 127 + docs/html/globals_o.html | 110 + docs/html/globals_p.html | 155 + docs/html/globals_q.html | 121 + docs/html/globals_r.html | 152 + docs/html/globals_s.html | 220 + docs/html/globals_t.html | 138 + docs/html/globals_type.html | 178 + docs/html/globals_u.html | 118 + docs/html/globals_v.html | 120 + docs/html/globals_vars.html | 107 + docs/html/globals_w.html | 133 + docs/html/globals_x.html | 121 + docs/html/globals_z.html | 111 + docs/html/group__MediaTags.html | 384 + docs/html/group__MediaTags.js | 79 + docs/html/group__MediaTypes.html | 1542 +++ docs/html/group__MediaTypes.js | 500 + docs/html/group__SectorTags.html | 211 + docs/html/group__SectorTags.js | 26 + docs/html/hash__map_8c.html | 431 + docs/html/hash__map_8c.js | 10 + docs/html/hash__map_8c_source.html | 231 + docs/html/hash__map_8h.html | 340 + docs/html/hash__map_8h.js | 9 + docs/html/hash__map_8h_source.html | 164 + docs/html/header_8h.html | 235 + docs/html/header_8h.js | 9 + docs/html/header_8h_source.html | 206 + docs/html/helpers_8c.html | 256 + docs/html/helpers_8c.js | 7 + docs/html/helpers_8c_source.html | 788 ++ docs/html/identify_8c.html | 305 + docs/html/identify_8c.js | 5 + docs/html/identify_8c_source.html | 176 + docs/html/index.html | 106 + docs/html/index_8h.html | 225 + docs/html/index_8h.js | 11 + docs/html/index_8h_source.html | 187 + docs/html/index__v1_8c.html | 324 + docs/html/index__v1_8c.js | 5 + docs/html/index__v1_8c_source.html | 320 + docs/html/index__v2_8c.html | 326 + docs/html/index__v2_8c.js | 5 + docs/html/index__v2_8c_source.html | 384 + docs/html/index__v3_8c.html | 465 + docs/html/index__v3_8c.js | 6 + docs/html/index__v3_8c_source.html | 479 + docs/html/internal_8h.html | 2761 +++++ docs/html/internal_8h.js | 33 + docs/html/internal_8h_source.html | 202 + docs/html/jquery.js | 204 + docs/html/lisa__tag_8c.html | 650 ++ docs/html/lisa__tag_8c.js | 18 + docs/html/lisa__tag_8c_source.html | 514 + docs/html/lisa__tag_8h.html | 630 ++ docs/html/lisa__tag_8h.js | 21 + docs/html/lisa__tag_8h_source.html | 248 + docs/html/log_8h.html | 174 + docs/html/log_8h.js | 5 + docs/html/log_8h_source.html | 149 + docs/html/lru_8c.html | 327 + docs/html/lru_8c.js | 8 + docs/html/lru_8c_source.html | 198 + docs/html/lru_8h.html | 299 + docs/html/lru_8h.js | 9 + docs/html/lru_8h_source.html | 150 + docs/html/lzma_8c.html | 294 + docs/html/lzma_8c.js | 5 + docs/html/lzma_8c_source.html | 155 + docs/html/md5_8c.html | 853 ++ docs/html/md5_8c.js | 29 + docs/html/md5_8c_source.html | 674 ++ docs/html/md5_8h.html | 121 + docs/html/md5_8h.js | 4 + docs/html/md5_8h_source.html | 156 + docs/html/md_README.html | 147 + docs/html/menu.js | 131 + docs/html/menudata.js | 183 + docs/html/metadata_8c.html | 3405 +++++++ docs/html/metadata_8c.js | 38 + docs/html/metadata_8c_source.html | 1993 ++++ docs/html/metadata_8h.html | 201 + docs/html/metadata_8h.js | 9 + docs/html/metadata_8h_source.html | 218 + docs/html/navtree.css | 327 + docs/html/navtree.js | 899 ++ docs/html/navtreedata.js | 67 + docs/html/navtreeindex0.js | 253 + docs/html/navtreeindex1.js | 253 + docs/html/navtreeindex2.js | 253 + docs/html/navtreeindex3.js | 253 + docs/html/navtreeindex4.js | 253 + docs/html/navtreeindex5.js | 253 + docs/html/navtreeindex6.js | 253 + docs/html/navtreeindex7.js | 222 + docs/html/open_8c.html | 284 + docs/html/open_8c.js | 5 + docs/html/open_8c_source.html | 627 ++ docs/html/optical_8c.html | 421 + docs/html/optical_8c.js | 6 + docs/html/optical_8c_source.html | 436 + docs/html/optical_8h.html | 186 + docs/html/optical_8h.js | 7 + docs/html/optical_8h_source.html | 169 + docs/html/options_8c.html | 164 + docs/html/options_8c.js | 4 + docs/html/options_8c_source.html | 262 + docs/html/options_8h.html | 216 + docs/html/options_8h.js | 4 + docs/html/options_8h_source.html | 161 + docs/html/pages.html | 110 + docs/html/read_8c.html | 850 ++ docs/html/read_8c.js | 8 + docs/html/read_8c_source.html | 1652 +++ docs/html/search/all_0.js | 4 + docs/html/search/all_1.js | 233 + docs/html/search/all_10.js | 61 + docs/html/search/all_11.js | 18 + docs/html/search/all_12.js | 59 + docs/html/search/all_13.js | 177 + docs/html/search/all_14.js | 53 + docs/html/search/all_15.js | 19 + docs/html/search/all_16.js | 23 + docs/html/search/all_17.js | 35 + docs/html/search/all_18.js | 18 + docs/html/search/all_19.js | 8 + docs/html/search/all_2.js | 51 + docs/html/search/all_3.js | 148 + docs/html/search/all_4.js | 169 + docs/html/search/all_5.js | 79 + docs/html/search/all_6.js | 49 + docs/html/search/all_7.js | 19 + docs/html/search/all_8.js | 49 + docs/html/search/all_9.js | 48 + docs/html/search/all_a.js | 8 + docs/html/search/all_b.js | 7 + docs/html/search/all_c.js | 50 + docs/html/search/all_d.js | 109 + docs/html/search/all_e.js | 30 + docs/html/search/all_f.js | 14 + docs/html/search/classes_0.js | 9 + docs/html/search/classes_1.js | 5 + docs/html/search/classes_2.js | 11 + docs/html/search/classes_3.js | 9 + docs/html/search/classes_4.js | 4 + docs/html/search/classes_5.js | 4 + docs/html/search/classes_6.js | 8 + docs/html/search/classes_7.js | 4 + docs/html/search/classes_8.js | 6 + docs/html/search/classes_9.js | 5 + docs/html/search/classes_a.js | 4 + docs/html/search/classes_b.js | 7 + docs/html/search/classes_c.js | 12 + docs/html/search/defines_0.js | 47 + docs/html/search/defines_1.js | 6 + docs/html/search/defines_10.js | 4 + docs/html/search/defines_11.js | 4 + docs/html/search/defines_2.js | 9 + docs/html/search/defines_3.js | 4 + docs/html/search/defines_4.js | 4 + docs/html/search/defines_5.js | 11 + docs/html/search/defines_6.js | 6 + docs/html/search/defines_7.js | 8 + docs/html/search/defines_8.js | 5 + docs/html/search/defines_9.js | 8 + docs/html/search/defines_a.js | 16 + docs/html/search/defines_b.js | 4 + docs/html/search/defines_c.js | 4 + docs/html/search/defines_d.js | 7 + docs/html/search/defines_e.js | 18 + docs/html/search/defines_f.js | 4 + docs/html/search/enums_0.js | 4 + docs/html/search/enums_1.js | 4 + docs/html/search/enums_2.js | 6 + docs/html/search/enums_3.js | 4 + docs/html/search/enums_4.js | 4 + docs/html/search/enums_5.js | 5 + docs/html/search/enums_6.js | 5 + docs/html/search/enums_7.js | 4 + docs/html/search/enums_8.js | 4 + docs/html/search/enumvalues_0.js | 67 + docs/html/search/enumvalues_1.js | 24 + docs/html/search/enumvalues_10.js | 40 + docs/html/search/enumvalues_11.js | 90 + docs/html/search/enumvalues_12.js | 24 + docs/html/search/enumvalues_13.js | 13 + docs/html/search/enumvalues_14.js | 13 + docs/html/search/enumvalues_15.js | 6 + docs/html/search/enumvalues_16.js | 17 + docs/html/search/enumvalues_17.js | 8 + docs/html/search/enumvalues_2.js | 79 + docs/html/search/enumvalues_3.js | 120 + docs/html/search/enumvalues_4.js | 63 + docs/html/search/enumvalues_5.js | 20 + docs/html/search/enumvalues_6.js | 12 + docs/html/search/enumvalues_7.js | 22 + docs/html/search/enumvalues_8.js | 21 + docs/html/search/enumvalues_9.js | 6 + docs/html/search/enumvalues_a.js | 25 + docs/html/search/enumvalues_b.js | 48 + docs/html/search/enumvalues_c.js | 23 + docs/html/search/enumvalues_d.js | 6 + docs/html/search/enumvalues_e.js | 28 + docs/html/search/enumvalues_f.js | 18 + docs/html/search/files_0.js | 7 + docs/html/search/files_1.js | 14 + docs/html/search/files_2.js | 11 + docs/html/search/files_3.js | 7 + docs/html/search/files_4.js | 5 + docs/html/search/files_5.js | 7 + docs/html/search/files_6.js | 9 + docs/html/search/files_7.js | 9 + docs/html/search/files_8.js | 7 + docs/html/search/files_9.js | 8 + docs/html/search/files_a.js | 5 + docs/html/search/files_b.js | 12 + docs/html/search/files_c.js | 6 + docs/html/search/files_d.js | 4 + docs/html/search/files_e.js | 4 + docs/html/search/functions_0.js | 4 + docs/html/search/functions_1.js | 107 + docs/html/search/functions_10.js | 27 + docs/html/search/functions_2.js | 7 + docs/html/search/functions_3.js | 7 + docs/html/search/functions_4.js | 7 + docs/html/search/functions_5.js | 5 + docs/html/search/functions_6.js | 11 + docs/html/search/functions_7.js | 4 + docs/html/search/functions_8.js | 4 + docs/html/search/functions_9.js | 4 + docs/html/search/functions_a.js | 4 + docs/html/search/functions_b.js | 25 + docs/html/search/functions_c.js | 8 + docs/html/search/functions_d.js | 12 + docs/html/search/functions_e.js | 4 + docs/html/search/functions_f.js | 6 + docs/html/search/groups_0.js | 4 + docs/html/search/groups_1.js | 6 + docs/html/search/groups_2.js | 5 + docs/html/search/groups_3.js | 4 + docs/html/search/groups_4.js | 6 + docs/html/search/pages_0.js | 4 + docs/html/search/search.css | 378 + docs/html/search/search.js | 708 ++ docs/html/search/searchdata.js | 45 + docs/html/search/typedefs_0.js | 7 + docs/html/search/typedefs_1.js | 4 + docs/html/search/typedefs_2.js | 8 + docs/html/search/typedefs_3.js | 9 + docs/html/search/typedefs_4.js | 4 + docs/html/search/typedefs_5.js | 8 + docs/html/search/typedefs_6.js | 5 + docs/html/search/typedefs_7.js | 5 + docs/html/search/typedefs_8.js | 4 + docs/html/search/typedefs_9.js | 12 + docs/html/search/variables_0.js | 10 + docs/html/search/variables_1.js | 20 + docs/html/search/variables_10.js | 10 + docs/html/search/variables_11.js | 50 + docs/html/search/variables_12.js | 14 + docs/html/search/variables_13.js | 7 + docs/html/search/variables_14.js | 8 + docs/html/search/variables_15.js | 7 + docs/html/search/variables_2.js | 39 + docs/html/search/variables_3.js | 32 + docs/html/search/variables_4.js | 12 + docs/html/search/variables_5.js | 13 + docs/html/search/variables_6.js | 5 + docs/html/search/variables_7.js | 20 + docs/html/search/variables_8.js | 16 + docs/html/search/variables_9.js | 5 + docs/html/search/variables_a.js | 6 + docs/html/search/variables_b.js | 15 + docs/html/search/variables_c.js | 39 + docs/html/search/variables_d.js | 9 + docs/html/search/variables_e.js | 5 + docs/html/search/variables_f.js | 10 + docs/html/sha1_8c.html | 454 + docs/html/sha1_8c.js | 14 + docs/html/sha1_8c_source.html | 296 + docs/html/sha1_8h.html | 144 + docs/html/sha1_8h.js | 5 + docs/html/sha1_8h_source.html | 165 + docs/html/sha256_8c.html | 521 + docs/html/sha256_8c.js | 17 + docs/html/sha256_8c_source.html | 286 + docs/html/sha256_8h.html | 144 + docs/html/sha256_8h.js | 5 + docs/html/sha256_8h_source.html | 164 + docs/html/simd_8c.html | 119 + docs/html/simd_8c_source.html | 349 + docs/html/simd_8h.html | 142 + docs/html/simd_8h.js | 4 + docs/html/simd_8h_source.html | 219 + docs/html/spamsum_8c.html | 507 + docs/html/spamsum_8c.js | 15 + docs/html/spamsum_8c_source.html | 476 + docs/html/spamsum_8h.html | 256 + docs/html/spamsum_8h.js | 13 + docs/html/spamsum_8h_source.html | 192 + docs/html/structAaruHeader.html | 343 + docs/html/structAaruHeader.js | 13 + docs/html/structAaruHeaderV2.html | 503 + docs/html/structAaruHeaderV2.js | 20 + .../structAaruMetadataJsonBlockHeader.html | 175 + .../html/structAaruMetadataJsonBlockHeader.js | 5 + docs/html/structBlockHeader.html | 317 + docs/html/structBlockHeader.js | 11 + docs/html/structCacheEntry.html | 201 + docs/html/structCacheEntry.js | 6 + docs/html/structCacheHeader.html | 179 + docs/html/structCacheHeader.js | 5 + docs/html/structCdEccContext.html | 219 + docs/html/structCdEccContext.js | 7 + docs/html/structChecksumEntry.html | 176 + docs/html/structChecksumEntry.js | 5 + docs/html/structChecksumHeader.html | 197 + docs/html/structChecksumHeader.js | 6 + docs/html/structChecksums.html | 351 + docs/html/structChecksums.js | 13 + docs/html/structCicmMetadataBlock.html | 175 + docs/html/structCicmMetadataBlock.js | 5 + docs/html/structDdtHeader.html | 329 + docs/html/structDdtHeader.js | 12 + docs/html/structDdtHeader2.html | 559 ++ docs/html/structDdtHeader2.js | 21 + docs/html/structDumpExtent.html | 172 + docs/html/structDumpExtent.js | 5 + .../structDumpHardwareEntriesWithData.html | 351 + .../html/structDumpHardwareEntriesWithData.js | 13 + docs/html/structDumpHardwareEntry.html | 335 + docs/html/structDumpHardwareEntry.js | 12 + docs/html/structDumpHardwareHeader.html | 218 + docs/html/structDumpHardwareHeader.js | 7 + docs/html/structGeometryBlockHeader.html | 219 + docs/html/structGeometryBlockHeader.js | 7 + docs/html/structImageInfo.html | 475 + docs/html/structImageInfo.js | 15 + docs/html/structIndexEntry.html | 201 + docs/html/structIndexEntry.js | 6 + docs/html/structIndexHeader.html | 197 + docs/html/structIndexHeader.js | 6 + docs/html/structIndexHeader2.html | 197 + docs/html/structIndexHeader2.js | 6 + docs/html/structIndexHeader3.html | 219 + docs/html/structIndexHeader3.js | 7 + docs/html/structMetadataBlockHeader.html | 747 ++ docs/html/structMetadataBlockHeader.js | 31 + docs/html/structTapeDdtHashEntry.html | 190 + docs/html/structTapeDdtHashEntry.js | 6 + docs/html/structTapeFileEntry.html | 238 + docs/html/structTapeFileEntry.js | 7 + docs/html/structTapeFileHashEntry.html | 190 + docs/html/structTapeFileHashEntry.js | 6 + docs/html/structTapeFileHeader.html | 269 + docs/html/structTapeFileHeader.js | 7 + docs/html/structTapePartitionEntry.html | 241 + docs/html/structTapePartitionEntry.js | 6 + docs/html/structTapePartitionHashEntry.html | 190 + docs/html/structTapePartitionHashEntry.js | 6 + docs/html/structTapePartitionHeader.html | 278 + docs/html/structTapePartitionHeader.js | 7 + docs/html/structTrackEntry.html | 304 + docs/html/structTrackEntry.js | 11 + docs/html/structTracksHeader.html | 196 + docs/html/structTracksHeader.js | 6 + docs/html/structaaru__flac__ctx.html | 259 + docs/html/structaaru__flac__ctx.js | 10 + docs/html/structaaru__options.html | 374 + docs/html/structaaru__options.js | 14 + docs/html/structaaruformat__context.html | 2390 +++++ docs/html/structaaruformat__context.js | 105 + docs/html/structblockhash__ctx.html | 221 + docs/html/structblockhash__ctx.js | 8 + docs/html/structcrc64__ctx.html | 152 + docs/html/structcrc64__ctx.js | 4 + docs/html/structhash__map__t.html | 202 + docs/html/structhash__map__t.js | 6 + docs/html/structkv__pair__t.html | 175 + docs/html/structkv__pair__t.js | 5 + docs/html/structmd5__ctx.html | 276 + docs/html/structmd5__ctx.js | 11 + docs/html/structmediaTagEntry.html | 217 + docs/html/structmediaTagEntry.js | 7 + docs/html/structpriam__tag.html | 412 + docs/html/structpriam__tag.js | 16 + docs/html/structprofile__tag.html | 390 + docs/html/structprofile__tag.js | 15 + docs/html/structroll__state.html | 221 + docs/html/structroll__state.js | 8 + docs/html/structs_8h.html | 129 + docs/html/structs_8h_source.html | 165 + docs/html/structsha1__ctx.html | 183 + docs/html/structsha1__ctx.js | 6 + docs/html/structsha256__ctx.html | 183 + docs/html/structsha256__ctx.js | 6 + docs/html/structsony__tag.html | 302 + docs/html/structsony__tag.js | 11 + docs/html/structspamsum__ctx.html | 221 + docs/html/structspamsum__ctx.js | 8 + docs/html/tabs.css | 1 + docs/html/tape_8c.html | 862 ++ docs/html/tape_8c.js | 9 + docs/html/tape_8c_source.html | 622 ++ docs/html/tape_8h.html | 230 + docs/html/tape_8h.js | 11 + docs/html/tape_8h_source.html | 194 + docs/html/time_8c.html | 150 + docs/html/time_8c.js | 4 + docs/html/time_8c_source.html | 155 + docs/html/topics.html | 112 + docs/html/topics.js | 6 + docs/html/verify_8c.html | 313 + docs/html/verify_8c.js | 6 + docs/html/verify_8c_source.html | 539 + docs/html/write_8c.html | 1227 +++ docs/html/write_8c.js | 8 + docs/html/write_8c_source.html | 1875 ++++ 646 files changed, 124953 insertions(+) create mode 100644 docs/html/README_8md.html create mode 100644 docs/html/aaru_8h.html create mode 100644 docs/html/aaru_8h.js create mode 100644 docs/html/aaru_8h_source.html create mode 100644 docs/html/aaruformat_8h.html create mode 100644 docs/html/aaruformat_8h.js create mode 100644 docs/html/aaruformat_8h_source.html create mode 100644 docs/html/annotated.html create mode 100644 docs/html/annotated_dup.js create mode 100644 docs/html/arm__vmull_8c.html create mode 100644 docs/html/arm__vmull_8c_source.html create mode 100644 docs/html/arm__vmull_8h.html create mode 100644 docs/html/arm__vmull_8h_source.html create mode 100644 docs/html/blocks_2dump_8c.html create mode 100644 docs/html/blocks_2dump_8c.js create mode 100644 docs/html/blocks_2dump_8c_source.html create mode 100644 docs/html/blocks_2metadata_8c.html create mode 100644 docs/html/blocks_2metadata_8c.js create mode 100644 docs/html/blocks_2metadata_8c_source.html create mode 100644 docs/html/checksum_8c.html create mode 100644 docs/html/checksum_8c.js create mode 100644 docs/html/checksum_8c_source.html create mode 100644 docs/html/checksum_8h.html create mode 100644 docs/html/checksum_8h.js create mode 100644 docs/html/checksum_8h_source.html create mode 100644 docs/html/classes.html create mode 100644 docs/html/clipboard.js create mode 100644 docs/html/close_8c.html create mode 100644 docs/html/close_8c.js create mode 100644 docs/html/close_8c_source.html create mode 100644 docs/html/consts_8h.html create mode 100644 docs/html/consts_8h.js create mode 100644 docs/html/consts_8h_source.html create mode 100644 docs/html/context_8h.html create mode 100644 docs/html/context_8h.js create mode 100644 docs/html/context_8h_source.html create mode 100644 docs/html/cookie.js create mode 100644 docs/html/crc64_8c.html create mode 100644 docs/html/crc64_8c.js create mode 100644 docs/html/crc64_8c_source.html create mode 100644 docs/html/crc64_8h.html create mode 100644 docs/html/crc64_8h.js create mode 100644 docs/html/crc64_8h_source.html create mode 100644 docs/html/crc64__clmul_8c.html create mode 100644 docs/html/crc64__clmul_8c_source.html create mode 100644 docs/html/crc64__vmull_8c.html create mode 100644 docs/html/crc64__vmull_8c_source.html create mode 100644 docs/html/create_8c.html create mode 100644 docs/html/create_8c.js create mode 100644 docs/html/create_8c_source.html create mode 100644 docs/html/cst_8c.html create mode 100644 docs/html/cst_8c.js create mode 100644 docs/html/cst_8c_source.html create mode 100644 docs/html/data_8c.html create mode 100644 docs/html/data_8c.js create mode 100644 docs/html/data_8c_source.html create mode 100644 docs/html/data_8h.html create mode 100644 docs/html/data_8h.js create mode 100644 docs/html/data_8h_source.html create mode 100644 docs/html/ddt_8h.html create mode 100644 docs/html/ddt_8h.js create mode 100644 docs/html/ddt_8h_source.html create mode 100644 docs/html/ddt__v1_8c.html create mode 100644 docs/html/ddt__v1_8c.js create mode 100644 docs/html/ddt__v1_8c_source.html create mode 100644 docs/html/ddt__v2_8c.html create mode 100644 docs/html/ddt__v2_8c.js create mode 100644 docs/html/ddt__v2_8c_source.html create mode 100644 docs/html/decls_8h.html create mode 100644 docs/html/decls_8h.js create mode 100644 docs/html/decls_8h_source.html create mode 100644 docs/html/dir_19ac67bde96fa7098d9c89fb8e36db69.html create mode 100644 docs/html/dir_19ac67bde96fa7098d9c89fb8e36db69.js create mode 100644 docs/html/dir_40ed6a89610fc2370cf3ffcd6469b940.html create mode 100644 docs/html/dir_40ed6a89610fc2370cf3ffcd6469b940.js create mode 100644 docs/html/dir_6387aeb6e475a334d8dc12d69f21999e.html create mode 100644 docs/html/dir_6387aeb6e475a334d8dc12d69f21999e.js create mode 100644 docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html create mode 100644 docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.js create mode 100644 docs/html/dir_6b3196bdf3f485a11a190486a5644c9a.html create mode 100644 docs/html/dir_6b3196bdf3f485a11a190486a5644c9a.js create mode 100644 docs/html/dir_a6e99c46e07b25cfb1b3942f86972439.html create mode 100644 docs/html/dir_a6e99c46e07b25cfb1b3942f86972439.js create mode 100644 docs/html/dir_aeff2545c9dfcfc842fe9d84b123cb31.html create mode 100644 docs/html/dir_aeff2545c9dfcfc842fe9d84b123cb31.js create mode 100644 docs/html/dir_b2e0cd1ddd0a904cb261e9b68779deb4.html create mode 100644 docs/html/dir_b2e0cd1ddd0a904cb261e9b68779deb4.js create mode 100644 docs/html/dir_b86b57f9d61b104fa8483aa475f863ae.html create mode 100644 docs/html/dir_b86b57f9d61b104fa8483aa475f863ae.js create mode 100644 docs/html/dir_d44c64559bbebec7f509842c48db8b23.html create mode 100644 docs/html/dir_d44c64559bbebec7f509842c48db8b23.js create mode 100644 docs/html/doxygen.css create mode 100644 docs/html/doxygen.svg create mode 100644 docs/html/doxygen_crawl.html create mode 100644 docs/html/dump_8c.html create mode 100644 docs/html/dump_8c.js create mode 100644 docs/html/dump_8c_source.html create mode 100644 docs/html/dump_8h.html create mode 100644 docs/html/dump_8h.js create mode 100644 docs/html/dump_8h_source.html create mode 100644 docs/html/dynsections.js create mode 100644 docs/html/ecc__cd_8c.html create mode 100644 docs/html/ecc__cd_8c.js create mode 100644 docs/html/ecc__cd_8c_source.html create mode 100644 docs/html/endian_8h.html create mode 100644 docs/html/endian_8h.js create mode 100644 docs/html/endian_8h_source.html create mode 100644 docs/html/enums_8h.html create mode 100644 docs/html/enums_8h.js create mode 100644 docs/html/enums_8h_source.html create mode 100644 docs/html/errors_8h.html create mode 100644 docs/html/errors_8h.js create mode 100644 docs/html/errors_8h_source.html create mode 100644 docs/html/files.html create mode 100644 docs/html/files_dup.js create mode 100644 docs/html/flac_8c.html create mode 100644 docs/html/flac_8c.js create mode 100644 docs/html/flac_8c_source.html create mode 100644 docs/html/flac_8h.html create mode 100644 docs/html/flac_8h.js create mode 100644 docs/html/flac_8h_source.html create mode 100644 docs/html/functions.html create mode 100644 docs/html/functions_b.html create mode 100644 docs/html/functions_c.html create mode 100644 docs/html/functions_d.html create mode 100644 docs/html/functions_dup.js create mode 100644 docs/html/functions_e.html create mode 100644 docs/html/functions_f.html create mode 100644 docs/html/functions_g.html create mode 100644 docs/html/functions_h.html create mode 100644 docs/html/functions_i.html create mode 100644 docs/html/functions_j.html create mode 100644 docs/html/functions_k.html create mode 100644 docs/html/functions_l.html create mode 100644 docs/html/functions_m.html create mode 100644 docs/html/functions_n.html create mode 100644 docs/html/functions_o.html create mode 100644 docs/html/functions_p.html create mode 100644 docs/html/functions_r.html create mode 100644 docs/html/functions_s.html create mode 100644 docs/html/functions_t.html create mode 100644 docs/html/functions_u.html create mode 100644 docs/html/functions_v.html create mode 100644 docs/html/functions_vars.html create mode 100644 docs/html/functions_vars.js create mode 100644 docs/html/functions_vars_b.html create mode 100644 docs/html/functions_vars_c.html create mode 100644 docs/html/functions_vars_d.html create mode 100644 docs/html/functions_vars_e.html create mode 100644 docs/html/functions_vars_f.html create mode 100644 docs/html/functions_vars_g.html create mode 100644 docs/html/functions_vars_h.html create mode 100644 docs/html/functions_vars_i.html create mode 100644 docs/html/functions_vars_j.html create mode 100644 docs/html/functions_vars_k.html create mode 100644 docs/html/functions_vars_l.html create mode 100644 docs/html/functions_vars_m.html create mode 100644 docs/html/functions_vars_n.html create mode 100644 docs/html/functions_vars_o.html create mode 100644 docs/html/functions_vars_p.html create mode 100644 docs/html/functions_vars_r.html create mode 100644 docs/html/functions_vars_s.html create mode 100644 docs/html/functions_vars_t.html create mode 100644 docs/html/functions_vars_u.html create mode 100644 docs/html/functions_vars_v.html create mode 100644 docs/html/functions_vars_w.html create mode 100644 docs/html/functions_w.html create mode 100644 docs/html/globals.html create mode 100644 docs/html/globals_a.html create mode 100644 docs/html/globals_b.html create mode 100644 docs/html/globals_c.html create mode 100644 docs/html/globals_d.html create mode 100644 docs/html/globals_defs.html create mode 100644 docs/html/globals_dup.js create mode 100644 docs/html/globals_e.html create mode 100644 docs/html/globals_enum.html create mode 100644 docs/html/globals_eval.html create mode 100644 docs/html/globals_eval.js create mode 100644 docs/html/globals_eval_b.html create mode 100644 docs/html/globals_eval_c.html create mode 100644 docs/html/globals_eval_d.html create mode 100644 docs/html/globals_eval_e.html create mode 100644 docs/html/globals_eval_f.html create mode 100644 docs/html/globals_eval_g.html create mode 100644 docs/html/globals_eval_h.html create mode 100644 docs/html/globals_eval_i.html create mode 100644 docs/html/globals_eval_j.html create mode 100644 docs/html/globals_eval_l.html create mode 100644 docs/html/globals_eval_m.html create mode 100644 docs/html/globals_eval_n.html create mode 100644 docs/html/globals_eval_o.html create mode 100644 docs/html/globals_eval_p.html create mode 100644 docs/html/globals_eval_q.html create mode 100644 docs/html/globals_eval_r.html create mode 100644 docs/html/globals_eval_s.html create mode 100644 docs/html/globals_eval_t.html create mode 100644 docs/html/globals_eval_u.html create mode 100644 docs/html/globals_eval_v.html create mode 100644 docs/html/globals_eval_w.html create mode 100644 docs/html/globals_eval_x.html create mode 100644 docs/html/globals_eval_z.html create mode 100644 docs/html/globals_f.html create mode 100644 docs/html/globals_func.html create mode 100644 docs/html/globals_func.js create mode 100644 docs/html/globals_func_a.html create mode 100644 docs/html/globals_func_b.html create mode 100644 docs/html/globals_func_c.html create mode 100644 docs/html/globals_func_d.html create mode 100644 docs/html/globals_func_e.html create mode 100644 docs/html/globals_func_f.html create mode 100644 docs/html/globals_func_g.html create mode 100644 docs/html/globals_func_i.html create mode 100644 docs/html/globals_func_l.html create mode 100644 docs/html/globals_func_m.html create mode 100644 docs/html/globals_func_p.html create mode 100644 docs/html/globals_func_r.html create mode 100644 docs/html/globals_func_s.html create mode 100644 docs/html/globals_func_u.html create mode 100644 docs/html/globals_func_v.html create mode 100644 docs/html/globals_func_w.html create mode 100644 docs/html/globals_g.html create mode 100644 docs/html/globals_h.html create mode 100644 docs/html/globals_i.html create mode 100644 docs/html/globals_j.html create mode 100644 docs/html/globals_k.html create mode 100644 docs/html/globals_l.html create mode 100644 docs/html/globals_m.html create mode 100644 docs/html/globals_n.html create mode 100644 docs/html/globals_o.html create mode 100644 docs/html/globals_p.html create mode 100644 docs/html/globals_q.html create mode 100644 docs/html/globals_r.html create mode 100644 docs/html/globals_s.html create mode 100644 docs/html/globals_t.html create mode 100644 docs/html/globals_type.html create mode 100644 docs/html/globals_u.html create mode 100644 docs/html/globals_v.html create mode 100644 docs/html/globals_vars.html create mode 100644 docs/html/globals_w.html create mode 100644 docs/html/globals_x.html create mode 100644 docs/html/globals_z.html create mode 100644 docs/html/group__MediaTags.html create mode 100644 docs/html/group__MediaTags.js create mode 100644 docs/html/group__MediaTypes.html create mode 100644 docs/html/group__MediaTypes.js create mode 100644 docs/html/group__SectorTags.html create mode 100644 docs/html/group__SectorTags.js create mode 100644 docs/html/hash__map_8c.html create mode 100644 docs/html/hash__map_8c.js create mode 100644 docs/html/hash__map_8c_source.html create mode 100644 docs/html/hash__map_8h.html create mode 100644 docs/html/hash__map_8h.js create mode 100644 docs/html/hash__map_8h_source.html create mode 100644 docs/html/header_8h.html create mode 100644 docs/html/header_8h.js create mode 100644 docs/html/header_8h_source.html create mode 100644 docs/html/helpers_8c.html create mode 100644 docs/html/helpers_8c.js create mode 100644 docs/html/helpers_8c_source.html create mode 100644 docs/html/identify_8c.html create mode 100644 docs/html/identify_8c.js create mode 100644 docs/html/identify_8c_source.html create mode 100644 docs/html/index.html create mode 100644 docs/html/index_8h.html create mode 100644 docs/html/index_8h.js create mode 100644 docs/html/index_8h_source.html create mode 100644 docs/html/index__v1_8c.html create mode 100644 docs/html/index__v1_8c.js create mode 100644 docs/html/index__v1_8c_source.html create mode 100644 docs/html/index__v2_8c.html create mode 100644 docs/html/index__v2_8c.js create mode 100644 docs/html/index__v2_8c_source.html create mode 100644 docs/html/index__v3_8c.html create mode 100644 docs/html/index__v3_8c.js create mode 100644 docs/html/index__v3_8c_source.html create mode 100644 docs/html/internal_8h.html create mode 100644 docs/html/internal_8h.js create mode 100644 docs/html/internal_8h_source.html create mode 100644 docs/html/jquery.js create mode 100644 docs/html/lisa__tag_8c.html create mode 100644 docs/html/lisa__tag_8c.js create mode 100644 docs/html/lisa__tag_8c_source.html create mode 100644 docs/html/lisa__tag_8h.html create mode 100644 docs/html/lisa__tag_8h.js create mode 100644 docs/html/lisa__tag_8h_source.html create mode 100644 docs/html/log_8h.html create mode 100644 docs/html/log_8h.js create mode 100644 docs/html/log_8h_source.html create mode 100644 docs/html/lru_8c.html create mode 100644 docs/html/lru_8c.js create mode 100644 docs/html/lru_8c_source.html create mode 100644 docs/html/lru_8h.html create mode 100644 docs/html/lru_8h.js create mode 100644 docs/html/lru_8h_source.html create mode 100644 docs/html/lzma_8c.html create mode 100644 docs/html/lzma_8c.js create mode 100644 docs/html/lzma_8c_source.html create mode 100644 docs/html/md5_8c.html create mode 100644 docs/html/md5_8c.js create mode 100644 docs/html/md5_8c_source.html create mode 100644 docs/html/md5_8h.html create mode 100644 docs/html/md5_8h.js create mode 100644 docs/html/md5_8h_source.html create mode 100644 docs/html/md_README.html create mode 100644 docs/html/menu.js create mode 100644 docs/html/menudata.js create mode 100644 docs/html/metadata_8c.html create mode 100644 docs/html/metadata_8c.js create mode 100644 docs/html/metadata_8c_source.html create mode 100644 docs/html/metadata_8h.html create mode 100644 docs/html/metadata_8h.js create mode 100644 docs/html/metadata_8h_source.html create mode 100644 docs/html/navtree.css create mode 100644 docs/html/navtree.js create mode 100644 docs/html/navtreedata.js create mode 100644 docs/html/navtreeindex0.js create mode 100644 docs/html/navtreeindex1.js create mode 100644 docs/html/navtreeindex2.js create mode 100644 docs/html/navtreeindex3.js create mode 100644 docs/html/navtreeindex4.js create mode 100644 docs/html/navtreeindex5.js create mode 100644 docs/html/navtreeindex6.js create mode 100644 docs/html/navtreeindex7.js create mode 100644 docs/html/open_8c.html create mode 100644 docs/html/open_8c.js create mode 100644 docs/html/open_8c_source.html create mode 100644 docs/html/optical_8c.html create mode 100644 docs/html/optical_8c.js create mode 100644 docs/html/optical_8c_source.html create mode 100644 docs/html/optical_8h.html create mode 100644 docs/html/optical_8h.js create mode 100644 docs/html/optical_8h_source.html create mode 100644 docs/html/options_8c.html create mode 100644 docs/html/options_8c.js create mode 100644 docs/html/options_8c_source.html create mode 100644 docs/html/options_8h.html create mode 100644 docs/html/options_8h.js create mode 100644 docs/html/options_8h_source.html create mode 100644 docs/html/pages.html create mode 100644 docs/html/read_8c.html create mode 100644 docs/html/read_8c.js create mode 100644 docs/html/read_8c_source.html create mode 100644 docs/html/search/all_0.js create mode 100644 docs/html/search/all_1.js create mode 100644 docs/html/search/all_10.js create mode 100644 docs/html/search/all_11.js create mode 100644 docs/html/search/all_12.js create mode 100644 docs/html/search/all_13.js create mode 100644 docs/html/search/all_14.js create mode 100644 docs/html/search/all_15.js create mode 100644 docs/html/search/all_16.js create mode 100644 docs/html/search/all_17.js create mode 100644 docs/html/search/all_18.js create mode 100644 docs/html/search/all_19.js create mode 100644 docs/html/search/all_2.js create mode 100644 docs/html/search/all_3.js create mode 100644 docs/html/search/all_4.js create mode 100644 docs/html/search/all_5.js create mode 100644 docs/html/search/all_6.js create mode 100644 docs/html/search/all_7.js create mode 100644 docs/html/search/all_8.js create mode 100644 docs/html/search/all_9.js create mode 100644 docs/html/search/all_a.js create mode 100644 docs/html/search/all_b.js create mode 100644 docs/html/search/all_c.js create mode 100644 docs/html/search/all_d.js create mode 100644 docs/html/search/all_e.js create mode 100644 docs/html/search/all_f.js create mode 100644 docs/html/search/classes_0.js create mode 100644 docs/html/search/classes_1.js create mode 100644 docs/html/search/classes_2.js create mode 100644 docs/html/search/classes_3.js create mode 100644 docs/html/search/classes_4.js create mode 100644 docs/html/search/classes_5.js create mode 100644 docs/html/search/classes_6.js create mode 100644 docs/html/search/classes_7.js create mode 100644 docs/html/search/classes_8.js create mode 100644 docs/html/search/classes_9.js create mode 100644 docs/html/search/classes_a.js create mode 100644 docs/html/search/classes_b.js create mode 100644 docs/html/search/classes_c.js create mode 100644 docs/html/search/defines_0.js create mode 100644 docs/html/search/defines_1.js create mode 100644 docs/html/search/defines_10.js create mode 100644 docs/html/search/defines_11.js create mode 100644 docs/html/search/defines_2.js create mode 100644 docs/html/search/defines_3.js create mode 100644 docs/html/search/defines_4.js create mode 100644 docs/html/search/defines_5.js create mode 100644 docs/html/search/defines_6.js create mode 100644 docs/html/search/defines_7.js create mode 100644 docs/html/search/defines_8.js create mode 100644 docs/html/search/defines_9.js create mode 100644 docs/html/search/defines_a.js create mode 100644 docs/html/search/defines_b.js create mode 100644 docs/html/search/defines_c.js create mode 100644 docs/html/search/defines_d.js create mode 100644 docs/html/search/defines_e.js create mode 100644 docs/html/search/defines_f.js create mode 100644 docs/html/search/enums_0.js create mode 100644 docs/html/search/enums_1.js create mode 100644 docs/html/search/enums_2.js create mode 100644 docs/html/search/enums_3.js create mode 100644 docs/html/search/enums_4.js create mode 100644 docs/html/search/enums_5.js create mode 100644 docs/html/search/enums_6.js create mode 100644 docs/html/search/enums_7.js create mode 100644 docs/html/search/enums_8.js create mode 100644 docs/html/search/enumvalues_0.js create mode 100644 docs/html/search/enumvalues_1.js create mode 100644 docs/html/search/enumvalues_10.js create mode 100644 docs/html/search/enumvalues_11.js create mode 100644 docs/html/search/enumvalues_12.js create mode 100644 docs/html/search/enumvalues_13.js create mode 100644 docs/html/search/enumvalues_14.js create mode 100644 docs/html/search/enumvalues_15.js create mode 100644 docs/html/search/enumvalues_16.js create mode 100644 docs/html/search/enumvalues_17.js create mode 100644 docs/html/search/enumvalues_2.js create mode 100644 docs/html/search/enumvalues_3.js create mode 100644 docs/html/search/enumvalues_4.js create mode 100644 docs/html/search/enumvalues_5.js create mode 100644 docs/html/search/enumvalues_6.js create mode 100644 docs/html/search/enumvalues_7.js create mode 100644 docs/html/search/enumvalues_8.js create mode 100644 docs/html/search/enumvalues_9.js create mode 100644 docs/html/search/enumvalues_a.js create mode 100644 docs/html/search/enumvalues_b.js create mode 100644 docs/html/search/enumvalues_c.js create mode 100644 docs/html/search/enumvalues_d.js create mode 100644 docs/html/search/enumvalues_e.js create mode 100644 docs/html/search/enumvalues_f.js create mode 100644 docs/html/search/files_0.js create mode 100644 docs/html/search/files_1.js create mode 100644 docs/html/search/files_2.js create mode 100644 docs/html/search/files_3.js create mode 100644 docs/html/search/files_4.js create mode 100644 docs/html/search/files_5.js create mode 100644 docs/html/search/files_6.js create mode 100644 docs/html/search/files_7.js create mode 100644 docs/html/search/files_8.js create mode 100644 docs/html/search/files_9.js create mode 100644 docs/html/search/files_a.js create mode 100644 docs/html/search/files_b.js create mode 100644 docs/html/search/files_c.js create mode 100644 docs/html/search/files_d.js create mode 100644 docs/html/search/files_e.js create mode 100644 docs/html/search/functions_0.js create mode 100644 docs/html/search/functions_1.js create mode 100644 docs/html/search/functions_10.js create mode 100644 docs/html/search/functions_2.js create mode 100644 docs/html/search/functions_3.js create mode 100644 docs/html/search/functions_4.js create mode 100644 docs/html/search/functions_5.js create mode 100644 docs/html/search/functions_6.js create mode 100644 docs/html/search/functions_7.js create mode 100644 docs/html/search/functions_8.js create mode 100644 docs/html/search/functions_9.js create mode 100644 docs/html/search/functions_a.js create mode 100644 docs/html/search/functions_b.js create mode 100644 docs/html/search/functions_c.js create mode 100644 docs/html/search/functions_d.js create mode 100644 docs/html/search/functions_e.js create mode 100644 docs/html/search/functions_f.js create mode 100644 docs/html/search/groups_0.js create mode 100644 docs/html/search/groups_1.js create mode 100644 docs/html/search/groups_2.js create mode 100644 docs/html/search/groups_3.js create mode 100644 docs/html/search/groups_4.js create mode 100644 docs/html/search/pages_0.js create mode 100644 docs/html/search/search.css create mode 100644 docs/html/search/search.js create mode 100644 docs/html/search/searchdata.js create mode 100644 docs/html/search/typedefs_0.js create mode 100644 docs/html/search/typedefs_1.js create mode 100644 docs/html/search/typedefs_2.js create mode 100644 docs/html/search/typedefs_3.js create mode 100644 docs/html/search/typedefs_4.js create mode 100644 docs/html/search/typedefs_5.js create mode 100644 docs/html/search/typedefs_6.js create mode 100644 docs/html/search/typedefs_7.js create mode 100644 docs/html/search/typedefs_8.js create mode 100644 docs/html/search/typedefs_9.js create mode 100644 docs/html/search/variables_0.js create mode 100644 docs/html/search/variables_1.js create mode 100644 docs/html/search/variables_10.js create mode 100644 docs/html/search/variables_11.js create mode 100644 docs/html/search/variables_12.js create mode 100644 docs/html/search/variables_13.js create mode 100644 docs/html/search/variables_14.js create mode 100644 docs/html/search/variables_15.js create mode 100644 docs/html/search/variables_2.js create mode 100644 docs/html/search/variables_3.js create mode 100644 docs/html/search/variables_4.js create mode 100644 docs/html/search/variables_5.js create mode 100644 docs/html/search/variables_6.js create mode 100644 docs/html/search/variables_7.js create mode 100644 docs/html/search/variables_8.js create mode 100644 docs/html/search/variables_9.js create mode 100644 docs/html/search/variables_a.js create mode 100644 docs/html/search/variables_b.js create mode 100644 docs/html/search/variables_c.js create mode 100644 docs/html/search/variables_d.js create mode 100644 docs/html/search/variables_e.js create mode 100644 docs/html/search/variables_f.js create mode 100644 docs/html/sha1_8c.html create mode 100644 docs/html/sha1_8c.js create mode 100644 docs/html/sha1_8c_source.html create mode 100644 docs/html/sha1_8h.html create mode 100644 docs/html/sha1_8h.js create mode 100644 docs/html/sha1_8h_source.html create mode 100644 docs/html/sha256_8c.html create mode 100644 docs/html/sha256_8c.js create mode 100644 docs/html/sha256_8c_source.html create mode 100644 docs/html/sha256_8h.html create mode 100644 docs/html/sha256_8h.js create mode 100644 docs/html/sha256_8h_source.html create mode 100644 docs/html/simd_8c.html create mode 100644 docs/html/simd_8c_source.html create mode 100644 docs/html/simd_8h.html create mode 100644 docs/html/simd_8h.js create mode 100644 docs/html/simd_8h_source.html create mode 100644 docs/html/spamsum_8c.html create mode 100644 docs/html/spamsum_8c.js create mode 100644 docs/html/spamsum_8c_source.html create mode 100644 docs/html/spamsum_8h.html create mode 100644 docs/html/spamsum_8h.js create mode 100644 docs/html/spamsum_8h_source.html create mode 100644 docs/html/structAaruHeader.html create mode 100644 docs/html/structAaruHeader.js create mode 100644 docs/html/structAaruHeaderV2.html create mode 100644 docs/html/structAaruHeaderV2.js create mode 100644 docs/html/structAaruMetadataJsonBlockHeader.html create mode 100644 docs/html/structAaruMetadataJsonBlockHeader.js create mode 100644 docs/html/structBlockHeader.html create mode 100644 docs/html/structBlockHeader.js create mode 100644 docs/html/structCacheEntry.html create mode 100644 docs/html/structCacheEntry.js create mode 100644 docs/html/structCacheHeader.html create mode 100644 docs/html/structCacheHeader.js create mode 100644 docs/html/structCdEccContext.html create mode 100644 docs/html/structCdEccContext.js create mode 100644 docs/html/structChecksumEntry.html create mode 100644 docs/html/structChecksumEntry.js create mode 100644 docs/html/structChecksumHeader.html create mode 100644 docs/html/structChecksumHeader.js create mode 100644 docs/html/structChecksums.html create mode 100644 docs/html/structChecksums.js create mode 100644 docs/html/structCicmMetadataBlock.html create mode 100644 docs/html/structCicmMetadataBlock.js create mode 100644 docs/html/structDdtHeader.html create mode 100644 docs/html/structDdtHeader.js create mode 100644 docs/html/structDdtHeader2.html create mode 100644 docs/html/structDdtHeader2.js create mode 100644 docs/html/structDumpExtent.html create mode 100644 docs/html/structDumpExtent.js create mode 100644 docs/html/structDumpHardwareEntriesWithData.html create mode 100644 docs/html/structDumpHardwareEntriesWithData.js create mode 100644 docs/html/structDumpHardwareEntry.html create mode 100644 docs/html/structDumpHardwareEntry.js create mode 100644 docs/html/structDumpHardwareHeader.html create mode 100644 docs/html/structDumpHardwareHeader.js create mode 100644 docs/html/structGeometryBlockHeader.html create mode 100644 docs/html/structGeometryBlockHeader.js create mode 100644 docs/html/structImageInfo.html create mode 100644 docs/html/structImageInfo.js create mode 100644 docs/html/structIndexEntry.html create mode 100644 docs/html/structIndexEntry.js create mode 100644 docs/html/structIndexHeader.html create mode 100644 docs/html/structIndexHeader.js create mode 100644 docs/html/structIndexHeader2.html create mode 100644 docs/html/structIndexHeader2.js create mode 100644 docs/html/structIndexHeader3.html create mode 100644 docs/html/structIndexHeader3.js create mode 100644 docs/html/structMetadataBlockHeader.html create mode 100644 docs/html/structMetadataBlockHeader.js create mode 100644 docs/html/structTapeDdtHashEntry.html create mode 100644 docs/html/structTapeDdtHashEntry.js create mode 100644 docs/html/structTapeFileEntry.html create mode 100644 docs/html/structTapeFileEntry.js create mode 100644 docs/html/structTapeFileHashEntry.html create mode 100644 docs/html/structTapeFileHashEntry.js create mode 100644 docs/html/structTapeFileHeader.html create mode 100644 docs/html/structTapeFileHeader.js create mode 100644 docs/html/structTapePartitionEntry.html create mode 100644 docs/html/structTapePartitionEntry.js create mode 100644 docs/html/structTapePartitionHashEntry.html create mode 100644 docs/html/structTapePartitionHashEntry.js create mode 100644 docs/html/structTapePartitionHeader.html create mode 100644 docs/html/structTapePartitionHeader.js create mode 100644 docs/html/structTrackEntry.html create mode 100644 docs/html/structTrackEntry.js create mode 100644 docs/html/structTracksHeader.html create mode 100644 docs/html/structTracksHeader.js create mode 100644 docs/html/structaaru__flac__ctx.html create mode 100644 docs/html/structaaru__flac__ctx.js create mode 100644 docs/html/structaaru__options.html create mode 100644 docs/html/structaaru__options.js create mode 100644 docs/html/structaaruformat__context.html create mode 100644 docs/html/structaaruformat__context.js create mode 100644 docs/html/structblockhash__ctx.html create mode 100644 docs/html/structblockhash__ctx.js create mode 100644 docs/html/structcrc64__ctx.html create mode 100644 docs/html/structcrc64__ctx.js create mode 100644 docs/html/structhash__map__t.html create mode 100644 docs/html/structhash__map__t.js create mode 100644 docs/html/structkv__pair__t.html create mode 100644 docs/html/structkv__pair__t.js create mode 100644 docs/html/structmd5__ctx.html create mode 100644 docs/html/structmd5__ctx.js create mode 100644 docs/html/structmediaTagEntry.html create mode 100644 docs/html/structmediaTagEntry.js create mode 100644 docs/html/structpriam__tag.html create mode 100644 docs/html/structpriam__tag.js create mode 100644 docs/html/structprofile__tag.html create mode 100644 docs/html/structprofile__tag.js create mode 100644 docs/html/structroll__state.html create mode 100644 docs/html/structroll__state.js create mode 100644 docs/html/structs_8h.html create mode 100644 docs/html/structs_8h_source.html create mode 100644 docs/html/structsha1__ctx.html create mode 100644 docs/html/structsha1__ctx.js create mode 100644 docs/html/structsha256__ctx.html create mode 100644 docs/html/structsha256__ctx.js create mode 100644 docs/html/structsony__tag.html create mode 100644 docs/html/structsony__tag.js create mode 100644 docs/html/structspamsum__ctx.html create mode 100644 docs/html/structspamsum__ctx.js create mode 100644 docs/html/tabs.css create mode 100644 docs/html/tape_8c.html create mode 100644 docs/html/tape_8c.js create mode 100644 docs/html/tape_8c_source.html create mode 100644 docs/html/tape_8h.html create mode 100644 docs/html/tape_8h.js create mode 100644 docs/html/tape_8h_source.html create mode 100644 docs/html/time_8c.html create mode 100644 docs/html/time_8c.js create mode 100644 docs/html/time_8c_source.html create mode 100644 docs/html/topics.html create mode 100644 docs/html/topics.js create mode 100644 docs/html/verify_8c.html create mode 100644 docs/html/verify_8c.js create mode 100644 docs/html/verify_8c_source.html create mode 100644 docs/html/write_8c.html create mode 100644 docs/html/write_8c.js create mode 100644 docs/html/write_8c_source.html diff --git a/docs/html/README_8md.html b/docs/html/README_8md.html new file mode 100644 index 0000000..29b0a80 --- /dev/null +++ b/docs/html/README_8md.html @@ -0,0 +1,113 @@ + + + + + + + +libaaruformat: README.md File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
README.md File Reference
+
+
+
+
+ +
+ + + + diff --git a/docs/html/aaru_8h.html b/docs/html/aaru_8h.html new file mode 100644 index 0000000..1b45f87 --- /dev/null +++ b/docs/html/aaru_8h.html @@ -0,0 +1,889 @@ + + + + + + + +libaaruformat: include/aaru.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
aaru.h File Reference
+
+
+ +

Public high-level API types: media classifications, per-sector / per-media tag enums and image summary. +More...

+
#include <stdint.h>
+
+

Go to the source code of this file.

+ + + + +

+Data Structures

struct  ImageInfo
 High-level summary of an opened Aaru image containing metadata and media characteristics. More...
+ + +

+Typedefs

typedef struct ImageInfo ImageInfo
+ + + + + +

+Enumerations

enum  MediaType {
+  Unknown = 0 +, UnknownMO = 1 +, GENERIC_HDD = 2 +, Microdrive = 3 +,
+  Zone_HDD = 4 +, FlashDrive = 5 +, CD = 10 +, CDDA = 11 +,
+  CDG = 12 +, CDEG = 13 +, CDI = 14 +, CDROM = 15 +,
+  CDROMXA = 16 +, CDPLUS = 17 +, CDMO = 18 +, CDR = 19 +,
+  CDRW = 20 +, CDMRW = 21 +, VCD = 22 +, SVCD = 23 +,
+  PCD = 24 +, SACD = 25 +, DDCD = 26 +, DDCDR = 27 +,
+  DDCDRW = 28 +, DTSCD = 29 +, CDMIDI = 30 +, CDV = 31 +,
+  PD650 = 32 +, PD650_WORM = 33 +, CDIREADY = 34 +, FMTOWNS = 35 +,
+  DVDROM = 40 +, DVDR = 41 +, DVDRW = 42 +, DVDPR = 43 +,
+  DVDPRW = 44 +, DVDPRWDL = 45 +, DVDRDL = 46 +, DVDPRDL = 47 +,
+  DVDRAM = 48 +, DVDRWDL = 49 +, DVDDownload = 50 +, HDDVDROM = 51 +,
+  HDDVDRAM = 52 +, HDDVDR = 53 +, HDDVDRW = 54 +, HDDVDRDL = 55 +,
+  HDDVDRWDL = 56 +, BDROM = 60 +, BDR = 61 +, BDRE = 62 +,
+  BDRXL = 63 +, BDREXL = 64 +, EVD = 70 +, FVD = 71 +,
+  HVD = 72 +, CBHD = 73 +, HDVMD = 74 +, VCDHD = 75 +,
+  SVOD = 76 +, FDDVD = 77 +, LD = 80 +, LDROM = 81 +,
+  LDROM2 = 82 +, LVROM = 83 +, MegaLD = 84 +, HiMD = 90 +,
+  MD = 91 +, MDData = 92 +, MDData2 = 93 +, UDO = 100 +,
+  UDO2 +, UDO2_WORM +, PlayStationMemoryCard = 110 +, PlayStationMemoryCard2 = 111 +,
+  PS1CD = 112 +, PS2CD = 113 +, PS2DVD = 114 +, PS3DVD = 115 +,
+  PS3BD = 116 +, PS4BD = 117 +, UMD = 118 +, PlayStationVitaGameCard = 119 +,
+  XGD = 130 +, XGD2 = 131 +, XGD3 = 132 +, XGD4 = 133 +,
+  MEGACD = 150 +, SATURNCD = 151 +, GDROM = 152 +, GDR = 153 +,
+  SegaCard = 154 +, MilCD = 155 +, HuCard = 170 +, SuperCDROM2 = 171 +,
+  JaguarCD = 172 +, ThreeDO = 173 +, PCFX = 174 +, NeoGeoCD = 175 +,
+  CDTV = 176 +, CD32 = 177 +, Nuon = 178 +, Playdia = 179 +,
+  Apple32SS = 180 +, Apple32DS = 181 +, Apple33SS = 182 +, Apple33DS = 183 +,
+  AppleSonySS = 184 +, AppleSonyDS = 185 +, AppleFileWare = 186 +, DOS_525_SS_DD_8 = 190 +,
+  DOS_525_SS_DD_9 = 191 +, DOS_525_DS_DD_8 = 192 +, DOS_525_DS_DD_9 = 193 +, DOS_525_HD = 194 +,
+  DOS_35_SS_DD_8 = 195 +, DOS_35_SS_DD_9 = 196 +, DOS_35_DS_DD_8 = 197 +, DOS_35_DS_DD_9 = 198 +,
+  DOS_35_HD = 199 +, DOS_35_ED = 200 +, DMF = 201 +, DMF_82 = 202 +,
+  XDF_525 = 203 +, XDF_35 = 204 +, IBM23FD = 210 +, IBM33FD_128 = 211 +,
+  IBM33FD_256 = 212 +, IBM33FD_512 = 213 +, IBM43FD_128 = 214 +, IBM43FD_256 = 215 +,
+  IBM53FD_256 = 216 +, IBM53FD_512 = 217 +, IBM53FD_1024 = 218 +, RX01 = 220 +,
+  RX02 = 221 +, RX03 = 222 +, RX50 = 223 +, ACORN_525_SS_SD_40 = 230 +,
+  ACORN_525_SS_SD_80 = 231 +, ACORN_525_SS_DD_40 = 232 +, ACORN_525_SS_DD_80 = 233 +, ACORN_525_DS_DD = 234 +,
+  ACORN_35_DS_DD = 235 +, ACORN_35_DS_HD = 236 +, ATARI_525_SD = 240 +, ATARI_525_ED = 241 +,
+  ATARI_525_DD = 242 +, ATARI_35_SS_DD = 243 +, ATARI_35_DS_DD = 244 +, ATARI_35_SS_DD_11 = 245 +,
+  ATARI_35_DS_DD_11 = 246 +, CBM_35_DD = 250 +, CBM_AMIGA_35_DD = 251 +, CBM_AMIGA_35_HD = 252 +,
+  CBM_1540 = 253 +, CBM_1540_Ext = 254 +, CBM_1571 = 255 +, NEC_8_SD = 260 +,
+  NEC_8_DD = 261 +, NEC_525_SS = 262 +, NEC_525_DS = 263 +, NEC_525_HD = 264 +,
+  NEC_35_HD_8 = 265 +, NEC_35_HD_15 = 266 +, NEC_35_TD = 267 +, SHARP_525 = NEC_525_HD +,
+  SHARP_525_9 = 268 +, SHARP_35 = NEC_35_HD_8 +, SHARP_35_9 = 269 +, ECMA_99_8 = 270 +,
+  ECMA_99_15 = 271 +, ECMA_99_26 = 272 +, ECMA_100 = DOS_35_DS_DD_9 +, ECMA_125 = DOS_35_HD +,
+  ECMA_147 = DOS_35_ED +, ECMA_54 = 273 +, ECMA_59 = 274 +, ECMA_66 +,
+  ECMA_69_8 = 276 +, ECMA_69_15 = 277 +, ECMA_69_26 = 278 +, ECMA_70 = 279 +,
+  ECMA_78 = 280 +, ECMA_78_2 = 281 +, FDFORMAT_525_DD = 290 +, FDFORMAT_525_HD = 291 +,
+  FDFORMAT_35_DD = 292 +, FDFORMAT_35_HD = 293 +, Apricot_35 = 309 +, ADR2120 = 310 +,
+  ADR260 = 311 +, ADR30 = 312 +, ADR50 = 313 +, AIT1 = 320 +,
+  AIT1Turbo = 321 +, AIT2 = 322 +, AIT2Turbo = 323 +, AIT3 = 324 +,
+  AIT3Ex = 325 +, AIT3Turbo = 326 +, AIT4 = 327 +, AIT5 = 328 +,
+  AITETurbo = 329 +, SAIT1 = 330 +, SAIT2 = 331 +, Bernoulli = 340 +,
+  Bernoulli2 = 341 +, Ditto = 342 +, DittoMax = 343 +, Jaz = 344 +,
+  Jaz2 = 345 +, PocketZip = 346 +, REV120 = 347 +, REV35 = 348 +,
+  REV70 = 349 +, ZIP100 = 350 +, ZIP250 = 351 +, ZIP750 = 352 +,
+  CompactCassette = 360 +, Data8 = 361 +, MiniDV = 362 +, Dcas25 = 363 +,
+  Dcas85 = 364 +, Dcas103 = 365 +, CFast = 370 +, CompactFlash = 371 +,
+  CompactFlashType2 = 372 +, DigitalAudioTape = 380 +, DAT160 = 381 +, DAT320 = 382 +,
+  DAT72 = 383 +, DDS1 = 384 +, DDS2 = 385 +, DDS3 = 386 +,
+  DDS4 = 387 +, CompactTapeI = 390 +, CompactTapeII = 391 +, DECtapeII = 392 +,
+  DLTtapeIII = 393 +, DLTtapeIIIxt = 394 +, DLTtapeIV = 395 +, DLTtapeS4 = 396 +,
+  SDLT1 = 397 +, SDLT2 = 398 +, VStapeI = 399 +, Exatape15m = 400 +,
+  Exatape22m = 401 +, Exatape22mAME = 402 +, Exatape28m = 403 +, Exatape40m = 404 +,
+  Exatape45m = 405 +, Exatape54m = 406 +, Exatape75m = 407 +, Exatape76m = 408 +,
+  Exatape80m = 409 +, Exatape106m = 410 +, Exatape160mXL = 411 +, Exatape112m = 412 +,
+  Exatape125m = 413 +, Exatape150m = 414 +, Exatape170m = 415 +, Exatape225m = 416 +,
+  ExpressCard34 = 420 +, ExpressCard54 = 421 +, PCCardTypeI = 422 +, PCCardTypeII = 423 +,
+  PCCardTypeIII = 424 +, PCCardTypeIV = 425 +, EZ135 = 430 +, EZ230 = 431 +,
+  Quest = 432 +, SparQ = 433 +, SQ100 = 434 +, SQ200 = 435 +,
+  SQ300 = 436 +, SQ310 = 437 +, SQ327 = 438 +, SQ400 = 439 +,
+  SQ800 = 440 +, SQ1500 = 441 +, SQ2000 = 442 +, SyJet = 443 +,
+  FamicomGamePak = 450 +, GameBoyAdvanceGamePak = 451 +, GameBoyGamePak = 452 +, GOD = 453 +,
+  N64DD = 454 +, N64GamePak = 455 +, NESGamePak = 456 +, Nintendo3DSGameCard = 457 +,
+  NintendoDiskCard = 458 +, NintendoDSGameCard = 459 +, NintendoDSiGameCard = 460 +, SNESGamePak = 461 +,
+  SNESGamePakUS = 462 +, WOD = 463 +, WUOD = 464 +, SwitchGameCard = 465 +,
+  IBM3470 = 470 +, IBM3480 = 471 +, IBM3490 = 472 +, IBM3490E = 473 +,
+  IBM3592 = 474 +, LTO = 480 +, LTO2 = 481 +, LTO3 = 482 +,
+  LTO3WORM = 483 +, LTO4 = 484 +, LTO4WORM = 485 +, LTO5 = 486 +,
+  LTO5WORM = 487 +, LTO6 = 488 +, LTO6WORM = 489 +, LTO7 = 490 +,
+  LTO7WORM = 491 +, MemoryStick = 510 +, MemoryStickDuo = 511 +, MemoryStickMicro = 512 +,
+  MemoryStickPro = 513 +, MemoryStickProDuo = 514 +, microSD = 520 +, miniSD = 521 +,
+  SecureDigital = 522 +, MMC = 530 +, MMCmicro = 531 +, RSMMC = 532 +,
+  MMCplus = 533 +, MMCmobile = 534 +, MLR1 = 540 +, MLR1SL = 541 +,
+  MLR3 = 542 +, SLR1 = 543 +, SLR2 = 544 +, SLR3 = 545 +,
+  SLR32 = 546 +, SLR32SL = 547 +, SLR4 = 548 +, SLR5 = 549 +,
+  SLR5SL = 550 +, SLR6 = 551 +, SLRtape7 = 552 +, SLRtape7SL = 553 +,
+  SLRtape24 = 554 +, SLRtape24SL = 555 +, SLRtape40 = 556 +, SLRtape50 = 557 +,
+  SLRtape60 = 558 +, SLRtape75 = 559 +, SLRtape100 = 560 +, SLRtape140 = 561 +,
+  QIC11 = 570 +, QIC120 = 571 +, QIC1350 = 572 +, QIC150 = 573 +,
+  QIC24 = 574 +, QIC3010 = 575 +, QIC3020 = 576 +, QIC3080 = 577 +,
+  QIC3095 = 578 +, QIC320 = 579 +, QIC40 = 580 +, QIC525 = 581 +,
+  QIC80 = 582 +, STK4480 = 590 +, STK4490 = 591 +, STK9490 = 592 +,
+  T9840A = 593 +, T9840B = 594 +, T9840C = 595 +, T9840D = 596 +,
+  T9940A = 597 +, T9940B = 598 +, T10000A = 599 +, T10000B = 600 +,
+  T10000C = 601 +, T10000D = 602 +, Travan = 610 +, Travan1Ex = 611 +,
+  Travan3 = 612 +, Travan3Ex = 613 +, Travan4 = 614 +, Travan5 = 615 +,
+  Travan7 = 616 +, VXA1 = 620 +, VXA2 = 621 +, VXA3 = 622 +,
+  ECMA_153 = 630 +, ECMA_153_512 = 631 +, ECMA_154 = 632 +, ECMA_183_512 = 633 +,
+  ECMA_183 = 634 +, ECMA_184_512 = 635 +, ECMA_184 = 636 +, ECMA_189 = 637 +,
+  ECMA_190 = 638 +, ECMA_195 = 639 +, ECMA_195_512 = 640 +, ECMA_201 = 641 +,
+  ECMA_201_ROM = 642 +, ECMA_223 = 643 +, ECMA_223_512 = 644 +, ECMA_238 = 645 +,
+  ECMA_239 = 646 +, ECMA_260 = 647 +, ECMA_260_Double = 648 +, ECMA_280 = 649 +,
+  ECMA_317 = 650 +, ECMA_322 = 651 +, ECMA_322_2k = 652 +, GigaMo = 653 +,
+  GigaMo2 = 654 +, CompactFloppy = 660 +, DemiDiskette = 661 +, Floptical = 662 +,
+  HiFD = 663 +, QuickDisk = 664 +, UHD144 = 665 +, VideoFloppy = 666 +,
+  Wafer = 667 +, ZXMicrodrive = 668 +, BeeCard = 670 +, Borsu = 671 +,
+  DataStore = 672 +, DIR = 673 +, DST = 674 +, DTF = 675 +,
+  DTF2 = 676 +, Flextra3020 = 677 +, Flextra3225 = 678 +, HiTC1 = 679 +,
+  HiTC2 = 680 +, LT1 = 681 +, MiniCard = 872 +, Orb = 683 +,
+  Orb5 = 684 +, SmartMedia = 685 +, xD = 686 +, XQD = 687 +,
+  DataPlay = 688 +, AppleProfile = 690 +, AppleWidget = 691 +, AppleHD20 = 692 +,
+  PriamDataTower = 693 +, Pippin = 694 +, RA60 = 700 +, RA80 = 701 +,
+  RA81 = 702 +, RC25 = 703 +, RD31 = 704 +, RD32 = 705 +,
+  RD51 = 706 +, RD52 = 707 +, RD53 = 708 +, RD54 = 709 +,
+  RK06 = 710 +, RK06_18 = 711 +, RK07 = 712 +, RK07_18 = 713 +,
+  RM02 = 714 +, RM03 = 715 +, RM05 = 716 +, RP02 = 717 +,
+  RP02_18 = 718 +, RP03 = 719 +, RP03_18 = 720 +, RP04 = 721 +,
+  RP04_18 = 722 +, RP05 = 723 +, RP05_18 = 724 +, RP06 = 725 +,
+  RP06_18 = 726 +, LS120 = 730 +, LS240 = 731 +, FD32MB = 732 +,
+  RDX = 733 +, RDX320 = 734 +, VideoNow = 740 +, VideoNowColor = 741 +,
+  VideoNowXp = 742 +
+ }
 Enumerates every recognized media / cartridge / optical / tape / card / disk format. More...
enum  SectorTagType {
+  AppleSectorTag = 0 +, CdSectorSync = 1 +, CdSectorHeader = 2 +, CdSectorSubHeader = 3 +,
+  CdSectorEdc = 4 +, CdSectorEccP = 5 +, CdSectorEccQ = 6 +, CdSectorEcc = 7 +,
+  CdSectorSubchannelAaru = 8 +, CdTrackIsrc = 9 +, CdTrackText = 10 +, CdTrackFlags = 11 +,
+  DvdCmi = 12 +, FloppyAddressMark = 13 +, DvdSectorTitleKey = 14 +, DvdTitleKeyDecrypted = 15 +,
+  DvdSectorInformation = 16 +, DvdSectorNumber = 17 +, DvdSectorIedAaru = 18 +, DvdSectorEdcAaru = 19 +,
+  MaxSectorTag = DvdSectorEdcAaru +
+ }
enum  MediaTagType {
+  CD_TOC = 0 +, CD_SessionInfo = 1 +, CD_FullTOC = 2 +, CD_PMA = 3 +,
+  CD_ATIP = 4 +, CD_TEXT = 5 +, CD_MCN = 6 +, DVD_PFI = 7 +,
+  DVD_CMI = 8 +, DVD_DiscKey = 9 +, DVD_BCA = 10 +, DVD_DMI = 11 +,
+  DVD_MediaIdentifier = 12 +, DVD_MKB = 13 +, DVDRAM_DDS = 14 +, DVDRAM_MediumStatus = 15 +,
+  DVDRAM_SpareArea = 16 +, DVDR_RMD = 17 +, DVDR_PreRecordedInfo = 18 +, DVDR_MediaIdentifier = 19 +,
+  DVDR_PFI = 20 +, DVD_ADIP = 21 +, HDDVD_CPI = 22 +, HDDVD_MediumStatus = 23 +,
+  DVDDL_LayerCapacity = 24 +, DVDDL_MiddleZoneAddress = 25 +, DVDDL_JumpIntervalSize = 26 +, DVDDL_ManualLayerJumpLBA = 27 +,
+  BD_DI = 28 +, BD_BCA = 29 +, BD_DDS = 30 +, BD_CartridgeStatus = 31 +,
+  BD_SpareArea = 32 +, AACS_VolumeIdentifier = 33 +, AACS_SerialNumber = 34 +, AACS_MediaIdentifier = 35 +,
+  AACS_MKB = 36 +, AACS_DataKeys = 37 +, AACS_LBAExtents = 38 +, AACS_CPRM_MKB = 39 +,
+  Hybrid_RecognizedLayers = 40 +, MMC_WriteProtection = 41 +, MMC_DiscInformation = 42 +, MMC_TrackResourcesInformation = 43 +,
+  MMC_POWResourcesInformation = 44 +, SCSI_INQUIRY = 45 +, SCSI_MODEPAGE_2A = 46 +, ATA_IDENTIFY = 47 +,
+  ATAPI_IDENTIFY = 48 +, PCMCIA_CIS = 49 +, SD_CID = 50 +, SD_CSD = 51 +,
+  SD_SCR = 52 +, SD_OCR = 53 +, MMC_CID = 54 +, MMC_CSD = 55 +,
+  MMC_OCR = 56 +, MMC_ExtendedCSD = 57 +, Xbox_SecuritySector = 58 +, Floppy_LeadOut = 59 +,
+  DCB = 60 +, CD_FirstTrackPregap = 61 +, CD_LeadOut = 62 +, SCSI_MODESENSE_6 = 63 +,
+  SCSI_MODESENSE_10 = 64 +, USB_Descriptors = 65 +, Xbox_DMI = 66 +, Xbox_PFI = 67 +,
+  CD_LeadIn = 68 +, MiniDiscType = 69 +, MiniDiscD5 = 70 +, MiniDiscUTOC = 71 +,
+  MiniDiscDTOC = 72 +, DVD_DiscKey_Decrypted = 73 +
+ }
+

Detailed Description

+

Public high-level API types: media classifications, per-sector / per-media tag enums and image summary.

+

This header provides:

    +
  • MediaType : exhaustive enumeration of recognized physical / logical media formats (disks, tapes, cards, optics).
  • +
  • ImageInfo : summary metadata extracted from an opened image (sizes, creator, geometry, drive/media identity).
  • +
  • SectorTagType : bit-addressable per-sector auxiliary data kinds (prefix/suffix/ECC/subchannel, etc.).
  • +
  • MediaTagType : higher-level per-media metadata structures (TOCs, format information, IDs, inquiry pages, etc.).
  • +
+

Value range conventions (MediaType): groups of contiguous numeric IDs are reserved for technology families; comments in the enum mark the ranges. This stable numeric mapping forms part of the external on-disk and API contract—do not renumber existing entries. New media types must be appended in an unused range or in an explicitly extended tail section to preserve backward compatibility.

+

Thread safety: All types here are PODs / enumerations and are safe for concurrent read-only access. Encoding: All UTF-8 textual pointers inside ImageInfo refer to NUL-terminated dynamically allocated buffers owned by the context that produced them (caller copies if persistence is required beyond context lifetime).

+

See also: aaruformat/context.h for runtime context internals and metadata/dump structures.

+ +

Definition in file aaru.h.

+

Typedef Documentation

+ +

◆ ImageInfo

+ +
+
+ + + + +
typedef struct ImageInfo ImageInfo
+
+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/aaru_8h.js b/docs/html/aaru_8h.js new file mode 100644 index 0000000..72bfe38 --- /dev/null +++ b/docs/html/aaru_8h.js @@ -0,0 +1,586 @@ +var aaru_8h = +[ + [ "ImageInfo", "aaru_8h.html#ad25ec179830ef7212282e4e4be62eafc", null ], + [ "MediaTagType", "group__MediaTags.html#gabdd09c559df8f34ae68fcb2ff1892ebe", [ + [ "CD_TOC", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea19936e1f9f92973f04c4206aabd63fc0", null ], + [ "CD_SessionInfo", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea3a6c6117044b4ff4e82eaca80aeffa5d", null ], + [ "CD_FullTOC", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeac41725b478131a32c6732bdc0716fc37", null ], + [ "CD_PMA", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeae8ebe2642dea52941221494e628dde43", null ], + [ "CD_ATIP", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea53d8953b8b5b6a61eba7e702521e531b", null ], + [ "CD_TEXT", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea6dea4e03372f3a5c04ee2a749880658e", null ], + [ "CD_MCN", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea6e31c5432c226da563183be0df9b535d", null ], + [ "DVD_PFI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea3c321569dc733d489eef07f5dc24a77a", null ], + [ "DVD_CMI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea23e0bce46fca436974a6fcbeb7e28366", null ], + [ "DVD_DiscKey", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea5d578c2ca1c95f0d229ddd9c2049400d", null ], + [ "DVD_BCA", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaae59a529c9f6e6e9afce9d4182f36788", null ], + [ "DVD_DMI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaadc5743c51f052e6e5a0b5449fdb4c12", null ], + [ "DVD_MediaIdentifier", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea6b893be6d1d457d464dd30d1e4126ae7", null ], + [ "DVD_MKB", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaafbeb4b604c8c02ad7205917948ef8ee", null ], + [ "DVDRAM_DDS", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea51bf18728367fbb92aebcfc877b5073f", null ], + [ "DVDRAM_MediumStatus", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaea5a748ee575bccffbe6acb00f9344f3", null ], + [ "DVDRAM_SpareArea", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea22d63ec3e13a2124275d8e5a17495a68", null ], + [ "DVDR_RMD", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaa6b1df1daac25656b57d3884cc76cfce", null ], + [ "DVDR_PreRecordedInfo", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea4eea08851cae61e2e5a151679c24d8fa", null ], + [ "DVDR_MediaIdentifier", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea2b455bad21ec128c687a04b7727f7148", null ], + [ "DVDR_PFI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea6ad222e2ed126add477aff995adc7d6e", null ], + [ "DVD_ADIP", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeac7c0f66e7a8d749c648b00af8863b67e", null ], + [ "HDDVD_CPI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeae7b93271a5caf33ce79503a1873e460e", null ], + [ "HDDVD_MediumStatus", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea75c19a67aee7ea51d0456f7212194918", null ], + [ "DVDDL_LayerCapacity", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea98e0119351bfcc3a96da5cf3d2e29ba3", null ], + [ "DVDDL_MiddleZoneAddress", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea853784fa692db695ec8f108a8cdd6ecd", null ], + [ "DVDDL_JumpIntervalSize", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea084726467616b3569039fdaa83a2531d", null ], + [ "DVDDL_ManualLayerJumpLBA", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea2163f38afb7b3c035610257ef491e0bf", null ], + [ "BD_DI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaffb17871a6a508af15eacc2f96349f61", null ], + [ "BD_BCA", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea9aae209cf8153d11507c506369f7494d", null ], + [ "BD_DDS", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea008f96361a248e4d4425402672ee1955", null ], + [ "BD_CartridgeStatus", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea482effdb660ead9def2fd03e60ed5644", null ], + [ "BD_SpareArea", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea1266c42d020713df4fa1a550fd72c5ae", null ], + [ "AACS_VolumeIdentifier", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea996c276a1ef9bd0450765cbf7d65c3aa", null ], + [ "AACS_SerialNumber", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea4d71cd8420cfe39624125c89f534c763", null ], + [ "AACS_MediaIdentifier", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea90c88c940ebc0178839d7224e723f5c1", null ], + [ "AACS_MKB", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea582480c2ac97445bccf117bf57c0d5c5", null ], + [ "AACS_DataKeys", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea53360a1de5bb9ed6ad0d9a2e1fa5987c", null ], + [ "AACS_LBAExtents", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaa7492b2607662192d7ab324e07ebe931", null ], + [ "AACS_CPRM_MKB", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaa63c093172a0a107e6004db645b85d4b", null ], + [ "Hybrid_RecognizedLayers", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea9dd5869095cb1fc785fd619da232a8cb", null ], + [ "MMC_WriteProtection", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeafc1040d1dec1cbae6d7b5b5faa91d672", null ], + [ "MMC_DiscInformation", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea5efb5d5b4be2b779de7c851aec3073e2", null ], + [ "MMC_TrackResourcesInformation", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea70fe49a37b43f7c59555107774b601bc", null ], + [ "MMC_POWResourcesInformation", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea8e1457b78bfece7ba405fcc8780fabb7", null ], + [ "SCSI_INQUIRY", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeabcbe501e664018ecf867f5b618e8277e", null ], + [ "SCSI_MODEPAGE_2A", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea000b6f0b3062df2a587f1490b58aaa20", null ], + [ "ATA_IDENTIFY", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea67902436f41ef62eb2404a0642e4ba26", null ], + [ "ATAPI_IDENTIFY", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea3a158af5d463f6535a84a4bb9d993dd4", null ], + [ "PCMCIA_CIS", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaea8ebc0474ea18414f182146c7f38db8", null ], + [ "SD_CID", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaf44743291e02e818e016f273ca1a121e", null ], + [ "SD_CSD", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeabc2e7406d62921895e3dcafc488eee96", null ], + [ "SD_SCR", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea5075bf29e39d7806cd9ecb5be6297619", null ], + [ "SD_OCR", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeae8db5476a87a3257c7e2705af1191ccb", null ], + [ "MMC_CID", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea0308fc707575b084ba1d0c6d16dc4809", null ], + [ "MMC_CSD", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea0a8c84bb9e459ec4e2270df915333f20", null ], + [ "MMC_OCR", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeace4662d46311a22be1eeb992b1037d5f", null ], + [ "MMC_ExtendedCSD", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea6d0f27fc4872800de6463d373fbda75b", null ], + [ "Xbox_SecuritySector", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea732b4820de4ba58e20953581fc1b0414", null ], + [ "Floppy_LeadOut", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea8588ae2ee995dfda8014f67a8072c59a", null ], + [ "DCB", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea7ce91d5bad8ca3fa18e2296b28cd644f", null ], + [ "CD_FirstTrackPregap", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaf55cf5503503f10b3e34eb16fa28d712", null ], + [ "CD_LeadOut", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea6bc1632b0f411e02fee79e4109f76146", null ], + [ "SCSI_MODESENSE_6", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea35dde3eb642e833bc907172c12cf72ca", null ], + [ "SCSI_MODESENSE_10", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea2ea4f436ea5c928fad353248467584db", null ], + [ "USB_Descriptors", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea32d2347b98e6b47e29cb1da692c6ad47", null ], + [ "Xbox_DMI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea4d51ede590eaa583c19b4d12ab7163b1", null ], + [ "Xbox_PFI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaeb88743e8c01a171df432876e5dd1a2f", null ], + [ "CD_LeadIn", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea3d8ba887e5b5cbd30a150980bcb6f48b", null ], + [ "MiniDiscType", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea668f4d55999da66ca23e8d943bbdf446", null ], + [ "MiniDiscD5", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea07d05a8c30e7516139ae761ac9eaefc1", null ], + [ "MiniDiscUTOC", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea7d3b34c3cd93d13905a87b466859b2a7", null ], + [ "MiniDiscDTOC", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea05624139ec685ba219acbc9ea0e49100", null ], + [ "DVD_DiscKey_Decrypted", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea109296d460fd5fc05446914dad9a0834", null ] + ] ], + [ "MediaType", "group__MediaTypes.html#ga1499e9f8a76cb81b43b7a4b0dbe7e44a", [ + [ "Unknown", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4e81c184ac3ad48a389cd4454c4a05bb", null ], + [ "UnknownMO", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa7fe08f73fb4c4f769e22c9fa7aac574", null ], + [ "GENERIC_HDD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aabe5fe31589b006affd9e65af071eb952", null ], + [ "Microdrive", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aabbc00e6dd97647ce34dfb1df8abc90c3", null ], + [ "Zone_HDD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3bdd404bc417081c8b5291bd8a49cbf4", null ], + [ "FlashDrive", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa57ae1fe6db732532ab7ffc732f826a23", null ], + [ "CD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9aea9e501fa935b114b235e8e9754267", null ], + [ "CDDA", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2931a7599dc57bd2db354a9638940193", null ], + [ "CDG", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1614aa017f103a05653a0d97aed82ede", null ], + [ "CDEG", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa24cc59b29fa409cdd7a9eeeb3a93a204", null ], + [ "CDI", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad2567d992fdf3df571ebbfba26f6e36e", null ], + [ "CDROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa359123216b26bd526c3a0b22e4a2e7fb", null ], + [ "CDROMXA", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0446766c082644f79001c24ea2095a5b", null ], + [ "CDPLUS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4f607f12adb6b9b7e46ae74916a3d078", null ], + [ "CDMO", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa230876d2ecbd62981bb9ad705f0862ff", null ], + [ "CDR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1117f14bfc3d2eeb593d7d4eccdb09d9", null ], + [ "CDRW", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa408f2dbd9aa3d80242a95819b8d5554c", null ], + [ "CDMRW", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2bf9f431ddc8a4bffceb3f85623bb96e", null ], + [ "VCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3e4f8fc0b0de2be739bc4e6aca61039a", null ], + [ "SVCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa42a85e55170f4b530f2841fe6d56b388", null ], + [ "PCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1556dd6c1b90666aefa74725b8d47f50", null ], + [ "SACD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6903c0dd79d234b9379daaaa97e2c0fe", null ], + [ "DDCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa23274a7e0b8dd0595a1cc3c34b53cbd2", null ], + [ "DDCDR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa49130f592d16013e73c54973f955ecf2", null ], + [ "DDCDRW", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacba105bad341306b948401a57e614321", null ], + [ "DTSCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac3a40c0ead8d2010547ae2525545c44a", null ], + [ "CDMIDI", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa75fa65ad8c509d1472d5aab9976cb3ed", null ], + [ "CDV", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa15c2e9c62a04ccf3ca8bc4a151ef289d", null ], + [ "PD650", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad78c761d32c5c140d29cf10e5b7c9a13", null ], + [ "PD650_WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6c27710f712f3814021f9797b2260fb0", null ], + [ "CDIREADY", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3299c8db9ba7b48ee7492b2dfbfdfeca", null ], + [ "FMTOWNS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa54a5601323f7c9935ba35beb1da5abcd", null ], + [ "DVDROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf254215c04f84a87eef3702782ba7662", null ], + [ "DVDR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa711ac65a3b3a2d5392d2efee1616bcd7", null ], + [ "DVDRW", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4cfa242859c1a136a740718d0440de9a", null ], + [ "DVDPR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac3c8ca46e314f36e5398a97e85b7a3d1", null ], + [ "DVDPRW", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad5de19f38ea842de6d5edc2baa586160", null ], + [ "DVDPRWDL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa44d41093d0d9a56fa5e9fa317c4d795a", null ], + [ "DVDRDL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadff93972faa98cafc01f4fbb464680a2", null ], + [ "DVDPRDL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6a04ebe8862d4f729e9dad48bfe92b99", null ], + [ "DVDRAM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaff04a947594e116dd0adf854660ff00a", null ], + [ "DVDRWDL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa502cfc3a14e97fdb99a2856c2f230e19", null ], + [ "DVDDownload", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadf89869853533586979db286065899af", null ], + [ "HDDVDROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa38dff83456540de8b0db2e8eacb5285c", null ], + [ "HDDVDRAM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa70672f466c2dfca0b557642b132c1088", null ], + [ "HDDVDR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab01abc4a564ec1ac8e39410ad69b187f", null ], + [ "HDDVDRW", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab8d5793ab3e0bd984e307c7f062183cc", null ], + [ "HDDVDRDL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa53cac04042ea5e943a8101b338749941", null ], + [ "HDDVDRWDL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5f682cb56cf6b64e19a182ea5829e8a1", null ], + [ "BDROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa79ba622fe51ab85f82ac1fef5d91ecf0", null ], + [ "BDR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaac8f48f5db15c7112e6fe4a466582b33", null ], + [ "BDRE", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac38c8f08c0f5b53d87aca57202eaf123", null ], + [ "BDRXL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa47f36801fd65d252e56797ef3d9bf67f", null ], + [ "BDREXL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0125edd84c12e1352cd217e927bcb0c0", null ], + [ "EVD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa67532fa1f785395445fd7cc2500f089a", null ], + [ "FVD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad0c431131a66081e6b394fafdb9828c4", null ], + [ "HVD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1a2d49c9c7b0809a5003a9237c38d139", null ], + [ "CBHD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa90ebc69abd374bc98b2dc66ce9af4e4", null ], + [ "HDVMD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab28ee6d0eec9bde3fe3a27d89356ddfb", null ], + [ "VCDHD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa98d53c50a738e49829883104d8df2727", null ], + [ "SVOD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0e880bad655cd93dfd4321c6a559dd5c", null ], + [ "FDDVD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf608c0182cd563d9da77fdba304e75bb", null ], + [ "LD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa24a5a956f8abcaacbde751c49c7d5001", null ], + [ "LDROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaaeb95cfb92ff05358a9b84a7413566c5", null ], + [ "LDROM2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf4798e7a7578b9ecbdb4f952e807c3e8", null ], + [ "LVROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadcf43ad5c010a9983baca9265c7cc4ae", null ], + [ "MegaLD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3e21b5d6e37cf7a60ca04dc86223a945", null ], + [ "HiMD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaebf4449aff0958611c03d3814ab6d205", null ], + [ "MD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa800ab8d25820e3e9fe503340561b0ca6", null ], + [ "MDData", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa79f28d42c4e7ffa514469ffdc7c59d51", null ], + [ "MDData2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa2fe0d2f1b6a286c5899a57787711b72", null ], + [ "UDO", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab07b439547f22e1c4ae92a400aea569e", null ], + [ "UDO2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aade3918df59411bc34c0583ab909c0e30", null ], + [ "UDO2_WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1db9c2ebd6274e845ca174dc8d6ea425", null ], + [ "PlayStationMemoryCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8292cf4b43ef2f4db9ac31704a6c7c03", null ], + [ "PlayStationMemoryCard2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa159fdac30e1b0d0714be311dd73be7da", null ], + [ "PS1CD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa59c572262681092c6da3188135ae944f", null ], + [ "PS2CD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafa77828f2ea2ff692992611a19307d9f", null ], + [ "PS2DVD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8dccd9aa3702e0112d3c4d6f3388820e", null ], + [ "PS3DVD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa727f071d5dd887fd6645e112cfcab197", null ], + [ "PS3BD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa626b10297c3bc07fbff69cf639208453", null ], + [ "PS4BD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaafd24844aa48e831be04f4a6446c9e48", null ], + [ "UMD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa649acec76a8835e5d968c8bd01e7a279", null ], + [ "PlayStationVitaGameCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa806f0de17c9f3ec6d688af26a51b89d", null ], + [ "XGD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6576c3669ab86877d0f12cfa5845a0e9", null ], + [ "XGD2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaae690ba36140800288e9635e35305575", null ], + [ "XGD3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6165a80d91d5a2e616a7ce034c5c3611", null ], + [ "XGD4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa933052f31f7e81b8c25f959861039774", null ], + [ "MEGACD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2e3fdf35c0b2961d6a0ab00407ce7fcb", null ], + [ "SATURNCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa5050a2f9296ac5f92e12287c00799ec", null ], + [ "GDROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa04566d313f48518f585f1c7b097f5c1", null ], + [ "GDR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2729318ff14e174d2ef9484bccf1dadb", null ], + [ "SegaCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0ff37a24cd37bbded4c4e3176373c46e", null ], + [ "MilCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac24c0127190d9b8bdbdccbb49a9cc8a8", null ], + [ "HuCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa61d6c579f7abab5881d150ad12c459f0", null ], + [ "SuperCDROM2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3e52a110f0759765e20f0c3380ad72a6", null ], + [ "JaguarCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8a082102c8bb98196eaad3fbd8131a86", null ], + [ "ThreeDO", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa13d8116741c1455648e1a69829d62cde", null ], + [ "PCFX", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa765042a646a55f7d00bc7474527ddb4a", null ], + [ "NeoGeoCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4a70111c4d3c373a1997911bf718dddc", null ], + [ "CDTV", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4fafe8fe3ae70a17431abd03ae6d78e0", null ], + [ "CD32", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadb8c878db849cdc88cecec01a353790c", null ], + [ "Nuon", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad730786bd592903cc42ad7f5a5847171", null ], + [ "Playdia", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad3844a541b5dc4ab194e6cd6d6a98fef", null ], + [ "Apple32SS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa492b19f427f1827e7cb640c775890d94", null ], + [ "Apple32DS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaac9b75c633c48d3805b60ac337f5df81", null ], + [ "Apple33SS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae71e931f1f86b160c80f085be25c4b7d", null ], + [ "Apple33DS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaad8803940389ccbe26e3c2cbb24e8e8d", null ], + [ "AppleSonySS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3d003ea60d3ecb7018a671e1302938a0", null ], + [ "AppleSonyDS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae809315e2cd79c3fd74d1604c38f3ae6", null ], + [ "AppleFileWare", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac08b59f9e8ecf5e380092edddb0340ec", null ], + [ "DOS_525_SS_DD_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa20e8efecfec4a885b1a1eca6d89fdbbc", null ], + [ "DOS_525_SS_DD_9", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf9766bbb312f0c44964d106aa944281d", null ], + [ "DOS_525_DS_DD_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf7746389097c4bc3bf5b5a753a54debc", null ], + [ "DOS_525_DS_DD_9", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8ad87a17fdbd68c7c60d2d555a84a665", null ], + [ "DOS_525_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9f7cb3eb43acf5b7e4bacda719409910", null ], + [ "DOS_35_SS_DD_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa21419d71d1a11499f1129b773c03a78f", null ], + [ "DOS_35_SS_DD_9", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa482920249a7531adc2c877432bace94e", null ], + [ "DOS_35_DS_DD_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa06ae80ac5c49b97bbf3e48a4e4bfec8d", null ], + [ "DOS_35_DS_DD_9", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5c480394d1ecefc1e19d542719561a0d", null ], + [ "DOS_35_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0bfe56a99813299e86156f7ed4ff978d", null ], + [ "DOS_35_ED", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa04b3553989b835c84ea50525aa26adc1", null ], + [ "DMF", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2fbc31a44883370f8033063912b270c1", null ], + [ "DMF_82", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa202ad542a84199a302aa11265da89d68", null ], + [ "XDF_525", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad07c2fe03f45b02968bf2d757428ba6c", null ], + [ "XDF_35", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaaee3301d147bd3f076c8ce520bd275f9", null ], + [ "IBM23FD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa379024f58c222744262a0885b3de1316", null ], + [ "IBM33FD_128", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacdcaed3e1aebde3da722b8a51cc3e4d7", null ], + [ "IBM33FD_256", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac67a562a1e8d91473f11a5db6d9153c5", null ], + [ "IBM33FD_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9e845685cf8808f41debf04d8840da79", null ], + [ "IBM43FD_128", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa322cc6bbd11d81838b76f3b5ed09c0bb", null ], + [ "IBM43FD_256", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9c3ce5c9bdd82c55afcbb28c6e773993", null ], + [ "IBM53FD_256", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1b8a80048f7587ea99d571ce9dcace4f", null ], + [ "IBM53FD_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae5717b8002157516de03fea874afe64e", null ], + [ "IBM53FD_1024", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab1a02c403632e48492a4a679e27f7c9a", null ], + [ "RX01", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad289653e39817d07bb3dd07027a34bec", null ], + [ "RX02", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa90fcc7dc4696ae5f90b7028cb7cb3047", null ], + [ "RX03", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0d4a3714a82174302891870ef7321496", null ], + [ "RX50", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad0f35c56f0953b0640432ab66a276d9e", null ], + [ "ACORN_525_SS_SD_40", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1c9b592577769915d4182b9774abe198", null ], + [ "ACORN_525_SS_SD_80", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac4009edab9ec4a495ef50855b5931871", null ], + [ "ACORN_525_SS_DD_40", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacdc7d883c098eacafcf71fcfa1a01862", null ], + [ "ACORN_525_SS_DD_80", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2eb820540a7214bd978a1e1bfde4d9be", null ], + [ "ACORN_525_DS_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa771851dbeed2874c7508064e6ea5e91a", null ], + [ "ACORN_35_DS_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaeac3bbe0689d57fffd02f7481a612464", null ], + [ "ACORN_35_DS_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7c6fffa53f45dc4a51c7341252599f83", null ], + [ "ATARI_525_SD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa30d4793d280426cf5f04f93f5b5978a6", null ], + [ "ATARI_525_ED", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8717609ce351da02d5aff39baabd934c", null ], + [ "ATARI_525_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae4d54ec0fa82996f4a011da309beeb15", null ], + [ "ATARI_35_SS_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa294a563d16e1f7c5ade840004b5a669a", null ], + [ "ATARI_35_DS_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaedf30f5110cd29833e2d821ae5e5d90d", null ], + [ "ATARI_35_SS_DD_11", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadebc32c0c8421a9b4fe80d08dcdfd5d8", null ], + [ "ATARI_35_DS_DD_11", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad8fe0792a6d7fb0bc84cf6d8bdf9f8c6", null ], + [ "CBM_35_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7f9fe8270ba80b99028f1b5f06c17e58", null ], + [ "CBM_AMIGA_35_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1500ddc6bb87802e887bca2f8e8cd6a1", null ], + [ "CBM_AMIGA_35_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aabd7cf2dd5b3da3ae189bceba61220be1", null ], + [ "CBM_1540", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafa556dc46658c5ef0b0e92d329e4115a", null ], + [ "CBM_1540_Ext", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3ab2271f940524cc21df8295f860e907", null ], + [ "CBM_1571", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf4b1ce88a95302267f31083c38d8f139", null ], + [ "NEC_8_SD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafbc409413b4cc2bb573880f78ec5b707", null ], + [ "NEC_8_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5a79f25c38d19b0719508573302f38f7", null ], + [ "NEC_525_SS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa64629ce0276e0945b44e358eb403b590", null ], + [ "NEC_525_DS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaebb002437c463903e73779aa24e512a4", null ], + [ "NEC_525_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa018f18706ace2392d77dd8312a3d5ce9", null ], + [ "NEC_35_HD_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa13d2bbca1f3dff0af02f428d2b8f8c86", null ], + [ "NEC_35_HD_15", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa16792ebd5fa617354ca314746163053b", null ], + [ "NEC_35_TD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa529b682990d62f58e66b719b00e43b0a", null ], + [ "SHARP_525", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa30d286d8620e7955c3f76748fa7b1a51", null ], + [ "SHARP_525_9", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa669773752d754f6ed452dc3ff0c5cd9b", null ], + [ "SHARP_35", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8e0ff6b32a39706d7a51544e62e61e7e", null ], + [ "SHARP_35_9", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa57a306a0822d74a1512aed5a01b9ae27", null ], + [ "ECMA_99_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa88f675ca4c6c660d50839614106b93b6", null ], + [ "ECMA_99_15", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa459fc3b6ca291275102fa09f42cee8b4", null ], + [ "ECMA_99_26", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaba667a25facc9151591dc24bbf7699a7", null ], + [ "ECMA_100", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa62b42c966a7d3ae08873c9658457be59", null ], + [ "ECMA_125", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa82d0775f274f59fe1577b26f3a724ca", null ], + [ "ECMA_147", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6e85317aeb85d75e385712c47a3a3763", null ], + [ "ECMA_54", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa61a01aac39d7d64a91b83dd3e5162361", null ], + [ "ECMA_59", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad062cf16ecb9e1b1f9b2e1f177236e9a", null ], + [ "ECMA_66", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaae2d7e00e9923054debf7e91421b5cc1", null ], + [ "ECMA_69_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9c1e0d69d1f273fa2c6beeaa613fcede", null ], + [ "ECMA_69_15", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9336d902f9633fb8269405c030181ea9", null ], + [ "ECMA_69_26", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1d76cfb577917374d3741d43d42cd9b8", null ], + [ "ECMA_70", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0c192706d220b779a8e107a7917f9712", null ], + [ "ECMA_78", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3139c292b7ca6e5712b1515f383b9d75", null ], + [ "ECMA_78_2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaddeda742144fb9104d8facaa4cb72a2d", null ], + [ "FDFORMAT_525_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9fd7230dedb4b9f8eb191bf3f7ed480a", null ], + [ "FDFORMAT_525_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa77c42e046250bf7227cd7e250f8ccf86", null ], + [ "FDFORMAT_35_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadb0d81fd2b1e80e305b9088bf4728703", null ], + [ "FDFORMAT_35_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9c675c3ce576cbdb97c140a7d4c47077", null ], + [ "Apricot_35", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa925b760123c53b79c9bb17fe94401c6d", null ], + [ "ADR2120", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa302a8915fc26f9b21c485bd8c57bfe3c", null ], + [ "ADR260", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa567c5e725a303597da53eb0a68f01db4", null ], + [ "ADR30", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9d85b0d5a53b4457c0c0c3084b26def3", null ], + [ "ADR50", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5db2ebec64af62afde675d62c52001ba", null ], + [ "AIT1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaed524f1642620cf0a210d619aba9be67", null ], + [ "AIT1Turbo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4be75377ec0cf6a7302e7f9ca3fde6f1", null ], + [ "AIT2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9c7b877e9f1f874f159a353799e0dc40", null ], + [ "AIT2Turbo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9006689a2bd2d1bd5b6ed30533b043d5", null ], + [ "AIT3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7efd199428d6ddcdb86d845cdf09ce27", null ], + [ "AIT3Ex", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa30c67e2f83f3f9b9afcdfa95c34f9d3d", null ], + [ "AIT3Turbo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5db70dbfc4f68635f9544a296fcff5e3", null ], + [ "AIT4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5f1c7b0c2797c22c0d9e495712d93986", null ], + [ "AIT5", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf326517432c7507b852ac156f8500d60", null ], + [ "AITETurbo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1dffa337e6e28b886a15fa8143d302bd", null ], + [ "SAIT1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa04351b1d269ddc654507d0c9fa8b0815", null ], + [ "SAIT2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa50a7f4075d444826b863a98c89eca9b2", null ], + [ "Bernoulli", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa9d14952b686e6c9d08e0a2bc133dc19", null ], + [ "Bernoulli2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacf4a719af78f28b3f2af9c9c545275d9", null ], + [ "Ditto", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafaa560db218a872d3488b2c22969ce6d", null ], + [ "DittoMax", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4d435846c8eaf5c3b4cf6367c9c58ac9", null ], + [ "Jaz", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7300afff4afe4b2a2d838bcf007df159", null ], + [ "Jaz2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa666e25da783c836fa375ee4efa53cd19", null ], + [ "PocketZip", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa58ee4dca871ec1f01260f0888621993b", null ], + [ "REV120", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa56cd4a3d2cf2c41ac0799be3c0662cb5", null ], + [ "REV35", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa41baaf53d95ce93addc9510e53232d14", null ], + [ "REV70", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac7451c18dbb78c82f2ea43a4b22c2708", null ], + [ "ZIP100", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab744f08470a9dc22ca2a7624ce006aaa", null ], + [ "ZIP250", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4d81ba20676520904d1ec12af2e9c069", null ], + [ "ZIP750", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa912034b3fd49a6e93d143cf8938bbc4", null ], + [ "CompactCassette", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa269b538ff5238fa39e115dc481b449e5", null ], + [ "Data8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac5f2bbe0d52cd7cf9362b94466dc088c", null ], + [ "MiniDV", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa026528746ef1f5f410a0977bf24f72ba", null ], + [ "Dcas25", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3cf66f038ccca5f9898ebc59aa7e2974", null ], + [ "Dcas85", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8daa0116220f10c33111c57f672eb952", null ], + [ "Dcas103", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3b2d06548aeb27a577b26fb87f079601", null ], + [ "CFast", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa884240bde73a404a4f5e25076a329191", null ], + [ "CompactFlash", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa68851e22da7d7599d3e24dd54649b7f2", null ], + [ "CompactFlashType2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa56a1c5d20b95f3de34f28e6a7935c3c7", null ], + [ "DigitalAudioTape", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacc94d9a0e002510116470ad9587552ad", null ], + [ "DAT160", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa21e9369acc74f7909a9f80b3b0e7e7ef", null ], + [ "DAT320", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4d4e516d1d9f515a9a974db0f8482b48", null ], + [ "DAT72", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaaf97f4129bb0fa8c44661d7d2ae1847c", null ], + [ "DDS1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa68b451149c8486237e16872c5f427c9b", null ], + [ "DDS2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa225fe83b7d46da4ad66c2571a80fedc", null ], + [ "DDS3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaefe307fd08c8ba7727fc0e187b7c250c", null ], + [ "DDS4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac69f6e13d71e46658f94bb90adfb79ff", null ], + [ "CompactTapeI", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa517f4a953d7706bb2178651eb3ea965f", null ], + [ "CompactTapeII", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac3070ed27508c145f950d49b145f4f14", null ], + [ "DECtapeII", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7c626f8bf16729b5f10b5081b625dd6b", null ], + [ "DLTtapeIII", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafc87821d1ccc83021eeb637d3e0c3efa", null ], + [ "DLTtapeIIIxt", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa44e5b33f31ac0b153906be5fd219cff1", null ], + [ "DLTtapeIV", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4098954065f9e024166feb3e1ff7e5ce", null ], + [ "DLTtapeS4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0a40223840280167a28c725ec82a1f2b", null ], + [ "SDLT1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad45fd74266e3206ecc7efd4d639d0e54", null ], + [ "SDLT2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7fbbf1e7014a9656bd10fcb5a12869fe", null ], + [ "VStapeI", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1da82b907193d0fd3a38e6d7eb7d1d90", null ], + [ "Exatape15m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa9cfd40d9f1d4833e4f379556f58aee0", null ], + [ "Exatape22m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae40038685c5b69b8d749c2aaf131b250", null ], + [ "Exatape22mAME", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4f7b2285310471de9e931adef4eb6ed3", null ], + [ "Exatape28m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4ad2ba9e9df28f8d385ae39ef51924e6", null ], + [ "Exatape40m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa15dbd14ab5c4317ac42b451c46689d0f", null ], + [ "Exatape45m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa15b38bc9a1138fdec063a0314bec55bc", null ], + [ "Exatape54m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8302315c50ccf99cf9a065494d5a9aee", null ], + [ "Exatape75m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae732f3d5f96c199ac229d740923ae2e9", null ], + [ "Exatape76m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa346fac97cf981992b2dc7162344cb3b3", null ], + [ "Exatape80m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0d4825c104727429da72cb3ffeb7f2cc", null ], + [ "Exatape106m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa36db28763c08f22bfae9c556188a7db9", null ], + [ "Exatape160mXL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aabddbb582fe47247fbcc87e41bbc0724a", null ], + [ "Exatape112m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaebc12ca5a5e9e30889648ba084049f73", null ], + [ "Exatape125m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae8ba1484b50d4422fa5e112f025db2ca", null ], + [ "Exatape150m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa215083923492f959f13a9b5179b84a63", null ], + [ "Exatape170m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf0d5f1dc229ffe0d4492f6ac610af28a", null ], + [ "Exatape225m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3fb466288a38201b3c5c5421bf2f885a", null ], + [ "ExpressCard34", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7d0b878a1fcbb2013c6994f45ec0c039", null ], + [ "ExpressCard54", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1e70978a3b2566bc1504f3a64e55c24f", null ], + [ "PCCardTypeI", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1e769aa2d23d5980075ac83436c4497a", null ], + [ "PCCardTypeII", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0ac5684a2c2b8b5e49dced914fd544ff", null ], + [ "PCCardTypeIII", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa78fd2695498748ca770a333985888180", null ], + [ "PCCardTypeIV", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa30b964439df6d758ea44079ceb27dbda", null ], + [ "EZ135", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad4b64182cff74fb3da822f955e35468f", null ], + [ "EZ230", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa73cc08581063a7bb0353bf4a7919a94", null ], + [ "Quest", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9552944749afff02f38b9689ed94d1e5", null ], + [ "SparQ", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa93b0b84a1ca688e24f0677d91c2b280b", null ], + [ "SQ100", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaacd5aef6f02d071120241ac243b70305", null ], + [ "SQ200", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf13be5636b0b3c52e8e1d054875abb5d", null ], + [ "SQ300", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa29aacb086d88816119281eb4f31c8f6f", null ], + [ "SQ310", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4846544a39263ffd44af1ed291ecbbe5", null ], + [ "SQ327", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4cfcd547d8878bf10cab7df3b54e339e", null ], + [ "SQ400", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa688b931b8a32ba72044a3c5fcd0000a0", null ], + [ "SQ800", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaad275e80346dceb1c35c656c9e704a04", null ], + [ "SQ1500", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4f7ea4403b046aad24696f4689f1f9df", null ], + [ "SQ2000", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1d715ed8c6f0fc7e9923ba2f6414a351", null ], + [ "SyJet", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad1af9b71a52d69b0ef7d870a2fe53fab", null ], + [ "FamicomGamePak", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4f0263eb9fb86d4d6046a4080589eacc", null ], + [ "GameBoyAdvanceGamePak", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8ea876f5601b98cd71000682b70fc9c3", null ], + [ "GameBoyGamePak", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa904387c404e6d4c9ed6165b66d286ca0", null ], + [ "GOD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa34fed1daeb2422887d826d127e6ad488", null ], + [ "N64DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae04a5d4c84dbdb402b1fb2ca81706dd4", null ], + [ "N64GamePak", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7b1b823420a55f6c243db8be1d09a74c", null ], + [ "NESGamePak", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafb8177a285680259bc8c3b2b53a0d984", null ], + [ "Nintendo3DSGameCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab61f89abbda06c12237c7a4728f6321f", null ], + [ "NintendoDiskCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab7736e1bdc9cb153900086bba46c3e06", null ], + [ "NintendoDSGameCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3d2a7b0cb27faa50e558f5dfcc4c52d5", null ], + [ "NintendoDSiGameCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaab027fb2aa926f3ca765562d1fd09696", null ], + [ "SNESGamePak", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa377c9aea4ef6423748cb104ad8c51bcd", null ], + [ "SNESGamePakUS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7f25662d4fbe3cf90f1602d73c4e3520", null ], + [ "WOD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa61ed400b8bb5104e7309b3823e85766c", null ], + [ "WUOD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaee394a7c6e389c9b3734850e1666ee04", null ], + [ "SwitchGameCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa64c3f553240acee7926acfae616bbcd4", null ], + [ "IBM3470", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7e4c4cd9066aad99af8d29bc941e46d3", null ], + [ "IBM3480", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa598db1dc36a0c8c5005cbc23f4ba7f66", null ], + [ "IBM3490", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4a3ecf94bb44deb11279413c85886197", null ], + [ "IBM3490E", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf6da87cbe37a63b48ac47126a4a16d15", null ], + [ "IBM3592", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa61a087bad2e8ed96512c67db75668a64", null ], + [ "LTO", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6aabc225213d7e700b757f0276834e59", null ], + [ "LTO2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6f2bfeadc066b63b7a837e221ab170aa", null ], + [ "LTO3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf3c7d7240021f5a138dff359af5f8bed", null ], + [ "LTO3WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa351aa3972af28aaf9b0d2cab1ce3c9b7", null ], + [ "LTO4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac2f94ffbe0b397608d59dd5196c4424f", null ], + [ "LTO4WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1e20a868404f401a0bb27664a493cacc", null ], + [ "LTO5", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa96d7163098b2f36a824abfc66f0cfc45", null ], + [ "LTO5WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8e9a0113a8ee17cc4edb8152db7fc008", null ], + [ "LTO6", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa42ce3d986ca7507ab314c7824d371206", null ], + [ "LTO6WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5e301457517e12fe8832c90eb9c053fc", null ], + [ "LTO7", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab0a82fc1dd86af5c361d7c549b001f6b", null ], + [ "LTO7WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7d3400fe55bbbb17b6ec7612a7092453", null ], + [ "MemoryStick", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaacbe7eefff71c4184dc2cd764de134e0", null ], + [ "MemoryStickDuo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad2df43a8dbc3b8bb2de7caff02098023", null ], + [ "MemoryStickMicro", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2099d3c555475b3f38fd8ed324f3581c", null ], + [ "MemoryStickPro", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0a14ea0cc560c5c585d86962a2b9f4c9", null ], + [ "MemoryStickProDuo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7964bc555b07ff11ccc22d5ac7b2f7c7", null ], + [ "microSD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1ec8c6f16c78efa0b7e78bfd1c7c8106", null ], + [ "miniSD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4dd0716cba005d43e04bd2dd06179ac0", null ], + [ "SecureDigital", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5a91e22b345c870a05d85884e0f69130", null ], + [ "MMC", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa7d8fca3406f36682514f0384d910fac", null ], + [ "MMCmicro", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab50bd38ed9bee0df1aca0fc52f2bb6f1", null ], + [ "RSMMC", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aabe59760d082965a1e54e32e2982b3342", null ], + [ "MMCplus", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa94dd34ef484b14c2c132ce671501944b", null ], + [ "MMCmobile", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aabf159edb905437dc3ec56e021acf6475", null ], + [ "MLR1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa120f420bca58f04fae6da13953fd2aeb", null ], + [ "MLR1SL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9d12da8f4cdee2a5775344ce9ade5bf2", null ], + [ "MLR3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8e0ec327020c38d489dfbf2e244db643", null ], + [ "SLR1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa98ff382e8ff354bc80f80d37f3970fb2", null ], + [ "SLR2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1b39849006bb15720a75226c59d742a2", null ], + [ "SLR3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2cabe2c2f396f5925be2ccb73773bc84", null ], + [ "SLR32", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab33b505b696f800bbbe1d91257d7fda4", null ], + [ "SLR32SL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa02194764bbcb58913472c2916c79aa41", null ], + [ "SLR4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa62b41c3180caa66b2944fc4e53b75723", null ], + [ "SLR5", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae3acf873c76f8b1e43135d8a52a864ed", null ], + [ "SLR5SL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0e9659fb6dd0da87a93028e5ffae5f33", null ], + [ "SLR6", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac47b24ebcaaab9171cf02115f5f1227c", null ], + [ "SLRtape7", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae24f9d1c92a4352e8c8e312655814c3a", null ], + [ "SLRtape7SL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac71b4e558ce9812acd1c32698788b3d5", null ], + [ "SLRtape24", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaae50288f1bc27ecbdd231d4b619bda03", null ], + [ "SLRtape24SL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa550d3f1120e95e275115fb1ada5d57b2", null ], + [ "SLRtape40", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafa54baa880c94cdddbaefae4074a1b34", null ], + [ "SLRtape50", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4499943c5ef9459fec5c3de548f9f1d8", null ], + [ "SLRtape60", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae4abfd04ae9f10dc26d7b77539c715eb", null ], + [ "SLRtape75", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8512f259791d1a4cbdfc453315de431a", null ], + [ "SLRtape100", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad69ae74d23215fc9bcb7fe4d96782dd2", null ], + [ "SLRtape140", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3af9af50794d3ac7ce09582fe81c6b57", null ], + [ "QIC11", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5cc5213aafae30b6cb8fa683bd876a08", null ], + [ "QIC120", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0c16296ffadfae8862605a452d4997b2", null ], + [ "QIC1350", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafe12a40dbc70411568542f416479cc18", null ], + [ "QIC150", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3a36dabf70b5abb52f88ded5c5dc6794", null ], + [ "QIC24", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1621b26afba7902bc0cd32381f571a94", null ], + [ "QIC3010", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5b5dc92b2fb7629e0fcac28d1e78dfcf", null ], + [ "QIC3020", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5061483c549da83be0ac57c0c7375fa5", null ], + [ "QIC3080", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa95958f9d1b963398ccdd999ed95f3a47", null ], + [ "QIC3095", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8b3ede889a2c476bf558b3b8906c46ed", null ], + [ "QIC320", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa36660d9a9a823609f6aa3aa71e99151c", null ], + [ "QIC40", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa5e5ecadaa1da4cbfb14865a9fe19a0d", null ], + [ "QIC525", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1bdfd3747221a570ecc4e5937cd86448", null ], + [ "QIC80", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaad58b63c87310b4e990c4a3119634c0e", null ], + [ "STK4480", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa80836783afb465434fce8a5d4926608f", null ], + [ "STK4490", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaefd940f05f4db9ed21ed2abb1817697b", null ], + [ "STK9490", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1aee0a945fb952eda9fc59c36ef4bba8", null ], + [ "T9840A", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa8a4c9376bf2bb69077d5c6041830378", null ], + [ "T9840B", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacf27834523e68dec77208663791b97d5", null ], + [ "T9840C", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0d4c387efbbe57faa296e94d09fbfa36", null ], + [ "T9840D", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad3976bf509bc96a9eb48fe3317b8983d", null ], + [ "T9940A", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa87521f0b78dafa236cfc45f7951b04fc", null ], + [ "T9940B", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6c889ce4189a917092a889312ba8cd1e", null ], + [ "T10000A", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae8b7cc03baf3fb313d877ccfdbbb98a1", null ], + [ "T10000B", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaafad79bd3e98b11dcc1e634da4ed555a", null ], + [ "T10000C", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa74c9e610a5c7db0ad8d8ec74246be37f", null ], + [ "T10000D", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae4353df5a39ee6f919b4a0029f4c7957", null ], + [ "Travan", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadc4bc3e46d2619158279110e1e4feae3", null ], + [ "Travan1Ex", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1773f94257858d5cdb89790bffda5d48", null ], + [ "Travan3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8efb27ede835c4aa1fa7639c40f95cf2", null ], + [ "Travan3Ex", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa262b14c1a54d581e2c09bf78f8a2c4aa", null ], + [ "Travan4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa635d6d35d33db9a95649ab1f9addc20c", null ], + [ "Travan5", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa866fb0281f44c8bc0bcca6ef2032632f", null ], + [ "Travan7", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa051dcd441aad3b51053790d69abd09ba", null ], + [ "VXA1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa55a4f7e253d8b5fc294e5540936b7ec7", null ], + [ "VXA2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa244c30a9b7f3e84cd9bfae375f1a5690", null ], + [ "VXA3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6f8ed1c2464ec140dd8f3304b3e28e78", null ], + [ "ECMA_153", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa99337ceffff5fe69ce467ad6393d3cfc", null ], + [ "ECMA_153_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad68ca8b18860bda1f809db0d9acd7d2c", null ], + [ "ECMA_154", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1febac19651eaae91c7df1df9836feaa", null ], + [ "ECMA_183_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8ab262e316e693a44cede3fe0580c139", null ], + [ "ECMA_183", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1d6e354725a2de76add2c567be8b5e07", null ], + [ "ECMA_184_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0cee23c32d4450f51469cf75cc6ef4a1", null ], + [ "ECMA_184", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad64e190d144c7eee377ccc76c9333171", null ], + [ "ECMA_189", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8c77ade87450174b91a273f8896f29b9", null ], + [ "ECMA_190", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aada72c68907744c23734ad247df1f5cc6", null ], + [ "ECMA_195", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa2dbb50c8bfdfb90c403790cc9d87df3", null ], + [ "ECMA_195_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae145d45957d6be5dd4c88a137d198c27", null ], + [ "ECMA_201", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa56e3a761b0ef5ea679460c5f2007d847", null ], + [ "ECMA_201_ROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6b66797bd5632463255db2be9e9902a4", null ], + [ "ECMA_223", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6f0e769c986467a5aefff4f2df91ddc1", null ], + [ "ECMA_223_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2c791f737c7486085e3cbd09237275f1", null ], + [ "ECMA_238", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9dcc142c0ec1b4e89bbe14fa091b7c62", null ], + [ "ECMA_239", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3fbd9fef069e8865c86f5abf7ca1200b", null ], + [ "ECMA_260", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa53cc880e322e3dc52c30fb9e477bbdde", null ], + [ "ECMA_260_Double", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaaadcbf5cc426d920448c3e2919c7c80e", null ], + [ "ECMA_280", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafaa23f497d1e74ac566b89461f50d0da", null ], + [ "ECMA_317", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa102a7cecfdfc4f1317355f1df0f2805e", null ], + [ "ECMA_322", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaccbfb5f7540dad197a58f2fe967afe00", null ], + [ "ECMA_322_2k", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa52692eca861ea5488fdada6a9b402b3f", null ], + [ "GigaMo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa13c75f49713c4f8cc5efbd5081bb9cea", null ], + [ "GigaMo2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad1b09b8d81bdf543b085d1dd34f35bb0", null ], + [ "CompactFloppy", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa42da310afbad5da41909989ea9cb5570", null ], + [ "DemiDiskette", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa42a9d5c20ebc42267c36e586224ae621", null ], + [ "Floptical", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7167e5fc54a519ec2c5f7997ac8c1180", null ], + [ "HiFD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7641724e47817e4e26f053ee75fc47a0", null ], + [ "QuickDisk", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa24dc9c2ade5fb417845a7df0a22799b4", null ], + [ "UHD144", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9942e74f56903efd79052f5c612a7cc2", null ], + [ "VideoFloppy", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa46854aaca89c8e37ba732a457fc565e8", null ], + [ "Wafer", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aada39e2cfbaaacd700f2f8e6fe011adaa", null ], + [ "ZXMicrodrive", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafef7aa6ae443b430e2ffac2214ec9997", null ], + [ "BeeCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9b1d1e6f2cd08405e6e3edd6a7a38d30", null ], + [ "Borsu", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa39cee35f676a3a5d96a8dba4a032ada2", null ], + [ "DataStore", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0504fd0e8593cdcedfd4031f3791dc52", null ], + [ "DIR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa68a38057d09a4789d8d25e55adc5b0e6", null ], + [ "DST", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7a1970158a695340fdc76c8424740233", null ], + [ "DTF", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa456c6a125408e92894946f07dbe76a00", null ], + [ "DTF2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa109ed1fbeda1148c6bd5d943da3fc71e", null ], + [ "Flextra3020", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9ed0152cefe8a3e5a9372ec104daeb54", null ], + [ "Flextra3225", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaced988167a2dd863b2a3548c8fb4c67f", null ], + [ "HiTC1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9b3de8c22b9a84ee49915a8403899441", null ], + [ "HiTC2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae72a3f32d995a51919fe2fb73d542a5a", null ], + [ "LT1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaec1cb4509dde5be8e137d163ac77f0ec", null ], + [ "MiniCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab5217deba208bb2dd48755a7e0e7fb2b", null ], + [ "Orb", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa50682a652359e42ba7cd14ccbff91fc5", null ], + [ "Orb5", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa401ebddb57c769497832259b49907a66", null ], + [ "SmartMedia", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa72a402cd067ee086374a2c41e89d8f7", null ], + [ "xD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaacf39cf18dac209ec45b320f8a210726", null ], + [ "XQD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa61fd75d164a474174fc6012d7ce86e05", null ], + [ "DataPlay", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac66b1205176d4e49128f5fccc68cfdcc", null ], + [ "AppleProfile", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0a8ba83da933d4ad284631784a991f19", null ], + [ "AppleWidget", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacd42dba7780092d737e7d51a3819cb4b", null ], + [ "AppleHD20", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab8fc3997a514404b7d4692a74fb87912", null ], + [ "PriamDataTower", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab933939a09397f9311004f3dd137226d", null ], + [ "Pippin", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2b9c5d1501a0eb5198a2f339f4e15d90", null ], + [ "RA60", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4e1cf1850442b5a953df9e05964441a5", null ], + [ "RA80", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa81ee9477ea9220e1f093d394072791ea", null ], + [ "RA81", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa715e4d3d27d9a6967584cfbeb6bf079", null ], + [ "RC25", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadfc004b1209aceeb239af4d51a8d7d95", null ], + [ "RD31", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa85d93d64e980933afd39b40dc783878", null ], + [ "RD32", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3043133bc68a70519b3c03fb1df4e780", null ], + [ "RD51", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa648a3814bc452a2d5ffe7a9a60f64d43", null ], + [ "RD52", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaba6d8523ecbe9c52a5f339cfd9aa2ecb", null ], + [ "RD53", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae64469fd4f91ef4ae5d7503fc03c870a", null ], + [ "RD54", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4d33d7848e526ebb0fd178e643fa3038", null ], + [ "RK06", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5ced7fb4341d51c5198ce4ec8987b2df", null ], + [ "RK06_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9827173c642642dd203f855d6c6d1adc", null ], + [ "RK07", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7f003cb6ed4c1600424bd3a00fc8055e", null ], + [ "RK07_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadfdac1f5eaf9fbed5661ca3df28876fa", null ], + [ "RM02", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa936d760ac0e916519763d0450806dd5a", null ], + [ "RM03", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa25aebd8c172dd861232a2c489c8785ef", null ], + [ "RM05", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1d2a8eb500f521f9f1cfc8e0583de1d6", null ], + [ "RP02", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae98f088d98d2faf73eae686e2d25d0b8", null ], + [ "RP02_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7bf73e7957997bcfb6050aa408d891f7", null ], + [ "RP03", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafe7413a6e07c8d0c37ef9b873c53b98f", null ], + [ "RP03_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae9ee13649a1f85141e356a4210ab42b0", null ], + [ "RP04", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5e2955cc0db84f151b7467ed1c3088e8", null ], + [ "RP04_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4c50ec1a3634ab3af7fb8fe01fe50809", null ], + [ "RP05", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa99305b598cc999d48c336dcbbab4f921", null ], + [ "RP05_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3174941bc947c0e3a0537e26fea5250d", null ], + [ "RP06", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaea7c773a245ac9e2ceca31b12812571c", null ], + [ "RP06_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa83d1cd0765d2af655a54f77bd8130f13", null ], + [ "LS120", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafd74db0cd680a761348cb49343cada8c", null ], + [ "LS240", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa63e8439ae8da0a01357f01ab3b55387", null ], + [ "FD32MB", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaed0c9c46d22555c99d6fbf67ca8dd656", null ], + [ "RDX", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0358584dab0bc3a6ff014581cf6f4660", null ], + [ "RDX320", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aada9b451a931bf03d4d0f75c0997fa72f", null ], + [ "VideoNow", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa953a27e6a4a41c6d9b9bd0d18feeb12c", null ], + [ "VideoNowColor", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa301beaee119622d402dcfb85a214953b", null ], + [ "VideoNowXp", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9685c678a93fbc28a9b4dbfee8759405", null ] + ] ], + [ "SectorTagType", "group__SectorTags.html#gaf863e81d172ce7a216d8687a8a23293a", [ + [ "AppleSectorTag", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aacc1f837c03086c6835e55dab021211d1", null ], + [ "CdSectorSync", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aae6cc37af9cad918edf7a402ecac48e9d", null ], + [ "CdSectorHeader", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa1ed658dec0ed38565a2f1420dcdcc2db", null ], + [ "CdSectorSubHeader", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa7807c14140de3beeda2945e17fbf5310", null ], + [ "CdSectorEdc", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa2593a6f3edbbaff37976da9a96363344", null ], + [ "CdSectorEccP", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa3b08c072df1b13b88f0711ea82c8943c", null ], + [ "CdSectorEccQ", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aae96d541a937c6a5c369f6f0bc32f94b3", null ], + [ "CdSectorEcc", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aad5a60e1c8a5550557a2b4a1ae1054c89", null ], + [ "CdSectorSubchannelAaru", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa73586ffdff3f35b8a05b7f8fd37fcee2", null ], + [ "CdTrackIsrc", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa8e35806d5790cb5568b7535073d40179", null ], + [ "CdTrackText", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa560df9ee82c259d8263852474faaf8a8", null ], + [ "CdTrackFlags", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa4922f334e9f6fb030152d093be4bee7c", null ], + [ "DvdCmi", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa7165008ad58fcf7904dc3f6626064828", null ], + [ "FloppyAddressMark", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa440e8a66ac1ffbbae3347b72728da547", null ], + [ "DvdSectorTitleKey", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa667cac95d269113c036dd6ab86530e10", null ], + [ "DvdTitleKeyDecrypted", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aae54bf2b3574266925062218c892c42b2", null ], + [ "DvdSectorInformation", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aaacdc97f5778a26551dae1e003fc5f769", null ], + [ "DvdSectorNumber", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa82265a5d640ce9474f8b357c54cc0440", null ], + [ "DvdSectorIedAaru", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa16bbf88cdbeb1c4bfe44244de7d16c3f", null ], + [ "DvdSectorEdcAaru", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa6d377a28e58b9da5452ab66e90ea4457", null ], + [ "MaxSectorTag", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa81dbcd4677b6377bce5351ad92fc4d64", null ] + ] ] +]; \ No newline at end of file diff --git a/docs/html/aaru_8h_source.html b/docs/html/aaru_8h_source.html new file mode 100644 index 0000000..4961e42 --- /dev/null +++ b/docs/html/aaru_8h_source.html @@ -0,0 +1,1516 @@ + + + + + + + +libaaruformat: include/aaru.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
aaru.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_AARU_H
+
20#define LIBAARUFORMAT_AARU_H
+
21
+
22#ifndef _MSC_VER
+
23#pragma clang diagnostic push
+
24#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
+
25#endif
+
26
+
27#include <stdint.h>
+
28
+
52
+
93// NOLINTBEGIN(readability-identifier-naming)
+
+
94typedef enum
+
95{
+
96 // Generics, types 0 to 9
+
97 Unknown = 0,
+ + + + + +
103 // Generics, types 0 to 9
+
104
+
105 // Somewhat standard Compact Disc formats, types 10 to 39
+
106 CD = 10,
+
107 CDDA = 11,
+
108 CDG = 12,
+
109 CDEG = 13,
+
110 CDI = 14,
+
111 CDROM = 15,
+
112 CDROMXA = 16,
+
113 CDPLUS = 17,
+
114 CDMO = 18,
+
115 CDR = 19,
+
116 CDRW = 20,
+
117 CDMRW = 21,
+
118 VCD = 22,
+
119 SVCD = 23,
+
120 PCD = 24,
+
121 SACD = 25,
+
122 DDCD = 26,
+
123 DDCDR = 27,
+
124 DDCDRW = 28,
+
125 DTSCD = 29,
+
126 CDMIDI = 30,
+
127 CDV = 31,
+
128 PD650 = 32,
+ +
130 CDIREADY = 34,
+
132 FMTOWNS = 35,
+
133 // Somewhat standard Compact Disc formats, types 10 to 39
+
134
+
135 // Standard DVD formats, types 40 to 50
+
136 DVDROM = 40,
+
137 DVDR = 41,
+
138 DVDRW = 42,
+
139 DVDPR = 43,
+
140 DVDPRW = 44,
+
141 DVDPRWDL = 45,
+
142 DVDRDL = 46,
+
143 DVDPRDL = 47,
+
144 DVDRAM = 48,
+
145 DVDRWDL = 49,
+ +
147 // Standard DVD formats, types 40 to 50
+
148
+
149 // Standard HD-DVD formats, types 51 to 59
+
150 HDDVDROM = 51,
+
151 HDDVDRAM = 52,
+
152 HDDVDR = 53,
+
153 HDDVDRW = 54,
+
154 HDDVDRDL = 55,
+ +
156 // Standard HD-DVD formats, types 51 to 59
+
157
+
158 // Standard Blu-ray formats, types 60 to 69
+
159 BDROM = 60,
+
160 BDR = 61,
+
161 BDRE = 62,
+
162 BDRXL = 63,
+
163 BDREXL = 64,
+
164 // Standard Blu-ray formats, types 60 to 69
+
165
+
166 // Rare or uncommon optical standards, types 70 to 79
+
167 EVD = 70,
+
168 FVD = 71,
+
169 HVD = 72,
+
170 CBHD = 73,
+
171 HDVMD = 74,
+
172 VCDHD = 75,
+
173 SVOD = 76,
+
174 FDDVD = 77,
+
175 // Rare or uncommon optical standards, types 70 to 79
+
176
+
177 // LaserDisc based, types 80 to 89
+
178 LD = 80,
+
179 LDROM = 81,
+
180 LDROM2 = 82,
+
181 LVROM = 83,
+
182 MegaLD = 84,
+
183 // LaserDisc based, types 80 to 89
+
184
+
185 // MiniDisc based, types 90 to 99
+
186 HiMD = 90,
+
187 MD = 91,
+
188 MDData = 92,
+
189 MDData2 = 93,
+
190 // MiniDisc based, types 90 to 99
+
191
+
192 // Plasmon UDO, types 100 to 109
+
193 UDO = 100,
+ +
195 101,
+ +
197 102,
+
198 // Plasmon UDO, types 100 to 109
+
199
+
200 // Sony game media, types 110 to 129
+ + +
203 PS1CD = 112,
+
204 PS2CD = 113,
+
205 PS2DVD = 114,
+
206 PS3DVD = 115,
+
207 PS3BD = 116,
+
208 PS4BD = 117,
+
209 UMD = 118,
+ +
211 // Sony game media, types 110 to 129
+
212
+
213 // Microsoft game media, types 130 to 149
+
214 XGD = 130,
+
215 XGD2 = 131,
+
216 XGD3 = 132,
+
217 XGD4 = 133,
+
218 // Microsoft game media, types 130 to 149
+
219
+
220 // Sega game media, types 150 to 169
+
221 MEGACD = 150,
+
222 SATURNCD = 151,
+
223 GDROM = 152,
+
224 GDR = 153,
+
225 SegaCard = 154,
+
226 MilCD = 155,
+
227 // Sega game media, types 150 to 169
+
228
+
229 // Other game media, types 170 to 179
+
230 HuCard = 170,
+ +
232 JaguarCD = 172,
+
233 ThreeDO = 173,
+
234 PCFX = 174,
+
235 NeoGeoCD = 175,
+
236 CDTV = 176,
+
237 CD32 = 177,
+
238 Nuon = 178,
+
239 Playdia = 179,
+
240 // Other game media, types 170 to 179
+
241
+
242 // Apple standard floppy format, types 180 to 189
+
243 Apple32SS = 180,
+
244 Apple32DS = 181,
+
245 Apple33SS = 182,
+
246 Apple33DS = 183,
+ + + +
250 // Apple standard floppy format
+
251
+
252 // IBM/Microsoft PC floppy formats, types 190 to 209
+ + + + + + + + + +
262 DOS_35_HD = 199,
+
263 DOS_35_ED = 200,
+
264 DMF = 201,
+
265 DMF_82 = 202,
+
266 XDF_525 = 203,
+
268 XDF_35 = 204,
+
270 // IBM/Microsoft PC standard floppy formats, types 190 to 209
+
271
+
272 // IBM standard floppy formats, types 210 to 219
+
273 IBM23FD = 210,
+ + + + + + + + +
285 // IBM standard floppy formats, types 210 to 219
+
286
+
287 // DEC standard floppy formats, types 220 to 229
+
288 RX01 = 220,
+
289 RX02 = 221,
+
290 RX03 = 222,
+
291 RX50 = 223,
+
292 // DEC standard floppy formats, types 220 to 229
+
293
+
294 // Acorn standard floppy formats, types 230 to 239
+ + + + + + + +
302 // Acorn standard floppy formats, types 230 to 239
+
303
+
304 // Atari standard floppy formats, types 240 to 249
+ + + + + + + +
312 // Atari standard floppy formats, types 240 to 249
+
313
+
314 // Commodore standard floppy formats, types 250 to 259
+
315 CBM_35_DD = 250,
+ + +
318 CBM_1540 = 253,
+ +
320 CBM_1571 = 255,
+
321 // Commodore standard floppy formats, types 250 to 259
+
322
+
323 // NEC/SHARP standard floppy formats, types 260 to 269
+
324 NEC_8_SD = 260,
+
325 NEC_8_DD = 261,
+ + + + + +
331 NEC_35_TD = 267,
+ + + + +
336 // NEC/SHARP standard floppy formats, types 260 to 269
+
337
+
338 // ECMA floppy standards, types 270 to 289
+
339 ECMA_99_8 = 270,
+ + + + + +
348 ECMA_54 = 273,
+
349 ECMA_59 = 274,
+ +
351 275,
+
352 ECMA_69_8 = 276,
+ + +
358 ECMA_70 = 279,
+
360 ECMA_78 = 280,
+
361 ECMA_78_2 = 281,
+
362 // ECMA floppy standards, types 270 to 289
+
363
+
364 // Non-standard PC formats (FDFORMAT, 2M, etc), types 290 to 308
+ + + + +
369 // Non-standard PC formats (FDFORMAT, 2M, etc), types 290 to 308
+
370
+
371 // Apricot ACT standard floppy formats, type 309
+ +
373 // Apricot ACT standard floppy formats, type 309
+
374
+
375 // OnStream ADR, types 310 to 319
+
376 ADR2120 = 310,
+
377 ADR260 = 311,
+
378 ADR30 = 312,
+
379 ADR50 = 313,
+
380 // OnStream ADR, types 310 to 319
+
381
+
382 // Advanced Intelligent Tape, types 320 to 339
+
383 AIT1 = 320,
+ +
385 AIT2 = 322,
+ +
387 AIT3 = 324,
+
388 AIT3Ex = 325,
+ +
390 AIT4 = 327,
+
391 AIT5 = 328,
+ +
393 SAIT1 = 330,
+
394 SAIT2 = 331,
+
395 // Advanced Intelligent Tape, types 320 to 339
+
396
+
397 // Iomega, types 340 to 359
+ + +
400 Ditto = 342,
+
401 DittoMax = 343,
+
402 Jaz = 344,
+
403 Jaz2 = 345,
+ +
405 REV120 = 347,
+
406 REV35 = 348,
+
407 REV70 = 349,
+
408 ZIP100 = 350,
+
409 ZIP250 = 351,
+
410 ZIP750 = 352,
+
411 // Iomega, types 340 to 359
+
412
+
413 // Audio or video media, types 360 to 369
+ +
415 Data8 = 361,
+
416 MiniDV = 362,
+
417 Dcas25 = 363,
+
418 Dcas85 = 364,
+
419 Dcas103 = 365,
+
420 // Audio media, types 360 to 369
+
421
+
422 // CompactFlash Association, types 370 to 379
+
423 CFast = 370,
+ + +
426 // CompactFlash Association, types 370 to 379
+
427
+
428 // Digital Audio Tape / Digital Data Storage, types 380 to 389
+ +
430 DAT160 = 381,
+
431 DAT320 = 382,
+
432 DAT72 = 383,
+
433 DDS1 = 384,
+
434 DDS2 = 385,
+
435 DDS3 = 386,
+
436 DDS4 = 387,
+
437 // Digital Audio Tape / Digital Data Storage, types 380 to 389
+
438
+
439 // DEC, types 390 to 399
+ + + + + + + +
447 SDLT1 = 397,
+
448 SDLT2 = 398,
+
449 VStapeI = 399,
+
450 // DEC, types 390 to 399
+
451
+
452 // Exatape, types 400 to 419
+ + + + + + + + + + + + + + + + + +
470 // Exatape, types 400 to 419
+
471
+
472 // PCMCIA / ExpressCard, types 420 to 429
+ + + + + + +
479 // PCMCIA / ExpressCard, types 420 to 429
+
480
+
481 // SyQuest, types 430 to 449
+
482 EZ135 = 430,
+
483 EZ230 = 431,
+
484 Quest = 432,
+
485 SparQ = 433,
+
486 SQ100 = 434,
+
487 SQ200 = 435,
+
488 SQ300 = 436,
+
489 SQ310 = 437,
+
490 SQ327 = 438,
+
491 SQ400 = 439,
+
492 SQ800 = 440,
+
493 SQ1500 = 441,
+
494 SQ2000 = 442,
+
495 SyJet = 443,
+
496 // SyQuest, types 430 to 449
+
497
+
498 // Nintendo, types 450 to 469
+ + + +
502 GOD = 453,
+
503 N64DD = 454,
+ + + + + + + + +
512 WOD = 463,
+
513 WUOD = 464,
+ +
515 // Nintendo, types 450 to 469
+
516
+
517 // IBM Tapes, types 470 to 479
+
518 IBM3470 = 470,
+
519 IBM3480 = 471,
+
520 IBM3490 = 472,
+
521 IBM3490E = 473,
+
522 IBM3592 = 474,
+
523 // IBM Tapes, types 470 to 479
+
524
+
525 // LTO Ultrium, types 480 to 509
+
526 LTO = 480,
+
527 LTO2 = 481,
+
528 LTO3 = 482,
+
529 LTO3WORM = 483,
+
530 LTO4 = 484,
+
531 LTO4WORM = 485,
+
532 LTO5 = 486,
+
533 LTO5WORM = 487,
+
534 LTO6 = 488,
+
535 LTO6WORM = 489,
+
536 LTO7 = 490,
+
537 LTO7WORM = 491,
+
538 // LTO Ultrium, types 480 to 509
+
539
+
540 // MemoryStick, types 510 to 519
+ + + + + +
546 // MemoryStick, types 510 to 519
+
547
+
548 // SecureDigital, types 520 to 529
+
549 microSD = 520,
+
550 miniSD = 521,
+ +
552 // SecureDigital, types 520 to 529
+
553
+
554 // MultiMediaCard, types 530 to 539
+
555 MMC = 530,
+
556 MMCmicro = 531,
+
557 RSMMC = 532,
+
558 MMCplus = 533,
+
559 MMCmobile = 534,
+
560 // MultiMediaCard, types 530 to 539
+
561
+
562 // SLR, types 540 to 569
+
563 MLR1 = 540,
+
564 MLR1SL = 541,
+
565 MLR3 = 542,
+
566 SLR1 = 543,
+
567 SLR2 = 544,
+
568 SLR3 = 545,
+
569 SLR32 = 546,
+
570 SLR32SL = 547,
+
571 SLR4 = 548,
+
572 SLR5 = 549,
+
573 SLR5SL = 550,
+
574 SLR6 = 551,
+
575 SLRtape7 = 552,
+ + + + + + + + + +
585 // SLR, types 540 to 569
+
586
+
587 // QIC, types 570 to 589
+
588 QIC11 = 570,
+
589 QIC120 = 571,
+
590 QIC1350 = 572,
+
591 QIC150 = 573,
+
592 QIC24 = 574,
+
593 QIC3010 = 575,
+
594 QIC3020 = 576,
+
595 QIC3080 = 577,
+
596 QIC3095 = 578,
+
597 QIC320 = 579,
+
598 QIC40 = 580,
+
599 QIC525 = 581,
+
600 QIC80 = 582,
+
601 // QIC, types 570 to 589
+
602
+
603 // StorageTek tapes, types 590 to 609
+
604 STK4480 = 590,
+
605 STK4490 = 591,
+
606 STK9490 = 592,
+
607 T9840A = 593,
+
608 T9840B = 594,
+
609 T9840C = 595,
+
610 T9840D = 596,
+
611 T9940A = 597,
+
612 T9940B = 598,
+
613 T10000A = 599,
+
614 T10000B = 600,
+
615 T10000C = 601,
+
616 T10000D = 602,
+
617 // StorageTek tapes, types 590 to 609
+
618
+
619 // Travan, types 610 to 619
+
620 Travan = 610,
+ +
622 Travan3 = 612,
+ +
624 Travan4 = 614,
+
625 Travan5 = 615,
+
626 Travan7 = 616,
+
627 // Travan, types 610 to 619
+
628
+
629 // VXA, types 620 to 629
+
630 VXA1 = 620,
+
631 VXA2 = 621,
+
632 VXA3 = 622,
+
633 // VXA, types 620 to 629
+
634
+
635 // Magneto-optical, types 630 to 659
+
636 ECMA_153 = 630,
+ +
638 ECMA_154 = 632,
+ +
640 ECMA_183 = 634,
+ +
642 ECMA_184 = 636,
+
643 ECMA_189 = 637,
+
644 ECMA_190 = 638,
+
645 ECMA_195 = 639,
+ +
647 ECMA_201 = 641,
+ +
649 ECMA_223 = 643,
+ +
651 ECMA_238 = 645,
+
652 ECMA_239 = 646,
+
653 ECMA_260 = 647,
+ +
655 ECMA_280 = 649,
+
656 ECMA_317 = 650,
+
657 ECMA_322 = 651,
+ +
659 GigaMo = 653,
+
660 GigaMo2 = 654,
+
661 // Magneto-optical, types 630 to 659
+
662
+
663 // Other floppy standards, types 660 to 689
+ + +
666 Floptical = 662,
+
667 HiFD = 663,
+ +
669 UHD144 = 665,
+ +
671 Wafer = 667,
+ +
673 // Other floppy standards, types 660 to 669
+
674
+
675 // Miscellaneous, types 670 to 689
+
676 BeeCard = 670,
+
677 Borsu = 671,
+ +
679 DIR = 673,
+
680 DST = 674,
+
681 DTF = 675,
+
682 DTF2 = 676,
+ + +
685 HiTC1 = 679,
+
686 HiTC2 = 680,
+
687 LT1 = 681,
+
688 MiniCard = 872,
+
689 Orb = 683,
+
690 Orb5 = 684,
+ +
692 xD = 686,
+
693 XQD = 687,
+
694 DataPlay = 688,
+
695 // Miscellaneous, types 670 to 689
+
696
+
697 // Apple specific media, types 690 to 699
+ + + + +
702 Pippin = 694,
+
703 // Apple specific media, types 690 to 699
+
704
+
705 // DEC hard disks, types 700 to 729
+
706 RA60 = 700,
+
708 RA80 = 701,
+
710 RA81 = 702,
+
712 RC25 = 703,
+
714 RD31 = 704,
+
716 RD32 = 705,
+
718 RD51 = 706,
+
720 RD52 = 707,
+
722 RD53 = 708,
+
724 RD54 = 709,
+
726 RK06 = 710,
+
728 RK06_18 = 711,
+
730 RK07 = 712,
+
732 RK07_18 = 713,
+
734 RM02 = 714,
+
736 RM03 = 715,
+
738 RM05 = 716,
+
740 RP02 = 717,
+
742 RP02_18 = 718,
+
744 RP03 = 719,
+
746 RP03_18 = 720,
+
748 RP04 = 721,
+
750 RP04_18 = 722,
+
752 RP05 = 723,
+
754 RP05_18 = 724,
+
756 RP06 = 725,
+
758 RP06_18 = 726,
+
760 // DEC hard disks, types 700 to 729
+
761
+
762 // Imation, types 730 to 739
+
763 LS120 = 730,
+
764 LS240 = 731,
+
765 FD32MB = 732,
+
766 RDX = 733,
+
767 RDX320 = 734,
+
768 // Imation, types 730 to 739
+
769
+
770 // VideoNow, types 740 to 749
+
771 VideoNow = 740,
+ + +
774 //
+
775} MediaType;
+
+
776 /* end of MediaTypes group */
+
778
+
779// NOLINTEND(readability-identifier-naming)
+
780
+
+
869typedef struct ImageInfo // NOLINT
+
870{
+ +
872 uint8_t HasSessions;
+
873 uint64_t ImageSize;
+
874 uint64_t Sectors;
+
875 uint32_t SectorSize;
+
876 char Version[32];
+
877 char Application[64];
+ +
879 int64_t CreationTime;
+ +
881 uint32_t MediaType;
+ + +
+
884
+
893// NOLINTBEGIN(readability-identifier-naming)
+ +
918 /* end of SectorTags group */
+
920
+
921/*
+
922 * Metadata present for each media.
+
923 */
+
924// NOLINTBEGIN(readability-identifier-naming)
+
+
932typedef enum
+
933{
+
934 /* CD table of contents */
+
935 CD_TOC = 0,
+ + +
938 CD_PMA = 3,
+ + +
941 CD_MCN = 6,
+ + + +
945 DVD_BCA = 10,
+
946 DVD_DMI = 11,
+ +
948 DVD_MKB = 13,
+ + + +
952 DVDR_RMD = 17,
+ + +
955 DVDR_PFI = 20,
+
956 DVD_ADIP = 21,
+ + + + + + +
963 BD_DI = 28,
+
964 BD_BCA = 29,
+
965 BD_DDS = 30,
+ + + + + +
971 AACS_MKB = 36,
+ + + + + + + + + + + + + +
985 SD_CID = 50,
+
986 SD_CSD = 51,
+
987 SD_SCR = 52,
+
988 SD_OCR = 53,
+
989 MMC_CID = 54,
+
990 MMC_CSD = 55,
+
991 MMC_OCR = 56,
+ + + +
995 DCB = 60,
+ + + + + + + + + + + + + +
1009} MediaTagType;
+
+
1010 /* end of MediaTags group */
+
1012
+
1013// NOLINTEND(readability-identifier-naming)
+
1014
+
1015#ifndef _MSC_VER
+
1016#pragma clang diagnostic pop
+
1017#endif
+
1018
+
1019#endif // LIBAARUFORMAT_AARU_H
+
MediaTagType
Definition aaru.h:933
+
@ SCSI_MODEPAGE_2A
SCSI Mode Page 2Ah (CD/DVD capabilities)
Definition aaru.h:981
+
@ BD_DDS
Disc Definition Structure (recordable)
Definition aaru.h:965
+
@ MMC_CID
MMC Card ID.
Definition aaru.h:989
+
@ MiniDiscDTOC
Not entirely clear kind of TOC that only appears on MD-DATA discs.
Definition aaru.h:1007
+
@ MiniDiscD5
4 bytes response to vendor command D5h
Definition aaru.h:1005
+
@ DVDDL_JumpIntervalSize
Jump interval size (opposite track path)
Definition aaru.h:961
+
@ MMC_CSD
MMC Card Specific Data.
Definition aaru.h:990
+
@ DVD_DiscKey_Decrypted
Decrypted DVD disc key.
Definition aaru.h:1008
+
@ BD_SpareArea
BD spare area allocation map.
Definition aaru.h:967
+
@ CD_TOC
Standard CD Table Of Contents (lead-in, first session)
Definition aaru.h:935
+
@ DVDDL_ManualLayerJumpLBA
Manual layer jump LBA (OTP)
Definition aaru.h:962
+
@ DVDRAM_SpareArea
Spare area descriptors.
Definition aaru.h:951
+
@ DVD_CMI
Copyright Management Information (CSS/CPRM flags)
Definition aaru.h:943
+
@ DVDR_MediaIdentifier
DVD-R/-RW writable media identifier.
Definition aaru.h:954
+
@ SCSI_MODESENSE_10
Raw MODE SENSE (10) data.
Definition aaru.h:999
+
@ USB_Descriptors
Concatenated USB descriptors (device/config/interface)
Definition aaru.h:1000
+
@ SCSI_MODESENSE_6
Raw MODE SENSE (6) data.
Definition aaru.h:998
+
@ ATAPI_IDENTIFY
ATA PACKET IDENTIFY DEVICE.
Definition aaru.h:983
+
@ CD_SessionInfo
Per-session summary (start/end addresses, track count)
Definition aaru.h:936
+
@ DVD_PFI
Physical Format Information (layer geometry & book type)
Definition aaru.h:942
+
@ CD_LeadIn
Raw lead-in (TOC frames)
Definition aaru.h:1003
+
@ BD_CartridgeStatus
Cartridge presence / write protect (BD-RE/BD-R in caddy)
Definition aaru.h:966
+
@ Xbox_DMI
Xbox Disc Manufacturing Info (DMI)
Definition aaru.h:1001
+
@ AACS_SerialNumber
Pre-recorded media serial number (AACS)
Definition aaru.h:969
+
@ DVDR_PreRecordedInfo
Pre-recorded info area (lead-in)
Definition aaru.h:953
+
@ SD_SCR
SecureDigital Configuration Register.
Definition aaru.h:987
+
@ DVDRAM_DDS
Defect Data Structure (DVD-RAM mapping)
Definition aaru.h:949
+
@ AACS_DataKeys
Extracted AACS title/volume keys (when decrypted)
Definition aaru.h:972
+
@ CD_ATIP
Absolute Time In Pregroove (writable media timing & power metadata)
Definition aaru.h:939
+
@ AACS_MKB
AACS Media Key Block.
Definition aaru.h:971
+
@ DVD_DiscKey
Encrypted disc key block (CSS)
Definition aaru.h:944
+
@ MMC_DiscInformation
Disc Information (recordable status, erasable, last session)
Definition aaru.h:977
+
@ MiniDiscType
8 bytes response that seems to define type of MiniDisc
Definition aaru.h:1004
+
@ ATA_IDENTIFY
ATA IDENTIFY DEVICE (512 bytes)
Definition aaru.h:982
+
@ DVDR_PFI
DVD-R physical format (layer data)
Definition aaru.h:955
+
@ DVD_MediaIdentifier
Writable media dye / manufacturer ID.
Definition aaru.h:947
+
@ CD_LeadOut
Lead-out area contents.
Definition aaru.h:997
+
@ MMC_ExtendedCSD
MMC Extended CSD (512 bytes)
Definition aaru.h:992
+
@ CD_TEXT
CD-Text blocks (titles, performers, etc.)
Definition aaru.h:940
+
@ CD_MCN
Media Catalogue Number (EAN/UPC style identifier)
Definition aaru.h:941
+
@ MMC_TrackResourcesInformation
Track Resources (allocated/open track data)
Definition aaru.h:978
+
@ Xbox_SecuritySector
Xbox/Xbox 360 Security Sector (SS.bin)
Definition aaru.h:993
+
@ HDDVD_MediumStatus
HD DVD Medium status (spares/defects)
Definition aaru.h:958
+
@ DCB
DVD Disc Control Blocks.
Definition aaru.h:995
+
@ MiniDiscUTOC
User TOC, contains fragments, track names, and can be from 1 to 3 sectors of 2336 bytes.
Definition aaru.h:1006
+
@ DVDDL_MiddleZoneAddress
Middle zone start LBA.
Definition aaru.h:960
+
@ Floppy_LeadOut
Manufacturer / duplication cylinder (floppy special data)
Definition aaru.h:994
+
@ MMC_POWResourcesInformation
Pseudo OverWrite resources (BD-R POW)
Definition aaru.h:979
+
@ AACS_MediaIdentifier
AACS Media Identifier (unique per disc)
Definition aaru.h:970
+
@ DVDDL_LayerCapacity
Dual layer capacity & break info.
Definition aaru.h:959
+
@ AACS_VolumeIdentifier
AACS Volume Identifier.
Definition aaru.h:968
+
@ BD_BCA
Blu-ray Burst Cutting Area.
Definition aaru.h:964
+
@ Hybrid_RecognizedLayers
Hybrid disc recognized layer combinations (e.g. CD/DVD/BD)
Definition aaru.h:975
+
@ AACS_CPRM_MKB
CPRM Media Key Block.
Definition aaru.h:974
+
@ DVDR_RMD
Recorded Media Data (RMD) last border-out.
Definition aaru.h:952
+
@ AACS_LBAExtents
LBA extents requiring bus encryption.
Definition aaru.h:973
+
@ DVD_DMI
Disc Manufacturer Information (lead-in descriptor)
Definition aaru.h:946
+
@ DVD_BCA
Burst Cutting Area (etched manufacturer / AACS info)
Definition aaru.h:945
+
@ DVD_MKB
Media Key Block (AACS/DVD)
Definition aaru.h:948
+
@ SD_CSD
SecureDigital Card Specific Data.
Definition aaru.h:986
+
@ SCSI_INQUIRY
SCSI INQUIRY standard data (SPC-*)
Definition aaru.h:980
+
@ CD_FullTOC
Complete multi-session TOC including hidden tracks.
Definition aaru.h:937
+
@ DVD_ADIP
Address In Pregroove (DVD+ / wobble timing)
Definition aaru.h:956
+
@ MMC_OCR
MMC Operation Conditions.
Definition aaru.h:991
+
@ HDDVD_CPI
Content Protection Info (HD DVD)
Definition aaru.h:957
+
@ SD_OCR
SecureDigital Operation Conditions (voltage)
Definition aaru.h:988
+
@ CD_PMA
Program Memory Area (temporary track info before finalization)
Definition aaru.h:938
+
@ DVDRAM_MediumStatus
Medium Status (allocated spare info)
Definition aaru.h:950
+
@ PCMCIA_CIS
PCMCIA/CardBus CIS tuple chain.
Definition aaru.h:984
+
@ Xbox_PFI
Xbox Physical Format Information (PFI)
Definition aaru.h:1002
+
@ SD_CID
SecureDigital Card ID register.
Definition aaru.h:985
+
@ CD_FirstTrackPregap
First track pregap (index 0)
Definition aaru.h:996
+
@ MMC_WriteProtection
Write protection status (MMC GET CONFIG)
Definition aaru.h:976
+
@ BD_DI
Disc Information (BD)
Definition aaru.h:963
+
MediaType
Enumerates every recognized media / cartridge / optical / tape / card / disk format.
Definition aaru.h:95
+
@ BDREXL
BD-RE XL.
Definition aaru.h:163
+
@ NEC_525_HD
5,25", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM
Definition aaru.h:328
+
@ SLR32SL
Definition aaru.h:570
+
@ MiniDV
Definition aaru.h:416
+
@ RDX
Tandberg / Imation RDX removable disk cartridge.
Definition aaru.h:766
+
@ SAIT1
Definition aaru.h:393
+
@ CDROMXA
CD-ROM XA (Yellow Book)
Definition aaru.h:112
+
@ DOS_35_ED
3.5", DS, ED, 80 tracks, 36 spt, 512 bytes/sector, MFM
Definition aaru.h:263
+
@ DataStore
Definition aaru.h:678
+
@ Travan7
Definition aaru.h:626
+
@ DOS_35_DS_DD_8
3.5", DS, DD, 80 tracks, 8 spt, 512 bytes/sector, MFM
Definition aaru.h:260
+
@ MemoryStickPro
Definition aaru.h:544
+
@ DLTtapeS4
Definition aaru.h:446
+
@ AppleProfile
Definition aaru.h:698
+
@ PCCardTypeII
Definition aaru.h:476
+
@ DOS_35_HD
3.5", DS, HD, 80 tracks, 18 spt, 512 bytes/sector, MFM
Definition aaru.h:262
+
@ QIC120
Definition aaru.h:589
+
@ ECMA_70
5,25", DS, DD, 40 tracks, 16 spt, 256 bytes/sector, FM, track 0 side 0 = 16 sectors,...
Definition aaru.h:358
+
@ ECMA_184_512
5,25", M.O., 1128772 or 1163337 sectors, 512 bytes/sector, ECMA-183, ISO 13549
Definition aaru.h:641
+
@ Exatape80m
Definition aaru.h:462
+
@ RX03
8", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM/MFM
Definition aaru.h:290
+
@ T9840C
Definition aaru.h:609
+
@ SVOD
Stacked Volumetric Optical Disc.
Definition aaru.h:173
+
@ SLR5SL
Definition aaru.h:573
+
@ SegaCard
Sega My Card / Sega Card (SG-1000 / Mark III)
Definition aaru.h:225
+
@ ECMA_317
300mm, M.O., 7355716 sectors, 2048 bytes/sector, ECMA-317, ISO 20162
Definition aaru.h:656
+
@ DTF2
Definition aaru.h:682
+
@ CDR
CD-Recordable (Orange Book)
Definition aaru.h:115
+
@ MLR1
Definition aaru.h:563
+
@ GigaMo
3,5", M.O., 605846 sectors, 2048 bytes/sector, Cherry Book, GigaMo, ECMA-351, ISO 17346
Definition aaru.h:659
+
@ NEC_35_HD_8
3,5", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM, aka mode 3
Definition aaru.h:329
+
@ ThreeDO
3DO CD
Definition aaru.h:233
+
@ CBM_AMIGA_35_DD
3,5", DS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM (Amiga)
Definition aaru.h:316
+
@ PCD
Photo CD (Beige Book)
Definition aaru.h:120
+
@ PlayStationMemoryCard2
Sony PlayStation 2 memory card (MagicGate, 8 MiB)
Definition aaru.h:202
+
@ Exatape45m
Definition aaru.h:458
+
@ CDV
CD-Video (ISO/IEC 61104)
Definition aaru.h:127
+
@ Exatape40m
Definition aaru.h:457
+
@ CDG
CD+G (Red Book)
Definition aaru.h:108
+
@ QIC24
Definition aaru.h:592
+
@ NEC_35_HD_15
3,5", DS, HD, 80 tracks, 15 spt, 512 bytes/sector, MFM
Definition aaru.h:330
+
@ Travan1Ex
Definition aaru.h:621
+
@ HVD
Holographic Versatile Disc.
Definition aaru.h:169
+
@ STK9490
Definition aaru.h:606
+
@ SLR2
Definition aaru.h:567
+
@ IBM53FD_256
8", DS, DD, 74 tracks, 26 spt, 256 bytes/sector, MFM, track 0 side 0 = 26 sectors,...
Definition aaru.h:279
+
@ QIC525
Definition aaru.h:599
+
@ ACORN_525_SS_SD_40
5,25", SS, SD, 40 tracks, 10 spt, 256 bytes/sector, FM
Definition aaru.h:295
+
@ RM05
823 cylinders, 19 tracks/cylinder, 32 sectors/track, 256 words/sector, 16 bits/word,...
Definition aaru.h:738
+
@ ECMA_183
5,25", M.O., 498526 sectors, 1024 bytes/sector, ECMA-183, ISO 13481
Definition aaru.h:640
+
@ SQ2000
Definition aaru.h:494
+
@ ECMA_69_26
8", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM, track 0 side 0 = 26 sectors, 128 bytes/sector,...
Definition aaru.h:356
+
@ VStapeI
Definition aaru.h:449
+
@ UDO2_WORM
5.25", Write-Once, 3668759 sectors, 8192 bytes/sector, Ultra Density Optical 2, ECMA-380,...
Definition aaru.h:196
+
@ AITETurbo
Definition aaru.h:392
+
@ LTO4WORM
Definition aaru.h:531
+
@ ExpressCard54
Definition aaru.h:474
+
@ PCCardTypeI
Definition aaru.h:475
+
@ microSD
microSD / microSDHC / microSDXC card
Definition aaru.h:549
+
@ ECMA_154
3,5", M.O., 249850 sectors, 512 bytes/sector, ECMA-154, ISO 10090
Definition aaru.h:638
+
@ DMF_82
3.5", DS, HD, 82 tracks, 21 spt, 512 bytes/sector, MFM
Definition aaru.h:265
+
@ MemoryStickMicro
Definition aaru.h:543
+
@ DOS_525_SS_DD_8
5.25", SS, DD, 40 tracks, 8 spt, 512 bytes/sector, MFM
Definition aaru.h:253
+
@ DOS_35_SS_DD_8
3.5", SS, DD, 80 tracks, 8 spt, 512 bytes/sector, MFM
Definition aaru.h:258
+
@ Exatape150m
Definition aaru.h:467
+
@ DAT160
Definition aaru.h:430
+
@ CDMO
CD-MO (Orange Book)
Definition aaru.h:114
+
@ DDCD
Double-Density CD-ROM (Purple Book)
Definition aaru.h:122
+
@ VXA2
Definition aaru.h:631
+
@ LD
Pioneer LaserDisc.
Definition aaru.h:178
+
@ CDEG
CD+EG (Red Book)
Definition aaru.h:109
+
@ QuickDisk
Definition aaru.h:668
+
@ RM03
823 cylinders, 5 tracks/cylinder, 32 sectors/track, 256 words/sector, 16 bits/word,...
Definition aaru.h:736
+
@ Travan3Ex
Definition aaru.h:623
+
@ CompactCassette
Definition aaru.h:414
+
@ GDR
Sega/Yamaha recordable Gigabyte Disc.
Definition aaru.h:224
+
@ CDDA
CD Digital Audio (Red Book)
Definition aaru.h:107
+
@ ATARI_35_SS_DD
3,5", SS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM
Definition aaru.h:308
+
@ SQ300
Definition aaru.h:488
+
@ Pippin
Definition aaru.h:702
+
@ CDMRW
Mount-Rainier CD-RW.
Definition aaru.h:117
+
@ ECMA_223_512
3,5", M.O., 694929 sectors, 512 bytes/sector, ECMA-223
Definition aaru.h:650
+
@ SLR3
Definition aaru.h:568
+
@ MEGACD
Sega MegaCD.
Definition aaru.h:221
+
@ ACORN_525_SS_DD_80
5,25", SS, DD, 80 tracks, 16 spt, 256 bytes/sector, MFM
Definition aaru.h:298
+
@ DMF
3.5", DS, HD, 80 tracks, 21 spt, 512 bytes/sector, MFM
Definition aaru.h:264
+
@ VideoNowColor
Hasbro VideoNow Color disc.
Definition aaru.h:772
+
@ ADR2120
Definition aaru.h:376
+
@ RD32
820 cylinders, 6 tracks/cylinder, 17 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:716
+
@ PCCardTypeIV
Definition aaru.h:478
+
@ AIT3Ex
Definition aaru.h:388
+
@ SHARP_525
5,25", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM
Definition aaru.h:332
+
@ ATARI_525_SD
5,25", SS, SD, 40 tracks, 18 spt, 128 bytes/sector, FM
Definition aaru.h:305
+
@ ECMA_78
Definition aaru.h:360
+
@ RP05_18
411 cylinders, 19 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word,...
Definition aaru.h:754
+
@ IBM43FD_128
8", DS, SD, 74 tracks, 26 spt, 128 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector
Definition aaru.h:277
+
@ CDIREADY
CD-i Ready, contains a track before the first TOC track, in mode 2, and all TOC tracks are Audio.
Definition aaru.h:130
+
@ Exatape76m
Definition aaru.h:461
+
@ GOD
Nintendo GameCube Optical Disc.
Definition aaru.h:502
+
@ LTO3WORM
Definition aaru.h:529
+
@ CDROM
CD-ROM (Yellow Book)
Definition aaru.h:111
+
@ QIC320
Definition aaru.h:597
+
@ Exatape106m
Definition aaru.h:463
+
@ SNESGamePak
Nintendo SNES (PAL/JPN) cartridge.
Definition aaru.h:510
+
@ IBM23FD
8", SS, SD, 32 tracks, 8 spt, 319 bytes/sector, FM
Definition aaru.h:273
+
@ HDDVDROM
HD DVD-ROM (applies to HD DVD Video)
Definition aaru.h:150
+
@ Borsu
Definition aaru.h:677
+
@ QIC150
Definition aaru.h:591
+
@ CBM_1540_Ext
5,25", SS, DD, 40 tracks, GCR
Definition aaru.h:319
+
@ SLRtape140
Definition aaru.h:584
+
@ Dcas103
D/CAS-103: Digital data on Compact Cassette form factor, special magnetic media, 21-track.
Definition aaru.h:419
+
@ Zone_HDD
Zoned hard disk.
Definition aaru.h:101
+
@ Dcas25
D/CAS-25: Digital data on Compact Cassette form factor, special magnetic media, 9-track.
Definition aaru.h:417
+
@ AppleSonySS
3.5", SS, DD, 80 tracks, 8 to 12 spt, 512 bytes/sector, GCR
Definition aaru.h:247
+
@ NintendoDSGameCard
Nintendo DS ROM card.
Definition aaru.h:508
+
@ MegaLD
Definition aaru.h:182
+
@ VCD
Video CD (White Book)
Definition aaru.h:118
+
@ SuperCDROM2
PC-Engine / TurboGrafx CD.
Definition aaru.h:231
+
@ Exatape225m
Definition aaru.h:469
+
@ ECMA_239
3,5", M.O., 318988, 320332 or 321100 sectors, 2048 bytes/sector, ECMA-239, ISO 15498
Definition aaru.h:652
+
@ Orb5
Definition aaru.h:690
+
@ CDRW
CD-ReWritable (Orange Book)
Definition aaru.h:116
+
@ DLTtapeIV
Definition aaru.h:445
+
@ REV35
Definition aaru.h:406
+
@ SVCD
Super Video CD (White Book)
Definition aaru.h:119
+
@ DemiDiskette
Definition aaru.h:665
+
@ LTO6
Definition aaru.h:534
+
@ CompactFloppy
Definition aaru.h:664
+
@ SLRtape50
Definition aaru.h:580
+
@ DVDPRWDL
DVD+RW DL.
Definition aaru.h:141
+
@ DLTtapeIIIxt
Definition aaru.h:444
+
@ DTF
Definition aaru.h:681
+
@ ECMA_99_15
5,25", DS, DD, 77 tracks, 15 spt, 512 bytes/sector, MFM, track 0 side 0 = 26 sectors,...
Definition aaru.h:341
+
@ VideoFloppy
Definition aaru.h:670
+
@ BDRXL
BD-R XL.
Definition aaru.h:162
+
@ DOS_35_SS_DD_9
3.5", SS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM
Definition aaru.h:259
+
@ SQ310
Definition aaru.h:489
+
@ DDCDR
DD CD-R (Purple Book)
Definition aaru.h:123
+
@ Apple32SS
5.25", SS, DD, 35 tracks, 13 spt, 256 bytes/sector, GCR
Definition aaru.h:243
+
@ IBM3490
Definition aaru.h:520
+
@ NeoGeoCD
NEO-GEO CD.
Definition aaru.h:235
+
@ Exatape28m
Definition aaru.h:456
+
@ AIT1Turbo
Definition aaru.h:384
+
@ RP04_18
411 cylinders, 19 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word,...
Definition aaru.h:750
+
@ DVDRW
DVD-RW.
Definition aaru.h:138
+
@ SQ327
Definition aaru.h:490
+
@ RD54
1225 cylinders, 8 tracks/cylinder, 18 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:724
+
@ DittoMax
Definition aaru.h:401
+
@ DAT320
Definition aaru.h:431
+
@ ZIP250
Definition aaru.h:409
+
@ miniSD
miniSD card
Definition aaru.h:550
+
@ RA60
2382 cylinders, 4 tracks/cylinder, 42 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:706
+
@ Unknown
Unknown disk type.
Definition aaru.h:97
+
@ FamicomGamePak
Nintendo Famicom cartridge.
Definition aaru.h:499
+
@ CDPLUS
CD+ (Blue Book)
Definition aaru.h:113
+
@ Exatape22mAME
Definition aaru.h:455
+
@ SQ1500
Definition aaru.h:493
+
@ CDTV
Commodore CDTV.
Definition aaru.h:236
+
@ DVDRWDL
DVD-RW DL.
Definition aaru.h:145
+
@ QIC3020
Definition aaru.h:594
+
@ Orb
Definition aaru.h:689
+
@ SAIT2
Definition aaru.h:394
+
@ CompactTapeI
Definition aaru.h:440
+
@ ECMA_322_2k
5,25", M.O., 2043664 sectors, 2048 bytes/sector, ECMA-322, ISO 22092
Definition aaru.h:658
+
@ NEC_35_TD
3,5", DS, TD, 240 tracks, 38 spt, 512 bytes/sector, MFM
Definition aaru.h:331
+
@ HDDVDRDL
HD DVD-R DL.
Definition aaru.h:154
+
@ ECMA_260
356mm, M.O., 14476734 sectors, 1024 bytes/sector, ECMA-260, ISO 15898
Definition aaru.h:653
+
@ FMTOWNS
Fujitsu FM Towns bootable CD (mixed-mode proprietary extensions)
Definition aaru.h:132
+
@ SLRtape24SL
Definition aaru.h:578
+
@ VXA1
Definition aaru.h:630
+
@ ADR260
Definition aaru.h:377
+
@ CompactFlashType2
Definition aaru.h:425
+
@ REV120
Definition aaru.h:405
+
@ ECMA_201
3,5", M.O., 446325 sectors, 512 bytes/sector, ECMA-201, ISO 13963
Definition aaru.h:647
+
@ SHARP_35_9
3,5", DS, HD, 80 tracks, 9 spt, 1024 bytes/sector, MFM
Definition aaru.h:335
+
@ FlashDrive
USB flash drives.
Definition aaru.h:102
+
@ PocketZip
Definition aaru.h:404
+
@ IBM3480
Definition aaru.h:519
+
@ PS1CD
Sony PlayStation game CD.
Definition aaru.h:203
+
@ NEC_8_DD
8", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, MFM
Definition aaru.h:325
+
@ SecureDigital
Full-size SD / SDHC / SDXC card.
Definition aaru.h:551
+
@ QIC3010
Definition aaru.h:593
+
@ DOS_35_DS_DD_9
3.5", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM
Definition aaru.h:261
+
@ QIC11
Definition aaru.h:588
+
@ RK06
411 cylinders, 3 tracks/cylinder, 22 sectors/track, 256 words/sector, 16 bits/word,...
Definition aaru.h:726
+
@ ADR50
Definition aaru.h:379
+
@ AIT3Turbo
Definition aaru.h:389
+
@ RP04
411 cylinders, 19 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:748
+
@ LTO6WORM
Definition aaru.h:535
+
@ AIT4
Definition aaru.h:390
+
@ HDDVDRWDL
HD DVD-RW DL.
Definition aaru.h:155
+
@ XGD3
Microsoft X-box 360 Game Disc.
Definition aaru.h:216
+
@ ECMA_54
8", SS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM
Definition aaru.h:348
+
@ IBM3592
Definition aaru.h:522
+
@ HuCard
PC-Engine / TurboGrafx cartridge.
Definition aaru.h:230
+
@ WOD
Nintendo Wii Optical Disc.
Definition aaru.h:512
+
@ XQD
Definition aaru.h:693
+
@ PS3BD
Sony PlayStation 3 game Blu-ray.
Definition aaru.h:207
+
@ SLR4
Definition aaru.h:571
+
@ ECMA_100
3,5", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM
Definition aaru.h:345
+
@ Travan4
Definition aaru.h:624
+
@ NEC_525_SS
5.25", SS, SD, 80 tracks, 16 spt, 256 bytes/sector, FM
Definition aaru.h:326
+
@ RD51
306 cylinders, 4 tracks/cylinder, 17 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:718
+
@ UMD
Sony PlayStation Portable Universal Media Disc (ECMA-365)
Definition aaru.h:209
+
@ SwitchGameCard
Nintendo Switch Game Card (NV flash)
Definition aaru.h:514
+
@ XGD
Microsoft X-box Game Disc.
Definition aaru.h:214
+
@ Jaz2
Definition aaru.h:403
+
@ SHARP_525_9
3,5", DS, HD, 80 tracks, 9 spt, 1024 bytes/sector, MFM
Definition aaru.h:333
+
@ EVD
Enhanced Versatile Disc.
Definition aaru.h:167
+
@ CompactFlash
Definition aaru.h:424
+
@ SQ400
Definition aaru.h:491
+
@ DIR
Definition aaru.h:679
+
@ DDS1
Definition aaru.h:433
+
@ SACD
Super Audio CD (Scarlet Book)
Definition aaru.h:121
+
@ DVDPRDL
DVD+R DL.
Definition aaru.h:143
+
@ LTO
Definition aaru.h:526
+
@ ECMA_201_ROM
3,5", M.O., 429975 sectors, 512 bytes/sector, embossed, ISO 13963
Definition aaru.h:648
+
@ PD650_WORM
120mm, Write-Once, 1281856 sectors, 512 bytes/sector, PD650, ECMA-240, ISO 15485
Definition aaru.h:129
+
@ T9940B
Definition aaru.h:612
+
@ ECMA_147
3,5", DS, ED, 80 tracks, 36 spt, 512 bytes/sector, MFM
Definition aaru.h:347
+
@ ECMA_223
3,5", M.O., 371371 sectors, 1024 bytes/sector, ECMA-223
Definition aaru.h:649
+
@ LTO2
Definition aaru.h:527
+
@ VXA3
Definition aaru.h:632
+
@ HDDVDRAM
HD DVD-RAM.
Definition aaru.h:151
+
@ DVDR
DVD-R.
Definition aaru.h:137
+
@ Floptical
3.5", 652 tracks, 2 sides, 512 bytes/sector, Floptical, ECMA-207, ISO 14169
Definition aaru.h:666
+
@ PS3DVD
Sony PlayStation 3 game DVD.
Definition aaru.h:206
+
@ Jaz
Definition aaru.h:402
+
@ T10000C
Definition aaru.h:615
+
@ CDMIDI
CD-MIDI (Red Book)
Definition aaru.h:126
+
@ HiFD
Definition aaru.h:667
+
@ PCFX
NEC PC-FX.
Definition aaru.h:234
+
@ ACORN_525_DS_DD
5,25", DS, DD, 80 tracks, 16 spt, 256 bytes/sector, MFM
Definition aaru.h:299
+
@ FDFORMAT_525_HD
5,25", DS, HD, 82 tracks, 17 spt, 512 bytes/sector, MFM
Definition aaru.h:366
+
@ PCCardTypeIII
Definition aaru.h:477
+
@ MemoryStickProDuo
Definition aaru.h:545
+
@ BDROM
BD-ROM (and BD Video)
Definition aaru.h:159
+
@ MDData
MiniDisc DATA (HiFD style data-only variant)
Definition aaru.h:188
+
@ DST
Definition aaru.h:680
+
@ N64GamePak
Nintendo 64 cartridge.
Definition aaru.h:504
+
@ RP02_18
203 cylinders, 10 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word,...
Definition aaru.h:742
+
@ DECtapeII
Definition aaru.h:442
+
@ ACORN_35_DS_HD
3,5", DS, HD, 80 tracks, 10 spt, 1024 bytes/sector, MFM
Definition aaru.h:301
+
@ ExpressCard34
Definition aaru.h:473
+
@ LTO7WORM
Definition aaru.h:537
+
@ IBM3470
Definition aaru.h:518
+
@ AIT3
Definition aaru.h:387
+
@ RK07
815 cylinders, 3 tracks/cylinder, 22 sectors/track, 256 words/sector, 16 bits/word,...
Definition aaru.h:730
+
@ SNESGamePakUS
Nintendo SNES (US) cartridge (different shell)
Definition aaru.h:511
+
@ CBM_35_DD
3,5", DS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM (1581)
Definition aaru.h:315
+
@ SDLT2
Definition aaru.h:448
+
@ MD
Sony MiniDisc.
Definition aaru.h:187
+
@ STK4480
Definition aaru.h:604
+
@ RA80
546 cylinders, 14 tracks/cylinder, 31 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:708
+
@ PlayStationMemoryCard
Sony PlayStation (PS1) memory card (128 KiB, 8 KB blocks)
Definition aaru.h:201
+
@ Exatape54m
Definition aaru.h:459
+
@ RP06_18
815 cylinders, 19 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word,...
Definition aaru.h:758
+
@ SLRtape75
Definition aaru.h:582
+
@ Travan5
Definition aaru.h:625
+
@ ATARI_525_ED
5,25", SS, ED, 40 tracks, 26 spt, 128 bytes/sector, MFM
Definition aaru.h:306
+
@ T9940A
Definition aaru.h:611
+
@ CFast
Definition aaru.h:423
+
@ ECMA_99_8
5,25", DS, DD, 80 tracks, 8 spt, 1024 bytes/sector, MFM, track 0 side 0 = 26 sectors,...
Definition aaru.h:339
+
@ JaguarCD
Atari Jaguar CD.
Definition aaru.h:232
+
@ ECMA_183_512
5,25", M.O., 904995 sectors, 512 bytes/sector, ECMA-183, ISO 13481
Definition aaru.h:639
+
@ DOS_525_DS_DD_9
5.25", DS, DD, 40 tracks, 9 spt, 512 bytes/sector, MFM
Definition aaru.h:256
+
@ QIC3095
Definition aaru.h:596
+
@ ECMA_189
300mm, M.O., ??? sectors, 1024 bytes/sector, ECMA-189, ISO 13614
Definition aaru.h:643
+
@ Dcas85
D/CAS-85: Digital data on Compact Cassette form factor, special magnetic media, 17-track.
Definition aaru.h:418
+
@ PS2DVD
Sony PlayStation 2 game DVD.
Definition aaru.h:205
+
@ MLR3
Definition aaru.h:565
+
@ SHARP_35
3,5", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM, aka mode 3
Definition aaru.h:334
+
@ LTO5WORM
Definition aaru.h:533
+
@ GameBoyAdvanceGamePak
Nintendo Game Boy Advance cartridge.
Definition aaru.h:500
+
@ Travan3
Definition aaru.h:622
+
@ AIT2Turbo
Definition aaru.h:386
+
@ GameBoyGamePak
Nintendo Game Boy / Color cartridge.
Definition aaru.h:501
+
@ RX02
8", SS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM/MFM
Definition aaru.h:289
+
@ Apricot_35
3.5", DS, DD, 70 tracks, 9 spt, 512 bytes/sector, MFM
Definition aaru.h:372
+
@ XGD4
Microsoft X-box One Game Disc.
Definition aaru.h:217
+
@ ECMA_69_15
8", DS, DD, 77 tracks, 15 spt, 512 bytes/sector, FM, track 0 side 0 = 26 sectors, 128 bytes/sector,...
Definition aaru.h:354
+
@ RM02
823 cylinders, 5 tracks/cylinder, 32 sectors/track, 256 words/sector, 16 bits/word,...
Definition aaru.h:734
+
@ SparQ
Definition aaru.h:485
+
@ MMCplus
MMCplus (high speed)
Definition aaru.h:558
+
@ VideoNow
Hasbro VideoNow 85 mm proprietary video disc.
Definition aaru.h:771
+
@ Quest
Definition aaru.h:484
+
@ QIC3080
Definition aaru.h:595
+
@ VideoNowXp
Hasbro VideoNow XP higher capacity disc.
Definition aaru.h:773
+
@ LTO5
Definition aaru.h:532
+
@ RK06_18
411 cylinders, 3 tracks/cylinder, 20 sectors/track, 256 words/sector, 18 bits/word,...
Definition aaru.h:728
+
@ VCDHD
Versatile Compact Disc High Density.
Definition aaru.h:172
+
@ SLR1
Definition aaru.h:566
+
@ RP05
411 cylinders, 19 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:752
+
@ ECMA_153
5,25", M.O., ??? sectors, 1024 bytes/sector, ECMA-153, ISO 11560
Definition aaru.h:636
+
@ UHD144
Definition aaru.h:669
+
@ CD
Any unknown or standard violating CD.
Definition aaru.h:106
+
@ BeeCard
Definition aaru.h:676
+
@ HiTC1
Definition aaru.h:685
+
@ ECMA_69_8
8", DS, DD, 77 tracks, 8 spt, 1024 bytes/sector, FM, track 0 side 0 = 26 sectors, 128 bytes/sector,...
Definition aaru.h:352
+
@ IBM43FD_256
8", DS, SD, 74 tracks, 26 spt, 256 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector
Definition aaru.h:278
+
@ FDFORMAT_35_HD
3,5", DS, HD, 82 tracks, 21 spt, 512 bytes/sector, MFM
Definition aaru.h:368
+
@ AIT2
Definition aaru.h:385
+
@ MLR1SL
Definition aaru.h:564
+
@ ADR30
Definition aaru.h:378
+
@ ECMA_238
5,25", M.O., 1244621 sectors, 1024 bytes/sector, ECMA-238, ISO 15486
Definition aaru.h:651
+
@ IBM33FD_512
8", SS, SD, 74 tracks, 8 spt, 512 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector
Definition aaru.h:276
+
@ Flextra3020
Definition aaru.h:683
+
@ DOS_525_HD
5.25", DS, HD, 80 tracks, 15 spt, 512 bytes/sector, MFM
Definition aaru.h:257
+
@ FDFORMAT_525_DD
5,25", DS, DD, 82 tracks, 10 spt, 512 bytes/sector, MFM
Definition aaru.h:365
+
@ GDROM
Sega/Yamaha Gigabyte Disc.
Definition aaru.h:223
+
@ DDS2
Definition aaru.h:434
+
@ ECMA_195
5,25", M.O., 936921 or 948770 sectors, 1024 bytes/sector, ECMA-195, ISO 13842
Definition aaru.h:645
+
@ MDData2
High-capacity MiniDisc DATA 2.
Definition aaru.h:189
+
@ SATURNCD
Sega Saturn disc.
Definition aaru.h:222
+
@ QIC40
Definition aaru.h:598
+
@ LS240
Imation LS-240 SuperDisk.
Definition aaru.h:764
+
@ RA81
1248 cylinders, 14 tracks/cylinder, 51 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:710
+
@ SmartMedia
Definition aaru.h:691
+
@ EZ230
Definition aaru.h:483
+
@ MMC
MultiMediaCard (legacy)
Definition aaru.h:555
+
@ UnknownMO
Unknown magneto-optical.
Definition aaru.h:98
+
@ PlayStationVitaGameCard
PS Vita NV memory card (proprietary flash)
Definition aaru.h:210
+
@ ECMA_125
3,5", DS, HD, 80 tracks, 18 spt, 512 bytes/sector, MFM
Definition aaru.h:346
+
@ RD31
615 cylinders, 4 tracks/cylinder, 17 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:714
+
@ T9840A
Definition aaru.h:607
+
@ CBHD
China Blue High Definition.
Definition aaru.h:170
+
@ ZIP750
Definition aaru.h:410
+
@ Exatape15m
Definition aaru.h:453
+
@ Bernoulli
Definition aaru.h:398
+
@ ECMA_260_Double
356mm, M.O., 24445990 sectors, 1024 bytes/sector, ECMA-260, ISO 15898
Definition aaru.h:654
+
@ NintendoDSiGameCard
Nintendo DSi enhanced ROM card.
Definition aaru.h:509
+
@ BDR
BD-R.
Definition aaru.h:160
+
@ Apple32DS
5.25", DS, DD, 35 tracks, 13 spt, 256 bytes/sector, GCR
Definition aaru.h:244
+
@ MemoryStick
Definition aaru.h:541
+
@ SQ100
Definition aaru.h:486
+
@ xD
Definition aaru.h:692
+
@ SQ800
Definition aaru.h:492
+
@ QIC80
Definition aaru.h:600
+
@ Apple33DS
5.25", DS, DD, 35 tracks, 16 spt, 256 bytes/sector, GCR
Definition aaru.h:246
+
@ ECMA_66
5,25", SS, DD, 35 tracks, 9 spt, 256 bytes/sector, FM, track 0 side 0 = 16 sectors,...
Definition aaru.h:350
+
@ SLRtape24
Definition aaru.h:577
+
@ XGD2
Microsoft X-box 360 Game Disc.
Definition aaru.h:215
+
@ LDROM
Pioneer LaserDisc data.
Definition aaru.h:179
+
@ XDF_35
3.5", DS, HD, 80 tracks, 4 spt, 8192 + 2048 + 1024 + 512 bytes/sector, MFM track 0 = 19 sectors,...
Definition aaru.h:268
+
@ DAT72
Definition aaru.h:432
+
@ T10000B
Definition aaru.h:614
+
@ PS4BD
Sony PlayStation 4 game Blu-ray.
Definition aaru.h:208
+
@ HDDVDR
HD DVD-R.
Definition aaru.h:152
+
@ UDO
5.25", Phase-Change, 1834348 sectors, 8192 bytes/sector, Ultra Density Optical, ECMA-350,...
Definition aaru.h:193
+
@ LTO7
Definition aaru.h:536
+
@ IBM53FD_1024
8", DS, DD, 74 tracks, 8 spt, 1024 bytes/sector, MFM, track 0 side 0 = 26 sectors,...
Definition aaru.h:283
+
@ HDVMD
High Definition Versatile Multilayer Disc.
Definition aaru.h:171
+
@ SLR32
Definition aaru.h:569
+
@ MMCmicro
MMCmicro (RS-MMC form)
Definition aaru.h:556
+
@ MiniCard
Definition aaru.h:688
+
@ Nintendo3DSGameCard
Nintendo 3DS ROM card.
Definition aaru.h:506
+
@ ZIP100
Definition aaru.h:408
+
@ NintendoDiskCard
Famicom Disk System disk.
Definition aaru.h:507
+
@ HDDVDRW
HD DVD-RW.
Definition aaru.h:153
+
@ AppleHD20
Definition aaru.h:700
+
@ PriamDataTower
Definition aaru.h:701
+
@ ECMA_99_26
5,25", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, MFM, track 0 side 0 = 26 sectors,...
Definition aaru.h:343
+
@ RD52
480 cylinders, 7 tracks/cylinder, 18 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:720
+
@ Microdrive
Microdrive type hard disk.
Definition aaru.h:100
+
@ CBM_AMIGA_35_HD
3,5", DS, HD, 80 tracks, 22 spt, 512 bytes/sector, MFM (Amiga)
Definition aaru.h:317
+
@ Exatape160mXL
Definition aaru.h:464
+
@ RSMMC
Reduced Size MMC.
Definition aaru.h:557
+
@ GENERIC_HDD
Generic hard disk.
Definition aaru.h:99
+
@ MMCmobile
MMCmobile (dual voltage)
Definition aaru.h:559
+
@ AppleFileWare
5.25", DS, ?D, ?? tracks, ?? spt, 512 bytes/sector, GCR, opposite side heads, aka Twiggy
Definition aaru.h:249
+
@ MilCD
Sega Dreamcast MIL-CD enhanced multimedia disc.
Definition aaru.h:226
+
@ LTO4
Definition aaru.h:530
+
@ CompactTapeII
Definition aaru.h:441
+
@ BDRE
BD-RE.
Definition aaru.h:161
+
@ DTSCD
DTS audio CD (non-standard)
Definition aaru.h:125
+
@ DVDPR
DVD+R.
Definition aaru.h:139
+
@ ACORN_525_SS_SD_80
5,25", SS, SD, 80 tracks, 10 spt, 256 bytes/sector, FM
Definition aaru.h:296
+
@ SLR6
Definition aaru.h:574
+
@ Data8
Definition aaru.h:415
+
@ DataPlay
Definition aaru.h:694
+
@ IBM33FD_256
8", SS, SD, 74 tracks, 15 spt, 256 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector
Definition aaru.h:275
+
@ DDS4
Definition aaru.h:436
+
@ SLRtape7SL
Definition aaru.h:576
+
@ REV70
Definition aaru.h:407
+
@ DDCDRW
DD CD-RW (Purple Book)
Definition aaru.h:124
+
@ DigitalAudioTape
Definition aaru.h:429
+
@ ECMA_322
5,25", M.O., 1095840 sectors, 4096 bytes/sector, ECMA-322, ISO 22092
Definition aaru.h:657
+
@ AppleWidget
Definition aaru.h:699
+
@ ACORN_525_SS_DD_40
5,25", SS, DD, 40 tracks, 16 spt, 256 bytes/sector, MFM
Definition aaru.h:297
+
@ IBM33FD_128
8", SS, SD, 73 tracks, 26 spt, 128 bytes/sector, FM
Definition aaru.h:274
+
@ Flextra3225
Definition aaru.h:684
+
@ T9840B
Definition aaru.h:608
+
@ Bernoulli2
Definition aaru.h:399
+
@ ECMA_59
8", DS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM
Definition aaru.h:349
+
@ XDF_525
5.25", DS, HD, 80 tracks, ?
Definition aaru.h:266
+
@ FVD
Forward Versatile Disc.
Definition aaru.h:168
+
@ RX50
5.25", SS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM
Definition aaru.h:291
+
@ SyJet
Definition aaru.h:495
+
@ GigaMo2
3,5", M.O., 1063146 sectors, 2048 bytes/sector, Cherry Book 2, GigaMo 2, ECMA-353,...
Definition aaru.h:660
+
@ CDI
CD-i (Green Book)
Definition aaru.h:110
+
@ RX01
8", SS, DD, 77 tracks, 26 spt, 128 bytes/sector, FM
Definition aaru.h:288
+
@ MemoryStickDuo
Definition aaru.h:542
+
@ Playdia
Bandai Playdia.
Definition aaru.h:239
+
@ T9840D
Definition aaru.h:610
+
@ SDLT1
Definition aaru.h:447
+
@ EZ135
Definition aaru.h:482
+
@ DVDPRW
DVD+RW.
Definition aaru.h:140
+
@ ECMA_184
5,25", M.O., 603466 or 637041 sectors, 1024 bytes/sector, ECMA-183, ISO 13549
Definition aaru.h:642
+
@ ECMA_153_512
5,25", M.O., ??? sectors, 512 bytes/sector, ECMA-153, ISO 11560
Definition aaru.h:637
+
@ SLRtape100
Definition aaru.h:583
+
@ Nuon
Nuon (DVD based videogame console)
Definition aaru.h:238
+
@ PD650
120mm, Phase-Change, 1298496 sectors, 512 bytes/sector, PD650, ECMA-240, ISO 15485
Definition aaru.h:128
+
@ ATARI_35_DS_DD_11
3,5", DS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM
Definition aaru.h:311
+
@ Wafer
Definition aaru.h:671
+
@ ECMA_190
300mm, M.O., ??? sectors, 1024 bytes/sector, ECMA-190, ISO 13403
Definition aaru.h:644
+
@ RDX320
Imation 320Gb RDX.
Definition aaru.h:767
+
@ FDFORMAT_35_DD
3,5", DS, DD, 82 tracks, 10 spt, 512 bytes/sector, MFM
Definition aaru.h:367
+
@ CD32
Amiga CD32.
Definition aaru.h:237
+
@ Travan
Definition aaru.h:620
+
@ LVROM
Definition aaru.h:181
+
@ ECMA_78_2
5,25", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, FM
Definition aaru.h:361
+
@ UDO2
5.25", Phase-Change, 3669724 sectors, 8192 bytes/sector, Ultra Density Optical 2, ECMA-380,...
Definition aaru.h:194
+
@ ATARI_35_SS_DD_11
3,5", SS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM
Definition aaru.h:310
+
@ DVDDownload
DVD-Download.
Definition aaru.h:146
+
@ RC25
302 cylinders, 4 tracks/cylinder, 42 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:712
+
@ RK07_18
815 cylinders, 3 tracks/cylinder, 20 sectors/track, 256 words/sector, 18 bits/word,...
Definition aaru.h:732
+
@ DVDRDL
DVD-R DL.
Definition aaru.h:142
+
@ N64DD
Definition aaru.h:503
+
@ ECMA_195_512
5,25", M.O., 1644581 or 1647371 sectors, 512 bytes/sector, ECMA-195, ISO 13842
Definition aaru.h:646
+
@ SLRtape7
Definition aaru.h:575
+
@ SLR5
Definition aaru.h:572
+
@ Exatape22m
Definition aaru.h:454
+
@ T10000D
Definition aaru.h:616
+
@ SLRtape60
Definition aaru.h:581
+
@ ATARI_525_DD
5,25", SS, DD, 40 tracks, 18 spt, 256 bytes/sector, MFM
Definition aaru.h:307
+
@ IBM53FD_512
8", DS, DD, 74 tracks, 15 spt, 512 bytes/sector, MFM, track 0 side 0 = 26 sectors,...
Definition aaru.h:281
+
@ RD53
1024 cylinders, 7 tracks/cylinder, 18 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:722
+
@ Apple33SS
5.25", SS, DD, 35 tracks, 16 spt, 256 bytes/sector, GCR
Definition aaru.h:245
+
@ HiTC2
Definition aaru.h:686
+
@ Exatape75m
Definition aaru.h:460
+
@ AppleSonyDS
3.5", DS, DD, 80 tracks, 8 to 12 spt, 512 bytes/sector, GCR
Definition aaru.h:248
+
@ T10000A
Definition aaru.h:613
+
@ Exatape125m
Definition aaru.h:466
+
@ RP02
203 cylinders, 10 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:740
+
@ RP03_18
400 cylinders, 10 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word,...
Definition aaru.h:746
+
@ RP06
815 cylinders, 19 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:756
+
@ ACORN_35_DS_DD
3,5", DS, DD, 80 tracks, 5 spt, 1024 bytes/sector, MFM
Definition aaru.h:300
+
@ NEC_525_DS
5.25", DS, SD, 80 tracks, 16 spt, 256 bytes/sector, MFM
Definition aaru.h:327
+
@ Exatape112m
Definition aaru.h:465
+
@ HiMD
Sony Hi-MD.
Definition aaru.h:186
+
@ LT1
Definition aaru.h:687
+
@ FD32MB
MF2HD formatted as 32MiB disk in Imation LS-240 drive.
Definition aaru.h:765
+
@ AIT1
Definition aaru.h:383
+
@ ATARI_35_DS_DD
3,5", DS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM
Definition aaru.h:309
+
@ WUOD
Nintendo Wii U Optical Disc.
Definition aaru.h:513
+
@ STK4490
Definition aaru.h:605
+
@ DDS3
Definition aaru.h:435
+
@ Exatape170m
Definition aaru.h:468
+
@ SQ200
Definition aaru.h:487
+
@ DVDROM
DVD-ROM (applies to DVD Video and DVD Audio)
Definition aaru.h:136
+
@ AIT5
Definition aaru.h:391
+
@ LTO3
Definition aaru.h:528
+
@ LDROM2
Definition aaru.h:180
+
@ CBM_1571
5,25", DS, DD, 35 tracks, GCR
Definition aaru.h:320
+
@ FDDVD
Five Dimensional disc.
Definition aaru.h:174
+
@ IBM3490E
Definition aaru.h:521
+
@ DOS_525_DS_DD_8
5.25", DS, DD, 40 tracks, 8 spt, 512 bytes/sector, MFM
Definition aaru.h:255
+
@ DOS_525_SS_DD_9
5.25", SS, DD, 40 tracks, 9 spt, 512 bytes/sector, MFM
Definition aaru.h:254
+
@ SLRtape40
Definition aaru.h:579
+
@ CBM_1540
5,25", SS, DD, 35 tracks, GCR
Definition aaru.h:318
+
@ PS2CD
Sony PlayStation 2 game CD.
Definition aaru.h:204
+
@ ECMA_280
5,25", M.O., 1128134 sectors, 2048 bytes/sector, ECMA-280, ISO 18093
Definition aaru.h:655
+
@ Ditto
Definition aaru.h:400
+
@ NESGamePak
Nintendo NES cartridge.
Definition aaru.h:505
+
@ NEC_8_SD
8", DS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM
Definition aaru.h:324
+
@ DLTtapeIII
Definition aaru.h:443
+
@ LS120
Imation LS-120 SuperDisk.
Definition aaru.h:763
+
@ QIC1350
Definition aaru.h:590
+
@ RP03
400 cylinders, 10 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word,...
Definition aaru.h:744
+
@ ZXMicrodrive
Definition aaru.h:672
+
@ DVDRAM
DVD-RAM.
Definition aaru.h:144
+
SectorTagType
Definition aaru.h:895
+
@ DvdSectorIedAaru
DVD sector ID error detection, 2 bytes.
Definition aaru.h:914
+
@ CdSectorHeader
4-byte CD header (minute, second, frame, mode)
Definition aaru.h:898
+
@ CdSectorEdc
32-bit CRC (EDC)
Definition aaru.h:900
+
@ CdSectorEccP
172 bytes Reed-Solomon ECC (P)
Definition aaru.h:901
+
@ FloppyAddressMark
Raw address mark & sync preamble (format dependent)
Definition aaru.h:909
+
@ CdTrackFlags
Track flags (audio/data, copy permitted, pre-emphasis)
Definition aaru.h:907
+
@ CdTrackText
Track text (CD-Text fragment, 13 bytes)
Definition aaru.h:906
+
@ DvdSectorTitleKey
DVD sector title key, 5 bytes.
Definition aaru.h:910
+
@ DvdSectorEdcAaru
DVD sector EDC, 4 bytes.
Definition aaru.h:915
+
@ DvdCmi
DVD Copyright Management Information (CSS)
Definition aaru.h:908
+
@ CdSectorSubchannelAaru
96 raw subchannel bytes (P-W)
Definition aaru.h:904
+
@ CdSectorSubHeader
Mode 2 Form subheader (8 bytes: copy, submode, channel)
Definition aaru.h:899
+
@ MaxSectorTag
Definition aaru.h:916
+
@ DvdSectorNumber
DVD sector number, 3 bytes.
Definition aaru.h:913
+
@ CdTrackIsrc
Track ISRC (12 ASCII chars, no terminator)
Definition aaru.h:905
+
@ DvdSectorInformation
DVD sector information, 1 bytes.
Definition aaru.h:912
+
@ AppleSectorTag
Apple's GCR sector tags, 12 bytes (address prolog + checksum)
Definition aaru.h:896
+
@ CdSectorEcc
Combined P+Q ECC (276 bytes)
Definition aaru.h:903
+
@ DvdTitleKeyDecrypted
Decrypted DVD sector title key, 5 bytes.
Definition aaru.h:911
+
@ CdSectorSync
12-byte CD sync pattern (00 FF*10 00)
Definition aaru.h:897
+
@ CdSectorEccQ
104 bytes Reed-Solomon ECC (Q)
Definition aaru.h:902
+
High-level summary of an opened Aaru image containing metadata and media characteristics.
Definition aaru.h:870
+
uint8_t HasPartitions
Image contains partitions (or tracks for optical media); 0=no, non-zero=yes.
Definition aaru.h:871
+
uint32_t MediaType
Media type identifier (see MediaType enum; 0=Unknown)
Definition aaru.h:881
+
uint8_t MetadataMediaType
Media type for sidecar generation (internal archival use)
Definition aaru.h:882
+
uint32_t SectorSize
Size of each logical sector in bytes (512, 2048, 2352, 4096, etc.)
Definition aaru.h:875
+
char Application[64]
Name of application that created the image (NUL-terminated)
Definition aaru.h:877
+
uint8_t HasSessions
Image contains multiple sessions (optical media); 0=single/none, non-zero=multi.
Definition aaru.h:872
+
uint64_t ImageSize
Size of the image payload in bytes (excludes headers/metadata)
Definition aaru.h:873
+
int64_t CreationTime
Image creation timestamp (Windows FILETIME: 100ns since 1601-01-01 UTC)
Definition aaru.h:879
+
int64_t LastModificationTime
Last modification timestamp (Windows FILETIME format)
Definition aaru.h:880
+
char Version[32]
Image format version string (NUL-terminated, e.g., "6.0")
Definition aaru.h:876
+
uint64_t Sectors
Total count of addressable logical sectors/blocks.
Definition aaru.h:874
+
char ApplicationVersion[32]
Version of the creating application (NUL-terminated)
Definition aaru.h:878
+
+
+
+ + + + diff --git a/docs/html/aaruformat_8h.html b/docs/html/aaruformat_8h.html new file mode 100644 index 0000000..4a8d465 --- /dev/null +++ b/docs/html/aaruformat_8h.html @@ -0,0 +1,169 @@ + + + + + + + +libaaruformat: include/aaruformat.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
aaruformat.h File Reference
+
+
+
#include "aaruformat/consts.h"
+#include "aaruformat/context.h"
+#include "aaruformat/crc64.h"
+#include "aaruformat/decls.h"
+#include "aaruformat/endian.h"
+#include "aaruformat/enums.h"
+#include "aaruformat/errors.h"
+#include "aaruformat/lru.h"
+#include "aaruformat/simd.h"
+#include "aaruformat/spamsum.h"
+#include "aaruformat/structs.h"
+
+

Go to the source code of this file.

+ + + + +

+Macros

#define LIBAARUFORMAT_MAJOR_VERSION   1
#define LIBAARUFORMAT_MINOR_VERSION   0
+

Macro Definition Documentation

+ +

◆ LIBAARUFORMAT_MAJOR_VERSION

+ +
+
+ + + + +
#define LIBAARUFORMAT_MAJOR_VERSION   1
+
+ +

Definition at line 22 of file aaruformat.h.

+ +

Referenced by aaruf_create(), and aaruf_open().

+ +
+
+ +

◆ LIBAARUFORMAT_MINOR_VERSION

+ +
+
+ + + + +
#define LIBAARUFORMAT_MINOR_VERSION   0
+
+ +

Definition at line 23 of file aaruformat.h.

+ +

Referenced by aaruf_create(), and aaruf_open().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/aaruformat_8h.js b/docs/html/aaruformat_8h.js new file mode 100644 index 0000000..e3404a9 --- /dev/null +++ b/docs/html/aaruformat_8h.js @@ -0,0 +1,5 @@ +var aaruformat_8h = +[ + [ "LIBAARUFORMAT_MAJOR_VERSION", "aaruformat_8h.html#a1341a1043d24b7d7e234fcbfe52dd907", null ], + [ "LIBAARUFORMAT_MINOR_VERSION", "aaruformat_8h.html#a9258501500f40e275641fca951a3ce04", null ] +]; \ No newline at end of file diff --git a/docs/html/aaruformat_8h_source.html b/docs/html/aaruformat_8h_source.html new file mode 100644 index 0000000..bf01642 --- /dev/null +++ b/docs/html/aaruformat_8h_source.html @@ -0,0 +1,154 @@ + + + + + + + +libaaruformat: include/aaruformat.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
aaruformat.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_AARUFORMAT_H
+
20#define LIBAARUFORMAT_AARUFORMAT_H
+
21
+
22#define LIBAARUFORMAT_MAJOR_VERSION 1
+
23#define LIBAARUFORMAT_MINOR_VERSION 0
+
24
+
25#include "aaruformat/consts.h"
+
26#include "aaruformat/context.h"
+
27#include "aaruformat/crc64.h"
+
28#include "aaruformat/decls.h"
+
29#include "aaruformat/endian.h"
+
30#include "aaruformat/enums.h"
+
31#include "aaruformat/errors.h"
+
32#include "aaruformat/lru.h"
+
33#include "aaruformat/simd.h"
+
34#include "aaruformat/spamsum.h"
+
35#include "aaruformat/structs.h"
+
36
+
37#endif // LIBAARUFORMAT_AARUFORMAT_H
+
Core public constants and compile‑time limits for the Aaru container format implementation.
+
Central runtime context structures for libaaruformat (image state, caches, checksum buffers).
+
CRC64 (ECMA-182) core context and precomputed slicing-by-4 tables.
+ + + +
Public error and status code definitions for libaaruformat.
+ + + + +
+
+
+ + + + diff --git a/docs/html/annotated.html b/docs/html/annotated.html new file mode 100644 index 0000000..b5f14c3 --- /dev/null +++ b/docs/html/annotated.html @@ -0,0 +1,158 @@ + + + + + + + +libaaruformat: Data Structures + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Data Structures
+
+
+
Here are the data structures with brief descriptions:
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 Caaru_flac_ctx
 Caaru_optionsParsed user-specified tunables controlling compression, deduplication, hashing and DDT geometry
 Caaruformat_contextMaster context representing an open or in‑creation Aaru image
 CAaruHeaderVersion 1 container header placed at offset 0 for legacy / initial format
 CAaruHeaderV2Version 2 container header with GUID, alignment shifts, and feature negotiation bitmaps
 CAaruMetadataJsonBlockHeaderHeader for an Aaru metadata JSON block (identifier == BlockType::AaruMetadataJsonBlock)
 Cblockhash_ctx
 CBlockHeaderHeader preceding the compressed data payload of a data block (BlockType::DataBlock)
 CCacheEntrySingle hash entry in the in-memory cache
 CCacheHeaderCache top-level descriptor encapsulating the hash table root and capacity limit
 CCdEccContextLookup tables and state for Compact Disc EDC/ECC (P/Q) regeneration / verification
 CChecksumEntryPer-checksum metadata immediately followed by the digest / signature bytes
 CChecksumHeaderHeader that precedes the sequence of checksum entries for a checksum block
 CChecksumsCollected whole‑image checksums / hashes present in a checksum block
 CCicmMetadataBlockHeader for a CICM XML metadata block (identifier == BlockType::CicmBlock)
 Ccrc64_ctxMinimal ECMA-182 CRC64 incremental state container (running value only)
 CDdtHeaderHeader preceding a version 1 (flat) deduplication table body
 CDdtHeader2Header preceding a version 2 hierarchical deduplication table
 CDumpExtentInclusive [start,end] logical sector range contributed by a single hardware environment
 CDumpHardwareEntriesWithDataIn-memory representation of a dump hardware entry plus decoded variable-length fields & extents
 CDumpHardwareEntryPer-environment length table describing subsequent UTF-8 strings and optional extent array
 CDumpHardwareHeaderHeader that precedes a sequence of dump hardware entries and their variable-length payload
 CGeometryBlockHeaderLegacy CHS style logical geometry metadata (BlockType::GeometryBlock)
 Chash_map_tMinimal open-addressing hash map for 64-bit key/value pairs used in deduplication lookup
 CImageInfoHigh-level summary of an opened Aaru image containing metadata and media characteristics
 CIndexEntrySingle index entry describing a block's type, (optional) data classification, and file offset
 CIndexHeaderIndex header (version 1) for legacy images (identifier == IndexBlock)
 CIndexHeader2Index header (version 2) with 64‑bit entry counter (identifier == IndexBlock2)
 CIndexHeader3Index header (version 3) adding hierarchical chaining (identifier == IndexBlock3)
 Ckv_pair_tSingle key/value slot used internally by the open-addressing hash map
 Cmd5_ctx
 CmediaTagEntryHash table entry for an arbitrary media tag (e.g., proprietary drive/medium descriptor)
 CMetadataBlockHeaderHeader for a metadata block containing offsets and lengths to UTF-16LE descriptive strings
 Cpriam_tag
 Cprofile_tag
 Croll_state
 Csha1_ctx
 Csha256_ctx
 Csony_tag
 Cspamsum_ctx
 CTapeDdtHashEntry
 CTapeFileEntryDescribes a single logical file on a tape medium
 CTapeFileHashEntry
 CTapeFileHeaderHeader for a tape file metadata block containing file layout information
 CTapePartitionEntryDescribes a single physical partition on a tape medium
 CTapePartitionHashEntry
 CTapePartitionHeaderHeader for a tape partition metadata block containing partition layout information
 CTrackEntrySingle optical disc track descriptor (sequence, type, LBAs, session, ISRC, flags)
 CTracksHeaderHeader for an optical tracks block listing track entries
+
+
+
+
+ + + + diff --git a/docs/html/annotated_dup.js b/docs/html/annotated_dup.js new file mode 100644 index 0000000..8acfe95 --- /dev/null +++ b/docs/html/annotated_dup.js @@ -0,0 +1,52 @@ +var annotated_dup = +[ + [ "aaru_flac_ctx", "structaaru__flac__ctx.html", "structaaru__flac__ctx" ], + [ "aaru_options", "structaaru__options.html", "structaaru__options" ], + [ "aaruformat_context", "structaaruformat__context.html", "structaaruformat__context" ], + [ "AaruHeader", "structAaruHeader.html", "structAaruHeader" ], + [ "AaruHeaderV2", "structAaruHeaderV2.html", "structAaruHeaderV2" ], + [ "AaruMetadataJsonBlockHeader", "structAaruMetadataJsonBlockHeader.html", "structAaruMetadataJsonBlockHeader" ], + [ "blockhash_ctx", "structblockhash__ctx.html", "structblockhash__ctx" ], + [ "BlockHeader", "structBlockHeader.html", "structBlockHeader" ], + [ "CacheEntry", "structCacheEntry.html", "structCacheEntry" ], + [ "CacheHeader", "structCacheHeader.html", "structCacheHeader" ], + [ "CdEccContext", "structCdEccContext.html", "structCdEccContext" ], + [ "ChecksumEntry", "structChecksumEntry.html", "structChecksumEntry" ], + [ "ChecksumHeader", "structChecksumHeader.html", "structChecksumHeader" ], + [ "Checksums", "structChecksums.html", "structChecksums" ], + [ "CicmMetadataBlock", "structCicmMetadataBlock.html", "structCicmMetadataBlock" ], + [ "crc64_ctx", "structcrc64__ctx.html", "structcrc64__ctx" ], + [ "DdtHeader", "structDdtHeader.html", "structDdtHeader" ], + [ "DdtHeader2", "structDdtHeader2.html", "structDdtHeader2" ], + [ "DumpExtent", "structDumpExtent.html", "structDumpExtent" ], + [ "DumpHardwareEntriesWithData", "structDumpHardwareEntriesWithData.html", "structDumpHardwareEntriesWithData" ], + [ "DumpHardwareEntry", "structDumpHardwareEntry.html", "structDumpHardwareEntry" ], + [ "DumpHardwareHeader", "structDumpHardwareHeader.html", "structDumpHardwareHeader" ], + [ "GeometryBlockHeader", "structGeometryBlockHeader.html", "structGeometryBlockHeader" ], + [ "hash_map_t", "structhash__map__t.html", "structhash__map__t" ], + [ "ImageInfo", "structImageInfo.html", "structImageInfo" ], + [ "IndexEntry", "structIndexEntry.html", "structIndexEntry" ], + [ "IndexHeader", "structIndexHeader.html", "structIndexHeader" ], + [ "IndexHeader2", "structIndexHeader2.html", "structIndexHeader2" ], + [ "IndexHeader3", "structIndexHeader3.html", "structIndexHeader3" ], + [ "kv_pair_t", "structkv__pair__t.html", "structkv__pair__t" ], + [ "md5_ctx", "structmd5__ctx.html", "structmd5__ctx" ], + [ "mediaTagEntry", "structmediaTagEntry.html", "structmediaTagEntry" ], + [ "MetadataBlockHeader", "structMetadataBlockHeader.html", "structMetadataBlockHeader" ], + [ "priam_tag", "structpriam__tag.html", "structpriam__tag" ], + [ "profile_tag", "structprofile__tag.html", "structprofile__tag" ], + [ "roll_state", "structroll__state.html", "structroll__state" ], + [ "sha1_ctx", "structsha1__ctx.html", "structsha1__ctx" ], + [ "sha256_ctx", "structsha256__ctx.html", "structsha256__ctx" ], + [ "sony_tag", "structsony__tag.html", "structsony__tag" ], + [ "spamsum_ctx", "structspamsum__ctx.html", "structspamsum__ctx" ], + [ "TapeDdtHashEntry", "structTapeDdtHashEntry.html", "structTapeDdtHashEntry" ], + [ "TapeFileEntry", "structTapeFileEntry.html", "structTapeFileEntry" ], + [ "TapeFileHashEntry", "structTapeFileHashEntry.html", "structTapeFileHashEntry" ], + [ "TapeFileHeader", "structTapeFileHeader.html", "structTapeFileHeader" ], + [ "TapePartitionEntry", "structTapePartitionEntry.html", "structTapePartitionEntry" ], + [ "TapePartitionHashEntry", "structTapePartitionHashEntry.html", "structTapePartitionHashEntry" ], + [ "TapePartitionHeader", "structTapePartitionHeader.html", "structTapePartitionHeader" ], + [ "TrackEntry", "structTrackEntry.html", "structTrackEntry" ], + [ "TracksHeader", "structTracksHeader.html", "structTracksHeader" ] +]; \ No newline at end of file diff --git a/docs/html/arm__vmull_8c.html b/docs/html/arm__vmull_8c.html new file mode 100644 index 0000000..d141de6 --- /dev/null +++ b/docs/html/arm__vmull_8c.html @@ -0,0 +1,115 @@ + + + + + + + +libaaruformat: src/crc64/arm_vmull.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
arm_vmull.c File Reference
+
+ +
+ +
+ + + + diff --git a/docs/html/arm__vmull_8c_source.html b/docs/html/arm__vmull_8c_source.html new file mode 100644 index 0000000..8b21cec --- /dev/null +++ b/docs/html/arm__vmull_8c_source.html @@ -0,0 +1,274 @@ + + + + + + + +libaaruformat: src/crc64/arm_vmull.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
arm_vmull.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 * Copyright sse2neon.h contributors
+
5 *
+
6 * sse2neon is freely redistributable under the MIT License.
+
7 *
+
8 * Permission is hereby granted, free of charge, to any person obtaining a copy
+
9 * of this software and associated documentation files (the "Software"), to deal
+
10 * in the Software without restriction, including without limitation the rights
+
11 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+
12 * copies of the Software, and to permit persons to whom the Software is
+
13 * furnished to do so, subject to the following conditions:
+
14 *
+
15 * The above copyright notice and this permission notice shall be included in
+
16 * all copies or substantial portions of the Software.
+
17 *
+
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+
21 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+
22 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+
23 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+
24 * SOFTWARE.
+
25 */
+
26
+
27#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
+
28
+
29#include <arm_neon.h>
+
30
+
31#include <aaruformat.h>
+
32
+
33#include "arm_vmull.h"
+
34
+
35#if !defined(__MINGW32__) && (!defined(__ANDROID__) || !defined(__arm__))
+
36TARGET_WITH_CRYPTO static uint64x2_t sse2neon_vmull_p64_crypto(uint64x1_t _a, uint64x1_t _b)
+
37{
+
38 poly64_t a = vget_lane_p64(vreinterpret_p64_u64(_a), 0);
+
39 poly64_t b = vget_lane_p64(vreinterpret_p64_u64(_b), 0);
+
40 return vreinterpretq_u64_p128(vmull_p64(a, b));
+
41}
+
42#endif
+
43
+
44TARGET_WITH_SIMD uint64x2_t sse2neon_vmull_p64(uint64x1_t _a, uint64x1_t _b)
+
45{
+
46#if !defined(__MINGW32__) && (!defined(__ANDROID__) || !defined(__arm__))
+
47 // Wraps vmull_p64
+
48 if(have_arm_crypto()) return sse2neon_vmull_p64_crypto(_a, _b);
+
49#endif
+
50
+
51 // ARMv7 polyfill
+
52 // ARMv7/some A64 lacks vmull_p64, but it has vmull_p8.
+
53 //
+
54 // vmull_p8 calculates 8 8-bit->16-bit polynomial multiplies, but we need a
+
55 // 64-bit->128-bit polynomial multiply.
+
56 //
+
57 // It needs some work and is somewhat slow, but it is still faster than all
+
58 // known scalar methods.
+
59 //
+
60 // Algorithm adapted to C from
+
61 // https://www.workofard.com/2017/07/ghash-for-low-end-cores/, which is adapted
+
62 // from "Fast Software Polynomial Multiplication on ARM Processors Using the
+
63 // NEON Engine" by Danilo Camara, Conrado Gouvea, Julio Lopez and Ricardo Dahab
+
64 // (https://hal.inria.fr/hal-01506572)
+
65
+
66 poly8x8_t a = vreinterpret_p8_u64(_a);
+
67 poly8x8_t b = vreinterpret_p8_u64(_b);
+
68
+
69 // Masks
+
70 uint8x16_t k48_32 = vcombine_u8(vcreate_u8(0x0000ffffffffffff), vcreate_u8(0x00000000ffffffff));
+
71 uint8x16_t k16_00 = vcombine_u8(vcreate_u8(0x000000000000ffff), vcreate_u8(0x0000000000000000));
+
72
+
73 // Do the multiplies, rotating with vext to get all combinations
+
74 uint8x16_t d = vreinterpretq_u8_p16(vmull_p8(a, b)); // D = A0 * B0
+
75 uint8x16_t e = vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 1))); // E = A0 * B1
+
76 uint8x16_t f = vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 1), b)); // F = A1 * B0
+
77 uint8x16_t g = vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 2))); // G = A0 * B2
+
78 uint8x16_t h = vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 2), b)); // H = A2 * B0
+
79 uint8x16_t i = vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 3))); // I = A0 * B3
+
80 uint8x16_t j = vreinterpretq_u8_p16(vmull_p8(vext_p8(a, a, 3), b)); // J = A3 * B0
+
81 uint8x16_t k = vreinterpretq_u8_p16(vmull_p8(a, vext_p8(b, b, 4))); // L = A0 * B4
+
82
+
83 // Add cross products
+
84 uint8x16_t l = veorq_u8(e, f); // L = E + F
+
85 uint8x16_t m = veorq_u8(g, h); // M = G + H
+
86 uint8x16_t n = veorq_u8(i, j); // N = I + J
+
87
+
88 // Interleave. Using vzip1 and vzip2 prevents Clang from emitting TBL
+
89 // instructions.
+
90#if defined(__aarch64__)
+
91 uint8x16_t lm_p0 = vreinterpretq_u8_u64(vzip1q_u64(vreinterpretq_u64_u8(l), vreinterpretq_u64_u8(m)));
+
92 uint8x16_t lm_p1 = vreinterpretq_u8_u64(vzip2q_u64(vreinterpretq_u64_u8(l), vreinterpretq_u64_u8(m)));
+
93 uint8x16_t nk_p0 = vreinterpretq_u8_u64(vzip1q_u64(vreinterpretq_u64_u8(n), vreinterpretq_u64_u8(k)));
+
94 uint8x16_t nk_p1 = vreinterpretq_u8_u64(vzip2q_u64(vreinterpretq_u64_u8(n), vreinterpretq_u64_u8(k)));
+
95#else
+
96 uint8x16_t lm_p0 = vcombine_u8(vget_low_u8(l), vget_low_u8(m));
+
97 uint8x16_t lm_p1 = vcombine_u8(vget_high_u8(l), vget_high_u8(m));
+
98 uint8x16_t nk_p0 = vcombine_u8(vget_low_u8(n), vget_low_u8(k));
+
99 uint8x16_t nk_p1 = vcombine_u8(vget_high_u8(n), vget_high_u8(k));
+
100#endif
+
101 // t0 = (L) (P0 + P1) << 8
+
102 // t1 = (M) (P2 + P3) << 16
+
103 uint8x16_t t0t1_tmp = veorq_u8(lm_p0, lm_p1);
+
104 uint8x16_t t0t1_h = vandq_u8(lm_p1, k48_32);
+
105 uint8x16_t t0t1_l = veorq_u8(t0t1_tmp, t0t1_h);
+
106
+
107 // t2 = (N) (P4 + P5) << 24
+
108 // t3 = (K) (P6 + P7) << 32
+
109 uint8x16_t t2t3_tmp = veorq_u8(nk_p0, nk_p1);
+
110 uint8x16_t t2t3_h = vandq_u8(nk_p1, k16_00);
+
111 uint8x16_t t2t3_l = veorq_u8(t2t3_tmp, t2t3_h);
+
112
+
113 // De-interleave
+
114#if defined(__aarch64__)
+
115 uint8x16_t t0 = vreinterpretq_u8_u64(vuzp1q_u64(vreinterpretq_u64_u8(t0t1_l), vreinterpretq_u64_u8(t0t1_h)));
+
116 uint8x16_t t1 = vreinterpretq_u8_u64(vuzp2q_u64(vreinterpretq_u64_u8(t0t1_l), vreinterpretq_u64_u8(t0t1_h)));
+
117 uint8x16_t t2 = vreinterpretq_u8_u64(vuzp1q_u64(vreinterpretq_u64_u8(t2t3_l), vreinterpretq_u64_u8(t2t3_h)));
+
118 uint8x16_t t3 = vreinterpretq_u8_u64(vuzp2q_u64(vreinterpretq_u64_u8(t2t3_l), vreinterpretq_u64_u8(t2t3_h)));
+
119#else
+
120 uint8x16_t t1 = vcombine_u8(vget_high_u8(t0t1_l), vget_high_u8(t0t1_h));
+
121 uint8x16_t t0 = vcombine_u8(vget_low_u8(t0t1_l), vget_low_u8(t0t1_h));
+
122 uint8x16_t t3 = vcombine_u8(vget_high_u8(t2t3_l), vget_high_u8(t2t3_h));
+
123 uint8x16_t t2 = vcombine_u8(vget_low_u8(t2t3_l), vget_low_u8(t2t3_h));
+
124#endif
+
125 // Shift the cross products
+
126 uint8x16_t t0_shift = vextq_u8(t0, t0, 15); // t0 << 8
+
127 uint8x16_t t1_shift = vextq_u8(t1, t1, 14); // t1 << 16
+
128 uint8x16_t t2_shift = vextq_u8(t2, t2, 13); // t2 << 24
+
129 uint8x16_t t3_shift = vextq_u8(t3, t3, 12); // t3 << 32
+
130
+
131 // Accumulate the products
+
132 uint8x16_t cross1 = veorq_u8(t0_shift, t1_shift);
+
133 uint8x16_t cross2 = veorq_u8(t2_shift, t3_shift);
+
134 uint8x16_t mix = veorq_u8(d, cross1);
+
135 uint8x16_t r = veorq_u8(mix, cross2);
+
136 return vreinterpretq_u64_u8(r);
+
137}
+
138
+
139TARGET_WITH_SIMD uint64x2_t mm_shuffle_epi8(uint64x2_t a, uint64x2_t b)
+
140{
+
141 uint8x16_t tbl = vreinterpretq_u8_u64(a); // input a
+
142 uint8x16_t idx = vreinterpretq_u8_u64(b); // input b
+
143 uint8x16_t idx_masked = vandq_u8(idx, vdupq_n_u8(0x8F)); // avoid using meaningless bits
+
144#if defined(__aarch64__)
+
145 return vreinterpretq_u64_u8(vqtbl1q_u8(tbl, idx_masked));
+
146#else
+
147 // use this line if testing on aarch64
+
148 uint8x8x2_t a_split = {vget_low_u8(tbl), vget_high_u8(tbl)};
+
149 return vreinterpretq_u64_u8(
+
150 vcombine_u8(vtbl2_u8(a_split, vget_low_u8(idx_masked)), vtbl2_u8(a_split, vget_high_u8(idx_masked))));
+
151#endif
+
152}
+
153
+
154TARGET_WITH_SIMD uint64x2_t mm_srli_si128(uint64x2_t a, int imm)
+
155{
+
156 uint8x16_t tmp[2] = {vreinterpretq_u8_u64(a), vdupq_n_u8(0)};
+
157 return vreinterpretq_u64_u8(vld1q_u8(((uint8_t const *)tmp) + imm));
+
158}
+
159
+
160TARGET_WITH_SIMD uint64x2_t mm_slli_si128(uint64x2_t a, int imm)
+
161{
+
162 uint8x16_t tmp[2] = {vdupq_n_u8(0), vreinterpretq_u8_u64(a)};
+
163 return vreinterpretq_u64_u8(vld1q_u8(((uint8_t const *)tmp) + (16 - imm)));
+
164}
+
165
+
166#endif
+ + +
+
+
+ + + + diff --git a/docs/html/arm__vmull_8h.html b/docs/html/arm__vmull_8h.html new file mode 100644 index 0000000..9968654 --- /dev/null +++ b/docs/html/arm__vmull_8h.html @@ -0,0 +1,115 @@ + + + + + + + +libaaruformat: src/crc64/arm_vmull.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
arm_vmull.h File Reference
+
+ +
+ +
+ + + + diff --git a/docs/html/arm__vmull_8h_source.html b/docs/html/arm__vmull_8h_source.html new file mode 100644 index 0000000..a9d6ece --- /dev/null +++ b/docs/html/arm__vmull_8h_source.html @@ -0,0 +1,138 @@ + + + + + + + +libaaruformat: src/crc64/arm_vmull.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
arm_vmull.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_NATIVE_ARM_VMULL_H
+
20#define LIBAARUFORMAT_NATIVE_ARM_VMULL_H
+
21
+
22#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
+
23
+
24TARGET_WITH_CRYPTO static uint64x2_t sse2neon_vmull_p64_crypto(uint64x1_t _a, uint64x1_t _b);
+
25TARGET_WITH_SIMD uint64x2_t sse2neon_vmull_p64(uint64x1_t _a, uint64x1_t _b);
+
26TARGET_WITH_SIMD uint64x2_t mm_shuffle_epi8(uint64x2_t a, uint64x2_t b);
+
27TARGET_WITH_SIMD uint64x2_t mm_srli_si128(uint64x2_t a, int imm);
+
28TARGET_WITH_SIMD uint64x2_t mm_slli_si128(uint64x2_t a, int imm);
+
29
+
30#endif
+
31
+
32#endif // LIBAARUFORMAT_NATIVE_ARM_VMULL_H
+
+
+
+ + + + diff --git a/docs/html/blocks_2dump_8c.html b/docs/html/blocks_2dump_8c.html new file mode 100644 index 0000000..58558de --- /dev/null +++ b/docs/html/blocks_2dump_8c.html @@ -0,0 +1,291 @@ + + + + + + + +libaaruformat: src/blocks/dump.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
dump.c File Reference
+
+
+
#include <inttypes.h>
+#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "aaruformat/consts.h"
+#include "aaruformat/context.h"
+#include "aaruformat/decls.h"
+#include "aaruformat/endian.h"
+#include "aaruformat/enums.h"
+#include "aaruformat/structs/dump.h"
+#include "aaruformat/structs/index.h"
+#include "internal.h"
+#include "log.h"
+
+

Go to the source code of this file.

+ + + + + + + +

+Functions

static void free_dump_hardware_entries_array (DumpHardwareEntriesWithData *entries, uint16_t count)
static void reset_dump_hardware_context (aaruformat_context *ctx)
static bool read_dump_string (FILE *stream, const char *field_name, uint32_t length, uint32_t *remaining, uint8_t **destination)
void process_dumphw_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes a dump hardware block from the image stream.
+

Function Documentation

+ +

◆ free_dump_hardware_entries_array()

+ +
+
+ + + + + +
+ + + + + + + + + + + +
void free_dump_hardware_entries_array (DumpHardwareEntriesWithData * entries,
uint16_t count )
+
+static
+
+ +

Definition at line 36 of file dump.c.

+ +

Referenced by process_dumphw_block(), and reset_dump_hardware_context().

+ +
+
+ +

◆ process_dumphw_block()

+ +
+
+ + + + + + + + + + + +
void process_dumphw_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes a dump hardware block from the image stream.

+

Reads a dump hardware block from the image and updates the context with its contents.

+
Parameters
+ + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the dump hardware block.
+
+
+ +

Definition at line 108 of file dump.c.

+ +

References aaruf_crc64_data(), AARUF_VERSION_V1, IndexEntry::blockType, bswap_64, compare_extents(), DumpHardwareHeader::crc64, aaruformat_context::dump_hardware_entries_with_data, aaruformat_context::dump_hardware_header, DumpHardwareBlock, DumpHardwareHeader::entries, DumpHardwareEntriesWithData::entry, DumpHardwareEntriesWithData::extents, DumpHardwareEntry::extents, FATAL, DumpHardwareEntriesWithData::firmware, DumpHardwareEntry::firmwareLength, free_dump_hardware_entries_array(), aaruformat_context::header, DumpHardwareHeader::identifier, AaruHeaderV2::imageMajorVersion, aaruformat_context::imageStream, DumpHardwareHeader::length, DumpHardwareEntriesWithData::manufacturer, DumpHardwareEntry::manufacturerLength, DumpHardwareEntriesWithData::model, DumpHardwareEntry::modelLength, IndexEntry::offset, read_dump_string(), reset_dump_hardware_context(), DumpHardwareEntriesWithData::revision, DumpHardwareEntry::revisionLength, DumpHardwareEntriesWithData::serial, DumpHardwareEntry::serialLength, DumpHardwareEntriesWithData::softwareName, DumpHardwareEntry::softwareNameLength, DumpHardwareEntriesWithData::softwareOperatingSystem, DumpHardwareEntry::softwareOperatingSystemLength, DumpHardwareEntriesWithData::softwareVersion, DumpHardwareEntry::softwareVersionLength, and TRACE.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ read_dump_string()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
bool read_dump_string (FILE * stream,
const char * field_name,
uint32_t length,
uint32_t * remaining,
uint8_t ** destination )
+
+static
+
+ +

Definition at line 64 of file dump.c.

+ +

References TRACE.

+ +

Referenced by process_dumphw_block().

+ +
+
+ +

◆ reset_dump_hardware_context()

+ +
+
+ + + + + +
+ + + + + + + +
void reset_dump_hardware_context (aaruformat_context * ctx)
+
+static
+
+
+
+
+ +
+ + + + diff --git a/docs/html/blocks_2dump_8c.js b/docs/html/blocks_2dump_8c.js new file mode 100644 index 0000000..0026804 --- /dev/null +++ b/docs/html/blocks_2dump_8c.js @@ -0,0 +1,7 @@ +var blocks_2dump_8c = +[ + [ "free_dump_hardware_entries_array", "blocks_2dump_8c.html#a5145c01023659313140eb978a393b6eb", null ], + [ "process_dumphw_block", "blocks_2dump_8c.html#a0e2cfc858c0551bc9bef11d5bdb85aac", null ], + [ "read_dump_string", "blocks_2dump_8c.html#aa79263803528183e28811dfb50e9bdad", null ], + [ "reset_dump_hardware_context", "blocks_2dump_8c.html#a2976d361aeda7bcc7b9ad40be6b7901d", null ] +]; \ No newline at end of file diff --git a/docs/html/blocks_2dump_8c_source.html b/docs/html/blocks_2dump_8c_source.html new file mode 100644 index 0000000..b974764 --- /dev/null +++ b/docs/html/blocks_2dump_8c_source.html @@ -0,0 +1,517 @@ + + + + + + + +libaaruformat: src/blocks/dump.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
dump.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <inttypes.h>
+
20#include <limits.h>
+
21#include <stdint.h>
+
22#include <stdio.h>
+
23#include <stdlib.h>
+
24#include <string.h>
+
25
+
26#include "aaruformat/consts.h"
+
27#include "aaruformat/context.h"
+
28#include "aaruformat/decls.h"
+
29#include "aaruformat/endian.h"
+
30#include "aaruformat/enums.h"
+ + +
33#include "internal.h"
+
34#include "log.h"
+
35
+
+ +
37{
+
38 if(entries == NULL) return;
+
39
+
40 for(uint16_t e = 0; e < count; e++)
+
41 {
+
42 free(entries[e].manufacturer);
+
43 free(entries[e].model);
+
44 free(entries[e].revision);
+
45 free(entries[e].firmware);
+
46 free(entries[e].serial);
+
47 free(entries[e].softwareName);
+
48 free(entries[e].softwareVersion);
+
49 free(entries[e].softwareOperatingSystem);
+
50 free(entries[e].extents);
+
51 }
+
52}
+
+
53
+
+ +
55{
+
56 if(ctx == NULL) return;
+
57
+ + + +
61 memset(&ctx->dump_hardware_header, 0, sizeof(ctx->dump_hardware_header));
+
62}
+
+
63
+
+
64static bool read_dump_string(FILE *stream, const char *field_name, uint32_t length, uint32_t *remaining,
+
65 uint8_t **destination)
+
66{
+
67 if(length == 0) return true;
+
68
+
69 if(remaining == NULL || *remaining < length)
+
70 {
+
71 TRACE("Dump hardware %s length %u exceeds remaining payload %u", field_name, length,
+
72 remaining == NULL ? 0 : *remaining);
+
73 return false;
+
74 }
+
75
+
76 uint8_t *buffer = (uint8_t *)malloc((size_t)length + 1);
+
77
+
78 if(buffer == NULL)
+
79 {
+
80 TRACE("Could not allocate %s buffer of length %u", field_name, length);
+
81 return false;
+
82 }
+
83
+
84 size_t bytes_read = fread(buffer, 1, length, stream);
+
85
+
86 if(bytes_read != length)
+
87 {
+
88 TRACE("Could not read %s field, expected %u bytes got %zu", field_name, length, bytes_read);
+
89 free(buffer);
+
90 return false;
+
91 }
+
92
+
93 buffer[length] = 0;
+
94 *remaining -= length;
+
95 *destination = buffer;
+
96
+
97 return true;
+
98}
+
+
99
+
+ +
109{
+
110 TRACE("Entering process_dumphw_block(%p, %p)", ctx, entry);
+
111 size_t read_bytes = 0;
+
112
+
113 if(ctx == NULL || ctx->imageStream == NULL || entry == NULL)
+
114 {
+
115 FATAL("Invalid context, image stream, or index entry pointer.");
+
116 TRACE("Exiting process_dumphw_block()");
+
117 if(ctx != NULL) reset_dump_hardware_context(ctx);
+
118 return;
+
119 }
+
120
+
121 if(entry->blockType != DumpHardwareBlock)
+
122 {
+
123 TRACE("Index entry block type %u is not DumpHardwareBlock, skipping.", entry->blockType);
+
124 TRACE("Exiting process_dumphw_block()");
+
125 return;
+
126 }
+
127
+
128 if(fseek(ctx->imageStream, (long)entry->offset, SEEK_SET) < 0 || ftell(ctx->imageStream) != entry->offset)
+
129 {
+
130 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
+ +
132 TRACE("Exiting process_dumphw_block()");
+
133 return;
+
134 }
+
135
+
136 TRACE("Reading dump hardware block header at position %" PRIu64, entry->offset);
+
137 DumpHardwareHeader header;
+
138 read_bytes = fread(&header, 1, sizeof(header), ctx->imageStream);
+
139
+
140 if(read_bytes != sizeof(header))
+
141 {
+
142 TRACE("Could not read dump hardware block header (read %zu bytes)", read_bytes);
+ +
144 TRACE("Exiting process_dumphw_block()");
+
145 return;
+
146 }
+
147
+
148 if(header.identifier != DumpHardwareBlock)
+
149 {
+
150 TRACE("Incorrect identifier 0x%08" PRIx32 " for dump hardware block at position %" PRIu64, header.identifier,
+
151 entry->offset);
+ +
153 TRACE("Exiting process_dumphw_block()");
+
154 return;
+
155 }
+
156
+
157 if(header.entries > 0 && header.length == 0)
+
158 {
+
159 TRACE("Dump hardware header indicates %u entries but zero payload length", header.entries);
+ +
161 TRACE("Exiting process_dumphw_block()");
+
162 return;
+
163 }
+
164
+
165 const uint32_t payload_length = header.length;
+
166
+
167 if(payload_length > 0)
+
168 {
+
169 uint8_t *payload = (uint8_t *)malloc(payload_length);
+
170
+
171 if(payload == NULL)
+
172 {
+
173 TRACE("Could not allocate %u bytes for dump hardware payload", payload_length);
+ +
175 TRACE("Exiting process_dumphw_block()");
+
176 return;
+
177 }
+
178
+
179 read_bytes = fread(payload, 1, payload_length, ctx->imageStream);
+
180
+
181 if(read_bytes != payload_length)
+
182 {
+
183 TRACE("Could not read dump hardware payload, expected %u bytes got %zu", payload_length, read_bytes);
+
184 free(payload);
+ +
186 TRACE("Exiting process_dumphw_block()");
+
187 return;
+
188 }
+
189
+
190 uint64_t crc64 = aaruf_crc64_data(payload, payload_length);
+
191
+
192 if(ctx->header.imageMajorVersion <= AARUF_VERSION_V1) crc64 = bswap_64(crc64);
+
193
+
194 if(crc64 != header.crc64)
+
195 {
+
196 TRACE("Dump hardware block CRC mismatch: computed 0x%" PRIx64 " expected 0x%" PRIx64, crc64, header.crc64);
+
197 free(payload);
+ +
199 TRACE("Exiting process_dumphw_block()");
+
200 return;
+
201 }
+
202
+
203 free(payload);
+
204
+
205 if(fseek(ctx->imageStream, -(long)payload_length, SEEK_CUR) != 0)
+
206 {
+
207 TRACE("Could not rewind after CRC verification");
+ +
209 TRACE("Exiting process_dumphw_block()");
+
210 return;
+
211 }
+
212 }
+
213
+
214 if(header.entries == 0)
+
215 {
+ +
217 ctx->dump_hardware_header = header;
+
218 TRACE("Dump hardware block contains no entries. Clearing existing metadata.");
+
219 TRACE("Exiting process_dumphw_block()");
+
220 return;
+
221 }
+
222
+
223 const size_t allocation_size = (size_t)header.entries * sizeof(DumpHardwareEntriesWithData);
+
224
+
225 if(allocation_size / sizeof(DumpHardwareEntriesWithData) != header.entries)
+
226 {
+
227 TRACE("Dump hardware entries multiplication overflow (%u entries)", header.entries);
+ +
229 TRACE("Exiting process_dumphw_block()");
+
230 return;
+
231 }
+
232
+ + +
235
+
236 if(entries == NULL)
+
237 {
+
238 TRACE("Could not allocate %zu bytes for dump hardware entries", allocation_size);
+ +
240 TRACE("Exiting process_dumphw_block()");
+
241 return;
+
242 }
+
243
+
244 uint32_t remaining_payload = payload_length;
+
245 uint16_t processed_entry = 0;
+
246
+
247 TRACE("Processing %u dump hardware block entries", header.entries);
+
248
+
249 for(uint16_t e = 0; e < header.entries; e++)
+
250 {
+
251 processed_entry = e;
+
252 DumpHardwareEntriesWithData *current = &entries[e];
+
253
+
254 if(remaining_payload < sizeof(DumpHardwareEntry))
+
255 {
+
256 TRACE("Remaining payload %u too small for dump hardware entry %u", remaining_payload, e);
+
257 goto parse_failure;
+
258 }
+
259
+
260 read_bytes = fread(&current->entry, 1, sizeof(DumpHardwareEntry), ctx->imageStream);
+
261
+
262 if(read_bytes != sizeof(DumpHardwareEntry))
+
263 {
+
264 TRACE("Could not read dump hardware entry %u header (read %zu bytes)", e, read_bytes);
+
265 goto parse_failure;
+
266 }
+
267
+
268 remaining_payload -= sizeof(DumpHardwareEntry);
+
269
+
270 if(!read_dump_string(ctx->imageStream, "manufacturer", current->entry.manufacturerLength, &remaining_payload,
+
271 &current->manufacturer))
+
272 goto parse_failure;
+
273
+
274 if(!read_dump_string(ctx->imageStream, "model", current->entry.modelLength, &remaining_payload,
+
275 &current->model))
+
276 goto parse_failure;
+
277
+
278 if(!read_dump_string(ctx->imageStream, "revision", current->entry.revisionLength, &remaining_payload,
+
279 &current->revision))
+
280 goto parse_failure;
+
281
+
282 if(!read_dump_string(ctx->imageStream, "firmware", current->entry.firmwareLength, &remaining_payload,
+
283 &current->firmware))
+
284 goto parse_failure;
+
285
+
286 if(!read_dump_string(ctx->imageStream, "serial", current->entry.serialLength, &remaining_payload,
+
287 &current->serial))
+
288 goto parse_failure;
+
289
+
290 if(!read_dump_string(ctx->imageStream, "software name", current->entry.softwareNameLength, &remaining_payload,
+
291 &current->softwareName))
+
292 goto parse_failure;
+
293
+
294 if(!read_dump_string(ctx->imageStream, "software version", current->entry.softwareVersionLength,
+
295 &remaining_payload, &current->softwareVersion))
+
296 goto parse_failure;
+
297
+
298 if(!read_dump_string(ctx->imageStream, "software operating system",
+
299 current->entry.softwareOperatingSystemLength, &remaining_payload,
+
300 &current->softwareOperatingSystem))
+
301 goto parse_failure;
+
302
+
303 const uint32_t extent_count = current->entry.extents;
+
304
+
305 if(extent_count == 0) continue;
+
306
+
307 const size_t extent_bytes = (size_t)extent_count * sizeof(DumpExtent);
+
308
+
309 if(extent_bytes / sizeof(DumpExtent) != extent_count || extent_bytes > remaining_payload)
+
310 {
+
311 TRACE("Extent array for entry %u exceeds remaining payload (%zu bytes requested, %u left)", e, extent_bytes,
+
312 remaining_payload);
+
313 goto parse_failure;
+
314 }
+
315
+
316 current->extents = (DumpExtent *)malloc(extent_bytes);
+
317
+
318 if(current->extents == NULL)
+
319 {
+
320 TRACE("Could not allocate %zu bytes for dump hardware entry %u extents", extent_bytes, e);
+
321 goto parse_failure;
+
322 }
+
323
+
324 const size_t extents_read = fread(current->extents, sizeof(DumpExtent), extent_count, ctx->imageStream);
+
325
+
326 if(extents_read != extent_count)
+
327 {
+
328 TRACE("Could not read %u dump hardware extents for entry %u (read %zu)", extent_count, e, extents_read);
+
329 goto parse_failure;
+
330 }
+
331
+
332 remaining_payload -= (uint32_t)extent_bytes;
+
333
+
334 qsort(current->extents, extent_count, sizeof(DumpExtent), compare_extents);
+
335 TRACE("Sorted %u extents for entry %u", extent_count, e);
+
336 }
+
337
+ +
339 ctx->dump_hardware_entries_with_data = entries;
+
340 ctx->dump_hardware_header = header;
+
341
+
342 if(remaining_payload != 0)
+
343 {
+
344 TRACE("Dump hardware block parsing completed with %u trailing payload bytes", remaining_payload);
+
345 }
+
346
+
347 TRACE("Exiting process_dumphw_block()");
+
348 return;
+
349
+
350parse_failure:
+
351 free_dump_hardware_entries_array(entries, processed_entry + 1);
+
352 free(entries);
+ +
354 TRACE("Exiting process_dumphw_block()");
+
355}
+
+
void process_dumphw_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a dump hardware block from the image stream.
Definition dump.c:108
+
static void reset_dump_hardware_context(aaruformat_context *ctx)
Definition dump.c:54
+
static void free_dump_hardware_entries_array(DumpHardwareEntriesWithData *entries, uint16_t count)
Definition dump.c:36
+
static bool read_dump_string(FILE *stream, const char *field_name, uint32_t length, uint32_t *remaining, uint8_t **destination)
Definition dump.c:64
+
Core public constants and compile‑time limits for the Aaru container format implementation.
+
#define AARUF_VERSION_V1
First on‑disk version (C# implementation).
Definition consts.h:71
+
Central runtime context structures for libaaruformat (image state, caches, checksum buffers).
+ +
uint64_t aaruf_crc64_data(const uint8_t *data, uint32_t len)
Definition crc64.c:160
+
Packed on-disk structures describing hardware and software used during image acquisition.
+ +
#define bswap_64(x)
Definition endian.h:81
+ +
@ DumpHardwareBlock
Block containing an array of hardware used to create the image.
Definition enums.h:156
+
On‑disk index block header and entry structures (versions 1, 2 and 3).
+ +
int compare_extents(const void *a, const void *b)
Comparison function for sorting DumpExtent arrays by start sector.
Definition helpers.c:451
+ +
#define FATAL(fmt,...)
Definition log.h:40
+
#define TRACE(fmt,...)
Definition log.h:25
+
uint8_t imageMajorVersion
Container format major version.
Definition header.h:110
+
Inclusive [start,end] logical sector range contributed by a single hardware environment.
Definition context.h:333
+
In-memory representation of a dump hardware entry plus decoded variable-length fields & extents.
Definition context.h:314
+
uint8_t * firmware
Firmware version string or NULL.
Definition context.h:320
+
uint8_t * revision
Hardware revision string or NULL.
Definition context.h:319
+
uint8_t * model
Model string or NULL.
Definition context.h:318
+
uint8_t * softwareName
Dump software name or NULL.
Definition context.h:322
+
struct DumpExtent * extents
Array of extents (entry.extents elements) or NULL.
Definition context.h:316
+
uint8_t * manufacturer
Manufacturer string (UTF-8) or NULL.
Definition context.h:317
+
uint8_t * softwareVersion
Dump software version or NULL.
Definition context.h:323
+
uint8_t * serial
Serial number string or NULL.
Definition context.h:321
+
DumpHardwareEntry entry
Fixed-size header with lengths & counts.
Definition context.h:315
+
uint8_t * softwareOperatingSystem
Host operating system string or NULL.
Definition context.h:324
+
Per-environment length table describing subsequent UTF-8 strings and optional extent array.
Definition dump.h:113
+
uint32_t softwareNameLength
Length in bytes of dumping software name string.
Definition dump.h:119
+
uint32_t manufacturerLength
Length in bytes of manufacturer UTF-8 string.
Definition dump.h:114
+
uint32_t softwareVersionLength
Length in bytes of dumping software version string.
Definition dump.h:120
+
uint32_t firmwareLength
Length in bytes of firmware version string.
Definition dump.h:117
+
uint32_t extents
Number of DumpExtent records following the strings (0 = none).
Definition dump.h:122
+
uint32_t modelLength
Length in bytes of model UTF-8 string.
Definition dump.h:115
+
uint32_t serialLength
Length in bytes of device serial number string.
Definition dump.h:118
+
uint32_t revisionLength
Length in bytes of revision / hardware revision string.
Definition dump.h:116
+
uint32_t softwareOperatingSystemLength
Length in bytes of host operating system string.
Definition dump.h:121
+
Header that precedes a sequence of dump hardware entries and their variable-length payload.
Definition dump.h:91
+
uint64_t crc64
CRC64-ECMA of the payload (byte-swapped for legacy v1 images, handled automatically).
Definition dump.h:95
+
uint32_t identifier
Block identifier, must be BlockType::DumpHardwareBlock.
Definition dump.h:92
+
uint32_t length
Total payload bytes after this header (sum of entries, strings, and extents arrays).
Definition dump.h:94
+
uint16_t entries
Number of DumpHardwareEntry records that follow.
Definition dump.h:93
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
uint32_t blockType
Block identifier of the referenced block (value from BlockType).
Definition index.h:110
+
uint64_t offset
Absolute byte offset in the image where the referenced block header begins.
Definition index.h:112
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
AaruHeaderV2 header
Parsed container header (v2).
Definition context.h:175
+
struct DumpHardwareEntriesWithData * dump_hardware_entries_with_data
Array of dump hardware entries + strings.
Definition context.h:212
+
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
+
DumpHardwareHeader dump_hardware_header
Dump hardware header.
Definition context.h:232
+
+
+
+ + + + diff --git a/docs/html/blocks_2metadata_8c.html b/docs/html/blocks_2metadata_8c.html new file mode 100644 index 0000000..b0e2a69 --- /dev/null +++ b/docs/html/blocks_2metadata_8c.html @@ -0,0 +1,343 @@ + + + + + + + +libaaruformat: src/blocks/metadata.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
metadata.c File Reference
+
+
+
#include <inttypes.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "aaruformat.h"
+#include "log.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + +

+Functions

void process_metadata_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes a metadata block from the image stream.
void process_geometry_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes a logical geometry block from the image stream.
void process_cicm_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes a CICM XML metadata block from the image stream.
void process_aaru_metadata_json_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes an Aaru metadata JSON block from the image stream during image opening.
+

Function Documentation

+ +

◆ process_aaru_metadata_json_block()

+ +
+
+ + + + + + + + + + + +
void process_aaru_metadata_json_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes an Aaru metadata JSON block from the image stream during image opening.

+

Reads an Aaru metadata JSON block from the image file and loads its contents into the context for subsequent retrieval. The Aaru metadata JSON format is a structured representation of comprehensive image metadata including media information, imaging session details, hardware configuration, optical disc tracks and sessions, checksums, and preservation metadata. The JSON payload is stored in its original form without parsing or interpretation by this function, allowing higher-level code to process the structured data as needed.

+

This function is called during the image opening process (aaruf_open) when an index entry indicates the presence of an AaruMetadataJsonBlock. The function is non-critical; if reading fails or memory allocation fails, the error is logged but the image opening continues. This allows images without JSON metadata or with corrupted JSON blocks to still be opened for data access.

+

Processing sequence:

    +
  1. Validate context and image stream
  2. +
  3. Seek to the block offset specified by the index entry
  4. +
  5. Read the AaruMetadataJsonBlockHeader (8 bytes: identifier + length)
  6. +
  7. Validate the block identifier matches AaruMetadataJsonBlock
  8. +
  9. Allocate memory for the JSON payload
  10. +
  11. Read the JSON data from the file stream
  12. +
  13. Store header and data pointer in the context for later retrieval
  14. +
+

Memory allocation: The function allocates memory (via malloc) sized to hold the entire JSON payload as specified by ctx->jsonBlockHeader.length. This memory remains allocated for the lifetime of the context and is freed during aaruf_close(). If allocation fails, the function returns gracefully without the JSON metadata, allowing the image to still be opened.

+

Image size tracking: The function increments ctx->imageInfo.ImageSize by the length of the JSON payload to track the total size of metadata and structural blocks in the image.

+

Error handling: All errors are non-fatal and handled gracefully:

    +
  • Seek failures: logged and function returns early
  • +
  • Header read failures: header zeroed, function returns
  • +
  • Identifier mismatches: header zeroed, processing continues but data is not loaded
  • +
  • Memory allocation failures: header zeroed, function returns
  • +
  • Data read failures: header zeroed, allocated memory freed, function returns
  • +
+

In all error cases, the ctx->jsonBlockHeader is zeroed (memset to 0) to indicate that no valid JSON metadata is available, and any allocated memory is properly freed.

+
Parameters
+ + + +
ctxPointer to an initialized aaruformatContext being populated during image opening. Must not be NULL. ctx->imageStream must be open and readable. On success, ctx->jsonBlockHeader will contain the block header and ctx->jsonBlock will point to the allocated JSON data.
entryPointer to the IndexEntry that specifies the file offset where the AaruMetadataJsonBlock begins. Must not be NULL. entry->offset indicates the position of the block header in the file.
+
+
+
Note
JSON Format and Encoding:
    +
  • The JSON payload is stored in UTF-8 encoding
  • +
  • The payload may or may not be null-terminated
  • +
  • This function treats the JSON as opaque binary data
  • +
  • No JSON parsing, interpretation, or validation is performed during loading
  • +
  • JSON schema validation is the responsibility of code that retrieves the metadata
  • +
+
+
+Aaru Metadata JSON Purpose:
    +
  • Provides machine-readable structured metadata about the image
  • +
  • Includes comprehensive information about media, sessions, tracks, and checksums
  • +
  • Enables programmatic access to metadata without XML parsing overhead
  • +
  • Complements CICM XML with a more modern, structured format
  • +
  • Used by Aaru and compatible tools for metadata exchange
  • +
+
+
+Non-Critical Nature:
    +
  • JSON metadata is optional and supplementary to core image data
  • +
  • Failures reading this block do not prevent image opening
  • +
  • The image remains fully functional for sector data access without JSON metadata
  • +
  • Higher-level code should check if ctx->jsonBlock is non-NULL before use
  • +
+
+
+Distinction from CICM XML:
    +
  • Both CICM and Aaru JSON blocks can coexist in the same image
  • +
  • CICM XML follows the Canary Islands Computer Museum schema
  • +
  • Aaru JSON follows the Aaru-specific metadata schema
  • +
  • Different tools may prefer one format over the other
  • +
+
+
Warning
Memory allocated for ctx->jsonBlock persists for the context lifetime and must be freed during context cleanup (aaruf_close).
+
+This function does not validate JSON syntax or schema. Corrupted JSON data will be loaded successfully and errors will only be detected when attempting to parse.
+
See also
AaruMetadataJsonBlockHeader for the on-disk structure definition.
+
+process_cicm_block() for processing CICM XML metadata blocks.
+
+aaruf_open() for the overall image opening sequence.
+ +

Definition at line 470 of file metadata.c.

+ +

References AaruMetadataJsonBlock, FATAL, AaruMetadataJsonBlockHeader::identifier, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, aaruformat_context::json_block, aaruformat_context::json_block_header, AaruMetadataJsonBlockHeader::length, IndexEntry::offset, and TRACE.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_cicm_block()

+ +
+
+ + + + + + + + + + + +
void process_cicm_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes a CICM XML metadata block from the image stream.

+

Reads a CICM XML metadata block from the image and updates the context with its contents.

+
Parameters
+ + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the CICM block.
+
+
+ +

Definition at line 306 of file metadata.c.

+ +

References aaruformat_context::cicm_block, aaruformat_context::cicm_block_header, CicmBlock, FATAL, CicmMetadataBlock::identifier, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, CicmMetadataBlock::length, IndexEntry::offset, and TRACE.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_geometry_block()

+ +
+
+ + + + + + + + + + + +
void process_geometry_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes a logical geometry block from the image stream.

+

Reads a logical geometry block from the image and updates the context with its contents.

+
Parameters
+ + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the geometry block.
+
+
+ +

Definition at line 246 of file metadata.c.

+ +

References aaruformat_context::cylinders, GeometryBlockHeader::cylinders, FATAL, aaruformat_context::geometry_block, GeometryBlock, aaruformat_context::heads, GeometryBlockHeader::heads, GeometryBlockHeader::identifier, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, IndexEntry::offset, aaruformat_context::sectors_per_track, GeometryBlockHeader::sectorsPerTrack, and TRACE.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_metadata_block()

+ +
+
+ + + + + + + + + + + +
void process_metadata_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes a metadata block from the image stream.

+

Reads a metadata block from the image and updates the context with its contents.

+
Parameters
+ + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the metadata block.
+
+
+ +

Definition at line 35 of file metadata.c.

+ +

References MetadataBlockHeader::blockSize, IndexEntry::blockType, aaruformat_context::comments, MetadataBlockHeader::commentsLength, MetadataBlockHeader::commentsOffset, aaruformat_context::creator, MetadataBlockHeader::creatorLength, MetadataBlockHeader::creatorOffset, aaruformat_context::drive_firmware_revision, aaruformat_context::drive_manufacturer, aaruformat_context::drive_model, aaruformat_context::drive_serial_number, MetadataBlockHeader::driveFirmwareRevisionLength, MetadataBlockHeader::driveFirmwareRevisionOffset, MetadataBlockHeader::driveManufacturerLength, MetadataBlockHeader::driveManufacturerOffset, MetadataBlockHeader::driveModelLength, MetadataBlockHeader::driveModelOffset, MetadataBlockHeader::driveSerialNumberLength, MetadataBlockHeader::driveSerialNumberOffset, FATAL, MetadataBlockHeader::identifier, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, aaruformat_context::last_media_sequence, MetadataBlockHeader::lastMediaSequence, aaruformat_context::media_barcode, aaruformat_context::media_manufacturer, aaruformat_context::media_model, aaruformat_context::media_part_number, aaruformat_context::media_sequence, aaruformat_context::media_serial_number, aaruformat_context::media_title, MetadataBlockHeader::mediaBarcodeLength, MetadataBlockHeader::mediaBarcodeOffset, MetadataBlockHeader::mediaManufacturerLength, MetadataBlockHeader::mediaManufacturerOffset, MetadataBlockHeader::mediaModelLength, MetadataBlockHeader::mediaModelOffset, MetadataBlockHeader::mediaPartNumberLength, MetadataBlockHeader::mediaPartNumberOffset, MetadataBlockHeader::mediaSequence, MetadataBlockHeader::mediaSerialNumberLength, MetadataBlockHeader::mediaSerialNumberOffset, MetadataBlockHeader::mediaTitleLength, MetadataBlockHeader::mediaTitleOffset, aaruformat_context::metadata_block, aaruformat_context::metadata_block_header, IndexEntry::offset, and TRACE.

+ +

Referenced by aaruf_open().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/blocks_2metadata_8c.js b/docs/html/blocks_2metadata_8c.js new file mode 100644 index 0000000..1857c0a --- /dev/null +++ b/docs/html/blocks_2metadata_8c.js @@ -0,0 +1,7 @@ +var blocks_2metadata_8c = +[ + [ "process_aaru_metadata_json_block", "blocks_2metadata_8c.html#a84003ec881425a7b28ec24cb48d19f02", null ], + [ "process_cicm_block", "blocks_2metadata_8c.html#a5e0397faed8aea27c5a6a3881875de54", null ], + [ "process_geometry_block", "blocks_2metadata_8c.html#a81d410de6727d95a85b827067e1a8bc6", null ], + [ "process_metadata_block", "blocks_2metadata_8c.html#a43974d4c183240be30d49ff09ef7b8c2", null ] +]; \ No newline at end of file diff --git a/docs/html/blocks_2metadata_8c_source.html b/docs/html/blocks_2metadata_8c_source.html new file mode 100644 index 0000000..52bb9d9 --- /dev/null +++ b/docs/html/blocks_2metadata_8c_source.html @@ -0,0 +1,620 @@ + + + + + + + +libaaruformat: src/blocks/metadata.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
metadata.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <inttypes.h>
+
20#include <stdint.h>
+
21#include <stdio.h>
+
22#include <stdlib.h>
+
23
+
24#include "aaruformat.h"
+
25#include "log.h"
+
26
+
+ +
36{
+
37 TRACE("Entering process_metadata_block(%p, %p)", ctx, entry);
+
38 int pos = 0;
+
39 size_t read_bytes = 0;
+
40
+
41 // Check if the context and image stream are valid
+
42 if(ctx == NULL || ctx->imageStream == NULL)
+
43 {
+
44 FATAL("Invalid context or image stream.");
+
45 TRACE("Exiting process_metadata_block()");
+
46 return;
+
47 }
+
48
+
49 // Seek to block
+
50 TRACE("Seeking to metadata block at position %" PRIu64, entry->offset);
+
51 pos = fseek(ctx->imageStream, entry->offset, SEEK_SET);
+
52 if(pos < 0 || ftell(ctx->imageStream) != entry->offset)
+
53 {
+
54 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
+
55
+
56 TRACE("Exiting process_metadata_block()");
+
57 return;
+
58 }
+
59
+
60 // Even if those two checks shall have been done before
+
61 TRACE("Reading metadata block header at position %" PRIu64, entry->offset);
+
62 read_bytes = fread(&ctx->metadata_block_header, 1, sizeof(MetadataBlockHeader), ctx->imageStream);
+
63
+
64 if(read_bytes != sizeof(MetadataBlockHeader))
+
65 {
+
66 memset(&ctx->metadata_block_header, 0, sizeof(MetadataBlockHeader));
+
67 FATAL("Could not read metadata block header, continuing...");
+
68
+
69 TRACE("Exiting process_metadata_block()");
+
70 return;
+
71 }
+
72
+ +
74 {
+
75 memset(&ctx->metadata_block_header, 0, sizeof(MetadataBlockHeader));
+
76 TRACE("Incorrect identifier for data block at position %" PRIu64 "", entry->offset);
+
77
+
78 TRACE("Exiting process_metadata_block()");
+
79 return;
+
80 }
+
81
+ +
83
+
84 ctx->metadata_block = (uint8_t *)malloc(ctx->metadata_block_header.blockSize);
+
85
+
86 if(ctx->metadata_block == NULL)
+
87 {
+
88 memset(&ctx->metadata_block_header, 0, sizeof(MetadataBlockHeader));
+
89 FATAL("Could not allocate memory for metadata block, continuing...");
+
90
+
91 TRACE("Exiting process_metadata_block()");
+
92 return;
+
93 }
+
94
+
95 TRACE("Reading metadata block of size %u at position %" PRIu64, ctx->metadata_block_header.blockSize,
+
96 entry->offset + sizeof(MetadataBlockHeader));
+
97 read_bytes = fread(ctx->metadata_block, 1, ctx->metadata_block_header.blockSize, ctx->imageStream);
+
98
+
99 if(read_bytes != ctx->metadata_block_header.blockSize)
+
100 {
+
101 memset(&ctx->metadata_block_header, 0, sizeof(MetadataBlockHeader));
+
102 free(ctx->metadata_block);
+
103 FATAL("Could not read metadata block, continuing...");
+
104 }
+
105
+ +
107 {
+ + +
110 TRACE("Setting media sequence as %d of %d", ctx->media_sequence, ctx->last_media_sequence);
+
111 }
+
112
+ + + +
116 {
+
117 ctx->creator = (uint8_t *)malloc(ctx->metadata_block_header.creatorLength);
+
118 if(ctx->creator != NULL)
+ + +
121 }
+
122
+ + + +
126 {
+
127 ctx->comments = (uint8_t *)malloc(ctx->metadata_block_header.commentsLength);
+
128 if(ctx->comments != NULL)
+ + +
131 }
+
132
+ + + +
136 {
+
137 ctx->media_title = (uint8_t *)malloc(ctx->metadata_block_header.mediaTitleLength);
+
138 if(ctx->media_title != NULL)
+ + +
141 }
+
142
+ + + +
146 {
+ +
148 if(ctx->media_manufacturer != NULL)
+ + +
151 }
+
152
+ + + +
156 {
+
157 ctx->media_model = (uint8_t *)malloc(ctx->metadata_block_header.mediaModelLength);
+
158 if(ctx->media_model != NULL)
+ + +
161 }
+
162
+ + + +
166 {
+ +
168 if(ctx->media_serial_number != NULL)
+ + +
171 }
+
172
+ + + +
176 {
+
177 ctx->media_barcode = (uint8_t *)malloc(ctx->metadata_block_header.mediaBarcodeLength);
+
178 if(ctx->media_barcode != NULL)
+ + +
181 }
+
182
+ + + +
186 {
+ +
188 if(ctx->media_part_number != NULL)
+ + +
191 }
+
192
+ + + +
196 {
+ +
198 if(ctx->drive_manufacturer != NULL)
+ + +
201 }
+
202
+ + + +
206 {
+
207 ctx->drive_model = (uint8_t *)malloc(ctx->metadata_block_header.driveModelLength);
+
208 if(ctx->drive_model != NULL)
+ + +
211 }
+
212
+ + + +
216 {
+ +
218 if(ctx->drive_serial_number != NULL)
+ + +
221 }
+
222
+ + + + +
227 {
+ +
229 if(ctx->drive_firmware_revision != NULL)
+
230 memcpy(ctx->drive_firmware_revision,
+ + +
233 }
+
234
+
235 TRACE("Exiting process_metadata_block()");
+
236}
+
+
237
+
+ +
247{
+
248 TRACE("Entering process_geometry_block(%p, %p)", ctx, entry);
+
249 size_t read_bytes = 0;
+
250
+
251 // Check if the context and image stream are valid
+
252 if(ctx == NULL || ctx->imageStream == NULL)
+
253 {
+
254 FATAL("Invalid context or image stream.");
+
255
+
256 TRACE("Exiting process_geometry_block()");
+
257 return;
+
258 }
+
259
+
260 // Seek to block
+
261 if(fseek(ctx->imageStream, entry->offset, SEEK_SET) != 0)
+
262 {
+
263 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
+
264
+
265 TRACE("Exiting process_geometry_block()");
+
266 return;
+
267 }
+
268
+
269 TRACE("Reading geometry block header at position %" PRIu64, entry->offset);
+
270 read_bytes = fread(&ctx->geometry_block, 1, sizeof(GeometryBlockHeader), ctx->imageStream);
+
271
+
272 if(read_bytes != sizeof(GeometryBlockHeader))
+
273 {
+
274 memset(&ctx->geometry_block, 0, sizeof(GeometryBlockHeader));
+
275 TRACE("Could not read geometry block header, continuing...");
+
276 return;
+
277 }
+
278
+ +
280 {
+
281 memset(&ctx->geometry_block, 0, sizeof(GeometryBlockHeader));
+
282 TRACE("Incorrect identifier for geometry block at position %" PRIu64 "", entry->offset);
+
283 return;
+
284 }
+
285
+ +
287
+
288 TRACE("Geometry set to %d cylinders %d heads %d sectors per track", ctx->geometry_block.cylinders,
+ +
290
+ +
292 ctx->heads = ctx->geometry_block.heads;
+ +
294
+
295 TRACE("Exiting process_geometry_block()");
+
296}
+
+
297
+
+ +
307{
+
308 TRACE("Entering process_cicm_block(%p, %p)", ctx, entry);
+
309 int pos = 0;
+
310 size_t read_bytes = 0;
+
311
+
312 // Check if the context and image stream are valid
+
313 if(ctx == NULL || ctx->imageStream == NULL)
+
314 {
+
315 FATAL("Invalid context or image stream.");
+
316
+
317 TRACE("Exiting process_cicm_block()");
+
318 return;
+
319 }
+
320
+
321 // Seek to block
+
322 TRACE("Seeking to CICM XML metadata block at position %" PRIu64, entry->offset);
+
323 pos = fseek(ctx->imageStream, entry->offset, SEEK_SET);
+
324 if(pos < 0 || ftell(ctx->imageStream) != entry->offset)
+
325 {
+
326 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
+
327
+
328 TRACE("Exiting process_cicm_block()");
+
329 return;
+
330 }
+
331
+
332 // Even if those two checks shall have been done before
+
333 TRACE("Reading CICM XML metadata block header at position %" PRIu64, entry->offset);
+
334 read_bytes = fread(&ctx->cicm_block_header, 1, sizeof(CicmMetadataBlock), ctx->imageStream);
+
335
+
336 if(read_bytes != sizeof(CicmMetadataBlock))
+
337 {
+
338 memset(&ctx->cicm_block_header, 0, sizeof(CicmMetadataBlock));
+
339 TRACE("Could not read CICM XML metadata header, continuing...");
+
340 return;
+
341 }
+
342
+ +
344 {
+
345 memset(&ctx->cicm_block_header, 0, sizeof(CicmMetadataBlock));
+
346 TRACE("Incorrect identifier for data block at position %" PRIu64 "", entry->offset);
+
347 }
+
348
+ +
350
+
351 ctx->cicm_block = (uint8_t *)malloc(ctx->cicm_block_header.length);
+
352
+
353 if(ctx->cicm_block == NULL)
+
354 {
+
355 memset(&ctx->cicm_block_header, 0, sizeof(CicmMetadataBlock));
+
356 TRACE("Could not allocate memory for CICM XML metadata block, continuing...");
+
357
+
358 TRACE("Exiting process_cicm_block()");
+
359 return;
+
360 }
+
361
+
362 TRACE("Reading CICM XML metadata block of size %u at position %" PRIu64, ctx->cicm_block_header.length,
+
363 entry->offset + sizeof(CicmMetadataBlock));
+
364 read_bytes = fread(ctx->cicm_block, 1, ctx->cicm_block_header.length, ctx->imageStream);
+
365
+
366 if(read_bytes != ctx->cicm_block_header.length)
+
367 {
+
368 memset(&ctx->cicm_block_header, 0, sizeof(CicmMetadataBlock));
+
369 free(ctx->cicm_block);
+
370 TRACE("Could not read CICM XML metadata block, continuing...");
+
371 }
+
372
+
373 TRACE("Found CICM XML metadata block %" PRIu64 ".", entry->offset);
+
374
+
375 TRACE("Exiting process_cicm_block()");
+
376}
+
+
377
+
+ +
471{
+
472 TRACE("Entering process_aaru_metadata_json_block(%p, %p)", ctx, entry);
+
473 int pos = 0;
+
474 size_t read_bytes = 0;
+
475
+
476 // Check if the context and image stream are valid
+
477 if(ctx == NULL || ctx->imageStream == NULL)
+
478 {
+
479 FATAL("Invalid context or image stream.");
+
480
+
481 TRACE("Exiting process_aaru_metadata_json_block()");
+
482 return;
+
483 }
+
484
+
485 // Seek to block
+
486 TRACE("Seeking to Aaru metadata JSON block at position %" PRIu64, entry->offset);
+
487 pos = fseek(ctx->imageStream, entry->offset, SEEK_SET);
+
488 if(pos < 0 || ftell(ctx->imageStream) != entry->offset)
+
489 {
+
490 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
+
491
+
492 TRACE("Exiting process_aaru_metadata_json_block()");
+
493 return;
+
494 }
+
495
+
496 // Even if those two checks shall have been done before
+
497 TRACE("Reading Aaru metadata JSON block header at position %" PRIu64, entry->offset);
+
498 read_bytes = fread(&ctx->json_block_header, 1, sizeof(AaruMetadataJsonBlockHeader), ctx->imageStream);
+
499
+
500 if(read_bytes != sizeof(AaruMetadataJsonBlockHeader))
+
501 {
+
502 memset(&ctx->json_block_header, 0, sizeof(AaruMetadataJsonBlockHeader));
+
503 TRACE("Could not read Aaru metadata JSON header, continuing...");
+
504 return;
+
505 }
+
506
+ +
508 {
+
509 memset(&ctx->json_block_header, 0, sizeof(AaruMetadataJsonBlockHeader));
+
510 TRACE("Incorrect identifier for data block at position %" PRIu64 "", entry->offset);
+
511 }
+
512
+ +
514
+
515 ctx->json_block = (uint8_t *)malloc(ctx->json_block_header.length);
+
516
+
517 if(ctx->json_block == NULL)
+
518 {
+
519 memset(&ctx->json_block_header, 0, sizeof(AaruMetadataJsonBlockHeader));
+
520 TRACE("Could not allocate memory for Aaru metadata JSON block, continuing...");
+
521
+
522 TRACE("Exiting process_aaru_metadata_json_block()");
+
523 return;
+
524 }
+
525
+
526 TRACE("Reading Aaru metadata JSON block of size %u at position %" PRIu64, ctx->json_block_header.length,
+
527 entry->offset + sizeof(AaruMetadataJsonBlockHeader));
+
528 read_bytes = fread(ctx->json_block, 1, ctx->json_block_header.length, ctx->imageStream);
+
529
+
530 if(read_bytes != ctx->json_block_header.length)
+
531 {
+
532 memset(&ctx->json_block_header, 0, sizeof(AaruMetadataJsonBlockHeader));
+
533 free(ctx->json_block);
+
534 TRACE("Could not read Aaru metadata JSON block, continuing...");
+
535 }
+
536
+
537 TRACE("Found Aaru metadata JSON block %" PRIu64 ".", entry->offset);
+
538
+
539 TRACE("Exiting process_aaru_metadata_json_block()");
+
540}
+
+ +
void process_metadata_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a metadata block from the image stream.
Definition metadata.c:35
+
void process_cicm_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a CICM XML metadata block from the image stream.
Definition metadata.c:306
+
void process_geometry_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a logical geometry block from the image stream.
Definition metadata.c:246
+
void process_aaru_metadata_json_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes an Aaru metadata JSON block from the image stream during image opening.
Definition metadata.c:470
+
@ GeometryBlock
Block containing logical geometry.
Definition enums.h:148
+
@ AaruMetadataJsonBlock
Block containing JSON version of Aaru Metadata.
Definition enums.h:159
+
@ CicmBlock
Block containing CICM XML metadata.
Definition enums.h:151
+ +
#define FATAL(fmt,...)
Definition log.h:40
+
#define TRACE(fmt,...)
Definition log.h:25
+
Header for an Aaru metadata JSON block (identifier == BlockType::AaruMetadataJsonBlock).
Definition metadata.h:120
+
uint32_t identifier
Block identifier, must be BlockType::AaruMetadataJsonBlock.
Definition metadata.h:121
+
uint32_t length
Length in bytes of the Aaru metadata JSON payload that follows.
Definition metadata.h:122
+
Header for a CICM XML metadata block (identifier == BlockType::CicmBlock).
Definition metadata.h:108
+
uint32_t length
Length in bytes of the CICM metadata payload that follows.
Definition metadata.h:110
+
uint32_t identifier
Block identifier, must be BlockType::CicmBlock.
Definition metadata.h:109
+
Legacy CHS style logical geometry metadata (BlockType::GeometryBlock).
Definition data.h:91
+
uint32_t identifier
Block identifier, must be BlockType::GeometryBlock.
Definition data.h:92
+
uint32_t cylinders
Number of cylinders.
Definition data.h:93
+
uint32_t heads
Number of heads (tracks per cylinder).
Definition data.h:94
+
uint32_t sectorsPerTrack
Number of sectors per track.
Definition data.h:95
+
uint64_t ImageSize
Size of the image payload in bytes (excludes headers/metadata)
Definition aaru.h:873
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
uint32_t blockType
Block identifier of the referenced block (value from BlockType).
Definition index.h:110
+
uint64_t offset
Absolute byte offset in the image where the referenced block header begins.
Definition index.h:112
+
Header for a metadata block containing offsets and lengths to UTF-16LE descriptive strings.
Definition metadata.h:69
+
uint32_t commentsLength
Length in bytes (including null) of comments string.
Definition metadata.h:78
+
int32_t mediaSequence
Sequence number within a multi-disc / multi-volume set (0-based or 1-based as producer defines).
Definition metadata.h:72
+
uint32_t identifier
Block identifier, must be BlockType::MetadataBlock.
Definition metadata.h:70
+
uint32_t mediaTitleOffset
Offset to UTF-16LE media title string.
Definition metadata.h:79
+
uint32_t driveModelLength
Length in bytes (including null) of drive model string.
Definition metadata.h:94
+
uint32_t driveManufacturerLength
Length in bytes (including null) of drive manufacturer string.
Definition metadata.h:92
+
uint32_t blockSize
Total size in bytes of the entire metadata block (header + strings).
Definition metadata.h:71
+
uint32_t driveModelOffset
Offset to UTF-16LE drive model string.
Definition metadata.h:93
+
uint32_t mediaModelOffset
Offset to UTF-16LE media model string.
Definition metadata.h:83
+
uint32_t creatorOffset
Offset to UTF-16LE creator string (or undefined if creatorLength==0).
Definition metadata.h:75
+
uint32_t mediaTitleLength
Length in bytes (including null) of media title string.
Definition metadata.h:80
+
uint32_t mediaManufacturerOffset
Offset to UTF-16LE media manufacturer string.
Definition metadata.h:81
+
uint32_t driveSerialNumberLength
Length in bytes (including null) of drive serial number string.
Definition metadata.h:96
+
uint32_t driveSerialNumberOffset
Offset to UTF-16LE drive serial number string.
Definition metadata.h:95
+
uint32_t mediaManufacturerLength
Length in bytes (including null) of media manufacturer string.
Definition metadata.h:82
+
uint32_t mediaModelLength
Length in bytes (including null) of media model string.
Definition metadata.h:84
+
uint32_t driveFirmwareRevisionOffset
Offset to UTF-16LE drive firmware revision string.
Definition metadata.h:97
+
int32_t lastMediaSequence
Total number of media in the set; 0 or 1 if single item.
Definition metadata.h:74
+
uint32_t commentsOffset
Offset to UTF-16LE comments string.
Definition metadata.h:77
+
uint32_t driveManufacturerOffset
Offset to UTF-16LE drive manufacturer string.
Definition metadata.h:91
+
uint32_t mediaSerialNumberOffset
Offset to UTF-16LE media serial number string.
Definition metadata.h:85
+
uint32_t mediaSerialNumberLength
Length in bytes (including null) of media serial number string.
Definition metadata.h:86
+
uint32_t mediaPartNumberOffset
Offset to UTF-16LE media part number string.
Definition metadata.h:89
+
uint32_t mediaPartNumberLength
Length in bytes (including null) of media part number string.
Definition metadata.h:90
+
uint32_t mediaBarcodeLength
Length in bytes (including null) of media barcode string.
Definition metadata.h:88
+
uint32_t creatorLength
Length in bytes (including null) of creator string (0 if absent).
Definition metadata.h:76
+
uint32_t driveFirmwareRevisionLength
Length in bytes (including null) of drive firmware revision string.
Definition metadata.h:98
+
uint32_t mediaBarcodeOffset
Offset to UTF-16LE media barcode string.
Definition metadata.h:87
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
uint8_t * media_barcode
Barcode of the media represented by the image.
Definition context.h:222
+
uint8_t * creator
Who (person) created the image?
Definition context.h:216
+
uint8_t * cicm_block
CICM XML payload.
Definition context.h:214
+
uint32_t cylinders
Cylinders of the media represented by the image.
Definition context.h:234
+
uint8_t * drive_firmware_revision
Firmware revision of the drive used to read the media represented by the image.
Definition context.h:228
+
uint8_t * media_serial_number
Serial number of the media represented by the image.
Definition context.h:221
+
MetadataBlockHeader metadata_block_header
Metadata block header.
Definition context.h:230
+
int32_t media_sequence
Number in sequence for the media represented by the image.
Definition context.h:238
+
uint8_t * media_model
Model of the media represented by the image.
Definition context.h:220
+
uint8_t * drive_serial_number
Serial number of the drive used to read the media represented by the image.
Definition context.h:226
+
uint8_t * drive_manufacturer
Manufacturer of the drive used to read the media represented by the image.
Definition context.h:224
+
CicmMetadataBlock cicm_block_header
CICM metadata header (if present).
Definition context.h:231
+
uint8_t * drive_model
Model of the drive used to read the media represented by the image.
Definition context.h:225
+
GeometryBlockHeader geometry_block
Logical geometry block (if present).
Definition context.h:229
+
uint8_t * json_block
JSON metadata block payload (UTF-8).
Definition context.h:215
+
uint8_t * media_part_number
Part number of the media represented by the image.
Definition context.h:223
+
AaruMetadataJsonBlockHeader json_block_header
JSON metadata block header (if present).
Definition context.h:233
+
uint32_t sectors_per_track
Sectors per track of the media represented by the image (for variable image, the smallest)
Definition context.h:236
+
uint8_t * comments
Image comments.
Definition context.h:218
+
uint32_t heads
Heads of the media represented by the image.
Definition context.h:235
+
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
+
ImageInfo image_info
Exposed high-level image info summary.
Definition context.h:260
+
uint8_t * metadata_block
Raw metadata UTF-16LE concatenated strings.
Definition context.h:213
+
uint8_t * media_title
Title of the media represented by the image.
Definition context.h:217
+
int32_t last_media_sequence
Last media of the sequence the media represented by the image corresponds to.
Definition context.h:239
+
uint8_t * media_manufacturer
Manufacturer of the media represented by the image.
Definition context.h:219
+
+
+
+ + + + diff --git a/docs/html/checksum_8c.html b/docs/html/checksum_8c.html new file mode 100644 index 0000000..6b2be73 --- /dev/null +++ b/docs/html/checksum_8c.html @@ -0,0 +1,169 @@ + + + + + + + +libaaruformat: src/blocks/checksum.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
checksum.c File Reference
+
+
+
#include <inttypes.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "aaruformat/context.h"
+#include "aaruformat/enums.h"
+#include "aaruformat/structs/checksum.h"
+#include "aaruformat/structs/index.h"
+#include "log.h"
+
+

Go to the source code of this file.

+ + + + +

+Functions

void process_checksum_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes a checksum block from the image stream.
+

Function Documentation

+ +

◆ process_checksum_block()

+ +
+
+ + + + + + + + + + + +
void process_checksum_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes a checksum block from the image stream.

+

Reads a checksum block, parses its entries, and stores the checksums (MD5, SHA1, SHA256, SpamSum) in the context.

+
Parameters
+ + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the checksum block.
+
+
+ +

Definition at line 39 of file checksum.c.

+ +

References ChecksumBlock, aaruformat_context::checksums, ChecksumHeader::entries, FATAL, Checksums::hasMd5, Checksums::hasSha1, Checksums::hasSha256, Checksums::hasSpamSum, ChecksumHeader::identifier, aaruformat_context::imageStream, ChecksumEntry::length, ChecksumHeader::length, Md5, Checksums::md5, MD5_DIGEST_LENGTH, IndexEntry::offset, Sha1, Checksums::sha1, SHA1_DIGEST_LENGTH, Sha256, Checksums::sha256, SHA256_DIGEST_LENGTH, SpamSum, Checksums::spamsum, TRACE, and ChecksumEntry::type.

+ +

Referenced by aaruf_open().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/checksum_8c.js b/docs/html/checksum_8c.js new file mode 100644 index 0000000..b94be1a --- /dev/null +++ b/docs/html/checksum_8c.js @@ -0,0 +1,4 @@ +var checksum_8c = +[ + [ "process_checksum_block", "checksum_8c.html#a565eace88f86c500249be1f2a89a1c60", null ] +]; \ No newline at end of file diff --git a/docs/html/checksum_8c_source.html b/docs/html/checksum_8c_source.html new file mode 100644 index 0000000..6cbc02b --- /dev/null +++ b/docs/html/checksum_8c_source.html @@ -0,0 +1,325 @@ + + + + + + + +libaaruformat: src/blocks/checksum.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
checksum.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <inttypes.h>
+
20#include <stdint.h>
+
21#include <stdio.h>
+
22#include <stdlib.h>
+
23#include <string.h>
+
24
+
25#include "aaruformat/context.h"
+
26#include "aaruformat/enums.h"
+ + +
29#include "log.h"
+
30
+
+ +
40{
+
41 TRACE("Entering process_checksum_block(%p, %p)", ctx, entry);
+
42
+
43 int seek_result = 0;
+
44 size_t read_bytes = 0;
+
45 ChecksumHeader checksum_header;
+
46 ChecksumEntry const *checksum_entry = NULL;
+
47 uint8_t *data = NULL;
+
48 int j = 0;
+
49 size_t payload_pos = 0;
+
50
+
51 // Check if the context and image stream are valid
+
52 if(ctx == NULL || ctx->imageStream == NULL)
+
53 {
+
54 FATAL("Invalid context or image stream.");
+
55 return;
+
56 }
+
57
+
58 // Seek to block
+
59 seek_result = fseek(ctx->imageStream, entry->offset, SEEK_SET);
+
60 if(seek_result < 0 || ftell(ctx->imageStream) != entry->offset)
+
61 {
+
62 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
+
63
+
64 return;
+
65 }
+
66
+
67 // Even if those two checks shall have been done before
+
68 TRACE("Reading checksum block header at position %" PRIu64, entry->offset);
+
69 read_bytes = fread(&checksum_header, 1, sizeof(ChecksumHeader), ctx->imageStream);
+
70
+
71 if(read_bytes != sizeof(ChecksumHeader))
+
72 {
+
73 memset(&checksum_header, 0, sizeof(ChecksumHeader));
+
74 FATAL("Could not read checksums block header, continuing...\n");
+
75 return;
+
76 }
+
77
+
78 if(checksum_header.identifier != ChecksumBlock)
+
79 {
+
80 memset(&checksum_header, 0, sizeof(ChecksumHeader));
+
81 FATAL("Incorrect identifier for checksum block at position %" PRIu64 "\n", entry->offset);
+
82 return;
+
83 }
+
84
+
85 TRACE("Allocating %u bytes for checksum block", checksum_header.length);
+
86 data = (uint8_t *)malloc(checksum_header.length);
+
87
+
88 if(data == NULL)
+
89 {
+
90 memset(&checksum_header, 0, sizeof(ChecksumHeader));
+
91 FATAL("Could not allocate memory for checksum block, continuing...\n");
+
92 return;
+
93 }
+
94
+
95 TRACE("Reading checksum block data at position %" PRIu64, entry->offset + sizeof(ChecksumHeader));
+
96 read_bytes = fread(data, 1, checksum_header.length, ctx->imageStream);
+
97
+
98 if(read_bytes != checksum_header.length)
+
99 {
+
100 memset(&checksum_header, 0, sizeof(ChecksumHeader));
+
101 free(data);
+
102 FATAL("Could not read checksums block, continuing...\n");
+
103 return;
+
104 }
+
105
+
106 payload_pos = 0;
+
107 TRACE("Processing %u checksum entries", checksum_header.entries);
+
108 for(j = 0; j < checksum_header.entries; j++)
+
109 {
+
110 if(payload_pos + sizeof(ChecksumEntry) > checksum_header.length)
+
111 {
+
112 FATAL("Checksum entry %d exceeds block payload size", j);
+
113 break;
+
114 }
+
115
+
116 checksum_entry = (const ChecksumEntry *)&data[payload_pos];
+
117 payload_pos += sizeof(ChecksumEntry);
+
118
+
119 if(payload_pos + checksum_entry->length > checksum_header.length)
+
120 {
+
121 FATAL("Checksum payload for entry %d exceeds block payload size", j);
+
122 break;
+
123 }
+
124
+
125 switch(checksum_entry->type)
+
126 {
+
127 case Md5:
+
128 if(checksum_entry->length != MD5_DIGEST_LENGTH)
+
129 {
+
130 FATAL("MD5 checksum entry has invalid length %u", checksum_entry->length);
+
131 break;
+
132 }
+
133
+
134 TRACE("Found MD5 checksum");
+
135 memcpy(ctx->checksums.md5, &data[payload_pos], MD5_DIGEST_LENGTH);
+
136 ctx->checksums.hasMd5 = true;
+
137 break;
+
138 case Sha1:
+
139 if(checksum_entry->length != SHA1_DIGEST_LENGTH)
+
140 {
+
141 FATAL("SHA1 checksum entry has invalid length %u", checksum_entry->length);
+
142 break;
+
143 }
+
144
+
145 TRACE("Found SHA1 checksum");
+
146 memcpy(ctx->checksums.sha1, &data[payload_pos], SHA1_DIGEST_LENGTH);
+
147 ctx->checksums.hasSha1 = true;
+
148 break;
+
149 case Sha256:
+
150 if(checksum_entry->length != SHA256_DIGEST_LENGTH)
+
151 {
+
152 FATAL("SHA256 checksum entry has invalid length %u", checksum_entry->length);
+
153 break;
+
154 }
+
155
+
156 TRACE("Found SHA256 checksum");
+
157 memcpy(ctx->checksums.sha256, &data[payload_pos], SHA256_DIGEST_LENGTH);
+
158 ctx->checksums.hasSha256 = true;
+
159 break;
+
160 case SpamSum:
+
161 TRACE("Found SpamSum checksum of size %u", checksum_entry->length);
+
162 free(ctx->checksums.spamsum);
+
163 ctx->checksums.spamsum = NULL;
+
164
+
165 ctx->checksums.spamsum = malloc(checksum_entry->length + 1);
+
166
+
167 if(ctx->checksums.spamsum == NULL)
+
168 {
+
169 FATAL("Could not allocate memory for SpamSum digest");
+
170 break;
+
171 }
+
172
+
173 memcpy(ctx->checksums.spamsum, &data[payload_pos], checksum_entry->length);
+
174 ctx->checksums.spamsum[checksum_entry->length] = '\0';
+
175 ctx->checksums.hasSpamSum = true;
+
176 break;
+
177 default:
+
178 TRACE("Unknown checksum type %u, skipping", checksum_entry->type);
+
179 break;
+
180 }
+
181
+
182 payload_pos += checksum_entry->length;
+
183 }
+
184
+
185 checksum_entry = NULL;
+
186 free(data);
+
187
+
188 TRACE("Exiting process_checksum_block()");
+
189}
+
+
void process_checksum_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a checksum block from the image stream.
Definition checksum.c:39
+
On-disk layout definitions for the checksum block (BlockType::ChecksumBlock).
+
Central runtime context structures for libaaruformat (image state, caches, checksum buffers).
+
#define MD5_DIGEST_LENGTH
Definition context.h:69
+ +
@ ChecksumBlock
Block containing contents checksums.
Definition enums.h:152
+
@ Sha1
SHA-1 hash.
Definition enums.h:170
+
@ Md5
MD5 hash.
Definition enums.h:169
+
@ Sha256
SHA-256 hash.
Definition enums.h:171
+
@ SpamSum
SpamSum (context-triggered piecewise hash).
Definition enums.h:172
+
On‑disk index block header and entry structures (versions 1, 2 and 3).
+ +
#define FATAL(fmt,...)
Definition log.h:40
+
#define TRACE(fmt,...)
Definition log.h:25
+
#define SHA1_DIGEST_LENGTH
Definition sha1.h:39
+
#define SHA256_DIGEST_LENGTH
Definition sha256.h:38
+
Per-checksum metadata immediately followed by the digest / signature bytes.
Definition checksum.h:91
+
uint32_t length
Length in bytes of the digest that immediately follows this structure.
Definition checksum.h:93
+
uint8_t type
Algorithm used (value from ChecksumAlgorithm).
Definition checksum.h:92
+
Header that precedes the sequence of checksum entries for a checksum block.
Definition checksum.h:74
+
uint32_t identifier
Block identifier, must be BlockType::ChecksumBlock.
Definition checksum.h:75
+
uint32_t length
Length in bytes of the payload (all entries + their digest data, excluding this header).
Definition checksum.h:76
+
uint8_t entries
Number of checksum entries that follow in the payload.
Definition checksum.h:77
+
uint8_t * spamsum
SpamSum fuzzy hash (ASCII), allocated length+1 with trailing 0.
Definition context.h:110
+
bool hasSha256
True if sha256[] buffer populated.
Definition context.h:103
+
uint8_t sha1[20]
SHA-1 digest (20 bytes).
Definition context.h:107
+
uint8_t sha256[32]
SHA-256 digest (32 bytes).
Definition context.h:108
+
uint8_t md5[16]
MD5 digest (16 bytes).
Definition context.h:106
+
bool hasSpamSum
True if spamsum pointer allocated and signature read.
Definition context.h:105
+
bool hasSha1
True if sha1[] buffer populated.
Definition context.h:102
+
bool hasMd5
True if md5[] buffer populated.
Definition context.h:101
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
uint64_t offset
Absolute byte offset in the image where the referenced block header begins.
Definition index.h:112
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
Checksums checksums
Whole-image checksums discovered.
Definition context.h:269
+
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
+
+
+
+ + + + diff --git a/docs/html/checksum_8h.html b/docs/html/checksum_8h.html new file mode 100644 index 0000000..960dafa --- /dev/null +++ b/docs/html/checksum_8h.html @@ -0,0 +1,179 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/checksum.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
checksum.h File Reference
+
+
+ +

On-disk layout definitions for the checksum block (BlockType::ChecksumBlock). +More...

+
#include <stdint.h>
+
+

Go to the source code of this file.

+ + + + + + +

+Data Structures

struct  ChecksumHeader
 Header that precedes the sequence of checksum entries for a checksum block. More...
struct  ChecksumEntry
 Per-checksum metadata immediately followed by the digest / signature bytes. More...
+ + + +

+Typedefs

typedef struct ChecksumHeader ChecksumHeader
typedef struct ChecksumEntry ChecksumEntry
+

Detailed Description

+

On-disk layout definitions for the checksum block (BlockType::ChecksumBlock).

+

A checksum block stores one or more whole-image (user data) checksums. For optical media the user data definition follows the format's raw sector rules (e.g. 2352-byte raw sector when available).

+

Binary layout (all integers are little-endian, structure is packed):

+

+---------------------------—+----------------------------—+ | Field | Size (bytes) | +==============================+===============================+ | ChecksumHeader | sizeof(ChecksumHeader)=9 | | identifier | 4 (BlockType::ChecksumBlock) | | length | 4 (payload bytes that follow)| | entries | 1 (number of checksum entries)| +---------------------------—+----------------------------—+ | Repeated for each entry: | | ChecksumEntry | sizeof(ChecksumEntry)=5 | | type | 1 (ChecksumAlgorithm) | | length | 4 (digest length) | | digest bytes | length | +---------------------------—+----------------------------—+

+

Thus, the payload size (ChecksumHeader.length) MUST equal the sum over all entries of: sizeof(ChecksumEntry) + entry.length.

+

Typical digest lengths:

    +
  • Md5: 16 bytes
  • +
  • Sha1: 20 bytes
  • +
  • Sha256: 32 bytes
  • +
  • SpamSum: variable length ASCII, NOT null-terminated on disk (a terminating '\0' may be appended in memory).
  • +
+
Warning
The structures are packed; never rely on host compiler default padding or directly casting from a buffer without ensuring correct endianness if porting to big-endian systems (current implementation assumes LE).
+
See also
BlockType
+
+ChecksumAlgorithm
+ +

Definition in file checksum.h.

+

Typedef Documentation

+ +

◆ ChecksumEntry

+ +
+
+ + + + +
typedef struct ChecksumEntry ChecksumEntry
+
+ +
+
+ +

◆ ChecksumHeader

+ +
+
+ + + + +
typedef struct ChecksumHeader ChecksumHeader
+
+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/checksum_8h.js b/docs/html/checksum_8h.js new file mode 100644 index 0000000..be5b1e0 --- /dev/null +++ b/docs/html/checksum_8h.js @@ -0,0 +1,7 @@ +var checksum_8h = +[ + [ "ChecksumHeader", "structChecksumHeader.html", "structChecksumHeader" ], + [ "ChecksumEntry", "structChecksumEntry.html", "structChecksumEntry" ], + [ "ChecksumEntry", "checksum_8h.html#aeba107584fd6e2db8dcc1d790c24734f", null ], + [ "ChecksumHeader", "checksum_8h.html#a64152a064d0f42344886c7c5576ede2c", null ] +]; \ No newline at end of file diff --git a/docs/html/checksum_8h_source.html b/docs/html/checksum_8h_source.html new file mode 100644 index 0000000..328fb7c --- /dev/null +++ b/docs/html/checksum_8h_source.html @@ -0,0 +1,159 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/checksum.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
checksum.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_CHECKSUM_H
+
20#define LIBAARUFORMAT_CHECKSUM_H
+
21
+
22#include <stdint.h> // Fixed-width integer types for on-disk structures.
+
23
+
24#pragma pack(push, 1)
+
25
+
65
+
+
73typedef struct ChecksumHeader
+
74{
+
75 uint32_t identifier;
+
76 uint32_t length;
+
77 uint8_t entries;
+ +
+
79
+
+
90typedef struct ChecksumEntry
+
91{
+
92 uint8_t type;
+
93 uint32_t length;
+ +
+
95
+
96#pragma pack(pop)
+
97
+
98#endif // LIBAARUFORMAT_CHECKSUM_H
+
Per-checksum metadata immediately followed by the digest / signature bytes.
Definition checksum.h:91
+
uint32_t length
Length in bytes of the digest that immediately follows this structure.
Definition checksum.h:93
+
uint8_t type
Algorithm used (value from ChecksumAlgorithm).
Definition checksum.h:92
+
Header that precedes the sequence of checksum entries for a checksum block.
Definition checksum.h:74
+
uint32_t identifier
Block identifier, must be BlockType::ChecksumBlock.
Definition checksum.h:75
+
uint32_t length
Length in bytes of the payload (all entries + their digest data, excluding this header).
Definition checksum.h:76
+
uint8_t entries
Number of checksum entries that follow in the payload.
Definition checksum.h:77
+
+
+
+ + + + diff --git a/docs/html/classes.html b/docs/html/classes.html new file mode 100644 index 0000000..c871b27 --- /dev/null +++ b/docs/html/classes.html @@ -0,0 +1,147 @@ + + + + + + + +libaaruformat: Data Structure Index + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+ +
+ + + + diff --git a/docs/html/clipboard.js b/docs/html/clipboard.js new file mode 100644 index 0000000..9da9f3c --- /dev/null +++ b/docs/html/clipboard.js @@ -0,0 +1,61 @@ +/** + +The code below is based on the Doxygen Awesome project, see +https://github.com/jothepro/doxygen-awesome-css + +MIT License + +Copyright (c) 2021 - 2022 jothepro + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +*/ + +let clipboard_title = "Copy to clipboard" +let clipboard_icon = `` +let clipboard_successIcon = `` +let clipboard_successDuration = 1000 + +$(function() { + if(navigator.clipboard) { + const fragments = document.getElementsByClassName("fragment") + for(const fragment of fragments) { + const clipboard_div = document.createElement("div") + clipboard_div.classList.add("clipboard") + clipboard_div.innerHTML = clipboard_icon + clipboard_div.title = clipboard_title + $(clipboard_div).click(function() { + const content = this.parentNode.cloneNode(true) + // filter out line number and folded fragments from file listings + content.querySelectorAll(".lineno, .ttc, .foldclosed").forEach((node) => { node.remove() }) + let text = content.textContent + // remove trailing newlines and trailing spaces from empty lines + text = text.replace(/^\s*\n/gm,'\n').replace(/\n*$/,'') + navigator.clipboard.writeText(text); + this.classList.add("success") + this.innerHTML = clipboard_successIcon + window.setTimeout(() => { // switch back to normal icon after timeout + this.classList.remove("success") + this.innerHTML = clipboard_icon + }, clipboard_successDuration); + }) + fragment.insertBefore(clipboard_div, fragment.firstChild) + } + } +}) diff --git a/docs/html/close_8c.html b/docs/html/close_8c.html new file mode 100644 index 0000000..e939ca2 --- /dev/null +++ b/docs/html/close_8c.html @@ -0,0 +1,2071 @@ + + + + + + + +libaaruformat: src/close.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
close.c File Reference
+
+
+ +

Implements image finalization and resource cleanup for libaaruformat. +More...

+
#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <aaruformat.h>
+#include "internal.h"
+#include "log.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

static int32_t write_cached_secondary_ddt (aaruformat_context *ctx)
 Flush a cached secondary (child) DeDuplication Table (DDT) to the image.
static int32_t write_primary_ddt (aaruformat_context *ctx)
 Write (flush) the multi-level primary DDT table header and data back to its file offset.
static int32_t write_single_level_ddt (aaruformat_context *ctx)
 Serialize a single-level DDT (tableShift == 0) directly after its header.
static int32_t write_tape_ddt (aaruformat_context *ctx)
 Converts tape DDT hash table to array format and writes it as a single-level DDT.
static void write_checksum_block (aaruformat_context *ctx)
 Finalize any active checksum calculations and append a checksum block.
static void write_tracks_block (aaruformat_context *ctx)
 Serialize the tracks metadata block and add it to the index.
static void write_mode2_subheaders_block (aaruformat_context *ctx)
 Serialize a MODE 2 (XA) subheaders data block.
static void write_sector_prefix (aaruformat_context *ctx)
 Serialize the optional CD sector prefix block.
static void write_sector_suffix (aaruformat_context *ctx)
 Serialize the optional CD sector suffix block (EDC/ECC region capture).
static void write_sector_prefix_ddt (aaruformat_context *ctx)
 Serialize the per-sector CD prefix status / index DeDuplication Table (DDT v2, prefix variant).
static void write_sector_suffix_ddt (aaruformat_context *ctx)
 Serialize the per-sector CD suffix status / index DeDuplication Table (DDT v2, suffix variant).
static void write_sector_subchannel (const aaruformat_context *ctx)
 Serialize the per-sector subchannel or tag data block.
void write_dvd_long_sector_blocks (aaruformat_context *ctx)
 Serialize DVD long sector auxiliary data blocks to the image file.
static void write_dvd_title_key_decrypted_block (const aaruformat_context *ctx)
 Serialize the DVD decrypted title key data block to the image file.
static void write_media_tags (const aaruformat_context *ctx)
 Serialize all accumulated media tags to the image file.
static void write_tape_file_block (const aaruformat_context *ctx)
 Serialize the tape file metadata block to the image file.
static void write_tape_partition_block (const aaruformat_context *ctx)
 Serialize the tape partition metadata block to the image file.
static void write_geometry_block (const aaruformat_context *ctx)
 Serialize the geometry metadata block to the image file.
static void write_metadata_block (aaruformat_context *ctx)
 Serialize the metadata block containing image and media descriptive information.
static void write_dumphw_block (aaruformat_context *ctx)
 Serialize the dump hardware block containing acquisition environment information.
static void write_cicm_block (const aaruformat_context *ctx)
 Serialize the CICM XML metadata block to the image file.
static void write_aaru_json_block (const aaruformat_context *ctx)
 Serialize the Aaru metadata JSON block to the image file.
static int32_t write_index_block (aaruformat_context *ctx)
 Serialize the accumulated index entries at the end of the image and back-patch the header.
int aaruf_close (void *context)
 Close an Aaru image context, flushing pending data structures and releasing resources.
+

Detailed Description

+

Implements image finalization and resource cleanup for libaaruformat.

+

This translation unit contains the logic that flushes any remaining in-memory structures (deduplication tables, checksum information, track metadata, MODE 2 subheaders, sector prefix data and the global index) to the on-disk Aaru image when closing a context opened for writing. It also performs orderly teardown of dynamically allocated resources regardless of read or write mode.

+

Helper (static) functions perform discrete serialization steps; the public entry point is aaruf_close(). All write helpers assume that the caller has already validated the context magic and (for write mode) written the initial provisional header at offset 0. Functions return libaaruformat status codes (AARUF_STATUS_OK on success or an AARUF_ERROR_* constant) except for aaruf_close(), which returns 0 on success and -1 on failure while setting errno.

+ +

Definition in file close.c.

+

Function Documentation

+ +

◆ aaruf_close()

+ +
+
+ + + + + + + +
int aaruf_close (void * context)
+
+ +

Close an Aaru image context, flushing pending data structures and releasing resources.

+

Public API entry point used to finalize an image being written or simply dispose of a context opened for reading. For write-mode contexts (ctx->isWriting true) the function performs the following ordered steps:

    +
  1. Rewrite the (possibly updated) main header at offset 0.
  2. +
  3. Close any open data block via aaruf_close_current_block().
  4. +
  5. Flush a cached secondary DDT (multi-level) if pending.
  6. +
  7. Flush either the primary DDT (multi-level) or the single-level DDT table.
  8. +
  9. Finalize and append checksum block(s) for all enabled algorithms.
  10. +
  11. Write auxiliary metadata blocks: tracks, MODE 2 subheaders, sector prefix.
  12. +
  13. Serialize the global index and patch header.indexOffset.
  14. +
  15. Clear deduplication hash map if used.
  16. +
+

Afterwards (or for read-mode contexts) all dynamically allocated buffers, arrays, hash tables and mapping structures are freed/unmapped. Media tags are removed from their hash table.

+

Error Handling:

    +
  • Returns -1 with errno = EINVAL if the provided pointer is NULL or not a valid context.
  • +
  • Returns -1 with errno set to AARUF_ERROR_CANNOT_WRITE_HEADER if a header write fails.
  • +
  • If any intermediate serialization helper returns an error status, that error value is propagated (converted to -1 with errno set accordingly by the caller if desired). In the current implementation aaruf_close() directly returns the negative error code for helper failures to preserve detail.
  • +
+
Parameters
+ + +
contextOpaque pointer returned by earlier open/create calls (must be an aaruformatContext).
+
+
+
Returns
0 on success; -1 or negative libaaruformat error code on failure.
+
Return values
+ + + + + +
0All pending data flushed (if writing) and resources released successfully.
-1Invalid context pointer or initial header rewrite failure (errno = EINVAL or AARUF_ERROR_CANNOT_WRITE_HEADER).
AARUF_ERROR_CANNOT_WRITE_HEADERA later write helper (e.g., index, DDT) failed and returned this code directly.
<othernegative libaaruformat code> Propagated from a write helper if future helpers add more error codes.
+
+
+
Note
On success the context memory itself is freed; the caller must not reuse the pointer.
+ +

Definition at line 3995 of file close.c.

+ +

References AARU_MAGIC, aaruf_close_current_block(), AARUF_ERROR_CANNOT_WRITE_HEADER, AARUF_STATUS_OK, aaruformat_context::checksums, aaruformat_context::cicm_block, mediaTagEntry::data, aaruformat_context::deduplicate, aaruformat_context::dump_hardware_entries_with_data, aaruformat_context::dump_hardware_header, aaruformat_context::ecc_cd_context, DumpHardwareHeader::entries, DumpHardwareEntriesWithData::extents, FATAL, DumpHardwareEntriesWithData::firmware, free_map(), aaruformat_context::header, aaruformat_context::imageStream, aaruformat_context::in_memory_ddt, aaruformat_context::index_entries, aaruformat_context::is_tape, aaruformat_context::is_writing, aaruformat_context::magic, DumpHardwareEntriesWithData::manufacturer, aaruformat_context::mapped_memory_ddt_size, aaruformat_context::mediaTags, aaruformat_context::metadata_block, aaruformat_context::mode2_subheaders, DumpHardwareEntriesWithData::model, aaruformat_context::readableSectorTags, DumpHardwareEntriesWithData::revision, aaruformat_context::sector_cpr_mai, aaruformat_context::sector_edc, aaruformat_context::sector_hash_map, aaruformat_context::sector_id, aaruformat_context::sector_ied, aaruformat_context::sector_prefix, aaruformat_context::sector_prefix_corrected, aaruformat_context::sector_prefix_ddt, aaruformat_context::sector_prefix_ddt2, aaruformat_context::sector_subchannel, aaruformat_context::sector_suffix, aaruformat_context::sector_suffix_corrected, aaruformat_context::sector_suffix_ddt, aaruformat_context::sector_suffix_ddt2, DumpHardwareEntriesWithData::serial, DumpHardwareEntriesWithData::softwareName, DumpHardwareEntriesWithData::softwareOperatingSystem, DumpHardwareEntriesWithData::softwareVersion, Checksums::spamsum, TRACE, aaruformat_context::track_entries, aaruformat_context::user_data_ddt, write_aaru_json_block(), write_cached_secondary_ddt(), write_checksum_block(), write_cicm_block(), write_dumphw_block(), write_dvd_long_sector_blocks(), write_dvd_title_key_decrypted_block(), write_geometry_block(), write_index_block(), write_media_tags(), write_metadata_block(), write_mode2_subheaders_block(), write_primary_ddt(), write_sector_prefix(), write_sector_prefix_ddt(), write_sector_subchannel(), write_sector_suffix(), write_sector_suffix_ddt(), write_single_level_ddt(), write_tape_ddt(), write_tape_file_block(), write_tape_partition_block(), write_tracks_block(), and aaruformat_context::writing_buffer.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ write_aaru_json_block()

+ +
+
+ + + + + +
+ + + + + + + +
void write_aaru_json_block (const aaruformat_context * ctx)
+
+static
+
+ +

Serialize the Aaru metadata JSON block to the image file.

+

This function writes an AaruMetadataJsonBlock containing embedded Aaru metadata JSON to the Aaru image file. The Aaru metadata JSON format is a structured, machine-readable representation of comprehensive image metadata including media information, imaging session details, hardware configuration, optical disc tracks and sessions, checksums, and preservation metadata. The JSON payload is stored in its original form without parsing, interpretation, or validation by the library, preserving the exact structure and content provided during image creation.

+

The Aaru JSON block is optional; if no Aaru JSON metadata has been populated (jsonBlock is NULL, length is zero, or identifier is not set to AaruMetadataJsonBlock), the function returns immediately without writing anything. This no-op behavior allows the close operation to proceed gracefully whether or not Aaru JSON metadata was included during image creation.

+

Block structure: The serialized block consists of:

    +
  1. AaruMetadataJsonBlockHeader (8 bytes: identifier + length)
  2. +
  3. Variable-length JSON payload: the raw UTF-8 encoded Aaru metadata JSON data
  4. +
+

The header contains:

    +
  • identifier: Always set to AaruMetadataJsonBlock (0x444D534A, "JSMD" in ASCII)
  • +
  • length: Size in bytes of the JSON payload that immediately follows the header
  • +
+

Alignment and file positioning: Before writing the block, the file position is moved to EOF and then aligned forward to the next boundary satisfying (position & alignment_mask) == 0, where alignment_mask is derived from ctx->userDataDdtHeader.blockAlignmentShift. This ensures the Aaru JSON block begins on a properly aligned offset for efficient I/O and compliance with the Aaru format specification.

+

Write sequence: The function performs a two-stage write operation:

    +
  1. Write the AaruMetadataJsonBlockHeader (sizeof(AaruMetadataJsonBlockHeader) bytes)
  2. +
  3. Write the JSON payload (ctx->jsonBlockHeader.length bytes)
  4. +
+

Both writes must succeed for the block to be considered successfully written. If the header write fails, the payload write is skipped. Only if both writes succeed is an index entry added.

+

Index registration: After successfully writing both the header and JSON payload, an IndexEntry is appended to ctx->indexEntries with:

    +
  • blockType = AaruMetadataJsonBlock
  • +
  • dataType = 0 (Aaru JSON blocks have no subtype)
  • +
  • offset = the aligned file position where the AaruMetadataJsonBlockHeader was written
  • +
+

Error handling: Write errors (fwrite returning < 1) are silently ignored; no index entry is added if either write fails. Diagnostic TRACE logs report success or failure. The function does not propagate error codes; higher-level close logic must validate overall integrity if needed.

+

No-op conditions:

    +
  • ctx->jsonBlock is NULL (no JSON data loaded) OR
  • +
  • ctx->jsonBlockHeader.length == 0 (empty metadata) OR
  • +
  • ctx->jsonBlockHeader.identifier != AaruMetadataJsonBlock (block not properly initialized)
  • +
+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode. Must not be NULL. ctx->jsonBlockHeader contains the header with identifier and length fields. ctx->jsonBlock points to the actual UTF-8 encoded JSON data (may be NULL if no Aaru JSON metadata was provided). ctx->imageStream must be open and writable. ctx->indexEntries must be initialized (utarray) to accept new index entries.
+
+
+
Note
JSON Encoding and Format:
    +
  • The JSON payload is stored in UTF-8 encoding
  • +
  • The payload may or may not be null-terminated
  • +
  • The library treats the JSON as opaque binary data
  • +
  • No JSON parsing, interpretation, or validation is performed during write
  • +
  • Schema compliance is the responsibility of the code that set the Aaru JSON metadata
  • +
+
+
+Aaru Metadata JSON Purpose:
    +
  • Provides machine-readable structured metadata using modern JSON format
  • +
  • Includes comprehensive information about media, sessions, tracks, and checksums
  • +
  • Enables programmatic access to metadata without XML parsing overhead
  • +
  • Documents imaging session details, hardware configuration, and preservation data
  • +
  • Used by Aaru and compatible tools for metadata exchange and analysis
  • +
  • Complements or serves as alternative to CICM XML metadata
  • +
+
+
+Memory Management:
    +
  • The function does not allocate or free any memory
  • +
  • ctx->jsonBlock memory is managed by the caller (typically freed during aaruf_close)
  • +
  • The JSON data is written directly from the existing buffer
  • +
+
+
+Unlike data blocks (which may be compressed and include CRC64 checksums), the Aaru JSON block is written without compression or explicit integrity checking. The JSON payload is written verbatim as provided, relying on file-level integrity mechanisms.
+
+Order in Close Sequence:
    +
  • Aaru JSON blocks are typically written after CICM blocks but before the index
  • +
  • The exact position in the file depends on what other blocks precede it
  • +
  • The index entry ensures the Aaru JSON block can be located during subsequent opens
  • +
+
+
+Distinction from CICM XML:
    +
  • Both CICM XML and Aaru JSON blocks can be written to the same image
  • +
  • CICM XML follows the Canary Islands Computer Museum schema (older format)
  • +
  • Aaru JSON follows the Aaru-specific metadata schema (newer format)
  • +
  • They serve similar purposes but with different structures and consumers
  • +
  • Including both provides maximum compatibility across different tools
  • +
+
+
See also
AaruMetadataJsonBlockHeader for the on-disk structure definition.
+
+aaruf_set_aaru_json_metadata() for setting Aaru JSON during image creation.
+
+aaruf_get_aaru_json_metadata() for retrieving Aaru JSON from opened images.
+
+write_cicm_block() for the similar function that writes CICM XML blocks.
+ +

Definition at line 3812 of file close.c.

+ +

References AaruMetadataJsonBlock, DdtHeader2::blockAlignmentShift, IndexEntry::blockType, IndexEntry::dataType, AaruMetadataJsonBlockHeader::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, aaruformat_context::json_block, aaruformat_context::json_block_header, AaruMetadataJsonBlockHeader::length, IndexEntry::offset, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_cached_secondary_ddt()

+ +
+
+ + + + + +
+ + + + + + + +
int32_t write_cached_secondary_ddt (aaruformat_context * ctx)
+
+static
+
+ +

Flush a cached secondary (child) DeDuplication Table (DDT) to the image.

+

When working with a multi-level DDT (i.e. primary table with tableShift > 0), a single secondary table may be cached in memory while sectors belonging to its range are written. This function serializes the currently cached secondary table (if any) at the end of the file, aligning the write position to the DDT block alignment, and updates the corresponding primary table entry to point to the new block-aligned location. The primary table itself is then re-written in-place (only its data array portion) to persist the updated pointer. The index is updated by removing any previous index entry for the same secondary table offset and inserting a new one for the freshly written table.

+

CRC64 is computed for the serialized table contents and stored in crc64; cmpCrc64 stores the checksum of compressed data or equals crc64 if compression is not applied or not effective.

+

On return the cached secondary table buffers and bookkeeping fields (cachedSecondaryDdtSmall, cachedSecondaryDdtBig, cachedDdtOffset) are cleared.

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode.
+
+
+
Returns
AARUF_STATUS_OK on success, or AARUF_ERROR_CANNOT_WRITE_HEADER if the secondary table or updated primary table cannot be flushed.
+
Return values
+ + + +
AARUF_STATUS_OKSuccess or no cached secondary DDT needed flushing.
AARUF_ERROR_CANNOT_WRITE_HEADERFailed writing secondary table or rewriting primary table.
+
+
+
Note
If no cached secondary DDT is pending (detected via tableShift and cache pointers), the function is a no-op returning AARUF_STATUS_OK.
+ +

Definition at line 77 of file close.c.

+ +

References aaruf_crc64_data(), aaruf_crc64_final(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_WRITE_HEADER, AARUF_ERROR_NOT_ENOUGH_MEMORY, aaruf_lzma_encode_buffer(), AARUF_STATUS_OK, DdtHeader2::blockAlignmentShift, DdtHeader2::blocks, IndexEntry::blockType, aaruformat_context::cached_ddt_offset, aaruformat_context::cached_ddt_position, aaruformat_context::cached_secondary_ddt2, DdtHeader2::cmpCrc64, DdtHeader2::cmpLength, DdtHeader2::compression, aaruformat_context::compression_enabled, DdtHeader2::crc64, DdtHeader2::dataShift, IndexEntry::dataType, DeDuplicationTableSecondary, DdtHeader2::entries, DdtHeader2::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, DdtHeader2::length, DdtHeader2::levels, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, DdtHeader2::negative, None, IndexEntry::offset, DdtHeader2::overflow, DdtHeader2::previousLevelOffset, aaruformat_context::primary_ddt_offset, DdtHeader2::start, DdtHeader2::tableLevel, DdtHeader2::tableShift, TRACE, DdtHeader2::type, aaruformat_context::user_data_ddt2, aaruformat_context::user_data_ddt_header, and UserData.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_checksum_block()

+ +
+
+ + + + + +
+ + + + + + + +
void write_checksum_block (aaruformat_context * ctx)
+
+static
+
+ +

Finalize any active checksum calculations and append a checksum block.

+

This routine completes pending hash contexts (MD5, SHA-1, SHA-256, SpamSum, BLAKE3), marks the presence flags in ctx->checksums, and if at least one checksum exists writes a ChecksumBlock at the end of the image (block-aligned). Individual ChecksumEntry records are serialized for each available algorithm and the block is indexed. Feature flags (e.g. AARU_FEATURE_RW_BLAKE3) are updated if required.

+

Memory ownership: for SpamSum a buffer is allocated here if a digest was being computed and is subsequently written without being freed inside this function (it will be freed during close). The BLAKE3 context is freed after finalization.

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode.
+
+
+ +

Definition at line 654 of file close.c.

+ +

References AARU_FEATURE_RW_BLAKE3, aaruf_md5_final(), aaruf_sha1_final(), aaruf_sha256_final(), aaruf_spamsum_final(), aaruf_spamsum_free(), Blake3, Checksums::blake3, aaruformat_context::blake3_context, DdtHeader2::blockAlignmentShift, IndexEntry::blockType, aaruformat_context::calculating_blake3, aaruformat_context::calculating_md5, aaruformat_context::calculating_sha1, aaruformat_context::calculating_sha256, aaruformat_context::calculating_spamsum, ChecksumBlock, aaruformat_context::checksums, IndexEntry::dataType, ChecksumHeader::entries, AaruHeaderV2::featureCompatible, FUZZY_MAX_RESULT, Checksums::hasBlake3, Checksums::hasMd5, Checksums::hasSha1, Checksums::hasSha256, Checksums::hasSpamSum, aaruformat_context::header, ChecksumHeader::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, ChecksumEntry::length, ChecksumHeader::length, Md5, Checksums::md5, aaruformat_context::md5_context, MD5_DIGEST_LENGTH, IndexEntry::offset, Sha1, Checksums::sha1, aaruformat_context::sha1_context, SHA1_DIGEST_LENGTH, Sha256, Checksums::sha256, aaruformat_context::sha256_context, SHA256_DIGEST_LENGTH, SpamSum, Checksums::spamsum, aaruformat_context::spamsum_context, TRACE, ChecksumEntry::type, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_cicm_block()

+ +
+
+ + + + + +
+ + + + + + + +
void write_cicm_block (const aaruformat_context * ctx)
+
+static
+
+ +

Serialize the CICM XML metadata block to the image file.

+

This function writes a CicmBlock containing embedded CICM (Canary Islands Computer Museum) XML metadata to the Aaru image file. The CICM XML format is a standardized metadata schema used for documenting preservation and archival information about media and disk images. The XML payload is stored in its original form without parsing, interpretation, or validation by the library, preserving the exact structure and content provided during image creation.

+

The CICM block is optional; if no CICM metadata has been populated (cicmBlock is NULL, length is zero, or identifier is not set to CicmBlock), the function returns immediately without writing anything. This no-op behavior allows the close operation to proceed gracefully whether or not CICM metadata was included during image creation.

+

Block structure: The serialized block consists of:

    +
  1. CicmMetadataBlock header (8 bytes: identifier + length)
  2. +
  3. Variable-length XML payload: the raw UTF-8 encoded CICM XML data
  4. +
+

The header contains:

    +
  • identifier: Always set to CicmBlock (0x4D434943, "CICM" in ASCII)
  • +
  • length: Size in bytes of the XML payload that immediately follows the header
  • +
+

Alignment and file positioning: Before writing the block, the file position is moved to EOF and then aligned forward to the next boundary satisfying (position & alignment_mask) == 0, where alignment_mask is derived from ctx->userDataDdtHeader.blockAlignmentShift. This ensures the CICM block begins on a properly aligned offset for efficient I/O and compliance with the Aaru format specification.

+

Write sequence: The function performs a two-stage write operation:

    +
  1. Write the CicmMetadataBlock header (sizeof(CicmMetadataBlock) bytes)
  2. +
  3. Write the XML payload (ctx->cicmBlockHeader.length bytes)
  4. +
+

Both writes must succeed for the block to be considered successfully written. If the header write fails, the payload write is skipped. Only if both writes succeed is an index entry added.

+

Index registration: After successfully writing both the header and XML payload, an IndexEntry is appended to ctx->indexEntries with:

    +
  • blockType = CicmBlock
  • +
  • dataType = 0 (CICM blocks have no subtype)
  • +
  • offset = the aligned file position where the CicmMetadataBlock header was written
  • +
+

Error handling: Write errors (fwrite returning < 1) are silently ignored; no index entry is added if either write fails. Diagnostic TRACE logs report success or failure. The function does not propagate error codes; higher-level close logic must validate overall integrity if needed.

+

No-op conditions:

    +
  • ctx->cicmBlock is NULL (no XML data loaded) OR
  • +
  • ctx->cicmBlockHeader.length == 0 (empty metadata) OR
  • +
  • ctx->cicmBlockHeader.identifier != CicmBlock (block not properly initialized)
  • +
+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode. Must not be NULL. ctx->cicmBlockHeader contains the header with identifier and length fields. ctx->cicmBlock points to the actual UTF-8 encoded XML data (may be NULL if no CICM metadata was provided). ctx->imageStream must be open and writable. ctx->indexEntries must be initialized (utarray) to accept new index entries.
+
+
+
Note
XML Encoding and Format:
    +
  • The XML payload is stored in UTF-8 encoding
  • +
  • The payload may or may not be null-terminated
  • +
  • The library treats the XML as opaque binary data
  • +
  • No XML parsing, interpretation, or validation is performed during write
  • +
  • Schema compliance is the responsibility of the code that set the CICM metadata
  • +
+
+
+CICM Metadata Purpose:
    +
  • Developed by the Canary Islands Computer Museum for digital preservation
  • +
  • Documents comprehensive preservation metadata following a standardized schema
  • +
  • Includes checksums for data integrity verification
  • +
  • Records detailed device and media information
  • +
  • Supports archival and long-term preservation requirements
  • +
  • Used by cultural heritage institutions and archives
  • +
+
+
+Memory Management:
    +
  • The function does not allocate or free any memory
  • +
  • ctx->cicmBlock memory is managed by the caller (typically freed during aaruf_close)
  • +
  • The XML data is written directly from the existing buffer
  • +
+
+
+Unlike data blocks (which may be compressed and include CRC64 checksums), the CICM block is written without compression or explicit integrity checking. The XML payload is written verbatim as provided, relying on file-level integrity mechanisms.
+
+Order in Close Sequence:
    +
  • CICM blocks are typically written after structural data blocks but before the index
  • +
  • The exact position in the file depends on what other blocks precede it
  • +
  • The index entry ensures the CICM block can be located during subsequent opens
  • +
+
+
See also
CicmMetadataBlock for the on-disk structure definition.
+
+aaruf_get_cicm_metadata() for retrieving CICM XML from opened images.
+ +

Definition at line 3675 of file close.c.

+ +

References DdtHeader2::blockAlignmentShift, IndexEntry::blockType, aaruformat_context::cicm_block, aaruformat_context::cicm_block_header, CicmBlock, IndexEntry::dataType, CicmMetadataBlock::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, CicmMetadataBlock::length, IndexEntry::offset, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_dumphw_block()

+ +
+
+ + + + + +
+ + + + + + + +
void write_dumphw_block (aaruformat_context * ctx)
+
+static
+
+ +

Serialize the dump hardware block containing acquisition environment information.

+

This function writes a DumpHardwareBlock to the image file, documenting the hardware and software environments used to create the image. A dump hardware block records one or more "dump environments" – typically combinations of physical devices (drives, controllers, adapters) and the software stacks that performed the read operations. This metadata is essential for understanding the imaging context, validating acquisition integrity, reproducing imaging conditions, and supporting forensic or archival documentation requirements.

+

Each environment entry includes hardware identification (manufacturer, model, revision, firmware, serial number), software identification (name, version, operating system), and optional extent ranges that specify which logical sectors or units were contributed by that particular environment. This structure supports complex imaging scenarios where multiple devices or software configurations were used to create a composite image.

+

The dump hardware block is optional; if no dump hardware information has been populated (dumpHardwareEntriesWithData is NULL, entries count is zero, or identifier is not set to DumpHardwareBlock), the function returns immediately without writing anything. This no-op behavior allows the close operation to proceed gracefully whether or not dump hardware metadata was included during image creation.

+

Block structure: The serialized block consists of:

    +
  1. DumpHardwareHeader (16 bytes: identifier, entries count, payload length, CRC64)
  2. +
  3. For each dump hardware entry (variable size):
      +
    • DumpHardwareEntry (36 bytes: length fields for all strings and extent count)
    • +
    • Variable-length UTF-8 strings in order: manufacturer, model, revision, firmware, serial, software name, software version, software operating system
    • +
    • Array of DumpExtent structures (16 bytes each) if extent count > 0
    • +
    +
  4. +
+

All strings are UTF-8 encoded and NOT null-terminated in the serialized block. String lengths are measured in bytes, not character counts.

+

Serialization process:

    +
  1. Allocate a temporary buffer sized to hold the complete block (header + all payload data)
  2. +
  3. Iterate through all dump hardware entries in ctx->dumpHardwareEntriesWithData
  4. +
  5. For each entry, copy the DumpHardwareEntry structure followed by each non-NULL string (only if the corresponding length > 0), then copy the extent array (if extents > 0)
  6. +
  7. Calculate CRC64-ECMA over the payload (everything after the header)
  8. +
  9. Copy the DumpHardwareHeader with calculated CRC64 to the beginning of the buffer
  10. +
  11. Align file position to block boundary
  12. +
  13. Write the complete buffer to the image file
  14. +
  15. Add index entry on successful write
  16. +
  17. Free the temporary buffer
  18. +
+

Alignment and file positioning: Before writing the block, the file position is moved to EOF and then aligned forward to the next boundary satisfying (position & alignment_mask) == 0, where alignment_mask is derived from ctx->userDataDdtHeader.blockAlignmentShift. This ensures the dump hardware block begins on a properly aligned offset for efficient I/O and compliance with the Aaru format specification.

+

CRC64 calculation: The function calculates CRC64-ECMA over the payload portion of the buffer (everything after the DumpHardwareHeader) and stores it in the header before writing. This checksum allows verification of dump hardware block integrity when reading the image.

+

Index registration: After successfully writing the complete block, an IndexEntry is appended to ctx->indexEntries with:

    +
  • blockType = DumpHardwareBlock
  • +
  • dataType = 0 (dump hardware blocks have no subtype)
  • +
  • offset = the aligned file position where the block was written
  • +
+

Error handling: Memory allocation failures (calloc returning NULL) cause immediate return without writing. Bounds checking is performed during serialization; if calculated entry sizes exceed the allocated buffer, the buffer is freed and the function returns without writing. Write errors (fwrite returning < 1) are silently ignored; no index entry is added if the write fails. Diagnostic TRACE logs report success or failure. The function does not propagate error codes; higher-level close logic must validate overall integrity if needed.

+

No-op conditions:

    +
  • ctx->dumpHardwareEntriesWithData is NULL (no hardware data loaded) OR
  • +
  • ctx->dumpHardwareHeader.entries == 0 (no entries to write) OR
  • +
  • ctx->dumpHardwareHeader.identifier != DumpHardwareBlock (block not properly initialized)
  • +
+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode. Must not be NULL. ctx->dumpHardwareHeader contains the header with identifier, entry count, and total payload length. ctx->dumpHardwareEntriesWithData contains the array of dump hardware entries with their associated string data and extents (may be NULL if no dump hardware was added). ctx->imageStream must be open and writable. ctx->indexEntries must be initialized (utarray) to accept new index entries.
+
+
+
Note
Dump Hardware Environments:
    +
  • Each entry represents one hardware/software combination used during imaging
  • +
  • Multiple entries support scenarios where different devices contributed different sectors
  • +
  • Extent arrays specify which logical sector ranges each environment contributed
  • +
  • Empty extent arrays (extents == 0) indicate the environment dumped the entire medium
  • +
  • Overlapping extents between entries may indicate verification passes or redundancy
  • +
+
+
+Hardware Identification Fields:
    +
  • manufacturer: Device manufacturer (e.g., "Plextor", "Sony", "Samsung")
  • +
  • model: Device model number (e.g., "PX-716A", "DRU-820A")
  • +
  • revision: Hardware revision identifier
  • +
  • firmware: Firmware version (e.g., "1.11", "KY08")
  • +
  • serial: Device serial number for unique identification
  • +
+
+
+Software Identification Fields:
    +
  • softwareName: Dumping software name (e.g., "Aaru", "ddrescue", "IsoBuster")
  • +
  • softwareVersion: Software version (e.g., "5.3.0", "1.25")
  • +
  • softwareOperatingSystem: Host OS (e.g., "Linux 5.10.0", "Windows 10", "macOS 12.0")
  • +
+
+
+String Encoding:
    +
  • All strings are UTF-8 encoded
  • +
  • Strings are NOT null-terminated in the serialized block
  • +
  • String lengths in DumpHardwareEntry are in bytes, not character counts
  • +
  • The library maintains null-terminated strings in memory for convenience
  • +
  • Only non-null-terminated data is written to the file
  • +
+
+
+Memory Management:
    +
  • The function allocates a temporary buffer to serialize the entire block
  • +
  • The buffer is freed before the function returns, regardless of success or failure
  • +
  • The source data in ctx->dumpHardwareEntriesWithData is not modified
  • +
  • The source data is freed later during context cleanup (aaruf_close)
  • +
+
+
+Use Cases:
    +
  • Forensic documentation requiring complete equipment chain of custody
  • +
  • Archival metadata for long-term preservation requirements
  • +
  • Reproducing imaging conditions for verification or re-imaging
  • +
  • Identifying firmware-specific issues or drive-specific behaviors
  • +
  • Multi-device imaging scenario documentation
  • +
  • Correlating imaging artifacts with specific hardware/software combinations
  • +
+
+
+Order in Close Sequence:
    +
  • Dump hardware blocks are typically written after sector data but before metadata blocks
  • +
  • The exact position in the file depends on what other blocks precede it
  • +
  • The index entry ensures the dump hardware block can be located during subsequent opens
  • +
+
+
Warning
The temporary buffer allocation may fail on systems with limited memory or when the dump hardware block is extremely large (many entries with long strings and extents). Allocation failures result in silent no-op; the image is created without dump hardware.
+
+Bounds checking during serialization protects against buffer overruns. If calculated entry sizes exceed the allocated buffer length (which should never occur if the header's length field is correct), the function aborts without writing. This is a sanity check against data corruption.
+
See also
DumpHardwareHeader for the block header structure definition.
+
+DumpHardwareEntry for the per-environment entry structure definition.
+
+DumpExtent for the extent range structure definition.
+
+aaruf_get_dumphw() for retrieving dump hardware from opened images.
+
+process_dumphw_block() for the loading process during image opening.
+ +

Definition at line 3445 of file close.c.

+ +

References aaruf_crc64_data(), DdtHeader2::blockAlignmentShift, IndexEntry::blockType, DumpHardwareHeader::crc64, IndexEntry::dataType, aaruformat_context::dump_hardware_entries_with_data, aaruformat_context::dump_hardware_header, DumpHardwareBlock, DumpHardwareHeader::entries, DumpHardwareEntriesWithData::entry, DumpHardwareEntriesWithData::extents, DumpHardwareEntry::extents, FATAL, DumpHardwareEntriesWithData::firmware, DumpHardwareEntry::firmwareLength, DumpHardwareHeader::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, DumpHardwareHeader::length, DumpHardwareEntriesWithData::manufacturer, DumpHardwareEntry::manufacturerLength, DumpHardwareEntriesWithData::model, DumpHardwareEntry::modelLength, IndexEntry::offset, DumpHardwareEntriesWithData::revision, DumpHardwareEntry::revisionLength, DumpHardwareEntriesWithData::serial, DumpHardwareEntry::serialLength, DumpHardwareEntriesWithData::softwareName, DumpHardwareEntry::softwareNameLength, DumpHardwareEntriesWithData::softwareOperatingSystem, DumpHardwareEntry::softwareOperatingSystemLength, DumpHardwareEntriesWithData::softwareVersion, DumpHardwareEntry::softwareVersionLength, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_dvd_long_sector_blocks()

+ +
+
+ + + + + + + +
void write_dvd_long_sector_blocks (aaruformat_context * ctx)
+
+ +

Serialize DVD long sector auxiliary data blocks to the image file.

+

This function writes four separate data blocks containing DVD-specific auxiliary information extracted from "long" DVD sectors. DVD long sectors contain additional fields beyond the 2048 bytes of user data, including sector identification, error detection, and copy protection information. When writing DVD images with long sector support, these auxiliary fields are stored separately from the main user data to optimize storage and enable selective access.

+

The function is only invoked if all four auxiliary buffers have been populated during image creation (sector_id, sector_ied, sector_cpr_mai, sector_edc). If any buffer is NULL, the function returns immediately without writing anything, allowing DVD images without long sector data to be created normally.

+

Four auxiliary data blocks written:

+
    +
  1. DVD Sector ID Block (DvdSectorId): 4 bytes per sector
      +
    • Contains the sector ID field from DVD long sectors
    • +
    • Used for sector identification and addressing validation
    • +
    +
  2. +
  3. DVD Sector IED Block (DvdSectorIed): 2 bytes per sector
      +
    • Contains the IED (ID Error Detection) field from DVD long sectors
    • +
    • Used for detecting errors in the sector ID field
    • +
    +
  4. +
  5. DVD Sector CPR/MAI Block (DvdSectorCprMai): 6 bytes per sector
      +
    • Contains the CPR_MAI (Copyright Management Information) field
    • +
    • Used for copy protection and media authentication information
    • +
    +
  6. +
  7. DVD Sector EDC Block (DvdSectorEdc): 4 bytes per sector
      +
    • Contains the EDC (Error Detection Code) field from DVD long sectors
    • +
    • Used for detecting errors in the sector data
    • +
    +
  8. +
+

Block structure for each auxiliary block: Each block consists of:

    +
  1. BlockHeader containing identifier (DataBlock), type (DvdSectorId/IED/CprMai/Edc), compression (None), lengths, and CRC64 checksums
  2. +
  3. Raw auxiliary data: concatenated fields from all sectors (including negative, normal, and overflow sectors)
  4. +
+

The total number of sectors includes negative sectors (for lead-in), normal image sectors, and overflow sectors (for lead-out), calculated as: total_sectors = negative + Sectors + overflow

+

Write sequence for each block:

    +
  1. Seek to end of file
  2. +
  3. Align file position to block boundary (using blockAlignmentShift)
  4. +
  5. Construct BlockHeader with appropriate type and calculated length
  6. +
  7. Calculate CRC64 over the auxiliary data buffer
  8. +
  9. Write BlockHeader (sizeof(BlockHeader) bytes)
  10. +
  11. Write auxiliary data buffer (length bytes)
  12. +
  13. On success, add IndexEntry to ctx->indexEntries
  14. +
+

Alignment and file positioning: Before writing each block, the file position is moved to EOF and then aligned forward to the next boundary satisfying (position & alignment_mask) == 0, where alignment_mask is derived from ctx->userDataDdtHeader.blockAlignmentShift. This ensures all blocks begin on properly aligned offsets for efficient I/O and compliance with the Aaru format specification.

+

Index registration: After successfully writing each block's header and data, an IndexEntry is appended to ctx->indexEntries with:

    +
  • blockType = DataBlock
  • +
  • dataType = DvdSectorId, DvdSectorIed, DvdSectorCprMai, or DvdSectorEdc
  • +
  • offset = the aligned file position where the BlockHeader was written
  • +
+

Error handling: Write errors (fwrite returning < 1) are silently ignored for individual blocks; no index entry is added if a write fails, but iteration continues to attempt writing remaining blocks. Diagnostic TRACE logs report success or failure for each block. The function does not propagate error codes; higher-level close logic must validate overall integrity if needed.

+

No-op conditions: If any of the four auxiliary buffers is NULL, the function returns immediately without writing anything. This is an all-or-nothing operation - either all four blocks are written or none.

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode. Must not be NULL. ctx->sector_id contains the ID fields from all DVD long sectors (may be NULL). ctx->sector_ied contains the IED fields from all DVD long sectors (may be NULL). ctx->sector_cpr_mai contains the CPR/MAI fields from all DVD long sectors (may be NULL). ctx->sector_edc contains the EDC fields from all DVD long sectors (may be NULL). ctx->imageStream must be open and writable. ctx->indexEntries must be initialized (utarray) to accept new index entries.
+
+
+
Note
DVD Long Sector Format:
    +
  • Standard DVD sectors contain 2048 bytes of user data
  • +
  • Long DVD sectors include additional fields for error detection and copy protection
  • +
  • Total long sector size varies by DVD format (typically 2064-2076 bytes)
  • +
  • These auxiliary fields are critical for forensic imaging and copy-protected media
  • +
+
+
+Sector Coverage:
    +
  • Negative sectors: Lead-in area before sector 0 (if present)
  • +
  • Normal sectors: Main data area (sectors 0 to Sectors-1)
  • +
  • Overflow sectors: Lead-out area after the main data (if present)
  • +
  • All three areas are included in the auxiliary data blocks
  • +
+
+
+Field Sizes:
    +
  • ID field: 4 bytes per sector (sector identification)
  • +
  • IED field: 2 bytes per sector (ID error detection)
  • +
  • CPR/MAI field: 6 bytes per sector (copyright management)
  • +
  • EDC field: 4 bytes per sector (error detection code)
  • +
  • Total auxiliary data: 16 bytes per sector across all four blocks
  • +
+
+
+Memory Management:
    +
  • The function allocates temporary buffers for compression when enabled
  • +
  • Auxiliary data buffers are managed by the caller
  • +
  • Compression buffers are freed after each block is written
  • +
  • Source data memory is freed later during context cleanup (aaruf_close)
  • +
+
+
+Use Cases:
    +
  • Forensic imaging of DVD media requiring complete sector data
  • +
  • Preservation of copy-protected DVD content
  • +
  • Analysis of DVD error detection and correction information
  • +
  • Validation of DVD sector structure and integrity
  • +
  • Research into DVD copy protection mechanisms
  • +
+
+
+Order in Close Sequence:
    +
  • DVD long sector blocks are typically written after user data but before metadata
  • +
  • The exact position in the file depends on what other blocks precede them
  • +
  • Index entries ensure blocks can be located during subsequent opens
  • +
  • All four blocks are written consecutively if present
  • +
+
+
Warning
The auxiliary data buffers must contain data for ALL sectors (negative + normal + overflow). Partial buffers or mismatched sizes will cause incorrect data to be written or buffer overruns.
+
+Compression is applied if enabled. The blocks may be stored compressed or uncompressed depending on the compression_enabled setting and compression effectiveness.
+
+If any of the four auxiliary buffers is NULL, the entire function is skipped. This is an all-or-nothing operation - either all four blocks are written or none.
+
See also
aaruf_write_sector_long() for writing individual DVD long sectors that populate these buffers.
+
+BlockHeader for the block header structure definition.
+ +

Definition at line 1808 of file close.c.

+ +

References aaruf_crc64_data(), aaruf_lzma_encode_buffer(), DdtHeader2::blockAlignmentShift, IndexEntry::blockType, BlockHeader::cmpCrc64, BlockHeader::cmpLength, BlockHeader::compression, aaruformat_context::compression_enabled, BlockHeader::crc64, DataBlock, IndexEntry::dataType, DvdSectorCprMai, DvdSectorEdc, DvdSectorId, DvdSectorIed, BlockHeader::identifier, aaruformat_context::image_info, aaruformat_context::imageStream, aaruformat_context::index_entries, BlockHeader::length, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, DdtHeader2::negative, None, IndexEntry::offset, DdtHeader2::overflow, aaruformat_context::sector_cpr_mai, aaruformat_context::sector_edc, aaruformat_context::sector_id, aaruformat_context::sector_ied, ImageInfo::Sectors, TRACE, BlockHeader::type, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_dvd_title_key_decrypted_block()

+ +
+
+ + + + + +
+ + + + + + + +
void write_dvd_title_key_decrypted_block (const aaruformat_context * ctx)
+
+static
+
+ +

Serialize the DVD decrypted title key data block to the image file.

+

This function writes a data block containing decrypted DVD title keys for all sectors in the image. DVD title keys are used in the Content Scrambling System (CSS) encryption scheme to decrypt sector data on encrypted DVDs. When imaging encrypted DVD media, if the decryption keys are available, they can be stored alongside the encrypted data to enable future decryption without requiring the original disc or authentication process.

+

The function is only invoked if the decrypted title key buffer has been populated during image creation (ctx->sector_decrypted_title_key != NULL). If the buffer is NULL, the function returns immediately without writing anything, allowing DVD images without decrypted title keys to be created normally. This is typical for non-encrypted DVDs or when keys were not available during imaging.

+

Data block structure:

+
    +
  • Block Type: DataBlock with type DvdSectorTitleKeyDecrypted
  • +
  • Size: 5 bytes per sector (total_sectors × 5 bytes)
      +
    • total_sectors = negative sectors + user sectors + overflow sectors
    • +
    +
  • +
  • Compression: Applied if enabled (LZMA compression)
  • +
  • CRC64: Computed over the decrypted title key buffer
  • +
  • Alignment: Block-aligned according to ctx->userDataDdtHeader.blockAlignmentShift
  • +
+

Block write sequence:

+
    +
  1. Check if ctx->sector_decrypted_title_key is NULL; return early if so
  2. +
  3. Seek to end of file to determine write position
  4. +
  5. Align file position forward to next block boundary (if needed)
  6. +
  7. Construct BlockHeader with:
      +
    • identifier = DataBlock
    • +
    • type = DvdSectorTitleKeyDecrypted
    • +
    • compression = ctx->compression_enabled ? Lzma : None
    • +
    • length = (negative + sectors + overflow) × 5
    • +
    • cmpLength = compressed size or original size if compression not effective
    • +
    • crc64 = CRC64 of original key buffer
    • +
    • cmpCrc64 = CRC64 of compressed data or same as crc64 if uncompressed
    • +
    +
  8. +
  9. Write BlockHeader (sizeof(BlockHeader) bytes)
  10. +
  11. Write LZMA properties if compressed (LZMA_PROPERTIES_LENGTH bytes)
  12. +
  13. Write decrypted title key data buffer (compressed or uncompressed)
  14. +
  15. Create and append IndexEntry to ctx->indexEntries:
      +
    • blockType = DataBlock
    • +
    • dataType = DvdSectorTitleKeyDecrypted
    • +
    • offset = aligned block position
    • +
    +
  16. +
+

Alignment and file positioning:

+

Before writing the block, the file position is moved to EOF and then aligned forward to the next boundary satisfying (position & alignment_mask) == 0, where alignment_mask is derived from the blockAlignmentShift. This ensures that all structural blocks begin on properly aligned offsets for efficient I/O and compliance with the Aaru format specification.

+

Index registration:

+

After successful write, an IndexEntry is created and added to ctx->indexEntries using utarray_push_back(). This allows the block to be located efficiently during image reading via the index lookup mechanism. The index stores the exact file offset where the BlockHeader was written.

+

Title Key Format:

+

Each sector's title key is exactly 5 bytes. The keys are stored sequentially in sector order (negative sectors first, then user sectors, then overflow sectors). The corrected sector addressing scheme is used to index into the buffer:

    +
  • Negative sector N: index = (N - negative)
  • +
  • User sector U: index = (negative + U)
  • +
  • Overflow sector O: index = (negative + Sectors + O)
  • +
+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode.
+
+
+
Note
This is a static helper function called during image finalization (aaruf_close). It is not part of the public API.
+
+The function performs no error handling beyond checking for NULL buffer. Write failures are silently ignored, consistent with other optional metadata serialization routines in the finalization sequence.
+
+Decrypted title keys are sensitive cryptographic material. Applications should consider access control and security implications when storing and distributing images containing decrypted keys.
+
+The function uses TRACE() macros for diagnostic logging of write progress, file positions, and index entry creation.
+
Warning
This function assumes ctx->imageStream is open and writable. Calling it with a read-only or closed stream will result in undefined behavior.
+
+The function does not validate that ctx->sector_decrypted_title_key contains exactly (negative + sectors + overflow) × 5 bytes. Buffer overruns may occur if the buffer was improperly allocated.
+
+Do not call this function directly. It is invoked automatically by aaruf_close() as part of the image finalization sequence.
+ +

Definition at line 2245 of file close.c.

+ +

References aaruf_crc64_data(), aaruf_lzma_encode_buffer(), DdtHeader2::blockAlignmentShift, IndexEntry::blockType, BlockHeader::cmpCrc64, BlockHeader::cmpLength, BlockHeader::compression, aaruformat_context::compression_enabled, BlockHeader::crc64, DataBlock, IndexEntry::dataType, DvdSectorTitleKeyDecrypted, BlockHeader::identifier, aaruformat_context::image_info, aaruformat_context::imageStream, aaruformat_context::index_entries, BlockHeader::length, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, DdtHeader2::negative, None, IndexEntry::offset, DdtHeader2::overflow, aaruformat_context::sector_decrypted_title_key, ImageInfo::Sectors, TRACE, BlockHeader::type, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_geometry_block()

+ +
+
+ + + + + +
+ + + + + + + +
void write_geometry_block (const aaruformat_context * ctx)
+
+static
+
+ +

Serialize the geometry metadata block to the image file.

+

This function writes a GeometryBlockHeader containing legacy CHS (Cylinder-Head-Sector) style logical geometry metadata to the Aaru image file. The geometry block records the physical/logical layout of media that can be addressed using classical CHS parameters (cylinders, heads, sectors per track) common to legacy hard disk drives and some optical media formats.

+

The geometry information is optional; if no geometry metadata was previously set (detected by checking ctx->geometryBlock.identifier != GeometryBlock), the function returns immediately as a no-op. When present, the block is written at the end of the image file, aligned to the DDT block boundary specified by blockAlignmentShift, and an IndexEntry is appended to ctx->indexEntries so readers can locate it during image parsing.

+

Block layout:

    +
  • GeometryBlockHeader (16 bytes):
      +
    • identifier (4 bytes): BlockType::GeometryBlock magic constant
    • +
    • cylinders (4 bytes): Number of cylinders
    • +
    • heads (4 bytes): Number of heads (tracks per cylinder)
    • +
    • sectorsPerTrack (4 bytes): Number of sectors per track
    • +
    +
  • +
  • No additional payload follows the header in current format versions.
  • +
+

Total logical sectors implied by the geometry: cylinders × heads × sectorsPerTrack. Sector size is not encoded in this block and must be derived from other metadata (e.g., from the media type or explicitly stored elsewhere in the image).

+

Alignment strategy:

    +
  • The write position is obtained via fseek(SEEK_END) + ftell().
  • +
  • If the position is not aligned to (1 << blockAlignmentShift), it is advanced to the next aligned boundary by computing: (position + alignment_mask) & ~alignment_mask.
  • +
  • This ensures the geometry block starts on a block-aligned offset for efficient access.
  • +
+

Error handling:

    +
  • If fwrite() fails to write the GeometryBlockHeader, the function silently returns without updating the index. This is consistent with other optional metadata writers in this module that use opportunistic writes (failures logged via TRACE but not propagated as errors).
  • +
  • The caller (aaruf_close) will continue finalizing other blocks even if geometry write fails.
  • +
+

Indexing:

    +
  • On successful write, an IndexEntry with blockType = GeometryBlock, dataType = 0, and offset = block_position is pushed to ctx->indexEntries.
  • +
  • The index will be serialized later by write_index_block() and allows readers to quickly locate the geometry metadata without scanning the entire file.
  • +
+

Use cases:

    +
  • Preserving original CHS geometry for disk images from legacy systems (e.g., IDE/PATA drives, floppy disks, early SCSI devices) where BIOS or firmware relied on CHS addressing.
  • +
  • Documenting physical layout of optical media that may have track/sector organization.
  • +
  • Supporting forensic/archival workflows that need complete metadata fidelity.
  • +
+

Thread safety: This function is not thread-safe; it modifies shared ctx state (imageStream file position, indexEntries array) and must only be called during single-threaded finalization (within aaruf_close).

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode. Must not be NULL. The geometryBlock field must be pre-populated if geometry metadata is desired. The imageStream must be open and writable.
+
+
+ +

Definition at line 3026 of file close.c.

+ +

References DdtHeader2::blockAlignmentShift, IndexEntry::blockType, IndexEntry::dataType, aaruformat_context::geometry_block, GeometryBlock, GeometryBlockHeader::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, IndexEntry::offset, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_index_block()

+ +
+
+ + + + + +
+ + + + + + + +
int32_t write_index_block (aaruformat_context * ctx)
+
+static
+
+ +

Serialize the accumulated index entries at the end of the image and back-patch the header.

+

All previously written structural blocks push their IndexEntry into ctx->indexEntries. This function collects them, writes an IndexHeader3 followed by each IndexEntry, computes CRC64 over the entries, and then updates the main AaruHeaderV2 (at offset 0) with the index offset. The index itself is aligned to the DDT block boundary. No previous index chaining is currently implemented (index_header.previous = 0).

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode.
+
+
+
Returns
AARUF_STATUS_OK on success; AARUF_ERROR_CANNOT_WRITE_HEADER if the index header, any entry, or the header back-patch fails.
+
Return values
+ + + +
AARUF_STATUS_OKIndex written and header updated.
AARUF_ERROR_CANNOT_WRITE_HEADERFailed writing index header, entries, or updating main header.
+
+
+ +

Definition at line 3862 of file close.c.

+ +

References aaruf_crc64_final(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_WRITE_HEADER, AARUF_STATUS_OK, DdtHeader2::blockAlignmentShift, IndexEntry::blockType, IndexHeader3::crc64, IndexEntry::dataType, IndexHeader3::entries, aaruformat_context::header, IndexHeader3::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, IndexBlock3, AaruHeaderV2::indexOffset, IndexEntry::offset, IndexHeader3::previous, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_media_tags()

+ +
+
+ + + + + +
+ + + + + + + +
void write_media_tags (const aaruformat_context * ctx)
+
+static
+
+ +

Serialize all accumulated media tags to the image file.

+

Media tags represent arbitrary metadata or descriptor blobs associated with the entire medium (as opposed to per-sector or per-track metadata). Examples include proprietary drive firmware information, TOC descriptors, ATIP data, PMA/Lead-in content, or manufacturer-specific binary structures that do not fit the standard track or sector model. Each tag is identified by a numeric type field interpreted by upper layers or external tooling.

+

This function traverses the ctx->mediaTags hash table (keyed by tag type) using HASH_ITER and writes each tag as an independent DataBlock. Each block is:

    +
  • Aligned to the DDT block boundary (controlled by ctx->userDataDdtHeader.blockAlignmentShift)
  • +
  • Prefixed with a BlockHeader containing the identifier DataBlock and a data type derived from the tag's type field via aaruf_get_datatype_for_media_tag_type()
  • +
  • Compressed if enabled (compression = ctx->compression_enabled ? Lzma : None)
  • +
  • CRC64-protected: the checksum is computed over the raw tag data and stored in crc64; cmpCrc64 stores the checksum of compressed data or equals crc64 if uncompressed
  • +
  • Followed immediately by the tag's data payload (compressed or uncompressed)
  • +
+

After successfully writing a tag's header and data, an IndexEntry is appended to ctx->indexEntries with:

    +
  • blockType = DataBlock
  • +
  • dataType = the converted tag type (from aaruf_get_datatype_for_media_tag_type)
  • +
  • offset = the aligned file position where the BlockHeader was written
  • +
+

Alignment and file positioning: Before writing each tag, the file position is moved to EOF and then aligned forward to the next boundary satisfying (position & alignment_mask) == 0, where alignment_mask is derived from the blockAlignmentShift. This ensures that all structural blocks (including media tags) begin on properly aligned offsets for efficient I/O and compliance with the Aaru format specification.

+

Order of operations for each tag:

    +
  1. Seek to end of file
  2. +
  3. Align file position to block boundary
  4. +
  5. Construct BlockHeader with identifier, type, compression setting, length, CRC64
  6. +
  7. Compress tag data if enabled and compression is effective
  8. +
  9. Write BlockHeader (sizeof(BlockHeader) bytes)
  10. +
  11. Write LZMA properties if compressed (LZMA_PROPERTIES_LENGTH bytes)
  12. +
  13. Write tag data (compressed or uncompressed)
  14. +
  15. On success, push IndexEntry to ctx->indexEntries
  16. +
+

Error handling: Write errors (fwrite returning < 1) are silently ignored for individual tags; no index entry is added if a write fails, but iteration continues. Diagnostic TRACE logs report success or failure for each tag. The function does not propagate error codes; higher-level close logic must validate overall integrity if needed.

+

Hash table iteration: The function uses HASH_ITER(hh, ctx->mediaTags, media_tag, tmp_media_tag) from uthash to safely iterate all entries. The tmp_media_tag parameter provides deletion-safe traversal, though this function does not delete entries (cleanup is handled during context teardown).

+

No-op conditions: If ctx->mediaTags is NULL (no tags were added during image creation), the function returns immediately without writing anything or modifying the index.

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode. Must not be NULL. ctx->mediaTags contains the hash table of media tags to serialize (may be NULL if no tags exist). ctx->imageStream must be open and writable. ctx->indexEntries must be initialized (utarray) to accept new index entries.
+
+
+
Note
Media tags are format-agnostic at this layer. The tag type-to-datatype mapping is delegated to aaruf_get_datatype_for_media_tag_type(), which consults internal tables or enumerations defined elsewhere in the library.
+
See also
aaruf_write_media_tag() for adding tags to the context during image creation.
+
+aaruf_get_datatype_for_media_tag_type() for type conversion logic.
+
+mediaTagEntry for the hash table entry structure.
+ +

Definition at line 2409 of file close.c.

+ +

References aaruf_crc64_data(), aaruf_get_datatype_for_media_tag_type(), aaruf_lzma_encode_buffer(), DdtHeader2::blockAlignmentShift, IndexEntry::blockType, BlockHeader::cmpCrc64, BlockHeader::cmpLength, BlockHeader::compression, aaruformat_context::compression_enabled, BlockHeader::crc64, mediaTagEntry::data, DataBlock, IndexEntry::dataType, BlockHeader::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, BlockHeader::length, mediaTagEntry::length, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, aaruformat_context::mediaTags, None, IndexEntry::offset, TRACE, BlockHeader::type, mediaTagEntry::type, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_metadata_block()

+ +
+
+ + + + + +
+ + + + + + + +
void write_metadata_block (aaruformat_context * ctx)
+
+static
+
+ +

Serialize the metadata block containing image and media descriptive information.

+

This function writes a MetadataBlock containing human-readable and machine-readable metadata strings that describe the image creation context, the physical media being preserved, and the drive used for acquisition. The metadata block stores variable-length UTF-16LE strings for fields such as creator identification, user comments, media identification (title, manufacturer, model, serial number, barcode, part number), and drive identification (manufacturer, model, serial number, firmware revision). Each string is stored sequentially in a single contiguous buffer, with the MetadataBlockHeader recording both the offset (relative to the start of the buffer) and length of each field.

+

The metadata block is optional; if no metadata fields have been populated (all string pointers are NULL and sequence numbers are zero), the function returns immediately without writing anything. This no-op behavior is detected by checking that the identifier has not been explicitly set to MetadataBlock and all relevant imageInfo string fields are NULL.

+

Block structure: The serialized block consists of:

    +
  1. MetadataBlockHeader (fixed size, containing identifier, sequence numbers, field offsets and lengths for all metadata strings)
  2. +
  3. Variable-length payload: concatenated UTF-16LE string data for all non-NULL fields
  4. +
+

The total blockSize is computed as sizeof(MetadataBlockHeader) plus the sum of all populated string lengths (creatorLength, commentsLength, mediaTitleLength, etc.). Note that lengths are in bytes, not character counts.

+

Field packing order: Non-NULL strings from ctx->imageInfo are copied into the buffer in the following order:

    +
  1. Creator
  2. +
  3. Comments
  4. +
  5. MediaTitle
  6. +
  7. MediaManufacturer
  8. +
  9. MediaModel
  10. +
  11. MediaSerialNumber
  12. +
  13. MediaBarcode
  14. +
  15. MediaPartNumber
  16. +
  17. DriveManufacturer
  18. +
  19. DriveModel
  20. +
  21. DriveSerialNumber
  22. +
  23. DriveFirmwareRevision
  24. +
+

As each field is copied, its offset (relative to the buffer start, which begins after the header) is recorded in the corresponding offset field of ctx->metadataBlockHeader, and the position pointer is advanced by the field's length.

+

Alignment and file positioning: Before writing the block, the file position is moved to EOF and then aligned forward to the next boundary satisfying (position & alignment_mask) == 0, where alignment_mask is derived from ctx->userDataDdtHeader.blockAlignmentShift. This ensures the metadata block begins on a properly aligned offset for efficient I/O and compliance with the Aaru format specification.

+

Index registration: After successfully writing the metadata block, an IndexEntry is appended to ctx->indexEntries with:

    +
  • blockType = MetadataBlock
  • +
  • dataType = 0 (metadata blocks have no subtype)
  • +
  • offset = the aligned file position where the block was written
  • +
+

Memory management: The function allocates a temporary buffer (via calloc) sized to hold the entire block payload. If allocation fails, the function returns immediately without writing anything. The buffer is freed before the function returns, regardless of write success or failure.

+

Error handling: Write errors (fwrite returning < 1) are silently ignored; no index entry is added if the write fails, but the temporary buffer is still freed. Diagnostic TRACE logs report success or failure. The function does not propagate error codes; higher-level close logic must validate overall integrity if needed.

+

No-op conditions:

    +
  • ctx->metadataBlockHeader.identifier is not MetadataBlock AND
  • +
  • ctx->metadataBlockHeader.mediaSequence == 0 AND
  • +
  • ctx->metadataBlockHeader.lastMediaSequence == 0 AND
  • +
  • All ctx->imageInfo string fields (Creator, Comments, MediaTitle, etc.) are NULL
  • +
+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode. Must not be NULL. ctx->metadataBlockHeader contains the header template with pre-populated field lengths and sequence numbers (if applicable). ctx->imageInfo contains pointers to the actual UTF-16LE string data (may be NULL for unpopulated fields). ctx->imageStream must be open and writable. ctx->indexEntries must be initialized (utarray) to accept new index entries.
+
+
+
Note
UTF-16LE Encoding:
    +
  • All metadata strings use UTF-16LE encoding to support international characters
  • +
  • Field lengths are in bytes, not character counts (UTF-16LE uses 2 or 4 bytes per character)
  • +
  • The library treats string data as opaque and does not validate UTF-16LE encoding
  • +
  • Ensure even byte lengths to maintain UTF-16LE character alignment
  • +
+
+
+Unlike data blocks (which include CRC64 checksums), the metadata block does not currently include integrity checking beyond the implicit file-level checksums. The header itself stores offsets/lengths but not CRCs for individual string fields.
+
+Media sequence numbers (mediaSequence, lastMediaSequence) support multi-volume image sets (e.g., spanning multiple optical discs). Single-volume images typically set both to 0 or leave them uninitialized.
+
See also
MetadataBlockHeader for the on-disk structure definition.
+
+aaruf_set_creator() for populating the creator field.
+
+aaruf_set_comments() for populating the comments field.
+
+aaruf_set_media_title() for populating the media title field.
+ +

Definition at line 3162 of file close.c.

+ +

References DdtHeader2::blockAlignmentShift, MetadataBlockHeader::blockSize, IndexEntry::blockType, aaruformat_context::comments, MetadataBlockHeader::commentsLength, MetadataBlockHeader::commentsOffset, aaruformat_context::creator, MetadataBlockHeader::creatorLength, MetadataBlockHeader::creatorOffset, IndexEntry::dataType, aaruformat_context::drive_firmware_revision, aaruformat_context::drive_manufacturer, aaruformat_context::drive_model, aaruformat_context::drive_serial_number, MetadataBlockHeader::driveFirmwareRevisionLength, MetadataBlockHeader::driveFirmwareRevisionOffset, MetadataBlockHeader::driveManufacturerLength, MetadataBlockHeader::driveManufacturerOffset, MetadataBlockHeader::driveModelLength, MetadataBlockHeader::driveModelOffset, MetadataBlockHeader::driveSerialNumberLength, MetadataBlockHeader::driveSerialNumberOffset, MetadataBlockHeader::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, MetadataBlockHeader::lastMediaSequence, aaruformat_context::media_barcode, aaruformat_context::media_manufacturer, aaruformat_context::media_model, aaruformat_context::media_part_number, aaruformat_context::media_serial_number, aaruformat_context::media_title, MetadataBlockHeader::mediaBarcodeLength, MetadataBlockHeader::mediaBarcodeOffset, MetadataBlockHeader::mediaManufacturerLength, MetadataBlockHeader::mediaManufacturerOffset, MetadataBlockHeader::mediaModelLength, MetadataBlockHeader::mediaModelOffset, MetadataBlockHeader::mediaPartNumberLength, MetadataBlockHeader::mediaPartNumberOffset, MetadataBlockHeader::mediaSequence, MetadataBlockHeader::mediaSerialNumberLength, MetadataBlockHeader::mediaSerialNumberOffset, MetadataBlockHeader::mediaTitleLength, MetadataBlockHeader::mediaTitleOffset, aaruformat_context::metadata_block_header, MetadataBlock, IndexEntry::offset, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_mode2_subheaders_block()

+ +
+
+ + + + + +
+ + + + + + + +
void write_mode2_subheaders_block (aaruformat_context * ctx)
+
+static
+
+ +

Serialize a MODE 2 (XA) subheaders data block.

+

When Compact Disc Mode 2 form sectors are present, optional 8-byte subheaders (one per logical sector including negative / overflow ranges) are stored in an in-memory buffer. This function writes that buffer as a DataBlock of type CompactDiscMode2Subheader with CRC64 (compression enabled if configured) and adds an IndexEntry.

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode; ctx->mode2_subheaders must point to a buffer sized for the described sector span.
+
+
+ +

Definition at line 850 of file close.c.

+ +

References aaruf_crc64_data(), aaruf_lzma_encode_buffer(), DdtHeader2::blockAlignmentShift, IndexEntry::blockType, BlockHeader::cmpCrc64, BlockHeader::cmpLength, CompactDiscMode2Subheader, BlockHeader::compression, aaruformat_context::compression_enabled, BlockHeader::crc64, DataBlock, IndexEntry::dataType, BlockHeader::identifier, aaruformat_context::image_info, aaruformat_context::imageStream, aaruformat_context::index_entries, BlockHeader::length, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, aaruformat_context::mode2_subheaders, DdtHeader2::negative, None, IndexEntry::offset, DdtHeader2::overflow, ImageInfo::Sectors, TRACE, BlockHeader::type, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_primary_ddt()

+ +
+
+ + + + + +
+ + + + + + + +
int32_t write_primary_ddt (aaruformat_context * ctx)
+
+static
+
+ +

Write (flush) the multi-level primary DDT table header and data back to its file offset.

+

This function is applicable only when a multi-level DDT is in use (tableShift > 0). It updates the header fields (identifier, type, compression, CRC, lengths) and writes first the header and then the entire primary table data block at ctx->primaryDdtOffset. The function also pushes an IndexEntry for the primary DDT into the in-memory index array so that later write_index_block() will serialize it.

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode.
+
+
+
Returns
AARUF_STATUS_OK on success; AARUF_ERROR_CANNOT_WRITE_HEADER if either the header or the table body cannot be written. Returns AARUF_STATUS_OK immediately if no primary table should be written (single-level DDT or table buffers absent).
+
Return values
+ + + +
AARUF_STATUS_OKSuccess or nothing to do (no multi-level primary table present).
AARUF_ERROR_CANNOT_WRITE_HEADERFailed writing header or primary table data.
+
+
+ +

Definition at line 283 of file close.c.

+ +

References aaruf_crc64_final(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_WRITE_HEADER, AARUF_STATUS_OK, IndexEntry::blockType, DdtHeader2::cmpCrc64, DdtHeader2::cmpLength, DdtHeader2::compression, DdtHeader2::crc64, IndexEntry::dataType, DeDuplicationTable2, DdtHeader2::entries, DdtHeader2::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, DdtHeader2::length, None, IndexEntry::offset, aaruformat_context::primary_ddt_offset, DdtHeader2::tableShift, TRACE, DdtHeader2::type, aaruformat_context::user_data_ddt2, aaruformat_context::user_data_ddt_header, and UserData.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_sector_prefix()

+ +
+
+ + + + + +
+ + + + + + + +
void write_sector_prefix (aaruformat_context * ctx)
+
+static
+
+ +

Serialize the optional CD sector prefix block.

+

The sector prefix corresponds to the leading bytes of a raw CD sector (synchronization pattern, address / header in MSF format and the mode byte) that precede the user data and any ECC/ECCP fields. It is unrelated to subchannel (P–W) data, which is handled separately. If prefix data was collected (ctx->sector_prefix != NULL), this writes a DataBlock of type CdSectorPrefix containing exactly the bytes accumulated up to sector_prefix_offset. The block is CRC64 protected, compressed if enabled, aligned to the DDT block boundary and indexed.

+

Typical raw Mode 1 / Mode 2 sector layout (2352 bytes total): 12-byte sync pattern (00 FF FF FF FF FF FF FF FF FF FF 00) 3-byte address (Minute, Second, Frame in BCD) 1-byte mode (e.g., 0x01, 0x02) ... user data ... ... ECC / EDC ... The stored prefix encompasses the first 16 bytes (sync + address + mode) or whatever subset was gathered by the writer.

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode.
+
+
+ +

Definition at line 966 of file close.c.

+ +

References aaruf_crc64_data(), aaruf_lzma_encode_buffer(), DdtHeader2::blockAlignmentShift, IndexEntry::blockType, CdSectorPrefix, BlockHeader::cmpCrc64, BlockHeader::cmpLength, BlockHeader::compression, aaruformat_context::compression_enabled, BlockHeader::crc64, DataBlock, IndexEntry::dataType, BlockHeader::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, BlockHeader::length, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, None, IndexEntry::offset, aaruformat_context::sector_prefix, aaruformat_context::sector_prefix_offset, TRACE, BlockHeader::type, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_sector_prefix_ddt()

+ +
+
+ + + + + +
+ + + + + + + +
void write_sector_prefix_ddt (aaruformat_context * ctx)
+
+static
+
+ +

Serialize the per-sector CD prefix status / index DeDuplication Table (DDT v2, prefix variant).

+

This DDT records for each logical sector (including negative and overflow ranges) an optional index into the stored 16‑byte prefix capture buffer plus a 4-bit status code. It is written only if at least one prefix status or captured prefix was recorded (i.e., the in-memory DDT array exists).

+

Encoding: Bits 63..61 : SectorStatus enum value (see enums.h, values already positioned for v2 layout). Bits 60..0 : Index of the 16-byte prefix chunk inside the CdSectorPrefix data block, or 0 when no external prefix bytes were stored (status applies to a generated/implicit prefix).

+

Notes:

    +
  • Unlike DDT v1, there are no CD_XFIX_MASK / CD_DFIX_MASK macros used here. The bit layout is compact and directly encoded when writing (status values are pre-shifted where needed in write.c).
  • +
  • The table length equals (negative + Sectors + overflow) * entrySize.
  • +
  • dataShift is set to 4 (2^4 = 16) expressing the granularity of referenced prefix units.
  • +
  • Compression is applied if enabled; crc64/cmpCrc64 protect the raw table bytes.
  • +
  • Idempotent: if an index entry of type DeDuplicationTable2 + CdSectorPrefixCorrected already exists the function returns immediately.
  • +
+

Alignment: The table is block-aligned using the same blockAlignmentShift as user data DDTs. Indexing: An IndexEntry is appended on success so readers can locate and parse the table.

+
Parameters
+ + +
ctxPointer to a valid aaruformatContext in write mode (must not be NULL).
+
+
+ +

Definition at line 1206 of file close.c.

+ +

References aaruf_crc64_data(), aaruf_lzma_encode_buffer(), DdtHeader2::blockAlignmentShift, DdtHeader2::blocks, IndexEntry::blockType, CdSectorPrefix, DdtHeader2::cmpCrc64, DdtHeader2::cmpLength, DdtHeader2::compression, aaruformat_context::compression_enabled, DdtHeader2::crc64, DdtHeader2::dataShift, IndexEntry::dataType, DeDuplicationTable2, DdtHeader2::entries, DdtHeader2::identifier, aaruformat_context::image_info, aaruformat_context::imageStream, aaruformat_context::index_entries, DdtHeader2::length, DdtHeader2::levels, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, DdtHeader2::negative, None, IndexEntry::offset, DdtHeader2::overflow, aaruformat_context::sector_prefix_ddt2, ImageInfo::Sectors, DdtHeader2::start, DdtHeader2::tableLevel, DdtHeader2::tableShift, TRACE, DdtHeader2::type, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_sector_subchannel()

+ +
+
+ + + + + +
+ + + + + + + +
void write_sector_subchannel (const aaruformat_context * ctx)
+
+static
+
+ +

Serialize the per-sector subchannel or tag data block.

+

This routine writes out the accumulated subchannel or tag metadata that accompanies each logical sector (including negative pregap and overflow ranges). The exact interpretation and size depend on the media type:

+

Optical Disc (CD) subchannel:

    +
  • Type: CdSectorSubchannel
  • +
  • Contains the deinterleaved P through W subchannel data (96 bytes per sector).
  • +
  • Covers: (negative + Sectors + overflow) sectors.
  • +
  • The P channel marks pause boundaries; Q encodes track/index/time information (MCN, ISRC).
  • +
  • R–W channels are typically used for CD+G graphics or CD-TEXT.
  • +
+

Apple block media tags:

    +
  • AppleProfile / AppleFileWare: 20 bytes per sector (AppleProfileTag).
  • +
  • AppleSonyDS / AppleSonySS: 12 bytes per sector (AppleSonyTag).
  • +
  • PriamDataTower: 24 bytes per sector (PriamDataTowerTag).
  • +
  • Tags encode filesystem metadata, allocation state, or device-specific control information.
  • +
  • Only positive sectors (0 through Sectors-1) and overflow are included; no negative range.
  • +
+

The block size is computed as (applicable_sector_count) × (bytes_per_sector_for_media_type). Compression is conditionally applied based on media type and compression settings:

    +
  • Optical Disc: When compression is enabled, applies Claunia Subchannel Transform (CST) followed by LZMA compression (LzmaClauniaSubchannelTransform). If the compressed size is not smaller than the original, falls back to uncompressed storage.
  • +
  • Block Media: Always attempts LZMA compression for tag data. If the compressed size is not smaller than the original, falls back to uncompressed storage. The data is written after a DataBlock header with CRC64 integrity protection. The write position is aligned to the DDT block boundary (2^blockAlignmentShift) before serialization begins.
  • +
+

Media type validation: The function only proceeds if XmlMediaType is OpticalDisc or BlockMedia and (for block media) the specific MediaType matches one of the supported Apple or Priam variants. Any other media type causes an immediate silent return (logged at TRACE level).

+

Alignment & indexing: The block is aligned using the same alignment shift as the user data DDT. An IndexEntry (blockType = DataBlock, dataType = subchannel_block.type, offset = aligned file position) is appended to ctx->indexEntries on successful write, enabling readers to locate the subchannel or tag data.

+

Thread / reentrancy: This function is invoked once during finalization (aaruf_close) in a single-threaded context. No synchronization is performed.

+

Error handling: Write errors are logged but not explicitly propagated as return codes. If the write succeeds an index entry is added; if it fails no entry is added and diagnostics appear in TRACE logs. Higher level close logic determines overall success or failure.

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode. Must not be NULL. ctx->sector_subchannel must point to a fully populated buffer sized appropriately for the media type and sector count.
+
+
+ +

Definition at line 1508 of file close.c.

+ +

References aaruf_crc64_data(), aaruf_cst_transform(), aaruf_lzma_encode_buffer(), AppleFileWare, AppleProfile, AppleProfileTag, AppleSonyDS, AppleSonySS, AppleSonyTag, DdtHeader2::blockAlignmentShift, BlockMedia, IndexEntry::blockType, CdSectorSubchannel, BlockHeader::cmpCrc64, BlockHeader::cmpLength, BlockHeader::compression, aaruformat_context::compression_enabled, BlockHeader::crc64, DataBlock, IndexEntry::dataType, BlockHeader::identifier, aaruformat_context::image_info, aaruformat_context::imageStream, aaruformat_context::index_entries, BlockHeader::length, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, LzmaClauniaSubchannelTransform, ImageInfo::MediaType, ImageInfo::MetadataMediaType, DdtHeader2::negative, None, IndexEntry::offset, OpticalDisc, DdtHeader2::overflow, PriamDataTower, PriamDataTowerTag, aaruformat_context::sector_subchannel, ImageInfo::Sectors, TRACE, BlockHeader::type, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_sector_suffix()

+ +
+
+ + + + + +
+ + + + + + + +
void write_sector_suffix (aaruformat_context * ctx)
+
+static
+
+ +

Serialize the optional CD sector suffix block (EDC/ECC region capture).

+

The sector suffix contains trailing integrity and redundancy bytes of a raw CD sector that follow the user data area. Depending on the mode this includes:

    +
  • Mode 1: 4-byte EDC, 8-byte reserved, 276 bytes (P/Q layers) ECC = 288 bytes total.
  • +
  • Mode 2 Form 1: 4-byte EDC, 8 reserved, 276 ECC = 288 bytes.
  • +
  • Mode 2 Form 2: 4-byte EDC only (no ECC) but when an error is detected the implementation may still store a 288-byte suffix container for uniformity when capturing errored data.
  • +
+

During writing, when an error or uncorrectable condition is detected for a sector's suffix, the 288-byte trailing portion (starting at offset 2064 for Mode 1 / Form 1 or 2348/2349 for other layouts) is copied into an in-memory expandable buffer pointed to by ctx->sector_suffix. The per-sector DDT entry encodes either an inlined status (OK / No CRC / etc.) or an index to the stored suffix (ctx->sector_suffix_offset / 288). This function serializes the accumulated suffix buffer as a DataBlock of type CdSectorSuffix if any suffix bytes were stored.

+

Layout considerations:

    +
  • The block length is exactly the number of bytes copied (ctx->sector_suffix_offset).
  • +
  • Compression is applied if enabled; CRC64 is calculated on the raw suffix stream for integrity.
  • +
  • The write position is aligned to the DDT block alignment (2^blockAlignmentShift).
  • +
+

Indexing: An IndexEntry is appended so later readers can locate the suffix collection. Absence of this block implies no per-sector suffix captures were required (all suffixes considered OK).

+

Thread / reentrancy: This routine is called only once during finalization (aaruf_close) in a single-threaded context; no synchronization is performed.

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode. Must not be NULL.
+
+
+ +

Definition at line 1088 of file close.c.

+ +

References aaruf_crc64_data(), aaruf_lzma_encode_buffer(), DdtHeader2::blockAlignmentShift, IndexEntry::blockType, CdSectorSuffix, BlockHeader::cmpCrc64, BlockHeader::cmpLength, BlockHeader::compression, aaruformat_context::compression_enabled, BlockHeader::crc64, DataBlock, IndexEntry::dataType, BlockHeader::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, BlockHeader::length, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, None, IndexEntry::offset, aaruformat_context::sector_suffix, aaruformat_context::sector_suffix_offset, TRACE, BlockHeader::type, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_sector_suffix_ddt()

+ +
+
+ + + + + +
+ + + + + + + +
void write_sector_suffix_ddt (aaruformat_context * ctx)
+
+static
+
+ +

Serialize the per-sector CD suffix status / index DeDuplication Table (DDT v2, suffix variant).

+

This routine emits the DDT v2 table that maps each logical sector (including negative pregap and overflow ranges) to (a) a 4-bit SectorStatus code and (b) a 12-bit index pointing into the captured suffix data block (CdSectorSuffix). The suffix bytes (typically the 288-byte EDC/ECC region for Mode 1 or Mode 2 Form 1, or shorter EDC-only for Form 2) are stored separately by write_sector_suffix(). When a sector's suffix was captured because it differed from the expected generated values (e.g., uncorrectable, intentionally preserved corruption, or variant layout), the in-memory mini entry records the index of its 16 * 18 (288) byte chunk. If no suffix bytes were explicitly stored for a sector the index field is zero and only the status applies.

+

Encoding (DDT v2 semantics): Bits 63..61 : SectorStatus enumeration (already aligned for direct storage; no legacy masks used). Bits 60..0 : Index referencing a suffix unit of size 288 bytes (2^dataShift granularity), or 0 when the sector uses an implicit / regenerated suffix (no external data captured).

+

Characteristics & constraints:

    +
  • Only DDT v2 is supported here; no fallback or mixed-mode emission with v1 occurs.
  • +
  • Table length = (negative + total Sectors + overflow) * sizeof(uint16_t).
  • +
  • dataShift mirrors userDataDdtHeader.dataShift (expressing granularity for index referencing).
  • +
  • Single-level table (levels = 1, tableLevel = 0, tableShift = 0).
  • +
  • Compression is applied if enabled; CRC64 protects the table bytes.
  • +
  • Alignment: The table is aligned to 2^(blockAlignmentShift) before writing to guarantee block boundary access.
  • +
  • Idempotence: If sectorSuffixDdt2 is NULL the function is a no-op (indicating no suffix anomalies captured).
  • +
+

Index integration: On success an IndexEntry (blockType = DeDuplicationTable2, dataType = CdSectorSuffix, offset = file position) is appended to ctx->indexEntries enabling later readers to locate and parse the suffix DDT.

+

Error handling & assumptions:

    +
  • The function does not explicitly propagate write failures upward; partial write errors simply omit the index entry (TRACE logs provide diagnostics). Higher level close logic determines overall success.
  • +
  • Executed in a single-threaded finalization path; no locking is performed or required.
  • +
+

Preconditions:

    +
  • ctx must be a valid non-NULL pointer opened for writing.
  • +
  • ctx->sectorSuffixDdt2 must point to a fully populated contiguous array of uint16_t entries.
  • +
+
Parameters
+ + +
ctxActive aaruformatContext being finalized.
+
+
+ +

Definition at line 1350 of file close.c.

+ +

References aaruf_crc64_data(), aaruf_lzma_encode_buffer(), DdtHeader2::blockAlignmentShift, DdtHeader2::blocks, IndexEntry::blockType, CdSectorSuffix, DdtHeader2::cmpCrc64, DdtHeader2::cmpLength, DdtHeader2::compression, aaruformat_context::compression_enabled, DdtHeader2::crc64, DdtHeader2::dataShift, IndexEntry::dataType, DeDuplicationTable2, DdtHeader2::entries, DdtHeader2::identifier, aaruformat_context::image_info, aaruformat_context::imageStream, aaruformat_context::index_entries, DdtHeader2::length, DdtHeader2::levels, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, DdtHeader2::negative, None, IndexEntry::offset, DdtHeader2::overflow, aaruformat_context::sector_suffix_ddt2, ImageInfo::Sectors, DdtHeader2::start, DdtHeader2::tableLevel, DdtHeader2::tableShift, TRACE, DdtHeader2::type, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_single_level_ddt()

+ +
+
+ + + + + +
+ + + + + + + +
int32_t write_single_level_ddt (aaruformat_context * ctx)
+
+static
+
+ +

Serialize a single-level DDT (tableShift == 0) directly after its header.

+

For single-level DDT configurations the entire table of sector references is contiguous. This routine computes a CRC64 for the table, populates all header metadata, writes the header at ctx->primaryDdtOffset followed immediately by the table, and registers the block in the index.

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode with tableShift == 0.
+
+
+
Returns
AARUF_STATUS_OK on success; AARUF_ERROR_CANNOT_WRITE_HEADER if serialization fails. Returns AARUF_STATUS_OK without action when the context represents a multi-level DDT or the table buffers are NULL.
+
Return values
+ + + +
AARUF_STATUS_OKSuccess or nothing to do (not single-level / buffers missing).
AARUF_ERROR_CANNOT_WRITE_HEADERFailed writing header or table data.
+
+
+ +

Definition at line 369 of file close.c.

+ +

References aaruf_crc64_data(), AARUF_ERROR_CANNOT_WRITE_HEADER, AARUF_ERROR_NOT_ENOUGH_MEMORY, aaruf_lzma_encode_buffer(), AARUF_STATUS_OK, DdtHeader2::blockAlignmentShift, IndexEntry::blockType, DdtHeader2::cmpCrc64, DdtHeader2::cmpLength, DdtHeader2::compression, aaruformat_context::compression_enabled, DdtHeader2::crc64, IndexEntry::dataType, DeDuplicationTable2, DdtHeader2::entries, DdtHeader2::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, DdtHeader2::length, DdtHeader2::levels, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, None, IndexEntry::offset, DdtHeader2::previousLevelOffset, DdtHeader2::tableLevel, DdtHeader2::tableShift, TRACE, DdtHeader2::type, aaruformat_context::user_data_ddt2, aaruformat_context::user_data_ddt_header, and UserData.

+ +

Referenced by aaruf_close(), and write_tape_ddt().

+ +
+
+ +

◆ write_tape_ddt()

+ +
+
+ + + + + +
+ + + + + + + +
int32_t write_tape_ddt (aaruformat_context * ctx)
+
+static
+
+ +

Converts tape DDT hash table to array format and writes it as a single-level DDT.

+

This function is specifically designed for tape media images where sectors have been tracked using a sparse hash table (UTHASH) during write operations. It converts the hash-based tape DDT into a traditional array-based DDT structure suitable for serialization to disk. The function performs a complete transformation from the sparse hash representation to a dense array representation, then delegates the actual write operation to write_single_level_ddt().

+

The conversion process involves:

    +
  1. Validating the context is for tape media
  2. +
  3. Scanning the hash table to determine the maximum sector address (key)
  4. +
  5. Allocating a contiguous array large enough to hold all entries up to max_key
  6. +
  7. Populating the array by copying hash table entries to their corresponding indices
  8. +
  9. Initializing a DDT v2 header with appropriate metadata
  10. +
  11. Calling write_single_level_ddt() to serialize the DDT to disk
  12. +
+

Hash Table to Array Conversion: The tape DDT hash table uses sector addresses as keys and DDT entries as values. This function creates a zero-initialized array of size (max_key + 1) and copies each hash entry to array[entry->key] = entry->value. Sectors not present in the hash table remain as zero entries in the array, which indicates SectorStatusNotDumped in the DDT format.

+

Memory Allocation: The function always uses BigDdtSizeType (32-bit entries) for tape DDTs, allocating (max_key + 1) * sizeof(uint32_t) bytes. This provides sufficient capacity for the 28-bit data + 4-bit status encoding used in tape DDT entries.

+

DDT Header Configuration: The userDataDdtHeader is configured for a single-level DDT v2 structure:

    +
  • identifier: DeDuplicationTable2
  • +
  • type: UserData
  • +
  • compression: Determined by ctx->compression_enabled (Lzma or None)
  • +
  • levels: 1 (single-level structure)
  • +
  • tableLevel: 0 (top-level table)
  • +
  • tableShift: 0 (no multi-level indirection)
  • +
  • sizeType: BigDdtSizeType (32-bit entries)
  • +
  • entries/blocks: max_key + 1
  • +
  • negative/overflow: 0 (not used for tape)
  • +
+
Parameters
+ + +
ctxPointer to the aaruformat context. Must not be NULL and must be in write mode. The context must have is_tape set to true and tapeDdt hash table populated. The ctx->userDataDdtBig array will be allocated and populated by this function. The ctx->userDataDdtHeader will be initialized with DDT metadata.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully converted and wrote the tape DDT. This occurs when:
    +
  • The context is valid and is_tape is true
  • +
  • Memory allocation for the DDT array succeeds
  • +
  • The hash table entries are successfully copied to the array
  • +
  • write_single_level_ddt() completes successfully
  • +
  • The DDT is written to disk and indexed
  • +
+
AARUF_STATUS_INVALID_CONTEXT(-2) The context is not for tape media. This occurs when:
    +
  • ctx->is_tape is false
  • +
  • This function was called for a disk/optical image instead of tape
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-6) Memory allocation failed. This occurs when:
    +
  • calloc() fails to allocate the userDataDdtBig array
  • +
  • Insufficient system memory for (max_key + 1) * 4 bytes
  • +
+
AARUF_ERROR_CANNOT_WRITE_HEADER(-8) Writing the DDT failed. This can occur when: +
+
+
+
Note
This function is only called during image finalization (aaruf_close) for tape images. It should not be called for disk or optical media images.
+
+Hash Table Iteration:
    +
  • Uses HASH_ITER macro from UTHASH to safely traverse all entries
  • +
  • Finds maximum key in first pass to determine array size
  • +
  • Copies entries in second pass to populate the array
  • +
  • Empty (zero) array slots represent sectors not written to tape
  • +
+
+
+Memory Ownership:
    +
  • Allocates ctx->userDataDdtBig which becomes owned by the context
  • +
  • The allocated array is freed during context cleanup (not in this function)
  • +
  • The original hash table (ctx->tapeDdt) is freed separately during cleanup
  • +
+
+
+Single-Level DDT Choice:
    +
  • Tape DDTs always use single-level structure (tableShift = 0)
  • +
  • Multi-level DDTs are not used because tape access patterns are typically sparse
  • +
  • The hash table already provides efficient sparse storage during write
  • +
  • Conversion to dense array only happens once at close time
  • +
+
+
+Compression:
    +
  • The actual compression is handled by write_single_level_ddt()
  • +
  • Compression type is determined by ctx->compression_enabled flag
  • +
  • If enabled, LZMA compression is applied to the DDT array
  • +
  • Compression may be disabled if it doesn't reduce size
  • +
+
+
Warning
The function assumes tapeDdt hash table is properly populated. An empty hash table will result in a DDT with a single zero entry (max_key = 0, entries = 1).
+
+This function modifies ctx->userDataDdtHeader and ctx->userDataDdtBig. These must not be modified by other code during the close operation.
+
+The allocated array size is (max_key + 1), which could be very large if tape sectors have high addresses with sparse distribution. Memory usage should be considered.
+
See also
set_ddt_tape() for how entries are added to the hash table during write operations
+
+write_single_level_ddt() for the actual DDT serialization logic
+
+TapeDdtHashEntry for the hash table entry structure
+ +

Definition at line 596 of file close.c.

+ +

References AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_STATUS_INVALID_CONTEXT, DdtHeader2::blocks, DdtHeader2::cmpLength, DdtHeader2::compression, aaruformat_context::compression_enabled, DeDuplicationTable2, DdtHeader2::entries, DdtHeader2::identifier, aaruformat_context::is_tape, TapeDdtHashEntry::key, DdtHeader2::length, DdtHeader2::levels, Lzma, DdtHeader2::negative, None, DdtHeader2::overflow, DdtHeader2::previousLevelOffset, DdtHeader2::start, DdtHeader2::tableLevel, DdtHeader2::tableShift, aaruformat_context::tape_ddt, TRACE, DdtHeader2::type, aaruformat_context::user_data_ddt2, aaruformat_context::user_data_ddt_header, UserData, TapeDdtHashEntry::value, and write_single_level_ddt().

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_tape_file_block()

+ +
+
+ + + + + +
+ + + + + + + +
void write_tape_file_block (const aaruformat_context * ctx)
+
+static
+
+ +

Serialize the tape file metadata block to the image file.

+

This function writes a TapeFileBlock containing the complete tape file structure metadata to the Aaru image file. The tape file block documents all logical files present on the tape medium, recording each file's partition number, file number, and block range (first and last block addresses). This metadata enables random access to specific files within the tape image and preserves the original tape's logical organization for archival purposes.

+

The tape file block is optional; if no tape file metadata has been populated (ctx->tapeFiles hash table is NULL or empty), the function returns immediately without writing anything. This no-op behavior allows the close operation to proceed gracefully whether or not tape file structure metadata was included during image creation.

+

Block Structure: The serialized block consists of:

+-------------------------+
+
| TapeFileHeader (24 B) | <- identifier, entries, length, crc64
+
+-------------------------+
+
| TapeFileEntry 0 (21 B) | <- File, Partition, FirstBlock, LastBlock
+
| TapeFileEntry 1 (21 B) |
+
| ... |
+
| TapeFileEntry (n-1) |
+
+-------------------------+
+
Describes a single logical file on a tape medium.
Definition tape.h:134
+
struct TapeFileHeader TapeFileHeader
+
struct TapeFileEntry TapeFileEntry
+

Processing Flow:

    +
  1. Entry Enumeration: Iterate through ctx->tapeFiles hash table to count entries
  2. +
  3. Buffer Allocation: Allocate temporary buffer for all TapeFileEntry structures
  4. +
  5. Data Copying: Copy each file entry from hash table to buffer sequentially
  6. +
  7. Header Construction: Build TapeFileHeader with entry count and CRC64 checksum
  8. +
  9. Alignment: Seek to EOF and align to block boundary (blockAlignmentShift)
  10. +
  11. Write Operations: Write header followed by entry array to image stream
  12. +
  13. Indexing: Add IndexEntry pointing to this block for fast location during reads
  14. +
  15. Cleanup: Free temporary buffer
  16. +
+

Hash Table Iteration: The function uses UTHASH's HASH_ITER macro to safely traverse ctx->tapeFiles:

    +
  • First pass: Count total entries in the hash table
  • +
  • Second pass: Copy each TapeFileEntry to the output buffer
  • +
  • The iteration order depends on hash table internals, not insertion order
  • +
  • For deterministic output, entries could be sorted before writing (not currently done)
  • +
+

CRC64 Integrity Protection: A CRC64-ECMA checksum is computed over the complete array of TapeFileEntry structures using aaruf_crc64_data(). This checksum is stored in the TapeFileHeader and verified during image opening by process_tape_files_block() to detect corruption in the file table. The checksum covers only the entry data, not the header itself.

+

Alignment Strategy: Before writing, the file position is:

    +
  1. Moved to EOF using fseek(SEEK_END)
  2. +
  3. Aligned forward to next boundary: (position + alignment_mask) & ~alignment_mask
  4. +
  5. Where alignment_mask = (1 << blockAlignmentShift) - 1 This ensures the tape file block starts on a properly aligned offset for efficient I/O and compliance with the Aaru format specification.
  6. +
+

Write Sequence: The function performs a two-stage write operation:

    +
  1. Write TapeFileHeader (sizeof(TapeFileHeader) = 24 bytes)
  2. +
  3. Write TapeFileEntry array (tape_file_block.length bytes)
  4. +
+

Both writes must succeed for the index entry to be added. If either write fails, the block is incomplete but the function continues (no error propagation).

+

Indexing: On successful write, an IndexEntry is created and pushed to ctx->indexEntries:

    +
  • blockType = TapeFileBlock (identifies this as tape file metadata)
  • +
  • dataType = 0 (tape file blocks have no subtype)
  • +
  • offset = file position where TapeFileHeader was written
  • +
+

This index entry enables process_tape_files_block() to quickly locate the tape file metadata during subsequent image opens without scanning the entire file.

+

Entry Order: The current implementation writes entries in hash table iteration order, which is non-deterministic and depends on the hash function and insertion sequence. For better compatibility and reproducibility, entries should ideally be sorted by:

    +
  1. Partition number (ascending)
  2. +
  3. File number within partition (ascending) However, the current implementation does not enforce this ordering.
  4. +
+

Error Handling: The function handles errors gracefully without propagating them:

    +
  • NULL hash table: Return immediately (no tape files to write)
  • +
  • Memory allocation failure: Log via TRACE and return (block not written)
  • +
  • Write failures: Silent (index entry not added, block incomplete)
  • +
+

This opportunistic approach ensures that tape file metadata write failures do not prevent the image from being created, though the resulting image will lack file structure metadata.

+

Memory Management:

    +
  • Allocates temporary buffer sized to hold all TapeFileEntry structures
  • +
  • Buffer is zero-initialized with memset for consistent padding bytes
  • +
  • Buffer is always freed before the function returns, even on write failure
  • +
  • Source data in ctx->tapeFiles is not modified and is freed later during cleanup
  • +
+

Thread Safety: This function is NOT thread-safe. It modifies shared ctx state (imageStream file position, indexEntries array) and must only be called during single-threaded finalization (within aaruf_close).

+

Use Cases:

    +
  • Preserving tape file structure for archival and forensic purposes
  • +
  • Enabling random access to specific files within tape images
  • +
  • Documenting multi-file tape organization for analysis tools
  • +
  • Supporting tape formats with complex file/partition layouts
  • +
  • Facilitating tape image validation and structure verification
  • +
+

Relationship to Other Functions:

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode. Must not be NULL. The tapeFiles hash table should be populated if tape file metadata exists. The imageStream must be open and writable. The indexEntries array must be initialized for adding the index entry.
+
+
+
Note
The tape file block is written near the end of the image file, after sector data and before the final index block. The exact position depends on what other metadata blocks are present in the image.
+
+If ctx->tapeFiles is NULL or empty, the function returns immediately without writing anything. This is not an error condition - it simply means the image contains no tape file structure metadata.
+
+Memory allocation failure during buffer creation results in no tape file block being written, but does not prevent the image from being successfully created. The image will simply lack tape file metadata.
+
+The TapeFileHeader.entries field is intentionally set to tape_file_count, not stored separately. The count is derived dynamically from the hash table size.
+
+Entry ordering is not guaranteed to match insertion order or logical order. Reading applications should sort entries by partition/file number if ordered access is required.
+
Warning
Write failures (fwrite returns != 1) are silently ignored. The function does not return an error code or set errno. Partial writes may leave the block incomplete, which will be detected during subsequent reads via CRC mismatch.
+
+The temporary buffer allocation may fail on systems with limited memory or when the tape has an extremely large number of files. Allocation failures result in silent no-op; the image is created without tape file metadata.
+
+Bounds checking during iteration protects against buffer overruns. If index exceeds tape_file_count (which should never occur), the loop breaks early as a sanity check.
+
See also
TapeFileHeader for the block header structure definition
+
+TapeFileEntry for individual file entry structure definition
+
+tapeFileHashEntry for the hash table entry structure
+
+aaruf_set_tape_file() for adding tape files during image creation
+
+process_tape_files_block() for the loading process during image opening
+
+aaruf_get_tape_file() for retrieving tape file information from opened images
+ +

Definition at line 2669 of file close.c.

+ +

References aaruf_crc64_data(), DdtHeader2::blockAlignmentShift, IndexEntry::blockType, TapeFileHeader::crc64, IndexEntry::dataType, TapeFileHashEntry::fileEntry, TapeFileHeader::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, TapeFileHeader::length, IndexEntry::offset, aaruformat_context::tape_files, TapeFileBlock, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_tape_partition_block()

+ +
+
+ + + + + +
+ + + + + + + +
void write_tape_partition_block (const aaruformat_context * ctx)
+
+static
+
+ +

Serialize the tape partition metadata block to the image file.

+

This function writes a TapePartitionBlock containing the complete tape partition structure metadata to the Aaru image file. The tape partition block documents all physical partitions present on the tape medium, recording each partition's partition number and block range (first and last block addresses). This metadata enables proper interpretation of tape file locations, validation of partition boundaries, and preservation of the original tape's physical organization for archival purposes.

+

The tape partition block is optional; if no tape partition metadata has been populated (ctx->tapePartitions hash table is NULL or empty), the function returns immediately without writing anything. This no-op behavior allows the close operation to proceed gracefully whether or not tape partition structure metadata was included during image creation.

+

Block Structure: The serialized block consists of:

+-----------------------------+
+
| TapePartitionHeader (24 B) | <- identifier, entries, length, crc64
+
+-----------------------------+
+
| TapePartitionEntry 0 (17 B) | <- Number, FirstBlock, LastBlock
+
| TapePartitionEntry 1 (17 B) |
+
| ... |
+ +
+-----------------------------+
+
Describes a single physical partition on a tape medium.
Definition tape.h:320
+
struct TapePartitionHeader TapePartitionHeader
+
struct TapePartitionEntry TapePartitionEntry
+

Processing Flow:

    +
  1. Entry Enumeration: Iterate through ctx->tapePartitions hash table to count entries
  2. +
  3. Buffer Allocation: Allocate temporary buffer for all TapePartitionEntry structures
  4. +
  5. Data Copying: Copy each partition entry from hash table to buffer sequentially
  6. +
  7. Header Construction: Build TapePartitionHeader with entry count and CRC64 checksum
  8. +
  9. Alignment: Seek to EOF and align to block boundary (blockAlignmentShift)
  10. +
  11. Write Operations: Write header followed by entry array to image stream
  12. +
  13. Indexing: Add IndexEntry pointing to this block for fast location during reads
  14. +
  15. Cleanup: Free temporary buffer
  16. +
+

Hash Table Iteration: The function uses UTHASH's HASH_ITER macro to safely traverse ctx->tapePartitions:

    +
  • First pass: Count total entries in the hash table
  • +
  • Second pass: Copy each TapePartitionEntry to the output buffer
  • +
  • The iteration order depends on hash table internals, not insertion order
  • +
  • For deterministic output, entries could be sorted by partition number (not currently done)
  • +
+

CRC64 Integrity Protection: A CRC64-ECMA checksum is computed over the complete array of TapePartitionEntry structures using aaruf_crc64_data(). This checksum is stored in the TapePartitionHeader and verified during image opening by process_tape_partitions_block() to detect corruption in the partition table. The checksum covers only the entry data, not the header itself.

+

Alignment Strategy: Before writing, the file position is:

    +
  1. Moved to EOF using fseek(SEEK_END)
  2. +
  3. Aligned forward to next boundary: (position + alignment_mask) & ~alignment_mask
  4. +
  5. Where alignment_mask = (1 << blockAlignmentShift) - 1 This ensures the tape partition block starts on a properly aligned offset for efficient I/O and compliance with the Aaru format specification.
  6. +
+

Write Sequence: The function performs a two-stage write operation:

    +
  1. Write TapePartitionHeader (sizeof(TapePartitionHeader) = 24 bytes)
  2. +
  3. Write TapePartitionEntry array (tape_partition_block.length bytes)
  4. +
+

Both writes must succeed for the index entry to be added. If either write fails, the block is incomplete but the function continues (no error propagation).

+

Indexing: On successful write, an IndexEntry is created and pushed to ctx->indexEntries:

    +
  • blockType = TapePartitionBlock (identifies this as tape partition metadata)
  • +
  • dataType = 0 (tape partition blocks have no subtype)
  • +
  • offset = file position where TapePartitionHeader was written
  • +
+

This index entry enables process_tape_partitions_block() to quickly locate the tape partition metadata during subsequent image opens without scanning the entire file.

+

Entry Order: The current implementation writes entries in hash table iteration order, which is non-deterministic and depends on the hash function and insertion sequence. For better compatibility and reproducibility, entries should ideally be sorted by partition number (ascending). However, the current implementation does not enforce this ordering.

+

Partition Block Ranges: Each partition entry defines an independent block address space:

    +
  • FirstBlock: Starting block address (often 0, but format-dependent)
  • +
  • LastBlock: Ending block address (inclusive)
  • +
  • Block count: (LastBlock - FirstBlock + 1)
  • +
+

Different partitions may have overlapping logical block numbers (e.g., partition 0 and partition 1 can both have blocks 0-1000). The partition metadata is essential for correctly interpreting tape file locations, as files reference partition numbers in their definitions.

+

Error Handling: The function handles errors gracefully without propagating them:

    +
  • NULL hash table: Return immediately (no tape partitions to write)
  • +
  • Memory allocation failure: Log via TRACE and return (block not written)
  • +
  • Write failures: Silent (index entry not added, block incomplete)
  • +
+

This opportunistic approach ensures that tape partition metadata write failures do not prevent the image from being created, though the resulting image will lack partition structure metadata.

+

Memory Management:

    +
  • Allocates temporary buffer sized to hold all TapePartitionEntry structures
  • +
  • Buffer is zero-initialized with memset for consistent padding bytes
  • +
  • Buffer is always freed before the function returns, even on write failure
  • +
  • Source data in ctx->tapePartitions is not modified and is freed later during cleanup
  • +
+

Thread Safety: This function is NOT thread-safe. It modifies shared ctx state (imageStream file position, indexEntries array) and must only be called during single-threaded finalization (within aaruf_close).

+

Use Cases:

    +
  • Preserving tape partition structure for archival and forensic purposes
  • +
  • Documenting multi-partition tape layouts (LTO, DLT, AIT formats)
  • +
  • Enabling validation of file block ranges against partition boundaries
  • +
  • Supporting tape formats with complex partition organizations
  • +
  • Facilitating tape image validation and structure verification
  • +
+

Relationship to Other Functions:

+

Format Considerations:

    +
  • Single-partition tapes: May omit TapePartitionBlock entirely (partition 0 implied)
  • +
  • Multi-partition tapes: Should include complete partition layout for proper file access
  • +
  • Block addresses are local to each partition in most tape formats
  • +
  • Partition metadata is primarily informational and used for validation
  • +
+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode. Must not be NULL. The tapePartitions hash table should be populated if tape partition metadata exists. The imageStream must be open and writable. The indexEntries array must be initialized for adding the index entry.
+
+
+
Note
The tape partition block is written near the end of the image file, after sector data and before the final index block. The exact position depends on what other metadata blocks are present in the image.
+
+If ctx->tapePartitions is NULL or empty, the function returns immediately without writing anything. This is not an error condition - it simply means the image contains no tape partition structure metadata (typical for single-partition tapes).
+
+Memory allocation failure during buffer creation results in no tape partition block being written, but does not prevent the image from being successfully created. The image will simply lack tape partition metadata.
+
+The partition metadata should be consistent with file metadata. Files should only reference partitions that have been defined, and their block ranges should fall within the partition boundaries, though no automatic validation is performed.
+
Warning
Write failures are not propagated as errors. If the write operation fails, the index entry is not added, but aaruf_close() continues with other finalization tasks. The resulting image may be incomplete or missing partition metadata.
+
See also
write_tape_file_block() for writing tape file metadata (which references partitions)
+
+process_tape_partitions_block() for reading partition metadata during image open
+
+aaruf_set_tape_partition() for adding partition entries during image creation
+
+TapePartitionHeader for the block header structure
+
+TapePartitionEntry for individual partition entry structure
+ +

Definition at line 2901 of file close.c.

+ +

References aaruf_crc64_data(), DdtHeader2::blockAlignmentShift, IndexEntry::blockType, TapePartitionHeader::crc64, IndexEntry::dataType, TapePartitionHeader::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, TapePartitionHeader::length, IndexEntry::offset, TapePartitionHashEntry::partitionEntry, aaruformat_context::tape_partitions, TapePartitionBlock, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+ +

◆ write_tracks_block()

+ +
+
+ + + + + +
+ + + + + + + +
void write_tracks_block (aaruformat_context * ctx)
+
+static
+
+ +

Serialize the tracks metadata block and add it to the index.

+

Writes a TracksHeader followed by the array of TrackEntry structures if any track entries are present (tracksHeader.entries > 0 and trackEntries not NULL). The block is aligned to the DDT block boundary and an IndexEntry is appended.

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode.
+
+
+ +

Definition at line 798 of file close.c.

+ +

References DdtHeader2::blockAlignmentShift, IndexEntry::blockType, IndexEntry::dataType, TracksHeader::entries, aaruformat_context::imageStream, aaruformat_context::index_entries, IndexEntry::offset, TRACE, aaruformat_context::track_entries, aaruformat_context::tracks_header, TracksBlock, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_close().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/close_8c.js b/docs/html/close_8c.js new file mode 100644 index 0000000..9461b7f --- /dev/null +++ b/docs/html/close_8c.js @@ -0,0 +1,27 @@ +var close_8c = +[ + [ "aaruf_close", "close_8c.html#a6823e139f81a9dfd08efcb0e9b213a49", null ], + [ "write_aaru_json_block", "close_8c.html#adbc2790344fae0327f55d751b79dd800", null ], + [ "write_cached_secondary_ddt", "close_8c.html#af0f89d22c6e2bdca261223bbdda7654c", null ], + [ "write_checksum_block", "close_8c.html#a84f08d3fe750b46dad183b12bb3927c5", null ], + [ "write_cicm_block", "close_8c.html#aa868077fc938ed2cdee85832a40ef821", null ], + [ "write_dumphw_block", "close_8c.html#a796034966c1e918152e652635431dc39", null ], + [ "write_dvd_long_sector_blocks", "close_8c.html#a13f6c475294969c1eb8c59ff53c91af9", null ], + [ "write_dvd_title_key_decrypted_block", "close_8c.html#af9269816dfd495bc6927e9463422df91", null ], + [ "write_geometry_block", "close_8c.html#a5e24a87e4dd5eb0cb9225be3e25c7ef3", null ], + [ "write_index_block", "close_8c.html#a3532372fac3d5bb2619900820a26632e", null ], + [ "write_media_tags", "close_8c.html#a458e1630d31726b91a54b514f34a9b37", null ], + [ "write_metadata_block", "close_8c.html#af36ba67be5e488713558202feef0eeef", null ], + [ "write_mode2_subheaders_block", "close_8c.html#ade7f81cbae198dbbea937551bf670a4f", null ], + [ "write_primary_ddt", "close_8c.html#a1bb181171eb9d0b0016cf4091ed831d7", null ], + [ "write_sector_prefix", "close_8c.html#af383051987456d1295862e395027ffa8", null ], + [ "write_sector_prefix_ddt", "close_8c.html#ae5ee36ba745233583773cd7a644c8aa7", null ], + [ "write_sector_subchannel", "close_8c.html#ae0a4b670cbb5359edd44751e1b76ca9c", null ], + [ "write_sector_suffix", "close_8c.html#a8ea54bc4597be4246f2be361a5854251", null ], + [ "write_sector_suffix_ddt", "close_8c.html#a9d0eb026d1fa544b554493e780b7fbc1", null ], + [ "write_single_level_ddt", "close_8c.html#a7314de0d71768709fa4ba2db7f89cdb9", null ], + [ "write_tape_ddt", "close_8c.html#aed9f90614002b887ae9f3ef2333de16a", null ], + [ "write_tape_file_block", "close_8c.html#afffa52af1d2da0e17edf3add326e36d9", null ], + [ "write_tape_partition_block", "close_8c.html#a82707f569a505107ab77c9c86502cf79", null ], + [ "write_tracks_block", "close_8c.html#aa2451e6c0fc8d4db3bfb9874f2ca990c", null ] +]; \ No newline at end of file diff --git a/docs/html/close_8c_source.html b/docs/html/close_8c_source.html new file mode 100644 index 0000000..77c7470 --- /dev/null +++ b/docs/html/close_8c_source.html @@ -0,0 +1,3119 @@ + + + + + + + +libaaruformat: src/close.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
close.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
36
+
37#include <errno.h>
+
38#include <stdio.h>
+
39#include <stdlib.h>
+
40
+
41#ifdef __linux__
+
42#include <sys/mman.h>
+
43#endif
+
44
+
45#include <aaruformat.h>
+
46
+
47#include "internal.h"
+
48#include "log.h"
+
49
+
+ +
78{
+
79 // Write cached secondary table to file end and update primary table entry with its position
+
80 // Check if we have a cached table that needs to be written (either it has an offset or exists in memory)
+
81 bool has_cached_secondary_ddt =
+
82 ctx->user_data_ddt_header.tableShift > 0 && (ctx->cached_ddt_offset != 0 || ctx->cached_secondary_ddt2 != NULL);
+
83
+
84 if(!has_cached_secondary_ddt) return AARUF_STATUS_OK;
+
85
+
86 TRACE("Writing cached secondary DDT table to file");
+
87
+
88 fseek(ctx->imageStream, 0, SEEK_END);
+
89 long end_of_file = ftell(ctx->imageStream);
+
90
+
91 // Align the position according to block alignment shift
+
92 uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
93 if(end_of_file & alignment_mask)
+
94 {
+
95 // Calculate the next aligned position
+
96 uint64_t aligned_position = end_of_file + alignment_mask & ~alignment_mask;
+
97
+
98 // Seek to the aligned position and pad with zeros if necessary
+
99 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
100 end_of_file = aligned_position;
+
101
+
102 TRACE("Aligned DDT write position from %ld to %" PRIu64 " (alignment shift: %d)",
+
103 ftell(ctx->imageStream) - (aligned_position - end_of_file), aligned_position,
+ +
105 }
+
106
+
107 // Prepare DDT header for the cached table
+
108 DdtHeader2 ddt_header = {0};
+ +
110 ddt_header.type = UserData;
+
111 ddt_header.compression = ctx->compression_enabled ? Lzma : None;
+
112 ddt_header.levels = ctx->user_data_ddt_header.levels;
+
113 ddt_header.tableLevel = ctx->user_data_ddt_header.tableLevel + 1;
+
114 ddt_header.previousLevelOffset = ctx->primary_ddt_offset;
+
115 ddt_header.negative = ctx->user_data_ddt_header.negative;
+
116 ddt_header.overflow = ctx->user_data_ddt_header.overflow;
+ +
118 ddt_header.dataShift = ctx->user_data_ddt_header.dataShift;
+
119 ddt_header.tableShift = 0; // Secondary tables are single level
+
120
+
121 uint64_t items_per_ddt_entry = 1 << ctx->user_data_ddt_header.tableShift;
+
122 ddt_header.blocks = items_per_ddt_entry;
+
123 ddt_header.entries = items_per_ddt_entry;
+
124 ddt_header.start = ctx->cached_ddt_position * items_per_ddt_entry;
+
125
+
126 // Calculate data size
+
127 ddt_header.length = items_per_ddt_entry * sizeof(uint64_t);
+
128
+
129 // Calculate CRC64 of the data
+
130 crc64_ctx *crc64_context = aaruf_crc64_init();
+
131 if(crc64_context != NULL)
+
132 {
+
133 aaruf_crc64_update(crc64_context, (uint8_t *)ctx->cached_secondary_ddt2, (uint32_t)ddt_header.length);
+
134
+
135 uint64_t crc64;
+
136 aaruf_crc64_final(crc64_context, &crc64);
+
137 ddt_header.crc64 = crc64;
+
138 }
+
139
+
140 uint8_t *buffer = NULL;
+
141 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
142
+
143 if(ddt_header.compression == None)
+
144 {
+
145 buffer = (uint8_t *)ctx->cached_secondary_ddt2;
+
146 ddt_header.cmpCrc64 = ddt_header.crc64;
+
147 }
+
148 else
+
149 {
+
150 buffer = malloc((size_t)ddt_header.length * 2); // Allocate double size for compression
+
151 if(buffer == NULL)
+
152 {
+
153 TRACE("Failed to allocate memory for secondary DDT v2 compression");
+ +
155 }
+
156
+
157 size_t dst_size = (size_t)ddt_header.length * 2 * 2;
+
158 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
159 aaruf_lzma_encode_buffer(buffer, &dst_size,
+
160
+
161 (uint8_t *)ctx->cached_secondary_ddt2, ddt_header.length, lzma_properties, &props_size,
+
162 9, ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
163
+
164 ddt_header.cmpLength = (uint32_t)dst_size;
+
165
+
166 if(ddt_header.cmpLength >= ddt_header.length)
+
167 {
+
168 ddt_header.compression = None;
+
169 free(buffer);
+
170 buffer = (uint8_t *)ctx->cached_secondary_ddt2;
+
171 }
+
172 }
+
173
+
174 if(ddt_header.compression == None)
+
175 {
+
176 ddt_header.cmpLength = ddt_header.length;
+
177 ddt_header.cmpCrc64 = ddt_header.crc64;
+
178 }
+
179 else
+
180 ddt_header.cmpCrc64 = aaruf_crc64_data(buffer, ddt_header.cmpLength);
+
181
+
182 if(ddt_header.compression == Lzma) ddt_header.cmpLength += LZMA_PROPERTIES_LENGTH;
+
183
+
184 // Write header
+
185 if(fwrite(&ddt_header, sizeof(DdtHeader2), 1, ctx->imageStream) == 1)
+
186 {
+
187 if(ddt_header.compression == Lzma) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
188
+
189 // Write data
+
190 if(fwrite(buffer, ddt_header.cmpLength, 1, ctx->imageStream) == 1)
+
191 {
+
192 // Update primary table entry to point to new location
+
193 const uint64_t new_secondary_table_block_offset =
+
194 end_of_file >> ctx->user_data_ddt_header.blockAlignmentShift;
+
195
+
196 ctx->user_data_ddt2[ctx->cached_ddt_position] = (uint64_t)new_secondary_table_block_offset;
+
197
+
198 // Update index: remove old entry for cached DDT and add new one
+
199 TRACE("Updating index for cached secondary DDT");
+
200
+
201 // Remove old index entry for the cached DDT
+
202 if(ctx->cached_ddt_offset != 0)
+
203 {
+
204 TRACE("Removing old index entry for DDT at offset %" PRIu64, ctx->cached_ddt_offset);
+
205 const IndexEntry *entry = NULL;
+
206
+
207 // Find and remove the old index entry
+
208 for(unsigned int k = 0; k < utarray_len(ctx->index_entries); k++)
+
209 {
+
210 entry = (IndexEntry *)utarray_eltptr(ctx->index_entries, k);
+
211 if(entry && entry->offset == ctx->cached_ddt_offset &&
+ +
213 {
+
214 TRACE("Found old DDT index entry at position %u, removing", k);
+
215 utarray_erase(ctx->index_entries, k, 1);
+
216 break;
+
217 }
+
218 }
+
219 }
+
220
+
221 // Add new index entry for the newly written secondary DDT
+
222 IndexEntry new_ddt_entry;
+ +
224 new_ddt_entry.dataType = UserData;
+
225 new_ddt_entry.offset = end_of_file;
+
226
+
227 utarray_push_back(ctx->index_entries, &new_ddt_entry);
+
228 TRACE("Added new DDT index entry at offset %" PRIu64, end_of_file);
+
229
+
230 // Write the updated primary table back to its original position in the file
+
231 long saved_pos = ftell(ctx->imageStream);
+
232 fseek(ctx->imageStream, ctx->primary_ddt_offset + sizeof(DdtHeader2), SEEK_SET);
+
233
+
234 size_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint64_t);
+
235
+
236 size_t primary_written_bytes = 0;
+
237 primary_written_bytes = fwrite(ctx->user_data_ddt2, primary_table_size, 1, ctx->imageStream);
+
238
+
239 if(primary_written_bytes != 1)
+
240 {
+
241 TRACE("Could not flush primary DDT table to file.");
+ +
243 }
+
244
+
245 fseek(ctx->imageStream, saved_pos, SEEK_SET);
+
246 }
+
247 else
+
248 TRACE("Failed to write cached secondary DDT data");
+
249 }
+
250 else
+
251 TRACE("Failed to write cached secondary DDT header");
+
252
+
253 // Free the cached table
+
254 free(ctx->cached_secondary_ddt2);
+
255 ctx->cached_secondary_ddt2 = NULL;
+
256 ctx->cached_ddt_offset = 0;
+
257
+
258 // Set position
+
259 fseek(ctx->imageStream, 0, SEEK_END);
+
260
+
261 if(ddt_header.compression == Lzma) free(buffer);
+
262
+
263 return AARUF_STATUS_OK;
+
264}
+
+
265
+
+ +
284{
+
285 // Write the cached primary DDT table back to its position in the file
+
286 if(ctx->user_data_ddt_header.tableShift <= 0 || ctx->user_data_ddt2 == NULL) return AARUF_STATUS_OK;
+
287
+
288 TRACE("Writing cached primary DDT table back to file");
+
289
+
290 // Calculate CRC64 of the primary DDT table data first
+
291 crc64_ctx *crc64_context = aaruf_crc64_init();
+
292 if(crc64_context != NULL)
+
293 {
+
294 size_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint64_t);
+
295
+
296 aaruf_crc64_update(crc64_context, (uint8_t *)ctx->user_data_ddt2, primary_table_size);
+
297
+
298 uint64_t crc64;
+
299 aaruf_crc64_final(crc64_context, &crc64);
+
300
+
301 // Properly populate all header fields for multi-level DDT primary table
+ + + +
305 // levels, tableLevel, previousLevelOffset, negative, overflow, blockAlignmentShift,
+
306 // dataShift, tableShift, sizeType, entries, blocks, start are already set during creation
+
307 ctx->user_data_ddt_header.crc64 = crc64;
+
308 ctx->user_data_ddt_header.cmpCrc64 = crc64;
+
309 ctx->user_data_ddt_header.length = primary_table_size;
+
310 ctx->user_data_ddt_header.cmpLength = primary_table_size;
+
311
+
312 TRACE("Calculated CRC64 for primary DDT: 0x%16lX", crc64);
+
313 }
+
314
+
315 // First write the DDT header
+
316 fseek(ctx->imageStream, ctx->primary_ddt_offset, SEEK_SET);
+
317
+
318 size_t headerWritten = fwrite(&ctx->user_data_ddt_header, sizeof(DdtHeader2), 1, ctx->imageStream);
+
319 if(headerWritten != 1)
+
320 {
+
321 TRACE("Failed to write primary DDT header to file");
+ +
323 }
+
324
+
325 // Then write the table data (position is already after the header)
+
326 size_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint64_t);
+
327
+
328 // Write the primary table data
+
329 size_t written_bytes = 0;
+
330 written_bytes = fwrite(ctx->user_data_ddt2, primary_table_size, 1, ctx->imageStream);
+
331
+
332 if(written_bytes == 1)
+
333 {
+
334 TRACE("Successfully wrote primary DDT header and table to file (%" PRIu64 " entries, %zu bytes)",
+
335 ctx->user_data_ddt_header.entries, primary_table_size);
+
336
+
337 // Add primary DDT to index
+
338 TRACE("Adding primary DDT to index");
+
339 IndexEntry primary_ddt_entry;
+
340 primary_ddt_entry.blockType = DeDuplicationTable2;
+
341 primary_ddt_entry.dataType = UserData;
+
342 primary_ddt_entry.offset = ctx->primary_ddt_offset;
+
343
+
344 utarray_push_back(ctx->index_entries, &primary_ddt_entry);
+
345 TRACE("Added primary DDT index entry at offset %" PRIu64, ctx->primary_ddt_offset);
+
346 }
+
347 else
+
348 TRACE("Failed to write primary DDT table to file");
+
349
+
350 return AARUF_STATUS_OK;
+
351}
+
+
352
+
+ +
370{
+
371 // Write the single level DDT table block aligned just after the header
+
372 if(ctx->user_data_ddt_header.tableShift != 0 || ctx->user_data_ddt2 == NULL) return AARUF_STATUS_OK;
+
373
+
374 TRACE("Writing single-level DDT table to file");
+
375
+
376 // Calculate CRC64 of the primary DDT table data
+
377 const size_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint64_t);
+
378
+
379 // Properly populate all header fields
+ + + +
383 ctx->user_data_ddt_header.levels = 1; // Single level
+
384 ctx->user_data_ddt_header.tableLevel = 0; // Top level
+
385 ctx->user_data_ddt_header.previousLevelOffset = 0; // No previous level for single-level DDT
+
386 // negative and overflow are already set during creation
+
387 // blockAlignmentShift, dataShift, tableShift, sizeType, entries, blocks, start are already set
+
388 ctx->user_data_ddt_header.length = primary_table_size;
+
389 ctx->user_data_ddt_header.cmpLength = primary_table_size;
+
390
+
391 ctx->user_data_ddt_header.crc64 = aaruf_crc64_data((uint8_t *)ctx->user_data_ddt2, primary_table_size);
+
392
+
393 TRACE("Calculated CRC64 for single-level DDT: 0x%16lX", ctx->user_data_ddt_header.crc64);
+
394
+
395 uint8_t *cmp_buffer = NULL;
+
396 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
397
+ +
399 {
+
400
+
401 cmp_buffer = (uint8_t *)ctx->user_data_ddt2;
+ +
403 }
+
404 else
+
405 {
+
406 cmp_buffer = malloc((size_t)ctx->user_data_ddt_header.length * 2); // Allocate double size for compression
+
407 if(cmp_buffer == NULL)
+
408 {
+
409 TRACE("Failed to allocate memory for secondary DDT v2 compression");
+ +
411 }
+
412
+
413 size_t dst_size = (size_t)ctx->user_data_ddt_header.length * 2 * 2;
+
414 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
415 aaruf_lzma_encode_buffer(cmp_buffer, &dst_size, (uint8_t *)ctx->user_data_ddt2,
+
416 ctx->user_data_ddt_header.length, lzma_properties, &props_size, 9, ctx->lzma_dict_size,
+
417 4, 0, 2, 273, 8);
+
418
+
419 ctx->user_data_ddt_header.cmpLength = (uint32_t)dst_size;
+
420
+ +
422 {
+ +
424 free(cmp_buffer);
+
425
+
426 cmp_buffer = (uint8_t *)ctx->user_data_ddt2;
+
427 }
+
428 }
+
429
+ +
431 {
+ + +
434 }
+
435 else
+ +
437 aaruf_crc64_data(cmp_buffer, (uint32_t)ctx->user_data_ddt_header.cmpLength);
+
438
+ +
440
+
441 // Write the DDT header first
+
442 fseek(ctx->imageStream, 0, SEEK_END);
+
443 long ddt_position = ftell(ctx->imageStream);
+
444 // Align index position to block boundary if needed
+
445 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
446 if(ddt_position & alignment_mask)
+
447 {
+
448 const uint64_t aligned_position = ddt_position + alignment_mask & ~alignment_mask;
+
449 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
450 ddt_position = aligned_position;
+
451 }
+
452
+
453 const size_t header_written = fwrite(&ctx->user_data_ddt_header, sizeof(DdtHeader2), 1, ctx->imageStream);
+
454 if(header_written != 1)
+
455 {
+
456 TRACE("Failed to write single-level DDT header to file");
+ +
458 }
+
459
+
460 // Write the primary table data
+
461 size_t written_bytes = 0;
+ +
463 fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
464
+
465 written_bytes = fwrite(cmp_buffer, ctx->user_data_ddt_header.cmpLength, 1, ctx->imageStream);
+
466
+
467 if(written_bytes == 1)
+
468 {
+
469 TRACE("Successfully wrote single-level DDT header and table to file (%" PRIu64
+
470 " entries, %zu bytes, %zu compressed bytes)",
+ +
472
+
473 // Add single-level DDT to index
+
474 TRACE("Adding single-level DDT to index");
+
475 IndexEntry single_ddt_entry;
+
476 single_ddt_entry.blockType = DeDuplicationTable2;
+
477 single_ddt_entry.dataType = UserData;
+
478 single_ddt_entry.offset = ddt_position;
+
479
+
480 utarray_push_back(ctx->index_entries, &single_ddt_entry);
+
481 TRACE("Added single-level DDT index entry at offset %" PRIu64, ddt_position);
+
482 }
+
483 else
+
484 TRACE("Failed to write single-level DDT table data to file");
+
485
+
486 return AARUF_STATUS_OK;
+
487}
+
+
488
+
+ +
597{
+
598 if(!ctx->is_tape) return AARUF_STATUS_INVALID_CONTEXT;
+
599
+
600 // Traverse the tape DDT uthash and find the biggest key
+
601 uint64_t max_key = 0;
+
602 TapeDdtHashEntry *entry, *tmp;
+
603 HASH_ITER(hh, ctx->tape_ddt, entry, tmp)
+
604 if(entry->key > max_key) max_key = entry->key;
+
605
+
606 // Initialize context user data DDT header
+ + + +
610 ctx->user_data_ddt_header.levels = 1; // Single level
+
611 ctx->user_data_ddt_header.tableLevel = 0; // Top level
+
612 ctx->user_data_ddt_header.previousLevelOffset = 0; // No previous level for single-level DDT
+ + +
615 ctx->user_data_ddt_header.tableShift = 0; // Single level
+
616 ctx->user_data_ddt_header.entries = max_key + 1;
+
617 ctx->user_data_ddt_header.blocks = max_key + 1;
+ +
619 ctx->user_data_ddt_header.length = ctx->user_data_ddt_header.entries * sizeof(uint64_t);
+ +
621
+
622 // Initialize memory for user data DDT
+
623 ctx->user_data_ddt2 = calloc(ctx->user_data_ddt_header.entries, sizeof(uint64_t));
+
624 if(ctx->user_data_ddt2 == NULL)
+
625 {
+
626 TRACE("Failed to allocate memory for tape DDT table");
+ +
628 }
+
629
+
630 // Populate user data DDT from tape DDT uthash
+
631 HASH_ITER(hh, ctx->tape_ddt, entry, tmp)
+
632 if(entry->key < ctx->user_data_ddt_header.blocks) ctx->user_data_ddt2[entry->key] = entry->value;
+
633
+
634 // Do not repeat code
+
635 return write_single_level_ddt(ctx);
+
636}
+
+
637
+
+ +
655{
+
656 uint64_t alignment_mask;
+
657 uint64_t aligned_position;
+
658
+
659 // Finalize pending checksums
+
660 if(ctx->calculating_md5)
+
661 {
+
662 ctx->checksums.hasMd5 = true;
+ +
664 }
+
665 if(ctx->calculating_sha1)
+
666 {
+
667 ctx->checksums.hasSha1 = true;
+ +
669 }
+
670 if(ctx->calculating_sha256)
+
671 {
+
672 ctx->checksums.hasSha256 = true;
+ +
674 }
+
675 if(ctx->calculating_spamsum)
+
676 {
+
677 ctx->checksums.hasSpamSum = true;
+
678 ctx->checksums.spamsum = calloc(1, FUZZY_MAX_RESULT);
+ + +
681 }
+
682 if(ctx->calculating_blake3)
+
683 {
+
684 ctx->checksums.hasBlake3 = true;
+
685 blake3_hasher_finalize(ctx->blake3_context, ctx->checksums.blake3, BLAKE3_OUT_LEN);
+
686 free(ctx->blake3_context);
+
687 }
+
688
+
689 // Write the checksums block
+
690 bool has_checksums = ctx->checksums.hasMd5 || ctx->checksums.hasSha1 || ctx->checksums.hasSha256 ||
+ +
692
+
693 if(!has_checksums) return;
+
694
+
695 ChecksumHeader checksum_header = {0};
+
696 checksum_header.identifier = ChecksumBlock;
+
697
+
698 fseek(ctx->imageStream, 0, SEEK_END);
+
699 long checksum_position = ftell(ctx->imageStream);
+
700 // Align index position to block boundary if needed
+
701 alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
702 if(checksum_position & alignment_mask)
+
703 {
+
704 aligned_position = checksum_position + alignment_mask & ~alignment_mask;
+
705 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
706 checksum_position = aligned_position;
+
707 }
+
708
+
709 // Skip checksum_header
+
710 fseek(ctx->imageStream, sizeof(checksum_header), SEEK_CUR);
+
711
+
712 if(ctx->checksums.hasMd5)
+
713 {
+
714 TRACE("Writing MD5 checksum entry");
+
715 ChecksumEntry md5_entry = {0};
+
716 md5_entry.length = MD5_DIGEST_LENGTH;
+
717 md5_entry.type = Md5;
+
718 fwrite(&md5_entry, sizeof(ChecksumEntry), 1, ctx->imageStream);
+
719 fwrite(&ctx->checksums.md5, MD5_DIGEST_LENGTH, 1, ctx->imageStream);
+
720 checksum_header.length += sizeof(ChecksumEntry) + MD5_DIGEST_LENGTH;
+
721 checksum_header.entries++;
+
722 }
+
723
+
724 if(ctx->checksums.hasSha1)
+
725 {
+
726 TRACE("Writing SHA1 checksum entry");
+
727 ChecksumEntry sha1_entry = {0};
+
728 sha1_entry.length = SHA1_DIGEST_LENGTH;
+
729 sha1_entry.type = Sha1;
+
730 fwrite(&sha1_entry, sizeof(ChecksumEntry), 1, ctx->imageStream);
+
731 fwrite(&ctx->checksums.sha1, SHA1_DIGEST_LENGTH, 1, ctx->imageStream);
+
732 checksum_header.length += sizeof(ChecksumEntry) + SHA1_DIGEST_LENGTH;
+
733 checksum_header.entries++;
+
734 }
+
735
+
736 if(ctx->checksums.hasSha256)
+
737 {
+
738 TRACE("Writing SHA256 checksum entry");
+
739 ChecksumEntry sha256_entry = {0};
+
740 sha256_entry.length = SHA256_DIGEST_LENGTH;
+
741 sha256_entry.type = Sha256;
+
742 fwrite(&sha256_entry, sizeof(ChecksumEntry), 1, ctx->imageStream);
+
743 fwrite(&ctx->checksums.sha256, SHA256_DIGEST_LENGTH, 1, ctx->imageStream);
+
744 checksum_header.length += sizeof(ChecksumEntry) + SHA256_DIGEST_LENGTH;
+
745 checksum_header.entries++;
+
746 }
+
747
+
748 if(ctx->checksums.hasSpamSum)
+
749 {
+
750 TRACE("Writing SpamSum checksum entry");
+
751 ChecksumEntry spamsum_entry = {0};
+
752 spamsum_entry.length = strlen((const char *)ctx->checksums.spamsum);
+
753 spamsum_entry.type = SpamSum;
+
754 fwrite(&spamsum_entry, sizeof(ChecksumEntry), 1, ctx->imageStream);
+
755 fwrite(ctx->checksums.spamsum, spamsum_entry.length, 1, ctx->imageStream);
+
756 checksum_header.length += sizeof(ChecksumEntry) + spamsum_entry.length;
+
757 checksum_header.entries++;
+
758 }
+
759
+
760 if(ctx->checksums.hasBlake3)
+
761 {
+
762 TRACE("Writing BLAKE3 checksum entry");
+
763 ChecksumEntry blake3_entry = {0};
+
764 blake3_entry.length = BLAKE3_OUT_LEN;
+
765 blake3_entry.type = Blake3;
+
766 fwrite(&blake3_entry, sizeof(ChecksumEntry), 1, ctx->imageStream);
+
767 fwrite(&ctx->checksums.blake3, BLAKE3_OUT_LEN, 1, ctx->imageStream);
+
768 checksum_header.length += sizeof(ChecksumEntry) + BLAKE3_OUT_LEN;
+
769 checksum_header.entries++;
+ +
771 }
+
772
+
773 fseek(ctx->imageStream, checksum_position, SEEK_SET);
+
774 TRACE("Writing checksum header");
+
775 fwrite(&checksum_header, sizeof(ChecksumHeader), 1, ctx->imageStream);
+
776
+
777 // Add checksum block to index
+
778 TRACE("Adding checksum block to index");
+
779 IndexEntry checksum_index_entry;
+
780 checksum_index_entry.blockType = ChecksumBlock;
+
781 checksum_index_entry.dataType = 0;
+
782 checksum_index_entry.offset = checksum_position;
+
783
+
784 utarray_push_back(ctx->index_entries, &checksum_index_entry);
+
785 TRACE("Added checksum block index entry at offset %" PRIu64, checksum_position);
+
786}
+
+
787
+
+ +
799{
+
800 // Write tracks block
+
801 if(ctx->tracks_header.entries <= 0 || ctx->track_entries == NULL) return;
+
802
+
803 fseek(ctx->imageStream, 0, SEEK_END);
+
804 long tracks_position = ftell(ctx->imageStream);
+
805 // Align index position to block boundary if needed
+
806 uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
807 if(tracks_position & alignment_mask)
+
808 {
+
809 uint64_t aligned_position = tracks_position + alignment_mask & ~alignment_mask;
+
810 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
811 tracks_position = aligned_position;
+
812 }
+
813
+
814 TRACE("Writing tracks block at position %ld", tracks_position);
+
815 // Write header
+
816 if(fwrite(&ctx->tracks_header, sizeof(TracksHeader), 1, ctx->imageStream) == 1)
+
817 {
+
818 // Write entries
+
819 size_t written_entries =
+
820 fwrite(ctx->track_entries, sizeof(TrackEntry), ctx->tracks_header.entries, ctx->imageStream);
+
821
+
822 if(written_entries == ctx->tracks_header.entries)
+
823 {
+
824 TRACE("Successfully wrote tracks block with %u entries", ctx->tracks_header.entries);
+
825 // Add tracks block to index
+
826 TRACE("Adding tracks block to index");
+
827
+
828 IndexEntry tracks_index_entry;
+
829 tracks_index_entry.blockType = TracksBlock;
+
830 tracks_index_entry.dataType = 0;
+
831 tracks_index_entry.offset = tracks_position;
+
832 utarray_push_back(ctx->index_entries, &tracks_index_entry);
+
833 TRACE("Added tracks block index entry at offset %" PRIu64, tracks_position);
+
834 }
+
835 }
+
836}
+
+
837
+
+ +
851{
+
852 // Write MODE 2 subheader data block
+
853 if(ctx->mode2_subheaders == NULL) return;
+
854
+
855 fseek(ctx->imageStream, 0, SEEK_END);
+
856 long mode2_subheaders_position = ftell(ctx->imageStream);
+
857 // Align index position to block boundary if needed
+
858 uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
859 if(mode2_subheaders_position & alignment_mask)
+
860 {
+
861 uint64_t aligned_position = mode2_subheaders_position + alignment_mask & ~alignment_mask;
+
862 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
863 mode2_subheaders_position = aligned_position;
+
864 }
+
865
+
866 TRACE("Writing MODE 2 subheaders block at position %ld", mode2_subheaders_position);
+
867 BlockHeader subheaders_block = {0};
+
868 subheaders_block.identifier = DataBlock;
+
869 subheaders_block.type = CompactDiscMode2Subheader;
+
870 subheaders_block.compression = ctx->compression_enabled ? Lzma : None;
+
871 subheaders_block.length =
+ +
873 8;
+
874
+
875 // Calculate CRC64
+
876 subheaders_block.crc64 = aaruf_crc64_data(ctx->mode2_subheaders, subheaders_block.length);
+
877
+
878 uint8_t *buffer = NULL;
+
879 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
880
+
881 if(subheaders_block.compression == None)
+
882 {
+
883 buffer = ctx->mode2_subheaders;
+
884 subheaders_block.cmpCrc64 = subheaders_block.crc64;
+
885 }
+
886 else
+
887 {
+
888 buffer = malloc((size_t)subheaders_block.length * 2); // Allocate double size for compression
+
889 if(buffer == NULL)
+
890 {
+
891 TRACE("Failed to allocate memory for MODE 2 subheaders compression");
+
892 return;
+
893 }
+
894
+
895 size_t dst_size = (size_t)subheaders_block.length * 2 * 2;
+
896 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
897 aaruf_lzma_encode_buffer(buffer, &dst_size, ctx->mode2_subheaders, subheaders_block.length, lzma_properties,
+
898 &props_size, 9, ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
899
+
900 subheaders_block.cmpLength = (uint32_t)dst_size;
+
901
+
902 if(subheaders_block.cmpLength >= subheaders_block.length)
+
903 {
+
904 subheaders_block.compression = None;
+
905 free(buffer);
+
906 buffer = ctx->mode2_subheaders;
+
907 }
+
908 }
+
909
+
910 if(subheaders_block.compression == None)
+
911 {
+
912 subheaders_block.cmpLength = subheaders_block.length;
+
913 subheaders_block.cmpCrc64 = subheaders_block.crc64;
+
914 }
+
915 else
+
916 subheaders_block.cmpCrc64 = aaruf_crc64_data(buffer, subheaders_block.cmpLength);
+
917
+
918 if(subheaders_block.compression == Lzma) subheaders_block.cmpLength += LZMA_PROPERTIES_LENGTH;
+
919
+
920 // Write header
+
921 if(fwrite(&subheaders_block, sizeof(BlockHeader), 1, ctx->imageStream) == 1)
+
922 {
+
923 if(subheaders_block.compression == Lzma) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
924
+
925 // Write data
+
926 size_t written_bytes = fwrite(buffer, subheaders_block.cmpLength, 1, ctx->imageStream);
+
927 if(written_bytes == 1)
+
928 {
+
929 TRACE("Successfully wrote MODE 2 subheaders block (%" PRIu64 " bytes)", subheaders_block.cmpLength);
+
930 // Add MODE 2 subheaders block to index
+
931 TRACE("Adding MODE 2 subheaders block to index");
+
932 IndexEntry mode2_subheaders_index_entry;
+
933 mode2_subheaders_index_entry.blockType = DataBlock;
+
934 mode2_subheaders_index_entry.dataType = CompactDiscMode2Subheader;
+
935 mode2_subheaders_index_entry.offset = mode2_subheaders_position;
+
936 utarray_push_back(ctx->index_entries, &mode2_subheaders_index_entry);
+
937 TRACE("Added MODE 2 subheaders block index entry at offset %" PRIu64, mode2_subheaders_position);
+
938 }
+
939 }
+
940
+
941 if(subheaders_block.compression == Lzma) free(buffer);
+
942}
+
+
943
+
+ +
967{
+
968 if(ctx->sector_prefix == NULL) return;
+
969
+
970 fseek(ctx->imageStream, 0, SEEK_END);
+
971 long prefix_position = ftell(ctx->imageStream);
+
972 // Align index position to block boundary if needed
+
973 uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
974 if(prefix_position & alignment_mask)
+
975 {
+
976 uint64_t aligned_position = prefix_position + alignment_mask & ~alignment_mask;
+
977 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
978 prefix_position = aligned_position;
+
979 }
+
980
+
981 TRACE("Writing sector prefix block at position %ld", prefix_position);
+
982 BlockHeader prefix_block = {0};
+
983 prefix_block.identifier = DataBlock;
+
984 prefix_block.type = CdSectorPrefix;
+
985 prefix_block.compression = ctx->compression_enabled ? Lzma : None;
+
986 prefix_block.length = (uint32_t)ctx->sector_prefix_offset;
+
987
+
988 // Calculate CRC64
+
989 prefix_block.crc64 = aaruf_crc64_data(ctx->sector_prefix, prefix_block.length);
+
990
+
991 uint8_t *buffer = NULL;
+
992 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
993
+
994 if(prefix_block.compression == None)
+
995 {
+
996 buffer = ctx->sector_prefix;
+
997 prefix_block.cmpCrc64 = prefix_block.crc64;
+
998 }
+
999 else
+
1000 {
+
1001 buffer = malloc((size_t)prefix_block.length * 2); // Allocate double size for compression
+
1002 if(buffer == NULL)
+
1003 {
+
1004 TRACE("Failed to allocate memory for CD sector prefix compression");
+
1005 return;
+
1006 }
+
1007
+
1008 size_t dst_size = (size_t)prefix_block.length * 2 * 2;
+
1009 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
1010 aaruf_lzma_encode_buffer(buffer, &dst_size, ctx->sector_prefix, prefix_block.length, lzma_properties,
+
1011 &props_size, 9, ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
1012
+
1013 prefix_block.cmpLength = (uint32_t)dst_size;
+
1014
+
1015 if(prefix_block.cmpLength >= prefix_block.length)
+
1016 {
+
1017 prefix_block.compression = None;
+
1018 free(buffer);
+
1019 buffer = ctx->sector_prefix;
+
1020 }
+
1021 }
+
1022
+
1023 if(prefix_block.compression == None)
+
1024 {
+
1025 prefix_block.cmpLength = prefix_block.length;
+
1026 prefix_block.cmpCrc64 = prefix_block.crc64;
+
1027 }
+
1028 else
+
1029 prefix_block.cmpCrc64 = aaruf_crc64_data(buffer, prefix_block.cmpLength);
+
1030
+
1031 if(prefix_block.compression == Lzma) prefix_block.cmpLength += LZMA_PROPERTIES_LENGTH;
+
1032
+
1033 // Write header
+
1034 if(fwrite(&prefix_block, sizeof(BlockHeader), 1, ctx->imageStream) == 1)
+
1035 {
+
1036 if(prefix_block.compression == Lzma) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
1037
+
1038 // Write data
+
1039 const size_t written_bytes = fwrite(buffer, prefix_block.cmpLength, 1, ctx->imageStream);
+
1040 if(written_bytes == 1)
+
1041 {
+
1042 TRACE("Successfully wrote CD sector prefix block (%" PRIu64 " bytes)", prefix_block.cmpLength);
+
1043 // Add prefix block to index
+
1044 TRACE("Adding CD sector prefix block to index");
+
1045 IndexEntry prefix_index_entry;
+
1046 prefix_index_entry.blockType = DataBlock;
+
1047 prefix_index_entry.dataType = CdSectorPrefix;
+
1048 prefix_index_entry.offset = prefix_position;
+
1049 utarray_push_back(ctx->index_entries, &prefix_index_entry);
+
1050 TRACE("Added CD sector prefix block index entry at offset %" PRIu64, prefix_position);
+
1051 }
+
1052 }
+
1053
+
1054 if(prefix_block.compression == Lzma) free(buffer);
+
1055}
+
+
1056
+
+ +
1089{
+
1090 if(ctx->sector_suffix == NULL) return;
+
1091
+
1092 fseek(ctx->imageStream, 0, SEEK_END);
+
1093 long suffix_position = ftell(ctx->imageStream);
+
1094 // Align index position to block boundary if needed
+
1095 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
1096 if(suffix_position & alignment_mask)
+
1097 {
+
1098 const uint64_t aligned_position = suffix_position + alignment_mask & ~alignment_mask;
+
1099 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
1100 suffix_position = aligned_position;
+
1101 }
+
1102
+
1103 TRACE("Writing sector suffix block at position %ld", suffix_position);
+
1104 BlockHeader suffix_block = {0};
+
1105 suffix_block.identifier = DataBlock;
+
1106 suffix_block.type = CdSectorSuffix;
+
1107 suffix_block.compression = ctx->compression_enabled ? Lzma : None;
+
1108 suffix_block.length = (uint32_t)ctx->sector_suffix_offset;
+
1109
+
1110 // Calculate CRC64
+
1111 suffix_block.crc64 = aaruf_crc64_data(ctx->sector_suffix, suffix_block.length);
+
1112
+
1113 uint8_t *buffer = NULL;
+
1114 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
1115
+
1116 if(suffix_block.compression == None)
+
1117 {
+
1118 buffer = ctx->sector_suffix;
+
1119 suffix_block.cmpCrc64 = suffix_block.crc64;
+
1120 }
+
1121 else
+
1122 {
+
1123 buffer = malloc((size_t)suffix_block.length * 2); // Allocate double size for compression
+
1124 if(buffer == NULL)
+
1125 {
+
1126 TRACE("Failed to allocate memory for CD sector suffix compression");
+
1127 return;
+
1128 }
+
1129
+
1130 size_t dst_size = (size_t)suffix_block.length * 2 * 2;
+
1131 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
1132 aaruf_lzma_encode_buffer(buffer, &dst_size, ctx->sector_suffix, suffix_block.length, lzma_properties,
+
1133 &props_size, 9, ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
1134
+
1135 suffix_block.cmpLength = (uint32_t)dst_size;
+
1136
+
1137 if(suffix_block.cmpLength >= suffix_block.length)
+
1138 {
+
1139 suffix_block.compression = None;
+
1140 free(buffer);
+
1141 buffer = ctx->sector_suffix;
+
1142 }
+
1143 }
+
1144
+
1145 if(suffix_block.compression == None)
+
1146 {
+
1147 suffix_block.cmpLength = suffix_block.length;
+
1148 suffix_block.cmpCrc64 = suffix_block.crc64;
+
1149 }
+
1150 else
+
1151 suffix_block.cmpCrc64 = aaruf_crc64_data(buffer, suffix_block.cmpLength);
+
1152
+
1153 if(suffix_block.compression == Lzma) suffix_block.cmpLength += LZMA_PROPERTIES_LENGTH;
+
1154
+
1155 // Write header
+
1156 if(fwrite(&suffix_block, sizeof(BlockHeader), 1, ctx->imageStream) == 1)
+
1157 {
+
1158 if(suffix_block.compression == Lzma) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
1159
+
1160 // Write data
+
1161 const size_t written_bytes = fwrite(buffer, suffix_block.cmpLength, 1, ctx->imageStream);
+
1162 if(written_bytes == 1)
+
1163 {
+
1164 TRACE("Successfully wrote CD sector suffix block (%" PRIu64 " bytes)", suffix_block.cmpLength);
+
1165 // Add suffix block to index
+
1166 TRACE("Adding CD sector suffix block to index");
+
1167 IndexEntry suffix_index_entry;
+
1168 suffix_index_entry.blockType = DataBlock;
+
1169 suffix_index_entry.dataType = CdSectorSuffix;
+
1170 suffix_index_entry.offset = suffix_position;
+
1171 utarray_push_back(ctx->index_entries, &suffix_index_entry);
+
1172 TRACE("Added CD sector suffix block index entry at offset %" PRIu64, suffix_position);
+
1173 }
+
1174 }
+
1175
+
1176 if(suffix_block.compression == Lzma) free(buffer);
+
1177}
+
+
1178
+
+ +
1207{
+
1208 if(ctx->sector_prefix_ddt2 == NULL) return;
+
1209
+
1210 fseek(ctx->imageStream, 0, SEEK_END);
+
1211 long prefix_ddt_position = ftell(ctx->imageStream);
+
1212 // Align index position to block boundary if needed
+
1213 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
1214 if(prefix_ddt_position & alignment_mask)
+
1215 {
+
1216 const uint64_t aligned_position = prefix_ddt_position + alignment_mask & ~alignment_mask;
+
1217 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
1218 prefix_ddt_position = aligned_position;
+
1219 }
+
1220
+
1221 TRACE("Writing sector prefix DDT v2 at position %ld", prefix_ddt_position);
+
1222 DdtHeader2 ddt_header2 = {0};
+
1223 ddt_header2.identifier = DeDuplicationTable2;
+
1224 ddt_header2.type = CdSectorPrefix;
+
1225 ddt_header2.compression = ctx->compression_enabled ? Lzma : None;
+
1226 ddt_header2.levels = 1;
+
1227 ddt_header2.tableLevel = 0;
+
1228 ddt_header2.negative = ctx->user_data_ddt_header.negative;
+
1229 ddt_header2.overflow = ctx->user_data_ddt_header.overflow;
+ +
1231 ddt_header2.dataShift = ctx->user_data_ddt_header.dataShift;
+
1232 ddt_header2.tableShift = 0; // Single-level DDT
+
1233 ddt_header2.entries =
+ +
1235 ddt_header2.blocks = ctx->user_data_ddt_header.blocks;
+
1236 ddt_header2.start = 0;
+
1237 ddt_header2.length = ddt_header2.entries * sizeof(uint64_t);
+
1238 // Calculate CRC64
+
1239 ddt_header2.crc64 = aaruf_crc64_data((uint8_t *)ctx->sector_prefix_ddt2, (uint32_t)ddt_header2.length);
+
1240
+
1241 uint8_t *buffer = NULL;
+
1242 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
1243
+
1244 if(ddt_header2.compression == None)
+
1245 {
+
1246 buffer = (uint8_t *)ctx->sector_prefix_ddt2;
+
1247 ddt_header2.cmpCrc64 = ddt_header2.crc64;
+
1248 }
+
1249 else
+
1250 {
+
1251 buffer = malloc((size_t)ddt_header2.length * 2); // Allocate double size for compression
+
1252 if(buffer == NULL)
+
1253 {
+
1254 TRACE("Failed to allocate memory for sector prefix DDT v2 compression");
+
1255 return;
+
1256 }
+
1257
+
1258 size_t dst_size = (size_t)ddt_header2.length * 2 * 2;
+
1259 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
1260 aaruf_lzma_encode_buffer(buffer, &dst_size, (uint8_t *)ctx->sector_prefix_ddt2, ddt_header2.length,
+
1261 lzma_properties, &props_size, 9, ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
1262
+
1263 ddt_header2.cmpLength = (uint32_t)dst_size;
+
1264
+
1265 if(ddt_header2.cmpLength >= ddt_header2.length)
+
1266 {
+
1267 ddt_header2.compression = None;
+
1268 free(buffer);
+
1269 buffer = (uint8_t *)ctx->sector_prefix_ddt2;
+
1270 }
+
1271 }
+
1272
+
1273 if(ddt_header2.compression == None)
+
1274 {
+
1275 ddt_header2.cmpLength = ddt_header2.length;
+
1276 ddt_header2.cmpCrc64 = ddt_header2.crc64;
+
1277 }
+
1278 else
+
1279 ddt_header2.cmpCrc64 = aaruf_crc64_data(buffer, (uint32_t)ddt_header2.cmpLength);
+
1280
+
1281 if(ddt_header2.compression == Lzma) ddt_header2.cmpLength += LZMA_PROPERTIES_LENGTH;
+
1282
+
1283 // Write header
+
1284 if(fwrite(&ddt_header2, sizeof(DdtHeader2), 1, ctx->imageStream) == 1)
+
1285 {
+
1286 if(ddt_header2.compression == Lzma) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
1287
+
1288 // Write data
+
1289 const size_t written_bytes = fwrite(buffer, ddt_header2.cmpLength, 1, ctx->imageStream);
+
1290 if(written_bytes == 1)
+
1291 {
+
1292 TRACE("Successfully wrote sector prefix DDT v2 (%" PRIu64 " bytes)", ddt_header2.cmpLength);
+
1293 // Add prefix block to index
+
1294 TRACE("Adding sector prefix DDT v2 to index");
+
1295 IndexEntry prefix_ddt_index_entry;
+
1296 prefix_ddt_index_entry.blockType = DeDuplicationTable2;
+
1297 prefix_ddt_index_entry.dataType = CdSectorPrefix;
+
1298 prefix_ddt_index_entry.offset = prefix_ddt_position;
+
1299 utarray_push_back(ctx->index_entries, &prefix_ddt_index_entry);
+
1300 TRACE("Added sector prefix DDT v2 index entry at offset %" PRIu64, prefix_ddt_position);
+
1301 }
+
1302 }
+
1303
+
1304 if(ddt_header2.compression == Lzma) free(buffer);
+
1305}
+
+
1306
+
+ +
1351{
+
1352 if(ctx->sector_suffix_ddt2 == NULL) return;
+
1353
+
1354 fseek(ctx->imageStream, 0, SEEK_END);
+
1355 long suffix_ddt_position = ftell(ctx->imageStream);
+
1356 // Align index position to block boundary if needed
+
1357 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
1358 if(suffix_ddt_position & alignment_mask)
+
1359 {
+
1360 const uint64_t aligned_position = suffix_ddt_position + alignment_mask & ~alignment_mask;
+
1361 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
1362 suffix_ddt_position = aligned_position;
+
1363 }
+
1364
+
1365 TRACE("Writing sector suffix DDT v2 at position %ld", suffix_ddt_position);
+
1366 DdtHeader2 ddt_header2 = {0};
+
1367 ddt_header2.identifier = DeDuplicationTable2;
+
1368 ddt_header2.type = CdSectorSuffix;
+
1369 ddt_header2.compression = ctx->compression_enabled ? Lzma : None;
+
1370 ddt_header2.levels = 1;
+
1371 ddt_header2.tableLevel = 0;
+
1372 ddt_header2.negative = ctx->user_data_ddt_header.negative;
+
1373 ddt_header2.overflow = ctx->user_data_ddt_header.overflow;
+ +
1375 ddt_header2.dataShift = ctx->user_data_ddt_header.dataShift;
+
1376 ddt_header2.tableShift = 0; // Single-level DDT
+
1377 ddt_header2.entries =
+ +
1379 ddt_header2.blocks = ctx->user_data_ddt_header.blocks;
+
1380 ddt_header2.start = 0;
+
1381 ddt_header2.length = ddt_header2.entries * sizeof(uint64_t);
+
1382 // Calculate CRC64
+
1383 ddt_header2.crc64 = aaruf_crc64_data((uint8_t *)ctx->sector_suffix_ddt2, (uint32_t)ddt_header2.length);
+
1384
+
1385 uint8_t *buffer = NULL;
+
1386 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
1387
+
1388 if(ddt_header2.compression == None)
+
1389 {
+
1390 buffer = (uint8_t *)ctx->sector_suffix_ddt2;
+
1391 ddt_header2.cmpCrc64 = ddt_header2.crc64;
+
1392 }
+
1393 else
+
1394 {
+
1395 buffer = malloc((size_t)ddt_header2.length * 2); // Allocate double size for compression
+
1396 if(buffer == NULL)
+
1397 {
+
1398 TRACE("Failed to allocate memory for sector suffix DDT v2 compression");
+
1399 return;
+
1400 }
+
1401
+
1402 size_t dst_size = (size_t)ddt_header2.length * 2 * 2;
+
1403 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
1404 aaruf_lzma_encode_buffer(buffer, &dst_size, (uint8_t *)ctx->sector_suffix_ddt2, ddt_header2.length,
+
1405 lzma_properties, &props_size, 9, ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
1406
+
1407 ddt_header2.cmpLength = (uint32_t)dst_size;
+
1408
+
1409 if(ddt_header2.cmpLength >= ddt_header2.length)
+
1410 {
+
1411 ddt_header2.compression = None;
+
1412 free(buffer);
+
1413 buffer = (uint8_t *)ctx->sector_suffix_ddt2;
+
1414 }
+
1415 }
+
1416
+
1417 if(ddt_header2.compression == None)
+
1418 {
+
1419 ddt_header2.cmpLength = ddt_header2.length;
+
1420 ddt_header2.cmpCrc64 = ddt_header2.crc64;
+
1421 }
+
1422 else
+
1423 ddt_header2.cmpCrc64 = aaruf_crc64_data(buffer, (uint32_t)ddt_header2.cmpLength);
+
1424
+
1425 if(ddt_header2.compression == Lzma) ddt_header2.cmpLength += LZMA_PROPERTIES_LENGTH;
+
1426
+
1427 // Write header
+
1428 if(fwrite(&ddt_header2, sizeof(DdtHeader2), 1, ctx->imageStream) == 1)
+
1429 {
+
1430 if(ddt_header2.compression == Lzma) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
1431
+
1432 // Write data
+
1433 const size_t written_bytes = fwrite(buffer, ddt_header2.cmpLength, 1, ctx->imageStream);
+
1434 if(written_bytes == 1)
+
1435 {
+
1436 TRACE("Successfully wrote sector suffix DDT v2 (%" PRIu64 " bytes)", ddt_header2.cmpLength);
+
1437 // Add suffix block to index
+
1438 TRACE("Adding sector suffix DDT v2 to index");
+
1439 IndexEntry suffix_ddt_index_entry;
+
1440 suffix_ddt_index_entry.blockType = DeDuplicationTable2;
+
1441 suffix_ddt_index_entry.dataType = CdSectorSuffix;
+
1442 suffix_ddt_index_entry.offset = suffix_ddt_position;
+
1443 utarray_push_back(ctx->index_entries, &suffix_ddt_index_entry);
+
1444 TRACE("Added sector suffix DDT v2 index entry at offset %" PRIu64, suffix_ddt_position);
+
1445 }
+
1446 }
+
1447
+
1448 if(ddt_header2.compression == Lzma) free(buffer);
+
1449}
+
+
1450
+
+ +
1509{
+
1510 if(ctx->sector_subchannel == NULL) return;
+
1511
+
1512 fseek(ctx->imageStream, 0, SEEK_END);
+
1513 long block_position = ftell(ctx->imageStream);
+
1514 // Align index position to block boundary if needed
+
1515 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
1516 if(block_position & alignment_mask)
+
1517 {
+
1518 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
+
1519 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
1520 block_position = aligned_position;
+
1521 }
+
1522
+
1523 TRACE("Writing sector subchannel block at position %ld", block_position);
+
1524 BlockHeader subchannel_block = {0};
+
1525 subchannel_block.identifier = DataBlock;
+
1526 subchannel_block.compression = None;
+
1527
+
1528 uint8_t *buffer = ctx->sector_subchannel;
+
1529 bool owns_buffer = false;
+
1530 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
1531
+
1532 subchannel_block.cmpLength = subchannel_block.length;
+
1533
+ +
1535 {
+
1536 subchannel_block.type = CdSectorSubchannel;
+
1537 subchannel_block.length = (uint32_t)(ctx->user_data_ddt_header.negative + ctx->image_info.Sectors +
+ +
1539 96;
+
1540
+
1541 if(ctx->compression_enabled)
+
1542 {
+
1543 uint8_t *cst_buffer = malloc(subchannel_block.length);
+
1544
+
1545 if(cst_buffer == NULL)
+
1546 {
+
1547 TRACE("Failed to allocate memory for Claunia Subchannel Transform output");
+
1548 return;
+
1549 }
+
1550
+
1551 uint8_t *dst_buffer = malloc(subchannel_block.length);
+
1552
+
1553 if(dst_buffer == NULL)
+
1554 {
+
1555 TRACE("Failed to allocate memory for LZMA output");
+
1556 free(cst_buffer);
+
1557 return;
+
1558 }
+
1559
+
1560 aaruf_cst_transform(ctx->sector_subchannel, cst_buffer, subchannel_block.length);
+
1561 size_t dst_size = subchannel_block.length;
+
1562 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
1563
+
1564 aaruf_lzma_encode_buffer(dst_buffer, &dst_size, cst_buffer, subchannel_block.length, lzma_properties,
+
1565 &props_size, 9, ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
1566
+
1567 free(cst_buffer);
+
1568
+
1569 if(dst_size < subchannel_block.length)
+
1570 {
+ +
1572 subchannel_block.cmpLength = (uint32_t)dst_size;
+
1573 buffer = dst_buffer;
+
1574 owns_buffer = true;
+
1575 }
+
1576 else
+
1577 {
+
1578 subchannel_block.compression = None;
+
1579 free(dst_buffer);
+
1580 subchannel_block.cmpLength = subchannel_block.length;
+
1581 }
+
1582 }
+
1583 }
+
1584 else if(ctx->image_info.MetadataMediaType == BlockMedia)
+
1585 {
+
1586 switch(ctx->image_info.MediaType)
+
1587 {
+
1588 case AppleProfile:
+
1589 case AppleFileWare:
+
1590 subchannel_block.type = AppleProfileTag;
+
1591 subchannel_block.length = (uint32_t)(ctx->image_info.Sectors + ctx->user_data_ddt_header.overflow) * 20;
+
1592 break;
+
1593 case AppleSonyDS:
+
1594 case AppleSonySS:
+
1595 subchannel_block.type = AppleSonyTag;
+
1596 subchannel_block.length = (uint32_t)(ctx->image_info.Sectors + ctx->user_data_ddt_header.overflow) * 12;
+
1597 break;
+
1598 case PriamDataTower:
+
1599 subchannel_block.type = PriamDataTowerTag;
+
1600 subchannel_block.length = (uint32_t)(ctx->image_info.Sectors + ctx->user_data_ddt_header.overflow) * 24;
+
1601 break;
+
1602 default:
+
1603 TRACE("Incorrect media type, not writing sector subchannel block");
+
1604 return; // Incorrect media type
+
1605 }
+
1606 subchannel_block.compression = Lzma;
+
1607
+
1608 uint8_t *dst_buffer = malloc(subchannel_block.length);
+
1609
+
1610 if(dst_buffer == NULL)
+
1611 {
+
1612 TRACE("Failed to allocate memory for LZMA output");
+
1613 return;
+
1614 }
+
1615
+
1616 size_t dst_size = subchannel_block.length;
+
1617 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
1618
+
1619 aaruf_lzma_encode_buffer(dst_buffer, &dst_size, ctx->sector_subchannel, subchannel_block.length,
+
1620 lzma_properties, &props_size, 9, ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
1621
+
1622 if(dst_size < subchannel_block.length)
+
1623 {
+
1624 subchannel_block.cmpLength = (uint32_t)dst_size;
+
1625 buffer = dst_buffer;
+
1626 owns_buffer = true;
+
1627 }
+
1628 else
+
1629 {
+
1630 subchannel_block.compression = None;
+
1631 free(dst_buffer);
+
1632 subchannel_block.cmpLength = subchannel_block.length;
+
1633 }
+
1634 }
+
1635 else
+
1636 {
+
1637 TRACE("Incorrect media type, not writing sector subchannel block");
+
1638 return; // Incorrect media type
+
1639 }
+
1640
+
1641 // Calculate CRC64 for raw subchannel data and compressed payload when present
+
1642 subchannel_block.crc64 = aaruf_crc64_data(ctx->sector_subchannel, subchannel_block.length);
+
1643 if(subchannel_block.compression == None)
+
1644 subchannel_block.cmpCrc64 = subchannel_block.crc64;
+
1645 else
+
1646 subchannel_block.cmpCrc64 = aaruf_crc64_data(buffer, subchannel_block.cmpLength);
+
1647
+
1648 // Write header
+
1649 if(fwrite(&subchannel_block, sizeof(BlockHeader), 1, ctx->imageStream) == 1)
+
1650 {
+
1651 if(subchannel_block.compression != None) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
1652
+
1653 // Write data
+
1654 const size_t written_bytes = fwrite(buffer, subchannel_block.cmpLength, 1, ctx->imageStream);
+
1655 if(written_bytes == 1)
+
1656 {
+
1657 TRACE("Successfully wrote sector subchannel block (%" PRIu64 " bytes)", subchannel_block.cmpLength);
+
1658 // Add subchannel block to index
+
1659 TRACE("Adding sector subchannel block to index");
+
1660 IndexEntry subchannel_index_entry;
+
1661 subchannel_index_entry.blockType = DataBlock;
+
1662 subchannel_index_entry.dataType = subchannel_block.type;
+
1663 subchannel_index_entry.offset = block_position;
+
1664 utarray_push_back(ctx->index_entries, &subchannel_index_entry);
+
1665 TRACE("Added sector subchannel block index entry at offset %" PRIu64, block_position);
+
1666 }
+
1667 }
+
1668
+
1669 if(owns_buffer) free(buffer);
+
1670}
+
+
1671
+
+ +
1809{
+
1810 if(ctx->sector_id == NULL || ctx->sector_ied == NULL || ctx->sector_cpr_mai == NULL || ctx->sector_edc == NULL)
+
1811 return;
+
1812
+
1813 uint64_t total_sectors =
+ +
1815
+
1816 // Write DVD sector ID block
+
1817 fseek(ctx->imageStream, 0, SEEK_END);
+
1818 long id_position = ftell(ctx->imageStream);
+
1819 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
1820 if(id_position & alignment_mask)
+
1821 {
+
1822 const uint64_t aligned_position = id_position + alignment_mask & ~alignment_mask;
+
1823 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
1824 id_position = aligned_position;
+
1825 }
+
1826 TRACE("Writing DVD sector ID block at position %ld", id_position);
+
1827 BlockHeader id_block = {0};
+
1828 id_block.identifier = DataBlock;
+
1829 id_block.type = DvdSectorId;
+
1830 id_block.compression = ctx->compression_enabled ? Lzma : None;
+
1831 id_block.length = (uint32_t)total_sectors * 4;
+
1832
+
1833 // Calculate CRC64
+
1834 id_block.crc64 = aaruf_crc64_data(ctx->sector_id, id_block.length);
+
1835
+
1836 uint8_t *buffer = NULL;
+
1837 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
1838
+
1839 if(id_block.compression == None)
+
1840 {
+
1841 buffer = ctx->sector_id;
+
1842 id_block.cmpCrc64 = id_block.crc64;
+
1843 }
+
1844 else
+
1845 {
+
1846 buffer = malloc((size_t)id_block.length * 2); // Allocate double size for compression
+
1847 if(buffer == NULL)
+
1848 {
+
1849 TRACE("Failed to allocate memory for DVD sector ID compression");
+
1850 return;
+
1851 }
+
1852
+
1853 size_t dst_size = (size_t)id_block.length * 2 * 2;
+
1854 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
1855 aaruf_lzma_encode_buffer(buffer, &dst_size, ctx->sector_id, id_block.length, lzma_properties, &props_size, 9,
+
1856 ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
1857
+
1858 id_block.cmpLength = (uint32_t)dst_size;
+
1859
+
1860 if(id_block.cmpLength >= id_block.length)
+
1861 {
+
1862 id_block.compression = None;
+
1863 free(buffer);
+
1864 buffer = ctx->sector_id;
+
1865 }
+
1866 }
+
1867
+
1868 if(id_block.compression == None)
+
1869 {
+
1870 id_block.cmpLength = id_block.length;
+
1871 id_block.cmpCrc64 = id_block.crc64;
+
1872 }
+
1873 else
+
1874 id_block.cmpCrc64 = aaruf_crc64_data(buffer, id_block.cmpLength);
+
1875
+
1876 if(id_block.compression == Lzma) id_block.cmpLength += LZMA_PROPERTIES_LENGTH;
+
1877
+
1878 // Write header
+
1879 if(fwrite(&id_block, sizeof(BlockHeader), 1, ctx->imageStream) == 1)
+
1880 {
+
1881 if(id_block.compression == Lzma) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
1882
+
1883 // Write data
+
1884 const size_t written_bytes = fwrite(buffer, id_block.cmpLength, 1, ctx->imageStream);
+
1885 if(written_bytes == 1)
+
1886 {
+
1887 TRACE("Successfully wrote DVD sector ID block (%" PRIu64 " bytes)", id_block.cmpLength);
+
1888 // Add ID block to index
+
1889 TRACE("Adding DVD sector ID block to index");
+
1890 IndexEntry id_index_entry;
+
1891 id_index_entry.blockType = DataBlock;
+
1892 id_index_entry.dataType = DvdSectorId;
+
1893 id_index_entry.offset = id_position;
+
1894 utarray_push_back(ctx->index_entries, &id_index_entry);
+
1895 TRACE("Added DVD sector ID block index entry at offset %" PRIu64, id_position);
+
1896 }
+
1897 }
+
1898
+
1899 if(id_block.compression == Lzma) free(buffer);
+
1900
+
1901 // Write DVD sector IED block
+
1902 fseek(ctx->imageStream, 0, SEEK_END);
+
1903 long ied_position = ftell(ctx->imageStream);
+
1904 if(ied_position & alignment_mask)
+
1905 {
+
1906 const uint64_t aligned_position = ied_position + alignment_mask & ~alignment_mask;
+
1907 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
1908 ied_position = aligned_position;
+
1909 }
+
1910 TRACE("Writing DVD sector IED block at position %ld", ied_position);
+
1911 BlockHeader ied_block = {0};
+
1912 ied_block.identifier = DataBlock;
+
1913 ied_block.type = DvdSectorIed;
+
1914 ied_block.compression = ctx->compression_enabled ? Lzma : None;
+
1915 ied_block.length = (uint32_t)total_sectors * 2;
+
1916 // Calculate CRC64
+
1917 ied_block.crc64 = aaruf_crc64_data(ctx->sector_ied, ied_block.length);
+
1918
+
1919 buffer = NULL;
+
1920
+
1921 if(ied_block.compression == None)
+
1922 {
+
1923 buffer = ctx->sector_ied;
+
1924 ied_block.cmpCrc64 = ied_block.crc64;
+
1925 }
+
1926 else
+
1927 {
+
1928 buffer = malloc((size_t)ied_block.length * 2); // Allocate double size for compression
+
1929 if(buffer == NULL)
+
1930 {
+
1931 TRACE("Failed to allocate memory for DVD sector IED compression");
+
1932 return;
+
1933 }
+
1934
+
1935 size_t dst_size = (size_t)ied_block.length * 2 * 2;
+
1936 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
1937 aaruf_lzma_encode_buffer(buffer, &dst_size, ctx->sector_ied, ied_block.length, lzma_properties, &props_size, 9,
+
1938 ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
1939
+
1940 ied_block.cmpLength = (uint32_t)dst_size;
+
1941
+
1942 if(ied_block.cmpLength >= ied_block.length)
+
1943 {
+
1944 ied_block.compression = None;
+
1945 free(buffer);
+
1946 buffer = ctx->sector_ied;
+
1947 }
+
1948 }
+
1949
+
1950 if(ied_block.compression == None)
+
1951 {
+
1952 ied_block.cmpLength = ied_block.length;
+
1953 ied_block.cmpCrc64 = ied_block.crc64;
+
1954 }
+
1955 else
+
1956 ied_block.cmpCrc64 = aaruf_crc64_data(buffer, ied_block.cmpLength);
+
1957
+
1958 if(ied_block.compression == Lzma) ied_block.cmpLength += LZMA_PROPERTIES_LENGTH;
+
1959
+
1960 // Write header
+
1961 if(fwrite(&ied_block, sizeof(BlockHeader), 1, ctx->imageStream) == 1)
+
1962 {
+
1963 if(ied_block.compression == Lzma) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
1964
+
1965 // Write data
+
1966 const size_t written_bytes = fwrite(buffer, ied_block.cmpLength, 1, ctx->imageStream);
+
1967 if(written_bytes == 1)
+
1968 {
+
1969 TRACE("Successfully wrote DVD sector IED block (%" PRIu64 " bytes)", ied_block.cmpLength);
+
1970 // Add IED block to index
+
1971 TRACE("Adding DVD sector IED block to index");
+
1972 IndexEntry ied_index_entry;
+
1973 ied_index_entry.blockType = DataBlock;
+
1974 ied_index_entry.dataType = DvdSectorIed;
+
1975 ied_index_entry.offset = ied_position;
+
1976 utarray_push_back(ctx->index_entries, &ied_index_entry);
+
1977 TRACE("Added DVD sector IED block index entry at offset %" PRIu64, ied_position);
+
1978 }
+
1979 }
+
1980
+
1981 if(ied_block.compression == Lzma) free(buffer);
+
1982
+
1983 // Write DVD sector CPR/MAI block
+
1984 fseek(ctx->imageStream, 0, SEEK_END);
+
1985 long cpr_mai_position = ftell(ctx->imageStream);
+
1986 if(cpr_mai_position & alignment_mask)
+
1987 {
+
1988 const uint64_t aligned_position = cpr_mai_position + alignment_mask & ~alignment_mask;
+
1989 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
1990 cpr_mai_position = aligned_position;
+
1991 }
+
1992 TRACE("Writing DVD sector CPR/MAI block at position %ld", cpr_mai_position);
+
1993 BlockHeader cpr_mai_block = {0};
+
1994 cpr_mai_block.identifier = DataBlock;
+
1995 cpr_mai_block.type = DvdSectorCprMai;
+
1996 cpr_mai_block.compression = ctx->compression_enabled ? Lzma : None;
+
1997 cpr_mai_block.length = (uint32_t)total_sectors * 6;
+
1998 // Calculate CRC64
+
1999 cpr_mai_block.crc64 = aaruf_crc64_data(ctx->sector_cpr_mai, cpr_mai_block.length);
+
2000
+
2001 buffer = NULL;
+
2002
+
2003 if(cpr_mai_block.compression == None)
+
2004 {
+
2005 buffer = ctx->sector_cpr_mai;
+
2006 cpr_mai_block.cmpCrc64 = cpr_mai_block.crc64;
+
2007 }
+
2008 else
+
2009 {
+
2010 buffer = malloc((size_t)cpr_mai_block.length * 2); // Allocate double size for compression
+
2011 if(buffer == NULL)
+
2012 {
+
2013 TRACE("Failed to allocate memory for DVD sector CPR/MAI compression");
+
2014 return;
+
2015 }
+
2016
+
2017 size_t dst_size = (size_t)cpr_mai_block.length * 2 * 2;
+
2018 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
2019 aaruf_lzma_encode_buffer(buffer, &dst_size, ctx->sector_cpr_mai, cpr_mai_block.length, lzma_properties,
+
2020 &props_size, 9, ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
2021
+
2022 cpr_mai_block.cmpLength = (uint32_t)dst_size;
+
2023
+
2024 if(cpr_mai_block.cmpLength >= cpr_mai_block.length)
+
2025 {
+
2026 cpr_mai_block.compression = None;
+
2027 free(buffer);
+
2028 buffer = ctx->sector_cpr_mai;
+
2029 }
+
2030 }
+
2031
+
2032 if(cpr_mai_block.compression == None)
+
2033 {
+
2034 cpr_mai_block.cmpLength = cpr_mai_block.length;
+
2035 cpr_mai_block.cmpCrc64 = cpr_mai_block.crc64;
+
2036 }
+
2037 else
+
2038 cpr_mai_block.cmpCrc64 = aaruf_crc64_data(buffer, cpr_mai_block.cmpLength);
+
2039
+
2040 if(cpr_mai_block.compression == Lzma) cpr_mai_block.cmpLength += LZMA_PROPERTIES_LENGTH;
+
2041
+
2042 // Write header
+
2043 if(fwrite(&cpr_mai_block, sizeof(BlockHeader), 1, ctx->imageStream) == 1)
+
2044 {
+
2045 if(cpr_mai_block.compression == Lzma) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
2046
+
2047 // Write data
+
2048 const size_t written_bytes = fwrite(buffer, cpr_mai_block.cmpLength, 1, ctx->imageStream);
+
2049 if(written_bytes == 1)
+
2050 {
+
2051 TRACE("Successfully wrote DVD sector CPR/MAI block (%" PRIu64 " bytes)", cpr_mai_block.cmpLength);
+
2052 // Add CPR/MAI block to index
+
2053 TRACE("Adding DVD sector CPR/MAI block to index");
+
2054 IndexEntry cpr_mai_index_entry;
+
2055 cpr_mai_index_entry.blockType = DataBlock;
+
2056 cpr_mai_index_entry.dataType = DvdSectorCprMai;
+
2057 cpr_mai_index_entry.offset = cpr_mai_position;
+
2058 utarray_push_back(ctx->index_entries, &cpr_mai_index_entry);
+
2059 TRACE("Added DVD sector CPR/MAI block index entry at offset %" PRIu64, cpr_mai_position);
+
2060 }
+
2061 }
+
2062
+
2063 if(cpr_mai_block.compression == Lzma) free(buffer);
+
2064
+
2065 // Write DVD sector EDC block
+
2066 fseek(ctx->imageStream, 0, SEEK_END);
+
2067 long edc_position = ftell(ctx->imageStream);
+
2068 if(edc_position & alignment_mask)
+
2069 {
+
2070 const uint64_t aligned_position = edc_position + alignment_mask & ~alignment_mask;
+
2071 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
2072 edc_position = aligned_position;
+
2073 }
+
2074 TRACE("Writing DVD sector EDC block at position %ld", edc_position);
+
2075 BlockHeader edc_block = {0};
+
2076 edc_block.identifier = DataBlock;
+
2077 edc_block.type = DvdSectorEdc;
+
2078 edc_block.compression = ctx->compression_enabled ? Lzma : None;
+
2079 edc_block.length = (uint32_t)total_sectors * 4;
+
2080 // Calculate CRC64
+
2081 edc_block.crc64 = aaruf_crc64_data(ctx->sector_edc, edc_block.length);
+
2082
+
2083 buffer = NULL;
+
2084
+
2085 if(edc_block.compression == None)
+
2086 {
+
2087 buffer = ctx->sector_edc;
+
2088 edc_block.cmpCrc64 = edc_block.crc64;
+
2089 }
+
2090 else
+
2091 {
+
2092 buffer = malloc((size_t)edc_block.length * 2); // Allocate double size for compression
+
2093 if(buffer == NULL)
+
2094 {
+
2095 TRACE("Failed to allocate memory for DVD sector EDC compression");
+
2096 return;
+
2097 }
+
2098
+
2099 size_t dst_size = (size_t)edc_block.length * 2 * 2;
+
2100 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
2101 aaruf_lzma_encode_buffer(buffer, &dst_size, ctx->sector_edc, edc_block.length, lzma_properties, &props_size, 9,
+
2102 ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
2103
+
2104 edc_block.cmpLength = (uint32_t)dst_size;
+
2105
+
2106 if(edc_block.cmpLength >= edc_block.length)
+
2107 {
+
2108 edc_block.compression = None;
+
2109 free(buffer);
+
2110 buffer = ctx->sector_edc;
+
2111 }
+
2112 }
+
2113
+
2114 if(edc_block.compression == None)
+
2115 {
+
2116 edc_block.cmpLength = edc_block.length;
+
2117 edc_block.cmpCrc64 = edc_block.crc64;
+
2118 }
+
2119 else
+
2120 edc_block.cmpCrc64 = aaruf_crc64_data(buffer, edc_block.cmpLength);
+
2121
+
2122 if(edc_block.compression == Lzma) edc_block.cmpLength += LZMA_PROPERTIES_LENGTH;
+
2123
+
2124 // Write header
+
2125 if(fwrite(&edc_block, sizeof(BlockHeader), 1, ctx->imageStream) == 1)
+
2126 {
+
2127 if(edc_block.compression == Lzma) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
2128
+
2129 // Write data
+
2130 const size_t written_bytes = fwrite(buffer, edc_block.cmpLength, 1, ctx->imageStream);
+
2131 if(written_bytes == 1)
+
2132 {
+
2133 TRACE("Successfully wrote DVD sector EDC block (%" PRIu64 " bytes)", edc_block.cmpLength);
+
2134 // Add EDC block to index
+
2135 TRACE("Adding DVD sector EDC block to index");
+
2136 IndexEntry edc_index_entry;
+
2137 edc_index_entry.blockType = DataBlock;
+
2138 edc_index_entry.dataType = DvdSectorEdc;
+
2139 edc_index_entry.offset = edc_position;
+
2140 utarray_push_back(ctx->index_entries, &edc_index_entry);
+
2141 TRACE("Added DVD sector EDC block index entry at offset %" PRIu64, edc_position);
+
2142 }
+
2143 }
+
2144
+
2145 if(edc_block.compression == Lzma) free(buffer);
+
2146}
+
+
2147
+
+ +
2246{
+
2247 if(ctx->sector_decrypted_title_key == NULL) return;
+
2248
+
2249 fseek(ctx->imageStream, 0, SEEK_END);
+
2250 long block_position = ftell(ctx->imageStream);
+
2251 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
2252 if(block_position & alignment_mask)
+
2253 {
+
2254 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
+
2255 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
2256 block_position = aligned_position;
+
2257 }
+
2258 TRACE("Writing DVD decrypted title key block at position %ld", block_position);
+
2259 BlockHeader decrypted_title_key_block = {0};
+
2260 decrypted_title_key_block.identifier = DataBlock;
+
2261 decrypted_title_key_block.type = DvdSectorTitleKeyDecrypted;
+
2262 decrypted_title_key_block.compression = ctx->compression_enabled ? Lzma : None;
+
2263 decrypted_title_key_block.length =
+ +
2265 5;
+
2266 // Calculate CRC64
+
2267 decrypted_title_key_block.crc64 =
+
2268 aaruf_crc64_data(ctx->sector_decrypted_title_key, decrypted_title_key_block.length);
+
2269
+
2270 uint8_t *buffer = NULL;
+
2271 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
2272
+
2273 if(decrypted_title_key_block.compression == None)
+
2274 {
+
2275 buffer = ctx->sector_decrypted_title_key;
+
2276 decrypted_title_key_block.cmpCrc64 = decrypted_title_key_block.crc64;
+
2277 }
+
2278 else
+
2279 {
+
2280 buffer = malloc((size_t)decrypted_title_key_block.length * 2); // Allocate double size for compression
+
2281 if(buffer == NULL)
+
2282 {
+
2283 TRACE("Failed to allocate memory for DVD decrypted title key compression");
+
2284 return;
+
2285 }
+
2286
+
2287 size_t dst_size = (size_t)decrypted_title_key_block.length * 2 * 2;
+
2288 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
2289 aaruf_lzma_encode_buffer(buffer, &dst_size, ctx->sector_decrypted_title_key, decrypted_title_key_block.length,
+
2290 lzma_properties, &props_size, 9, ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
2291
+
2292 decrypted_title_key_block.cmpLength = (uint32_t)dst_size;
+
2293
+
2294 if(decrypted_title_key_block.cmpLength >= decrypted_title_key_block.length)
+
2295 {
+
2296 decrypted_title_key_block.compression = None;
+
2297 free(buffer);
+
2298 buffer = ctx->sector_decrypted_title_key;
+
2299 }
+
2300 }
+
2301
+
2302 if(decrypted_title_key_block.compression == None)
+
2303 {
+
2304 decrypted_title_key_block.cmpLength = decrypted_title_key_block.length;
+
2305 decrypted_title_key_block.cmpCrc64 = decrypted_title_key_block.crc64;
+
2306 }
+
2307 else
+
2308 decrypted_title_key_block.cmpCrc64 = aaruf_crc64_data(buffer, decrypted_title_key_block.cmpLength);
+
2309
+
2310 if(decrypted_title_key_block.compression == Lzma) decrypted_title_key_block.cmpLength += LZMA_PROPERTIES_LENGTH;
+
2311
+
2312 // Write header
+
2313 if(fwrite(&decrypted_title_key_block, sizeof(BlockHeader), 1, ctx->imageStream) == 1)
+
2314 {
+
2315 if(decrypted_title_key_block.compression == Lzma)
+
2316 fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
2317
+
2318 // Write data
+
2319 const size_t written_bytes = fwrite(buffer, decrypted_title_key_block.cmpLength, 1, ctx->imageStream);
+
2320 if(written_bytes == 1)
+
2321 {
+
2322 TRACE("Successfully wrote DVD decrypted title key block (%" PRIu64 " bytes)",
+
2323 decrypted_title_key_block.cmpLength);
+
2324 // Add decrypted title key block to index
+
2325 TRACE("Adding DVD decrypted title key block to index");
+
2326 IndexEntry decrypted_title_key_index_entry;
+
2327 decrypted_title_key_index_entry.blockType = DataBlock;
+
2328 decrypted_title_key_index_entry.dataType = DvdSectorTitleKeyDecrypted;
+
2329 decrypted_title_key_index_entry.offset = block_position;
+
2330 utarray_push_back(ctx->index_entries, &decrypted_title_key_index_entry);
+
2331 TRACE("Added DVD decrypted title key block index entry at offset %" PRIu64, block_position);
+
2332 }
+
2333 }
+
2334
+
2335 if(decrypted_title_key_block.compression == Lzma) free(buffer);
+
2336}
+
+
2337
+
+ +
2410{
+
2411 if(ctx->mediaTags == NULL) return;
+
2412
+
2413 mediaTagEntry *media_tag = NULL;
+
2414 mediaTagEntry *tmp_media_tag = NULL;
+
2415
+
2416 HASH_ITER(hh, ctx->mediaTags, media_tag, tmp_media_tag)
+
2417 {
+
2418 fseek(ctx->imageStream, 0, SEEK_END);
+
2419 long tag_position = ftell(ctx->imageStream);
+
2420 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
2421 if(tag_position & alignment_mask)
+
2422 {
+
2423 const uint64_t aligned_position = tag_position + alignment_mask & ~alignment_mask;
+
2424 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
2425 tag_position = aligned_position;
+
2426 }
+
2427
+
2428 TRACE("Writing media tag block type %d at position %ld", aaruf_get_datatype_for_media_tag_type(media_tag->type),
+
2429 tag_position);
+
2430 BlockHeader tag_block = {0};
+
2431 tag_block.identifier = DataBlock;
+
2432 tag_block.type = (uint16_t)aaruf_get_datatype_for_media_tag_type(media_tag->type);
+
2433 tag_block.compression = ctx->compression_enabled ? Lzma : None;
+
2434 tag_block.length = media_tag->length;
+
2435
+
2436 // Calculate CRC64
+
2437 tag_block.crc64 = aaruf_crc64_data(media_tag->data, tag_block.length);
+
2438
+
2439 uint8_t *buffer = NULL;
+
2440 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
2441
+
2442 if(tag_block.compression == None)
+
2443 {
+
2444 buffer = media_tag->data;
+
2445 tag_block.cmpCrc64 = tag_block.crc64;
+
2446 }
+
2447 else
+
2448 {
+
2449 buffer = malloc((size_t)tag_block.length * 2); // Allocate double size for compression
+
2450 if(buffer == NULL)
+
2451 {
+
2452 TRACE("Failed to allocate memory for media tag compression");
+
2453 return;
+
2454 }
+
2455
+
2456 size_t dst_size = (size_t)tag_block.length * 2 * 2;
+
2457 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
2458 aaruf_lzma_encode_buffer(buffer, &dst_size, media_tag->data, tag_block.length, lzma_properties, &props_size,
+
2459 9, ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
2460
+
2461 tag_block.cmpLength = (uint32_t)dst_size;
+
2462
+
2463 if(tag_block.cmpLength >= tag_block.length)
+
2464 {
+
2465 tag_block.compression = None;
+
2466 free(buffer);
+
2467 buffer = media_tag->data;
+
2468 }
+
2469 }
+
2470
+
2471 if(tag_block.compression == None)
+
2472 {
+
2473 tag_block.cmpLength = tag_block.length;
+
2474 tag_block.cmpCrc64 = tag_block.crc64;
+
2475 }
+
2476 else
+
2477 tag_block.cmpCrc64 = aaruf_crc64_data(buffer, tag_block.cmpLength);
+
2478
+
2479 if(tag_block.compression == Lzma) tag_block.cmpLength += LZMA_PROPERTIES_LENGTH;
+
2480
+
2481 // Write header
+
2482 if(fwrite(&tag_block, sizeof(BlockHeader), 1, ctx->imageStream) == 1)
+
2483 {
+
2484 if(tag_block.compression == Lzma)
+
2485 fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream); // Write data
+
2486
+
2487 const size_t written_bytes = fwrite(buffer, tag_block.cmpLength, 1, ctx->imageStream);
+
2488 if(written_bytes == 1)
+
2489 {
+
2490 TRACE("Successfully wrote media tag block type %d (%" PRIu64 " bytes)", tag_block.type,
+
2491 tag_block.cmpLength);
+
2492 // Add media tag block to index
+
2493 TRACE("Adding media tag type %d block to index", tag_block.type);
+
2494 IndexEntry tag_index_entry;
+
2495 tag_index_entry.blockType = DataBlock;
+
2496 tag_index_entry.dataType = tag_block.type;
+
2497 tag_index_entry.offset = tag_position;
+
2498 utarray_push_back(ctx->index_entries, &tag_index_entry);
+
2499 TRACE("Added media tag block type %d index entry at offset %" PRIu64, tag_block.type, tag_position);
+
2500 }
+
2501 }
+
2502
+
2503 if(tag_block.compression == Lzma) free(buffer);
+
2504 }
+
2505}
+
+
2506
+
+ +
2670{
+
2671 if(ctx->tape_files == NULL) return;
+
2672
+
2673 // Iterate the uthash and count how many entries do we have
+
2674 const tapeFileHashEntry *tape_file = NULL;
+
2675 const tapeFileHashEntry *tmp_tape_file = NULL;
+
2676 size_t tape_file_count = 0;
+
2677 HASH_ITER(hh, ctx->tape_files, tape_file, tmp_tape_file) tape_file_count++;
+
2678
+
2679 // Create a memory buffer to copy all the file entries
+
2680 const size_t buffer_size = tape_file_count * sizeof(TapeFileEntry);
+
2681 TapeFileEntry *buffer = malloc(buffer_size);
+
2682 if(buffer == NULL)
+
2683 {
+
2684 TRACE("Failed to allocate memory for tape file entries");
+
2685 return;
+
2686 }
+
2687 memset(buffer, 0, buffer_size);
+
2688 size_t index = 0;
+
2689 HASH_ITER(hh, ctx->tape_files, tape_file, tmp_tape_file)
+
2690 {
+
2691 if(index >= tape_file_count) break;
+
2692 memcpy(&buffer[index], &tape_file->fileEntry, sizeof(TapeFileEntry));
+
2693 index++;
+
2694 }
+
2695
+
2696 // Create the tape file block in memory
+
2697 TapeFileHeader tape_file_block = {0};
+
2698 tape_file_block.identifier = TapeFileBlock;
+
2699 tape_file_block.length = (uint32_t)buffer_size;
+
2700 tape_file_block.crc64 = aaruf_crc64_data((uint8_t *)buffer, (uint32_t)tape_file_block.length);
+
2701
+
2702 // Write tape file block to file, block aligned
+
2703 fseek(ctx->imageStream, 0, SEEK_END);
+
2704 long block_position = ftell(ctx->imageStream);
+
2705 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
2706 if(block_position & alignment_mask)
+
2707 {
+
2708 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
+
2709 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
2710 block_position = aligned_position;
+
2711 }
+
2712 TRACE("Writing tape file block at position %ld", block_position);
+
2713 if(fwrite(&tape_file_block, sizeof(TapeFileHeader), 1, ctx->imageStream) == 1)
+
2714 {
+
2715 const size_t written_bytes = fwrite(buffer, tape_file_block.length, 1, ctx->imageStream);
+
2716 if(written_bytes == 1)
+
2717 {
+
2718 TRACE("Successfully wrote tape file block (%" PRIu64 " bytes)", tape_file_block.length);
+
2719 // Add tape file block to index
+
2720 TRACE("Adding tape file block to index");
+
2721 IndexEntry index_entry;
+
2722 index_entry.blockType = TapeFileBlock;
+
2723 index_entry.dataType = 0;
+
2724 index_entry.offset = block_position;
+
2725 utarray_push_back(ctx->index_entries, &index_entry);
+
2726 TRACE("Added tape file block index entry at offset %" PRIu64, block_position);
+
2727 }
+
2728 }
+
2729
+
2730 free(buffer);
+
2731}
+
+
2732
+
+ +
2902{
+
2903 if(ctx->tape_partitions == NULL) return;
+
2904
+
2905 // Iterate the uthash and count how many entries do we have
+
2906 const TapePartitionHashEntry *tape_partition = NULL;
+
2907 const TapePartitionHashEntry *tmp_tape_partition = NULL;
+
2908 size_t tape_partition_count = 0;
+
2909 HASH_ITER(hh, ctx->tape_partitions, tape_partition, tmp_tape_partition) tape_partition_count++;
+
2910
+
2911 // Create a memory buffer to copy all the partition entries
+
2912 const size_t buffer_size = tape_partition_count * sizeof(TapePartitionEntry);
+
2913 TapePartitionEntry *buffer = malloc(buffer_size);
+
2914 if(buffer == NULL)
+
2915 {
+
2916 TRACE("Failed to allocate memory for tape partition entries");
+
2917 return;
+
2918 }
+
2919 memset(buffer, 0, buffer_size);
+
2920 size_t index = 0;
+
2921 HASH_ITER(hh, ctx->tape_partitions, tape_partition, tmp_tape_partition)
+
2922 {
+
2923 if(index >= tape_partition_count) break;
+
2924 memcpy(&buffer[index], &tape_partition->partitionEntry, sizeof(TapePartitionEntry));
+
2925 index++;
+
2926 }
+
2927
+
2928 // Create the tape partition block in memory
+
2929 TapePartitionHeader tape_partition_block = {0};
+
2930 tape_partition_block.identifier = TapePartitionBlock;
+
2931 tape_partition_block.length = (uint32_t)buffer_size;
+
2932 tape_partition_block.crc64 = aaruf_crc64_data((uint8_t *)buffer, (uint32_t)tape_partition_block.length);
+
2933
+
2934 // Write tape partition block to partition, block aligned
+
2935 fseek(ctx->imageStream, 0, SEEK_END);
+
2936 long block_position = ftell(ctx->imageStream);
+
2937 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
2938 if(block_position & alignment_mask)
+
2939 {
+
2940 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
+
2941 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
2942 block_position = aligned_position;
+
2943 }
+
2944 TRACE("Writing tape partition block at position %ld", block_position);
+
2945 if(fwrite(&tape_partition_block, sizeof(TapePartitionHeader), 1, ctx->imageStream) == 1)
+
2946 {
+
2947 const size_t written_bytes = fwrite(buffer, tape_partition_block.length, 1, ctx->imageStream);
+
2948 if(written_bytes == 1)
+
2949 {
+
2950 TRACE("Successfully wrote tape partition block (%" PRIu64 " bytes)", tape_partition_block.length);
+
2951 // Add tape partition block to index
+
2952 TRACE("Adding tape partition block to index");
+
2953 IndexEntry index_entry;
+
2954 index_entry.blockType = TapePartitionBlock;
+
2955 index_entry.dataType = 0;
+
2956 index_entry.offset = block_position;
+
2957 utarray_push_back(ctx->index_entries, &index_entry);
+
2958 TRACE("Added tape partition block index entry at offset %" PRIu64, block_position);
+
2959 }
+
2960 }
+
2961
+
2962 free(buffer);
+
2963}
+
+
2964
+
+ +
3027{
+
3028 if(ctx->geometry_block.identifier != GeometryBlock) return;
+
3029
+
3030 fseek(ctx->imageStream, 0, SEEK_END);
+
3031 long block_position = ftell(ctx->imageStream);
+
3032 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
3033 if(block_position & alignment_mask)
+
3034 {
+
3035 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
+
3036 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
3037 block_position = aligned_position;
+
3038 }
+
3039
+
3040 TRACE("Writing geometry block at position %ld", block_position);
+
3041
+
3042 // Write header
+
3043 if(fwrite(&ctx->geometry_block, sizeof(GeometryBlockHeader), 1, ctx->imageStream) == 1)
+
3044 {
+
3045 TRACE("Successfully wrote geometry block");
+
3046
+
3047 // Add geometry block to index
+
3048 TRACE("Adding geometry block to index");
+
3049 IndexEntry index_entry;
+
3050 index_entry.blockType = GeometryBlock;
+
3051 index_entry.dataType = 0;
+
3052 index_entry.offset = block_position;
+
3053 utarray_push_back(ctx->index_entries, &index_entry);
+
3054 TRACE("Added geometry block index entry at offset %" PRIu64, block_position);
+
3055 }
+
3056}
+
+
3057
+
+ +
3163{
+ +
3165 ctx->metadata_block_header.lastMediaSequence == 0 && ctx->creator == NULL && ctx->comments == NULL &&
+
3166 ctx->media_title == NULL && ctx->media_manufacturer == NULL && ctx->media_model == NULL &&
+
3167 ctx->media_serial_number == NULL && ctx->media_barcode == NULL && ctx->media_part_number == NULL &&
+
3168 ctx->drive_manufacturer == NULL && ctx->drive_model == NULL && ctx->drive_serial_number == NULL &&
+
3169 ctx->drive_firmware_revision == NULL)
+
3170 return;
+
3171
+ + + + + + + + +
3180
+ +
3182
+
3183 int pos = sizeof(MetadataBlockHeader);
+
3184
+
3185 uint8_t *buffer = calloc(1, ctx->metadata_block_header.blockSize);
+
3186 if(buffer == NULL) return;
+
3187
+
3188 if(ctx->creator != NULL && ctx->metadata_block_header.creatorLength > 0)
+
3189 {
+
3190 memcpy(buffer + pos, ctx->creator, ctx->metadata_block_header.creatorLength);
+ + +
3193 }
+
3194
+
3195 if(ctx->comments != NULL && ctx->metadata_block_header.commentsLength > 0)
+
3196 {
+
3197 memcpy(buffer + pos, ctx->comments, ctx->metadata_block_header.commentsLength);
+ + +
3200 }
+
3201
+
3202 if(ctx->media_title != NULL && ctx->metadata_block_header.mediaTitleLength > 0)
+
3203 {
+
3204 memcpy(buffer + pos, ctx->media_title, ctx->metadata_block_header.mediaTitleLength);
+ + +
3207 }
+
3208
+ +
3210 {
+
3211 memcpy(buffer + pos, ctx->media_manufacturer, ctx->metadata_block_header.mediaManufacturerLength);
+ + +
3214 }
+
3215
+
3216 if(ctx->media_model != NULL && ctx->metadata_block_header.mediaModelLength > 0)
+
3217 {
+
3218 memcpy(buffer + pos, ctx->media_model, ctx->metadata_block_header.mediaModelLength);
+ + +
3221 }
+
3222
+ +
3224 {
+
3225 memcpy(buffer + pos, ctx->media_serial_number, ctx->metadata_block_header.mediaSerialNumberLength);
+ + +
3228 }
+
3229
+
3230 if(ctx->media_barcode != NULL && ctx->metadata_block_header.mediaBarcodeLength > 0)
+
3231 {
+
3232 memcpy(buffer + pos, ctx->media_barcode, ctx->metadata_block_header.mediaBarcodeLength);
+ + +
3235 }
+
3236
+ +
3238 {
+
3239 memcpy(buffer + pos, ctx->media_part_number, ctx->metadata_block_header.mediaPartNumberLength);
+ + +
3242 }
+
3243
+ +
3245 {
+
3246 memcpy(buffer + pos, ctx->drive_manufacturer, ctx->metadata_block_header.driveManufacturerLength);
+ + +
3249 }
+
3250
+
3251 if(ctx->drive_model != NULL && ctx->metadata_block_header.driveModelLength > 0)
+
3252 {
+
3253 memcpy(buffer + pos, ctx->drive_model, ctx->metadata_block_header.driveModelLength);
+ + +
3256 }
+
3257
+ +
3259 {
+
3260 memcpy(buffer + pos, ctx->drive_serial_number, ctx->metadata_block_header.driveSerialNumberLength);
+ + +
3263 }
+
3264
+ +
3266 {
+ + +
3269 }
+
3270
+
3271 fseek(ctx->imageStream, 0, SEEK_END);
+
3272 long block_position = ftell(ctx->imageStream);
+
3273 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
3274 if(block_position & alignment_mask)
+
3275 {
+
3276 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
+
3277 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
3278 block_position = aligned_position;
+
3279 }
+
3280
+
3281 TRACE("Writing metadata block at position %ld", block_position);
+
3282
+
3283 if(fwrite(buffer, ctx->metadata_block_header.blockSize, 1, ctx->imageStream) == 1)
+
3284 {
+
3285 TRACE("Successfully wrote metadata block");
+
3286
+
3287 // Add metadata block to index
+
3288 TRACE("Adding metadata block to index");
+
3289 IndexEntry index_entry;
+
3290 index_entry.blockType = MetadataBlock;
+
3291 index_entry.dataType = 0;
+
3292 index_entry.offset = block_position;
+
3293 utarray_push_back(ctx->index_entries, &index_entry);
+
3294 TRACE("Added metadata block index entry at offset %" PRIu64, block_position);
+
3295 }
+
3296
+
3297 free(buffer);
+
3298}
+
+
3299
+
+ +
3446{
+
3447
+
3448 if(ctx->dump_hardware_entries_with_data == NULL || ctx->dump_hardware_header.entries == 0 ||
+ +
3450 return;
+
3451
+
3452 const size_t required_length = sizeof(DumpHardwareHeader) + ctx->dump_hardware_header.length;
+
3453
+
3454 uint8_t *buffer = calloc(1, required_length);
+
3455
+
3456 if(buffer == NULL) return;
+
3457
+
3458 // Start to iterate and copy the data
+
3459 size_t offset = 0;
+
3460 for(int i = 0; i < ctx->dump_hardware_header.entries; i++)
+
3461 {
+
3462 size_t entry_size = sizeof(DumpHardwareEntry) +
+ + + + + + + + + +
3472
+
3473 if(offset + entry_size > required_length)
+
3474 {
+
3475 FATAL("Calculated size exceeds provided buffer length");
+
3476 free(buffer);
+
3477 return;
+
3478 }
+
3479
+
3480 memcpy(buffer + offset, &ctx->dump_hardware_entries_with_data[i].entry, sizeof(DumpHardwareEntry));
+
3481 offset += sizeof(DumpHardwareEntry);
+ + +
3484 {
+
3485 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].manufacturer,
+ + +
3488 }
+ +
3490 ctx->dump_hardware_entries_with_data[i].model != NULL)
+
3491 {
+
3492 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].model,
+ + +
3495 }
+ + +
3498 {
+
3499 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].revision,
+ + +
3502 }
+ + +
3505 {
+
3506 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].firmware,
+ + +
3509 }
+ + +
3512 {
+
3513 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].serial,
+ + +
3516 }
+ + +
3519 {
+
3520 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].softwareName,
+ + +
3523 }
+ + +
3526 {
+
3527 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].softwareVersion,
+ + +
3530 }
+ + +
3533 {
+
3534 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].softwareOperatingSystem,
+ + +
3537 }
+ + +
3540 {
+
3541 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].extents,
+ +
3543 offset += ctx->dump_hardware_entries_with_data[i].entry.extents * sizeof(DumpExtent);
+
3544 }
+
3545 }
+
3546
+
3547 // Calculate CRC64
+ + +
3550
+
3551 // Copy header
+
3552 memcpy(buffer, &ctx->dump_hardware_header, sizeof(DumpHardwareHeader));
+
3553
+
3554 fseek(ctx->imageStream, 0, SEEK_END);
+
3555 long block_position = ftell(ctx->imageStream);
+
3556 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
3557 if(block_position & alignment_mask)
+
3558 {
+
3559 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
+
3560 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
3561 block_position = aligned_position;
+
3562 }
+
3563 TRACE("Writing dump hardware block at position %ld", block_position);
+
3564 if(fwrite(buffer, required_length, 1, ctx->imageStream) == 1)
+
3565 {
+
3566 TRACE("Successfully wrote dump hardware block");
+
3567
+
3568 // Add dump hardware block to index
+
3569 TRACE("Adding dump hardware block to index");
+
3570 IndexEntry index_entry;
+
3571 index_entry.blockType = DumpHardwareBlock;
+
3572 index_entry.dataType = 0;
+
3573 index_entry.offset = block_position;
+
3574 utarray_push_back(ctx->index_entries, &index_entry);
+
3575 TRACE("Added dump hardware block index entry at offset %" PRIu64, block_position);
+
3576 }
+
3577
+
3578 free(buffer);
+
3579}
+
+
3580
+
+ +
3676{
+
3677 if(ctx->cicm_block == NULL || ctx->cicm_block_header.length == 0 || ctx->cicm_block_header.identifier != CicmBlock)
+
3678 return;
+
3679
+
3680 fseek(ctx->imageStream, 0, SEEK_END);
+
3681 long block_position = ftell(ctx->imageStream);
+
3682 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
3683
+
3684 if(block_position & alignment_mask)
+
3685 {
+
3686 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
+
3687 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
3688 block_position = aligned_position;
+
3689 }
+
3690
+
3691 TRACE("Writing CICM XML block at position %ld", block_position);
+
3692 if(fwrite(&ctx->cicm_block_header, sizeof(CicmMetadataBlock), 1, ctx->imageStream) == 1)
+
3693 if(fwrite(ctx->cicm_block, ctx->cicm_block_header.length, 1, ctx->imageStream) == 1)
+
3694 {
+
3695 TRACE("Successfully wrote CICM XML block");
+
3696
+
3697 // Add CICM block to index
+
3698 TRACE("Adding CICM XML block to index");
+
3699 IndexEntry index_entry;
+
3700 index_entry.blockType = CicmBlock;
+
3701 index_entry.dataType = 0;
+
3702 index_entry.offset = block_position;
+
3703 utarray_push_back(ctx->index_entries, &index_entry);
+
3704 TRACE("Added CICM XML block index entry at offset %" PRIu64, block_position);
+
3705 }
+
3706}
+
+
3707
+
+ +
3813{
+
3814 if(ctx->json_block == NULL || ctx->json_block_header.length == 0 ||
+ +
3816 return;
+
3817
+
3818 fseek(ctx->imageStream, 0, SEEK_END);
+
3819 long block_position = ftell(ctx->imageStream);
+
3820 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
3821
+
3822 if(block_position & alignment_mask)
+
3823 {
+
3824 const uint64_t aligned_position = block_position + alignment_mask & ~alignment_mask;
+
3825 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
3826 block_position = aligned_position;
+
3827 }
+
3828
+
3829 TRACE("Writing Aaru metadata JSON block at position %ld", block_position);
+
3830 if(fwrite(&ctx->json_block_header, sizeof(AaruMetadataJsonBlockHeader), 1, ctx->imageStream) == 1)
+
3831 if(fwrite(ctx->json_block, ctx->json_block_header.length, 1, ctx->imageStream) == 1)
+
3832 {
+
3833 TRACE("Successfully wrote Aaru metadata JSON block");
+
3834
+
3835 // Add Aaru metadata JSON block to index
+
3836 TRACE("Adding Aaru metadata JSON block to index");
+
3837 IndexEntry index_entry;
+
3838 index_entry.blockType = AaruMetadataJsonBlock;
+
3839 index_entry.dataType = 0;
+
3840 index_entry.offset = block_position;
+
3841 utarray_push_back(ctx->index_entries, &index_entry);
+
3842 TRACE("Added Aaru metadata JSON block index entry at offset %" PRIu64, block_position);
+
3843 }
+
3844}
+
+
3845
+
+ +
3863{
+
3864 // Write the complete index at the end of the file
+
3865 TRACE("Writing index at the end of the file");
+
3866 fseek(ctx->imageStream, 0, SEEK_END);
+
3867 long index_position = ftell(ctx->imageStream);
+
3868
+
3869 // Align index position to block boundary if needed
+
3870 uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
3871 if(index_position & alignment_mask)
+
3872 {
+
3873 uint64_t aligned_position = index_position + alignment_mask & ~alignment_mask;
+
3874 fseek(ctx->imageStream, aligned_position, SEEK_SET);
+
3875 index_position = aligned_position;
+
3876 TRACE("Aligned index position to %" PRIu64, aligned_position);
+
3877 }
+
3878
+
3879 // Prepare index header
+
3880 IndexHeader3 index_header;
+
3881 index_header.identifier = IndexBlock3;
+
3882 index_header.entries = utarray_len(ctx->index_entries);
+
3883 index_header.previous = 0; // No previous index for now
+
3884
+
3885 TRACE("Writing index with %" PRIu64 " entries at position %ld", index_header.entries, index_position);
+
3886
+
3887 // Calculate CRC64 of index entries
+
3888 crc64_ctx *index_crc64_context = aaruf_crc64_init();
+
3889 if(index_crc64_context != NULL && index_header.entries > 0)
+
3890 {
+
3891 size_t index_data_size = index_header.entries * sizeof(IndexEntry);
+
3892 aaruf_crc64_update(index_crc64_context, utarray_front(ctx->index_entries), index_data_size);
+
3893 aaruf_crc64_final(index_crc64_context, &index_header.crc64);
+
3894 TRACE("Calculated index CRC64: 0x%16lX", index_header.crc64);
+
3895 }
+
3896 else
+
3897 index_header.crc64 = 0;
+
3898
+
3899 // Write index header
+
3900 if(fwrite(&index_header, sizeof(IndexHeader3), 1, ctx->imageStream) == 1)
+
3901 {
+
3902 TRACE("Successfully wrote index header");
+
3903
+
3904 // Write index entries
+
3905 if(index_header.entries > 0)
+
3906 {
+
3907 size_t entries_written = 0;
+
3908 IndexEntry *entry = NULL;
+
3909
+
3910 for(entry = (IndexEntry *)utarray_front(ctx->index_entries); entry != NULL;
+
3911 entry = (IndexEntry *)utarray_next(ctx->index_entries, entry))
+
3912 if(fwrite(entry, sizeof(IndexEntry), 1, ctx->imageStream) == 1)
+
3913 {
+
3914 entries_written++;
+
3915 TRACE("Wrote index entry: blockType=0x%08X dataType=%u offset=%" PRIu64, entry->blockType,
+
3916 entry->dataType, entry->offset);
+
3917 }
+
3918 else
+
3919 {
+
3920 TRACE("Failed to write index entry %zu", entries_written);
+
3921 break;
+
3922 }
+
3923
+
3924 if(entries_written == index_header.entries)
+
3925 {
+
3926 TRACE("Successfully wrote all %zu index entries", entries_written);
+
3927
+
3928 // Update header with index offset and rewrite it
+
3929 ctx->header.indexOffset = index_position;
+
3930 TRACE("Updating header with index offset: %" PRIu64, ctx->header.indexOffset);
+
3931
+
3932 // Seek back to beginning and rewrite header
+
3933 fseek(ctx->imageStream, 0, SEEK_SET);
+
3934 if(fwrite(&ctx->header, sizeof(AaruHeaderV2), 1, ctx->imageStream) == 1)
+
3935 TRACE("Successfully updated header with index offset");
+
3936 else
+
3937 {
+
3938 TRACE("Failed to update header with index offset");
+ +
3940 }
+
3941 }
+
3942 else
+
3943 {
+
3944 TRACE("Failed to write all index entries (wrote %zu of %" PRIu64 ")", entries_written,
+
3945 index_header.entries);
+ +
3947 }
+
3948 }
+
3949 }
+
3950 else
+
3951 {
+
3952 TRACE("Failed to write index header");
+ +
3954 }
+
3955
+
3956 return AARUF_STATUS_OK;
+
3957}
+
+
3958
+
+
3995int aaruf_close(void *context)
+
3996{
+
3997 TRACE("Entering aaruf_close(%p)", context);
+
3998
+
3999 mediaTagEntry *media_tag = NULL;
+
4000 mediaTagEntry *tmp_media_tag = NULL;
+
4001
+
4002 if(context == NULL)
+
4003 {
+
4004 FATAL("Invalid context");
+
4005 errno = EINVAL;
+
4006 return -1;
+
4007 }
+
4008
+
4009 aaruformat_context *ctx = context;
+
4010
+
4011 // Not a libaaruformat context
+
4012 if(ctx->magic != AARU_MAGIC)
+
4013 {
+
4014 FATAL("Invalid context");
+
4015 errno = EINVAL;
+
4016 return -1;
+
4017 }
+
4018
+
4019 if(ctx->is_writing)
+
4020 {
+
4021 TRACE("File is writing");
+
4022
+
4023 TRACE("Seeking to start of image");
+
4024 // Write the header at the beginning of the file
+
4025 fseek(ctx->imageStream, 0, SEEK_SET);
+
4026
+
4027 TRACE("Writing header at position 0");
+
4028 if(fwrite(&ctx->header, sizeof(AaruHeaderV2), 1, ctx->imageStream) != 1)
+
4029 {
+
4030 fclose(ctx->imageStream);
+
4031 ctx->imageStream = NULL;
+ +
4033 return -1;
+
4034 }
+
4035
+
4036 // Close current block first
+
4037 TRACE("Closing current block if any");
+
4038 if(ctx->writing_buffer != NULL)
+
4039 {
+
4040 int error = aaruf_close_current_block(ctx);
+
4041
+
4042 if(error != AARUF_STATUS_OK) return error;
+
4043 }
+
4044
+
4045 int32_t res;
+
4046 if(ctx->is_tape)
+
4047 {
+
4048 // Write tape DDT
+
4049 res = write_tape_ddt(ctx);
+
4050 if(res != AARUF_STATUS_OK) return res;
+
4051 }
+
4052 else
+
4053 {
+
4054 // Write cached secondary DDT table if any
+
4055 res = write_cached_secondary_ddt(ctx);
+
4056 if(res != AARUF_STATUS_OK) return res;
+
4057
+
4058 // Write primary DDT table (multi-level) if applicable
+
4059 res = write_primary_ddt(ctx);
+
4060 if(res != AARUF_STATUS_OK) return res;
+
4061
+
4062 // Write single-level DDT table if applicable
+
4063 res = write_single_level_ddt(ctx);
+
4064 if(res != AARUF_STATUS_OK) return res;
+
4065 }
+
4066
+
4067 // Finalize checksums and write checksum block
+ +
4069
+
4070 // Write tracks block
+
4071 write_tracks_block(ctx);
+
4072
+
4073 // Write MODE 2 subheader data block
+ +
4075
+
4076 // Write CD sector prefix data block
+ +
4078
+
4079 // Write sector prefix DDT (statuses + optional indexes)
+ +
4081
+
4082 // Write CD sector suffix data block (EDC/ECC captures)
+ +
4084
+
4085 // Write sector prefix DDT (EDC/ECC captures)
+ +
4087
+
4088 // Write sector subchannel data block
+ +
4090
+
4091 // Write DVD long sector data blocks
+ +
4093
+
4094 // Write DVD decrypted title keys
+ +
4096
+
4097 // Write media tags data blocks
+
4098 write_media_tags(ctx);
+
4099
+
4100 // Write tape files
+ +
4102
+
4103 // Write tape partitions
+ +
4105
+
4106 // Write geometry block if any
+ +
4108
+
4109 // Write metadata block
+ +
4111
+
4112 // Write dump hardware block if any
+
4113 write_dumphw_block(ctx);
+
4114
+
4115 // Write CICM XML block if any
+
4116 write_cicm_block(ctx);
+
4117
+
4118 // Write Aaru metadata JSON block if any
+ +
4120
+
4121 // Write the complete index at the end of the file
+
4122 res = write_index_block(ctx);
+
4123 if(res != AARUF_STATUS_OK) return res;
+
4124
+
4125 if(ctx->deduplicate && ctx->sector_hash_map != NULL)
+
4126 {
+
4127 TRACE("Clearing sector hash map");
+
4128 // Clear sector hash map
+ +
4130 ctx->sector_hash_map = NULL;
+
4131 }
+
4132 }
+
4133
+
4134 TRACE("Freeing memory pointers");
+
4135 // This may do nothing if imageStream is NULL, but as the behaviour is undefined, better sure than sorry
+
4136 if(ctx->imageStream != NULL)
+
4137 {
+
4138 fclose(ctx->imageStream);
+
4139 ctx->imageStream = NULL;
+
4140 }
+
4141
+
4142 // Free index entries array
+
4143 if(ctx->index_entries != NULL)
+
4144 {
+
4145 utarray_free(ctx->index_entries);
+
4146 ctx->index_entries = NULL;
+
4147 }
+
4148
+
4149 free(ctx->sector_prefix);
+
4150 ctx->sector_prefix = NULL;
+
4151 free(ctx->sector_prefix_corrected);
+
4152 ctx->sector_prefix_corrected = NULL;
+
4153 free(ctx->sector_suffix);
+
4154 ctx->sector_suffix = NULL;
+
4155 free(ctx->sector_suffix_corrected);
+
4156 ctx->sector_suffix_corrected = NULL;
+
4157 free(ctx->sector_subchannel);
+
4158 ctx->sector_subchannel = NULL;
+
4159 free(ctx->mode2_subheaders);
+
4160 ctx->mode2_subheaders = NULL;
+
4161
+
4162 TRACE("Freeing media tags");
+
4163 if(ctx->mediaTags != NULL) HASH_ITER(hh, ctx->mediaTags, media_tag, tmp_media_tag)
+
4164 {
+
4165 HASH_DEL(ctx->mediaTags, media_tag);
+
4166 free(media_tag->data);
+
4167 free(media_tag);
+
4168 }
+
4169
+
4170#ifdef __linux__ // TODO: Implement
+
4171 TRACE("Unmapping user data DDT if it is not in memory");
+
4172 if(!ctx->in_memory_ddt)
+
4173 {
+
4174 munmap(ctx->user_data_ddt, ctx->mapped_memory_ddt_size);
+
4175 ctx->user_data_ddt = NULL;
+
4176 }
+
4177#endif
+
4178
+
4179 free(ctx->sector_prefix_ddt2);
+
4180 ctx->sector_prefix_ddt2 = NULL;
+
4181 free(ctx->sector_prefix_ddt);
+
4182 ctx->sector_prefix_ddt = NULL;
+
4183 free(ctx->sector_suffix_ddt2);
+
4184 ctx->sector_suffix_ddt2 = NULL;
+
4185 free(ctx->sector_suffix_ddt);
+
4186 ctx->sector_suffix_ddt = NULL;
+
4187
+
4188 free(ctx->metadata_block);
+
4189 ctx->metadata_block = NULL;
+
4190 free(ctx->track_entries);
+
4191 ctx->track_entries = NULL;
+
4192 free(ctx->cicm_block);
+
4193 ctx->cicm_block = NULL;
+
4194
+
4195 if(ctx->dump_hardware_entries_with_data != NULL)
+
4196 {
+
4197 for(int i = 0; i < ctx->dump_hardware_header.entries; i++)
+
4198 {
+ + + + + + + + + + + + + + + + + + +
4217 }
+ +
4219 }
+
4220
+
4221 free(ctx->readableSectorTags);
+
4222 ctx->readableSectorTags = NULL;
+
4223
+
4224 free(ctx->ecc_cd_context);
+
4225 ctx->ecc_cd_context = NULL;
+
4226
+
4227 free(ctx->checksums.spamsum);
+
4228 ctx->checksums.spamsum = NULL;
+
4229
+
4230 free(ctx->sector_id);
+
4231 free(ctx->sector_ied);
+
4232 free(ctx->sector_cpr_mai);
+
4233 free(ctx->sector_edc);
+
4234
+
4235 // TODO: Free caches
+
4236
+
4237 free(context);
+
4238
+
4239 TRACE("Exiting aaruf_close() = 0");
+
4240 return 0;
+
4241}
+
+ +
void write_dvd_long_sector_blocks(aaruformat_context *ctx)
Serialize DVD long sector auxiliary data blocks to the image file.
Definition close.c:1808
+
static int32_t write_primary_ddt(aaruformat_context *ctx)
Write (flush) the multi-level primary DDT table header and data back to its file offset.
Definition close.c:283
+
static int32_t write_index_block(aaruformat_context *ctx)
Serialize the accumulated index entries at the end of the image and back-patch the header.
Definition close.c:3862
+
static void write_media_tags(const aaruformat_context *ctx)
Serialize all accumulated media tags to the image file.
Definition close.c:2409
+
static void write_geometry_block(const aaruformat_context *ctx)
Serialize the geometry metadata block to the image file.
Definition close.c:3026
+
int aaruf_close(void *context)
Close an Aaru image context, flushing pending data structures and releasing resources.
Definition close.c:3995
+
static int32_t write_single_level_ddt(aaruformat_context *ctx)
Serialize a single-level DDT (tableShift == 0) directly after its header.
Definition close.c:369
+
static void write_dumphw_block(aaruformat_context *ctx)
Serialize the dump hardware block containing acquisition environment information.
Definition close.c:3445
+
static void write_tape_partition_block(const aaruformat_context *ctx)
Serialize the tape partition metadata block to the image file.
Definition close.c:2901
+
static void write_checksum_block(aaruformat_context *ctx)
Finalize any active checksum calculations and append a checksum block.
Definition close.c:654
+
static void write_sector_suffix(aaruformat_context *ctx)
Serialize the optional CD sector suffix block (EDC/ECC region capture).
Definition close.c:1088
+
static void write_sector_suffix_ddt(aaruformat_context *ctx)
Serialize the per-sector CD suffix status / index DeDuplication Table (DDT v2, suffix variant).
Definition close.c:1350
+
static void write_tracks_block(aaruformat_context *ctx)
Serialize the tracks metadata block and add it to the index.
Definition close.c:798
+
static void write_cicm_block(const aaruformat_context *ctx)
Serialize the CICM XML metadata block to the image file.
Definition close.c:3675
+
static void write_aaru_json_block(const aaruformat_context *ctx)
Serialize the Aaru metadata JSON block to the image file.
Definition close.c:3812
+
static void write_mode2_subheaders_block(aaruformat_context *ctx)
Serialize a MODE 2 (XA) subheaders data block.
Definition close.c:850
+
static void write_sector_subchannel(const aaruformat_context *ctx)
Serialize the per-sector subchannel or tag data block.
Definition close.c:1508
+
static void write_sector_prefix_ddt(aaruformat_context *ctx)
Serialize the per-sector CD prefix status / index DeDuplication Table (DDT v2, prefix variant).
Definition close.c:1206
+
static int32_t write_tape_ddt(aaruformat_context *ctx)
Converts tape DDT hash table to array format and writes it as a single-level DDT.
Definition close.c:596
+
static int32_t write_cached_secondary_ddt(aaruformat_context *ctx)
Flush a cached secondary (child) DeDuplication Table (DDT) to the image.
Definition close.c:77
+
static void write_metadata_block(aaruformat_context *ctx)
Serialize the metadata block containing image and media descriptive information.
Definition close.c:3162
+
static void write_sector_prefix(aaruformat_context *ctx)
Serialize the optional CD sector prefix block.
Definition close.c:966
+
static void write_dvd_title_key_decrypted_block(const aaruformat_context *ctx)
Serialize the DVD decrypted title key data block to the image file.
Definition close.c:2245
+
static void write_tape_file_block(const aaruformat_context *ctx)
Serialize the tape file metadata block to the image file.
Definition close.c:2669
+
#define LZMA_PROPERTIES_LENGTH
Size in bytes of the fixed LZMA properties header (lc/lp/pb + dictionary size).
Definition consts.h:82
+
#define AARU_MAGIC
Magic identifier for AaruFormat container (ASCII "AARUFRMT").
Definition consts.h:64
+
#define MD5_DIGEST_LENGTH
Definition context.h:69
+
struct TapeFileHashEntry tapeFileHashEntry
+
void aaruf_sha1_final(sha1_ctx *ctx, unsigned char *result)
Definition sha1.c:124
+
int32_t aaruf_cst_transform(const uint8_t *interleaved, uint8_t *sequential, size_t length)
Transforms interleaved subchannel data to sequential format.
Definition cst.c:35
+
int32_t aaruf_lzma_encode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, size_t src_size, uint8_t *out_props, size_t *out_props_size, int32_t level, uint32_t dict_size, int32_t lc, int32_t lp, int32_t pb, int32_t fb, int32_t num_threads)
Encodes a buffer using LZMA compression.
Definition lzma.c:65
+
uint64_t aaruf_crc64_data(const uint8_t *data, uint32_t len)
Definition crc64.c:160
+
int aaruf_crc64_update(crc64_ctx *ctx, const uint8_t *data, uint32_t len)
Updates the CRC64 context with new data.
Definition crc64.c:55
+
void aaruf_sha256_final(sha256_ctx *ctx, unsigned char *result)
Definition sha256.c:115
+
crc64_ctx * aaruf_crc64_init()
Initializes a CRC64 context.
Definition crc64.c:32
+
void aaruf_md5_final(md5_ctx *ctx, unsigned char *result)
Definition md5.c:475
+
void aaruf_spamsum_free(spamsum_ctx *ctx)
Frees a spamsum (fuzzy hash) context.
Definition spamsum.c:75
+
int32_t aaruf_get_datatype_for_media_tag_type(int32_t tag_type)
Converts an Aaru media tag type to an image data type.
Definition helpers.c:189
+
int aaruf_spamsum_final(spamsum_ctx *ctx, uint8_t *result)
Definition spamsum.c:191
+
int aaruf_crc64_final(crc64_ctx *ctx, uint64_t *crc)
Computes the final CRC64 value from the context.
Definition crc64.c:141
+
@ IndexBlock3
Block containing the index v3.
Definition enums.h:147
+
@ ChecksumBlock
Block containing contents checksums.
Definition enums.h:152
+
@ DataBlock
Block containing data.
Definition enums.h:141
+
@ TapePartitionBlock
Block containing list of partitions for a tape image.
Definition enums.h:158
+
@ GeometryBlock
Block containing logical geometry.
Definition enums.h:148
+
@ DeDuplicationTableSecondary
Block containing a secondary deduplication table (v2).
Definition enums.h:144
+
@ AaruMetadataJsonBlock
Block containing JSON version of Aaru Metadata.
Definition enums.h:159
+
@ CicmBlock
Block containing CICM XML metadata.
Definition enums.h:151
+
@ DeDuplicationTable2
Block containing a deduplication table v2.
Definition enums.h:143
+
@ TapeFileBlock
Block containing list of files for a tape image.
Definition enums.h:157
+
@ DumpHardwareBlock
Block containing an array of hardware used to create the image.
Definition enums.h:156
+
@ MetadataBlock
Block containing metadata.
Definition enums.h:149
+
@ TracksBlock
Block containing optical disc tracks.
Definition enums.h:150
+
@ OpticalDisc
Purely optical discs.
Definition enums.h:218
+
@ BlockMedia
Media that is physically block-based or abstracted like that.
Definition enums.h:219
+
@ Blake3
BLAKE3 hash.
Definition enums.h:173
+
@ Sha1
SHA-1 hash.
Definition enums.h:170
+
@ Md5
MD5 hash.
Definition enums.h:169
+
@ Sha256
SHA-256 hash.
Definition enums.h:171
+
@ SpamSum
SpamSum (context-triggered piecewise hash).
Definition enums.h:172
+
@ CdSectorSubchannel
Compact Disc subchannel data.
Definition enums.h:116
+
@ AppleProfileTag
Apple Profile (20‑byte) tag.
Definition enums.h:117
+
@ DvdSectorIed
DVD ID Error Detection Code (IED)
Definition enums.h:129
+
@ DvdSectorCprMai
DVD Copyright Management Information (CPR_MAI)
Definition enums.h:126
+
@ AppleSonyTag
Apple Sony (12‑byte) tag.
Definition enums.h:118
+
@ CdSectorPrefix
Compact Disc sector prefix (sync, header).
Definition enums.h:114
+
@ PriamDataTowerTag
Priam Data Tower (24‑byte) tag.
Definition enums.h:119
+
@ UserData
User (main) data.
Definition enums.h:46
+
@ DvdSectorEdc
DVD Error Detection Code (EDC)
Definition enums.h:130
+
@ DvdSectorTitleKeyDecrypted
Decrypted DVD Title Key.
Definition enums.h:127
+
@ DvdSectorId
DVD Identification Data (ID)
Definition enums.h:128
+
@ CdSectorSuffix
Compact Disc sector suffix (EDC, ECC P, ECC Q).
Definition enums.h:115
+
@ CompactDiscMode2Subheader
Compact Disc MODE 2 subheader.
Definition enums.h:123
+
@ AARU_FEATURE_RW_BLAKE3
BLAKE3 checksum is present (read/write support for BLAKE3 hashes).
Definition enums.h:265
+
@ AARUF_STATUS_INVALID_CONTEXT
Provided context/handle is invalid.
Definition enums.h:209
+
@ Lzma
LZMA compression.
Definition enums.h:34
+
@ LzmaClauniaSubchannelTransform
LZMA applied to Claunia Subchannel Transform processed data.
Definition enums.h:36
+
@ None
Not compressed.
Definition enums.h:33
+
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
Definition errors.h:75
+
#define AARUF_ERROR_NOT_ENOUGH_MEMORY
Memory allocation failure (critical).
Definition errors.h:48
+
#define AARUF_ERROR_CANNOT_WRITE_HEADER
Failure writing container header.
Definition errors.h:60
+
@ AppleProfile
Definition aaru.h:698
+
@ AppleSonySS
3.5", SS, DD, 80 tracks, 8 to 12 spt, 512 bytes/sector, GCR
Definition aaru.h:247
+
@ PriamDataTower
Definition aaru.h:701
+
@ AppleFileWare
5.25", DS, ?D, ?? tracks, ?? spt, 512 bytes/sector, GCR, opposite side heads, aka Twiggy
Definition aaru.h:249
+
@ AppleSonyDS
3.5", DS, DD, 80 tracks, 8 to 12 spt, 512 bytes/sector, GCR
Definition aaru.h:248
+
void free_map(hash_map_t *map)
Frees all memory associated with a hash map.
Definition hash_map.c:73
+ +
int32_t aaruf_close_current_block(aaruformat_context *ctx)
Finalizes and writes the current data block to the AaruFormat image file.
Definition write.c:1383
+ +
#define FATAL(fmt,...)
Definition log.h:40
+
#define TRACE(fmt,...)
Definition log.h:25
+
#define SHA1_DIGEST_LENGTH
Definition sha1.h:39
+
#define SHA256_DIGEST_LENGTH
Definition sha256.h:38
+
#define FUZZY_MAX_RESULT
Definition spamsum.h:30
+
Version 2 container header with GUID, alignment shifts, and feature negotiation bitmaps.
Definition header.h:107
+
uint64_t featureCompatible
Feature bits: unimplemented bits are ignorable (still R/W safe).
Definition header.h:122
+
uint64_t indexOffset
Absolute byte offset to primary index block (MUST be > 0; 0 => corrupt/unreadable).
Definition header.h:115
+
Header for an Aaru metadata JSON block (identifier == BlockType::AaruMetadataJsonBlock).
Definition metadata.h:120
+
uint32_t identifier
Block identifier, must be BlockType::AaruMetadataJsonBlock.
Definition metadata.h:121
+
uint32_t length
Length in bytes of the Aaru metadata JSON payload that follows.
Definition metadata.h:122
+
Header preceding the compressed data payload of a data block (BlockType::DataBlock).
Definition data.h:71
+
uint32_t cmpLength
Size in bytes of the compressed payload immediately following this header.
Definition data.h:76
+
uint32_t length
Size in bytes of the uncompressed payload resulting after decompression.
Definition data.h:77
+
uint32_t identifier
Block identifier, must be BlockType::DataBlock.
Definition data.h:72
+
uint64_t cmpCrc64
CRC64-ECMA of the compressed payload (cmpLength bytes).
Definition data.h:78
+
uint64_t crc64
CRC64-ECMA of the uncompressed payload (length bytes).
Definition data.h:79
+
uint16_t type
Logical data classification (value from DataType).
Definition data.h:73
+
uint16_t compression
Compression algorithm used (value from CompressionType).
Definition data.h:74
+
Per-checksum metadata immediately followed by the digest / signature bytes.
Definition checksum.h:91
+
uint32_t length
Length in bytes of the digest that immediately follows this structure.
Definition checksum.h:93
+
uint8_t type
Algorithm used (value from ChecksumAlgorithm).
Definition checksum.h:92
+
Header that precedes the sequence of checksum entries for a checksum block.
Definition checksum.h:74
+
uint32_t identifier
Block identifier, must be BlockType::ChecksumBlock.
Definition checksum.h:75
+
uint32_t length
Length in bytes of the payload (all entries + their digest data, excluding this header).
Definition checksum.h:76
+
uint8_t entries
Number of checksum entries that follow in the payload.
Definition checksum.h:77
+
uint8_t * spamsum
SpamSum fuzzy hash (ASCII), allocated length+1 with trailing 0.
Definition context.h:110
+
bool hasSha256
True if sha256[] buffer populated.
Definition context.h:103
+
uint8_t sha1[20]
SHA-1 digest (20 bytes).
Definition context.h:107
+
uint8_t sha256[32]
SHA-256 digest (32 bytes).
Definition context.h:108
+
uint8_t md5[16]
MD5 digest (16 bytes).
Definition context.h:106
+
bool hasSpamSum
True if spamsum pointer allocated and signature read.
Definition context.h:105
+
bool hasSha1
True if sha1[] buffer populated.
Definition context.h:102
+
uint8_t blake3[BLAKE3_OUT_LEN]
BLAKE3 digest (32 bytes).
Definition context.h:109
+
bool hasMd5
True if md5[] buffer populated.
Definition context.h:101
+
bool hasBlake3
True if blake3[] buffer populated.
Definition context.h:104
+
Header for a CICM XML metadata block (identifier == BlockType::CicmBlock).
Definition metadata.h:108
+
uint32_t length
Length in bytes of the CICM metadata payload that follows.
Definition metadata.h:110
+
uint32_t identifier
Block identifier, must be BlockType::CicmBlock.
Definition metadata.h:109
+
Header preceding a version 2 hierarchical deduplication table.
Definition ddt.h:142
+
uint64_t cmpCrc64
CRC64-ECMA of compressed table payload.
Definition ddt.h:161
+
uint16_t type
Data classification (DataType) for sectors referenced by this table.
Definition ddt.h:144
+
uint64_t start
Base internal index covered by this table (used for secondary tables; currently informational).
Definition ddt.h:153
+
uint16_t overflow
Trailing dumped sectors beyond user area (overflow range), still mapped with entries.
Definition ddt.h:151
+
uint64_t crc64
CRC64-ECMA of uncompressed table payload.
Definition ddt.h:162
+
uint64_t entries
Number of entries contained in (uncompressed) table payload.
Definition ddt.h:158
+
uint8_t levels
Total number of hierarchy levels (root depth); > 0.
Definition ddt.h:146
+
uint64_t length
Uncompressed payload size in bytes.
Definition ddt.h:160
+
uint32_t identifier
Block identifier, must be BlockType::DeDuplicationTable2.
Definition ddt.h:143
+
uint8_t tableShift
2^tableShift = number of logical sectors per primary entry (multi-level only; 0 for single-level or s...
Definition ddt.h:156
+
uint64_t blocks
Total internal span (negative + usable + overflow) in logical sectors.
Definition ddt.h:150
+
uint16_t negative
Leading negative LBA count; added to external L to build internal index.
Definition ddt.h:149
+
uint8_t blockAlignmentShift
2^blockAlignmentShift = block alignment boundary in bytes.
Definition ddt.h:154
+
uint8_t tableLevel
Zero-based level index of this table (0 = root, increases downward).
Definition ddt.h:147
+
uint16_t compression
Compression algorithm for this table body (CompressionType).
Definition ddt.h:145
+
uint8_t dataShift
2^dataShift = sectors represented per increment in blockIndex field.
Definition ddt.h:155
+
uint64_t cmpLength
Compressed payload size in bytes.
Definition ddt.h:159
+
uint64_t previousLevelOffset
Absolute byte offset of the parent (previous) level table; 0 if root.
Definition ddt.h:148
+
Inclusive [start,end] logical sector range contributed by a single hardware environment.
Definition context.h:333
+
uint8_t * firmware
Firmware version string or NULL.
Definition context.h:320
+
uint8_t * revision
Hardware revision string or NULL.
Definition context.h:319
+
uint8_t * model
Model string or NULL.
Definition context.h:318
+
uint8_t * softwareName
Dump software name or NULL.
Definition context.h:322
+
struct DumpExtent * extents
Array of extents (entry.extents elements) or NULL.
Definition context.h:316
+
uint8_t * manufacturer
Manufacturer string (UTF-8) or NULL.
Definition context.h:317
+
uint8_t * softwareVersion
Dump software version or NULL.
Definition context.h:323
+
uint8_t * serial
Serial number string or NULL.
Definition context.h:321
+
DumpHardwareEntry entry
Fixed-size header with lengths & counts.
Definition context.h:315
+
uint8_t * softwareOperatingSystem
Host operating system string or NULL.
Definition context.h:324
+
Per-environment length table describing subsequent UTF-8 strings and optional extent array.
Definition dump.h:113
+
uint32_t softwareNameLength
Length in bytes of dumping software name string.
Definition dump.h:119
+
uint32_t manufacturerLength
Length in bytes of manufacturer UTF-8 string.
Definition dump.h:114
+
uint32_t softwareVersionLength
Length in bytes of dumping software version string.
Definition dump.h:120
+
uint32_t firmwareLength
Length in bytes of firmware version string.
Definition dump.h:117
+
uint32_t extents
Number of DumpExtent records following the strings (0 = none).
Definition dump.h:122
+
uint32_t modelLength
Length in bytes of model UTF-8 string.
Definition dump.h:115
+
uint32_t serialLength
Length in bytes of device serial number string.
Definition dump.h:118
+
uint32_t revisionLength
Length in bytes of revision / hardware revision string.
Definition dump.h:116
+
uint32_t softwareOperatingSystemLength
Length in bytes of host operating system string.
Definition dump.h:121
+
Header that precedes a sequence of dump hardware entries and their variable-length payload.
Definition dump.h:91
+
uint64_t crc64
CRC64-ECMA of the payload (byte-swapped for legacy v1 images, handled automatically).
Definition dump.h:95
+
uint32_t identifier
Block identifier, must be BlockType::DumpHardwareBlock.
Definition dump.h:92
+
uint32_t length
Total payload bytes after this header (sum of entries, strings, and extents arrays).
Definition dump.h:94
+
uint16_t entries
Number of DumpHardwareEntry records that follow.
Definition dump.h:93
+
Legacy CHS style logical geometry metadata (BlockType::GeometryBlock).
Definition data.h:91
+
uint32_t identifier
Block identifier, must be BlockType::GeometryBlock.
Definition data.h:92
+
uint32_t MediaType
Media type identifier (see MediaType enum; 0=Unknown)
Definition aaru.h:881
+
uint8_t MetadataMediaType
Media type for sidecar generation (internal archival use)
Definition aaru.h:882
+
uint64_t Sectors
Total count of addressable logical sectors/blocks.
Definition aaru.h:874
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
uint32_t blockType
Block identifier of the referenced block (value from BlockType).
Definition index.h:110
+
uint64_t offset
Absolute byte offset in the image where the referenced block header begins.
Definition index.h:112
+
uint16_t dataType
Data classification (value from DataType) or unused for untyped blocks.
Definition index.h:111
+
Index header (version 3) adding hierarchical chaining (identifier == IndexBlock3).
Definition index.h:93
+
uint64_t previous
File offset of a previous IndexBlock3 header (0 if none / root segment).
Definition index.h:97
+
uint32_t identifier
Block identifier (must be BlockType::IndexBlock3).
Definition index.h:94
+
uint64_t crc64
CRC64-ECMA of the local entries array (does NOT cover subindexes or previous chains).
Definition index.h:96
+
uint64_t entries
Number of IndexEntry records that follow in this (sub)index block.
Definition index.h:95
+
Header for a metadata block containing offsets and lengths to UTF-16LE descriptive strings.
Definition metadata.h:69
+
uint32_t commentsLength
Length in bytes (including null) of comments string.
Definition metadata.h:78
+
int32_t mediaSequence
Sequence number within a multi-disc / multi-volume set (0-based or 1-based as producer defines).
Definition metadata.h:72
+
uint32_t identifier
Block identifier, must be BlockType::MetadataBlock.
Definition metadata.h:70
+
uint32_t mediaTitleOffset
Offset to UTF-16LE media title string.
Definition metadata.h:79
+
uint32_t driveModelLength
Length in bytes (including null) of drive model string.
Definition metadata.h:94
+
uint32_t driveManufacturerLength
Length in bytes (including null) of drive manufacturer string.
Definition metadata.h:92
+
uint32_t blockSize
Total size in bytes of the entire metadata block (header + strings).
Definition metadata.h:71
+
uint32_t driveModelOffset
Offset to UTF-16LE drive model string.
Definition metadata.h:93
+
uint32_t mediaModelOffset
Offset to UTF-16LE media model string.
Definition metadata.h:83
+
uint32_t creatorOffset
Offset to UTF-16LE creator string (or undefined if creatorLength==0).
Definition metadata.h:75
+
uint32_t mediaTitleLength
Length in bytes (including null) of media title string.
Definition metadata.h:80
+
uint32_t mediaManufacturerOffset
Offset to UTF-16LE media manufacturer string.
Definition metadata.h:81
+
uint32_t driveSerialNumberLength
Length in bytes (including null) of drive serial number string.
Definition metadata.h:96
+
uint32_t driveSerialNumberOffset
Offset to UTF-16LE drive serial number string.
Definition metadata.h:95
+
uint32_t mediaManufacturerLength
Length in bytes (including null) of media manufacturer string.
Definition metadata.h:82
+
uint32_t mediaModelLength
Length in bytes (including null) of media model string.
Definition metadata.h:84
+
uint32_t driveFirmwareRevisionOffset
Offset to UTF-16LE drive firmware revision string.
Definition metadata.h:97
+
int32_t lastMediaSequence
Total number of media in the set; 0 or 1 if single item.
Definition metadata.h:74
+
uint32_t commentsOffset
Offset to UTF-16LE comments string.
Definition metadata.h:77
+
uint32_t driveManufacturerOffset
Offset to UTF-16LE drive manufacturer string.
Definition metadata.h:91
+
uint32_t mediaSerialNumberOffset
Offset to UTF-16LE media serial number string.
Definition metadata.h:85
+
uint32_t mediaSerialNumberLength
Length in bytes (including null) of media serial number string.
Definition metadata.h:86
+
uint32_t mediaPartNumberOffset
Offset to UTF-16LE media part number string.
Definition metadata.h:89
+
uint32_t mediaPartNumberLength
Length in bytes (including null) of media part number string.
Definition metadata.h:90
+
uint32_t mediaBarcodeLength
Length in bytes (including null) of media barcode string.
Definition metadata.h:88
+
uint32_t creatorLength
Length in bytes (including null) of creator string (0 if absent).
Definition metadata.h:76
+
uint32_t driveFirmwareRevisionLength
Length in bytes (including null) of drive firmware revision string.
Definition metadata.h:98
+
uint32_t mediaBarcodeOffset
Offset to UTF-16LE media barcode string.
Definition metadata.h:87
+ +
uint64_t key
Key: sector address.
Definition context.h:142
+
uint64_t value
Value: DDT entry.
Definition context.h:143
+
Describes a single logical file on a tape medium.
Definition tape.h:134
+
TapeFileEntry fileEntry
The actual tape file data.
Definition context.h:129
+
Header for a tape file metadata block containing file layout information.
Definition tape.h:238
+
uint32_t identifier
Block type identifier.
Definition tape.h:239
+
uint64_t crc64
CRC64-ECMA checksum of the entry data.
Definition tape.h:245
+
uint64_t length
Size of entry data in bytes (excluding this header).
Definition tape.h:243
+
Describes a single physical partition on a tape medium.
Definition tape.h:320
+ +
TapePartitionEntry partitionEntry
The actual tape partition data.
Definition context.h:136
+
Header for a tape partition metadata block containing partition layout information.
Definition tape.h:441
+
uint64_t crc64
CRC64-ECMA checksum of the entry data.
Definition tape.h:448
+
uint64_t length
Size of entry data in bytes (excluding this header).
Definition tape.h:446
+
uint32_t identifier
Block type identifier.
Definition tape.h:442
+
Single optical disc track descriptor (sequence, type, LBAs, session, ISRC, flags).
Definition optical.h:72
+
Header for an optical tracks block listing track entries.
Definition optical.h:62
+
uint16_t entries
Number of TrackEntry records following this header.
Definition optical.h:64
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
uint8_t * media_barcode
Barcode of the media represented by the image.
Definition context.h:222
+
DdtHeader2 user_data_ddt_header
Active user data DDT v2 header (primary table meta).
Definition context.h:189
+
Checksums checksums
Whole-image checksums discovered.
Definition context.h:269
+
uint8_t * creator
Who (person) created the image?
Definition context.h:216
+
bool deduplicate
Storage deduplication active (duplicates coalesce).
Definition context.h:298
+
bool compression_enabled
True if block compression enabled (writing path).
Definition context.h:299
+
uint8_t * cicm_block
CICM XML payload.
Definition context.h:214
+
uint8_t * sector_cpr_mai
DVD sector CPR_MAI (6 bytes) if present.
Definition context.h:207
+
hash_map_t * sector_hash_map
Deduplication hash map (fingerprint->entry mapping).
Definition context.h:253
+
uint8_t * sector_prefix_corrected
Corrected variant (post error correction) if stored.
Definition context.h:200
+
uint64_t * user_data_ddt
Legacy flat DDT pointer (NULL when using v2 mini/big arrays).
Definition context.h:181
+
sha256_ctx sha256_context
Opaque SHA-256 context for streaming updates.
Definition context.h:272
+
bool calculating_sha256
True if whole-image SHA-256 being calculated on-the-fly.
Definition context.h:275
+
uint8_t * drive_firmware_revision
Firmware revision of the drive used to read the media represented by the image.
Definition context.h:228
+
uint8_t * media_serial_number
Serial number of the media represented by the image.
Definition context.h:221
+
uint8_t * sector_ied
DVD sector IED (2 bytes) if present.
Definition context.h:206
+
md5_ctx md5_context
Opaque MD5 context for streaming updates.
Definition context.h:270
+
uint64_t * user_data_ddt2
DDT entries (big variant) primary/secondary current.
Definition context.h:187
+
MetadataBlockHeader metadata_block_header
Metadata block header.
Definition context.h:230
+
uint8_t * sector_prefix
Raw per-sector prefix (e.g., sync+header) uncorrected.
Definition context.h:199
+
uint64_t * sector_suffix_ddt2
CD sector suffix DDT V2.
Definition context.h:186
+
tapeFileHashEntry * tape_files
Hash table root for tape files.
Definition context.h:302
+
uint64_t cached_ddt_offset
File offset of currently cached secondary DDT (0=none).
Definition context.h:190
+
bool is_tape
True if the image is a tape image.
Definition context.h:304
+
uint8_t * sector_edc
DVD sector EDC (4 bytes) if present.
Definition context.h:208
+
bool calculating_sha1
True if whole-image SHA-1 being calculated on-the-fly.
Definition context.h:274
+
uint8_t * media_model
Model of the media represented by the image.
Definition context.h:220
+
uint8_t * drive_serial_number
Serial number of the drive used to read the media represented by the image.
Definition context.h:226
+
CdEccContext * ecc_cd_context
CD ECC/EDC helper tables (allocated on demand).
Definition context.h:248
+
uint32_t * sector_suffix_ddt
Legacy CD sector suffix DDT.
Definition context.h:184
+
uint8_t * drive_manufacturer
Manufacturer of the drive used to read the media represented by the image.
Definition context.h:224
+
bool in_memory_ddt
True if primary (and possibly secondary) DDT loaded.
Definition context.h:196
+
uint8_t * sector_suffix
Raw per-sector suffix (EDC/ECC) uncorrected.
Definition context.h:201
+
AaruHeaderV2 header
Parsed container header (v2).
Definition context.h:175
+
bool is_writing
True if context opened/created for writing.
Definition context.h:292
+
TapeDdtHashEntry * tape_ddt
Hash table root for tape DDT entries.
Definition context.h:182
+
spamsum_ctx * spamsum_context
Opaque SpamSum context for streaming updates.
Definition context.h:267
+
CicmMetadataBlock cicm_block_header
CICM metadata header (if present).
Definition context.h:231
+
size_t sector_prefix_offset
Current position in sector_prefix.
Definition context.h:286
+
uint8_t * drive_model
Model of the drive used to read the media represented by the image.
Definition context.h:225
+
uint64_t magic
File magic (AARU_MAGIC) post-open.
Definition context.h:174
+
uint8_t * writing_buffer
Accumulation buffer for current block data.
Definition context.h:280
+
uint64_t * sector_prefix_ddt2
CD sector prefix DDT V2.
Definition context.h:185
+
bool calculating_spamsum
True if whole-image SpamSum being calculated on-the-fly.
Definition context.h:276
+
uint64_t primary_ddt_offset
File offset of the primary DDT v2 table.
Definition context.h:192
+
mediaTagEntry * mediaTags
Hash table of extra media tags (uthash root).
Definition context.h:264
+
blake3_hasher * blake3_context
Opaque BLAKE3 context for streaming updates.
Definition context.h:268
+
bool calculating_blake3
True if whole-image BLAKE3 being calculated on-the-fly.
Definition context.h:277
+
struct DumpHardwareEntriesWithData * dump_hardware_entries_with_data
Array of dump hardware entries + strings.
Definition context.h:212
+
bool calculating_md5
True if whole-image MD5 being calculated on-the-fly.
Definition context.h:273
+
GeometryBlockHeader geometry_block
Logical geometry block (if present).
Definition context.h:229
+
size_t sector_suffix_offset
Current position in sector_suffix.
Definition context.h:287
+
uint64_t * cached_secondary_ddt2
Cached secondary table (big entries) or NULL.
Definition context.h:188
+
uint8_t * json_block
JSON metadata block payload (UTF-8).
Definition context.h:215
+
uint8_t * media_part_number
Part number of the media represented by the image.
Definition context.h:223
+
uint8_t * sector_decrypted_title_key
DVD decrypted title key (5 bytes) if present.
Definition context.h:209
+
AaruMetadataJsonBlockHeader json_block_header
JSON metadata block header (if present).
Definition context.h:233
+
uint8_t * sector_subchannel
Raw 96-byte subchannel (if captured).
Definition context.h:203
+
uint8_t * comments
Image comments.
Definition context.h:218
+
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
+
UT_array * index_entries
Flattened index entries (UT_array of IndexEntry).
Definition context.h:252
+
uint8_t * mode2_subheaders
MODE2 Form1/Form2 8-byte subheaders (concatenated).
Definition context.h:204
+
ImageInfo image_info
Exposed high-level image info summary.
Definition context.h:260
+
uint8_t * sector_id
DVD sector ID (4 bytes) if present.
Definition context.h:205
+
DumpHardwareHeader dump_hardware_header
Dump hardware header.
Definition context.h:232
+
sha1_ctx sha1_context
Opaque SHA-1 context for streaming updates.
Definition context.h:271
+
bool * readableSectorTags
Per-sector boolean array (optical tags read successfully?).
Definition context.h:263
+
TapePartitionHashEntry * tape_partitions
Hash table root for tape partitions.
Definition context.h:303
+
uint32_t * sector_prefix_ddt
Legacy CD sector prefix DDT (deprecated by *2).
Definition context.h:183
+
uint32_t lzma_dict_size
LZMA dictionary size (writing path).
Definition context.h:297
+
TrackEntry * track_entries
Full track list (tracksHeader.entries elements).
Definition context.h:242
+
uint8_t * sector_suffix_corrected
Corrected suffix if stored separately.
Definition context.h:202
+
uint8_t * metadata_block
Raw metadata UTF-16LE concatenated strings.
Definition context.h:213
+
uint64_t cached_ddt_position
Position index of cached secondary DDT.
Definition context.h:191
+
uint8_t * media_title
Title of the media represented by the image.
Definition context.h:217
+
size_t mapped_memory_ddt_size
Length of mmapped DDT if userDataDdt is mmapped.
Definition context.h:193
+
uint8_t * media_manufacturer
Manufacturer of the media represented by the image.
Definition context.h:219
+
TracksHeader tracks_header
Tracks header (optical) if present.
Definition context.h:244
+
Minimal ECMA-182 CRC64 incremental state container (running value only).
Definition crc64.h:56
+
Hash table entry for an arbitrary media tag (e.g., proprietary drive/medium descriptor).
Definition context.h:119
+
uint8_t * data
Tag data blob (opaque to library core); length bytes long.
Definition context.h:120
+
int32_t type
Numeric type identifier.
Definition context.h:121
+
uint32_t length
Length in bytes of data.
Definition context.h:122
+
+
+
+ + + + diff --git a/docs/html/consts_8h.html b/docs/html/consts_8h.html new file mode 100644 index 0000000..c366fa7 --- /dev/null +++ b/docs/html/consts_8h.html @@ -0,0 +1,438 @@ + + + + + + + +libaaruformat: include/aaruformat/consts.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
consts.h File Reference
+
+
+ +

Core public constants and compile‑time limits for the Aaru container format implementation. +More...

+ +

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Macros

#define DIC_MAGIC   0x544D52464D434944ULL
 Magic identifier for legacy DiscImageChef container (ASCII "DICMFRMT").
#define AARU_MAGIC   0x544D524655524141ULL
 Magic identifier for AaruFormat container (ASCII "AARUFRMT").
#define AARUF_VERSION   2
 Current image format major version (incompatible changes bump this).
#define AARUF_VERSION_V1   1
 First on‑disk version (C# implementation).
#define AARUF_VERSION_V2   2
 Second on‑disk version (C implementation).
#define MAX_CACHE_SIZE   536870912ULL
 Maximum read cache size (bytes).
#define LZMA_PROPERTIES_LENGTH   5
 Size in bytes of the fixed LZMA properties header (lc/lp/pb + dictionary size).
#define MAX_DDT_ENTRY_CACHE   16000000
 Maximum number of cached DDT entry descriptors retained in memory for fast duplicate detection.
#define SAMPLES_PER_SECTOR   588
 Red Book (CD‑DA) PCM samples per 2352‑byte sector: 44,100 Hz / 75 sectors per second = 588 samples.
#define MAX_FLAKE_BLOCK   4608
 FLAC maximum block size used for encoding audio sectors.
#define MIN_FLAKE_BLOCK   256
 FLAC minimum block size.
#define CD_XFIX_MASK   0xFF000000U
 Mask for extracting correction / fix flags in Compact Disc suffix/prefix DDT entries.
#define CD_DFIX_MASK   0x00FFFFFFU
 Mask for extracting positional index (lower 24 bits) in Compact Disc suffix/prefix deduplicated block entries.
+

Detailed Description

+

Core public constants and compile‑time limits for the Aaru container format implementation.

+

This header exposes magic identifiers, format version selectors, resource limits, codec parameter bounds, and bit masks used across libaaruformat. All values are immutable interface contracts; changing them breaks backward compatibility unless a new format version is declared.

+

Summary:

    +
  • Magic numbers (DIC_MAGIC, AARU_MAGIC) identify container families (legacy DiscImageChef vs AaruFormat).
  • +
  • Version macros distinguish format generations (V1 C# / legacy CRC endianness, V2 current C implementation).
  • +
  • Cache and table size limits provide protective upper bounds against runaway memory consumption.
  • +
  • Audio constants (SAMPLES_PER_SECTOR, MIN/MAX_FLAKE_BLOCK) align with Red Book (CD‑DA) and FLAC encoding best practices.
  • +
  • CD_* masks assist with extracting flags / positional subfields in deduplicated Compact Disc sector tables.
  • +
  • CRC64 constants implement ECMA‑182 polynomial and standard seed, enabling deterministic end‑to‑end block integrity.
  • +
+

Notes:

    +
  • Magic values are stored little‑endian on disk when written as 64‑bit integers; when inspecting raw bytes make sure to account for host endianness.
  • +
  • AARUF_VERSION must be incremented only when an incompatible on‑disk layout change is introduced.
  • +
  • MAX_DDT_ENTRY_CACHE is a soft upper bound sized to balance deduplication hit rate vs RAM; tune in future builds via configuration if adaptive heuristics are introduced.
  • +
  • The LZMA properties length (5) derives from the standard LZMA header (lc/lp/pb + dict size) and is constant for raw LZMA streams used here.
  • +
  • FLAC sample block guidance: empirical evaluation shows >4608 samples per block does not yield meaningful ratio gains for typical optical audio captures while increasing decode buffer size.
  • +
+

Thread safety: All macros are compile‑time constants; no synchronization required. Portability: Constants chosen to fit within 64‑bit targets; arithmetic assumes two's complement.

+ +

Definition in file consts.h.

+

Macro Definition Documentation

+ +

◆ AARU_MAGIC

+ +
+
+ + + + +
#define AARU_MAGIC   0x544D524655524141ULL
+
+ +

Magic identifier for AaruFormat container (ASCII "AARUFRMT").

+

Used in the primary header to assert correct file type.

+ +

Definition at line 64 of file consts.h.

+ +

Referenced by aaruf_close(), aaruf_close_current_block(), aaruf_create(), aaruf_get_aaru_json_metadata(), aaruf_get_cicm_metadata(), aaruf_get_comments(), aaruf_get_creator(), aaruf_get_drive_firmware_revision(), aaruf_get_drive_manufacturer(), aaruf_get_drive_model(), aaruf_get_drive_serial_number(), aaruf_get_dumphw(), aaruf_get_geometry(), aaruf_get_image_info(), aaruf_get_media_barcode(), aaruf_get_media_manufacturer(), aaruf_get_media_model(), aaruf_get_media_part_number(), aaruf_get_media_sequence(), aaruf_get_media_serial_number(), aaruf_get_media_title(), aaruf_get_negative_sectors(), aaruf_get_overflow_sectors(), aaruf_get_tape_file(), aaruf_get_tape_partition(), aaruf_get_tracks(), aaruf_get_user_sectors(), aaruf_identify_stream(), aaruf_open(), aaruf_read_media_tag(), aaruf_read_sector(), aaruf_read_sector_long(), aaruf_read_sector_tag(), aaruf_read_track_sector(), aaruf_set_aaru_json_metadata(), aaruf_set_comments(), aaruf_set_creator(), aaruf_set_drive_firmware_revision(), aaruf_set_drive_manufacturer(), aaruf_set_drive_model(), aaruf_set_drive_serial_number(), aaruf_set_dumphw(), aaruf_set_geometry(), aaruf_set_media_barcode(), aaruf_set_media_manufacturer(), aaruf_set_media_model(), aaruf_set_media_part_number(), aaruf_set_media_sequence(), aaruf_set_media_serial_number(), aaruf_set_media_title(), aaruf_set_tape_file(), aaruf_set_tape_partition(), aaruf_set_tracks(), aaruf_verify_image(), aaruf_write_media_tag(), aaruf_write_sector(), aaruf_write_sector_long(), and aaruf_write_sector_tag().

+ +
+
+ +

◆ AARUF_VERSION

+ +
+
+ + + + +
#define AARUF_VERSION   2
+
+ +

Current image format major version (incompatible changes bump this).

+

Readers should reject headers with a higher number unless explicitly forward compatible.

+ +

Definition at line 68 of file consts.h.

+ +

Referenced by aaruf_identify_stream(), and aaruf_open().

+ +
+
+ +

◆ AARUF_VERSION_V1

+ +
+
+ + + + +
#define AARUF_VERSION_V1   1
+
+ +

First on‑disk version (C# implementation).

+

Quirk: CRC64 values were stored byte‑swapped relative to ECMA‑182 canonical output.

+ +

Definition at line 71 of file consts.h.

+ +

Referenced by aaruf_verify_image(), process_data_block(), process_dumphw_block(), process_tracks_block(), verify_index_v1(), verify_index_v2(), and verify_index_v3().

+ +
+
+ +

◆ AARUF_VERSION_V2

+ +
+
+ + + + +
#define AARUF_VERSION_V2   2
+
+ +

Second on‑disk version (C implementation).

+

Introduced: extended header (GUID, feature bitmaps), hierarchical DDT v2, improved index (v2/v3), multi‑codec compression, refined metadata blocks.

+ +

Definition at line 75 of file consts.h.

+ +

Referenced by aaruf_create(), and aaruf_open().

+ +
+
+ +

◆ CD_DFIX_MASK

+ +
+
+ + + + +
#define CD_DFIX_MASK   0x00FFFFFFU
+
+ +

Mask for extracting positional index (lower 24 bits) in Compact Disc suffix/prefix deduplicated block entries.

+ +

Definition at line 102 of file consts.h.

+ +

Referenced by aaruf_read_sector_long().

+ +
+
+ +

◆ CD_XFIX_MASK

+ +
+
+ + + + +
#define CD_XFIX_MASK   0xFF000000U
+
+ +

Mask for extracting correction / fix flags in Compact Disc suffix/prefix DDT entries.

+

High 8 bits store status (see SectorStatus / CdFixFlags relationships).

+ +

Definition at line 100 of file consts.h.

+ +

Referenced by aaruf_read_sector_long().

+ +
+
+ +

◆ DIC_MAGIC

+ +
+
+ + + + +
#define DIC_MAGIC   0x544D52464D434944ULL
+
+ +

Magic identifier for legacy DiscImageChef container (ASCII "DICMFRMT").

+

Retained for backward compatibility / migration tooling.

+ +

Definition at line 61 of file consts.h.

+ +

Referenced by aaruf_identify_stream(), and aaruf_open().

+ +
+
+ +

◆ LZMA_PROPERTIES_LENGTH

+ + + +

◆ MAX_CACHE_SIZE

+ +
+
+ + + + +
#define MAX_CACHE_SIZE   536870912ULL
+
+ +

Maximum read cache size (bytes).

+

512 MiB chosen to prevent excessive resident memory while still enabling efficient sequential and moderate random access patterns.

+ +

Definition at line 79 of file consts.h.

+ +

Referenced by aaruf_create(), and aaruf_open().

+ +
+
+ +

◆ MAX_DDT_ENTRY_CACHE

+ +
+
+ + + + +
#define MAX_DDT_ENTRY_CACHE   16000000
+
+ +

Maximum number of cached DDT entry descriptors retained in memory for fast duplicate detection.

+

At 16,000,000 entries with a compact structure, this caps hash_map overhead while covering large images. (Approx memory just for lookup bookkeeping: ~16 bytes * N ≈ 256 MB worst case; typical effective <50% of cap.)

+ +

Definition at line 87 of file consts.h.

+ +
+
+ +

◆ MAX_FLAKE_BLOCK

+ +
+
+ + + + +
#define MAX_FLAKE_BLOCK   4608
+
+ +

FLAC maximum block size used for encoding audio sectors.

+

Empirically >4608 samples yields diminishing compression returns and higher decode latency.

+ +

Definition at line 94 of file consts.h.

+ +

Referenced by aaruf_close_current_block().

+ +
+
+ +

◆ MIN_FLAKE_BLOCK

+ +
+
+ + + + +
#define MIN_FLAKE_BLOCK   256
+
+ +

FLAC minimum block size.

+

CUETools.Codecs.FLAKE does not accept blocks smaller than 256 samples.

+ +

Definition at line 96 of file consts.h.

+ +

Referenced by aaruf_close_current_block().

+ +
+
+ +

◆ SAMPLES_PER_SECTOR

+ +
+
+ + + + +
#define SAMPLES_PER_SECTOR   588
+
+ +

Red Book (CD‑DA) PCM samples per 2352‑byte sector: 44,100 Hz / 75 sectors per second = 588 samples.

+ +

Definition at line 90 of file consts.h.

+ +

Referenced by aaruf_close_current_block().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/consts_8h.js b/docs/html/consts_8h.js new file mode 100644 index 0000000..5e1d2f2 --- /dev/null +++ b/docs/html/consts_8h.js @@ -0,0 +1,16 @@ +var consts_8h = +[ + [ "AARU_MAGIC", "consts_8h.html#a3c3ba66fe2b547655c9e4b16a1ba519a", null ], + [ "AARUF_VERSION", "consts_8h.html#adbbd4387273589f1c76a5f5786607013", null ], + [ "AARUF_VERSION_V1", "consts_8h.html#ac837e146bff4d0f3603e4a9e444358c6", null ], + [ "AARUF_VERSION_V2", "consts_8h.html#ad2fdced5805aa0364f1c5b073f81dd76", null ], + [ "CD_DFIX_MASK", "consts_8h.html#a0b24c62ef1b78b72b9f4a42918f39e13", null ], + [ "CD_XFIX_MASK", "consts_8h.html#aa64757ba31a320f675fca1062111180f", null ], + [ "DIC_MAGIC", "consts_8h.html#a13ba7a163f45ee45c977d63c408539ca", null ], + [ "LZMA_PROPERTIES_LENGTH", "consts_8h.html#a25fd08252b97a0230d3efc899bddd240", null ], + [ "MAX_CACHE_SIZE", "consts_8h.html#a6c8469dfe973ac952cf40394bd2c160b", null ], + [ "MAX_DDT_ENTRY_CACHE", "consts_8h.html#ac97c436bf02e6e7e7daea67d374f03cd", null ], + [ "MAX_FLAKE_BLOCK", "consts_8h.html#a207a31e861ea8e3a4f5ef52c13b42b3d", null ], + [ "MIN_FLAKE_BLOCK", "consts_8h.html#a3fd3617b4eb7e9548e0fd0ca8990e44a", null ], + [ "SAMPLES_PER_SECTOR", "consts_8h.html#a44401191f17a7c09a05e57ff9e5cff24", null ] +]; \ No newline at end of file diff --git a/docs/html/consts_8h_source.html b/docs/html/consts_8h_source.html new file mode 100644 index 0000000..509b39e --- /dev/null +++ b/docs/html/consts_8h_source.html @@ -0,0 +1,159 @@ + + + + + + + +libaaruformat: include/aaruformat/consts.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
consts.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_CONSTS_H
+
20#define LIBAARUFORMAT_CONSTS_H
+
21
+
22#ifndef _MSC_VER
+
23#pragma clang diagnostic push
+
24#pragma ide diagnostic ignored "OCUnusedMacroInspection"
+
25#endif
+
26
+
58
+
61#define DIC_MAGIC 0x544D52464D434944ULL
+
64#define AARU_MAGIC 0x544D524655524141ULL
+
65
+
68#define AARUF_VERSION 2
+
71#define AARUF_VERSION_V1 1
+
75#define AARUF_VERSION_V2 2
+
76
+
79#define MAX_CACHE_SIZE 536870912ULL
+
80
+
82#define LZMA_PROPERTIES_LENGTH 5
+
83
+
87#define MAX_DDT_ENTRY_CACHE 16000000
+
88
+
90#define SAMPLES_PER_SECTOR 588
+
91
+
94#define MAX_FLAKE_BLOCK 4608
+
96#define MIN_FLAKE_BLOCK 256
+
97
+
100#define CD_XFIX_MASK 0xFF000000U
+
102#define CD_DFIX_MASK 0x00FFFFFFU
+
103
+
104#ifndef _MSC_VER
+
105#pragma clang diagnostic pop
+
106#endif
+
107
+
108#endif // LIBAARUFORMAT_CONSTS_H
+
+
+
+ + + + diff --git a/docs/html/context_8h.html b/docs/html/context_8h.html new file mode 100644 index 0000000..24dfda3 --- /dev/null +++ b/docs/html/context_8h.html @@ -0,0 +1,326 @@ + + + + + + + +libaaruformat: include/aaruformat/context.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
context.h File Reference
+
+
+ +

Central runtime context structures for libaaruformat (image state, caches, checksum buffers). +More...

+
#include "blake3.h"
+#include "crc64.h"
+#include "hash_map.h"
+#include "lru.h"
+#include "md5.h"
+#include "sha1.h"
+#include "sha256.h"
+#include "spamsum.h"
+#include "structs.h"
+#include "utarray.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + +

+Data Structures

struct  CdEccContext
 Lookup tables and state for Compact Disc EDC/ECC (P/Q) regeneration / verification. More...
struct  Checksums
 Collected whole‑image checksums / hashes present in a checksum block. More...
struct  mediaTagEntry
 Hash table entry for an arbitrary media tag (e.g., proprietary drive/medium descriptor). More...
struct  TapeFileHashEntry
struct  TapePartitionHashEntry
struct  TapeDdtHashEntry
struct  aaruformat_context
 Master context representing an open or in‑creation Aaru image. More...
struct  DumpHardwareEntriesWithData
 In-memory representation of a dump hardware entry plus decoded variable-length fields & extents. More...
struct  DumpExtent
 Inclusive [start,end] logical sector range contributed by a single hardware environment. More...
+ + +

+Macros

#define MD5_DIGEST_LENGTH   16
+ + + + + + + + + + +

+Typedefs

typedef struct CdEccContext CdEccContext
typedef struct Checksums Checksums
typedef struct mediaTagEntry mediaTagEntry
typedef struct TapeFileHashEntry tapeFileHashEntry
typedef struct TapePartitionHashEntry TapePartitionHashEntry
typedef struct TapeDdtHashEntry TapeDdtHashEntry
typedef struct aaruformat_context aaruformat_context
typedef struct DumpHardwareEntriesWithData DumpHardwareEntriesWithData
typedef struct DumpExtent DumpExtent
+

Detailed Description

+

Central runtime context structures for libaaruformat (image state, caches, checksum buffers).

+

The principal structure, aaruformat_context, aggregates: header metadata, open stream handle, deduplication tables (DDT) currently in memory, optical disc auxiliary data (sector prefix/suffix/subchannel), track listings, geometry & metadata blocks, checksum accumulators, CRC & ECC helper contexts, hash map for deduplication, and transient write buffers.

+

Memory ownership model (unless otherwise stated): if a pointer field is non-NULL it is owned by the context and will be freed (or otherwise released) during context close / destruction. Callers must not free or reallocate these pointers directly. External callers should treat all internal buffers as read‑only unless explicitly writing.

+

Threading: a single context instance is NOT thread-safe; serialize access if used across threads. Lifetime: allocate, initialize/open, perform read/write/verify operations, then close/free.

+

Deduplication tables (DDT): only a subset (primary table + an active secondary + optional cache) is retained in RAM; large images may rely on lazy loading of secondary tables. Flags (inMemoryDdt, userDataDdt*, cachedSecondary*) indicate what is currently resident.

+

Optical auxiliary buffers (sectorPrefix / sectorSuffix / subchannel / corrected variants) are populated only for images where those components exist (e.g., raw CD dumps). They may be NULL for block devices / non‑optical media.

+

Index handling: indexEntries (UT_array) holds a flattened list of IndexEntry structures (regardless of v1/v2/v3). hash_map_t *sectorHashMap provides fast duplicate detection keyed by content fingerprint / sparse sector key.

+

Invariants / sanity expectations (not strictly enforced everywhere):

    +
  • magic == AARU_MAGIC after successful open/create.
  • +
  • header.imageMajorVersion <= AARUF_VERSION.
  • +
  • imageStream != NULL when any I/O method is in progress.
  • +
  • If deduplicate == false, sectorHashMap may still be populated for bookkeeping but duplicates are stored independently.
  • +
  • If userDataDdtMini != NULL then userDataDdtBig == NULL (and vice versa) for a given level.
  • +
+ +

Definition in file context.h.

+

Macro Definition Documentation

+ +

◆ MD5_DIGEST_LENGTH

+ +
+
+ + + + +
#define MD5_DIGEST_LENGTH   16
+
+ +

Definition at line 69 of file context.h.

+ +

Referenced by process_checksum_block(), and write_checksum_block().

+ +
+
+

Typedef Documentation

+ +

◆ aaruformat_context

+ +
+
+ + + + +
typedef struct aaruformat_context aaruformat_context
+
+ +
+
+ +

◆ CdEccContext

+ +
+
+ + + + +
typedef struct CdEccContext CdEccContext
+
+ +
+
+ +

◆ Checksums

+ +
+
+ + + + +
typedef struct Checksums Checksums
+
+ +
+
+ +

◆ DumpExtent

+ +
+
+ + + + +
typedef struct DumpExtent DumpExtent
+
+ +
+
+ +

◆ DumpHardwareEntriesWithData

+ +
+
+ + + + +
typedef struct DumpHardwareEntriesWithData DumpHardwareEntriesWithData
+
+ +
+
+ +

◆ mediaTagEntry

+ +
+
+ + + + +
typedef struct mediaTagEntry mediaTagEntry
+
+ +
+
+ +

◆ TapeDdtHashEntry

+ +
+
+ + + + +
typedef struct TapeDdtHashEntry TapeDdtHashEntry
+
+ +
+
+ +

◆ tapeFileHashEntry

+ +
+
+ + + + +
typedef struct TapeFileHashEntry tapeFileHashEntry
+
+ +
+
+ +

◆ TapePartitionHashEntry

+ +
+
+ + + + +
typedef struct TapePartitionHashEntry TapePartitionHashEntry
+
+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/context_8h.js b/docs/html/context_8h.js new file mode 100644 index 0000000..38a26e2 --- /dev/null +++ b/docs/html/context_8h.js @@ -0,0 +1,22 @@ +var context_8h = +[ + [ "CdEccContext", "structCdEccContext.html", "structCdEccContext" ], + [ "Checksums", "structChecksums.html", "structChecksums" ], + [ "mediaTagEntry", "structmediaTagEntry.html", "structmediaTagEntry" ], + [ "TapeFileHashEntry", "structTapeFileHashEntry.html", "structTapeFileHashEntry" ], + [ "TapePartitionHashEntry", "structTapePartitionHashEntry.html", "structTapePartitionHashEntry" ], + [ "TapeDdtHashEntry", "structTapeDdtHashEntry.html", "structTapeDdtHashEntry" ], + [ "aaruformat_context", "structaaruformat__context.html", "structaaruformat__context" ], + [ "DumpHardwareEntriesWithData", "structDumpHardwareEntriesWithData.html", "structDumpHardwareEntriesWithData" ], + [ "DumpExtent", "structDumpExtent.html", "structDumpExtent" ], + [ "MD5_DIGEST_LENGTH", "context_8h.html#a09a4f4b2f28cbe522d9b80153666029c", null ], + [ "aaruformat_context", "context_8h.html#a07c6208ca3659883538a68592b40b53b", null ], + [ "CdEccContext", "context_8h.html#a32dcff5b3409f48aa8f6741695193e9a", null ], + [ "Checksums", "context_8h.html#a269d576bb08923618502afa0ce77c869", null ], + [ "DumpExtent", "context_8h.html#aa607bc285ec04872be8d317bb16924f1", null ], + [ "DumpHardwareEntriesWithData", "context_8h.html#afdce598c4a7b73c31a747ac56458e178", null ], + [ "mediaTagEntry", "context_8h.html#a2db7e557df9bb4db40e140298b494946", null ], + [ "TapeDdtHashEntry", "context_8h.html#a6f261287fa8891601a626c6649b3196e", null ], + [ "tapeFileHashEntry", "context_8h.html#a5ba965cb003bc2d68a9f9e1c11225494", null ], + [ "TapePartitionHashEntry", "context_8h.html#a7dcde2e312674ec91292bf34f09b39d8", null ] +]; \ No newline at end of file diff --git a/docs/html/context_8h_source.html b/docs/html/context_8h_source.html new file mode 100644 index 0000000..ffdcfd6 --- /dev/null +++ b/docs/html/context_8h_source.html @@ -0,0 +1,562 @@ + + + + + + + +libaaruformat: include/aaruformat/context.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
context.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_CONTEXT_H
+
20#define LIBAARUFORMAT_CONTEXT_H
+
21
+
22#include "blake3.h"
+
23#include "crc64.h"
+
24#include "hash_map.h"
+
25#include "lru.h"
+
26#include "md5.h"
+
27#include "sha1.h"
+
28#include "sha256.h"
+
29#include "spamsum.h"
+
30#include "structs.h"
+
31#include "utarray.h"
+
32
+
67
+
68#ifndef MD5_DIGEST_LENGTH
+
69#define MD5_DIGEST_LENGTH 16
+
70#endif
+
71
+
72#ifndef SHA1_DIGEST_LENGTH
+
73#define SHA1_DIGEST_LENGTH 20
+
74#endif
+
75
+
76#ifndef SHA256_DIGEST_LENGTH
+
77#define SHA256_DIGEST_LENGTH 32
+
78#endif
+
79
+
+
85typedef struct CdEccContext
+
86{
+ +
88 uint8_t *ecc_b_table;
+
89 uint8_t *ecc_f_table;
+
90 uint32_t *edc_table;
+ +
+
92
+
+
99typedef struct Checksums
+
100{
+
101 bool hasMd5;
+
102 bool hasSha1;
+ + + + + + +
109 uint8_t blake3[BLAKE3_OUT_LEN];
+
110 uint8_t *spamsum;
+ +
+
112
+
+
118typedef struct mediaTagEntry
+
119{
+
120 uint8_t *data;
+
121 int32_t type;
+
122 uint32_t length;
+
123 UT_hash_handle hh;
+ +
+
125
+
+
126typedef struct TapeFileHashEntry
+
127{
+
128 uint64_t key;
+ +
130 UT_hash_handle hh;
+ +
+
132
+ +
139
+
+
140typedef struct TapeDdtHashEntry
+
141{
+
142 uint64_t key;
+
143 uint64_t value;
+
144 UT_hash_handle hh;
+ +
+
146
+
+
171typedef struct aaruformat_context
+
172{
+
173 /* Core & header */
+
174 uint64_t magic;
+ + + + +
179
+
180 /* Deduplication tables (DDT) */
+
181 uint64_t *user_data_ddt;
+ + + + + +
187 uint64_t *user_data_ddt2;
+ + + + + + + +
195 uint8_t shift;
+ +
197
+
198 /* Optical auxiliary buffers (NULL if not present) */
+
199 uint8_t *sector_prefix;
+ +
201 uint8_t *sector_suffix;
+ + + +
205 uint8_t *sector_id;
+
206 uint8_t *sector_ied;
+
207 uint8_t *sector_cpr_mai;
+
208 uint8_t *sector_edc;
+ +
210
+
211 /* Metadata & geometry */
+ +
213 uint8_t *metadata_block;
+
214 uint8_t *cicm_block;
+
215 uint8_t *json_block;
+
216 uint8_t *creator;
+
217 uint8_t *media_title;
+
218 uint8_t *comments;
+ +
220 uint8_t *media_model;
+ +
222 uint8_t *media_barcode;
+ + +
225 uint8_t *drive_model;
+ +
227 uint8_t
+ + + + + + +
234 uint32_t cylinders;
+
235 uint32_t heads;
+ + + +
240
+
241 /* Optical information */
+ + + + +
246
+
247 /* Integrity & ECC */
+ + +
250
+
251 /* Index & deduplication lookup */
+
252 UT_array *index_entries;
+ +
254
+
255 /* Caches */
+ + +
258
+
259 /* High-level summary */
+ +
261
+
262 /* Tags */
+ + +
265
+
266 /* Checksums */
+ +
268 blake3_hasher *blake3_context;
+ + + + + + + + + +
278
+
279 /* Write path */
+
280 uint8_t *writing_buffer;
+ + + + + + + + + + + +
293 bool rewinded;
+ +
295
+
296 /* Options */
+
297 uint32_t lzma_dict_size;
+ + +
300
+
301 /* Tape-specific structures */
+ + +
304 bool is_tape;
+ +
+
306
+ +
326
+
327#pragma pack(push, 1)
+
328
+
+
332typedef struct DumpExtent
+
333{
+
334 uint64_t start;
+
335 uint64_t end;
+ +
+
337
+
338#pragma pack(pop)
+
339
+
340#endif // LIBAARUFORMAT_CONTEXT_H
+
#define MD5_DIGEST_LENGTH
Definition context.h:69
+
struct TapeFileHashEntry tapeFileHashEntry
+
CRC64 (ECMA-182) core context and precomputed slicing-by-4 tables.
+ + + + +
#define SHA1_DIGEST_LENGTH
Definition sha1.h:39
+ +
#define SHA256_DIGEST_LENGTH
Definition sha256.h:38
+ +
Version 2 container header with GUID, alignment shifts, and feature negotiation bitmaps.
Definition header.h:107
+
Header for an Aaru metadata JSON block (identifier == BlockType::AaruMetadataJsonBlock).
Definition metadata.h:120
+
Header preceding the compressed data payload of a data block (BlockType::DataBlock).
Definition data.h:71
+
Cache top-level descriptor encapsulating the hash table root and capacity limit.
Definition lru.h:46
+
Lookup tables and state for Compact Disc EDC/ECC (P/Q) regeneration / verification.
Definition context.h:86
+
uint8_t * ecc_f_table
Forward (F) ECC table.
Definition context.h:89
+
bool inited_edc
True once EDC/ECC tables have been initialized.
Definition context.h:87
+
uint32_t * edc_table
EDC (CRC) lookup table.
Definition context.h:90
+
uint8_t * ecc_b_table
Backward (B) ECC table (allocated, size implementation-defined).
Definition context.h:88
+
Collected whole‑image checksums / hashes present in a checksum block.
Definition context.h:100
+
uint8_t * spamsum
SpamSum fuzzy hash (ASCII), allocated length+1 with trailing 0.
Definition context.h:110
+
bool hasSha256
True if sha256[] buffer populated.
Definition context.h:103
+
uint8_t sha1[20]
SHA-1 digest (20 bytes).
Definition context.h:107
+
uint8_t sha256[32]
SHA-256 digest (32 bytes).
Definition context.h:108
+
uint8_t md5[16]
MD5 digest (16 bytes).
Definition context.h:106
+
bool hasSpamSum
True if spamsum pointer allocated and signature read.
Definition context.h:105
+
bool hasSha1
True if sha1[] buffer populated.
Definition context.h:102
+
uint8_t blake3[BLAKE3_OUT_LEN]
BLAKE3 digest (32 bytes).
Definition context.h:109
+
bool hasMd5
True if md5[] buffer populated.
Definition context.h:101
+
bool hasBlake3
True if blake3[] buffer populated.
Definition context.h:104
+
Header for a CICM XML metadata block (identifier == BlockType::CicmBlock).
Definition metadata.h:108
+
Header preceding a version 2 hierarchical deduplication table.
Definition ddt.h:142
+
Inclusive [start,end] logical sector range contributed by a single hardware environment.
Definition context.h:333
+
uint64_t end
Ending LBA (inclusive); >= start.
Definition context.h:335
+
uint64_t start
Starting LBA (inclusive).
Definition context.h:334
+
In-memory representation of a dump hardware entry plus decoded variable-length fields & extents.
Definition context.h:314
+
uint8_t * firmware
Firmware version string or NULL.
Definition context.h:320
+
uint8_t * revision
Hardware revision string or NULL.
Definition context.h:319
+
uint8_t * model
Model string or NULL.
Definition context.h:318
+
uint8_t * softwareName
Dump software name or NULL.
Definition context.h:322
+
struct DumpExtent * extents
Array of extents (entry.extents elements) or NULL.
Definition context.h:316
+
uint8_t * manufacturer
Manufacturer string (UTF-8) or NULL.
Definition context.h:317
+
uint8_t * softwareVersion
Dump software version or NULL.
Definition context.h:323
+
uint8_t * serial
Serial number string or NULL.
Definition context.h:321
+
DumpHardwareEntry entry
Fixed-size header with lengths & counts.
Definition context.h:315
+
uint8_t * softwareOperatingSystem
Host operating system string or NULL.
Definition context.h:324
+
Per-environment length table describing subsequent UTF-8 strings and optional extent array.
Definition dump.h:113
+
Header that precedes a sequence of dump hardware entries and their variable-length payload.
Definition dump.h:91
+
Legacy CHS style logical geometry metadata (BlockType::GeometryBlock).
Definition data.h:91
+
High-level summary of an opened Aaru image containing metadata and media characteristics.
Definition aaru.h:870
+
Header for a metadata block containing offsets and lengths to UTF-16LE descriptive strings.
Definition metadata.h:69
+ +
UT_hash_handle hh
UTHASH handle.
Definition context.h:144
+
uint64_t key
Key: sector address.
Definition context.h:142
+
uint64_t value
Value: DDT entry.
Definition context.h:143
+
Describes a single logical file on a tape medium.
Definition tape.h:134
+ +
UT_hash_handle hh
UTHASH handle.
Definition context.h:130
+
uint64_t key
Composite key: partition << 32 | file.
Definition context.h:128
+
TapeFileEntry fileEntry
The actual tape file data.
Definition context.h:129
+
Describes a single physical partition on a tape medium.
Definition tape.h:320
+ +
UT_hash_handle hh
UTHASH handle.
Definition context.h:137
+
uint8_t key
Key: partition.
Definition context.h:135
+
TapePartitionEntry partitionEntry
The actual tape partition data.
Definition context.h:136
+
Single optical disc track descriptor (sequence, type, LBAs, session, ISRC, flags).
Definition optical.h:72
+
Header for an optical tracks block listing track entries.
Definition optical.h:62
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
uint8_t * media_barcode
Barcode of the media represented by the image.
Definition context.h:222
+
DdtHeader2 user_data_ddt_header
Active user data DDT v2 header (primary table meta).
Definition context.h:189
+
Checksums checksums
Whole-image checksums discovered.
Definition context.h:269
+
uint8_t library_major_version
Linked library major version.
Definition context.h:177
+
uint8_t * creator
Who (person) created the image?
Definition context.h:216
+
bool deduplicate
Storage deduplication active (duplicates coalesce).
Definition context.h:298
+
size_t sector_suffix_length
Length of sector_suffix.
Definition context.h:285
+
bool compression_enabled
True if block compression enabled (writing path).
Definition context.h:299
+
uint64_t last_written_block
Last written block number (write path).
Definition context.h:283
+
uint8_t * cicm_block
CICM XML payload.
Definition context.h:214
+
uint8_t * sector_cpr_mai
DVD sector CPR_MAI (6 bytes) if present.
Definition context.h:207
+
hash_map_t * sector_hash_map
Deduplication hash map (fingerprint->entry mapping).
Definition context.h:253
+
uint8_t * sector_prefix_corrected
Corrected variant (post error correction) if stored.
Definition context.h:200
+
uint64_t * user_data_ddt
Legacy flat DDT pointer (NULL when using v2 mini/big arrays).
Definition context.h:181
+
sha256_ctx sha256_context
Opaque SHA-256 context for streaming updates.
Definition context.h:272
+
TrackEntry * data_tracks
Filtered list of data tracks (subset of trackEntries).
Definition context.h:243
+
uint32_t cylinders
Cylinders of the media represented by the image.
Definition context.h:234
+
bool calculating_sha256
True if whole-image SHA-256 being calculated on-the-fly.
Definition context.h:275
+
uint8_t * drive_firmware_revision
Firmware revision of the drive used to read the media represented by the image.
Definition context.h:228
+
uint8_t * media_serial_number
Serial number of the media represented by the image.
Definition context.h:221
+
struct CacheHeader block_header_cache
LRU/Cache header for block headers.
Definition context.h:256
+
uint8_t * sector_ied
DVD sector IED (2 bytes) if present.
Definition context.h:206
+
md5_ctx md5_context
Opaque MD5 context for streaming updates.
Definition context.h:270
+
uint64_t * user_data_ddt2
DDT entries (big variant) primary/secondary current.
Definition context.h:187
+
MetadataBlockHeader metadata_block_header
Metadata block header.
Definition context.h:230
+
int32_t media_sequence
Number in sequence for the media represented by the image.
Definition context.h:238
+
uint8_t shift
Legacy overall shift (deprecated by data_shift/table_shift).
Definition context.h:195
+
uint8_t * sector_prefix
Raw per-sector prefix (e.g., sync+header) uncorrected.
Definition context.h:199
+
uint64_t * sector_suffix_ddt2
CD sector suffix DDT V2.
Definition context.h:186
+
tapeFileHashEntry * tape_files
Hash table root for tape files.
Definition context.h:302
+
uint64_t cached_ddt_offset
File offset of currently cached secondary DDT (0=none).
Definition context.h:190
+
bool is_tape
True if the image is a tape image.
Definition context.h:304
+
uint8_t * sector_edc
DVD sector EDC (4 bytes) if present.
Definition context.h:208
+
bool calculating_sha1
True if whole-image SHA-1 being calculated on-the-fly.
Definition context.h:274
+
uint8_t * media_model
Model of the media represented by the image.
Definition context.h:220
+
uint8_t * drive_serial_number
Serial number of the drive used to read the media represented by the image.
Definition context.h:226
+
CdEccContext * ecc_cd_context
CD ECC/EDC helper tables (allocated on demand).
Definition context.h:248
+
bool rewinded
True if stream has been rewound after open (write path).
Definition context.h:293
+
struct CacheHeader block_cache
LRU/Cache header for block payloads.
Definition context.h:257
+
uint32_t * sector_suffix_ddt
Legacy CD sector suffix DDT.
Definition context.h:184
+
uint8_t * drive_manufacturer
Manufacturer of the drive used to read the media represented by the image.
Definition context.h:224
+
bool in_memory_ddt
True if primary (and possibly secondary) DDT loaded.
Definition context.h:196
+
uint8_t * sector_suffix
Raw per-sector suffix (EDC/ECC) uncorrected.
Definition context.h:201
+
AaruHeaderV2 header
Parsed container header (v2).
Definition context.h:175
+
int current_block_offset
Logical offset inside block (units: bytes or sectors depending on path).
Definition context.h:288
+
bool is_writing
True if context opened/created for writing.
Definition context.h:292
+
TapeDdtHashEntry * tape_ddt
Hash table root for tape DDT entries.
Definition context.h:182
+
spamsum_ctx * spamsum_context
Opaque SpamSum context for streaming updates.
Definition context.h:267
+
CicmMetadataBlock cicm_block_header
CICM metadata header (if present).
Definition context.h:231
+
size_t sector_prefix_offset
Current position in sector_prefix.
Definition context.h:286
+
uint8_t * drive_model
Model of the drive used to read the media represented by the image.
Definition context.h:225
+
BlockHeader current_block_header
Header for block currently being assembled (write path).
Definition context.h:281
+
int ddt_version
DDT version in use (1=legacy, 2=v2 hierarchical).
Definition context.h:194
+
uint64_t magic
File magic (AARU_MAGIC) post-open.
Definition context.h:174
+
uint8_t * writing_buffer
Accumulation buffer for current block data.
Definition context.h:280
+
uint64_t * sector_prefix_ddt2
CD sector prefix DDT V2.
Definition context.h:185
+
bool calculating_spamsum
True if whole-image SpamSum being calculated on-the-fly.
Definition context.h:276
+
uint64_t primary_ddt_offset
File offset of the primary DDT v2 table.
Definition context.h:192
+
size_t sector_prefix_length
Length of sector_prefix.
Definition context.h:284
+
mediaTagEntry * mediaTags
Hash table of extra media tags (uthash root).
Definition context.h:264
+
blake3_hasher * blake3_context
Opaque BLAKE3 context for streaming updates.
Definition context.h:268
+
bool calculating_blake3
True if whole-image BLAKE3 being calculated on-the-fly.
Definition context.h:277
+
uint8_t library_minor_version
Linked library minor version;.
Definition context.h:178
+
struct DumpHardwareEntriesWithData * dump_hardware_entries_with_data
Array of dump hardware entries + strings.
Definition context.h:212
+
uint64_t next_block_position
Absolute file offset where next block will be written.
Definition context.h:282
+
bool calculating_md5
True if whole-image MD5 being calculated on-the-fly.
Definition context.h:273
+
GeometryBlockHeader geometry_block
Logical geometry block (if present).
Definition context.h:229
+
size_t sector_suffix_offset
Current position in sector_suffix.
Definition context.h:287
+
uint64_t * cached_secondary_ddt2
Cached secondary table (big entries) or NULL.
Definition context.h:188
+
uint8_t * json_block
JSON metadata block payload (UTF-8).
Definition context.h:215
+
uint8_t * media_part_number
Part number of the media represented by the image.
Definition context.h:223
+
uint8_t * sector_decrypted_title_key
DVD decrypted title key (5 bytes) if present.
Definition context.h:209
+
AaruMetadataJsonBlockHeader json_block_header
JSON metadata block header (if present).
Definition context.h:233
+
int writing_buffer_position
Current size / position within writingBuffer.
Definition context.h:289
+
crc64_ctx * crc64_context
Opaque CRC64 context for streaming updates.
Definition context.h:249
+
uint32_t sectors_per_track
Sectors per track of the media represented by the image (for variable image, the smallest)
Definition context.h:236
+
uint8_t * sector_subchannel
Raw 96-byte subchannel (if captured).
Definition context.h:203
+
uint8_t * comments
Image comments.
Definition context.h:218
+
uint32_t heads
Heads of the media represented by the image.
Definition context.h:235
+
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
+
UT_array * index_entries
Flattened index entries (UT_array of IndexEntry).
Definition context.h:252
+
uint8_t * mode2_subheaders
MODE2 Form1/Form2 8-byte subheaders (concatenated).
Definition context.h:204
+
ImageInfo image_info
Exposed high-level image info summary.
Definition context.h:260
+
uint8_t * sector_id
DVD sector ID (4 bytes) if present.
Definition context.h:205
+
DumpHardwareHeader dump_hardware_header
Dump hardware header.
Definition context.h:232
+
sha1_ctx sha1_context
Opaque SHA-1 context for streaming updates.
Definition context.h:271
+
bool * readableSectorTags
Per-sector boolean array (optical tags read successfully?).
Definition context.h:263
+
TapePartitionHashEntry * tape_partitions
Hash table root for tape partitions.
Definition context.h:303
+
uint32_t * sector_prefix_ddt
Legacy CD sector prefix DDT (deprecated by *2).
Definition context.h:183
+
uint32_t lzma_dict_size
LZMA dictionary size (writing path).
Definition context.h:297
+
TrackEntry * track_entries
Full track list (tracksHeader.entries elements).
Definition context.h:242
+
uint8_t number_of_data_tracks
Count of tracks considered "data" (sequence 1..99 heuristics).
Definition context.h:245
+
uint8_t * sector_suffix_corrected
Corrected suffix if stored separately.
Definition context.h:202
+
uint8_t * metadata_block
Raw metadata UTF-16LE concatenated strings.
Definition context.h:213
+
uint64_t cached_ddt_position
Position index of cached secondary DDT.
Definition context.h:191
+
uint8_t current_track_type
Current track type (when writing optical images with tracks, needed for block compression type).
Definition context.h:290
+
bool writing_long
True if writing long sectors.
Definition context.h:294
+
uint8_t * media_title
Title of the media represented by the image.
Definition context.h:217
+
int32_t last_media_sequence
Last media of the sequence the media represented by the image corresponds to.
Definition context.h:239
+
size_t mapped_memory_ddt_size
Length of mmapped DDT if userDataDdt is mmapped.
Definition context.h:193
+
uint8_t * media_manufacturer
Manufacturer of the media represented by the image.
Definition context.h:219
+
TracksHeader tracks_header
Tracks header (optical) if present.
Definition context.h:244
+
Minimal ECMA-182 CRC64 incremental state container (running value only).
Definition crc64.h:56
+
Minimal open-addressing hash map for 64-bit key/value pairs used in deduplication lookup.
Definition hash_map.h:50
+
Definition md5.h:32
+
Hash table entry for an arbitrary media tag (e.g., proprietary drive/medium descriptor).
Definition context.h:119
+
uint8_t * data
Tag data blob (opaque to library core); length bytes long.
Definition context.h:120
+
int32_t type
Numeric type identifier.
Definition context.h:121
+
uint32_t length
Length in bytes of data.
Definition context.h:122
+
UT_hash_handle hh
uthash linkage.
Definition context.h:123
+ + + + +
+
+
+ + + + diff --git a/docs/html/cookie.js b/docs/html/cookie.js new file mode 100644 index 0000000..53ad21d --- /dev/null +++ b/docs/html/cookie.js @@ -0,0 +1,58 @@ +/*! + Cookie helper functions + Copyright (c) 2023 Dimitri van Heesch + Released under MIT license. +*/ +let Cookie = { + cookie_namespace: 'doxygen_', + + readSetting(cookie,defVal) { + if (window.chrome) { + const val = localStorage.getItem(this.cookie_namespace+cookie) || + sessionStorage.getItem(this.cookie_namespace+cookie); + if (val) return val; + } else { + let myCookie = this.cookie_namespace+cookie+"="; + if (document.cookie) { + const index = document.cookie.indexOf(myCookie); + if (index != -1) { + const valStart = index + myCookie.length; + let valEnd = document.cookie.indexOf(";", valStart); + if (valEnd == -1) { + valEnd = document.cookie.length; + } + return document.cookie.substring(valStart, valEnd); + } + } + } + return defVal; + }, + + writeSetting(cookie,val,days=10*365) { // default days='forever', 0=session cookie, -1=delete + if (window.chrome) { + if (days==0) { + sessionStorage.setItem(this.cookie_namespace+cookie,val); + } else { + localStorage.setItem(this.cookie_namespace+cookie,val); + } + } else { + let date = new Date(); + date.setTime(date.getTime()+(days*24*60*60*1000)); + const expiration = days!=0 ? "expires="+date.toGMTString()+";" : ""; + document.cookie = this.cookie_namespace + cookie + "=" + + val + "; SameSite=Lax;" + expiration + "path=/"; + } + }, + + eraseSetting(cookie) { + if (window.chrome) { + if (localStorage.getItem(this.cookie_namespace+cookie)) { + localStorage.removeItem(this.cookie_namespace+cookie); + } else if (sessionStorage.getItem(this.cookie_namespace+cookie)) { + sessionStorage.removeItem(this.cookie_namespace+cookie); + } + } else { + this.writeSetting(cookie,'',-1); + } + }, +} diff --git a/docs/html/crc64_8c.html b/docs/html/crc64_8c.html new file mode 100644 index 0000000..4aa6216 --- /dev/null +++ b/docs/html/crc64_8c.html @@ -0,0 +1,342 @@ + + + + + + + +libaaruformat: src/crc64/crc64.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
crc64.c File Reference
+
+
+
#include <stdlib.h>
+#include <aaruformat.h>
+#include "log.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + +

+Functions

crc64_ctxaaruf_crc64_init (void)
 Initializes a CRC64 context.
int aaruf_crc64_update (crc64_ctx *ctx, const uint8_t *data, uint32_t len)
 Updates the CRC64 context with new data.
void aaruf_crc64_slicing (uint64_t *previous_crc, const uint8_t *data, uint32_t len)
 Updates a CRC64 value using the slicing-by-8 algorithm.
int aaruf_crc64_final (crc64_ctx *ctx, uint64_t *crc)
 Computes the final CRC64 value from the context.
void aaruf_crc64_free (crc64_ctx *ctx)
 Frees a CRC64 context.
uint64_t aaruf_crc64_data (const uint8_t *data, const uint32_t len)
+

Function Documentation

+ +

◆ aaruf_crc64_data()

+ + + +

◆ aaruf_crc64_final()

+ +
+
+ + + + + + + + + + + +
int aaruf_crc64_final (crc64_ctx * ctx,
uint64_t * crc )
+
+ +

Computes the final CRC64 value from the context.

+
Parameters
+ + + +
ctxPointer to the CRC64 context.
crcPointer to store the resulting CRC64 value.
+
+
+
Returns
0 on success, -1 on error.
+ +

Definition at line 141 of file crc64.c.

+ +

References AARU_CALL, AARU_EXPORT, crc64_ctx::crc, and CRC64_ECMA_SEED.

+ +

Referenced by aaruf_close_current_block(), aaruf_crc64_data(), aaruf_verify_image(), decode_ddt_multi_level_v2(), process_ddt_v2(), set_ddt_multi_level_v2(), verify_index_v2(), verify_index_v3(), write_cached_secondary_ddt(), write_index_block(), and write_primary_ddt().

+ +
+
+ +

◆ aaruf_crc64_free()

+ +
+
+ + + + + + + +
void aaruf_crc64_free (crc64_ctx * ctx)
+
+ +

Frees a CRC64 context.

+
Parameters
+ + +
ctxPointer to the CRC64 context to free.
+
+
+ +

Definition at line 155 of file crc64.c.

+ +

References AARU_CALL, and AARU_EXPORT.

+ +

Referenced by aaruf_close_current_block(), aaruf_crc64_data(), aaruf_verify_image(), verify_index_v2(), and verify_index_v3().

+ +
+
+ +

◆ aaruf_crc64_init()

+ +
+
+ + + + + + + +
crc64_ctx * aaruf_crc64_init (void )
+
+ +

Initializes a CRC64 context.

+

Allocates and initializes a CRC64 context for checksum calculations.

+
Returns
Pointer to the initialized crc64_ctx structure, or NULL on failure.
+ +

Definition at line 32 of file crc64.c.

+ +

References AARU_CALL, AARU_EXPORT, crc64_ctx::crc, CRC64_ECMA_SEED, and TRACE.

+ +

Referenced by aaruf_close_current_block(), aaruf_crc64_data(), aaruf_verify_image(), decode_ddt_multi_level_v2(), process_ddt_v2(), set_ddt_multi_level_v2(), verify_index_v2(), verify_index_v3(), write_cached_secondary_ddt(), write_index_block(), and write_primary_ddt().

+ +
+
+ +

◆ aaruf_crc64_slicing()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_crc64_slicing (uint64_t * previous_crc,
const uint8_t * data,
uint32_t len )
+
+ +

Updates a CRC64 value using the slicing-by-8 algorithm.

+
Parameters
+ + + + +
previous_crcPointer to the previous CRC64 value (input/output).
dataPointer to the data buffer.
lenLength of the data buffer in bytes.
+
+
+ +

Definition at line 102 of file crc64.c.

+ +

References AARU_CALL, AARU_EXPORT, and crc64_table.

+ +

Referenced by aaruf_crc64_update().

+ +
+
+ +

◆ aaruf_crc64_update()

+ +
+
+ + + + + + + + + + + + + + + + +
int aaruf_crc64_update (crc64_ctx * ctx,
const uint8_t * data,
uint32_t len )
+
+ +

Updates the CRC64 context with new data.

+

Processes the given data buffer and updates the CRC64 value in the context.

+
Parameters
+ + + + +
ctxPointer to the CRC64 context.
dataPointer to the data buffer.
lenLength of the data buffer.
+
+
+
Returns
0 on success, or -1 on error.
+ +

Definition at line 55 of file crc64.c.

+ +

References AARU_CALL, AARU_EXPORT, aaruf_crc64_slicing(), crc64_ctx::crc, and TRACE.

+ +

Referenced by aaruf_close_current_block(), aaruf_crc64_data(), decode_ddt_multi_level_v2(), process_ddt_v2(), set_ddt_multi_level_v2(), update_crc64_from_stream(), verify_index_v2(), verify_index_v3(), write_cached_secondary_ddt(), write_index_block(), and write_primary_ddt().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/crc64_8c.js b/docs/html/crc64_8c.js new file mode 100644 index 0000000..f6218b7 --- /dev/null +++ b/docs/html/crc64_8c.js @@ -0,0 +1,9 @@ +var crc64_8c = +[ + [ "aaruf_crc64_data", "crc64_8c.html#adae8cec415b4af4b7a9e8a4a74d82828", null ], + [ "aaruf_crc64_final", "crc64_8c.html#ae48cfb59c6585e9ffd4cd1a97044891f", null ], + [ "aaruf_crc64_free", "crc64_8c.html#a4943569a8623eb2e3e0adc276c433097", null ], + [ "aaruf_crc64_init", "crc64_8c.html#af16f2c48e857f46bedf48db0bf495bad", null ], + [ "aaruf_crc64_slicing", "crc64_8c.html#a83ecd1f5636915aebacfd29fc6306520", null ], + [ "aaruf_crc64_update", "crc64_8c.html#a1fb4423a841ccd728e3ad0d028cbc9b4", null ] +]; \ No newline at end of file diff --git a/docs/html/crc64_8c_source.html b/docs/html/crc64_8c_source.html new file mode 100644 index 0000000..2013b0c --- /dev/null +++ b/docs/html/crc64_8c_source.html @@ -0,0 +1,269 @@ + + + + + + + +libaaruformat: src/crc64/crc64.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
crc64.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <stdlib.h>
+
20
+
21#include <aaruformat.h>
+
22
+
23#include "log.h"
+
24
+
+ +
33{
+
34 TRACE("Entering aaruf_crc64_init()");
+
35 crc64_ctx *ctx = malloc(sizeof(crc64_ctx));
+
36
+
37 if(!ctx) return NULL;
+
38
+
39 ctx->crc = CRC64_ECMA_SEED;
+
40
+
41 TRACE("Exiting aaruf_crc64_init()");
+
42 return ctx;
+
43}
+
+
44
+
+
55AARU_EXPORT int AARU_CALL aaruf_crc64_update(crc64_ctx *ctx, const uint8_t *data, uint32_t len)
+
56{
+
57 TRACE("Entering aaruf_crc64_update(%p, %p, %u)", ctx, data, len);
+
58 if(!ctx || !data)
+
59 {
+
60 TRACE("Exiting aaruf_crc64_update() = -1");
+
61 return -1;
+
62 }
+
63
+
64#if defined(__x86_64__) || defined(__amd64) || defined(_M_AMD64) || defined(_M_X64) || defined(__I386__) || \
+
65 defined(__i386__) || defined(__THW_INTEL) || defined(_M_IX86)
+
66 if(have_clmul())
+
67 {
+
68 ctx->crc = ~aaruf_crc64_clmul(~ctx->crc, data, len);
+
69
+
70 TRACE("Exiting aaruf_crc64_update() = 0");
+
71 return 0;
+
72 }
+
73#endif
+
74
+
75#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
+
76 if(have_neon())
+
77 {
+
78 ctx->crc = ~aaruf_crc64_vmull(~ctx->crc, data, len);
+
79
+
80 TRACE("Exiting aaruf_crc64_update() = 0");
+
81 return 0;
+
82 }
+
83#endif
+
84
+
85 // Unroll according to Intel slicing by uint8_t
+
86 // http://www.intel.com/technology/comms/perfnet/download/CRC_generators.pdf
+
87 // http://sourceforge.net/projects/slicing-by-8/
+
88
+
89 aaruf_crc64_slicing(&ctx->crc, data, len);
+
90
+
91 TRACE("Exiting aaruf_crc64_update() = 0");
+
92 return 0;
+
93}
+
+
94
+
+
102AARU_EXPORT void AARU_CALL aaruf_crc64_slicing(uint64_t *previous_crc, const uint8_t *data, uint32_t len)
+
103{
+
104 uint64_t c = *previous_crc;
+
105
+
106 if(len > 4)
+
107 {
+
108 const uint8_t *limit = NULL;
+
109
+
110 while((uintptr_t)data & 3)
+
111 {
+
112 c = crc64_table[0][*data++ ^ c & 0xFF] ^ c >> 8;
+
113 --len;
+
114 }
+
115
+
116 limit = data + (len & ~(uint32_t)3);
+
117 len &= (uint32_t)3;
+
118
+
119 while(data < limit)
+
120 {
+
121 const uint32_t tmp = c ^ *(const uint32_t *)data;
+
122 data += 4;
+
123
+
124 c = crc64_table[3][(tmp & 0xFF)] ^ crc64_table[2][(tmp >> 8 & 0xFF)] ^ c >> 32 ^
+
125 crc64_table[1][(tmp >> 16 & 0xFF)] ^ crc64_table[0][(tmp >> 24)];
+
126 }
+
127 }
+
128
+
129 while(len-- != 0) c = crc64_table[0][*data++ ^ c & 0xFF] ^ c >> 8;
+
130
+
131 *previous_crc = c;
+
132}
+
+
133
+
+ +
142{
+
143 if(!ctx) return -1;
+
144
+
145 *crc = ctx->crc ^ CRC64_ECMA_SEED;
+
146
+
147 return 0;
+
148}
+
+
149
+
+ +
156{
+
157 if(ctx) free(ctx);
+
158}
+
+
159
+
+
160AARU_EXPORT uint64_t AARU_CALL aaruf_crc64_data(const uint8_t *data, const uint32_t len)
+
161{
+ +
163 uint64_t crc = 0;
+
164
+
165 if(!ctx) return crc;
+
166
+
167 aaruf_crc64_update(ctx, data, len);
+
168 aaruf_crc64_final(ctx, &crc);
+
169 aaruf_crc64_free(ctx);
+
170
+
171 return crc;
+
172}
+
+ +
int aaruf_crc64_update(crc64_ctx *ctx, const uint8_t *data, uint32_t len)
Updates the CRC64 context with new data.
Definition crc64.c:55
+
void aaruf_crc64_free(crc64_ctx *ctx)
Frees a CRC64 context.
Definition crc64.c:155
+
void aaruf_crc64_slicing(uint64_t *previous_crc, const uint8_t *data, uint32_t len)
Updates a CRC64 value using the slicing-by-8 algorithm.
Definition crc64.c:102
+
uint64_t aaruf_crc64_data(const uint8_t *data, const uint32_t len)
Definition crc64.c:160
+
int aaruf_crc64_final(crc64_ctx *ctx, uint64_t *crc)
Computes the final CRC64 value from the context.
Definition crc64.c:141
+
crc64_ctx * aaruf_crc64_init(void)
Initializes a CRC64 context.
Definition crc64.c:32
+
static const uint64_t crc64_table[4][256]
Precomputed slicing-by-4 ECMA-182 CRC64 lookup tables (4 * 256 * 8 = 8192 bytes).
Definition crc64.h:66
+
#define CRC64_ECMA_SEED
ECMA-182 initial seed (all bits set).
Definition crc64.h:280
+
#define AARU_CALL
Definition decls.h:45
+
#define AARU_EXPORT
Definition decls.h:54
+ +
#define TRACE(fmt,...)
Definition log.h:25
+
Minimal ECMA-182 CRC64 incremental state container (running value only).
Definition crc64.h:56
+
uint64_t crc
Running CRC value (initialize to CRC64_ECMA_SEED before first update).
Definition crc64.h:57
+
+
+
+ + + + diff --git a/docs/html/crc64_8h.html b/docs/html/crc64_8h.html new file mode 100644 index 0000000..49aeeab --- /dev/null +++ b/docs/html/crc64_8h.html @@ -0,0 +1,229 @@ + + + + + + + +libaaruformat: include/aaruformat/crc64.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
crc64.h File Reference
+
+
+ +

CRC64 (ECMA-182) core context and precomputed slicing-by-4 tables. +More...

+
#include <stdint.h>
+
+

Go to the source code of this file.

+ + + + +

+Data Structures

struct  crc64_ctx
 Minimal ECMA-182 CRC64 incremental state container (running value only). More...
+ + + + + +

+Macros

#define CRC64_ECMA_POLY   0xC96C5795D7870F42ULL
 ECMA-182 reflected polynomial constant.
#define CRC64_ECMA_SEED   0xFFFFFFFFFFFFFFFFULL
 ECMA-182 initial seed (all bits set).
+ + + +

+Variables

static const uint64_t crc64_table [4][256]
 Precomputed slicing-by-4 ECMA-182 CRC64 lookup tables (4 * 256 * 8 = 8192 bytes).
+

Detailed Description

+

CRC64 (ECMA-182) core context and precomputed slicing-by-4 tables.

+

Exposes:

    +
  • crc64_ctx: minimal incremental state (initialize crc to CRC64_ECMA_SEED).
  • +
  • crc64_table[4][256]: 4-way (slicing-by-4) lookup tables for high-throughput updates.
  • +
  • CRC64_ECMA_POLY / CRC64_ECMA_SEED macros matching ECMA-182 (reflected polynomial, all-bits-set seed).
  • +
+

Algorithm characteristics:

    +
  • Polynomial: 0xC96C5795D7870F42 (reflected form).
  • +
  • Seed / initial value: 0xFFFFFFFFFFFFFFFFULL.
  • +
  • Final XOR: none (raw accumulator is the result).
  • +
  • Bit order: reflected; least significant bit processed first.
  • +
+

Table layout & optimization: Four 256-entry tables are used (slicing-by-4) allowing 4-byte chunks to be folded per iteration, reducing data dependency chains compared to a single-table approach. This improves throughput on modern CPUs with abundant ILP.

+

Incremental usage (pseudo-code):

crc64_ctx ctx = { .crc = CRC64_ECMA_SEED };
+
ctx.crc = crc64_update(ctx.crc, buf, len); // internal helper using crc64_table
+
// ctx.crc now holds ECMA-182 CRC64 value.
+
#define CRC64_ECMA_SEED
ECMA-182 initial seed (all bits set).
Definition crc64.h:280
+
Minimal ECMA-182 CRC64 incremental state container (running value only).
Definition crc64.h:56
+
uint64_t crc
Running CRC value (initialize to CRC64_ECMA_SEED before first update).
Definition crc64.h:57
+

Thread safety: The table is read-only; each thread must use its own crc64_ctx. Endianness: Table values are host-endian 64-bit constants; algorithm result is endianness-agnostic.

+ +

Definition in file crc64.h.

+

Macro Definition Documentation

+ +

◆ CRC64_ECMA_POLY

+ +
+
+ + + + +
#define CRC64_ECMA_POLY   0xC96C5795D7870F42ULL
+
+ +

ECMA-182 reflected polynomial constant.

+ +

Definition at line 278 of file crc64.h.

+ +
+
+ +

◆ CRC64_ECMA_SEED

+ +
+
+ + + + +
#define CRC64_ECMA_SEED   0xFFFFFFFFFFFFFFFFULL
+
+ +

ECMA-182 initial seed (all bits set).

+ +

Definition at line 280 of file crc64.h.

+ +

Referenced by aaruf_crc64_final(), and aaruf_crc64_init().

+ +
+
+

Variable Documentation

+ +

◆ crc64_table

+ +
+
+ + + + + +
+ + + + +
const uint64_t crc64_table[4][256]
+
+static
+
+ +

Precomputed slicing-by-4 ECMA-182 CRC64 lookup tables (4 * 256 * 8 = 8192 bytes).

+

Each row corresponds to one byte lane in a 4-byte block update; actual folding logic resides in the implementation. Content generated offline; do not modify manually.

+ +

Definition at line 66 of file crc64.h.

+ +

Referenced by aaruf_crc64_slicing().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/crc64_8h.js b/docs/html/crc64_8h.js new file mode 100644 index 0000000..38b7707 --- /dev/null +++ b/docs/html/crc64_8h.js @@ -0,0 +1,7 @@ +var crc64_8h = +[ + [ "crc64_ctx", "structcrc64__ctx.html", "structcrc64__ctx" ], + [ "CRC64_ECMA_POLY", "crc64_8h.html#a4239d5693b3807b04cd1d3d5b173e9df", null ], + [ "CRC64_ECMA_SEED", "crc64_8h.html#ad72070c1e0954a95d3d8d3eb49e4ca06", null ], + [ "crc64_table", "crc64_8h.html#ac74d5f4eb89e0a1366aed271f46b6302", null ] +]; \ No newline at end of file diff --git a/docs/html/crc64_8h_source.html b/docs/html/crc64_8h_source.html new file mode 100644 index 0000000..a9823bf --- /dev/null +++ b/docs/html/crc64_8h_source.html @@ -0,0 +1,356 @@ + + + + + + + +libaaruformat: include/aaruformat/crc64.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
crc64.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_CRC64_H
+
20#define LIBAARUFORMAT_CRC64_H
+
21#include <stdint.h>
+
22
+
51
+
+
55typedef struct
+
56{
+
57 uint64_t crc;
+
58} crc64_ctx;
+
+
59
+
+
66const static uint64_t crc64_table[4][256] = {
+
67 {0x0000000000000000, 0xB32E4CBE03A75F6F, 0xF4843657A840A05B, 0x47AA7AE9ABE7FF34, 0x7BD0C384FF8F5E33,
+
68 0xC8FE8F3AFC28015C, 0x8F54F5D357CFFE68, 0x3C7AB96D5468A107, 0xF7A18709FF1EBC66, 0x448FCBB7FCB9E309,
+
69 0x0325B15E575E1C3D, 0xB00BFDE054F94352, 0x8C71448D0091E255, 0x3F5F08330336BD3A, 0x78F572DAA8D1420E,
+
70 0xCBDB3E64AB761D61, 0x7D9BA13851336649, 0xCEB5ED8652943926, 0x891F976FF973C612, 0x3A31DBD1FAD4997D,
+
71 0x064B62BCAEBC387A, 0xB5652E02AD1B6715, 0xF2CF54EB06FC9821, 0x41E11855055BC74E, 0x8A3A2631AE2DDA2F,
+
72 0x39146A8FAD8A8540, 0x7EBE1066066D7A74, 0xCD905CD805CA251B, 0xF1EAE5B551A2841C, 0x42C4A90B5205DB73,
+
73 0x056ED3E2F9E22447, 0xB6409F5CFA457B28, 0xFB374270A266CC92, 0x48190ECEA1C193FD, 0x0FB374270A266CC9,
+
74 0xBC9D3899098133A6, 0x80E781F45DE992A1, 0x33C9CD4A5E4ECDCE, 0x7463B7A3F5A932FA, 0xC74DFB1DF60E6D95,
+
75 0x0C96C5795D7870F4, 0xBFB889C75EDF2F9B, 0xF812F32EF538D0AF, 0x4B3CBF90F69F8FC0, 0x774606FDA2F72EC7,
+
76 0xC4684A43A15071A8, 0x83C230AA0AB78E9C, 0x30EC7C140910D1F3, 0x86ACE348F355AADB, 0x3582AFF6F0F2F5B4,
+
77 0x7228D51F5B150A80, 0xC10699A158B255EF, 0xFD7C20CC0CDAF4E8, 0x4E526C720F7DAB87, 0x09F8169BA49A54B3,
+
78 0xBAD65A25A73D0BDC, 0x710D64410C4B16BD, 0xC22328FF0FEC49D2, 0x85895216A40BB6E6, 0x36A71EA8A7ACE989,
+
79 0x0ADDA7C5F3C4488E, 0xB9F3EB7BF06317E1, 0xFE5991925B84E8D5, 0x4D77DD2C5823B7BA, 0x64B62BCAEBC387A1,
+
80 0xD7986774E864D8CE, 0x90321D9D438327FA, 0x231C512340247895, 0x1F66E84E144CD992, 0xAC48A4F017EB86FD,
+
81 0xEBE2DE19BC0C79C9, 0x58CC92A7BFAB26A6, 0x9317ACC314DD3BC7, 0x2039E07D177A64A8, 0x67939A94BC9D9B9C,
+
82 0xD4BDD62ABF3AC4F3, 0xE8C76F47EB5265F4, 0x5BE923F9E8F53A9B, 0x1C4359104312C5AF, 0xAF6D15AE40B59AC0,
+
83 0x192D8AF2BAF0E1E8, 0xAA03C64CB957BE87, 0xEDA9BCA512B041B3, 0x5E87F01B11171EDC, 0x62FD4976457FBFDB,
+
84 0xD1D305C846D8E0B4, 0x96797F21ED3F1F80, 0x2557339FEE9840EF, 0xEE8C0DFB45EE5D8E, 0x5DA24145464902E1,
+
85 0x1A083BACEDAEFDD5, 0xA9267712EE09A2BA, 0x955CCE7FBA6103BD, 0x267282C1B9C65CD2, 0x61D8F8281221A3E6,
+
86 0xD2F6B4961186FC89, 0x9F8169BA49A54B33, 0x2CAF25044A02145C, 0x6B055FEDE1E5EB68, 0xD82B1353E242B407,
+
87 0xE451AA3EB62A1500, 0x577FE680B58D4A6F, 0x10D59C691E6AB55B, 0xA3FBD0D71DCDEA34, 0x6820EEB3B6BBF755,
+
88 0xDB0EA20DB51CA83A, 0x9CA4D8E41EFB570E, 0x2F8A945A1D5C0861, 0x13F02D374934A966, 0xA0DE61894A93F609,
+
89 0xE7741B60E174093D, 0x545A57DEE2D35652, 0xE21AC88218962D7A, 0x5134843C1B317215, 0x169EFED5B0D68D21,
+
90 0xA5B0B26BB371D24E, 0x99CA0B06E7197349, 0x2AE447B8E4BE2C26, 0x6D4E3D514F59D312, 0xDE6071EF4CFE8C7D,
+
91 0x15BB4F8BE788911C, 0xA6950335E42FCE73, 0xE13F79DC4FC83147, 0x521135624C6F6E28, 0x6E6B8C0F1807CF2F,
+
92 0xDD45C0B11BA09040, 0x9AEFBA58B0476F74, 0x29C1F6E6B3E0301B, 0xC96C5795D7870F42, 0x7A421B2BD420502D,
+
93 0x3DE861C27FC7AF19, 0x8EC62D7C7C60F076, 0xB2BC941128085171, 0x0192D8AF2BAF0E1E, 0x4638A2468048F12A,
+
94 0xF516EEF883EFAE45, 0x3ECDD09C2899B324, 0x8DE39C222B3EEC4B, 0xCA49E6CB80D9137F, 0x7967AA75837E4C10,
+
95 0x451D1318D716ED17, 0xF6335FA6D4B1B278, 0xB199254F7F564D4C, 0x02B769F17CF11223, 0xB4F7F6AD86B4690B,
+
96 0x07D9BA1385133664, 0x4073C0FA2EF4C950, 0xF35D8C442D53963F, 0xCF273529793B3738, 0x7C0979977A9C6857,
+
97 0x3BA3037ED17B9763, 0x888D4FC0D2DCC80C, 0x435671A479AAD56D, 0xF0783D1A7A0D8A02, 0xB7D247F3D1EA7536,
+
98 0x04FC0B4DD24D2A59, 0x3886B22086258B5E, 0x8BA8FE9E8582D431, 0xCC0284772E652B05, 0x7F2CC8C92DC2746A,
+
99 0x325B15E575E1C3D0, 0x8175595B76469CBF, 0xC6DF23B2DDA1638B, 0x75F16F0CDE063CE4, 0x498BD6618A6E9DE3,
+
100 0xFAA59ADF89C9C28C, 0xBD0FE036222E3DB8, 0x0E21AC88218962D7, 0xC5FA92EC8AFF7FB6, 0x76D4DE52895820D9,
+
101 0x317EA4BB22BFDFED, 0x8250E80521188082, 0xBE2A516875702185, 0x0D041DD676D77EEA, 0x4AAE673FDD3081DE,
+
102 0xF9802B81DE97DEB1, 0x4FC0B4DD24D2A599, 0xFCEEF8632775FAF6, 0xBB44828A8C9205C2, 0x086ACE348F355AAD,
+
103 0x34107759DB5DFBAA, 0x873E3BE7D8FAA4C5, 0xC094410E731D5BF1, 0x73BA0DB070BA049E, 0xB86133D4DBCC19FF,
+
104 0x0B4F7F6AD86B4690, 0x4CE50583738CB9A4, 0xFFCB493D702BE6CB, 0xC3B1F050244347CC, 0x709FBCEE27E418A3,
+
105 0x3735C6078C03E797, 0x841B8AB98FA4B8F8, 0xADDA7C5F3C4488E3, 0x1EF430E13FE3D78C, 0x595E4A08940428B8,
+
106 0xEA7006B697A377D7, 0xD60ABFDBC3CBD6D0, 0x6524F365C06C89BF, 0x228E898C6B8B768B, 0x91A0C532682C29E4,
+
107 0x5A7BFB56C35A3485, 0xE955B7E8C0FD6BEA, 0xAEFFCD016B1A94DE, 0x1DD181BF68BDCBB1, 0x21AB38D23CD56AB6,
+
108 0x9285746C3F7235D9, 0xD52F0E859495CAED, 0x6601423B97329582, 0xD041DD676D77EEAA, 0x636F91D96ED0B1C5,
+
109 0x24C5EB30C5374EF1, 0x97EBA78EC690119E, 0xAB911EE392F8B099, 0x18BF525D915FEFF6, 0x5F1528B43AB810C2,
+
110 0xEC3B640A391F4FAD, 0x27E05A6E926952CC, 0x94CE16D091CE0DA3, 0xD3646C393A29F297, 0x604A2087398EADF8,
+
111 0x5C3099EA6DE60CFF, 0xEF1ED5546E415390, 0xA8B4AFBDC5A6ACA4, 0x1B9AE303C601F3CB, 0x56ED3E2F9E224471,
+
112 0xE5C372919D851B1E, 0xA26908783662E42A, 0x114744C635C5BB45, 0x2D3DFDAB61AD1A42, 0x9E13B115620A452D,
+
113 0xD9B9CBFCC9EDBA19, 0x6A978742CA4AE576, 0xA14CB926613CF817, 0x1262F598629BA778, 0x55C88F71C97C584C,
+
114 0xE6E6C3CFCADB0723, 0xDA9C7AA29EB3A624, 0x69B2361C9D14F94B, 0x2E184CF536F3067F, 0x9D36004B35545910,
+
115 0x2B769F17CF112238, 0x9858D3A9CCB67D57, 0xDFF2A94067518263, 0x6CDCE5FE64F6DD0C, 0x50A65C93309E7C0B,
+
116 0xE388102D33392364, 0xA4226AC498DEDC50, 0x170C267A9B79833F, 0xDCD7181E300F9E5E, 0x6FF954A033A8C131,
+
117 0x28532E49984F3E05, 0x9B7D62F79BE8616A, 0xA707DB9ACF80C06D, 0x14299724CC279F02, 0x5383EDCD67C06036,
+
118 0xE0ADA17364673F59},
+
119 {0x0000000000000000, 0x54E979925CD0F10D, 0xA9D2F324B9A1E21A, 0xFD3B8AB6E5711317, 0xC17D4962DC4DDAB1,
+
120 0x959430F0809D2BBC, 0x68AFBA4665EC38AB, 0x3C46C3D4393CC9A6, 0x10223DEE1795ABE7, 0x44CB447C4B455AEA,
+
121 0xB9F0CECAAE3449FD, 0xED19B758F2E4B8F0, 0xD15F748CCBD87156, 0x85B60D1E9708805B, 0x788D87A87279934C,
+
122 0x2C64FE3A2EA96241, 0x20447BDC2F2B57CE, 0x74AD024E73FBA6C3, 0x899688F8968AB5D4, 0xDD7FF16ACA5A44D9,
+
123 0xE13932BEF3668D7F, 0xB5D04B2CAFB67C72, 0x48EBC19A4AC76F65, 0x1C02B80816179E68, 0x3066463238BEFC29,
+
124 0x648F3FA0646E0D24, 0x99B4B516811F1E33, 0xCD5DCC84DDCFEF3E, 0xF11B0F50E4F32698, 0xA5F276C2B823D795,
+
125 0x58C9FC745D52C482, 0x0C2085E60182358F, 0x4088F7B85E56AF9C, 0x14618E2A02865E91, 0xE95A049CE7F74D86,
+
126 0xBDB37D0EBB27BC8B, 0x81F5BEDA821B752D, 0xD51CC748DECB8420, 0x28274DFE3BBA9737, 0x7CCE346C676A663A,
+
127 0x50AACA5649C3047B, 0x0443B3C41513F576, 0xF9783972F062E661, 0xAD9140E0ACB2176C, 0x91D78334958EDECA,
+
128 0xC53EFAA6C95E2FC7, 0x380570102C2F3CD0, 0x6CEC098270FFCDDD, 0x60CC8C64717DF852, 0x3425F5F62DAD095F,
+
129 0xC91E7F40C8DC1A48, 0x9DF706D2940CEB45, 0xA1B1C506AD3022E3, 0xF558BC94F1E0D3EE, 0x086336221491C0F9,
+
130 0x5C8A4FB0484131F4, 0x70EEB18A66E853B5, 0x2407C8183A38A2B8, 0xD93C42AEDF49B1AF, 0x8DD53B3C839940A2,
+
131 0xB193F8E8BAA58904, 0xE57A817AE6757809, 0x18410BCC03046B1E, 0x4CA8725E5FD49A13, 0x8111EF70BCAD5F38,
+
132 0xD5F896E2E07DAE35, 0x28C31C54050CBD22, 0x7C2A65C659DC4C2F, 0x406CA61260E08589, 0x1485DF803C307484,
+
133 0xE9BE5536D9416793, 0xBD572CA48591969E, 0x9133D29EAB38F4DF, 0xC5DAAB0CF7E805D2, 0x38E121BA129916C5,
+
134 0x6C0858284E49E7C8, 0x504E9BFC77752E6E, 0x04A7E26E2BA5DF63, 0xF99C68D8CED4CC74, 0xAD75114A92043D79,
+
135 0xA15594AC938608F6, 0xF5BCED3ECF56F9FB, 0x088767882A27EAEC, 0x5C6E1E1A76F71BE1, 0x6028DDCE4FCBD247,
+
136 0x34C1A45C131B234A, 0xC9FA2EEAF66A305D, 0x9D135778AABAC150, 0xB177A9428413A311, 0xE59ED0D0D8C3521C,
+
137 0x18A55A663DB2410B, 0x4C4C23F46162B006, 0x700AE020585E79A0, 0x24E399B2048E88AD, 0xD9D81304E1FF9BBA,
+
138 0x8D316A96BD2F6AB7, 0xC19918C8E2FBF0A4, 0x9570615ABE2B01A9, 0x684BEBEC5B5A12BE, 0x3CA2927E078AE3B3,
+
139 0x00E451AA3EB62A15, 0x540D28386266DB18, 0xA936A28E8717C80F, 0xFDDFDB1CDBC73902, 0xD1BB2526F56E5B43,
+
140 0x85525CB4A9BEAA4E, 0x7869D6024CCFB959, 0x2C80AF90101F4854, 0x10C66C44292381F2, 0x442F15D675F370FF,
+
141 0xB9149F60908263E8, 0xEDFDE6F2CC5292E5, 0xE1DD6314CDD0A76A, 0xB5341A8691005667, 0x480F903074714570,
+
142 0x1CE6E9A228A1B47D, 0x20A02A76119D7DDB, 0x744953E44D4D8CD6, 0x8972D952A83C9FC1, 0xDD9BA0C0F4EC6ECC,
+
143 0xF1FF5EFADA450C8D, 0xA51627688695FD80, 0x582DADDE63E4EE97, 0x0CC4D44C3F341F9A, 0x308217980608D63C,
+
144 0x646B6E0A5AD82731, 0x9950E4BCBFA93426, 0xCDB99D2EE379C52B, 0x90FB71CAD654A0F5, 0xC41208588A8451F8,
+
145 0x392982EE6FF542EF, 0x6DC0FB7C3325B3E2, 0x518638A80A197A44, 0x056F413A56C98B49, 0xF854CB8CB3B8985E,
+
146 0xACBDB21EEF686953, 0x80D94C24C1C10B12, 0xD43035B69D11FA1F, 0x290BBF007860E908, 0x7DE2C69224B01805,
+
147 0x41A405461D8CD1A3, 0x154D7CD4415C20AE, 0xE876F662A42D33B9, 0xBC9F8FF0F8FDC2B4, 0xB0BF0A16F97FF73B,
+
148 0xE4567384A5AF0636, 0x196DF93240DE1521, 0x4D8480A01C0EE42C, 0x71C2437425322D8A, 0x252B3AE679E2DC87,
+
149 0xD810B0509C93CF90, 0x8CF9C9C2C0433E9D, 0xA09D37F8EEEA5CDC, 0xF4744E6AB23AADD1, 0x094FC4DC574BBEC6,
+
150 0x5DA6BD4E0B9B4FCB, 0x61E07E9A32A7866D, 0x350907086E777760, 0xC8328DBE8B066477, 0x9CDBF42CD7D6957A,
+
151 0xD073867288020F69, 0x849AFFE0D4D2FE64, 0x79A1755631A3ED73, 0x2D480CC46D731C7E, 0x110ECF10544FD5D8,
+
152 0x45E7B682089F24D5, 0xB8DC3C34EDEE37C2, 0xEC3545A6B13EC6CF, 0xC051BB9C9F97A48E, 0x94B8C20EC3475583,
+
153 0x698348B826364694, 0x3D6A312A7AE6B799, 0x012CF2FE43DA7E3F, 0x55C58B6C1F0A8F32, 0xA8FE01DAFA7B9C25,
+
154 0xFC177848A6AB6D28, 0xF037FDAEA72958A7, 0xA4DE843CFBF9A9AA, 0x59E50E8A1E88BABD, 0x0D0C771842584BB0,
+
155 0x314AB4CC7B648216, 0x65A3CD5E27B4731B, 0x989847E8C2C5600C, 0xCC713E7A9E159101, 0xE015C040B0BCF340,
+
156 0xB4FCB9D2EC6C024D, 0x49C73364091D115A, 0x1D2E4AF655CDE057, 0x216889226CF129F1, 0x7581F0B03021D8FC,
+
157 0x88BA7A06D550CBEB, 0xDC53039489803AE6, 0x11EA9EBA6AF9FFCD, 0x4503E72836290EC0, 0xB8386D9ED3581DD7,
+
158 0xECD1140C8F88ECDA, 0xD097D7D8B6B4257C, 0x847EAE4AEA64D471, 0x794524FC0F15C766, 0x2DAC5D6E53C5366B,
+
159 0x01C8A3547D6C542A, 0x5521DAC621BCA527, 0xA81A5070C4CDB630, 0xFCF329E2981D473D, 0xC0B5EA36A1218E9B,
+
160 0x945C93A4FDF17F96, 0x6967191218806C81, 0x3D8E608044509D8C, 0x31AEE56645D2A803, 0x65479CF41902590E,
+
161 0x987C1642FC734A19, 0xCC956FD0A0A3BB14, 0xF0D3AC04999F72B2, 0xA43AD596C54F83BF, 0x59015F20203E90A8,
+
162 0x0DE826B27CEE61A5, 0x218CD888524703E4, 0x7565A11A0E97F2E9, 0x885E2BACEBE6E1FE, 0xDCB7523EB73610F3,
+
163 0xE0F191EA8E0AD955, 0xB418E878D2DA2858, 0x492362CE37AB3B4F, 0x1DCA1B5C6B7BCA42, 0x5162690234AF5051,
+
164 0x058B1090687FA15C, 0xF8B09A268D0EB24B, 0xAC59E3B4D1DE4346, 0x901F2060E8E28AE0, 0xC4F659F2B4327BED,
+
165 0x39CDD344514368FA, 0x6D24AAD60D9399F7, 0x414054EC233AFBB6, 0x15A92D7E7FEA0ABB, 0xE892A7C89A9B19AC,
+
166 0xBC7BDE5AC64BE8A1, 0x803D1D8EFF772107, 0xD4D4641CA3A7D00A, 0x29EFEEAA46D6C31D, 0x7D0697381A063210,
+
167 0x712612DE1B84079F, 0x25CF6B4C4754F692, 0xD8F4E1FAA225E585, 0x8C1D9868FEF51488, 0xB05B5BBCC7C9DD2E,
+
168 0xE4B2222E9B192C23, 0x1989A8987E683F34, 0x4D60D10A22B8CE39, 0x61042F300C11AC78, 0x35ED56A250C15D75,
+
169 0xC8D6DC14B5B04E62, 0x9C3FA586E960BF6F, 0xA0796652D05C76C9, 0xF4901FC08C8C87C4, 0x09AB957669FD94D3,
+
170 0x5D42ECE4352D65DE},
+
171 {0x0000000000000000, 0x3F0BE14A916A6DCB, 0x7E17C29522D4DB96, 0x411C23DFB3BEB65D, 0xFC2F852A45A9B72C,
+
172 0xC3246460D4C3DAE7, 0x823847BF677D6CBA, 0xBD33A6F5F6170171, 0x6A87A57F245D70DD, 0x558C4435B5371D16,
+
173 0x149067EA0689AB4B, 0x2B9B86A097E3C680, 0x96A8205561F4C7F1, 0xA9A3C11FF09EAA3A, 0xE8BFE2C043201C67,
+
174 0xD7B4038AD24A71AC, 0xD50F4AFE48BAE1BA, 0xEA04ABB4D9D08C71, 0xAB18886B6A6E3A2C, 0x94136921FB0457E7,
+
175 0x2920CFD40D135696, 0x162B2E9E9C793B5D, 0x57370D412FC78D00, 0x683CEC0BBEADE0CB, 0xBF88EF816CE79167,
+
176 0x80830ECBFD8DFCAC, 0xC19F2D144E334AF1, 0xFE94CC5EDF59273A, 0x43A76AAB294E264B, 0x7CAC8BE1B8244B80,
+
177 0x3DB0A83E0B9AFDDD, 0x02BB49749AF09016, 0x38C63AD73E7BDDF1, 0x07CDDB9DAF11B03A, 0x46D1F8421CAF0667,
+
178 0x79DA19088DC56BAC, 0xC4E9BFFD7BD26ADD, 0xFBE25EB7EAB80716, 0xBAFE7D685906B14B, 0x85F59C22C86CDC80,
+
179 0x52419FA81A26AD2C, 0x6D4A7EE28B4CC0E7, 0x2C565D3D38F276BA, 0x135DBC77A9981B71, 0xAE6E1A825F8F1A00,
+
180 0x9165FBC8CEE577CB, 0xD079D8177D5BC196, 0xEF72395DEC31AC5D, 0xEDC9702976C13C4B, 0xD2C29163E7AB5180,
+
181 0x93DEB2BC5415E7DD, 0xACD553F6C57F8A16, 0x11E6F50333688B67, 0x2EED1449A202E6AC, 0x6FF1379611BC50F1,
+
182 0x50FAD6DC80D63D3A, 0x874ED556529C4C96, 0xB845341CC3F6215D, 0xF95917C370489700, 0xC652F689E122FACB,
+
183 0x7B61507C1735FBBA, 0x446AB136865F9671, 0x057692E935E1202C, 0x3A7D73A3A48B4DE7, 0x718C75AE7CF7BBE2,
+
184 0x4E8794E4ED9DD629, 0x0F9BB73B5E236074, 0x30905671CF490DBF, 0x8DA3F084395E0CCE, 0xB2A811CEA8346105,
+
185 0xF3B432111B8AD758, 0xCCBFD35B8AE0BA93, 0x1B0BD0D158AACB3F, 0x2400319BC9C0A6F4, 0x651C12447A7E10A9,
+
186 0x5A17F30EEB147D62, 0xE72455FB1D037C13, 0xD82FB4B18C6911D8, 0x9933976E3FD7A785, 0xA6387624AEBDCA4E,
+
187 0xA4833F50344D5A58, 0x9B88DE1AA5273793, 0xDA94FDC5169981CE, 0xE59F1C8F87F3EC05, 0x58ACBA7A71E4ED74,
+
188 0x67A75B30E08E80BF, 0x26BB78EF533036E2, 0x19B099A5C25A5B29, 0xCE049A2F10102A85, 0xF10F7B65817A474E,
+
189 0xB01358BA32C4F113, 0x8F18B9F0A3AE9CD8, 0x322B1F0555B99DA9, 0x0D20FE4FC4D3F062, 0x4C3CDD90776D463F,
+
190 0x73373CDAE6072BF4, 0x494A4F79428C6613, 0x7641AE33D3E60BD8, 0x375D8DEC6058BD85, 0x08566CA6F132D04E,
+
191 0xB565CA530725D13F, 0x8A6E2B19964FBCF4, 0xCB7208C625F10AA9, 0xF479E98CB49B6762, 0x23CDEA0666D116CE,
+
192 0x1CC60B4CF7BB7B05, 0x5DDA28934405CD58, 0x62D1C9D9D56FA093, 0xDFE26F2C2378A1E2, 0xE0E98E66B212CC29,
+
193 0xA1F5ADB901AC7A74, 0x9EFE4CF390C617BF, 0x9C4505870A3687A9, 0xA34EE4CD9B5CEA62, 0xE252C71228E25C3F,
+
194 0xDD592658B98831F4, 0x606A80AD4F9F3085, 0x5F6161E7DEF55D4E, 0x1E7D42386D4BEB13, 0x2176A372FC2186D8,
+
195 0xF6C2A0F82E6BF774, 0xC9C941B2BF019ABF, 0x88D5626D0CBF2CE2, 0xB7DE83279DD54129, 0x0AED25D26BC24058,
+
196 0x35E6C498FAA82D93, 0x74FAE74749169BCE, 0x4BF1060DD87CF605, 0xE318EB5CF9EF77C4, 0xDC130A1668851A0F,
+
197 0x9D0F29C9DB3BAC52, 0xA204C8834A51C199, 0x1F376E76BC46C0E8, 0x203C8F3C2D2CAD23, 0x6120ACE39E921B7E,
+
198 0x5E2B4DA90FF876B5, 0x899F4E23DDB20719, 0xB694AF694CD86AD2, 0xF7888CB6FF66DC8F, 0xC8836DFC6E0CB144,
+
199 0x75B0CB09981BB035, 0x4ABB2A430971DDFE, 0x0BA7099CBACF6BA3, 0x34ACE8D62BA50668, 0x3617A1A2B155967E,
+
200 0x091C40E8203FFBB5, 0x4800633793814DE8, 0x770B827D02EB2023, 0xCA382488F4FC2152, 0xF533C5C265964C99,
+
201 0xB42FE61DD628FAC4, 0x8B2407574742970F, 0x5C9004DD9508E6A3, 0x639BE59704628B68, 0x2287C648B7DC3D35,
+
202 0x1D8C270226B650FE, 0xA0BF81F7D0A1518F, 0x9FB460BD41CB3C44, 0xDEA84362F2758A19, 0xE1A3A228631FE7D2,
+
203 0xDBDED18BC794AA35, 0xE4D530C156FEC7FE, 0xA5C9131EE54071A3, 0x9AC2F254742A1C68, 0x27F154A1823D1D19,
+
204 0x18FAB5EB135770D2, 0x59E69634A0E9C68F, 0x66ED777E3183AB44, 0xB15974F4E3C9DAE8, 0x8E5295BE72A3B723,
+
205 0xCF4EB661C11D017E, 0xF045572B50776CB5, 0x4D76F1DEA6606DC4, 0x727D1094370A000F, 0x3361334B84B4B652,
+
206 0x0C6AD20115DEDB99, 0x0ED19B758F2E4B8F, 0x31DA7A3F1E442644, 0x70C659E0ADFA9019, 0x4FCDB8AA3C90FDD2,
+
207 0xF2FE1E5FCA87FCA3, 0xCDF5FF155BED9168, 0x8CE9DCCAE8532735, 0xB3E23D8079394AFE, 0x64563E0AAB733B52,
+
208 0x5B5DDF403A195699, 0x1A41FC9F89A7E0C4, 0x254A1DD518CD8D0F, 0x9879BB20EEDA8C7E, 0xA7725A6A7FB0E1B5,
+
209 0xE66E79B5CC0E57E8, 0xD96598FF5D643A23, 0x92949EF28518CC26, 0xAD9F7FB81472A1ED, 0xEC835C67A7CC17B0,
+
210 0xD388BD2D36A67A7B, 0x6EBB1BD8C0B17B0A, 0x51B0FA9251DB16C1, 0x10ACD94DE265A09C, 0x2FA73807730FCD57,
+
211 0xF8133B8DA145BCFB, 0xC718DAC7302FD130, 0x8604F9188391676D, 0xB90F185212FB0AA6, 0x043CBEA7E4EC0BD7,
+
212 0x3B375FED7586661C, 0x7A2B7C32C638D041, 0x45209D785752BD8A, 0x479BD40CCDA22D9C, 0x789035465CC84057,
+
213 0x398C1699EF76F60A, 0x0687F7D37E1C9BC1, 0xBBB45126880B9AB0, 0x84BFB06C1961F77B, 0xC5A393B3AADF4126,
+
214 0xFAA872F93BB52CED, 0x2D1C7173E9FF5D41, 0x121790397895308A, 0x530BB3E6CB2B86D7, 0x6C0052AC5A41EB1C,
+
215 0xD133F459AC56EA6D, 0xEE3815133D3C87A6, 0xAF2436CC8E8231FB, 0x902FD7861FE85C30, 0xAA52A425BB6311D7,
+
216 0x9559456F2A097C1C, 0xD44566B099B7CA41, 0xEB4E87FA08DDA78A, 0x567D210FFECAA6FB, 0x6976C0456FA0CB30,
+
217 0x286AE39ADC1E7D6D, 0x176102D04D7410A6, 0xC0D5015A9F3E610A, 0xFFDEE0100E540CC1, 0xBEC2C3CFBDEABA9C,
+
218 0x81C922852C80D757, 0x3CFA8470DA97D626, 0x03F1653A4BFDBBED, 0x42ED46E5F8430DB0, 0x7DE6A7AF6929607B,
+
219 0x7F5DEEDBF3D9F06D, 0x40560F9162B39DA6, 0x014A2C4ED10D2BFB, 0x3E41CD0440674630, 0x83726BF1B6704741,
+
220 0xBC798ABB271A2A8A, 0xFD65A96494A49CD7, 0xC26E482E05CEF11C, 0x15DA4BA4D78480B0, 0x2AD1AAEE46EEED7B,
+
221 0x6BCD8931F5505B26, 0x54C6687B643A36ED, 0xE9F5CE8E922D379C, 0xD6FE2FC403475A57, 0x97E20C1BB0F9EC0A,
+
222 0xA8E9ED51219381C1},
+
223 {0x0000000000000000, 0x1DEE8A5E222CA1DC, 0x3BDD14BC445943B8, 0x26339EE26675E264, 0x77BA297888B28770,
+
224 0x6A54A326AA9E26AC, 0x4C673DC4CCEBC4C8, 0x5189B79AEEC76514, 0xEF7452F111650EE0, 0xF29AD8AF3349AF3C,
+
225 0xD4A9464D553C4D58, 0xC947CC137710EC84, 0x98CE7B8999D78990, 0x8520F1D7BBFB284C, 0xA3136F35DD8ECA28,
+
226 0xBEFDE56BFFA26BF4, 0x4C300AC98DC40345, 0x51DE8097AFE8A299, 0x77ED1E75C99D40FD, 0x6A03942BEBB1E121,
+
227 0x3B8A23B105768435, 0x2664A9EF275A25E9, 0x0057370D412FC78D, 0x1DB9BD5363036651, 0xA34458389CA10DA5,
+
228 0xBEAAD266BE8DAC79, 0x98994C84D8F84E1D, 0x8577C6DAFAD4EFC1, 0xD4FE714014138AD5, 0xC910FB1E363F2B09,
+
229 0xEF2365FC504AC96D, 0xF2CDEFA2726668B1, 0x986015931B88068A, 0x858E9FCD39A4A756, 0xA3BD012F5FD14532,
+
230 0xBE538B717DFDE4EE, 0xEFDA3CEB933A81FA, 0xF234B6B5B1162026, 0xD4072857D763C242, 0xC9E9A209F54F639E,
+
231 0x771447620AED086A, 0x6AFACD3C28C1A9B6, 0x4CC953DE4EB44BD2, 0x5127D9806C98EA0E, 0x00AE6E1A825F8F1A,
+
232 0x1D40E444A0732EC6, 0x3B737AA6C606CCA2, 0x269DF0F8E42A6D7E, 0xD4501F5A964C05CF, 0xC9BE9504B460A413,
+
233 0xEF8D0BE6D2154677, 0xF26381B8F039E7AB, 0xA3EA36221EFE82BF, 0xBE04BC7C3CD22363, 0x9837229E5AA7C107,
+
234 0x85D9A8C0788B60DB, 0x3B244DAB87290B2F, 0x26CAC7F5A505AAF3, 0x00F95917C3704897, 0x1D17D349E15CE94B,
+
235 0x4C9E64D30F9B8C5F, 0x5170EE8D2DB72D83, 0x7743706F4BC2CFE7, 0x6AADFA3169EE6E3B, 0xA218840D981E1391,
+
236 0xBFF60E53BA32B24D, 0x99C590B1DC475029, 0x842B1AEFFE6BF1F5, 0xD5A2AD7510AC94E1, 0xC84C272B3280353D,
+
237 0xEE7FB9C954F5D759, 0xF391339776D97685, 0x4D6CD6FC897B1D71, 0x50825CA2AB57BCAD, 0x76B1C240CD225EC9,
+
238 0x6B5F481EEF0EFF15, 0x3AD6FF8401C99A01, 0x273875DA23E53BDD, 0x010BEB384590D9B9, 0x1CE5616667BC7865,
+
239 0xEE288EC415DA10D4, 0xF3C6049A37F6B108, 0xD5F59A785183536C, 0xC81B102673AFF2B0, 0x9992A7BC9D6897A4,
+
240 0x847C2DE2BF443678, 0xA24FB300D931D41C, 0xBFA1395EFB1D75C0, 0x015CDC3504BF1E34, 0x1CB2566B2693BFE8,
+
241 0x3A81C88940E65D8C, 0x276F42D762CAFC50, 0x76E6F54D8C0D9944, 0x6B087F13AE213898, 0x4D3BE1F1C854DAFC,
+
242 0x50D56BAFEA787B20, 0x3A78919E8396151B, 0x27961BC0A1BAB4C7, 0x01A58522C7CF56A3, 0x1C4B0F7CE5E3F77F,
+
243 0x4DC2B8E60B24926B, 0x502C32B8290833B7, 0x761FAC5A4F7DD1D3, 0x6BF126046D51700F, 0xD50CC36F92F31BFB,
+
244 0xC8E24931B0DFBA27, 0xEED1D7D3D6AA5843, 0xF33F5D8DF486F99F, 0xA2B6EA171A419C8B, 0xBF586049386D3D57,
+
245 0x996BFEAB5E18DF33, 0x848574F57C347EEF, 0x76489B570E52165E, 0x6BA611092C7EB782, 0x4D958FEB4A0B55E6,
+
246 0x507B05B56827F43A, 0x01F2B22F86E0912E, 0x1C1C3871A4CC30F2, 0x3A2FA693C2B9D296, 0x27C12CCDE095734A,
+
247 0x993CC9A61F3718BE, 0x84D243F83D1BB962, 0xA2E1DD1A5B6E5B06, 0xBF0F57447942FADA, 0xEE86E0DE97859FCE,
+
248 0xF3686A80B5A93E12, 0xD55BF462D3DCDC76, 0xC8B57E3CF1F07DAA, 0xD6E9A7309F3239A7, 0xCB072D6EBD1E987B,
+
249 0xED34B38CDB6B7A1F, 0xF0DA39D2F947DBC3, 0xA1538E481780BED7, 0xBCBD041635AC1F0B, 0x9A8E9AF453D9FD6F,
+
250 0x876010AA71F55CB3, 0x399DF5C18E573747, 0x24737F9FAC7B969B, 0x0240E17DCA0E74FF, 0x1FAE6B23E822D523,
+
251 0x4E27DCB906E5B037, 0x53C956E724C911EB, 0x75FAC80542BCF38F, 0x6814425B60905253, 0x9AD9ADF912F63AE2,
+
252 0x873727A730DA9B3E, 0xA104B94556AF795A, 0xBCEA331B7483D886, 0xED6384819A44BD92, 0xF08D0EDFB8681C4E,
+
253 0xD6BE903DDE1DFE2A, 0xCB501A63FC315FF6, 0x75ADFF0803933402, 0x6843755621BF95DE, 0x4E70EBB447CA77BA,
+
254 0x539E61EA65E6D666, 0x0217D6708B21B372, 0x1FF95C2EA90D12AE, 0x39CAC2CCCF78F0CA, 0x24244892ED545116,
+
255 0x4E89B2A384BA3F2D, 0x536738FDA6969EF1, 0x7554A61FC0E37C95, 0x68BA2C41E2CFDD49, 0x39339BDB0C08B85D,
+
256 0x24DD11852E241981, 0x02EE8F674851FBE5, 0x1F0005396A7D5A39, 0xA1FDE05295DF31CD, 0xBC136A0CB7F39011,
+
257 0x9A20F4EED1867275, 0x87CE7EB0F3AAD3A9, 0xD647C92A1D6DB6BD, 0xCBA943743F411761, 0xED9ADD965934F505,
+
258 0xF07457C87B1854D9, 0x02B9B86A097E3C68, 0x1F5732342B529DB4, 0x3964ACD64D277FD0, 0x248A26886F0BDE0C,
+
259 0x7503911281CCBB18, 0x68ED1B4CA3E01AC4, 0x4EDE85AEC595F8A0, 0x53300FF0E7B9597C, 0xEDCDEA9B181B3288,
+
260 0xF02360C53A379354, 0xD610FE275C427130, 0xCBFE74797E6ED0EC, 0x9A77C3E390A9B5F8, 0x879949BDB2851424,
+
261 0xA1AAD75FD4F0F640, 0xBC445D01F6DC579C, 0x74F1233D072C2A36, 0x691FA96325008BEA, 0x4F2C37814375698E,
+
262 0x52C2BDDF6159C852, 0x034B0A458F9EAD46, 0x1EA5801BADB20C9A, 0x38961EF9CBC7EEFE, 0x257894A7E9EB4F22,
+
263 0x9B8571CC164924D6, 0x866BFB923465850A, 0xA05865705210676E, 0xBDB6EF2E703CC6B2, 0xEC3F58B49EFBA3A6,
+
264 0xF1D1D2EABCD7027A, 0xD7E24C08DAA2E01E, 0xCA0CC656F88E41C2, 0x38C129F48AE82973, 0x252FA3AAA8C488AF,
+
265 0x031C3D48CEB16ACB, 0x1EF2B716EC9DCB17, 0x4F7B008C025AAE03, 0x52958AD220760FDF, 0x74A614304603EDBB,
+
266 0x69489E6E642F4C67, 0xD7B57B059B8D2793, 0xCA5BF15BB9A1864F, 0xEC686FB9DFD4642B, 0xF186E5E7FDF8C5F7,
+
267 0xA00F527D133FA0E3, 0xBDE1D8233113013F, 0x9BD246C15766E35B, 0x863CCC9F754A4287, 0xEC9136AE1CA42CBC,
+
268 0xF17FBCF03E888D60, 0xD74C221258FD6F04, 0xCAA2A84C7AD1CED8, 0x9B2B1FD69416ABCC, 0x86C59588B63A0A10,
+
269 0xA0F60B6AD04FE874, 0xBD188134F26349A8, 0x03E5645F0DC1225C, 0x1E0BEE012FED8380, 0x383870E3499861E4,
+
270 0x25D6FABD6BB4C038, 0x745F4D278573A52C, 0x69B1C779A75F04F0, 0x4F82599BC12AE694, 0x526CD3C5E3064748,
+
271 0xA0A13C6791602FF9, 0xBD4FB639B34C8E25, 0x9B7C28DBD5396C41, 0x8692A285F715CD9D, 0xD71B151F19D2A889,
+
272 0xCAF59F413BFE0955, 0xECC601A35D8BEB31, 0xF1288BFD7FA74AED, 0x4FD56E9680052119, 0x523BE4C8A22980C5,
+
273 0x74087A2AC45C62A1, 0x69E6F074E670C37D, 0x386F47EE08B7A669, 0x2581CDB02A9B07B5, 0x03B253524CEEE5D1,
+
274 0x1E5CD90C6EC2440D}
+
275};
+
+
276
+
278#define CRC64_ECMA_POLY 0xC96C5795D7870F42ULL
+
280#define CRC64_ECMA_SEED 0xFFFFFFFFFFFFFFFFULL
+
281
+
282#endif // LIBAARUFORMAT_CRC64_H
+
static const uint64_t crc64_table[4][256]
Precomputed slicing-by-4 ECMA-182 CRC64 lookup tables (4 * 256 * 8 = 8192 bytes).
Definition crc64.h:66
+
Minimal ECMA-182 CRC64 incremental state container (running value only).
Definition crc64.h:56
+
uint64_t crc
Running CRC value (initialize to CRC64_ECMA_SEED before first update).
Definition crc64.h:57
+
+
+
+ + + + diff --git a/docs/html/crc64__clmul_8c.html b/docs/html/crc64__clmul_8c.html new file mode 100644 index 0000000..a6b93cc --- /dev/null +++ b/docs/html/crc64__clmul_8c.html @@ -0,0 +1,115 @@ + + + + + + + +libaaruformat: src/crc64/crc64_clmul.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
crc64_clmul.c File Reference
+
+ +
+ +
+ + + + diff --git a/docs/html/crc64__clmul_8c_source.html b/docs/html/crc64__clmul_8c_source.html new file mode 100644 index 0000000..d38baf6 --- /dev/null +++ b/docs/html/crc64__clmul_8c_source.html @@ -0,0 +1,324 @@ + + + + + + + +libaaruformat: src/crc64/crc64_clmul.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
crc64_clmul.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#if defined(__x86_64__) || defined(__amd64) || defined(_M_AMD64) || defined(_M_X64) || defined(__I386__) || \
+
20 defined(__i386__) || defined(__THW_INTEL) || defined(_M_IX86)
+
21
+
22#include <inttypes.h>
+
23#include <smmintrin.h>
+
24#include <wmmintrin.h>
+
25
+
26#include "log.h"
+
27
+
28#ifdef _MSC_VER
+
29#include <intrin.h>
+
30#endif
+
31
+
32#include <aaruformat.h>
+
33
+
34// Reverses bits
+
35static uint64_t bitReflect(uint64_t v)
+
36{
+
37 v = v >> 1 & 0x5555555555555555 | (v & 0x5555555555555555) << 1;
+
38 v = v >> 2 & 0x3333333333333333 | (v & 0x3333333333333333) << 2;
+
39 v = v >> 4 & 0x0F0F0F0F0F0F0F0F | (v & 0x0F0F0F0F0F0F0F0F) << 4;
+
40 v = v >> 8 & 0x00FF00FF00FF00FF | (v & 0x00FF00FF00FF00FF) << 8;
+
41 v = v >> 16 & 0x0000FFFF0000FFFF | (v & 0x0000FFFF0000FFFF) << 16;
+
42 v = v >> 32 | v << 32;
+
43 return v;
+
44}
+
45
+
46// Computes r*x^N mod p(x)
+
47static uint64_t expMod65(uint32_t n, uint64_t p, uint64_t r)
+
48{
+
49 return n == 0 ? r : expMod65(n - 1, p, r << 1 ^ p & (int64_t)r >> 63);
+
50}
+
51
+
52// Computes x^129 / p(x); the result has an implicit 65th bit.
+
53static uint64_t div129by65(uint64_t poly)
+
54{
+
55 uint64_t q = 0;
+
56 uint64_t h = poly;
+
57 for(uint32_t i = 0; i < 64; ++i)
+
58 {
+
59 q |= (h & 1ull << 63) >> i;
+
60 h = h << 1 ^ poly & (int64_t)h >> 63;
+
61 }
+
62 return q;
+
63}
+
64
+
65static const uint8_t shuffleMasks[] = {
+
66 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+
67 0x8f, 0x8e, 0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80,
+
68};
+
69
+
70CLMUL static void shiftRight128(__m128i in, size_t n, __m128i *out_left, __m128i *out_right)
+
71{
+
72 const __m128i mask_a = _mm_loadu_si128((const __m128i *)(shuffleMasks + (16 - n)));
+
73 const __m128i mask_b = _mm_xor_si128(mask_a, _mm_cmpeq_epi8(_mm_setzero_si128(), _mm_setzero_si128()));
+
74
+
75 *out_left = _mm_shuffle_epi8(in, mask_b);
+
76 *out_right = _mm_shuffle_epi8(in, mask_a);
+
77}
+
78
+
79CLMUL static __m128i fold(__m128i in, __m128i fold_constants)
+
80{
+
81 return _mm_xor_si128(_mm_clmulepi64_si128(in, fold_constants, 0x00),
+
82 _mm_clmulepi64_si128(in, fold_constants, 0x11));
+
83}
+
84
+
93AARU_EXPORT CLMUL uint64_t AARU_CALL aaruf_crc64_clmul(const uint64_t crc, const uint8_t *data, long length)
+
94{
+
95 TRACE("Entering aaruf_crc64_clmul(%" PRIu64 ", %p, %ld)", crc, data, length);
+
96
+
97 const uint64_t k1 = 0xe05dd497ca393ae4; // bitReflect(expMod65(128 + 64, poly, 1)) << 1;
+
98 const uint64_t k2 = 0xdabe95afc7875f40; // bitReflect(expMod65(128, poly, 1)) << 1;
+
99 const uint64_t mu = 0x9c3e466c172963d5; // (bitReflect(div129by65(poly)) << 1) | 1;
+
100 const uint64_t p = 0x92d8af2baf0e1e85; // (bitReflect(poly) << 1) | 1;
+
101
+
102 const __m128i fold_constants_1 = _mm_set_epi64x(k2, k1);
+
103 const __m128i fold_constants_2 = _mm_set_epi64x(p, mu);
+
104
+
105 const uint8_t *end = data + length;
+
106
+
107 // Align pointers
+
108 const __m128i *aligned_data = (const __m128i *)((uintptr_t)data & ~(uintptr_t)15);
+
109 const __m128i *aligned_end = (const __m128i *)((uintptr_t)end + 15 & ~(uintptr_t)15);
+
110
+
111 const size_t lead_in_size = data - (const uint8_t *)aligned_data;
+
112 const size_t lead_out_size = (const uint8_t *)aligned_end - end;
+
113
+
114 const size_t aligned_length = aligned_end - aligned_data;
+
115
+
116 const __m128i lead_in_mask = _mm_loadu_si128((const __m128i *)(shuffleMasks + (16 - lead_in_size)));
+
117 const __m128i data0 = _mm_blendv_epi8(_mm_setzero_si128(), _mm_load_si128(aligned_data), lead_in_mask);
+
118
+
119#if defined(_WIN64)
+
120 const __m128i initial_crc = _mm_cvtsi64x_si128(~crc);
+
121#else
+
122 const __m128i initial_crc = _mm_set_epi64x(0, ~crc);
+
123#endif
+
124
+
125 __m128i r_reg;
+
126 if(aligned_length == 1)
+
127 {
+
128 // Single data block, initial CRC possibly bleeds into zero padding
+
129 __m128i crc0, crc1;
+
130 shiftRight128(initial_crc, 16 - length, &crc0, &crc1);
+
131
+
132 __m128i a_reg, b_reg;
+
133 shiftRight128(data0, lead_out_size, &a_reg, &b_reg);
+
134
+
135 const __m128i p_reg = _mm_xor_si128(a_reg, crc0);
+
136 r_reg = _mm_xor_si128(_mm_clmulepi64_si128(p_reg, fold_constants_1, 0x10),
+
137 _mm_xor_si128(_mm_srli_si128(p_reg, 8), _mm_slli_si128(crc1, 8)));
+
138 }
+
139 else if(aligned_length == 2)
+
140 {
+
141 const __m128i data1 = _mm_load_si128(aligned_data + 1);
+
142
+
143 if(length < 8)
+
144 {
+
145 // Initial CRC bleeds into the zero padding
+
146 __m128i crc0, crc1;
+
147 shiftRight128(initial_crc, 16 - length, &crc0, &crc1);
+
148
+
149 __m128i a_reg, b_reg, c_reg, d_reg;
+
150 shiftRight128(data0, lead_out_size, &a_reg, &b_reg);
+
151 shiftRight128(data1, lead_out_size, &c_reg, &d_reg);
+
152
+
153 const __m128i p_reg = _mm_xor_si128(_mm_xor_si128(b_reg, c_reg), crc0);
+
154 r_reg = _mm_xor_si128(_mm_clmulepi64_si128(p_reg, fold_constants_1, 0x10),
+
155 _mm_xor_si128(_mm_srli_si128(p_reg, 8), _mm_slli_si128(crc1, 8)));
+
156 }
+
157 else
+
158 {
+
159 // We can fit the initial CRC into the data without bleeding into the zero padding
+
160 __m128i crc0, crc1;
+
161 shiftRight128(initial_crc, lead_in_size, &crc0, &crc1);
+
162
+
163 __m128i a_reg, b_reg, c_reg, d_reg;
+
164 shiftRight128(_mm_xor_si128(data0, crc0), lead_out_size, &a_reg, &b_reg);
+
165 shiftRight128(_mm_xor_si128(data1, crc1), lead_out_size, &c_reg, &d_reg);
+
166
+
167 const __m128i p_reg = _mm_xor_si128(fold(a_reg, fold_constants_1), _mm_xor_si128(b_reg, c_reg));
+
168 r_reg = _mm_xor_si128(_mm_clmulepi64_si128(p_reg, fold_constants_1, 0x10), _mm_srli_si128(p_reg, 8));
+
169 }
+
170 }
+
171 else
+
172 {
+
173 aligned_data++;
+
174 length -= 16 - lead_in_size;
+
175
+
176 // Initial CRC can simply be added to data
+
177 __m128i crc0, crc1;
+
178 shiftRight128(initial_crc, lead_in_size, &crc0, &crc1);
+
179
+
180 __m128i accumulator = _mm_xor_si128(fold(_mm_xor_si128(crc0, data0), fold_constants_1), crc1);
+
181
+
182 while(length >= 32)
+
183 {
+
184 accumulator = fold(_mm_xor_si128(_mm_load_si128(aligned_data), accumulator), fold_constants_1);
+
185
+
186 length -= 16;
+
187 aligned_data++;
+
188 }
+
189
+
190 __m128i p_reg;
+
191 if(length == 16) { p_reg = _mm_xor_si128(accumulator, _mm_load_si128(aligned_data)); }
+
192 else
+
193 {
+
194 const __m128i end0 = _mm_xor_si128(accumulator, _mm_load_si128(aligned_data));
+
195 const __m128i end1 = _mm_load_si128(aligned_data + 1);
+
196
+
197 __m128i a_reg, b_reg, c_reg, d_reg;
+
198 shiftRight128(end0, lead_out_size, &a_reg, &b_reg);
+
199 shiftRight128(end1, lead_out_size, &c_reg, &d_reg);
+
200
+
201 p_reg = _mm_xor_si128(fold(a_reg, fold_constants_1), _mm_or_si128(b_reg, c_reg));
+
202 }
+
203
+
204 r_reg = _mm_xor_si128(_mm_clmulepi64_si128(p_reg, fold_constants_1, 0x10), _mm_srli_si128(p_reg, 8));
+
205 }
+
206
+
207 // Final Barrett reduction
+
208 const __m128i t1_reg = _mm_clmulepi64_si128(r_reg, fold_constants_2, 0x00);
+
209 const __m128i t2_reg = _mm_xor_si128(
+
210 _mm_xor_si128(_mm_clmulepi64_si128(t1_reg, fold_constants_2, 0x10), _mm_slli_si128(t1_reg, 8)), r_reg);
+
211
+
212 TRACE("Exiting aaruf_crc64_clmul()");
+
213
+
214#if defined(_WIN64)
+
215 return ~_mm_extract_epi64(t2_reg, 1);
+
216#else
+
217 return ~((uint64_t)(uint32_t)_mm_extract_epi32(t2_reg, 3) << 32 | (uint64_t)(uint32_t)_mm_extract_epi32(t2_reg, 2));
+
218#endif
+
219}
+
220
+
221#endif
+ +
#define AARU_CALL
Definition decls.h:45
+
#define AARU_EXPORT
Definition decls.h:54
+ +
#define TRACE(fmt,...)
Definition log.h:25
+
+
+
+ + + + diff --git a/docs/html/crc64__vmull_8c.html b/docs/html/crc64__vmull_8c.html new file mode 100644 index 0000000..abd7e21 --- /dev/null +++ b/docs/html/crc64__vmull_8c.html @@ -0,0 +1,115 @@ + + + + + + + +libaaruformat: src/crc64/crc64_vmull.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
crc64_vmull.c File Reference
+
+ +
+ +
+ + + + diff --git a/docs/html/crc64__vmull_8c_source.html b/docs/html/crc64__vmull_8c_source.html new file mode 100644 index 0000000..aa6f37d --- /dev/null +++ b/docs/html/crc64__vmull_8c_source.html @@ -0,0 +1,296 @@ + + + + + + + +libaaruformat: src/crc64/crc64_vmull.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
crc64_vmull.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
+
20
+
21#include <arm_neon.h>
+
22#include <stddef.h>
+
23#include <stdint.h>
+
24
+
25#include <aaruformat.h>
+
26
+
27#include "arm_vmull.h"
+
28#include "log.h"
+
29
+
30static const uint8_t shuffleMasks[] = {
+
31 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
+
32 0x8f, 0x8e, 0x8d, 0x8c, 0x8b, 0x8a, 0x89, 0x88, 0x87, 0x86, 0x85, 0x84, 0x83, 0x82, 0x81, 0x80,
+
33};
+
34
+
35TARGET_WITH_SIMD FORCE_INLINE void shiftRight128(uint64x2_t in, size_t n, uint64x2_t *outLeft, uint64x2_t *outRight)
+
36{
+
37 const uint64x2_t maskA =
+
38 vreinterpretq_u64_u32(vld1q_u32((const uint32_t *)(const uint64x2_t *)(shuffleMasks + (16 - n))));
+
39 uint64x2_t b = vreinterpretq_u64_u8(vceqq_u8(vreinterpretq_u8_u64(vreinterpretq_u64_u32(vdupq_n_u32(0))),
+
40 vreinterpretq_u8_u64(vreinterpretq_u64_u32(vdupq_n_u32(0)))));
+
41 const uint64x2_t maskB = vreinterpretq_u64_u32(veorq_u32(vreinterpretq_u32_u64(maskA), vreinterpretq_u32_u64(b)));
+
42
+
43 *outLeft = mm_shuffle_epi8(in, maskB);
+
44 *outRight = mm_shuffle_epi8(in, maskA);
+
45}
+
46
+
47TARGET_WITH_SIMD FORCE_INLINE uint64x2_t fold(uint64x2_t in, uint64x2_t foldConstants)
+
48{
+
49 return veorq_u64(sse2neon_vmull_p64(vget_low_u64(in), vget_low_u64(foldConstants)),
+
50 sse2neon_vmull_p64(vget_high_u64(in), vget_high_u64(foldConstants)));
+
51}
+
52
+
61AARU_EXPORT TARGET_WITH_SIMD uint64_t AARU_CALL aaruf_crc64_vmull(uint64_t previous_crc, const uint8_t *data, long len)
+
62{
+
63 TRACE("Entering aaruf_crc64_vmull(%llu, %p, %ld)", previous_crc, data, len);
+
64
+
65 const uint64_t k1 = 0xe05dd497ca393ae4; // bitReflect(expMod65(128 + 64, poly, 1)) << 1;
+
66 const uint64_t k2 = 0xdabe95afc7875f40; // bitReflect(expMod65(128, poly, 1)) << 1;
+
67 const uint64_t mu = 0x9c3e466c172963d5; // (bitReflect(div129by65(poly)) << 1) | 1;
+
68 const uint64_t p = 0x92d8af2baf0e1e85; // (bitReflect(poly) << 1) | 1;
+
69
+
70 const uint64x2_t foldConstants1 = vcombine_u64(vcreate_u64(k1), vcreate_u64(k2));
+
71 const uint64x2_t foldConstants2 = vcombine_u64(vcreate_u64(mu), vcreate_u64(p));
+
72
+
73 const uint8_t *end = data + len;
+
74
+
75 // Align pointers
+
76 const uint64x2_t *alignedData = (const uint64x2_t *)((uintptr_t)data & ~(uintptr_t)15);
+
77 const uint64x2_t *alignedEnd = (const uint64x2_t *)(((uintptr_t)end + 15) & ~(uintptr_t)15);
+
78
+
79 const size_t leadInSize = data - (const uint8_t *)alignedData;
+
80 const size_t leadOutSize = (const uint8_t *)alignedEnd - end;
+
81
+
82 const size_t alignedLength = alignedEnd - alignedData;
+
83
+
84 const uint64x2_t leadInMask =
+
85 vreinterpretq_u64_u32(vld1q_u32((const uint32_t *)(const uint64x2_t *)(shuffleMasks + (16 - leadInSize))));
+
86 uint64x2_t a = vreinterpretq_u64_u32(vdupq_n_u32(0));
+
87 uint64x2_t b = vreinterpretq_u64_u32(
+
88 vld1q_u32((const uint32_t *)alignedData)); // Use a signed shift right to create a mask with the sign bit
+
89 const uint64x2_t data0 =
+
90 vreinterpretq_u64_u8(vbslq_u8(vreinterpretq_u8_s8(vshrq_n_s8(vreinterpretq_s8_u64(leadInMask), 7)),
+
91 vreinterpretq_u8_u64(b), vreinterpretq_u8_u64(a)));
+
92
+
93 const uint64x2_t initialCrc = vsetq_lane_u64(~previous_crc, vdupq_n_u64(0), 0);
+
94
+
95 uint64x2_t R;
+
96 if(alignedLength == 1)
+
97 {
+
98 // Single data block, initial CRC possibly bleeds into zero padding
+
99 uint64x2_t crc0, crc1;
+
100 shiftRight128(initialCrc, 16 - len, &crc0, &crc1);
+
101
+
102 uint64x2_t A, B;
+
103 shiftRight128(data0, leadOutSize, &A, &B);
+
104
+
105 const uint64x2_t P = veorq_u64(A, crc0);
+
106 R = veorq_u64(sse2neon_vmull_p64(vget_low_u64(P), vget_high_u64(foldConstants1)),
+
107 veorq_u64(mm_srli_si128(P, 8), mm_slli_si128(crc1, 8)));
+
108 }
+
109 else if(alignedLength == 2)
+
110 {
+
111 const uint64x2_t data1 = vreinterpretq_u64_u32(vld1q_u32((const uint32_t *)(alignedData + 1)));
+
112
+
113 if(len < 8)
+
114 {
+
115 // Initial CRC bleeds into the zero padding
+
116 uint64x2_t crc0, crc1;
+
117 shiftRight128(initialCrc, 16 - len, &crc0, &crc1);
+
118
+
119 uint64x2_t A, B, C, D;
+
120 shiftRight128(data0, leadOutSize, &A, &B);
+
121 shiftRight128(data1, leadOutSize, &C, &D);
+
122
+
123 const uint64x2_t P = veorq_u64(veorq_u64(B, C), crc0);
+
124 R = veorq_u64(sse2neon_vmull_p64(vget_low_u64(P), vget_high_u64(foldConstants1)),
+
125 veorq_u64(mm_srli_si128(P, 8), mm_slli_si128(crc1, 8)));
+
126 }
+
127 else
+
128 {
+
129 // We can fit the initial CRC into the data without bleeding into the zero padding
+
130 uint64x2_t crc0, crc1;
+
131 shiftRight128(initialCrc, leadInSize, &crc0, &crc1);
+
132
+
133 uint64x2_t A, B, C, D;
+
134 shiftRight128(veorq_u64(data0, crc0), leadOutSize, &A, &B);
+
135 shiftRight128(veorq_u64(data1, crc1), leadOutSize, &C, &D);
+
136
+
137 const uint64x2_t P = veorq_u64(fold(A, foldConstants1), veorq_u64(B, C));
+
138 R = veorq_u64(sse2neon_vmull_p64(vget_low_u64(P), vget_high_u64(foldConstants1)), mm_srli_si128(P, 8));
+
139 }
+
140 }
+
141 else
+
142 {
+
143 alignedData++;
+
144 len -= 16 - leadInSize;
+
145
+
146 // Initial CRC can simply be added to data
+
147 uint64x2_t crc0, crc1;
+
148 shiftRight128(initialCrc, leadInSize, &crc0, &crc1);
+
149
+
150 uint64x2_t accumulator = veorq_u64(fold(veorq_u64(crc0, data0), foldConstants1), crc1);
+
151
+
152 while(len >= 32)
+
153 {
+
154 accumulator = fold(veorq_u64(vreinterpretq_u64_u32(vld1q_u32((const uint32_t *)alignedData)), accumulator),
+
155 foldConstants1);
+
156
+
157 len -= 16;
+
158 alignedData++;
+
159 }
+
160
+
161 uint64x2_t P;
+
162 if(len == 16)
+
163 P = veorq_u64(accumulator, vreinterpretq_u64_u32(vld1q_u32((const uint32_t *)alignedData)));
+
164 else
+
165 {
+
166 const uint64x2_t end0 =
+
167 veorq_u64(accumulator, vreinterpretq_u64_u32(vld1q_u32((const uint32_t *)alignedData)));
+
168 const uint64x2_t end1 = vreinterpretq_u64_u32(vld1q_u32((const uint32_t *)(alignedData + 1)));
+
169
+
170 uint64x2_t A, B, C, D;
+
171 shiftRight128(end0, leadOutSize, &A, &B);
+
172 shiftRight128(end1, leadOutSize, &C, &D);
+
173
+
174 P = veorq_u64(fold(A, foldConstants1),
+
175 vreinterpretq_u64_u32(vorrq_u32(vreinterpretq_u32_u64(B), vreinterpretq_u32_u64(C))));
+
176 }
+
177
+
178 R = veorq_u64(sse2neon_vmull_p64(vget_low_u64(P), vget_high_u64(foldConstants1)), mm_srli_si128(P, 8));
+
179 }
+
180
+
181 // Final Barrett reduction
+
182 const uint64x2_t T1 = sse2neon_vmull_p64(vget_low_u64(R), vget_low_u64(foldConstants2));
+
183 const uint64x2_t T2 = veorq_u64(
+
184 veorq_u64(sse2neon_vmull_p64(vget_low_u64(T1), vget_high_u64(foldConstants2)), mm_slli_si128(T1, 8)), R);
+
185
+
186 TRACE("Exiting aaruf_crc64_vmull()");
+
187
+
188 return ~vgetq_lane_u64(T2, 1);
+
189}
+
190
+
191#endif
+ + +
#define AARU_CALL
Definition decls.h:45
+
#define AARU_EXPORT
Definition decls.h:54
+
#define FORCE_INLINE
Definition decls.h:63
+ +
#define TRACE(fmt,...)
Definition log.h:25
+
+
+
+ + + + diff --git a/docs/html/create_8c.html b/docs/html/create_8c.html new file mode 100644 index 0000000..f50b93d --- /dev/null +++ b/docs/html/create_8c.html @@ -0,0 +1,433 @@ + + + + + + + +libaaruformat: src/create.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
create.c File Reference
+
+
+
#include <errno.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "aaruformat.h"
+#include "enums.h"
+#include "internal.h"
+#include "log.h"
+
+

Go to the source code of this file.

+ + + + + +

+Functions

static void cleanup_failed_create (aaruformat_context *ctx)
void * aaruf_create (const char *filepath, const uint32_t media_type, const uint32_t sector_size, const uint64_t user_sectors, const uint64_t negative_sectors, const uint64_t overflow_sectors, const char *options, const uint8_t *application_name, const uint8_t application_name_length, const uint8_t application_major_version, const uint8_t application_minor_version, const bool is_tape)
 Creates a new AaruFormat image file.
+

Function Documentation

+ +

◆ aaruf_create()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void * aaruf_create (const char * filepath,
const uint32_t media_type,
const uint32_t sector_size,
const uint64_t user_sectors,
const uint64_t negative_sectors,
const uint64_t overflow_sectors,
const char * options,
const uint8_t * application_name,
const uint8_t application_name_length,
const uint8_t application_major_version,
const uint8_t application_minor_version,
const bool is_tape )
+
+ +

Creates a new AaruFormat image file.

+

Allocates and initializes a new aaruformat context and image file with the specified parameters. This function sets up all necessary data structures including headers, DDT (deduplication table), caches, and index entries for writing a new AaruFormat image. It also handles file creation, memory allocation, and proper initialization of the writing context. The function supports both block-based media (disks, optical media) and sequential tape media with different initialization strategies optimized for each media type.

+

Media Type Handling: The function creates different internal structures based on the is_tape parameter:

+

Block Media (is_tape = false):

    +
  • Initializes full DDT (Deduplication Table) version 2 for sector-level deduplication
  • +
  • Allocates primary DDT table (userDataDdtMini or userDataDdtBig) as a preallocated array
  • +
  • Configures multi-level DDT support for large images (> 138,412,552 sectors)
  • +
  • Enables optional deduplication hash map for detecting duplicate sectors
  • +
  • Reserves space for DDT at the beginning of the file (after header, block-aligned)
  • +
  • Data blocks start after DDT table to maintain sequential layout
  • +
  • DDT size is fixed and known upfront based on sector count
  • +
+

Tape Media (is_tape = true):

    +
  • Initializes DDT for sector-level deduplication using a different strategy
  • +
  • Uses a growing hash table (tapeDdt) instead of a preallocated array
  • +
  • Sets ctx->is_tape flag and initializes ctx->tapeDdt to NULL (populated on first write)
  • +
  • Data blocks start immediately after the header (block-aligned)
  • +
  • Hash table grows dynamically as blocks are written
  • +
  • Optimized for sequential write patterns typical of tape media
  • +
  • Tape file/partition metadata is managed separately via additional hash tables
  • +
  • More memory-efficient for tapes with unknown final size
  • +
+

Initialization Flow:

    +
  1. Parse creation options (compression, alignment, deduplication, checksums)
  2. +
  3. Allocate and zero-initialize context structure
  4. +
  5. Create/open image file in binary write mode
  6. +
  7. Initialize AaruFormat header with application and version information
  8. +
  9. Set up image metadata and sector size information
  10. +
  11. Initialize block and header caches for performance
  12. +
  13. Initialize ECC context for Compact Disc support
  14. +
  15. Branch based on media type:
      +
    • Block media: Configure DDT structures and calculate offsets with preallocated array
    • +
    • Tape media: Set tape flags and initialize for dynamic hash table DDT
    • +
    +
  16. +
  17. Initialize index entries array for tracking all blocks
  18. +
  19. Configure compression, checksums, and deduplication based on options
  20. +
  21. Position file pointer at calculated data start position
  22. +
+

DDT Configuration (Block Media Only): The function automatically selects optimal DDT parameters:

    +
  • Single-level DDT (tableShift=0): For images < 138,412,552 sectors
  • +
  • Multi-level DDT (tableShift=22): For images ≥ 138,412,552 sectors
  • +
+

The DDT offset calculation ensures proper alignment:

    +
  • Primary DDT placed immediately after header (block-aligned)
  • +
  • Data blocks positioned after DDT table (block-aligned)
  • +
  • Alignment controlled by blockAlignmentShift from options
  • +
+
Parameters
+ + + + + + + + + + + + + +
filepathPath to the image file to create. The file will be created if it doesn't exist, or overwritten if it does. Must be a valid writable path.
media_typeMedia type identifier (e.g., CompactDisc, DVD, HardDisk, Tape formats). This affects how the image is structured and which features are enabled.
sector_sizeSize of each sector/block in bytes. Common values:
    +
  • 512 bytes: Hard disks, floppy disks
  • +
  • 2048 bytes: CD-ROM, DVD
  • +
  • Variable: Tape media (block size varies by format)
  • +
+
user_sectorsNumber of user data sectors/blocks in the image. This is the main data area excluding negative (lead-in) and overflow (lead-out) regions. For tape media, this may be an estimate as the final size is often unknown.
negative_sectorsNumber of negative sectors (typically lead-in area for optical media). Set to 0 for media types without lead-in areas. Not used for tape media.
overflow_sectorsNumber of overflow sectors (typically lead-out area for optical media). Set to 0 for media types without lead-out areas. Not used for tape media.
optionsString with creation options in key=value format, semicolon-separated. Supported options:
    +
  • "compress=true|false": Enable/disable LZMA compression
  • +
  • "deduplicate=true|false": Enable/disable sector deduplication (all media types)
  • +
  • "md5=true|false": Calculate MD5 checksum during write
  • +
  • "sha1=true|false": Calculate SHA-1 checksum during write
  • +
  • "sha256=true|false": Calculate SHA-256 checksum during write
  • +
  • "spamsum=true|false": Calculate SpamSum fuzzy hash during write
  • +
  • "blake3=true|false": Calculate BLAKE3 checksum during write
  • +
  • "block_alignment=N": Block alignment shift value (default varies)
  • +
  • "data_shift=N": Data shift value for DDT granularity
  • +
  • "table_shift=N": Table shift for multi-level DDT (-1 for auto, block media only)
  • +
  • "dictionary=N": LZMA dictionary size in bytes Example: "compress=true;deduplicate=true;md5=true;sha1=true"
  • +
+
application_namePointer to the application name string (UTF-8 encoded). This identifies the software that created the image. The string will be copied directly to the image header.
application_name_lengthLength of the application name string in bytes. Must be ≤ AARU_HEADER_APP_NAME_LEN (64 bytes).
application_major_versionMajor version of the creating application (0-255).
application_minor_versionMinor version of the creating application (0-255).
is_tapeBoolean flag indicating tape media type:
    +
  • true: Initialize for tape media (sequential, dynamic hash table DDT, file/partition metadata)
  • +
  • false: Initialize for block media (random access, preallocated array DDT)
  • +
+
+
+
+
Returns
Returns one of the following:
+
Return values
+ + + +
aaruformatContext*Successfully created and initialized context. The returned pointer contains:
    +
  • Properly initialized AaruFormat headers and metadata
  • +
  • For block media: Allocated and configured DDT structures with preallocated arrays
  • +
  • For tape media: Tape flags set, DDT initialized as NULL (grows on demand)
  • +
  • Initialized block and header caches for performance
  • +
  • Open file stream ready for writing operations
  • +
  • Index entries array ready for block tracking
  • +
  • ECC context initialized for Compact Disc support
  • +
  • Checksum contexts initialized based on options
  • +
+
NULLCreation failed. The specific error can be determined by checking errno, which will be set to:
    +
  • AARUF_ERROR_NOT_ENOUGH_MEMORY (-9) when memory allocation fails for:
      +
    • Context allocation
    • +
    • Readable sector tags array allocation
    • +
    • Application version string allocation
    • +
    • Image version string allocation
    • +
    • DDT table allocation (userDataDdtMini or userDataDdtBig, block media only)
    • +
    • Index entries array allocation
    • +
    +
  • +
  • AARUF_ERROR_CANNOT_CREATE_FILE (-19) when file operations fail:
      +
    • Unable to open the specified filepath for writing
    • +
    • File seek operations fail during initialization
    • +
    • File system errors or permission issues
    • +
    +
  • +
  • AARUF_ERROR_INVALID_APP_NAME_LENGTH (-20) when:
      +
    • application_name_length exceeds AARU_HEADER_APP_NAME_LEN (64 bytes)
    • +
    +
  • +
+
+
+
+
Note
Memory Management:
    +
  • The function performs extensive memory allocation for various context structures
  • +
  • On failure, all previously allocated memory is properly cleaned up
  • +
  • The returned context must be freed using aaruf_close() when finished
  • +
+
+
+File Operations:
    +
  • Creates a new file at the specified path (overwrites existing files)
  • +
  • Opens the file in binary read/write mode ("wb+")
  • +
  • Positions the file pointer at the calculated data start position
  • +
  • File alignment is handled based on parsed options
  • +
+
+
+DDT Initialization (Block Media Only):
    +
  • Uses DDT version 2 format with configurable compression and alignment
  • +
  • Calculates optimal table sizes based on sector counts and shift parameters
  • +
  • All DDT entries are initialized to zero (indicating unallocated sectors)
  • +
  • Multi-level DDT is used for images with ≥ 138,412,552 total sectors
  • +
  • Single-level DDT is used for smaller images for efficiency
  • +
  • DDT is a fixed-size preallocated array written to file at known offset
  • +
+
+
+Tape Media Initialization:
    +
  • Tape images use a dynamic hash table DDT for sector-level deduplication
  • +
  • File and partition metadata is managed via separate hash tables
  • +
  • ctx->is_tape is set to 1 to indicate tape mode throughout the library
  • +
  • ctx->tapeDdt is initialized to NULL and grows dynamically as blocks are written
  • +
  • Data blocks can start immediately after header for optimal sequential access
  • +
  • The hash table DDT allows for efficient deduplication without knowing final size
  • +
  • More memory-efficient for tapes with unpredictable or very large sizes
  • +
  • Deduplication hash map may still be used alongside tapeDdt if enabled in options
  • +
+
+
+Options Parsing:
    +
  • The options string is parsed to extract block_alignment, data_shift, and table_shift
  • +
  • These parameters affect memory usage, performance, and file organization
  • +
  • Invalid options may result in suboptimal performance but won't cause failure
  • +
  • Compression and checksums can be enabled independently via options
  • +
+
+
+Checksum Initialization:
    +
  • MD5, SHA-1, SHA-256, SpamSum, and BLAKE3 can be calculated during write
  • +
  • Checksum contexts are initialized only if requested in options
  • +
  • Checksums are computed incrementally as sectors/blocks are written
  • +
  • Final checksums are stored in checksum block during image finalization
  • +
+
+
Warning
The created context is in writing mode and expects proper finalization before closing to ensure index and metadata are written correctly.
+
+Application name length validation is strict - exceeding the limit will cause creation failure with AARUF_ERROR_INVALID_APP_NAME_LENGTH.
+
+For tape media, the DDT structure is fundamentally different (hash table vs array). The is_tape flag must accurately reflect the media type being created.
+
+The negative_sectors and overflow_sectors parameters are used only for block media. For tape media, these parameters are ignored.
+
See also
aaruf_close() for proper context cleanup and image finalization
+
+aaruf_write_sector() for writing sectors to block media images
+
+aaruf_set_tape_file() for defining tape file metadata
+
+aaruf_set_tape_partition() for defining tape partition metadata
+

< Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).

+ +

Definition at line 279 of file create.c.

+ +

References AARU_HEADER_APP_NAME_LEN, AARU_MAGIC, aaruf_ecc_cd_init(), AARUF_ERROR_CANNOT_CREATE_FILE, AARUF_ERROR_INVALID_APP_NAME_LENGTH, AARUF_ERROR_NOT_ENOUGH_MEMORY, aaruf_get_xml_mediatype(), aaruf_md5_init(), aaruf_sha1_init(), aaruf_sha256_init(), aaruf_spamsum_init(), AARUF_VERSION_V2, ImageInfo::Application, AaruHeaderV2::application, AaruHeaderV2::applicationMajorVersion, AaruHeaderV2::applicationMinorVersion, ImageInfo::ApplicationVersion, aaru_options::blake3, aaruformat_context::blake3_context, aaru_options::block_alignment, aaruformat_context::block_cache, aaruformat_context::block_header_cache, DdtHeader2::blockAlignmentShift, DdtHeader2::blocks, CacheHeader::cache, aaruformat_context::calculating_blake3, aaruformat_context::calculating_md5, aaruformat_context::calculating_sha1, aaruformat_context::calculating_sha256, aaruformat_context::calculating_spamsum, cleanup_failed_create(), aaru_options::compress, DdtHeader2::compression, aaruformat_context::compression_enabled, create_map(), ImageInfo::CreationTime, AaruHeaderV2::creationTime, aaru_options::data_shift, DdtHeader2::dataShift, aaru_options::deduplicate, aaruformat_context::deduplicate, DeDuplicationTable2, aaru_options::dictionary, aaruformat_context::ecc_cd_context, DdtHeader2::entries, FATAL, get_filetime_uint64(), aaruformat_context::header, AaruHeaderV2::identifier, DdtHeader2::identifier, aaruformat_context::image_info, AaruHeaderV2::imageMajorVersion, AaruHeaderV2::imageMinorVersion, ImageInfo::ImageSize, aaruformat_context::imageStream, aaruformat_context::in_memory_ddt, aaruformat_context::index_entries, AaruHeaderV2::indexOffset, aaruformat_context::is_tape, aaruformat_context::is_writing, aaruformat_context::last_written_block, ImageInfo::LastModificationTime, AaruHeaderV2::lastWrittenTime, DdtHeader2::levels, LIBAARUFORMAT_MAJOR_VERSION, LIBAARUFORMAT_MINOR_VERSION, aaruformat_context::library_major_version, aaruformat_context::library_minor_version, aaruformat_context::lzma_dict_size, aaruformat_context::magic, MAX_CACHE_SIZE, CacheHeader::max_items, MaxSectorTag, aaru_options::md5, aaruformat_context::md5_context, ImageInfo::MediaType, AaruHeaderV2::mediaType, ImageInfo::MetadataMediaType, DdtHeader2::negative, aaruformat_context::next_block_position, None, DdtHeader2::overflow, parse_options(), DdtHeader2::previousLevelOffset, aaruformat_context::primary_ddt_offset, aaruformat_context::readableSectorTags, aaruformat_context::rewinded, aaruformat_context::sector_hash_map, ImageInfo::Sectors, ImageInfo::SectorSize, aaru_options::sha1, aaruformat_context::sha1_context, aaru_options::sha256, aaruformat_context::sha256_context, aaruformat_context::shift, aaru_options::spamsum, aaruformat_context::spamsum_context, DdtHeader2::start, aaru_options::table_shift, DdtHeader2::tableLevel, DdtHeader2::tableShift, aaruformat_context::tape_ddt, TRACE, DdtHeader2::type, aaruformat_context::user_data_ddt2, aaruformat_context::user_data_ddt_header, UserData, and ImageInfo::Version.

+ +
+
+ +

◆ cleanup_failed_create()

+ + +
+
+ +
+ + + + diff --git a/docs/html/create_8c.js b/docs/html/create_8c.js new file mode 100644 index 0000000..47f579e --- /dev/null +++ b/docs/html/create_8c.js @@ -0,0 +1,5 @@ +var create_8c = +[ + [ "aaruf_create", "create_8c.html#a8fc1d6adf1ec5cc7d7bb9c067aff9f6e", null ], + [ "cleanup_failed_create", "create_8c.html#ae92275e097d4193d960bb97311b9cd78", null ] +]; \ No newline at end of file diff --git a/docs/html/create_8c_source.html b/docs/html/create_8c_source.html new file mode 100644 index 0000000..f22b772 --- /dev/null +++ b/docs/html/create_8c_source.html @@ -0,0 +1,601 @@ + + + + + + + +libaaruformat: src/create.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
create.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18#include <errno.h>
+
19#include <stdbool.h>
+
20#include <stdint.h>
+
21#include <stdio.h>
+
22#include <stdlib.h>
+
23#include <string.h>
+
24
+
25#include "aaruformat.h"
+
26#include "enums.h"
+
27#include "internal.h"
+
28#include "log.h"
+
29
+
+ +
31{
+
32 if(ctx == NULL) return;
+
33
+
34 if(ctx->sector_hash_map != NULL)
+
35 {
+ +
37 ctx->sector_hash_map = NULL;
+
38 }
+
39
+
40 if(ctx->index_entries != NULL)
+
41 {
+
42 utarray_free(ctx->index_entries);
+
43 ctx->index_entries = NULL;
+
44 }
+
45
+
46 if(ctx->user_data_ddt2 != NULL)
+
47 {
+
48 free(ctx->user_data_ddt2);
+
49 ctx->user_data_ddt2 = NULL;
+
50 }
+
51
+
52 if(ctx->spamsum_context != NULL)
+
53 {
+ +
55 ctx->spamsum_context = NULL;
+
56 }
+
57
+
58 if(ctx->blake3_context != NULL)
+
59 {
+
60 free(ctx->blake3_context);
+
61 ctx->blake3_context = NULL;
+
62 }
+
63
+
64 if(ctx->ecc_cd_context != NULL)
+
65 {
+
66 free(ctx->ecc_cd_context);
+
67 ctx->ecc_cd_context = NULL;
+
68 }
+
69
+
70 if(ctx->readableSectorTags != NULL)
+
71 {
+
72 free(ctx->readableSectorTags);
+
73 ctx->readableSectorTags = NULL;
+
74 }
+
75
+
76 // ApplicationVersion and Version are fixed-size arrays, not pointers - no need to free
+
77
+
78 if(ctx->imageStream != NULL)
+
79 {
+
80 fclose(ctx->imageStream);
+
81 ctx->imageStream = NULL;
+
82 }
+
83
+
84 free(ctx);
+
85}
+
+
86
+
+
279void *aaruf_create(const char *filepath, const uint32_t media_type, const uint32_t sector_size,
+
280 const uint64_t user_sectors, const uint64_t negative_sectors, const uint64_t overflow_sectors,
+
281 const char *options, const uint8_t *application_name, const uint8_t application_name_length,
+
282 const uint8_t application_major_version, const uint8_t application_minor_version, const bool is_tape)
+
283{
+
284 TRACE("Entering aaruf_create(%s, %u, %u, %llu, %llu, %llu, %s, %s, %u, %u, %u, %d)", filepath, media_type,
+
285 sector_size, user_sectors, negative_sectors, overflow_sectors, options,
+
286 application_name ? (const char *)application_name : "NULL", application_name_length,
+
287 application_major_version, application_minor_version, is_tape);
+
288
+
289 // Parse the options
+
290 TRACE("Parsing options");
+
291 const aaru_options parsed_options = parse_options(options);
+
292
+
293 // Allocate context
+
294 TRACE("Allocating memory for context");
+
295 aaruformat_context *ctx = malloc(sizeof(aaruformat_context));
+
296 if(ctx == NULL)
+
297 {
+
298 FATAL("Not enough memory to create context");
+ +
300
+
301 TRACE("Exiting aaruf_create() = NULL");
+
302 return NULL;
+
303 }
+
304
+
305 memset(ctx, 0, sizeof(aaruformat_context));
+
306
+
307 // Create the image file
+
308 TRACE("Creating image file %s", filepath);
+
309 ctx->imageStream = fopen(filepath, "wb+");
+
310 if(ctx->imageStream == NULL)
+
311 {
+
312 FATAL("Error %d opening file %s for writing", errno, filepath);
+ +
314
+
315 TRACE("Exiting aaruf_create() = NULL");
+ +
317 return NULL;
+
318 }
+
319
+
320 if(application_name_length > AARU_HEADER_APP_NAME_LEN)
+
321 {
+
322 FATAL("Application name too long (%u bytes, maximum %u bytes)", application_name_length,
+ + +
325
+
326 TRACE("Exiting aaruf_create() = NULL");
+ +
328 return NULL;
+
329 }
+
330
+
331 // Initialize header
+
332 TRACE("Initializing header");
+ +
334 memcpy(ctx->header.application, application_name, application_name_length);
+ +
336 ctx->header.imageMinorVersion = 0;
+
337 ctx->header.applicationMajorVersion = application_major_version;
+
338 ctx->header.applicationMinorVersion = application_minor_version;
+
339 ctx->header.mediaType = media_type;
+
340 ctx->header.indexOffset = 0;
+ + +
343
+
344 ctx->readableSectorTags = (bool *)malloc(sizeof(bool) * MaxSectorTag);
+
345
+
346 if(ctx->readableSectorTags == NULL)
+
347 {
+ +
349
+
350 TRACE("Exiting aaruf_create() = NULL");
+ +
352 return NULL;
+
353 }
+
354
+
355 memset(ctx->readableSectorTags, 0, sizeof(bool) * MaxSectorTag);
+
356
+
357 // Initialize image info
+
358 TRACE("Initializing image info");
+
359
+
360 // Copy application name (UTF-8) to image_info
+
361 memset(ctx->image_info.Application, 0, 64);
+
362 size_t copy_len = application_name_length < 63 ? application_name_length : 63;
+
363 memcpy(ctx->image_info.Application, application_name, copy_len);
+
364 ctx->image_info.Application[63] = '\0';
+
365
+
366 // Set application version string directly in the fixed-size array
+
367 memset(ctx->image_info.ApplicationVersion, 0, 32);
+ + +
370
+
371 // Set image version string directly in the fixed-size array
+
372 memset(ctx->image_info.Version, 0, 32);
+
373 sprintf(ctx->image_info.Version, "%d.%d", ctx->header.imageMajorVersion, ctx->header.imageMinorVersion);
+
374
+ +
376 ctx->image_info.ImageSize = 0;
+ + + +
380 ctx->image_info.SectorSize = sector_size;
+
381 ctx->image_info.Sectors = user_sectors;
+
382
+
383 // Initialize caches
+
384 TRACE("Initializing caches");
+
385 ctx->block_header_cache.cache = NULL;
+
386 const uint64_t cache_divisor = (uint64_t)ctx->image_info.SectorSize * (1ULL << ctx->shift);
+
387 ctx->block_header_cache.max_items = cache_divisor == 0 ? 0 : MAX_CACHE_SIZE / cache_divisor;
+
388 ctx->block_cache.cache = NULL;
+ +
390
+
391 // TODO: Cache tracks and sessions?
+
392
+
393 // Initialize ECC for Compact Disc
+
394 TRACE("Initializing Compact Disc ECC");
+ +
396
+
397 ctx->magic = AARU_MAGIC;
+ + +
400
+
401 if(!is_tape)
+
402 { // Initialize DDT2
+
403 TRACE("Initializing DDT2");
+
404 ctx->in_memory_ddt = true;
+ + + + + +
410 ctx->user_data_ddt_header.negative = negative_sectors;
+
411 ctx->user_data_ddt_header.blocks = user_sectors + overflow_sectors + negative_sectors;
+
412 ctx->user_data_ddt_header.overflow = overflow_sectors;
+ + +
415 ctx->user_data_ddt_header.dataShift = parsed_options.data_shift;
+
416
+
417 if(parsed_options.table_shift == -1)
+
418 {
+
419 const uint64_t total_sectors = user_sectors + overflow_sectors + negative_sectors;
+
420
+
421 if(total_sectors < 0x8388608ULL)
+ +
423 else
+ +
425 }
+
426 else
+ +
428 parsed_options.table_shift > 0 ? (uint8_t)parsed_options.table_shift : 0;
+
429
+ +
431
+
432 uint8_t effective_table_shift = ctx->user_data_ddt_header.tableShift;
+
433 if(effective_table_shift >= 63)
+
434 {
+
435 TRACE("Clamping table shift from %u to 62 to avoid overflow", effective_table_shift);
+
436 effective_table_shift = 62;
+
437 ctx->user_data_ddt_header.tableShift = effective_table_shift;
+
438 }
+
439
+
440 const uint64_t sectors_per_entry = 1ULL << effective_table_shift;
+
441 ctx->user_data_ddt_header.entries = ctx->user_data_ddt_header.blocks / sectors_per_entry;
+
442 if(ctx->user_data_ddt_header.blocks % sectors_per_entry != 0 || ctx->user_data_ddt_header.entries == 0)
+ +
444
+
445 TRACE("Initializing primary/single DDT");
+
446 ctx->user_data_ddt2 =
+
447 (uint64_t *)calloc(ctx->user_data_ddt_header.entries, sizeof(uint64_t)); // All entries to zero
+
448 if(ctx->user_data_ddt2 == NULL)
+
449 {
+
450 FATAL("Not enough memory to allocate primary DDT (big)");
+ +
452 TRACE("Exiting aaruf_create() = NULL");
+ +
454 return NULL;
+
455 }
+
456
+
457 // Set the primary DDT offset (just after the header, block aligned)
+
458 ctx->primary_ddt_offset = sizeof(AaruHeaderV2); // Start just after the header
+
459 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
460 ctx->primary_ddt_offset = ctx->primary_ddt_offset + alignment_mask & ~alignment_mask;
+
461
+
462 TRACE("Primary DDT will be placed at offset %" PRIu64, ctx->primary_ddt_offset);
+
463
+
464 // Calculate size of primary DDT table
+
465 const uint64_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint64_t);
+
466
+
467 // Calculate where data blocks can start (after primary DDT + header)
+ +
469 {
+
470 const uint64_t data_start_position = ctx->primary_ddt_offset + sizeof(DdtHeader2) + primary_table_size;
+
471 ctx->next_block_position = data_start_position + alignment_mask & ~alignment_mask;
+
472 }
+
473 else
+
474 ctx->next_block_position = ctx->primary_ddt_offset; // Single-level DDT can start anywhere
+
475 }
+
476 else
+
477 {
+
478 // Fill needed values
+ +
480 ctx->user_data_ddt_header.dataShift = parsed_options.data_shift;
+
481
+
482 // Calculate aligned next block position
+
483 const uint64_t alignment_mask = (1ULL << parsed_options.block_alignment) - 1;
+
484 ctx->next_block_position = sizeof(AaruHeaderV2); // Start just after the header
+
485 ctx->next_block_position = ctx->next_block_position + alignment_mask & ~alignment_mask;
+
486 ctx->is_tape = 1;
+
487 ctx->tape_ddt = NULL;
+
488 }
+
489
+
490 TRACE("Data blocks will start at position %" PRIu64, ctx->next_block_position);
+
491
+
492 // Position file pointer at the data start position
+
493 if(fseek(ctx->imageStream, ctx->next_block_position, SEEK_SET) != 0)
+
494 {
+
495 FATAL("Could not seek to data start position");
+ +
497 TRACE("Exiting aaruf_create() = NULL");
+ +
499 return NULL;
+
500 }
+
501
+
502 // Initialize index entries array
+
503 TRACE("Initializing index entries array");
+
504 const UT_icd index_entry_icd = {sizeof(IndexEntry), NULL, NULL, NULL};
+
505 utarray_new(ctx->index_entries, &index_entry_icd);
+
506
+
507 if(ctx->index_entries == NULL)
+
508 {
+
509 FATAL("Not enough memory to create index entries array");
+ +
511
+
512 TRACE("Exiting aaruf_create() = NULL");
+ +
514 return NULL;
+
515 }
+
516
+
517 ctx->compression_enabled = parsed_options.compress;
+
518 ctx->lzma_dict_size = parsed_options.dictionary;
+
519 ctx->deduplicate = parsed_options.deduplicate;
+
520 if(ctx->deduplicate)
+
521 ctx->sector_hash_map = create_map(ctx->user_data_ddt_header.blocks * 25 / 100); // 25% of total sectors
+
522
+
523 ctx->rewinded = false;
+
524 ctx->last_written_block = 0;
+
525
+
526 if(parsed_options.md5)
+
527 {
+
528 ctx->calculating_md5 = true;
+ +
530 }
+
531 if(parsed_options.sha1)
+
532 {
+
533 ctx->calculating_sha1 = true;
+ +
535 }
+
536 if(parsed_options.sha256)
+
537 {
+
538 ctx->calculating_sha256 = true;
+ +
540 }
+
541 if(parsed_options.spamsum)
+
542 {
+
543 ctx->calculating_spamsum = true;
+ +
545 }
+
546 if(parsed_options.blake3)
+
547 {
+
548 ctx->blake3_context = calloc(1, sizeof(blake3_hasher));
+
549 if(ctx->blake3_context != NULL)
+
550 {
+
551 ctx->calculating_blake3 = true;
+
552 blake3_hasher_init(ctx->blake3_context);
+
553 }
+
554 }
+
555
+
556 // Is writing
+
557 ctx->is_writing = true;
+
558
+
559 TRACE("Exiting aaruf_create() = %p", ctx);
+
560 // Return context
+
561 return ctx;
+
562}
+
+ +
#define LIBAARUFORMAT_MAJOR_VERSION
Definition aaruformat.h:22
+
#define LIBAARUFORMAT_MINOR_VERSION
Definition aaruformat.h:23
+
#define AARU_MAGIC
Magic identifier for AaruFormat container (ASCII "AARUFRMT").
Definition consts.h:64
+
#define MAX_CACHE_SIZE
Maximum read cache size (bytes).
Definition consts.h:79
+
#define AARUF_VERSION_V2
Second on‑disk version (C implementation).
Definition consts.h:75
+
void * aaruf_create(const char *filepath, const uint32_t media_type, const uint32_t sector_size, const uint64_t user_sectors, const uint64_t negative_sectors, const uint64_t overflow_sectors, const char *options, const uint8_t *application_name, const uint8_t application_name_length, const uint8_t application_major_version, const uint8_t application_minor_version, const bool is_tape)
Creates a new AaruFormat image file.
Definition create.c:279
+
static void cleanup_failed_create(aaruformat_context *ctx)
Definition create.c:30
+
void aaruf_sha256_init(sha256_ctx *ctx)
Definition sha256.c:76
+
void aaruf_md5_init(md5_ctx *ctx)
Definition md5.c:425
+
void aaruf_spamsum_free(spamsum_ctx *ctx)
Frees a spamsum (fuzzy hash) context.
Definition spamsum.c:75
+
spamsum_ctx * aaruf_spamsum_init(void)
Definition spamsum.c:37
+
void aaruf_sha1_init(sha1_ctx *ctx)
Definition sha1.c:34
+
void * aaruf_ecc_cd_init()
Initializes a Compact Disc ECC context.
Definition ecc_cd.c:35
+
int32_t aaruf_get_xml_mediatype(int32_t type)
Definition helpers.c:339
+ +
@ DeDuplicationTable2
Block containing a deduplication table v2.
Definition enums.h:143
+
@ UserData
User (main) data.
Definition enums.h:46
+
@ None
Not compressed.
Definition enums.h:33
+
#define AARUF_ERROR_CANNOT_CREATE_FILE
Output file could not be created / opened for write.
Definition errors.h:58
+
#define AARUF_ERROR_INVALID_APP_NAME_LENGTH
Application name field length invalid (sanity limit).
Definition errors.h:59
+
#define AARUF_ERROR_NOT_ENOUGH_MEMORY
Memory allocation failure (critical).
Definition errors.h:48
+
@ MaxSectorTag
Definition aaru.h:916
+
hash_map_t * create_map(size_t size)
Creates a new hash map with the specified initial size.
Definition hash_map.c:49
+
void free_map(hash_map_t *map)
Frees all memory associated with a hash map.
Definition hash_map.c:73
+
#define AARU_HEADER_APP_NAME_LEN
Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).
Definition header.h:59
+ +
uint64_t get_filetime_uint64()
Gets the current time as a 64-bit FILETIME value.
Definition time.c:45
+
aaru_options parse_options(const char *options)
Parses the options string for AaruFormat image creation/opening.
Definition options.c:38
+ +
#define FATAL(fmt,...)
Definition log.h:40
+
#define TRACE(fmt,...)
Definition log.h:25
+
Version 2 container header with GUID, alignment shifts, and feature negotiation bitmaps.
Definition header.h:107
+
uint8_t application[64]
UTF-16LE creator application name (fixed 64 bytes).
Definition header.h:109
+
uint8_t applicationMajorVersion
Creator application major version.
Definition header.h:112
+
uint64_t identifier
File magic (AARU_MAGIC).
Definition header.h:108
+
int64_t lastWrittenTime
Last modification FILETIME (100 ns since 1601-01-01 UTC).
Definition header.h:117
+
uint64_t indexOffset
Absolute byte offset to primary index block (MUST be > 0; 0 => corrupt/unreadable).
Definition header.h:115
+
uint8_t applicationMinorVersion
Creator application minor / patch version.
Definition header.h:113
+
uint32_t mediaType
Media type enumeration (value from MediaType).
Definition header.h:114
+
uint8_t imageMinorVersion
Container format minor version.
Definition header.h:111
+
int64_t creationTime
Creation FILETIME (100 ns since 1601-01-01 UTC).
Definition header.h:116
+
uint8_t imageMajorVersion
Container format major version.
Definition header.h:110
+
struct CacheEntry * cache
Hash root (uthash). NULL when empty.
Definition lru.h:48
+
uint64_t max_items
Hard limit for number of entries (policy: enforce/ignore depends on implementation).
Definition lru.h:47
+
Lookup tables and state for Compact Disc EDC/ECC (P/Q) regeneration / verification.
Definition context.h:86
+
Header preceding a version 2 hierarchical deduplication table.
Definition ddt.h:142
+
uint16_t type
Data classification (DataType) for sectors referenced by this table.
Definition ddt.h:144
+
uint64_t start
Base internal index covered by this table (used for secondary tables; currently informational).
Definition ddt.h:153
+
uint16_t overflow
Trailing dumped sectors beyond user area (overflow range), still mapped with entries.
Definition ddt.h:151
+
uint64_t entries
Number of entries contained in (uncompressed) table payload.
Definition ddt.h:158
+
uint8_t levels
Total number of hierarchy levels (root depth); > 0.
Definition ddt.h:146
+
uint32_t identifier
Block identifier, must be BlockType::DeDuplicationTable2.
Definition ddt.h:143
+
uint8_t tableShift
2^tableShift = number of logical sectors per primary entry (multi-level only; 0 for single-level or s...
Definition ddt.h:156
+
uint64_t blocks
Total internal span (negative + usable + overflow) in logical sectors.
Definition ddt.h:150
+
uint16_t negative
Leading negative LBA count; added to external L to build internal index.
Definition ddt.h:149
+
uint8_t blockAlignmentShift
2^blockAlignmentShift = block alignment boundary in bytes.
Definition ddt.h:154
+
uint8_t tableLevel
Zero-based level index of this table (0 = root, increases downward).
Definition ddt.h:147
+
uint16_t compression
Compression algorithm for this table body (CompressionType).
Definition ddt.h:145
+
uint8_t dataShift
2^dataShift = sectors represented per increment in blockIndex field.
Definition ddt.h:155
+
uint64_t previousLevelOffset
Absolute byte offset of the parent (previous) level table; 0 if root.
Definition ddt.h:148
+
uint32_t MediaType
Media type identifier (see MediaType enum; 0=Unknown)
Definition aaru.h:881
+
uint8_t MetadataMediaType
Media type for sidecar generation (internal archival use)
Definition aaru.h:882
+
uint32_t SectorSize
Size of each logical sector in bytes (512, 2048, 2352, 4096, etc.)
Definition aaru.h:875
+
char Application[64]
Name of application that created the image (NUL-terminated)
Definition aaru.h:877
+
uint64_t ImageSize
Size of the image payload in bytes (excludes headers/metadata)
Definition aaru.h:873
+
int64_t CreationTime
Image creation timestamp (Windows FILETIME: 100ns since 1601-01-01 UTC)
Definition aaru.h:879
+
int64_t LastModificationTime
Last modification timestamp (Windows FILETIME format)
Definition aaru.h:880
+
char Version[32]
Image format version string (NUL-terminated, e.g., "6.0")
Definition aaru.h:876
+
uint64_t Sectors
Total count of addressable logical sectors/blocks.
Definition aaru.h:874
+
char ApplicationVersion[32]
Version of the creating application (NUL-terminated)
Definition aaru.h:878
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
Parsed user-specified tunables controlling compression, deduplication, hashing and DDT geometry.
Definition options.h:217
+
bool deduplicate
Storage dedup flag (DDT always exists).
Definition options.h:219
+
uint8_t data_shift
Global data shift: low bits encode sector offset inside a block (2^data_shift span).
Definition options.h:223
+
uint32_t dictionary
LZMA dictionary size in bytes (>= 4096 recommended). Default: 33554432 (32 MiB).
Definition options.h:221
+
bool compress
Enable adaptive compression (LZMA for data blocks, FLAC for audio). Default: true.
Definition options.h:218
+
bool sha256
Generate SHA-256 checksum (ChecksumAlgorithm::Sha256) when finalizing image.
Definition options.h:227
+
bool spamsum
Generate SpamSum fuzzy hash (ChecksumAlgorithm::SpamSum) if enabled.
Definition options.h:229
+
int8_t table_shift
DDT table shift (multi-level fan-out exponent). Default: heuristically calculated.
Definition options.h:222
+
bool md5
Generate MD5 checksum (ChecksumAlgorithm::Md5) when finalizing image.
Definition options.h:225
+
bool blake3
Generate BLAKE3 checksum if supported (not stored if algorithm unavailable).
Definition options.h:228
+
bool sha1
Generate SHA-1 checksum (ChecksumAlgorithm::Sha1) when finalizing image.
Definition options.h:226
+
uint8_t block_alignment
log2 underlying block alignment (2^n bytes). Default: 9 (512 bytes).
Definition options.h:224
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
DdtHeader2 user_data_ddt_header
Active user data DDT v2 header (primary table meta).
Definition context.h:189
+
uint8_t library_major_version
Linked library major version.
Definition context.h:177
+
bool deduplicate
Storage deduplication active (duplicates coalesce).
Definition context.h:298
+
bool compression_enabled
True if block compression enabled (writing path).
Definition context.h:299
+
uint64_t last_written_block
Last written block number (write path).
Definition context.h:283
+
hash_map_t * sector_hash_map
Deduplication hash map (fingerprint->entry mapping).
Definition context.h:253
+
sha256_ctx sha256_context
Opaque SHA-256 context for streaming updates.
Definition context.h:272
+
bool calculating_sha256
True if whole-image SHA-256 being calculated on-the-fly.
Definition context.h:275
+
struct CacheHeader block_header_cache
LRU/Cache header for block headers.
Definition context.h:256
+
md5_ctx md5_context
Opaque MD5 context for streaming updates.
Definition context.h:270
+
uint64_t * user_data_ddt2
DDT entries (big variant) primary/secondary current.
Definition context.h:187
+
uint8_t shift
Legacy overall shift (deprecated by data_shift/table_shift).
Definition context.h:195
+
bool is_tape
True if the image is a tape image.
Definition context.h:304
+
bool calculating_sha1
True if whole-image SHA-1 being calculated on-the-fly.
Definition context.h:274
+
CdEccContext * ecc_cd_context
CD ECC/EDC helper tables (allocated on demand).
Definition context.h:248
+
bool rewinded
True if stream has been rewound after open (write path).
Definition context.h:293
+
struct CacheHeader block_cache
LRU/Cache header for block payloads.
Definition context.h:257
+
bool in_memory_ddt
True if primary (and possibly secondary) DDT loaded.
Definition context.h:196
+
AaruHeaderV2 header
Parsed container header (v2).
Definition context.h:175
+
bool is_writing
True if context opened/created for writing.
Definition context.h:292
+
TapeDdtHashEntry * tape_ddt
Hash table root for tape DDT entries.
Definition context.h:182
+
spamsum_ctx * spamsum_context
Opaque SpamSum context for streaming updates.
Definition context.h:267
+
uint64_t magic
File magic (AARU_MAGIC) post-open.
Definition context.h:174
+
bool calculating_spamsum
True if whole-image SpamSum being calculated on-the-fly.
Definition context.h:276
+
uint64_t primary_ddt_offset
File offset of the primary DDT v2 table.
Definition context.h:192
+
blake3_hasher * blake3_context
Opaque BLAKE3 context for streaming updates.
Definition context.h:268
+
bool calculating_blake3
True if whole-image BLAKE3 being calculated on-the-fly.
Definition context.h:277
+
uint8_t library_minor_version
Linked library minor version;.
Definition context.h:178
+
uint64_t next_block_position
Absolute file offset where next block will be written.
Definition context.h:282
+
bool calculating_md5
True if whole-image MD5 being calculated on-the-fly.
Definition context.h:273
+
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
+
UT_array * index_entries
Flattened index entries (UT_array of IndexEntry).
Definition context.h:252
+
ImageInfo image_info
Exposed high-level image info summary.
Definition context.h:260
+
sha1_ctx sha1_context
Opaque SHA-1 context for streaming updates.
Definition context.h:271
+
bool * readableSectorTags
Per-sector boolean array (optical tags read successfully?).
Definition context.h:263
+
uint32_t lzma_dict_size
LZMA dictionary size (writing path).
Definition context.h:297
+
+
+
+ + + + diff --git a/docs/html/cst_8c.html b/docs/html/cst_8c.html new file mode 100644 index 0000000..3a7a7de --- /dev/null +++ b/docs/html/cst_8c.html @@ -0,0 +1,215 @@ + + + + + + + +libaaruformat: src/compression/cst.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
cst.c File Reference
+
+
+
#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include "aaruformat.h"
+
+

Go to the source code of this file.

+ + + + + + +

+Functions

int32_t aaruf_cst_transform (const uint8_t *interleaved, uint8_t *sequential, const size_t length)
 Transforms interleaved subchannel data to sequential format.
int32_t aaruf_cst_untransform (const uint8_t *sequential, uint8_t *interleaved, const size_t length)
 Reverses the CST (Claunia's Subchannel Transform) transformation from sequential to interleaved data.
+

Function Documentation

+ +

◆ aaruf_cst_transform()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_cst_transform (const uint8_t * interleaved,
uint8_t * sequential,
const size_t length )
+
+ +

Transforms interleaved subchannel data to sequential format.

+

Converts interleaved subchannel data into a sequential format for further processing.

+
Parameters
+ + + + +
interleavedPointer to the interleaved data buffer.
sequentialPointer to the output sequential data buffer.
lengthLength of the data buffer.
+
+
+
Returns
AARUF_STATUS_OK on success, or an error code on failure.
+ +

Definition at line 35 of file cst.c.

+ +

References AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_NOT_ENOUGH_MEMORY, and AARUF_STATUS_OK.

+ +

Referenced by write_sector_subchannel().

+ +
+
+ +

◆ aaruf_cst_untransform()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_cst_untransform (const uint8_t * sequential,
uint8_t * interleaved,
const size_t length )
+
+ +

Reverses the CST (Claunia's Subchannel Transform) transformation from sequential to interleaved data.

+
Parameters
+ + + + +
sequentialPointer to the sequential data buffer.
interleavedPointer to the output buffer for interleaved data.
lengthLength of the data in bytes.
+
+
+
Returns
AARUF_STATUS_OK on success, or an error code on failure.
+ +

Definition at line 193 of file cst.c.

+ +

References AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_NOT_ENOUGH_MEMORY, and AARUF_STATUS_OK.

+ +

Referenced by process_data_block().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/cst_8c.js b/docs/html/cst_8c.js new file mode 100644 index 0000000..a0b6a4d --- /dev/null +++ b/docs/html/cst_8c.js @@ -0,0 +1,5 @@ +var cst_8c = +[ + [ "aaruf_cst_transform", "cst_8c.html#aabb2d2d40402e948ccf5411d04a0d2f9", null ], + [ "aaruf_cst_untransform", "cst_8c.html#a1a547b6235034537a0564d1f46f4cbad", null ] +]; \ No newline at end of file diff --git a/docs/html/cst_8c_source.html b/docs/html/cst_8c_source.html new file mode 100644 index 0000000..9660c65 --- /dev/null +++ b/docs/html/cst_8c_source.html @@ -0,0 +1,426 @@ + + + + + + + +libaaruformat: src/compression/cst.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
cst.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <stdint.h>
+
20#include <stdlib.h>
+
21#include <string.h>
+
22
+
23#include "aaruformat.h"
+
24
+
+
35int32_t aaruf_cst_transform(const uint8_t *interleaved, uint8_t *sequential, const size_t length)
+
36{
+
37 uint8_t *p = NULL;
+
38 uint8_t *q = NULL;
+
39 uint8_t *r = NULL;
+
40 uint8_t *s = NULL;
+
41 uint8_t *t = NULL;
+
42 uint8_t *u = NULL;
+
43 uint8_t *v = NULL;
+
44 uint8_t *w = NULL;
+
45 size_t q_start = 0;
+
46 size_t r_start = 0;
+
47 size_t s_start = 0;
+
48 size_t t_start = 0;
+
49 size_t u_start = 0;
+
50 size_t v_start = 0;
+
51 size_t w_start = 0;
+
52 size_t i = 0;
+
53
+
54 if(interleaved == NULL || sequential == NULL) return AARUF_ERROR_BUFFER_TOO_SMALL;
+
55
+
56 p = malloc(length / 8);
+
57 q = malloc(length / 8);
+
58 r = malloc(length / 8);
+
59 s = malloc(length / 8);
+
60 t = malloc(length / 8);
+
61 u = malloc(length / 8);
+
62 v = malloc(length / 8);
+
63 w = malloc(length / 8);
+
64
+
65 if(p == NULL || q == NULL || r == NULL || s == NULL || t == NULL || u == NULL || v == NULL || w == NULL)
+
66 {
+
67 free(p);
+
68 free(q);
+
69 free(r);
+
70 free(s);
+
71 free(t);
+
72 free(u);
+
73 free(v);
+
74 free(w);
+ +
76 }
+
77
+
78 for(i = 0; i < length; i += 8)
+
79 {
+
80 p[i / 8] = (uint8_t)(interleaved[i] & 0x80);
+
81 p[i / 8] += (interleaved[i + 1] & 0x80) >> 1;
+
82 p[i / 8] += (interleaved[i + 2] & 0x80) >> 2;
+
83 p[i / 8] += (interleaved[i + 3] & 0x80) >> 3;
+
84 p[i / 8] += (interleaved[i + 4] & 0x80) >> 4;
+
85 p[i / 8] += (interleaved[i + 5] & 0x80) >> 5;
+
86 p[i / 8] += (interleaved[i + 6] & 0x80) >> 6;
+
87 p[i / 8] += (interleaved[i + 7] & 0x80) >> 7;
+
88
+
89 q[i / 8] = (uint8_t)((interleaved[i] & 0x40) << 1);
+
90 q[i / 8] += interleaved[i + 1] & 0x40;
+
91 q[i / 8] += (interleaved[i + 2] & 0x40) >> 1;
+
92 q[i / 8] += (interleaved[i + 3] & 0x40) >> 2;
+
93 q[i / 8] += (interleaved[i + 4] & 0x40) >> 3;
+
94 q[i / 8] += (interleaved[i + 5] & 0x40) >> 4;
+
95 q[i / 8] += (interleaved[i + 6] & 0x40) >> 5;
+
96 q[i / 8] += (interleaved[i + 7] & 0x40) >> 6;
+
97
+
98 r[i / 8] = (uint8_t)((interleaved[i] & 0x20) << 2);
+
99 r[i / 8] += (interleaved[i + 1] & 0x20) << 1;
+
100 r[i / 8] += interleaved[i + 2] & 0x20;
+
101 r[i / 8] += (interleaved[i + 3] & 0x20) >> 1;
+
102 r[i / 8] += (interleaved[i + 4] & 0x20) >> 2;
+
103 r[i / 8] += (interleaved[i + 5] & 0x20) >> 3;
+
104 r[i / 8] += (interleaved[i + 6] & 0x20) >> 4;
+
105 r[i / 8] += (interleaved[i + 7] & 0x20) >> 5;
+
106
+
107 s[i / 8] = (uint8_t)((interleaved[i] & 0x10) << 3);
+
108 s[i / 8] += (interleaved[i + 1] & 0x10) << 2;
+
109 s[i / 8] += (interleaved[i + 2] & 0x10) << 1;
+
110 s[i / 8] += interleaved[i + 3] & 0x10;
+
111 s[i / 8] += (interleaved[i + 4] & 0x10) >> 1;
+
112 s[i / 8] += (interleaved[i + 5] & 0x10) >> 2;
+
113 s[i / 8] += (interleaved[i + 6] & 0x10) >> 3;
+
114 s[i / 8] += (interleaved[i + 7] & 0x10) >> 4;
+
115
+
116 t[i / 8] = (uint8_t)((interleaved[i] & 0x08) << 4);
+
117 t[i / 8] += (interleaved[i + 1] & 0x08) << 3;
+
118 t[i / 8] += (interleaved[i + 2] & 0x08) << 2;
+
119 t[i / 8] += (interleaved[i + 3] & 0x08) << 1;
+
120 t[i / 8] += interleaved[i + 4] & 0x08;
+
121 t[i / 8] += (interleaved[i + 5] & 0x08) >> 1;
+
122 t[i / 8] += (interleaved[i + 6] & 0x08) >> 2;
+
123 t[i / 8] += (interleaved[i + 7] & 0x08) >> 3;
+
124
+
125 u[i / 8] = (uint8_t)((interleaved[i] & 0x04) << 5);
+
126 u[i / 8] += (interleaved[i + 1] & 0x04) << 4;
+
127 u[i / 8] += (interleaved[i + 2] & 0x04) << 3;
+
128 u[i / 8] += (interleaved[i + 3] & 0x04) << 2;
+
129 u[i / 8] += (interleaved[i + 4] & 0x04) << 1;
+
130 u[i / 8] += interleaved[i + 5] & 0x04;
+
131 u[i / 8] += (interleaved[i + 6] & 0x04) >> 1;
+
132 u[i / 8] += (interleaved[i + 7] & 0x04) >> 2;
+
133
+
134 v[i / 8] = (uint8_t)((interleaved[i] & 0x02) << 6);
+
135 v[i / 8] += (interleaved[i + 1] & 0x02) << 5;
+
136 v[i / 8] += (interleaved[i + 2] & 0x02) << 4;
+
137 v[i / 8] += (interleaved[i + 3] & 0x02) << 3;
+
138 v[i / 8] += (interleaved[i + 4] & 0x02) << 2;
+
139 v[i / 8] += (interleaved[i + 5] & 0x02) << 1;
+
140 v[i / 8] += interleaved[i + 6] & 0x02;
+
141 v[i / 8] += (interleaved[i + 7] & 0x02) >> 1;
+
142
+
143 w[i / 8] = (uint8_t)((interleaved[i] & 0x01) << 7);
+
144 w[i / 8] += (interleaved[i + 1] & 0x01) << 6;
+
145 w[i / 8] += (interleaved[i + 2] & 0x01) << 5;
+
146 w[i / 8] += (interleaved[i + 3] & 0x01) << 4;
+
147 w[i / 8] += (interleaved[i + 4] & 0x01) << 3;
+
148 w[i / 8] += (interleaved[i + 5] & 0x01) << 2;
+
149 w[i / 8] += (interleaved[i + 6] & 0x01) << 1;
+
150 w[i / 8] += interleaved[i + 7] & 0x01;
+
151 }
+
152
+
153 q_start = length / 8 * 1;
+
154 r_start = length / 8 * 2;
+
155 s_start = length / 8 * 3;
+
156 t_start = length / 8 * 4;
+
157 u_start = length / 8 * 5;
+
158 v_start = length / 8 * 6;
+
159 w_start = length / 8 * 7;
+
160
+
161 for(i = 0; i < length / 8; i++)
+
162 {
+
163 sequential[i] = p[i];
+
164 sequential[q_start + i] = q[i];
+
165 sequential[r_start + i] = r[i];
+
166 sequential[s_start + i] = s[i];
+
167 sequential[t_start + i] = t[i];
+
168 sequential[u_start + i] = u[i];
+
169 sequential[v_start + i] = v[i];
+
170 sequential[w_start + i] = w[i];
+
171 }
+
172
+
173 free(p);
+
174 free(q);
+
175 free(r);
+
176 free(s);
+
177 free(t);
+
178 free(u);
+
179 free(v);
+
180 free(w);
+
181
+
182 return AARUF_STATUS_OK;
+
183}
+
+
184
+
+
193int32_t aaruf_cst_untransform(const uint8_t *sequential, uint8_t *interleaved, const size_t length)
+
194{
+
195 size_t i;
+
196
+
197 if(interleaved == NULL || sequential == NULL) return AARUF_ERROR_BUFFER_TOO_SMALL;
+
198
+
199 uint8_t *p = malloc(length / 8);
+
200 uint8_t *q = malloc(length / 8);
+
201 uint8_t *r = malloc(length / 8);
+
202 uint8_t *s = malloc(length / 8);
+
203 uint8_t *t = malloc(length / 8);
+
204 uint8_t *u = malloc(length / 8);
+
205 uint8_t *v = malloc(length / 8);
+
206 uint8_t *w = malloc(length / 8);
+
207
+
208 if(p == NULL || q == NULL || r == NULL || s == NULL || t == NULL || u == NULL || v == NULL || w == NULL)
+
209 {
+
210 free(p);
+
211 free(q);
+
212 free(r);
+
213 free(s);
+
214 free(t);
+
215 free(u);
+
216 free(v);
+
217 free(w);
+ +
219 }
+
220
+
221 size_t q_start = length / 8 * 1;
+
222 size_t r_start = length / 8 * 2;
+
223 size_t s_start = length / 8 * 3;
+
224 size_t t_start = length / 8 * 4;
+
225 size_t u_start = length / 8 * 5;
+
226 size_t v_start = length / 8 * 6;
+
227 size_t w_start = length / 8 * 7;
+
228
+
229 for(i = 0; i < length / 8; i++)
+
230 {
+
231 p[i] = sequential[i];
+
232 q[i] = sequential[q_start + i];
+
233 r[i] = sequential[r_start + i];
+
234 s[i] = sequential[s_start + i];
+
235 t[i] = sequential[t_start + i];
+
236 u[i] = sequential[u_start + i];
+
237 v[i] = sequential[v_start + i];
+
238 w[i] = sequential[w_start + i];
+
239 }
+
240
+
241 memset(interleaved, 0, length);
+
242
+
243 for(i = 0; i < length; i += 8)
+
244 {
+
245 interleaved[i] += (p[i / 8] & 0x80) == 0x80 ? 0x80 : 0;
+
246 interleaved[i + 1] += (p[i / 8] & 0x40) == 0x40 ? 0x80 : 0;
+
247 interleaved[i + 2] += (p[i / 8] & 0x20) == 0x20 ? 0x80 : 0;
+
248 interleaved[i + 3] += (p[i / 8] & 0x10) == 0x10 ? 0x80 : 0;
+
249 interleaved[i + 4] += (p[i / 8] & 0x08) == 0x08 ? 0x80 : 0;
+
250 interleaved[i + 5] += (p[i / 8] & 0x04) == 0x04 ? 0x80 : 0;
+
251 interleaved[i + 6] += (p[i / 8] & 0x02) == 0x02 ? 0x80 : 0;
+
252 interleaved[i + 7] += (p[i / 8] & 0x01) == 0x01 ? 0x80 : 0;
+
253
+
254 interleaved[i] += (q[i / 8] & 0x80) == 0x80 ? 0x40 : 0;
+
255 interleaved[i + 1] += (q[i / 8] & 0x40) == 0x40 ? 0x40 : 0;
+
256 interleaved[i + 2] += (q[i / 8] & 0x20) == 0x20 ? 0x40 : 0;
+
257 interleaved[i + 3] += (q[i / 8] & 0x10) == 0x10 ? 0x40 : 0;
+
258 interleaved[i + 4] += (q[i / 8] & 0x08) == 0x08 ? 0x40 : 0;
+
259 interleaved[i + 5] += (q[i / 8] & 0x04) == 0x04 ? 0x40 : 0;
+
260 interleaved[i + 6] += (q[i / 8] & 0x02) == 0x02 ? 0x40 : 0;
+
261 interleaved[i + 7] += (q[i / 8] & 0x01) == 0x01 ? 0x40 : 0;
+
262
+
263 interleaved[i] += (r[i / 8] & 0x80) == 0x80 ? 0x20 : 0;
+
264 interleaved[i + 1] += (r[i / 8] & 0x40) == 0x40 ? 0x20 : 0;
+
265 interleaved[i + 2] += (r[i / 8] & 0x20) == 0x20 ? 0x20 : 0;
+
266 interleaved[i + 3] += (r[i / 8] & 0x10) == 0x10 ? 0x20 : 0;
+
267 interleaved[i + 4] += (r[i / 8] & 0x08) == 0x08 ? 0x20 : 0;
+
268 interleaved[i + 5] += (r[i / 8] & 0x04) == 0x04 ? 0x20 : 0;
+
269 interleaved[i + 6] += (r[i / 8] & 0x02) == 0x02 ? 0x20 : 0;
+
270 interleaved[i + 7] += (r[i / 8] & 0x01) == 0x01 ? 0x20 : 0;
+
271
+
272 interleaved[i] += (s[i / 8] & 0x80) == 0x80 ? 0x10 : 0;
+
273 interleaved[i + 1] += (s[i / 8] & 0x40) == 0x40 ? 0x10 : 0;
+
274 interleaved[i + 2] += (s[i / 8] & 0x20) == 0x20 ? 0x10 : 0;
+
275 interleaved[i + 3] += (s[i / 8] & 0x10) == 0x10 ? 0x10 : 0;
+
276 interleaved[i + 4] += (s[i / 8] & 0x08) == 0x08 ? 0x10 : 0;
+
277 interleaved[i + 5] += (s[i / 8] & 0x04) == 0x04 ? 0x10 : 0;
+
278 interleaved[i + 6] += (s[i / 8] & 0x02) == 0x02 ? 0x10 : 0;
+
279 interleaved[i + 7] += (s[i / 8] & 0x01) == 0x01 ? 0x10 : 0;
+
280
+
281 interleaved[i] += (t[i / 8] & 0x80) == 0x80 ? 0x08 : 0;
+
282 interleaved[i + 1] += (t[i / 8] & 0x40) == 0x40 ? 0x08 : 0;
+
283 interleaved[i + 2] += (t[i / 8] & 0x20) == 0x20 ? 0x08 : 0;
+
284 interleaved[i + 3] += (t[i / 8] & 0x10) == 0x10 ? 0x08 : 0;
+
285 interleaved[i + 4] += (t[i / 8] & 0x08) == 0x08 ? 0x08 : 0;
+
286 interleaved[i + 5] += (t[i / 8] & 0x04) == 0x04 ? 0x08 : 0;
+
287 interleaved[i + 6] += (t[i / 8] & 0x02) == 0x02 ? 0x08 : 0;
+
288 interleaved[i + 7] += (t[i / 8] & 0x01) == 0x01 ? 0x08 : 0;
+
289
+
290 interleaved[i] += (u[i / 8] & 0x80) == 0x80 ? 0x04 : 0;
+
291 interleaved[i + 1] += (u[i / 8] & 0x40) == 0x40 ? 0x04 : 0;
+
292 interleaved[i + 2] += (u[i / 8] & 0x20) == 0x20 ? 0x04 : 0;
+
293 interleaved[i + 3] += (u[i / 8] & 0x10) == 0x10 ? 0x04 : 0;
+
294 interleaved[i + 4] += (u[i / 8] & 0x08) == 0x08 ? 0x04 : 0;
+
295 interleaved[i + 5] += (u[i / 8] & 0x04) == 0x04 ? 0x04 : 0;
+
296 interleaved[i + 6] += (u[i / 8] & 0x02) == 0x02 ? 0x04 : 0;
+
297 interleaved[i + 7] += (u[i / 8] & 0x01) == 0x01 ? 0x04 : 0;
+
298
+
299 interleaved[i] += (v[i / 8] & 0x80) == 0x80 ? 0x02 : 0;
+
300 interleaved[i + 1] += (v[i / 8] & 0x40) == 0x40 ? 0x02 : 0;
+
301 interleaved[i + 2] += (v[i / 8] & 0x20) == 0x20 ? 0x02 : 0;
+
302 interleaved[i + 3] += (v[i / 8] & 0x10) == 0x10 ? 0x02 : 0;
+
303 interleaved[i + 4] += (v[i / 8] & 0x08) == 0x08 ? 0x02 : 0;
+
304 interleaved[i + 5] += (v[i / 8] & 0x04) == 0x04 ? 0x02 : 0;
+
305 interleaved[i + 6] += (v[i / 8] & 0x02) == 0x02 ? 0x02 : 0;
+
306 interleaved[i + 7] += (v[i / 8] & 0x01) == 0x01 ? 0x02 : 0;
+
307
+
308 interleaved[i] += (w[i / 8] & 0x80) == 0x80 ? 0x01 : 0;
+
309 interleaved[i + 1] += (w[i / 8] & 0x40) == 0x40 ? 0x01 : 0;
+
310 interleaved[i + 2] += (w[i / 8] & 0x20) == 0x20 ? 0x01 : 0;
+
311 interleaved[i + 3] += (w[i / 8] & 0x10) == 0x10 ? 0x01 : 0;
+
312 interleaved[i + 4] += (w[i / 8] & 0x08) == 0x08 ? 0x01 : 0;
+
313 interleaved[i + 5] += (w[i / 8] & 0x04) == 0x04 ? 0x01 : 0;
+
314 interleaved[i + 6] += (w[i / 8] & 0x02) == 0x02 ? 0x01 : 0;
+
315 interleaved[i + 7] += (w[i / 8] & 0x01) == 0x01 ? 0x01 : 0;
+
316 }
+
317
+
318 free(p);
+
319 free(q);
+
320 free(r);
+
321 free(s);
+
322 free(t);
+
323 free(u);
+
324 free(v);
+
325 free(w);
+
326
+
327 return AARUF_STATUS_OK;
+
328}
+
+ +
int32_t aaruf_cst_untransform(const uint8_t *sequential, uint8_t *interleaved, const size_t length)
Reverses the CST (Claunia's Subchannel Transform) transformation from sequential to interleaved data.
Definition cst.c:193
+
int32_t aaruf_cst_transform(const uint8_t *interleaved, uint8_t *sequential, const size_t length)
Transforms interleaved subchannel data to sequential format.
Definition cst.c:35
+
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
Definition errors.h:75
+
#define AARUF_ERROR_NOT_ENOUGH_MEMORY
Memory allocation failure (critical).
Definition errors.h:48
+
#define AARUF_ERROR_BUFFER_TOO_SMALL
Caller-supplied buffer insufficient for data.
Definition errors.h:49
+
+
+
+ + + + diff --git a/docs/html/data_8c.html b/docs/html/data_8c.html new file mode 100644 index 0000000..7c74bf5 --- /dev/null +++ b/docs/html/data_8c.html @@ -0,0 +1,199 @@ + + + + + + + +libaaruformat: src/blocks/data.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
data.c File Reference
+
+
+
#include <inttypes.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "aaruformat.h"
+#include "log.h"
+#include "uthash.h"
+
+

Go to the source code of this file.

+ + + + +

+Functions

int32_t process_data_block (aaruformat_context *ctx, IndexEntry *entry)
 Processes a data block from the image stream.
+

Function Documentation

+ +

◆ process_data_block()

+ +
+
+ + + + + + + + + + + +
int32_t process_data_block (aaruformat_context * ctx,
IndexEntry * entry )
+
+ +

Processes a data block from the image stream.

+

Reads a data block from the image, decompresses if needed, and updates the context with its contents. This function handles various types of data blocks including compressed (LZMA) and uncompressed data, performs CRC validation, and stores the processed data in the appropriate context fields.

+
Parameters
+ + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the data block.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully processed the data block. This is returned when:
    +
  • The block is processed successfully and all validations pass
  • +
  • A NoData block type is encountered (these are skipped)
  • +
  • A UserData block type is encountered (these update sector size but are otherwise skipped)
  • +
  • Block validation fails but processing continues (non-fatal errors like CRC mismatches)
  • +
  • Memory allocation failures occur (processing continues with other blocks)
  • +
  • Block reading failures occur (processing continues with other blocks)
  • +
  • Unknown compression types are encountered (block is skipped)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers).
AARUF_ERROR_CANNOT_READ_BLOCK(-7) Failed to seek to the block position in the image stream. This occurs when fseek() fails or the file position doesn't match the expected offset.
AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK(-17) LZMA decompression failed. This can happen when:
    +
  • The LZMA decoder returns an error code
  • +
  • The decompressed data size doesn't match the expected block length
  • +
+
+
+
+
Note
Most validation and reading errors are treated as non-fatal and result in AARUF_STATUS_OK being returned while the problematic block is skipped. This allows processing to continue with other blocks in the image.
+
+The function performs the following validations:
    +
  • Block identifier matches the expected block type
  • +
  • Block data type matches the expected data type
  • +
  • CRC64 checksum validation (with version-specific byte order handling)
  • +
  • Proper decompression for LZMA-compressed blocks
  • +
+
+
Warning
Memory allocated for block data is stored in the context and should be freed when the context is destroyed. The function may replace existing data in the context.
+ +

Definition at line 71 of file data.c.

+ +

References aaruf_crc64_data(), aaruf_cst_untransform(), AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, aaruf_get_media_tag_type_for_datatype(), aaruf_lzma_decode_buffer(), AARUF_STATUS_OK, AARUF_VERSION_V1, AppleProfileTag, AppleSectorTag, AppleSonyTag, IndexEntry::blockType, bswap_64, CdSectorEcc, CdSectorEccP, CdSectorEccQ, CdSectorEdc, CdSectorHeader, CdSectorPrefix, CdSectorPrefixCorrected, CdSectorSubchannel, CdSectorSubHeader, CdSectorSuffix, CdSectorSuffixCorrected, CdSectorSync, BlockHeader::cmpLength, CompactDiscMode2Subheader, BlockHeader::compression, BlockHeader::crc64, mediaTagEntry::data, IndexEntry::dataType, DvdCmi, DvdSectorCprMai, DvdSectorEdc, DvdSectorEdcAaru, DvdSectorId, DvdSectorIed, DvdSectorIedAaru, DvdSectorInformation, DvdSectorNumber, DvdSectorTitleKeyDecrypted, DvdTitleKeyDecrypted, FATAL, aaruformat_context::header, BlockHeader::identifier, aaruformat_context::image_info, AaruHeaderV2::imageMajorVersion, ImageInfo::ImageSize, aaruformat_context::imageStream, BlockHeader::length, mediaTagEntry::length, Lzma, LZMA_PROPERTIES_LENGTH, LzmaClauniaSubchannelTransform, aaruformat_context::mediaTags, aaruformat_context::mode2_subheaders, NoData, None, IndexEntry::offset, PriamDataTowerTag, aaruformat_context::readableSectorTags, aaruformat_context::sector_cpr_mai, aaruformat_context::sector_decrypted_title_key, aaruformat_context::sector_edc, aaruformat_context::sector_id, aaruformat_context::sector_ied, aaruformat_context::sector_prefix, aaruformat_context::sector_prefix_corrected, aaruformat_context::sector_subchannel, aaruformat_context::sector_suffix, aaruformat_context::sector_suffix_corrected, ImageInfo::SectorSize, BlockHeader::sectorSize, TRACE, BlockHeader::type, mediaTagEntry::type, and UserData.

+ +

Referenced by aaruf_open().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/data_8c.js b/docs/html/data_8c.js new file mode 100644 index 0000000..75a87cd --- /dev/null +++ b/docs/html/data_8c.js @@ -0,0 +1,4 @@ +var data_8c = +[ + [ "process_data_block", "data_8c.html#a28d844a06cecbbf436d825a3c99ff0eb", null ] +]; \ No newline at end of file diff --git a/docs/html/data_8c_source.html b/docs/html/data_8c_source.html new file mode 100644 index 0000000..ef8c562 --- /dev/null +++ b/docs/html/data_8c_source.html @@ -0,0 +1,579 @@ + + + + + + + +libaaruformat: src/blocks/data.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
data.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <inttypes.h>
+
20#include <stdint.h>
+
21#include <stdio.h>
+
22#include <stdlib.h>
+
23
+
24#include "aaruformat.h"
+
25#include "log.h"
+
26#include "uthash.h"
+
27
+
70
+
+ +
72{
+
73 TRACE("Entering process_data_block(%p, %p)", ctx, entry);
+
74 BlockHeader block_header;
+
75 int pos = 0;
+
76 size_t read_bytes = 0;
+
77 size_t lzma_size = 0;
+
78 uint8_t *cmp_data = NULL;
+
79 uint8_t *cst_data = NULL;
+
80 mediaTagEntry *old_media_tag = NULL;
+
81 mediaTagEntry *media_tag = NULL;
+
82 uint8_t *data = NULL;
+
83 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH];
+
84
+
85 // Check if the context, index entry, and image stream are valid
+
86 if(ctx == NULL || entry == NULL || ctx->imageStream == NULL)
+
87 {
+
88 FATAL("Invalid context or image stream.");
+ +
90 }
+
91
+
92 // Seek to block
+
93 pos = fseek(ctx->imageStream, entry->offset, SEEK_SET);
+
94 if(pos < 0 || ftell(ctx->imageStream) != entry->offset)
+
95 {
+
96 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
+
97
+ +
99 }
+
100
+
101 // Even if those two checks shall have been done before
+
102
+
103 // NOP block, skip
+
104 if(entry->dataType == NoData)
+
105 {
+
106 TRACE("NoData block found, skipping");
+
107 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
108 return AARUF_STATUS_OK;
+
109 }
+
110
+
111 TRACE("Reading block header at position %" PRIu64, entry->offset);
+
112 read_bytes = fread(&block_header, 1, sizeof(BlockHeader), ctx->imageStream);
+
113
+
114 if(read_bytes != sizeof(BlockHeader))
+
115 {
+
116 FATAL("Could not read block header at %" PRIu64, entry->offset);
+
117
+
118 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
119 return AARUF_STATUS_OK;
+
120 }
+
121
+
122 ctx->image_info.ImageSize += block_header.cmpLength;
+
123
+
124 // Unused, skip
+
125 if(entry->dataType == UserData)
+
126 {
+
127 if(block_header.sectorSize > ctx->image_info.SectorSize)
+
128 {
+
129 TRACE("Setting sector size to %" PRIu64 " bytes", block_header.sectorSize);
+
130 ctx->image_info.SectorSize = block_header.sectorSize;
+
131 }
+
132
+
133 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
134 return AARUF_STATUS_OK;
+
135 }
+
136
+
137 if(block_header.identifier != entry->blockType)
+
138 {
+
139 TRACE("Incorrect identifier for data block at position %" PRIu64, entry->offset);
+
140
+
141 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
142 return AARUF_STATUS_OK;
+
143 }
+
144
+
145 if(block_header.type != entry->dataType)
+
146 {
+
147 TRACE("Expected block with data type %4.4s at position %" PRIu64 " but found data type %4.4s",
+
148 (char *)&entry->blockType, entry->offset, (char *)&block_header.type);
+
149
+
150 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
151 return AARUF_STATUS_OK;
+
152 }
+
153
+
154 TRACE("Found data block with type %4.4s at position %" PRIu64, (char *)&entry->blockType, entry->offset);
+
155
+
156 if(block_header.compression == Lzma || block_header.compression == LzmaClauniaSubchannelTransform)
+
157 {
+
158 int error_no = 0;
+
159 if(block_header.compression == LzmaClauniaSubchannelTransform && block_header.type != CdSectorSubchannel)
+
160 {
+
161 TRACE("Invalid compression type %u for block with data type %u, continuing...", block_header.compression,
+
162 block_header.type);
+
163
+
164 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
165 return AARUF_STATUS_OK;
+
166 }
+
167
+
168 if(block_header.cmpLength < LZMA_PROPERTIES_LENGTH)
+
169 {
+
170 TRACE("Compressed block length %" PRIu32 " too small for LZMA properties, continuing...",
+
171 block_header.cmpLength);
+
172 TRACE("Exiting process_data_block() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
174 }
+
175
+
176 lzma_size = block_header.cmpLength - LZMA_PROPERTIES_LENGTH;
+
177
+
178 cmp_data = (lzma_size == 0) ? NULL : (uint8_t *)malloc(lzma_size);
+
179 if(lzma_size != 0 && cmp_data == NULL)
+
180 {
+
181 TRACE("Cannot allocate memory for block, continuing...");
+
182
+
183 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
184 return AARUF_STATUS_OK;
+
185 }
+
186
+
187 if(block_header.length != 0)
+
188 {
+
189 data = (uint8_t *)malloc(block_header.length);
+
190 if(data == NULL)
+
191 {
+
192 TRACE("Cannot allocate memory for block, continuing...");
+
193 free(cmp_data);
+
194
+
195 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
196 return AARUF_STATUS_OK;
+
197 }
+
198 }
+
199 else
+
200 data = NULL;
+
201
+
202 read_bytes = fread(lzma_properties, 1, LZMA_PROPERTIES_LENGTH, ctx->imageStream);
+
203 if(read_bytes != LZMA_PROPERTIES_LENGTH)
+
204 {
+
205 TRACE("Could not read LZMA properties, continuing...");
+
206 free(cmp_data);
+
207 free(data);
+
208
+
209 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
210 return AARUF_STATUS_OK;
+
211 }
+
212
+
213 if(lzma_size != 0)
+
214 {
+
215 read_bytes = fread(cmp_data, 1, lzma_size, ctx->imageStream);
+
216 if(read_bytes != lzma_size)
+
217 {
+
218 TRACE("Could not read compressed block, continuing...");
+
219 free(cmp_data);
+
220 free(data);
+
221
+
222 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
223 return AARUF_STATUS_OK;
+
224 }
+
225 }
+
226
+
227 if(block_header.length != 0)
+
228 {
+
229 read_bytes = block_header.length;
+
230 error_no = aaruf_lzma_decode_buffer(data, &read_bytes, cmp_data, &lzma_size, lzma_properties,
+ +
232
+
233 if(error_no != 0)
+
234 {
+
235 TRACE("Got error %d from LZMA, continuing...", error_no);
+
236 free(cmp_data);
+
237 free(data);
+
238
+
239 TRACE("Exiting process_data_block() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
241 }
+
242
+
243 if(read_bytes != block_header.length)
+
244 {
+
245 TRACE("Error decompressing block, expected %" PRIu32 " bytes but got %zu bytes, continuing...",
+
246 block_header.length, read_bytes);
+
247 free(cmp_data);
+
248 free(data);
+
249
+
250 TRACE("Exiting process_data_block() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
252 }
+
253 }
+
254 else if(lzma_size != 0)
+
255 {
+
256 TRACE("Compressed payload present for zero-length block, continuing...");
+
257 free(cmp_data);
+
258
+
259 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
260 return AARUF_STATUS_OK;
+
261 }
+
262
+
263 if(block_header.compression == LzmaClauniaSubchannelTransform && block_header.length != 0)
+
264 {
+
265 cst_data = (uint8_t *)malloc(block_header.length);
+
266 if(cst_data == NULL)
+
267 {
+
268 TRACE("Cannot allocate memory for block, continuing...");
+
269 free(cmp_data);
+
270 free(data);
+
271
+
272 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
273 return AARUF_STATUS_OK;
+
274 }
+
275
+
276 aaruf_cst_untransform(data, cst_data, block_header.length);
+
277 free(data);
+
278 data = cst_data;
+
279 cst_data = NULL;
+
280 }
+
281
+
282 free(cmp_data);
+
283 }
+
284 else if(block_header.compression == None)
+
285 {
+
286 if(block_header.length != 0)
+
287 {
+
288 data = (uint8_t *)malloc(block_header.length);
+
289 if(data == NULL)
+
290 {
+
291 TRACE("Cannot allocate memory for block, continuing...");
+
292
+
293 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
294 return AARUF_STATUS_OK;
+
295 }
+
296 }
+
297 else
+
298 data = NULL;
+
299
+
300 read_bytes = (block_header.length == 0) ? 0 : fread(data, 1, block_header.length, ctx->imageStream);
+
301
+
302 if(block_header.length != 0 && read_bytes != block_header.length)
+
303 {
+
304 free(data);
+
305 TRACE("Could not read block, continuing...");
+
306
+
307 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
308 return AARUF_STATUS_OK;
+
309 }
+
310 }
+
311 else
+
312 {
+
313 TRACE("Found unknown compression type %d, continuing...", block_header.compression);
+
314
+
315 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
316 return AARUF_STATUS_OK;
+
317 }
+
318
+
319 if(block_header.length > 0)
+
320 {
+
321 uint64_t crc64 = aaruf_crc64_data(data, block_header.length);
+
322
+
323 // Due to how C# wrote it, it is effectively reversed
+
324 if(ctx->header.imageMajorVersion <= AARUF_VERSION_V1) crc64 = bswap_64(crc64);
+
325
+
326 if(crc64 != block_header.crc64)
+
327 {
+
328 TRACE("Incorrect CRC found: 0x%" PRIx64 " found, expected 0x%" PRIx64 ", continuing...", crc64,
+
329 block_header.crc64);
+
330 free(data);
+
331
+
332 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
333 return AARUF_STATUS_OK;
+
334 }
+
335 }
+
336
+
337 // Check if it's not a media tag, but a sector tag, and fill the appropriate table then
+
338 switch(entry->dataType)
+
339 {
+
340 case CdSectorPrefix:
+ +
342 if(entry->dataType == CdSectorPrefixCorrected) { ctx->sector_prefix_corrected = data; }
+
343 else
+
344 ctx->sector_prefix = data;
+
345
+
346 ctx->readableSectorTags[CdSectorSync] = true;
+ +
348
+
349 break;
+
350 case CdSectorSuffix:
+ + +
353 ctx->sector_suffix_corrected = data;
+
354 else
+
355 ctx->sector_suffix = data;
+
356
+ +
358 ctx->readableSectorTags[CdSectorEcc] = true;
+
359 ctx->readableSectorTags[CdSectorEccP] = true;
+
360 ctx->readableSectorTags[CdSectorEccQ] = true;
+
361 ctx->readableSectorTags[CdSectorEdc] = true;
+
362 break;
+ +
364 ctx->sector_subchannel = data;
+ +
366 break;
+
367 case AppleProfileTag:
+
368 case AppleSonyTag:
+ +
370 ctx->sector_subchannel = data;
+ +
372 break;
+ +
374 ctx->mode2_subheaders = data;
+
375 break;
+
376 case DvdSectorId:
+
377 ctx->sector_id = data;
+ + +
380 break;
+
381 case DvdSectorIed:
+
382 ctx->sector_ied = data;
+ +
384 break;
+
385 case DvdSectorCprMai:
+
386 ctx->sector_cpr_mai = data;
+
387 ctx->readableSectorTags[DvdCmi] = true;
+
388 break;
+
389 case DvdSectorEdc:
+
390 ctx->sector_edc = data;
+ +
392 break;
+ +
394 ctx->sector_decrypted_title_key = data;
+ +
396 break;
+
397 default:
+
398 media_tag = (mediaTagEntry *)malloc(sizeof(mediaTagEntry));
+
399
+
400 if(media_tag == NULL)
+
401 {
+
402 TRACE("Cannot allocate memory for media tag entry.");
+
403 free(data);
+
404 data = NULL;
+
405 break;
+
406 }
+
407 memset(media_tag, 0, sizeof(mediaTagEntry));
+
408
+
409 media_tag->type = aaruf_get_media_tag_type_for_datatype(block_header.type);
+
410 media_tag->data = data;
+
411 media_tag->length = block_header.length;
+
412
+
413 HASH_REPLACE_INT(ctx->mediaTags, type, media_tag, old_media_tag);
+
414
+
415 if(old_media_tag != NULL)
+
416 {
+
417 TRACE("Replaced media tag with type %d", old_media_tag->type);
+
418 free(old_media_tag->data);
+
419 free(old_media_tag);
+
420 old_media_tag = NULL;
+
421 }
+
422
+
423 break;
+
424 }
+
425
+
426 TRACE("Exiting process_data_block() = AARUF_STATUS_OK");
+
427 return AARUF_STATUS_OK;
+
428}
+
+ +
#define LZMA_PROPERTIES_LENGTH
Size in bytes of the fixed LZMA properties header (lc/lp/pb + dictionary size).
Definition consts.h:82
+
#define AARUF_VERSION_V1
First on‑disk version (C# implementation).
Definition consts.h:71
+
int32_t process_data_block(aaruformat_context *ctx, IndexEntry *entry)
Processes a data block from the image stream.
Definition data.c:71
+
uint64_t aaruf_crc64_data(const uint8_t *data, uint32_t len)
Definition crc64.c:160
+
int32_t aaruf_lzma_decode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, size_t *src_size, const uint8_t *props, size_t props_size)
Decodes an LZMA-compressed buffer.
Definition lzma.c:39
+
int32_t aaruf_get_media_tag_type_for_datatype(int32_t type)
Converts an image data type to an Aaru media tag type.
Definition helpers.c:31
+
int32_t aaruf_cst_untransform(const uint8_t *sequential, uint8_t *interleaved, size_t length)
Reverses the CST (Claunia's Subchannel Transform) transformation from sequential to interleaved data.
Definition cst.c:193
+
#define bswap_64(x)
Definition endian.h:81
+
@ CdSectorSubchannel
Compact Disc subchannel data.
Definition enums.h:116
+
@ AppleProfileTag
Apple Profile (20‑byte) tag.
Definition enums.h:117
+
@ DvdSectorIed
DVD ID Error Detection Code (IED)
Definition enums.h:129
+
@ CdSectorPrefixCorrected
Compact Disc sector prefix (sync, header) corrected-only stored.
Definition enums.h:121
+
@ DvdSectorCprMai
DVD Copyright Management Information (CPR_MAI)
Definition enums.h:126
+
@ AppleSonyTag
Apple Sony (12‑byte) tag.
Definition enums.h:118
+
@ CdSectorPrefix
Compact Disc sector prefix (sync, header).
Definition enums.h:114
+
@ CdSectorSuffixCorrected
Compact Disc sector suffix (EDC, ECC P, ECC Q) corrected-only stored.
Definition enums.h:122
+
@ PriamDataTowerTag
Priam Data Tower (24‑byte) tag.
Definition enums.h:119
+
@ UserData
User (main) data.
Definition enums.h:46
+
@ NoData
No data.
Definition enums.h:45
+
@ DvdSectorEdc
DVD Error Detection Code (EDC)
Definition enums.h:130
+
@ DvdSectorTitleKeyDecrypted
Decrypted DVD Title Key.
Definition enums.h:127
+
@ DvdSectorId
DVD Identification Data (ID)
Definition enums.h:128
+
@ CdSectorSuffix
Compact Disc sector suffix (EDC, ECC P, ECC Q).
Definition enums.h:115
+
@ CompactDiscMode2Subheader
Compact Disc MODE 2 subheader.
Definition enums.h:123
+
@ Lzma
LZMA compression.
Definition enums.h:34
+
@ LzmaClauniaSubchannelTransform
LZMA applied to Claunia Subchannel Transform processed data.
Definition enums.h:36
+
@ None
Not compressed.
Definition enums.h:33
+
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
Definition errors.h:75
+
#define AARUF_ERROR_CANNOT_READ_BLOCK
Generic block read failure (seek/read error).
Definition errors.h:46
+
#define AARUF_ERROR_NOT_AARUFORMAT
Input file/stream failed magic or structural validation.
Definition errors.h:40
+
#define AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK
Decompression routine failed or size mismatch.
Definition errors.h:56
+
@ DvdSectorIedAaru
DVD sector ID error detection, 2 bytes.
Definition aaru.h:914
+
@ CdSectorHeader
4-byte CD header (minute, second, frame, mode)
Definition aaru.h:898
+
@ CdSectorEdc
32-bit CRC (EDC)
Definition aaru.h:900
+
@ CdSectorEccP
172 bytes Reed-Solomon ECC (P)
Definition aaru.h:901
+
@ DvdSectorEdcAaru
DVD sector EDC, 4 bytes.
Definition aaru.h:915
+
@ DvdCmi
DVD Copyright Management Information (CSS)
Definition aaru.h:908
+
@ CdSectorSubHeader
Mode 2 Form subheader (8 bytes: copy, submode, channel)
Definition aaru.h:899
+
@ DvdSectorNumber
DVD sector number, 3 bytes.
Definition aaru.h:913
+
@ DvdSectorInformation
DVD sector information, 1 bytes.
Definition aaru.h:912
+
@ AppleSectorTag
Apple's GCR sector tags, 12 bytes (address prolog + checksum)
Definition aaru.h:896
+
@ CdSectorEcc
Combined P+Q ECC (276 bytes)
Definition aaru.h:903
+
@ DvdTitleKeyDecrypted
Decrypted DVD sector title key, 5 bytes.
Definition aaru.h:911
+
@ CdSectorSync
12-byte CD sync pattern (00 FF*10 00)
Definition aaru.h:897
+
@ CdSectorEccQ
104 bytes Reed-Solomon ECC (Q)
Definition aaru.h:902
+ +
#define FATAL(fmt,...)
Definition log.h:40
+
#define TRACE(fmt,...)
Definition log.h:25
+
uint8_t imageMajorVersion
Container format major version.
Definition header.h:110
+
Header preceding the compressed data payload of a data block (BlockType::DataBlock).
Definition data.h:71
+
uint32_t cmpLength
Size in bytes of the compressed payload immediately following this header.
Definition data.h:76
+
uint32_t length
Size in bytes of the uncompressed payload resulting after decompression.
Definition data.h:77
+
uint32_t identifier
Block identifier, must be BlockType::DataBlock.
Definition data.h:72
+
uint32_t sectorSize
Size in bytes of each logical sector represented in this block.
Definition data.h:75
+
uint64_t crc64
CRC64-ECMA of the uncompressed payload (length bytes).
Definition data.h:79
+
uint16_t type
Logical data classification (value from DataType).
Definition data.h:73
+
uint16_t compression
Compression algorithm used (value from CompressionType).
Definition data.h:74
+
uint32_t SectorSize
Size of each logical sector in bytes (512, 2048, 2352, 4096, etc.)
Definition aaru.h:875
+
uint64_t ImageSize
Size of the image payload in bytes (excludes headers/metadata)
Definition aaru.h:873
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
uint32_t blockType
Block identifier of the referenced block (value from BlockType).
Definition index.h:110
+
uint64_t offset
Absolute byte offset in the image where the referenced block header begins.
Definition index.h:112
+
uint16_t dataType
Data classification (value from DataType) or unused for untyped blocks.
Definition index.h:111
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
uint8_t * sector_cpr_mai
DVD sector CPR_MAI (6 bytes) if present.
Definition context.h:207
+
uint8_t * sector_prefix_corrected
Corrected variant (post error correction) if stored.
Definition context.h:200
+
uint8_t * sector_ied
DVD sector IED (2 bytes) if present.
Definition context.h:206
+
uint8_t * sector_prefix
Raw per-sector prefix (e.g., sync+header) uncorrected.
Definition context.h:199
+
uint8_t * sector_edc
DVD sector EDC (4 bytes) if present.
Definition context.h:208
+
uint8_t * sector_suffix
Raw per-sector suffix (EDC/ECC) uncorrected.
Definition context.h:201
+
AaruHeaderV2 header
Parsed container header (v2).
Definition context.h:175
+
mediaTagEntry * mediaTags
Hash table of extra media tags (uthash root).
Definition context.h:264
+
uint8_t * sector_decrypted_title_key
DVD decrypted title key (5 bytes) if present.
Definition context.h:209
+
uint8_t * sector_subchannel
Raw 96-byte subchannel (if captured).
Definition context.h:203
+
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
+
uint8_t * mode2_subheaders
MODE2 Form1/Form2 8-byte subheaders (concatenated).
Definition context.h:204
+
ImageInfo image_info
Exposed high-level image info summary.
Definition context.h:260
+
uint8_t * sector_id
DVD sector ID (4 bytes) if present.
Definition context.h:205
+
bool * readableSectorTags
Per-sector boolean array (optical tags read successfully?).
Definition context.h:263
+
uint8_t * sector_suffix_corrected
Corrected suffix if stored separately.
Definition context.h:202
+
Hash table entry for an arbitrary media tag (e.g., proprietary drive/medium descriptor).
Definition context.h:119
+
uint8_t * data
Tag data blob (opaque to library core); length bytes long.
Definition context.h:120
+
int32_t type
Numeric type identifier.
Definition context.h:121
+
uint32_t length
Length in bytes of data.
Definition context.h:122
+
+
+
+ + + + diff --git a/docs/html/data_8h.html b/docs/html/data_8h.html new file mode 100644 index 0000000..56ed32a --- /dev/null +++ b/docs/html/data_8h.html @@ -0,0 +1,179 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/data.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
data.h File Reference
+
+
+ +

On-disk layout structures for data-bearing and geometry blocks. +More...

+
#include <stdint.h>
+
+

Go to the source code of this file.

+ + + + + + +

+Data Structures

struct  BlockHeader
 Header preceding the compressed data payload of a data block (BlockType::DataBlock). More...
struct  GeometryBlockHeader
 Legacy CHS style logical geometry metadata (BlockType::GeometryBlock). More...
+ + + +

+Typedefs

typedef struct BlockHeader BlockHeader
typedef struct GeometryBlockHeader GeometryBlockHeader
+

Detailed Description

+

On-disk layout structures for data-bearing and geometry blocks.

+

These packed structures describe the headers that precede variable-length payloads inside blocks whose identifiers are enumerated in BlockType. All integer fields are stored little-endian on disk. The library currently assumes a little-endian host; if ported to a big-endian architecture explicit byte swapping will be required.

+

Layout of a data block (BlockType::DataBlock): BlockHeader (sizeof(BlockHeader) bytes) Compressed payload (cmpLength bytes)

+

Payload decoding:

+

Geometry block (BlockType::GeometryBlock) has a GeometryBlockHeader followed by no additional fixed payload in the current format version; it conveys legacy CHS-style logical geometry metadata.

+
Warning
These structs are packed; do not take their address and assume natural alignment.
+
See also
BlockType
+
+DataType
+
+CompressionType
+ +

Definition in file data.h.

+

Typedef Documentation

+ +

◆ BlockHeader

+ +
+
+ + + + +
typedef struct BlockHeader BlockHeader
+
+ +
+
+ +

◆ GeometryBlockHeader

+ +
+
+ + + + +
typedef struct GeometryBlockHeader GeometryBlockHeader
+
+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/data_8h.js b/docs/html/data_8h.js new file mode 100644 index 0000000..fde32ac --- /dev/null +++ b/docs/html/data_8h.js @@ -0,0 +1,7 @@ +var data_8h = +[ + [ "BlockHeader", "structBlockHeader.html", "structBlockHeader" ], + [ "GeometryBlockHeader", "structGeometryBlockHeader.html", "structGeometryBlockHeader" ], + [ "BlockHeader", "data_8h.html#a1ca609714b5efe0b8571c14c51fd4609", null ], + [ "GeometryBlockHeader", "data_8h.html#ac4dce55b0edbc0bfdef3fcc84c63a78d", null ] +]; \ No newline at end of file diff --git a/docs/html/data_8h_source.html b/docs/html/data_8h_source.html new file mode 100644 index 0000000..60f0b14 --- /dev/null +++ b/docs/html/data_8h_source.html @@ -0,0 +1,173 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/data.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
data.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_DATA_H
+
20#define LIBAARUFORMAT_DATA_H
+
21
+
22#include <stdint.h> // Fixed width integer types used in on-disk packed structs.
+
23
+
24#pragma pack(push, 1)
+
25
+
54
+
+
70typedef struct BlockHeader
+
71{
+
72 uint32_t identifier;
+
73 uint16_t type;
+
74 uint16_t compression;
+
75 uint32_t sectorSize;
+
76 uint32_t cmpLength;
+
77 uint32_t length;
+
78 uint64_t cmpCrc64;
+
79 uint64_t crc64;
+ +
+
81
+
+
90typedef struct GeometryBlockHeader
+
91{
+
92 uint32_t identifier;
+
93 uint32_t cylinders;
+
94 uint32_t heads;
+
95 uint32_t sectorsPerTrack;
+ +
+
97
+
98#pragma pack(pop)
+
99
+
100#endif // LIBAARUFORMAT_DATA_H
+
Header preceding the compressed data payload of a data block (BlockType::DataBlock).
Definition data.h:71
+
uint32_t cmpLength
Size in bytes of the compressed payload immediately following this header.
Definition data.h:76
+
uint32_t length
Size in bytes of the uncompressed payload resulting after decompression.
Definition data.h:77
+
uint32_t identifier
Block identifier, must be BlockType::DataBlock.
Definition data.h:72
+
uint32_t sectorSize
Size in bytes of each logical sector represented in this block.
Definition data.h:75
+
uint64_t cmpCrc64
CRC64-ECMA of the compressed payload (cmpLength bytes).
Definition data.h:78
+
uint64_t crc64
CRC64-ECMA of the uncompressed payload (length bytes).
Definition data.h:79
+
uint16_t type
Logical data classification (value from DataType).
Definition data.h:73
+
uint16_t compression
Compression algorithm used (value from CompressionType).
Definition data.h:74
+
Legacy CHS style logical geometry metadata (BlockType::GeometryBlock).
Definition data.h:91
+
uint32_t identifier
Block identifier, must be BlockType::GeometryBlock.
Definition data.h:92
+
uint32_t cylinders
Number of cylinders.
Definition data.h:93
+
uint32_t heads
Number of heads (tracks per cylinder).
Definition data.h:94
+
uint32_t sectorsPerTrack
Number of sectors per track.
Definition data.h:95
+
+
+
+ + + + diff --git a/docs/html/ddt_8h.html b/docs/html/ddt_8h.html new file mode 100644 index 0000000..d7e1b39 --- /dev/null +++ b/docs/html/ddt_8h.html @@ -0,0 +1,177 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/ddt.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
ddt.h File Reference
+
+
+ +

On-disk headers for Deduplication Data Tables (DDT) versions 1 and 2. +More...

+
#include <stdint.h>
+
+

Go to the source code of this file.

+ + + + + + +

+Data Structures

struct  DdtHeader
 Header preceding a version 1 (flat) deduplication table body. More...
struct  DdtHeader2
 Header preceding a version 2 hierarchical deduplication table. More...
+ + + +

+Typedefs

typedef struct DdtHeader DdtHeader
typedef struct DdtHeader2 DdtHeader2
+

Detailed Description

+

On-disk headers for Deduplication Data Tables (DDT) versions 1 and 2.

+

A DDT maps logical sector indices (LBAs within an image's logical address space) to (block, sector) pairs plus a base file offset, enabling content de-duplication inside the container. Two generations exist:

    +
  • DdtHeader ("version 1") flat table.
  • +
  • DdtHeader2 ("version 2") hierarchical, multi-level subtables for scalability.
  • +
+

All integers are little-endian. Structures are packed (1-byte alignment). When porting to a big-endian architecture callers must perform byte swapping. Do not rely on compiler-introduced padding.

+

Compression of the table body (entries array) follows the same conventions as data blocks: first decompress according to the compression enum, then validate CRC64 for uncompressed contents.

+

Related enumerations:

    +
  • BlockType::DeDuplicationTable / BlockType::DeDuplicationTable2
  • +
  • CompressionType
  • +
  • DataType
  • +
  • DdtSizeType (for DdtHeader2::sizeType)
  • +
+ +

Definition in file ddt.h.

+

Typedef Documentation

+ +

◆ DdtHeader

+ +
+
+ + + + +
typedef struct DdtHeader DdtHeader
+
+ +
+
+ +

◆ DdtHeader2

+ +
+
+ + + + +
typedef struct DdtHeader2 DdtHeader2
+
+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/ddt_8h.js b/docs/html/ddt_8h.js new file mode 100644 index 0000000..e9b60ab --- /dev/null +++ b/docs/html/ddt_8h.js @@ -0,0 +1,7 @@ +var ddt_8h = +[ + [ "DdtHeader", "structDdtHeader.html", "structDdtHeader" ], + [ "DdtHeader2", "structDdtHeader2.html", "structDdtHeader2" ], + [ "DdtHeader", "ddt_8h.html#afff1df7553a3d0b0d2dc67e9dc4e9804", null ], + [ "DdtHeader2", "ddt_8h.html#ada1601ea9270f242a8af1d9808819a0a", null ] +]; \ No newline at end of file diff --git a/docs/html/ddt_8h_source.html b/docs/html/ddt_8h_source.html new file mode 100644 index 0000000..e53a192 --- /dev/null +++ b/docs/html/ddt_8h_source.html @@ -0,0 +1,204 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/ddt.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
ddt.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_DDT_H
+
20#define LIBAARUFORMAT_DDT_H
+
21
+
22#include <stdint.h> // fixed-width types for on-disk layout
+
23
+
24#pragma pack(push, 1)
+
25
+
47
+
+
65typedef struct DdtHeader
+
66{
+
67 uint32_t identifier;
+
68 uint16_t type;
+
69 uint16_t compression;
+
70 uint8_t shift;
+
71 uint64_t entries;
+
72 uint64_t cmpLength;
+
73 uint64_t length;
+
74 uint64_t cmpCrc64;
+
75 uint64_t crc64;
+ +
+
77
+
+
141typedef struct DdtHeader2
+
142{
+
143 uint32_t identifier;
+
144 uint16_t type;
+
145 uint16_t compression;
+
146 uint8_t levels;
+
147 uint8_t tableLevel;
+ +
149 uint16_t negative;
+
150 uint64_t blocks;
+
151 uint16_t overflow;
+
152 uint64_t
+ + +
155 uint8_t dataShift;
+
156 uint8_t tableShift;
+
158 uint64_t entries;
+
159 uint64_t cmpLength;
+
160 uint64_t length;
+
161 uint64_t cmpCrc64;
+
162 uint64_t crc64;
+ +
+
164
+
165#pragma pack(pop)
+
166
+
167#endif // LIBAARUFORMAT_DDT_H
+
Header preceding a version 2 hierarchical deduplication table.
Definition ddt.h:142
+
uint64_t cmpCrc64
CRC64-ECMA of compressed table payload.
Definition ddt.h:161
+
uint16_t type
Data classification (DataType) for sectors referenced by this table.
Definition ddt.h:144
+
uint64_t start
Base internal index covered by this table (used for secondary tables; currently informational).
Definition ddt.h:153
+
uint16_t overflow
Trailing dumped sectors beyond user area (overflow range), still mapped with entries.
Definition ddt.h:151
+
uint64_t crc64
CRC64-ECMA of uncompressed table payload.
Definition ddt.h:162
+
uint64_t entries
Number of entries contained in (uncompressed) table payload.
Definition ddt.h:158
+
uint8_t levels
Total number of hierarchy levels (root depth); > 0.
Definition ddt.h:146
+
uint64_t length
Uncompressed payload size in bytes.
Definition ddt.h:160
+
uint32_t identifier
Block identifier, must be BlockType::DeDuplicationTable2.
Definition ddt.h:143
+
uint8_t tableShift
2^tableShift = number of logical sectors per primary entry (multi-level only; 0 for single-level or s...
Definition ddt.h:156
+
uint64_t blocks
Total internal span (negative + usable + overflow) in logical sectors.
Definition ddt.h:150
+
uint16_t negative
Leading negative LBA count; added to external L to build internal index.
Definition ddt.h:149
+
uint8_t blockAlignmentShift
2^blockAlignmentShift = block alignment boundary in bytes.
Definition ddt.h:154
+
uint8_t tableLevel
Zero-based level index of this table (0 = root, increases downward).
Definition ddt.h:147
+
uint16_t compression
Compression algorithm for this table body (CompressionType).
Definition ddt.h:145
+
uint8_t dataShift
2^dataShift = sectors represented per increment in blockIndex field.
Definition ddt.h:155
+
uint64_t cmpLength
Compressed payload size in bytes.
Definition ddt.h:159
+
uint64_t previousLevelOffset
Absolute byte offset of the parent (previous) level table; 0 if root.
Definition ddt.h:148
+
Header preceding a version 1 (flat) deduplication table body.
Definition ddt.h:66
+
uint64_t crc64
CRC64-ECMA of the uncompressed payload.
Definition ddt.h:75
+
uint8_t shift
Left shift applied to per-entry file offset component forming logicalEntryValue.
Definition ddt.h:70
+
uint16_t compression
Compression algorithm for the table body (CompressionType).
Definition ddt.h:69
+
uint32_t identifier
Block identifier, must be BlockType::DeDuplicationTable.
Definition ddt.h:67
+
uint64_t cmpLength
Size in bytes of compressed entries payload.
Definition ddt.h:72
+
uint64_t length
Size in bytes of uncompressed entries payload.
Definition ddt.h:73
+
uint64_t entries
Number of deduplication entries contained in (uncompressed) table.
Definition ddt.h:71
+
uint16_t type
Data classification (DataType) for sectors referenced by this table.
Definition ddt.h:68
+
uint64_t cmpCrc64
CRC64-ECMA of the compressed payload.
Definition ddt.h:74
+
+
+
+ + + + diff --git a/docs/html/ddt__v1_8c.html b/docs/html/ddt__v1_8c.html new file mode 100644 index 0000000..061591b --- /dev/null +++ b/docs/html/ddt__v1_8c.html @@ -0,0 +1,313 @@ + + + + + + + +libaaruformat: src/ddt/ddt_v1.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
ddt_v1.c File Reference
+
+
+
#include <inttypes.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "errors.h"
+#include "aaruformat.h"
+#include "log.h"
+
+

Go to the source code of this file.

+ + + + + + +

+Functions

int32_t process_ddt_v1 (aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt)
 Processes a DDT v1 block from the image stream.
int32_t decode_ddt_entry_v1 (aaruformat_context *ctx, const uint64_t sector_address, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
 Decodes a DDT v1 entry for a given sector address.
+

Function Documentation

+ +

◆ decode_ddt_entry_v1()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t decode_ddt_entry_v1 (aaruformat_context * ctx,
const uint64_t sector_address,
uint64_t * offset,
uint64_t * block_offset,
uint8_t * sector_status )
+
+ +

Decodes a DDT v1 entry for a given sector address.

+

Determines the offset and block offset for a sector using the DDT v1 table. This function performs bit manipulation on the DDT entry to extract the sector offset within a block and the block offset, and determines whether the sector was dumped or not based on the DDT entry value.

+
Parameters
+ + + + + + +
ctxPointer to the aaruformat context containing the loaded DDT table.
sector_addressLogical sector address to decode (must be within valid range).
offsetPointer to store the resulting sector offset within the block.
block_offsetPointer to store the resulting block offset in the image.
sector_statusPointer to store the sector status (dumped or not dumped).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + +
AARUF_STATUS_OK(0) Successfully decoded the DDT entry. This is always returned when:
    +
  • The context and image stream are valid
  • +
  • The DDT entry is successfully extracted and decoded
  • +
  • The offset, block_offset, and sector_status are successfully populated
  • +
  • A zero DDT entry is encountered (indicates sector not dumped)
  • +
  • A non-zero DDT entry is encountered (indicates sector was dumped)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers). This is the only error condition that can occur in this function.
+
+
+
Note
This is a lightweight function that performs only basic validation and bit manipulation. It does not perform bounds checking on the sector_address parameter.
+
+DDT Entry Decoding:
    +
  • Uses a bit mask derived from ctx->shift to extract the offset within block
  • +
  • Right-shifts the DDT entry by ctx->shift bits to get the block offset
  • +
  • A zero DDT entry indicates the sector was not dumped (SectorStatusNotDumped)
  • +
  • A non-zero DDT entry indicates the sector was dumped (SectorStatusDumped)
  • +
+
+
Warning
The function assumes:
    +
  • The DDT table (ctx->userDataDdt) has been properly loaded by process_ddt_v1()
  • +
  • The sector_address is within the valid range of the DDT table
  • +
  • The shift value (ctx->shift) has been properly initialized
  • +
  • All output parameters (offset, block_offset, sector_status) are valid pointers
  • +
+
+
+No bounds checking is performed on sector_address. Accessing beyond the DDT table boundaries will result in undefined behavior.
+ +

Definition at line 405 of file ddt_v1.c.

+ +

References AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, aaruformat_context::imageStream, SectorStatusDumped, SectorStatusNotDumped, aaruformat_context::shift, TRACE, and aaruformat_context::user_data_ddt.

+ +

Referenced by aaruf_read_sector().

+ +
+
+ +

◆ process_ddt_v1()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t process_ddt_v1 (aaruformat_context * ctx,
IndexEntry * entry,
bool * found_user_data_ddt )
+
+ +

Processes a DDT v1 block from the image stream.

+

Reads and decompresses (if needed) a DDT v1 block, verifies its integrity, and loads it into memory or maps it. This function handles both user data DDT blocks and CD sector prefix/suffix corrected DDT blocks, supporting both LZMA compression and uncompressed formats. On Linux, uncompressed blocks can be memory-mapped for improved performance.

+
Parameters
+ + + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the DDT block.
found_user_data_ddtPointer to a boolean that will be set to true if a user data DDT was found and loaded.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully processed the DDT block. This is returned when:
    +
  • The DDT block is successfully read, decompressed (if needed), and loaded into memory
  • +
  • Memory mapping of uncompressed DDT succeeds on Linux systems
  • +
  • CD sector prefix/suffix corrected DDT blocks are processed successfully
  • +
  • Memory allocation failures occur for non-critical operations (processing continues)
  • +
  • File reading errors occur for compressed data or LZMA properties (processing continues)
  • +
  • Unknown compression types are encountered (block is skipped)
  • +
  • Memory mapping fails on Linux (sets found_user_data_ddt to false but continues)
  • +
  • Uncompressed DDT is encountered on non-Linux systems (not yet implemented, continues)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers).
AARUF_ERROR_CANNOT_READ_BLOCK(-7) Failed to access the DDT block in the image stream. This occurs when:
    +
  • fseek() fails to position at the DDT block offset
  • +
  • The file position doesn't match the expected offset after seeking
  • +
  • Failed to read the DDT header from the image stream
  • +
  • The number of bytes read for the DDT header is insufficient
  • +
+
AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK(-17) LZMA decompression failed. This can happen when:
    +
  • The LZMA decoder returns a non-zero error code during decompression
  • +
  • The decompressed data size doesn't match the expected DDT block length
  • +
  • This error causes immediate function termination and memory cleanup
  • +
+
+
+
+
Note
The function exhibits different error handling strategies depending on the operation:
    +
  • Critical errors (seek failures, header read failures, decompression failures) cause immediate return
  • +
  • Non-critical errors (memory allocation failures, unknown compression types) allow processing to continue
  • +
  • The found_user_data_ddt flag is updated to reflect the success of user data DDT loading
  • +
+
+
+Memory Management:
    +
  • Allocated DDT data is stored in the context (ctx->userDataDdt, ctx->sectorPrefixDdt, ctx->sectorSuffixDdt)
  • +
  • On Linux, uncompressed DDTs may be memory-mapped instead of allocated
  • +
  • Memory is automatically cleaned up on decompression errors
  • +
+
+
+Platform-specific behavior:
    +
  • Linux: Supports memory mapping of uncompressed DDT blocks for better performance
  • +
  • Non-Linux: Uncompressed DDT processing is not yet implemented
  • +
+
+
Warning
The function modifies context state including sector count, shift value, and DDT version. Ensure proper context cleanup when the function completes.
+ +

Definition at line 85 of file ddt_v1.c.

+ +

References AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, aaruf_lzma_decode_buffer(), AARUF_STATUS_OK, CdSectorPrefixCorrected, CdSectorSuffixCorrected, DdtHeader::cmpLength, DdtHeader::compression, IndexEntry::dataType, aaruformat_context::ddt_version, DdtHeader::entries, FATAL, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, aaruformat_context::in_memory_ddt, DdtHeader::length, Lzma, LZMA_PROPERTIES_LENGTH, aaruformat_context::mapped_memory_ddt_size, None, IndexEntry::offset, aaruformat_context::sector_prefix_ddt, aaruformat_context::sector_suffix_ddt, ImageInfo::Sectors, aaruformat_context::shift, DdtHeader::shift, TRACE, aaruformat_context::user_data_ddt, and UserData.

+ +

Referenced by aaruf_open().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/ddt__v1_8c.js b/docs/html/ddt__v1_8c.js new file mode 100644 index 0000000..d588d4a --- /dev/null +++ b/docs/html/ddt__v1_8c.js @@ -0,0 +1,5 @@ +var ddt__v1_8c = +[ + [ "decode_ddt_entry_v1", "ddt__v1_8c.html#aabd621530978c71e2abb20d78098453e", null ], + [ "process_ddt_v1", "ddt__v1_8c.html#abaf38090f967423898b99e0455751c07", null ] +]; \ No newline at end of file diff --git a/docs/html/ddt__v1_8c_source.html b/docs/html/ddt__v1_8c_source.html new file mode 100644 index 0000000..7bdef8b --- /dev/null +++ b/docs/html/ddt__v1_8c_source.html @@ -0,0 +1,504 @@ + + + + + + + +libaaruformat: src/ddt/ddt_v1.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
ddt_v1.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <inttypes.h>
+
20#include <stdint.h>
+
21#include <stdio.h>
+
22#include <stdlib.h>
+
23#include "errors.h"
+
24
+
25#ifdef __linux__
+
26#include <sys/mman.h>
+
27#endif
+
28
+
29#include "aaruformat.h"
+
30#include "log.h"
+
31
+
+
85int32_t process_ddt_v1(aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt)
+
86{
+
87 TRACE("Entering process_ddt_v1(%p, %p, %d)", ctx, entry, *found_user_data_ddt);
+
88
+
89 int pos = 0;
+
90 size_t read_bytes = 0;
+
91 DdtHeader ddt_header;
+
92 uint8_t *cmp_data = NULL;
+
93 uint32_t *cd_ddt = NULL;
+
94 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH];
+
95 size_t lzma_size = 0;
+
96 int error_no = 0;
+
97
+
98 // Check if the context and image stream are valid
+
99 if(ctx == NULL || ctx->imageStream == NULL)
+
100 {
+
101 FATAL("Invalid context or image stream.");
+
102
+
103 TRACE("Exiting process_ddt_v1() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
105 }
+
106
+
107 // Seek to block
+
108 TRACE("Seeking to DDT block at position %" PRIu64, entry->offset);
+
109 pos = fseek(ctx->imageStream, entry->offset, SEEK_SET);
+
110 if(pos < 0 || ftell(ctx->imageStream) != entry->offset)
+
111 {
+
112 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
+
113
+
114 TRACE("Exiting process_ddt_v1() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
116 }
+
117
+
118 // Even if those two checks shall have been done before
+
119 TRACE("Reading DDT block header at position %" PRIu64, entry->offset);
+
120 read_bytes = fread(&ddt_header, 1, sizeof(DdtHeader), ctx->imageStream);
+
121
+
122 if(read_bytes != sizeof(DdtHeader))
+
123 {
+
124 FATAL("Could not read block header at %" PRIu64 "", entry->offset);
+
125
+
126 TRACE("Exiting process_ddt_v1() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
128 }
+
129
+
130 *found_user_data_ddt = true;
+
131
+
132 ctx->image_info.ImageSize += ddt_header.cmpLength;
+
133
+
134 if(entry->dataType == UserData)
+
135 {
+
136 ctx->image_info.Sectors = ddt_header.entries;
+
137 ctx->shift = ddt_header.shift;
+
138 ctx->ddt_version = 1;
+
139
+
140 // Check for DDT compression
+
141 switch(ddt_header.compression)
+
142 {
+
143 // TODO: Check CRC
+
144 case Lzma:
+
145 if(ddt_header.cmpLength <= LZMA_PROPERTIES_LENGTH)
+
146 {
+
147 FATAL("Compressed DDT payload too small (%" PRIu64 ") for LZMA properties.", ddt_header.cmpLength);
+ +
149 }
+
150
+
151 lzma_size = ddt_header.cmpLength - LZMA_PROPERTIES_LENGTH;
+
152
+
153 cmp_data = (uint8_t *)malloc(lzma_size);
+
154 if(cmp_data == NULL)
+
155 {
+
156 TRACE("Cannot allocate memory for DDT, continuing...");
+
157 break;
+
158 }
+
159
+
160 ctx->user_data_ddt = (uint64_t *)malloc(ddt_header.length);
+
161 if(ctx->user_data_ddt == NULL)
+
162 {
+
163 TRACE("Cannot allocate memory for DDT, continuing...");
+
164 free(cmp_data);
+
165 break;
+
166 }
+
167
+
168 read_bytes = fread(lzma_properties, 1, LZMA_PROPERTIES_LENGTH, ctx->imageStream);
+
169 if(read_bytes != LZMA_PROPERTIES_LENGTH)
+
170 {
+
171 TRACE("Could not read LZMA properties, continuing...");
+
172 free(cmp_data);
+
173 free(ctx->user_data_ddt);
+
174 ctx->user_data_ddt = NULL;
+
175 break;
+
176 }
+
177
+
178 read_bytes = fread(cmp_data, 1, lzma_size, ctx->imageStream);
+
179 if(read_bytes != lzma_size)
+
180 {
+
181 TRACE("Could not read compressed block, continuing...");
+
182 free(cmp_data);
+
183 free(ctx->user_data_ddt);
+
184 ctx->user_data_ddt = NULL;
+
185 break;
+
186 }
+
187
+
188 read_bytes = ddt_header.length;
+
189 TRACE("Decompressing block of size %zu bytes", ddt_header.length);
+
190 error_no = aaruf_lzma_decode_buffer((uint8_t *)ctx->user_data_ddt, &read_bytes, cmp_data, &lzma_size,
+
191 lzma_properties, LZMA_PROPERTIES_LENGTH);
+
192
+
193 if(error_no != 0)
+
194 {
+
195 FATAL("Got error %d from LZMA, stopping...", error_no);
+
196 free(cmp_data);
+
197 free(ctx->user_data_ddt);
+
198 ctx->user_data_ddt = NULL;
+ +
200 }
+
201
+
202 if(read_bytes != ddt_header.length)
+
203 {
+
204 FATAL("Error decompressing block, should be {0} bytes but got {1} bytes., stopping...");
+
205 free(cmp_data);
+
206 free(ctx->user_data_ddt);
+
207 ctx->user_data_ddt = NULL;
+ +
209 }
+
210
+
211 free(cmp_data);
+
212 cmp_data = NULL;
+
213
+
214 ctx->in_memory_ddt = true;
+
215 *found_user_data_ddt = true;
+
216
+
217 break;
+
218 // TODO: Check CRC
+
219 case None:
+
220#ifdef __linux__
+
221 TRACE("Memory mapping deduplication table at position %" PRIu64, entry->offset + sizeof(ddt_header));
+
222 ctx->mapped_memory_ddt_size = sizeof(uint64_t) * ddt_header.entries;
+
223 ctx->user_data_ddt = mmap(NULL, ctx->mapped_memory_ddt_size, PROT_READ, MAP_SHARED,
+
224 fileno(ctx->imageStream), entry->offset + sizeof(ddt_header));
+
225
+
226 if(ctx->user_data_ddt == MAP_FAILED)
+
227 {
+
228 *found_user_data_ddt = false;
+
229 FATAL("Could not read map deduplication table.");
+
230 break;
+
231 }
+
232
+
233 ctx->in_memory_ddt = false;
+
234 break;
+
235#else // TODO: Implement
+
236 TRACE("Uncompressed DDT not yet implemented...");
+
237 *found_user_data_ddt = false;
+
238 break;
+
239#endif
+
240 default:
+
241 TRACE("Found unknown compression type %d, continuing...", ddt_header.compression);
+
242 *found_user_data_ddt = false;
+
243 break;
+
244 }
+
245 }
+ +
247 {
+
248 switch(ddt_header.compression)
+
249 {
+
250 // TODO: Check CRC
+
251 case Lzma:
+
252 if(ddt_header.cmpLength <= LZMA_PROPERTIES_LENGTH)
+
253 {
+
254 FATAL("Compressed DDT payload too small (%" PRIu64 ") for LZMA properties.", ddt_header.cmpLength);
+ +
256 }
+
257
+
258 lzma_size = ddt_header.cmpLength - LZMA_PROPERTIES_LENGTH;
+
259
+
260 cmp_data = (uint8_t *)malloc(lzma_size);
+
261 if(cmp_data == NULL)
+
262 {
+
263 TRACE("Cannot allocate memory for DDT, continuing...");
+
264 break;
+
265 }
+
266
+
267 cd_ddt = (uint32_t *)malloc(ddt_header.length);
+
268 if(cd_ddt == NULL)
+
269 {
+
270 TRACE("Cannot allocate memory for DDT, continuing...");
+
271 free(cmp_data);
+
272 break;
+
273 }
+
274
+
275 read_bytes = fread(lzma_properties, 1, LZMA_PROPERTIES_LENGTH, ctx->imageStream);
+
276 if(read_bytes != LZMA_PROPERTIES_LENGTH)
+
277 {
+
278 TRACE("Could not read LZMA properties, continuing...");
+
279 free(cmp_data);
+
280 free(cd_ddt);
+
281 break;
+
282 }
+
283
+
284 read_bytes = fread(cmp_data, 1, lzma_size, ctx->imageStream);
+
285 if(read_bytes != lzma_size)
+
286 {
+
287 TRACE("Could not read compressed block, continuing...");
+
288 free(cmp_data);
+
289 free(cd_ddt);
+
290 break;
+
291 }
+
292
+
293 read_bytes = ddt_header.length;
+
294 TRACE("Decompressing block of size %zu bytes", ddt_header.length);
+
295 error_no = aaruf_lzma_decode_buffer((uint8_t *)cd_ddt, &read_bytes, cmp_data, &lzma_size,
+
296 lzma_properties, LZMA_PROPERTIES_LENGTH);
+
297
+
298 if(error_no != 0)
+
299 {
+
300 FATAL("Got error %d from LZMA, stopping...", error_no);
+
301 free(cmp_data);
+
302 free(cd_ddt);
+ +
304 }
+
305
+
306 if(read_bytes != ddt_header.length)
+
307 {
+
308 FATAL("Error decompressing block, should be {0} bytes but got {1} bytes., stopping...");
+
309 free(cmp_data);
+
310 free(cd_ddt);
+ +
312 }
+
313
+
314 free(cmp_data);
+
315 cmp_data = NULL;
+
316
+ +
318 ctx->sector_prefix_ddt = cd_ddt;
+
319 else if(entry->dataType == CdSectorSuffixCorrected)
+
320 ctx->sector_suffix_ddt = cd_ddt;
+
321 else
+
322 free(cd_ddt);
+
323
+
324 break;
+
325
+
326 // TODO: Check CRC
+
327 case None:
+
328 cd_ddt = (uint32_t *)malloc(ddt_header.entries * sizeof(uint32_t));
+
329
+
330 if(cd_ddt == NULL)
+
331 {
+
332 TRACE("Cannot allocate memory for deduplication table.");
+
333 break;
+
334 }
+
335
+
336 read_bytes = fread(cd_ddt, 1, ddt_header.entries * sizeof(uint32_t), ctx->imageStream);
+
337
+
338 if(read_bytes != ddt_header.entries * sizeof(uint32_t))
+
339 {
+
340 free(cd_ddt);
+
341 TRACE("Could not read deduplication table, continuing...");
+
342 break;
+
343 }
+
344
+ +
346 ctx->sector_prefix_ddt = cd_ddt;
+
347 else if(entry->dataType == CdSectorSuffixCorrected)
+
348 ctx->sector_suffix_ddt = cd_ddt;
+
349 else
+
350 free(cd_ddt);
+
351
+
352 break;
+
353 default:
+
354 TRACE("Found unknown compression type %d, continuing...", ddt_header.compression);
+
355 break;
+
356 }
+
357 }
+
358
+
359 TRACE("Exiting process_ddt_v1() = AARUF_STATUS_OK");
+
360 return AARUF_STATUS_OK;
+
361}
+
+
362
+
+
405int32_t decode_ddt_entry_v1(aaruformat_context *ctx, const uint64_t sector_address, uint64_t *offset,
+
406 uint64_t *block_offset, uint8_t *sector_status)
+
407{
+
408 TRACE("Entering decode_ddt_entry_v1(%p, %" PRIu64 ", %p, %p, %p)", ctx, sector_address, offset, block_offset,
+
409 sector_status);
+
410
+
411 // Check if the context and image stream are valid
+
412 if(ctx == NULL || ctx->imageStream == NULL)
+
413 {
+
414 FATAL("Invalid context or image stream.");
+
415 TRACE("Exiting decode_ddt_entry_v1() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
417 }
+
418
+
419 if(ctx->user_data_ddt == NULL)
+
420 {
+
421 FATAL("User data DDT not loaded.");
+
422 TRACE("Exiting decode_ddt_entry_v1() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
424 }
+
425
+
426 if(ctx->shift >= 64)
+
427 {
+
428 FATAL("Invalid DDT shift value %u", ctx->shift);
+
429 TRACE("Exiting decode_ddt_entry_v1() = AARUF_ERROR_INCORRECT_DATA_SIZE");
+ +
431 }
+
432
+
433 const uint64_t ddt_entry = ctx->user_data_ddt[sector_address];
+
434 const uint64_t offset_mask64 = (UINT64_C(1) << ctx->shift) - UINT64_C(1);
+
435 *offset = ddt_entry & offset_mask64;
+
436 *block_offset = ddt_entry >> ctx->shift;
+
437
+
438 // Partially written image... as we can't know the real sector size just assume it's common :/
+
439 if(ddt_entry == 0)
+
440 *sector_status = SectorStatusNotDumped;
+
441 else
+
442 *sector_status = SectorStatusDumped;
+
443
+
444 TRACE("Exiting decode_ddt_entry_v1(%p, %" PRIu64 ", %llu, %llu, %d) = AARUF_STATUS_OK", ctx, sector_address,
+
445 *offset, *block_offset, *sector_status);
+
446 return AARUF_STATUS_OK;
+
447}
+
+ +
#define LZMA_PROPERTIES_LENGTH
Size in bytes of the fixed LZMA properties header (lc/lp/pb + dictionary size).
Definition consts.h:82
+
int32_t decode_ddt_entry_v1(aaruformat_context *ctx, const uint64_t sector_address, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
Decodes a DDT v1 entry for a given sector address.
Definition ddt_v1.c:405
+
int32_t process_ddt_v1(aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt)
Processes a DDT v1 block from the image stream.
Definition ddt_v1.c:85
+
int32_t aaruf_lzma_decode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, size_t *src_size, const uint8_t *props, size_t props_size)
Decodes an LZMA-compressed buffer.
Definition lzma.c:39
+
@ SectorStatusDumped
Sector(s) successfully dumped without error.
Definition enums.h:231
+
@ SectorStatusNotDumped
Sector(s) not yet acquired during image dumping.
Definition enums.h:230
+
@ CdSectorPrefixCorrected
Compact Disc sector prefix (sync, header) corrected-only stored.
Definition enums.h:121
+
@ CdSectorSuffixCorrected
Compact Disc sector suffix (EDC, ECC P, ECC Q) corrected-only stored.
Definition enums.h:122
+
@ UserData
User (main) data.
Definition enums.h:46
+
@ Lzma
LZMA compression.
Definition enums.h:34
+
@ None
Not compressed.
Definition enums.h:33
+
Public error and status code definitions for libaaruformat.
+
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
Definition errors.h:75
+
#define AARUF_ERROR_CANNOT_READ_BLOCK
Generic block read failure (seek/read error).
Definition errors.h:46
+
#define AARUF_ERROR_INCORRECT_DATA_SIZE
Data size does not match expected size.
Definition errors.h:65
+
#define AARUF_ERROR_NOT_AARUFORMAT
Input file/stream failed magic or structural validation.
Definition errors.h:40
+
#define AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK
Decompression routine failed or size mismatch.
Definition errors.h:56
+ +
#define FATAL(fmt,...)
Definition log.h:40
+
#define TRACE(fmt,...)
Definition log.h:25
+
Header preceding a version 1 (flat) deduplication table body.
Definition ddt.h:66
+
uint8_t shift
Left shift applied to per-entry file offset component forming logicalEntryValue.
Definition ddt.h:70
+
uint16_t compression
Compression algorithm for the table body (CompressionType).
Definition ddt.h:69
+
uint64_t cmpLength
Size in bytes of compressed entries payload.
Definition ddt.h:72
+
uint64_t length
Size in bytes of uncompressed entries payload.
Definition ddt.h:73
+
uint64_t entries
Number of deduplication entries contained in (uncompressed) table.
Definition ddt.h:71
+
uint64_t ImageSize
Size of the image payload in bytes (excludes headers/metadata)
Definition aaru.h:873
+
uint64_t Sectors
Total count of addressable logical sectors/blocks.
Definition aaru.h:874
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
uint64_t offset
Absolute byte offset in the image where the referenced block header begins.
Definition index.h:112
+
uint16_t dataType
Data classification (value from DataType) or unused for untyped blocks.
Definition index.h:111
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
uint64_t * user_data_ddt
Legacy flat DDT pointer (NULL when using v2 mini/big arrays).
Definition context.h:181
+
uint8_t shift
Legacy overall shift (deprecated by data_shift/table_shift).
Definition context.h:195
+
uint32_t * sector_suffix_ddt
Legacy CD sector suffix DDT.
Definition context.h:184
+
bool in_memory_ddt
True if primary (and possibly secondary) DDT loaded.
Definition context.h:196
+
int ddt_version
DDT version in use (1=legacy, 2=v2 hierarchical).
Definition context.h:194
+
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
+
ImageInfo image_info
Exposed high-level image info summary.
Definition context.h:260
+
uint32_t * sector_prefix_ddt
Legacy CD sector prefix DDT (deprecated by *2).
Definition context.h:183
+
size_t mapped_memory_ddt_size
Length of mmapped DDT if userDataDdt is mmapped.
Definition context.h:193
+
+
+
+ + + + diff --git a/docs/html/ddt__v2_8c.html b/docs/html/ddt__v2_8c.html new file mode 100644 index 0000000..3b4b563 --- /dev/null +++ b/docs/html/ddt__v2_8c.html @@ -0,0 +1,961 @@ + + + + + + + +libaaruformat: src/ddt/ddt_v2.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
ddt_v2.c File Reference
+
+
+
#include <inttypes.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "aaruformat.h"
+#include "internal.h"
+#include "log.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + +

+Functions

int32_t process_ddt_v2 (aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt)
 Processes a DDT v2 block from the image stream.
int32_t decode_ddt_entry_v2 (aaruformat_context *ctx, const uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
 Decodes a DDT v2 entry for a given sector address.
int32_t decode_ddt_single_level_v2 (aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
 Decodes a single-level DDT v2 entry for a given sector address.
int32_t decode_ddt_multi_level_v2 (aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
 Decodes a multi-level DDT v2 entry for a given sector address.
bool set_ddt_entry_v2 (aaruformat_context *ctx, const uint64_t sector_address, bool negative, const uint64_t offset, const uint64_t block_offset, const uint8_t sector_status, uint64_t *ddt_entry)
 Sets a DDT v2 entry for a given sector address.
bool set_ddt_single_level_v2 (aaruformat_context *ctx, uint64_t sector_address, const bool negative, const uint64_t offset, const uint64_t block_offset, const uint8_t sector_status, uint64_t *ddt_entry)
 Sets a single-level DDT v2 entry for a given sector address.
bool set_ddt_multi_level_v2 (aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
 Sets a multi-level DDT v2 entry for a given sector address.
bool set_ddt_tape (aaruformat_context *ctx, uint64_t sector_address, const uint64_t offset, const uint64_t block_offset, const uint8_t sector_status, uint64_t *ddt_entry)
 Sets a DDT entry for tape media using a hash-based lookup table.
+

Function Documentation

+ +

◆ decode_ddt_entry_v2()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t decode_ddt_entry_v2 (aaruformat_context * ctx,
const uint64_t sector_address,
bool negative,
uint64_t * offset,
uint64_t * block_offset,
uint8_t * sector_status )
+
+ +

Decodes a DDT v2 entry for a given sector address.

+

Determines the offset and block offset for a sector using the DDT v2 table(s). This function acts as a dispatcher that automatically selects between single-level and multi-level DDT decoding based on the tableShift parameter in the DDT header. It provides a unified interface for DDT v2 entry decoding regardless of the underlying table structure complexity.

+
Parameters
+ + + + + + + +
ctxPointer to the aaruformat context containing the loaded DDT structures.
sector_addressLogical sector address to decode (will be adjusted for negative sectors).
negativeIndicates if the sector address is negative.
offsetPointer to store the resulting sector offset within the block.
block_offsetPointer to store the resulting block offset in the image.
sector_statusPointer to store the sector status (dumped, not dumped, etc.).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + +
AARUF_STATUS_OK(0) Successfully decoded the DDT entry. This is always returned when:
    +
  • The context and image stream are valid
  • +
  • The appropriate decoding function (single-level or multi-level) completes successfully
  • +
  • All output parameters are properly populated with decoded values
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers). This is the only error condition that can occur at this dispatcher level.
Othererror codes may be returned by the underlying decoding functions: +
+
+
+
Note
Function Selection:
    +
  • If tableShift > 0: Uses multi-level DDT decoding (decode_ddt_multi_level_v2)
  • +
  • If tableShift = 0: Uses single-level DDT decoding (decode_ddt_single_level_v2)
  • +
  • The tableShift parameter is read from ctx->userDataDdtHeader.tableShift
  • +
+
+
+This function performs minimal validation and primarily acts as a dispatcher. Most error conditions and complex logic are handled by the underlying functions.
+
Warning
The function assumes the DDT has been properly loaded by process_ddt_v2(). Calling this function with an uninitialized or corrupted DDT will result in undefined behavior from the underlying decoding functions.
+
+All output parameters must be valid pointers. No bounds checking is performed on the sector_address parameter at this level.
+ +

Definition at line 507 of file ddt_v2.c.

+ +

References AARUF_ERROR_NOT_AARUFORMAT, decode_ddt_multi_level_v2(), decode_ddt_single_level_v2(), FATAL, aaruformat_context::imageStream, DdtHeader2::tableShift, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_read_sector().

+ +
+
+ +

◆ decode_ddt_multi_level_v2()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t decode_ddt_multi_level_v2 (aaruformat_context * ctx,
uint64_t sector_address,
bool negative,
uint64_t * offset,
uint64_t * block_offset,
uint8_t * sector_status )
+
+ +

Decodes a multi-level DDT v2 entry for a given sector address.

+

Used when the DDT table uses multi-level indirection (tableShift > 0). This function handles the complex process of navigating a hierarchical DDT structure where the primary table points to secondary tables that contain the actual sector mappings. It includes caching mechanisms for secondary tables, supports both compressed and uncompressed secondary tables, and performs comprehensive validation including CRC verification.

+
Parameters
+ + + + + + + +
ctxPointer to the aaruformat context containing the loaded primary DDT table.
sector_addressLogical sector address to decode (adjusted for negative sectors).
negativeIndicates if the sector address is negative.
offsetPointer to store the resulting sector offset within the block.
block_offsetPointer to store the resulting block offset in the image.
sector_statusPointer to store the sector status (dumped, not dumped, etc.).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + +
AARUF_STATUS_OK(0) Successfully decoded the DDT entry. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The tableShift validation passes (must be > 0)
  • +
  • The DDT size type is recognized (SmallDdtSizeType or BigDdtSizeType)
  • +
  • Secondary DDT table is successfully loaded (from cache or file)
  • +
  • Secondary DDT decompression succeeds (if needed)
  • +
  • Secondary DDT CRC validation passes
  • +
  • The DDT entry is successfully extracted and decoded
  • +
  • All output parameters are properly populated with decoded values
  • +
  • Zero DDT entries are handled (indicates sector not dumped)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers).
AARUF_ERROR_CANNOT_READ_BLOCK(-7) Configuration, validation, or file access errors. This occurs when:
    +
  • The tableShift is zero (should use single-level decoding instead)
  • +
  • The DDT size type is unknown/unsupported (not SmallDdtSizeType or BigDdtSizeType)
  • +
  • Cannot read the secondary DDT header from the image stream
  • +
  • Secondary DDT header validation fails (wrong identifier or type)
  • +
  • Cannot read uncompressed secondary DDT data from the image stream
  • +
  • CRC64 context initialization fails (internal error)
  • +
  • Memory allocation fails for secondary DDT data (critical failure)
  • +
  • Unknown compression type encountered in secondary DDT
  • +
+
AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK(-17) LZMA decompression failed for secondary DDT. This occurs when:
    +
  • Memory allocation fails for compressed data or decompression buffer
  • +
  • Cannot read LZMA properties from the image stream
  • +
  • Cannot read compressed secondary DDT data from the image stream
  • +
  • The LZMA decoder returns a non-zero error code during decompression
  • +
  • The decompressed data size doesn't match the expected secondary DDT length
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-18) CRC64 validation failed for secondary DDT. This occurs when:
    +
  • Calculated CRC64 doesn't match the expected CRC64 in the secondary DDT header
  • +
  • Data corruption is detected in the secondary DDT data
  • +
  • This applies to both compressed and uncompressed secondary DDT blocks
  • +
+
+
+
+
Note
Multi-level DDT Navigation:
    +
  • Uses tableShift to calculate items per DDT entry (2^tableShift)
  • +
  • Calculates DDT position by dividing sector address by items per entry
  • +
  • Retrieves secondary DDT offset from primary table at calculated position
  • +
  • Converts block offset to file offset using blockAlignmentShift
  • +
+
+
+Secondary DDT Caching:
    +
  • Maintains a single cached secondary DDT in memory (ctx->cachedSecondaryDdtSmall/Big)
  • +
  • Compares requested offset with cached offset (ctx->cachedDdtOffset)
  • +
  • Only loads from disk if the requested secondary DDT is not currently cached
  • +
  • Caching improves performance for sequential sector access patterns
  • +
+
+
+Secondary DDT Processing:
    +
  • Supports both LZMA compression and uncompressed formats
  • +
  • Performs full CRC64 validation of secondary DDT data
  • +
  • Same bit manipulation as single-level DDT for final entry decoding
  • +
+
+
+Error Handling Strategy:
    +
  • Memory allocation failures for secondary DDT loading are treated as critical errors
  • +
  • File I/O errors and validation failures cause immediate function termination
  • +
  • Unknown compression types are treated as errors (unlike the processing functions)
  • +
  • All allocated memory is cleaned up on error conditions
  • +
+
+
Warning
This function should only be called when tableShift > 0. Calling it with tableShift = 0 will result in AARUF_ERROR_CANNOT_READ_BLOCK.
+
+The function assumes the primary DDT table has been properly loaded and is accessible via ctx->userDataDdtMini or ctx->userDataDdtBig depending on size type.
+
+Secondary DDT caching means that memory usage can increase during operation. The cached secondary DDT is replaced when a different secondary table is needed.
+
+No bounds checking is performed on sector_address or calculated DDT positions. Accessing beyond table boundaries will result in undefined behavior.
+ +

Definition at line 724 of file ddt_v2.c.

+ +

References aaruf_crc64_final(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, aaruf_lzma_decode_buffer(), AARUF_STATUS_OK, DdtHeader2::blockAlignmentShift, aaruformat_context::cached_ddt_offset, aaruformat_context::cached_secondary_ddt2, DdtHeader2::cmpLength, DdtHeader2::compression, DdtHeader2::crc64, DdtHeader2::dataShift, DeDuplicationTableSecondary, FATAL, DdtHeader2::identifier, aaruformat_context::imageStream, DdtHeader2::length, Lzma, LZMA_PROPERTIES_LENGTH, DdtHeader2::negative, None, SectorStatusNotDumped, DdtHeader2::tableShift, TRACE, DdtHeader2::type, aaruformat_context::user_data_ddt2, aaruformat_context::user_data_ddt_header, and UserData.

+ +

Referenced by decode_ddt_entry_v2().

+ +
+
+ +

◆ decode_ddt_single_level_v2()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t decode_ddt_single_level_v2 (aaruformat_context * ctx,
uint64_t sector_address,
bool negative,
uint64_t * offset,
uint64_t * block_offset,
uint8_t * sector_status )
+
+ +

Decodes a single-level DDT v2 entry for a given sector address.

+

Used when the DDT table does not use multi-level indirection (tableShift = 0). This function performs direct lookup in the primary DDT table to extract sector offset, block offset, and sector status information. It performs bit manipulation to decode the packed DDT entry values.

+
Parameters
+ + + + + + + +
ctxPointer to the aaruformat context containing the loaded DDT table.
sector_addressLogical sector address to decode (adjusted for negative sectors).
negativeIndicates if the sector address is negative.
offsetPointer to store the resulting sector offset within the block.
block_offsetPointer to store the resulting block offset in the image.
sector_statusPointer to store the sector status (dumped, not dumped, etc.).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + +
AARUF_STATUS_OK(0) Successfully decoded the DDT entry. This is always returned when:
    +
  • The context and image stream are valid
  • +
  • The tableShift validation passes (must be 0)
  • +
  • The DDT size type is recognized (SmallDdtSizeType or BigDdtSizeType)
  • +
  • The DDT entry is successfully extracted and decoded
  • +
  • All output parameters are properly populated with decoded values
  • +
  • Zero DDT entries are handled (indicates sector not dumped)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers).
AARUF_ERROR_CANNOT_READ_BLOCK(-7) Configuration or validation errors. This occurs when:
    +
  • The tableShift is not zero (should use multi-level decoding instead)
  • +
  • The DDT size type is unknown/unsupported (not SmallDdtSizeType or BigDdtSizeType)
  • +
  • Internal consistency checks fail
  • +
+
+
+
+
Note
DDT Entry Decoding
    +
  • Bits 63-61: Sector status (4 bits)
  • +
  • Bits 60-0: Combined offset and block index (60 bits)
  • +
  • Offset mask: Derived from dataShift parameter
  • +
  • Block offset: Calculated using blockAlignmentShift parameter
  • +
+
+
+Negative Sector Handling:
    +
  • Sector address is automatically adjusted by adding ctx->userDataDdtHeader.negative
  • +
  • This allows proper indexing into the DDT table for negative sector addresses
  • +
+
+
+Zero Entry Handling:
    +
  • A zero DDT entry indicates the sector was not dumped
  • +
  • Sets sector_status to SectorStatusNotDumped and zeros offset/block_offset
  • +
  • This is a normal condition and not an error
  • +
+
+
Warning
The function assumes the DDT table has been properly loaded and is accessible via ctx->userDataDdtMini or ctx->userDataDdtBig depending on size type.
+
+No bounds checking is performed on sector_address. Accessing beyond the DDT table boundaries will result in undefined behavior.
+
+This function should only be called when tableShift is 0. Calling it with tableShift > 0 will result in AARUF_ERROR_CANNOT_READ_BLOCK.
+ +

Definition at line 581 of file ddt_v2.c.

+ +

References AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, DdtHeader2::blockAlignmentShift, DdtHeader2::dataShift, FATAL, aaruformat_context::imageStream, DdtHeader2::negative, SectorStatusNotDumped, DdtHeader2::tableShift, TRACE, aaruformat_context::user_data_ddt2, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by decode_ddt_entry_v2().

+ +
+
+ +

◆ process_ddt_v2()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t process_ddt_v2 (aaruformat_context * ctx,
IndexEntry * entry,
bool * found_user_data_ddt )
+
+ +

Processes a DDT v2 block from the image stream.

+

Reads and decompresses (if needed) a DDT v2 block, verifies its CRC, and loads it into memory. This function handles both user data DDT blocks and CD sector prefix/suffix corrected DDT blocks, supporting both LZMA compression and uncompressed formats. It performs CRC64 validation and stores the processed DDT data in the appropriate context fields based on size type (small/big).

+
Parameters
+ + + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the DDT block.
found_user_data_ddtPointer to a boolean that will be set to true if a user data DDT was found and loaded.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + +
AARUF_STATUS_OK(0) Successfully processed the DDT block. This is returned when:
    +
  • The DDT block is successfully read, decompressed (if needed), and loaded into memory
  • +
  • CRC64 validation passes for the DDT data
  • +
  • User data DDT blocks are processed and context is properly updated
  • +
  • CD sector prefix/suffix corrected DDT blocks are processed successfully
  • +
  • Memory allocation failures occur for non-critical operations (processing continues)
  • +
  • File reading errors occur for compressed data or LZMA properties (processing continues)
  • +
  • Unknown compression types are encountered (block is skipped)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers).
AARUF_ERROR_CANNOT_READ_BLOCK(-7) Failed to access the DDT block in the image stream. This occurs when:
    +
  • fseek() fails to position at the DDT block offset
  • +
  • The file position doesn't match the expected offset after seeking
  • +
  • Failed to read the DDT header from the image stream
  • +
  • The number of bytes read for the DDT header is insufficient
  • +
  • CRC64 context initialization fails (internal error)
  • +
+
AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK(-17) LZMA decompression failed. This can happen when:
    +
  • The LZMA decoder returns a non-zero error code during decompression
  • +
  • The decompressed data size doesn't match the expected DDT block length
  • +
  • This error causes immediate function termination and memory cleanup
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-18) CRC64 validation failed. This occurs when:
    +
  • Calculated CRC64 doesn't match the expected CRC64 in the DDT header
  • +
  • Data corruption is detected in the DDT block
  • +
  • This applies to both compressed and uncompressed DDT blocks
  • +
+
+
+
+
Note
Error Handling Strategy:
    +
  • Critical errors (seek failures, header read failures, decompression failures, CRC failures) cause immediate return
  • +
  • Non-critical errors (memory allocation failures, unknown compression types) allow processing to continue
  • +
  • The found_user_data_ddt flag is updated to reflect the success of user data DDT loading
  • +
+
+
+DDT v2 Features:
    +
  • Handles multi-level DDT hierarchies with tableShift parameter
  • +
  • Updates context with sector counts, DDT version, and primary DDT offset
  • +
  • Stores DDT data in size-appropriate context fields (userDataDdtMini/Big, sectorPrefixDdt, etc.)
  • +
+
+
+Memory Management:
    +
  • Allocated DDT data is stored in the context and becomes part of the context lifecycle
  • +
  • Memory is automatically cleaned up on decompression or CRC validation errors
  • +
  • Buffer memory is reused for the final DDT data storage (no double allocation)
  • +
+
+
+CRC Validation:
    +
  • All DDT blocks undergo CRC64 validation regardless of compression type
  • +
  • CRC is calculated on the final decompressed data
  • +
  • Uses standard CRC64 calculation (no version-specific endianness conversion like v1)
  • +
+
+
Warning
The function modifies context state including sector count, DDT version, and primary DDT offset. Ensure proper context cleanup when the function completes.
+
+Memory allocated for DDT data becomes part of the context and should not be freed separately. The context cleanup functions will handle DDT memory deallocation.
+ +

Definition at line 96 of file ddt_v2.c.

+ +

References aaruf_crc64_final(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, aaruf_lzma_decode_buffer(), AARUF_STATUS_OK, DdtHeader2::blocks, CdSectorPrefix, CdSectorSuffix, DdtHeader2::cmpLength, DdtHeader2::compression, DdtHeader2::crc64, IndexEntry::dataType, aaruformat_context::ddt_version, FATAL, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, aaruformat_context::in_memory_ddt, DdtHeader2::length, Lzma, LZMA_PROPERTIES_LENGTH, DdtHeader2::negative, None, IndexEntry::offset, DdtHeader2::overflow, aaruformat_context::primary_ddt_offset, aaruformat_context::sector_prefix_ddt2, aaruformat_context::sector_suffix_ddt2, ImageInfo::Sectors, TRACE, aaruformat_context::user_data_ddt2, aaruformat_context::user_data_ddt_header, and UserData.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ set_ddt_entry_v2()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool set_ddt_entry_v2 (aaruformat_context * ctx,
const uint64_t sector_address,
bool negative,
const uint64_t offset,
const uint64_t block_offset,
const uint8_t sector_status,
uint64_t * ddt_entry )
+
+ +

Sets a DDT v2 entry for a given sector address.

+

Updates the DDT v2 table(s) with the specified offset, block offset, and sector status for a sector.

+
Parameters
+ + + + + + + + +
ctxPointer to the aaruformat context.
sector_addressLogical sector address to set.
negativeIndicates if the sector address is negative.
offsetOffset to set for the sector.
block_offsetBlock offset to set for the sector.
sector_statusStatus to set for the sector.
ddt_entryExisting DDT entry or 0 to create a new one. If 0, a new entry is returned.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + +
trueif the entry was set successfully, false otherwise.
+
+
+ +

Definition at line 988 of file ddt_v2.c.

+ +

References FATAL, aaruformat_context::imageStream, set_ddt_multi_level_v2(), set_ddt_single_level_v2(), DdtHeader2::tableShift, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_write_sector().

+ +
+
+ +

◆ set_ddt_multi_level_v2()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool set_ddt_multi_level_v2 (aaruformat_context * ctx,
uint64_t sector_address,
bool negative,
uint64_t offset,
uint64_t block_offset,
uint8_t sector_status,
uint64_t * ddt_entry )
+
+ +

Sets a multi-level DDT v2 entry for a given sector address.

+

Used when the DDT table uses multi-level indirection (tableShift > 0).

+
Parameters
+ + + + + + + + +
ctxPointer to the aaruformat context.
sector_addressLogical sector address to set.
negativeIndicates if the sector address is negative.
offsetOffset to set for the sector.
block_offsetBlock offset to set for the sector.
sector_statusStatus to set for the sector.
ddt_entryExisting DDT entry or 0 to create a new one. If 0, a new entry is returned.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + +
trueif the entry was set successfully, false otherwise.
+
+
+ +

Definition at line 1092 of file ddt_v2.c.

+ +

References aaruf_close_current_block(), aaruf_crc64_data(), aaruf_crc64_final(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_NOT_ENOUGH_MEMORY, aaruf_lzma_encode_buffer(), DdtHeader2::blockAlignmentShift, DdtHeader2::blocks, IndexEntry::blockType, aaruformat_context::cached_ddt_offset, aaruformat_context::cached_ddt_position, aaruformat_context::cached_secondary_ddt2, DdtHeader2::cmpCrc64, DdtHeader2::cmpLength, DdtHeader2::compression, aaruformat_context::compression_enabled, DdtHeader2::crc64, DdtHeader2::dataShift, IndexEntry::dataType, DeDuplicationTable2, DeDuplicationTableSecondary, DdtHeader2::entries, FATAL, DdtHeader2::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, DdtHeader2::length, DdtHeader2::levels, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, DdtHeader2::negative, aaruformat_context::next_block_position, None, IndexEntry::offset, DdtHeader2::overflow, DdtHeader2::previousLevelOffset, aaruformat_context::primary_ddt_offset, DdtHeader2::start, DdtHeader2::tableLevel, DdtHeader2::tableShift, TRACE, DdtHeader2::type, aaruformat_context::user_data_ddt2, aaruformat_context::user_data_ddt_header, UserData, and aaruformat_context::writing_buffer.

+ +

Referenced by set_ddt_entry_v2().

+ +
+
+ +

◆ set_ddt_single_level_v2()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool set_ddt_single_level_v2 (aaruformat_context * ctx,
uint64_t sector_address,
const bool negative,
const uint64_t offset,
const uint64_t block_offset,
const uint8_t sector_status,
uint64_t * ddt_entry )
+
+ +

Sets a single-level DDT v2 entry for a given sector address.

+

Used when the DDT table does not use multi-level indirection.

+
Parameters
+ + + + + + + + +
ctxPointer to the aaruformat context.
sector_addressLogical sector address to set.
negativeIndicates if the sector address is negative.
offsetOffset to set for the sector.
block_offsetBlock offset to set for the sector.
sector_statusStatus to set for the sector.
ddt_entryExisting DDT entry or 0 to create a new one. If 0, a new entry is returned.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + +
trueif the entry was set successfully, false otherwise.
+
+
+ +

Definition at line 1023 of file ddt_v2.c.

+ +

References DdtHeader2::blockAlignmentShift, DdtHeader2::dataShift, FATAL, aaruformat_context::imageStream, DdtHeader2::negative, DdtHeader2::tableShift, TRACE, aaruformat_context::user_data_ddt2, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by set_ddt_entry_v2().

+ +
+
+ +

◆ set_ddt_tape()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool set_ddt_tape (aaruformat_context * ctx,
uint64_t sector_address,
const uint64_t offset,
const uint64_t block_offset,
const uint8_t sector_status,
uint64_t * ddt_entry )
+
+ +

Sets a DDT entry for tape media using a hash-based lookup table.

+

This function is specifically designed for tape media images where sectors are accessed non-sequentially and the traditional DDT array structure is inefficient. Instead of using a large contiguous array, it uses a hash table (UTHASH) to store only the sectors that have been written, providing sparse storage for tape media.

+

The function performs the following operations:

    +
  1. Validates the context and verifies it's a tape image
  2. +
  3. Constructs a DDT entry encoding offset, block alignment, and sector status
  4. +
  5. Creates a hash table entry with the sector address as the key
  6. +
  7. Inserts or replaces the entry in the tape DDT hash table
  8. +
+

DDT Entry Format: The DDT entry is a 64-bit value with the following bit layout:

Bits 0-(dataShift-1): Sector offset within block (masked by dataShift)
+
Bits dataShift-27: Block index (block_offset >> blockAlignmentShift)
+
Bits 28-31: Sector status (4 bits for status flags)
+
Bits 32-63: Unused (reserved for future use)
+

Hash Table Management: Uses HASH_REPLACE macro from UTHASH library which:

    +
  • Adds new entries if the key (sector_address) doesn't exist
  • +
  • Replaces existing entries if the key is found (automatically frees old entry)
  • +
  • Maintains O(1) average lookup time for sector address resolution
  • +
+

Overflow Detection: The function checks if the constructed DDT entry exceeds 28 bits (0xFFFFFFF). This limit ensures the sector status can fit in the upper 4 bits while leaving room for future extensions in the upper 32 bits.

+
Parameters
+ + + + + + + +
ctxPointer to the aaruformat context. Must not be NULL. The context must have a valid imageStream and is_tape must be true. The ctx->tapeDdt hash table will be updated with the new entry. The ctx->userDataDdtHeader contains alignment and shift parameters.
sector_addressLogical sector address on the tape to set. This serves as the unique key in the hash table. Multiple calls with the same sector_address will replace the previous entry.
offsetByte offset within the aligned block where the sector data begins. This value is masked by (1 << dataShift) - 1 to extract only the lower bits representing the offset within the block.
block_offsetAbsolute byte offset in the image file where the data block starts. This is right-shifted by blockAlignmentShift to get the block index, which is stored in the DDT entry's middle bits.
sector_statusStatus flags for the sector (4 bits). Common values include:
    +
  • 0x0 (SectorStatusNotDumped): Sector not yet acquired during image dumping
  • +
  • 0x1 (SectorStatusDumped): Sector successfully dumped without error
  • +
  • 0x2 (SectorStatusErrored): Error during dumping; data may be incomplete or corrupt
  • +
  • 0x3 (SectorStatusMode1Correct): Valid MODE 1 data with regenerable suffix/prefix
  • +
  • 0x4 (SectorStatusMode2Form1Ok): Suffix verified/regenerable for MODE 2 Form 1
  • +
  • 0x5 (SectorStatusMode2Form2Ok): Suffix matches MODE 2 Form 2 with valid CRC
  • +
  • 0x6 (SectorStatusMode2Form2NoCrc): Suffix matches MODE 2 Form 2 but CRC empty/missing
  • +
  • 0x7 (SectorStatusTwin): Pointer references a twin sector table
  • +
  • 0x8 (SectorStatusUnrecorded): Sector physically unrecorded; repeated reads non-deterministic
  • +
  • 0x9 (SectorStatusEncrypted): Content encrypted and stored encrypted in image
  • +
  • 0xA (SectorStatusUnencrypted): Content originally encrypted but stored decrypted in image See SectorStatus enum for complete list of defined values
  • +
+
ddt_entryPointer to a 64-bit value that will receive the constructed DDT entry.
    +
  • If *ddt_entry is 0: A new entry is constructed from the provided parameters
  • +
  • If *ddt_entry is non-zero: The existing value is used directly The constructed or provided value is stored in the hash table.
  • +
+
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + +
trueSuccessfully created and inserted the DDT entry. This occurs when:
    +
  • The context and image stream are valid
  • +
  • The image is confirmed to be a tape image (is_tape == true)
  • +
  • The DDT entry fits within the 28-bit limit (< 0xFFFFFFF)
  • +
  • Memory allocation for the hash entry succeeds
  • +
  • The entry is successfully inserted or replaced in the hash table
  • +
+
falseFailed to set the DDT entry. This can happen when:
    +
  • ctx is NULL or ctx->imageStream is NULL (invalid context)
  • +
  • ctx->is_tape is false (wrong function called for non-tape media)
  • +
  • The DDT entry exceeds 0xFFFFFFF (media too large for big DDT)
  • +
  • Memory allocation fails for the new hash table entry (out of memory)
  • +
+
+
+
+
Note
This function is only for tape images. For disk images, use set_ddt_single_level_v2() or set_ddt_multi_level_v2() instead, which use array-based DDT structures.
+
+Memory Management:
    +
  • Allocates a new TapeDdtHashEntry for each sector
  • +
  • HASH_REPLACE automatically frees replaced entries
  • +
  • All hash entries remain in context until cleanup
  • +
  • The tapeDdt hash table must be freed during context destruction
  • +
+
+
+Tape Media Characteristics:
    +
  • Tape sectors are typically accessed sequentially during streaming
  • +
  • File marks and partition boundaries create sparse address spaces
  • +
  • Hash table provides efficient storage for sparse sector maps
  • +
  • Supports variable block sizes common in tape formats
  • +
+
+
+Error Handling:
    +
  • All errors are logged with FATAL level messages
  • +
  • Function returns false immediately on any error condition
  • +
  • TRACE logging marks entry/exit points for debugging
  • +
  • No partial state changes occur on failure
  • +
+
+
Warning
The DDT entry overflow check at 0xFFFFFFF (28 bits) is critical. Exceeding this limit indicates the media is too large to fit in the current DDT format, and continuing would cause data corruption.
+
+This function modifies the shared tapeDdt hash table. In multi-threaded environments, external synchronization is required to prevent race conditions.
+
See also
TapeDdtHashEntry for the hash table entry structure
+
+set_ddt_entry_v2() for the main DDT entry point that dispatches to this function
+
+get_ddt_tape() for retrieving tape DDT entries from the hash table
+ +

Definition at line 1768 of file ddt_v2.c.

+ +

References DdtHeader2::blockAlignmentShift, DdtHeader2::dataShift, FATAL, aaruformat_context::imageStream, aaruformat_context::is_tape, TapeDdtHashEntry::key, aaruformat_context::tape_ddt, TRACE, aaruformat_context::user_data_ddt_header, and TapeDdtHashEntry::value.

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/ddt__v2_8c.js b/docs/html/ddt__v2_8c.js new file mode 100644 index 0000000..87558f2 --- /dev/null +++ b/docs/html/ddt__v2_8c.js @@ -0,0 +1,11 @@ +var ddt__v2_8c = +[ + [ "decode_ddt_entry_v2", "ddt__v2_8c.html#ab8d599dac0c84517fa72c757d5d753c0", null ], + [ "decode_ddt_multi_level_v2", "ddt__v2_8c.html#a83aff4d408ab17f8f350cb03b0e12ef6", null ], + [ "decode_ddt_single_level_v2", "ddt__v2_8c.html#a40c571bc4778040f22ac211cea670db1", null ], + [ "process_ddt_v2", "ddt__v2_8c.html#a1caeae710ee5e1dd356e43b3b659e9c0", null ], + [ "set_ddt_entry_v2", "ddt__v2_8c.html#aa36e08ed9b99bf6e6e022e810c1a3ad1", null ], + [ "set_ddt_multi_level_v2", "ddt__v2_8c.html#a69ff2e68fe4d92a2d2d469ac69f41d82", null ], + [ "set_ddt_single_level_v2", "ddt__v2_8c.html#a9583b5975c5c0b81902681c07d6f737f", null ], + [ "set_ddt_tape", "ddt__v2_8c.html#a40a8f87e97248615429d232ca9fb599b", null ] +]; \ No newline at end of file diff --git a/docs/html/ddt__v2_8c_source.html b/docs/html/ddt__v2_8c_source.html new file mode 100644 index 0000000..d151531 --- /dev/null +++ b/docs/html/ddt__v2_8c_source.html @@ -0,0 +1,1616 @@ + + + + + + + +libaaruformat: src/ddt/ddt_v2.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
ddt_v2.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <inttypes.h>
+
20#include <stdint.h>
+
21#include <stdio.h>
+
22#include <stdlib.h>
+
23
+
24#include "aaruformat.h"
+
25#include "internal.h"
+
26#include "log.h"
+
27
+
+
96int32_t process_ddt_v2(aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt)
+
97{
+
98 TRACE("Entering process_ddt_v2(%p, %p, %d)", ctx, entry, *found_user_data_ddt);
+
99
+
100 int pos = 0;
+
101 size_t read_bytes = 0;
+
102 DdtHeader2 ddt_header;
+
103 uint8_t *cmp_data = NULL;
+
104 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH];
+
105 size_t lzma_size = 0;
+
106 int error_no = 0;
+
107 crc64_ctx *crc64_context = NULL;
+
108 uint64_t crc64 = 0;
+
109 uint8_t *buffer = NULL;
+
110
+
111 // Check if the context and image stream are valid
+
112 if(ctx == NULL || ctx->imageStream == NULL)
+
113 {
+
114 FATAL("Invalid context or image stream.");
+
115
+
116 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
118 }
+
119
+
120 // Seek to block
+
121 pos = fseek(ctx->imageStream, entry->offset, SEEK_SET);
+
122 if(pos < 0 || ftell(ctx->imageStream) != entry->offset)
+
123 {
+
124 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
+
125
+
126 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
128 }
+
129
+
130 // Even if those two checks shall have been done before
+
131 TRACE("Reading DDT block header at position %" PRIu64, entry->offset);
+
132 read_bytes = fread(&ddt_header, 1, sizeof(DdtHeader2), ctx->imageStream);
+
133
+
134 if(read_bytes != sizeof(DdtHeader2))
+
135 {
+
136 FATAL("Could not read block header at %" PRIu64 "", entry->offset);
+
137
+
138 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
140 }
+
141
+
142 ctx->image_info.ImageSize += ddt_header.cmpLength;
+
143
+
144 if(entry->dataType == UserData)
+
145 {
+
146 // User area sectors is blocks stored in DDT minus the negative and overflow displacement blocks
+
147 ctx->image_info.Sectors = ddt_header.blocks - ddt_header.negative - ddt_header.overflow;
+
148 // We need the header later for the shift calculations
+
149 ctx->user_data_ddt_header = ddt_header;
+
150 ctx->ddt_version = 2;
+
151 // Store the primary DDT table's file offset for secondary table references
+
152 ctx->primary_ddt_offset = entry->offset;
+
153
+
154 // Check for DDT compression
+
155 switch(ddt_header.compression)
+
156 {
+
157 case Lzma:
+
158 if(ddt_header.cmpLength <= LZMA_PROPERTIES_LENGTH)
+
159 {
+
160 FATAL("Compressed DDT payload too small (%" PRIu64 ") for LZMA properties.", ddt_header.cmpLength);
+
161 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
163 }
+
164
+
165 lzma_size = (size_t)(ddt_header.cmpLength - LZMA_PROPERTIES_LENGTH);
+
166
+
167 cmp_data = (uint8_t *)malloc(lzma_size);
+
168 if(cmp_data == NULL)
+
169 {
+
170 TRACE("Cannot allocate memory for DDT, continuing...");
+
171 break;
+
172 }
+
173
+
174 buffer = malloc(ddt_header.length);
+
175 if(buffer == NULL)
+
176 {
+
177 TRACE("Cannot allocate memory for DDT, continuing...");
+
178 free(cmp_data);
+
179 break;
+
180 }
+
181
+
182 read_bytes = fread(lzma_properties, 1, LZMA_PROPERTIES_LENGTH, ctx->imageStream);
+
183 if(read_bytes != LZMA_PROPERTIES_LENGTH)
+
184 {
+
185 TRACE("Could not read LZMA properties, continuing...");
+
186 free(cmp_data);
+
187 free(buffer);
+
188 break;
+
189 }
+
190
+
191 read_bytes = fread(cmp_data, 1, lzma_size, ctx->imageStream);
+
192 if(read_bytes != lzma_size)
+
193 {
+
194 TRACE("Could not read compressed block, continuing...");
+
195 free(cmp_data);
+
196 free(buffer);
+
197 break;
+
198 }
+
199
+
200 read_bytes = ddt_header.length;
+
201 TRACE("Decompressing block of size %zu bytes", ddt_header.length);
+
202 error_no = aaruf_lzma_decode_buffer(buffer, &read_bytes, cmp_data, &lzma_size, lzma_properties,
+ +
204
+
205 if(error_no != 0)
+
206 {
+
207 FATAL("Got error %d from LZMA, stopping...", error_no);
+
208 free(cmp_data);
+
209 free(buffer);
+
210 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
212 }
+
213
+
214 if(read_bytes != ddt_header.length)
+
215 {
+
216 FATAL("Error decompressing block, should be {0} bytes but got {1} bytes., stopping...");
+
217 free(cmp_data);
+
218 free(buffer);
+
219 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
221 }
+
222
+
223 free(cmp_data);
+
224
+
225 crc64_context = aaruf_crc64_init();
+
226
+
227 if(crc64_context == NULL)
+
228 {
+
229 FATAL("Could not initialize CRC64.");
+
230 free(buffer);
+
231
+
232 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
234 }
+
235
+
236 aaruf_crc64_update(crc64_context, buffer, read_bytes);
+
237 aaruf_crc64_final(crc64_context, &crc64);
+
238
+
239 if(crc64 != ddt_header.crc64)
+
240 {
+
241 FATAL("Expected DDT CRC 0x%16lX but got 0x%16lX.", ddt_header.crc64, crc64);
+
242 free(buffer);
+
243 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_INVALID_BLOCK_CRC");
+ +
245 }
+
246
+
247 ctx->user_data_ddt2 = (uint64_t *)buffer;
+
248
+
249 ctx->in_memory_ddt = true;
+
250 *found_user_data_ddt = true;
+
251
+
252 break;
+
253 case None:
+
254 buffer = malloc(ddt_header.length);
+
255
+
256 if(buffer == NULL)
+
257 {
+
258 TRACE("Cannot allocate memory for DDT, continuing...");
+
259 break;
+
260 }
+
261
+
262 TRACE("Reading DDT of length %zu bytes", ddt_header.length);
+
263 read_bytes = fread(buffer, 1, ddt_header.length, ctx->imageStream);
+
264
+
265 if(read_bytes != ddt_header.length)
+
266 {
+
267 free(buffer);
+
268 FATAL("Could not read deduplication table, continuing...");
+
269 break;
+
270 }
+
271
+
272 crc64_context = aaruf_crc64_init();
+
273
+
274 if(crc64_context == NULL)
+
275 {
+
276 FATAL("Could not initialize CRC64.");
+
277 free(buffer);
+
278 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
280 }
+
281
+
282 aaruf_crc64_update(crc64_context, buffer, read_bytes);
+
283 aaruf_crc64_final(crc64_context, &crc64);
+
284
+
285 if(crc64 != ddt_header.crc64)
+
286 {
+
287 FATAL("Expected DDT CRC 0x%16lX but got 0x%16lX.", ddt_header.crc64, crc64);
+
288 free(buffer);
+
289 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_INVALID_BLOCK_CRC");
+ +
291 }
+
292
+
293 ctx->user_data_ddt2 = (uint64_t *)buffer;
+
294
+
295 ctx->in_memory_ddt = true;
+
296 *found_user_data_ddt = true;
+
297
+
298 break;
+
299 default:
+
300 TRACE("Found unknown compression type %d, continuing...", ddt_header.compression);
+
301 *found_user_data_ddt = false;
+
302 break;
+
303 }
+
304 }
+
305 else if(entry->dataType == CdSectorPrefix || entry->dataType == CdSectorSuffix)
+
306 switch(ddt_header.compression)
+
307 {
+
308 case Lzma:
+
309 if(ddt_header.cmpLength <= LZMA_PROPERTIES_LENGTH)
+
310 {
+
311 FATAL("Compressed DDT payload too small (%" PRIu64 ") for LZMA properties.", ddt_header.cmpLength);
+
312 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
314 }
+
315
+
316 lzma_size = (size_t)(ddt_header.cmpLength - LZMA_PROPERTIES_LENGTH);
+
317
+
318 cmp_data = (uint8_t *)malloc(lzma_size);
+
319 if(cmp_data == NULL)
+
320 {
+
321 TRACE("Cannot allocate memory for DDT, continuing...");
+
322 break;
+
323 }
+
324
+
325 buffer = malloc(ddt_header.length);
+
326 if(buffer == NULL)
+
327 {
+
328 TRACE("Cannot allocate memory for DDT, continuing...");
+
329 free(cmp_data);
+
330 break;
+
331 }
+
332
+
333 read_bytes = fread(lzma_properties, 1, LZMA_PROPERTIES_LENGTH, ctx->imageStream);
+
334 if(read_bytes != LZMA_PROPERTIES_LENGTH)
+
335 {
+
336 TRACE("Could not read LZMA properties, continuing...");
+
337 free(cmp_data);
+
338 free(buffer);
+
339 break;
+
340 }
+
341
+
342 read_bytes = fread(cmp_data, 1, lzma_size, ctx->imageStream);
+
343 if(read_bytes != lzma_size)
+
344 {
+
345 TRACE("Could not read compressed block, continuing...");
+
346 free(cmp_data);
+
347 free(buffer);
+
348 break;
+
349 }
+
350
+
351 read_bytes = ddt_header.length;
+
352 TRACE("Decompressing block of size %zu bytes", ddt_header.length);
+
353 error_no = aaruf_lzma_decode_buffer(buffer, &read_bytes, cmp_data, &lzma_size, lzma_properties,
+ +
355
+
356 if(error_no != 0)
+
357 {
+
358 FATAL("Got error %d from LZMA, stopping...", error_no);
+
359 free(cmp_data);
+
360 free(buffer);
+
361 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
363 }
+
364
+
365 if(read_bytes != ddt_header.length)
+
366 {
+
367 FATAL("Error decompressing block, should be {0} bytes but got {1} bytes., stopping...");
+
368 free(cmp_data);
+
369 free(buffer);
+
370 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
372 }
+
373
+
374 free(cmp_data);
+
375 cmp_data = NULL;
+
376
+
377 crc64_context = aaruf_crc64_init();
+
378
+
379 if(crc64_context == NULL)
+
380 {
+
381 FATAL("Could not initialize CRC64.");
+
382 free(buffer);
+
383 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
385 }
+
386
+
387 aaruf_crc64_update(crc64_context, buffer, read_bytes);
+
388 aaruf_crc64_final(crc64_context, &crc64);
+
389
+
390 if(crc64 != ddt_header.crc64)
+
391 {
+
392 FATAL("Expected DDT CRC 0x%16lX but got 0x%16lX.", ddt_header.crc64, crc64);
+
393 free(buffer);
+
394 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_INVALID_BLOCK_CRC");
+ +
396 }
+
397
+
398 if(entry->dataType == CdSectorPrefix)
+
399 ctx->sector_prefix_ddt2 = (uint64_t *)buffer;
+
400 else if(entry->dataType == CdSectorSuffix)
+
401 ctx->sector_suffix_ddt2 = (uint64_t *)buffer;
+
402 else
+
403 free(buffer);
+
404
+
405 break;
+
406
+
407 case None:
+
408 buffer = malloc(ddt_header.length);
+
409
+
410 if(buffer == NULL)
+
411 {
+
412 TRACE("Cannot allocate memory for deduplication table.");
+
413 break;
+
414 }
+
415
+
416 read_bytes = fread(buffer, 1, ddt_header.length, ctx->imageStream);
+
417
+
418 if(read_bytes != ddt_header.length)
+
419 {
+
420 free(buffer);
+
421 FATAL("Could not read deduplication table, continuing...");
+
422 break;
+
423 }
+
424
+
425 crc64_context = aaruf_crc64_init();
+
426
+
427 if(crc64_context == NULL)
+
428 {
+
429 FATAL("Could not initialize CRC64.");
+
430 free(buffer);
+
431 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
433 }
+
434
+
435 aaruf_crc64_update(crc64_context, buffer, read_bytes);
+
436 aaruf_crc64_final(crc64_context, &crc64);
+
437
+
438 if(crc64 != ddt_header.crc64)
+
439 {
+
440 FATAL("Expected DDT CRC 0x%16lX but got 0x%16lX.", ddt_header.crc64, crc64);
+
441 free(buffer);
+
442 TRACE("Exiting process_ddt_v2() = AARUF_ERROR_INVALID_BLOCK_CRC");
+ +
444 }
+
445
+
446 if(entry->dataType == CdSectorPrefix)
+
447 ctx->sector_prefix_ddt2 = (uint64_t *)buffer;
+
448 else if(entry->dataType == CdSectorSuffix)
+
449 ctx->sector_suffix_ddt2 = (uint64_t *)buffer;
+
450 else
+
451 free(buffer);
+
452
+
453 break;
+
454 default:
+
455 TRACE("Found unknown compression type %d, continuing...", ddt_header.compression);
+
456 break;
+
457 }
+
458
+
459 TRACE("Exiting process_ddt_v2() = AARUF_STATUS_OK");
+
460 return AARUF_STATUS_OK;
+
461}
+
+
462
+
+
507int32_t decode_ddt_entry_v2(aaruformat_context *ctx, const uint64_t sector_address, bool negative, uint64_t *offset,
+
508 uint64_t *block_offset, uint8_t *sector_status)
+
509{
+
510 TRACE("Entering decode_ddt_entry_v2(%p, %" PRIu64 ", %d, %llu, %llu, %d)", ctx, sector_address, negative, *offset,
+
511 *block_offset, *sector_status);
+
512 // Check if the context and image stream are valid
+
513 if(ctx == NULL || ctx->imageStream == NULL)
+
514 {
+
515 FATAL("Invalid context or image stream.");
+
516
+
517 TRACE("Exiting decode_ddt_entry_v2() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
519 }
+
520
+ +
522 return decode_ddt_multi_level_v2(ctx, sector_address, negative, offset, block_offset, sector_status);
+
523
+
524 return decode_ddt_single_level_v2(ctx, sector_address, negative, offset, block_offset, sector_status);
+
525}
+
+
526
+
+
581int32_t decode_ddt_single_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset,
+
582 uint64_t *block_offset, uint8_t *sector_status)
+
583{
+
584 TRACE("Entering decode_ddt_single_level_v2(%p, %" PRIu64 ", %d, %llu, %llu, %d)", ctx, sector_address, negative,
+
585 *offset, *block_offset, *sector_status);
+
586
+
587 uint64_t ddt_entry = 0;
+
588
+
589 // Check if the context and image stream are valid
+
590 if(ctx == NULL || ctx->imageStream == NULL)
+
591 {
+
592 FATAL("Invalid context or image stream.");
+
593
+
594 TRACE("Exiting decode_ddt_single_level_v2() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
596 }
+
597
+
598 // Should not really be here
+
599 if(ctx->user_data_ddt_header.tableShift != 0)
+
600 {
+
601 FATAL("DDT table shift is not zero, but we are in single-level DDT decoding.");
+
602 TRACE("Exiting decode_ddt_single_level_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
604 }
+
605
+
606 // Calculate positive or negative sector
+
607 if(negative)
+
608 sector_address -= ctx->user_data_ddt_header.negative;
+
609 else
+
610 sector_address += ctx->user_data_ddt_header.negative;
+
611
+
612 ddt_entry = ctx->user_data_ddt2[sector_address];
+
613
+
614 if(ddt_entry == 0)
+
615 {
+
616 *sector_status = SectorStatusNotDumped;
+
617 *offset = 0;
+
618 *block_offset = 0;
+
619 TRACE("Exiting decode_ddt_single_level_v2(%p, %" PRIu64 ", %llu, %llu, %d) = AARUF_STATUS_OK", ctx,
+
620 sector_address, *offset, *block_offset, *sector_status);
+
621 return AARUF_STATUS_OK;
+
622 }
+
623
+
624 *sector_status = ddt_entry >> 60;
+
625 ddt_entry &= 0xFFFFFFFFFFFFFFF;
+
626
+
627 const uint64_t offset_mask = (uint64_t)((1 << ctx->user_data_ddt_header.dataShift) - 1);
+
628 *offset = ddt_entry & offset_mask;
+
629 *block_offset =
+ +
631
+
632 TRACE("Exiting decode_ddt_single_level_v2(%p, %" PRIu64 ", %d, %llu, %llu, %d) = AARUF_STATUS_OK", ctx,
+
633 sector_address, negative, *offset, *block_offset, *sector_status);
+
634 return AARUF_STATUS_OK;
+
635}
+
+
636
+
+
724int32_t decode_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset,
+
725 uint64_t *block_offset, uint8_t *sector_status)
+
726{
+
727 TRACE("Entering decode_ddt_multi_level_v2(%p, %" PRIu64 ", %d, %llu, %llu, %d)", ctx, sector_address, negative,
+
728 *offset, *block_offset, *sector_status);
+
729
+
730 uint64_t ddt_entry = 0;
+
731 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH];
+
732 size_t lzma_size = 0;
+
733 uint8_t *cmp_data = NULL;
+
734 uint8_t *buffer = NULL;
+
735 crc64_ctx *crc64_context = NULL;
+
736 uint64_t crc64 = 0;
+
737 int items_per_ddt_entry = 0;
+
738 uint64_t ddt_position = 0;
+
739 uint64_t secondary_ddt_offset = 0;
+
740
+
741 // Check if the context and image stream are valid
+
742 if(ctx == NULL || ctx->imageStream == NULL)
+
743 {
+
744 FATAL("Invalid context or image stream.");
+
745
+
746 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
748 }
+
749
+
750 // Should not really be here
+
751 if(ctx->user_data_ddt_header.tableShift == 0)
+
752 {
+
753 FATAL("DDT table shift is zero, but we are in multi-level DDT decoding.");
+
754 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
756 }
+
757
+
758 // Calculate positive or negative sector
+
759 if(negative)
+
760 sector_address -= ctx->user_data_ddt_header.negative;
+
761 else
+
762 sector_address += ctx->user_data_ddt_header.negative;
+
763
+
764 items_per_ddt_entry = 1 << ctx->user_data_ddt_header.tableShift;
+
765 ddt_position = sector_address / items_per_ddt_entry;
+
766 secondary_ddt_offset = ctx->user_data_ddt2[ddt_position];
+
767
+
768 // Position in file of the child DDT table
+
769 secondary_ddt_offset *= 1 << ctx->user_data_ddt_header.blockAlignmentShift;
+
770
+
771 // Is the one we have cached the same as the one we need to read?
+
772 if(ctx->cached_ddt_offset != secondary_ddt_offset)
+
773 {
+
774 int32_t error_no = 0;
+
775 fseek(ctx->imageStream, secondary_ddt_offset, SEEK_SET);
+
776 DdtHeader2 ddt_header;
+
777 size_t read_bytes = fread(&ddt_header, 1, sizeof(DdtHeader2), ctx->imageStream);
+
778
+
779 if(read_bytes != sizeof(DdtHeader2))
+
780 {
+
781 FATAL("Could not read block header at %" PRIu64 "", secondary_ddt_offset);
+
782 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
784 }
+
785
+
786 if(ddt_header.identifier != DeDuplicationTableSecondary || ddt_header.type != UserData)
+
787 {
+
788 FATAL("Invalid block header at %" PRIu64 "", secondary_ddt_offset);
+
789 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
791 }
+
792
+
793 // Check for DDT compression
+
794 switch(ddt_header.compression)
+
795 {
+
796 case Lzma:
+
797 if(ddt_header.cmpLength <= LZMA_PROPERTIES_LENGTH)
+
798 {
+
799 FATAL("Compressed DDT payload too small (%" PRIu64 ") for LZMA properties.", ddt_header.cmpLength);
+
800 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
802 }
+
803
+
804 lzma_size = (size_t)(ddt_header.cmpLength - LZMA_PROPERTIES_LENGTH);
+
805
+
806 cmp_data = (uint8_t *)malloc(lzma_size);
+
807 if(cmp_data == NULL)
+
808 {
+
809 FATAL("Cannot allocate memory for DDT, stopping...");
+
810 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
812 }
+
813
+
814 buffer = malloc(ddt_header.length);
+
815 if(buffer == NULL)
+
816 {
+
817 FATAL("Cannot allocate memory for DDT, stopping...");
+
818 free(cmp_data);
+ +
820 }
+
821
+
822 read_bytes = fread(lzma_properties, 1, LZMA_PROPERTIES_LENGTH, ctx->imageStream);
+
823 if(read_bytes != LZMA_PROPERTIES_LENGTH)
+
824 {
+
825 FATAL("Could not read LZMA properties, stopping...");
+
826 free(cmp_data);
+
827 free(buffer);
+
828 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
830 }
+
831
+
832 read_bytes = fread(cmp_data, 1, lzma_size, ctx->imageStream);
+
833 if(read_bytes != lzma_size)
+
834 {
+
835 FATAL("Could not read compressed block, stopping...");
+
836 free(cmp_data);
+
837 free(buffer);
+
838 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
840 }
+
841
+
842 TRACE("Decompressing block of size %zu bytes", ddt_header.length);
+
843 read_bytes = ddt_header.length;
+
844 error_no = aaruf_lzma_decode_buffer(buffer, &read_bytes, cmp_data, &lzma_size, lzma_properties,
+ +
846
+
847 if(error_no != 0)
+
848 {
+
849 FATAL("Got error %d from LZMA, stopping...", error_no);
+
850 free(cmp_data);
+
851 free(buffer);
+
852 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
854 }
+
855
+
856 if(read_bytes != ddt_header.length)
+
857 {
+
858 FATAL("Error decompressing block, should be {0} bytes but got {1} bytes., stopping...");
+
859 free(cmp_data);
+
860 free(buffer);
+
861 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK");
+ +
863 }
+
864
+
865 free(cmp_data);
+
866
+
867 crc64_context = aaruf_crc64_init();
+
868
+
869 if(crc64_context == NULL)
+
870 {
+
871 FATAL("Could not initialize CRC64.");
+
872 free(buffer);
+
873 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
875 }
+
876
+
877 aaruf_crc64_update(crc64_context, buffer, read_bytes);
+
878 aaruf_crc64_final(crc64_context, &crc64);
+
879
+
880 if(crc64 != ddt_header.crc64)
+
881 {
+
882 FATAL("Expected DDT CRC 0x%16lX but got 0x%16lX.", ddt_header.crc64, crc64);
+
883 free(buffer);
+
884 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_INVALID_BLOCK_CRC");
+ +
886 }
+
887
+
888 ctx->cached_secondary_ddt2 = (uint64_t *)buffer;
+
889
+
890 ctx->cached_ddt_offset = secondary_ddt_offset;
+
891
+
892 break;
+
893 case None:
+
894 buffer = malloc(ddt_header.length);
+
895
+
896 if(buffer == NULL)
+
897 {
+
898 FATAL("Cannot allocate memory for DDT, stopping...");
+
899 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
901 }
+
902
+
903 read_bytes = fread(buffer, 1, ddt_header.length, ctx->imageStream);
+
904
+
905 if(read_bytes != ddt_header.length)
+
906 {
+
907 free(buffer);
+
908 FATAL("Could not read deduplication table, stopping...");
+
909 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
911 }
+
912
+
913 crc64_context = aaruf_crc64_init();
+
914
+
915 if(crc64_context == NULL)
+
916 {
+
917 FATAL("Could not initialize CRC64.");
+
918 free(buffer);
+
919 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
921 }
+
922
+
923 aaruf_crc64_update(crc64_context, buffer, read_bytes);
+
924 aaruf_crc64_final(crc64_context, &crc64);
+
925
+
926 if(crc64 != ddt_header.crc64)
+
927 {
+
928 FATAL("Expected DDT CRC 0x%16lX but got 0x%16lX.", ddt_header.crc64, crc64);
+
929 free(buffer);
+
930 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_INVALID_BLOCK_CRC");
+ +
932 }
+
933
+
934 ctx->cached_secondary_ddt2 = (uint64_t *)buffer;
+
935
+
936 ctx->cached_ddt_offset = secondary_ddt_offset;
+
937
+
938 break;
+
939 default:
+
940 FATAL("Found unknown compression type %d, stopping...", ddt_header.compression);
+
941 TRACE("Exiting decode_ddt_multi_level_v2() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
943 }
+
944 }
+
945
+
946 ddt_entry = ctx->cached_secondary_ddt2[sector_address % items_per_ddt_entry];
+
947
+
948 if(ddt_entry == 0)
+
949 {
+
950 *sector_status = SectorStatusNotDumped;
+
951 *offset = 0;
+
952 *block_offset = 0;
+
953
+
954 TRACE("Exiting decode_ddt_multi_level_v2(%p, %" PRIu64 ", %llu, %llu, %d) = AARUF_STATUS_OK", ctx,
+
955 sector_address, *offset, *block_offset, *sector_status);
+
956 return AARUF_STATUS_OK;
+
957 }
+
958
+
959 *sector_status = ddt_entry >> 60;
+
960 ddt_entry &= 0x0FFFFFFFFFFFFFFF;
+
961
+
962 const uint64_t offset_mask = (uint64_t)((1 << ctx->user_data_ddt_header.dataShift) - 1);
+
963 *offset = ddt_entry & offset_mask;
+
964 *block_offset =
+ +
966
+
967 TRACE("Exiting decode_ddt_multi_level_v2(%p, %" PRIu64 ", %d, %llu, %llu, %d) = AARUF_STATUS_OK", ctx,
+
968 sector_address, negative, *offset, *block_offset, *sector_status);
+
969 return AARUF_STATUS_OK;
+
970}
+
+
971
+
+
988bool set_ddt_entry_v2(aaruformat_context *ctx, const uint64_t sector_address, bool negative, const uint64_t offset,
+
989 const uint64_t block_offset, const uint8_t sector_status, uint64_t *ddt_entry)
+
990{
+
991 TRACE("Entering set_ddt_entry_v2(%p, %" PRIu64 ", %d, %llu, %llu, %d)", ctx, sector_address, negative, offset,
+
992 block_offset, sector_status);
+
993
+
994 // Check if the context and image stream are valid
+
995 if(ctx == NULL || ctx->imageStream == NULL)
+
996 {
+
997 FATAL("Invalid context or image stream.");
+
998 return false;
+
999 }
+
1000
+
1001 if(ctx->user_data_ddt_header.tableShift > 0)
+
1002 return set_ddt_multi_level_v2(ctx, sector_address, false, offset, block_offset, sector_status, ddt_entry);
+
1003
+
1004 return set_ddt_single_level_v2(ctx, sector_address, false, offset, block_offset, sector_status, ddt_entry);
+
1005}
+
+
1006
+
+
1023bool set_ddt_single_level_v2(aaruformat_context *ctx, uint64_t sector_address, const bool negative,
+
1024 const uint64_t offset, const uint64_t block_offset, const uint8_t sector_status,
+
1025 uint64_t *ddt_entry)
+
1026{
+
1027 TRACE("Entering set_ddt_single_level_v2(%p, %" PRIu64 ", %d, %llu, %llu, %d)", ctx, sector_address, negative,
+
1028 offset, block_offset, sector_status);
+
1029
+
1030 // Check if the context and image stream are valid
+
1031 if(ctx == NULL || ctx->imageStream == NULL)
+
1032 {
+
1033 FATAL("Invalid context or image stream.");
+
1034 TRACE("Exiting set_ddt_single_level_v2() = false");
+
1035 return false;
+
1036 }
+
1037
+
1038 // Should not really be here
+
1039 if(ctx->user_data_ddt_header.tableShift != 0)
+
1040 {
+
1041 FATAL("DDT table shift is not zero, but we are in single-level DDT setting.");
+
1042 TRACE("Exiting set_ddt_single_level_v2() = false");
+
1043 return false;
+
1044 }
+
1045
+
1046 // Calculate positive or negative sector
+
1047 if(negative)
+
1048 sector_address -= ctx->user_data_ddt_header.negative;
+
1049 else
+
1050 sector_address += ctx->user_data_ddt_header.negative;
+
1051
+
1052 if(*ddt_entry == 0)
+
1053 {
+
1054 const uint64_t block_index = block_offset >> ctx->user_data_ddt_header.blockAlignmentShift;
+
1055 *ddt_entry = offset & (1ULL << ctx->user_data_ddt_header.dataShift) - 1 |
+
1056 block_index << ctx->user_data_ddt_header.dataShift;
+
1057
+
1058 // Overflow detection for DDT entry
+
1059 if(*ddt_entry > 0xFFFFFFFFFFFFFFF)
+
1060 {
+
1061 FATAL("DDT overflow: media does not fit in big DDT");
+
1062 TRACE("Exiting set_ddt_single_level_v2() = false");
+
1063 return false;
+
1064 }
+
1065
+
1066 *ddt_entry |= (uint64_t)sector_status << 60;
+
1067 }
+
1068
+
1069 TRACE("Setting big single-level DDT entry %d to %ull", sector_address, (uint64_t)*ddt_entry);
+
1070 ctx->user_data_ddt2[sector_address] = *ddt_entry;
+
1071
+
1072 TRACE("Exiting set_ddt_single_level_v2() = true");
+
1073 return true;
+
1074}
+
+
1075
+
+
1092bool set_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset,
+
1093 uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
+
1094{
+
1095 TRACE("Entering set_ddt_multi_level_v2(%p, %" PRIu64 ", %d, %" PRIu64 ", %" PRIu64 ", %d)", ctx, sector_address,
+
1096 negative, offset, block_offset, sector_status);
+
1097
+
1098 uint64_t items_per_ddt_entry = 0;
+
1099 uint64_t ddt_position = 0;
+
1100 uint64_t secondary_ddt_offset = 0;
+
1101 uint64_t block_index = 0;
+
1102 uint8_t *buffer = NULL;
+
1103 crc64_ctx *crc64_context = NULL;
+
1104 uint64_t crc64 = 0;
+
1105 DdtHeader2 ddt_header;
+
1106 size_t written_bytes = 0;
+
1107 long end_of_file = 0;
+
1108 bool create_new_table = false;
+
1109
+
1110 // Check if the context and image stream are valid
+
1111 if(ctx == NULL || ctx->imageStream == NULL)
+
1112 {
+
1113 FATAL("Invalid context or image stream.");
+
1114 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1115 return false;
+
1116 }
+
1117
+
1118 // Should not really be here
+
1119 if(ctx->user_data_ddt_header.tableShift == 0)
+
1120 {
+
1121 FATAL("DDT table shift is zero, but we are in multi-level DDT setting.");
+
1122 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1123 return false;
+
1124 }
+
1125
+
1126 // Calculate positive or negative sector
+
1127 if(negative)
+
1128 sector_address -= ctx->user_data_ddt_header.negative;
+
1129 else
+
1130 sector_address += ctx->user_data_ddt_header.negative;
+
1131
+
1132 // Step 1: Calculate the corresponding secondary level table
+
1133 items_per_ddt_entry = 1 << ctx->user_data_ddt_header.tableShift;
+
1134 ddt_position = sector_address / items_per_ddt_entry;
+
1135 secondary_ddt_offset = ctx->user_data_ddt2[ddt_position];
+
1136
+
1137 // Position in file of the child DDT table
+
1138 secondary_ddt_offset *= 1 << ctx->user_data_ddt_header.blockAlignmentShift;
+
1139
+
1140 // Step 2: Check if it corresponds to the currently in-memory cached secondary level table
+
1141 if(ctx->cached_ddt_offset == secondary_ddt_offset && secondary_ddt_offset != 0)
+
1142 {
+
1143 // Update the corresponding DDT entry directly in the cached table
+
1144 if(*ddt_entry == 0)
+
1145 {
+
1146 block_index = block_offset >> ctx->user_data_ddt_header.blockAlignmentShift;
+
1147 *ddt_entry = offset & (1ULL << ctx->user_data_ddt_header.dataShift) - 1 |
+
1148 block_index << ctx->user_data_ddt_header.dataShift;
+
1149
+
1150 // Overflow detection for DDT entry
+
1151 if(*ddt_entry > 0xFFFFFFFFFFFFFFF)
+
1152 {
+
1153 FATAL("DDT overflow: media does not fit in big DDT");
+
1154 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1155 return false;
+
1156 }
+
1157
+
1158 *ddt_entry |= (uint64_t)sector_status << 60;
+
1159 }
+
1160
+
1161 TRACE("Setting small secondary DDT entry %d to %ull", sector_address % items_per_ddt_entry,
+
1162 (uint64_t)*ddt_entry);
+
1163 ctx->cached_secondary_ddt2[sector_address % items_per_ddt_entry] = *ddt_entry;
+
1164
+
1165 TRACE("Updated cached secondary DDT entry at position %" PRIu64, sector_address % items_per_ddt_entry);
+
1166 TRACE("Exiting set_ddt_multi_level_v2() = true");
+
1167 return true;
+
1168 }
+
1169
+
1170 // Step 2.5: Handle case where we have a cached secondary DDT that has never been written to disk
+
1171 // but does not contain the requested block
+
1172 if(ctx->cached_ddt_offset == 0 && (ctx->cached_secondary_ddt2 != NULL))
+
1173 {
+
1174 // Only write the cached table to disk if the requested block belongs to a different DDT position
+
1175 if(ddt_position != ctx->cached_ddt_position)
+
1176 {
+
1177 TRACE("Current secondary DDT in memory belongs to position %" PRIu64
+
1178 " but requested block needs position %" PRIu64,
+
1179 ctx->cached_ddt_position, ddt_position);
+
1180
+
1181 // Write the cached DDT to disk before proceeding with the new one
+
1182
+
1183 // Close the current data block first
+
1184 if(ctx->writing_buffer != NULL) aaruf_close_current_block(ctx);
+
1185
+
1186 // Get current position and seek to end of file
+
1187 fseek(ctx->imageStream, 0, SEEK_END);
+
1188 end_of_file = ftell(ctx->imageStream);
+
1189
+
1190 // Align to block boundary
+
1191 uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
1192 end_of_file = end_of_file + alignment_mask & ~alignment_mask;
+
1193 fseek(ctx->imageStream, end_of_file, SEEK_SET);
+
1194
+
1195 // Prepare DDT header for the never-written cached table
+
1196 memset(&ddt_header, 0, sizeof(DdtHeader2));
+ +
1198 ddt_header.type = UserData;
+
1199 ddt_header.compression = ctx->compression_enabled ? Lzma : None; // Use no compression for simplicity
+
1200 ddt_header.levels = ctx->user_data_ddt_header.levels;
+
1201 ddt_header.tableLevel = ctx->user_data_ddt_header.tableLevel + 1;
+
1202 ddt_header.previousLevelOffset = ctx->primary_ddt_offset;
+
1203 ddt_header.negative = ctx->user_data_ddt_header.negative;
+
1204 ddt_header.blocks = items_per_ddt_entry;
+
1205 ddt_header.overflow = ctx->user_data_ddt_header.overflow;
+
1206 ddt_header.start = ctx->cached_ddt_position * items_per_ddt_entry; // Use cached position with table shift
+ +
1208 ddt_header.dataShift = ctx->user_data_ddt_header.dataShift;
+
1209 ddt_header.tableShift = 0; // Secondary tables are single level
+
1210 ddt_header.entries = items_per_ddt_entry;
+
1211
+
1212 // Calculate data size
+
1213
+
1214 ddt_header.length = items_per_ddt_entry * sizeof(uint64_t);
+
1215
+
1216 // Calculate CRC64 of the data
+
1217 crc64_context = aaruf_crc64_init();
+
1218 if(crc64_context == NULL)
+
1219 {
+
1220 FATAL("Could not initialize CRC64.");
+
1221 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1222 return false;
+
1223 }
+
1224
+
1225 aaruf_crc64_update(crc64_context, (uint8_t *)ctx->cached_secondary_ddt2, (uint32_t)ddt_header.length);
+
1226
+
1227 aaruf_crc64_final(crc64_context, &crc64);
+
1228 ddt_header.crc64 = crc64;
+
1229
+
1230 uint8_t *cmp_buffer = NULL;
+
1231 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
1232
+
1233 if(ddt_header.compression == None)
+
1234 {
+
1235
+
1236 cmp_buffer = (uint8_t *)ctx->cached_secondary_ddt2;
+
1237 ddt_header.cmpCrc64 = ddt_header.crc64;
+
1238 }
+
1239 else
+
1240 {
+
1241 cmp_buffer = malloc((size_t)ddt_header.length * 2); // Allocate double size for compression
+
1242 if(cmp_buffer == NULL)
+
1243 {
+
1244 TRACE("Failed to allocate memory for secondary DDT v2 compression");
+ +
1246 }
+
1247
+
1248 size_t dst_size = (size_t)ddt_header.length * 2 * 2;
+
1249 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
1250 aaruf_lzma_encode_buffer(cmp_buffer, &dst_size, (uint8_t *)ctx->cached_secondary_ddt2,
+
1251 ddt_header.length, lzma_properties, &props_size, 9, ctx->lzma_dict_size, 4, 0,
+
1252 2, 273, 8);
+
1253
+
1254 ddt_header.cmpLength = (uint32_t)dst_size;
+
1255
+
1256 if(ddt_header.cmpLength >= ddt_header.length)
+
1257 {
+
1258 ddt_header.compression = None;
+
1259 free(cmp_buffer);
+
1260
+
1261 cmp_buffer = (uint8_t *)ctx->cached_secondary_ddt2;
+
1262 }
+
1263 }
+
1264
+
1265 if(ddt_header.compression == None)
+
1266 {
+
1267 ddt_header.cmpLength = ddt_header.length;
+
1268 ddt_header.cmpCrc64 = ddt_header.crc64;
+
1269 }
+
1270 else
+
1271 ddt_header.cmpCrc64 = aaruf_crc64_data(cmp_buffer, (uint32_t)ddt_header.cmpLength);
+
1272
+
1273 if(ddt_header.compression == Lzma) ddt_header.cmpLength += LZMA_PROPERTIES_LENGTH;
+
1274
+
1275 // Write header
+
1276 written_bytes = fwrite(&ddt_header, sizeof(DdtHeader2), 1, ctx->imageStream);
+
1277 if(written_bytes != 1)
+
1278 {
+
1279 FATAL("Could not write never-written DDT header to file.");
+
1280 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1281 return false;
+
1282 }
+
1283
+
1284 // Write data
+
1285 if(ddt_header.compression == Lzma) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
1286
+
1287 if(fwrite(cmp_buffer, ddt_header.cmpLength, 1, ctx->imageStream) != 1)
+
1288 {
+
1289 FATAL("Could not write never-written DDT data to file.");
+
1290 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1291 return false;
+
1292 }
+
1293
+
1294 if(ddt_header.compression == Lzma) free(cmp_buffer);
+
1295
+
1296 // Add index entry for the newly written secondary DDT
+
1297 IndexEntry new_ddt_entry;
+
1298 new_ddt_entry.blockType = DeDuplicationTableSecondary;
+
1299 new_ddt_entry.dataType = UserData;
+
1300 new_ddt_entry.offset = end_of_file;
+
1301
+
1302 utarray_push_back(ctx->index_entries, &new_ddt_entry);
+
1303 TRACE("Added new DDT index entry for never-written table at offset %" PRIu64, end_of_file);
+
1304
+
1305 // Update the primary level table entry to point to the new location of the secondary table
+
1306 uint64_t new_secondary_table_block_offset = end_of_file >> ctx->user_data_ddt_header.blockAlignmentShift;
+
1307
+
1308 ctx->user_data_ddt2[ctx->cached_ddt_position] = new_secondary_table_block_offset;
+
1309
+
1310 // Write the updated primary table back to its original position in the file
+
1311 long saved_pos = ftell(ctx->imageStream);
+
1312 fseek(ctx->imageStream, ctx->primary_ddt_offset + sizeof(DdtHeader2), SEEK_SET);
+
1313
+
1314 size_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint64_t);
+
1315
+
1316 written_bytes = fwrite(ctx->user_data_ddt2, primary_table_size, 1, ctx->imageStream);
+
1317
+
1318 if(written_bytes != 1)
+
1319 {
+
1320 FATAL("Could not flush primary DDT table to file after writing never-written secondary table.");
+
1321 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1322 return false;
+
1323 }
+
1324
+
1325 // Update nextBlockPosition to ensure future blocks don't overwrite the DDT
+
1326 uint64_t ddt_total_size = sizeof(DdtHeader2) + ddt_header.length;
+
1327 ctx->next_block_position = end_of_file + ddt_total_size + alignment_mask & ~alignment_mask;
+
1328 block_offset = ctx->next_block_position;
+
1329 offset = 0;
+
1330 TRACE("Updated nextBlockPosition after never-written DDT write to %" PRIu64, ctx->next_block_position);
+
1331
+
1332 // Free the cached table
+
1333
+
1334 free(ctx->cached_secondary_ddt2);
+
1335 ctx->cached_secondary_ddt2 = NULL;
+
1336
+
1337 // Reset cached values since we've written and freed the table
+
1338 ctx->cached_ddt_offset = 0;
+
1339 ctx->cached_ddt_position = 0;
+
1340
+
1341 // Restore file position
+
1342 fseek(ctx->imageStream, saved_pos, SEEK_SET);
+
1343
+
1344 TRACE("Successfully wrote never-written cached secondary DDT to disk");
+
1345 }
+
1346 else
+
1347 // The cached DDT is actually for the requested block range, so we can use it directly
+
1348 TRACE("Cached DDT is for the correct block range, using it directly");
+
1349 // No need to write to disk, just continue with the cached table
+
1350 }
+
1351
+
1352 // Step 3: Write the currently in-memory cached secondary level table to the end of the file
+
1353 if(ctx->cached_ddt_offset != 0)
+
1354 {
+
1355 long current_pos = 0;
+
1356 // Close the current data block first
+
1357 if(ctx->writing_buffer != NULL) aaruf_close_current_block(ctx);
+
1358
+
1359 // Get current position and seek to end of file
+
1360 current_pos = ftell(ctx->imageStream);
+
1361 fseek(ctx->imageStream, 0, SEEK_END);
+
1362 end_of_file = ftell(ctx->imageStream);
+
1363
+
1364 // Align to block boundary
+
1365 uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
+
1366 end_of_file = end_of_file + alignment_mask & ~alignment_mask;
+
1367 fseek(ctx->imageStream, end_of_file, SEEK_SET);
+
1368
+
1369 // Prepare DDT header for the cached table
+
1370 memset(&ddt_header, 0, sizeof(DdtHeader2));
+ +
1372 ddt_header.type = UserData;
+
1373 ddt_header.compression = ctx->compression_enabled ? Lzma : None;
+
1374 ddt_header.levels = ctx->user_data_ddt_header.levels;
+
1375 ddt_header.tableLevel = ctx->user_data_ddt_header.tableLevel + 1;
+
1376 ddt_header.previousLevelOffset = ctx->primary_ddt_offset; // Set to primary DDT table location
+
1377 ddt_header.negative = ctx->user_data_ddt_header.negative;
+
1378 ddt_header.blocks = items_per_ddt_entry;
+
1379 ddt_header.overflow = ctx->user_data_ddt_header.overflow;
+
1380 ddt_header.start = ddt_position * items_per_ddt_entry; // First block this DDT table references
+ +
1382 ddt_header.dataShift = ctx->user_data_ddt_header.dataShift;
+
1383 ddt_header.tableShift = 0; // Secondary tables are single level
+
1384 ddt_header.entries = items_per_ddt_entry;
+
1385
+
1386 // Calculate data size
+
1387
+
1388 ddt_header.length = items_per_ddt_entry * sizeof(uint64_t);
+
1389
+
1390 // Calculate CRC64 of the data
+
1391 crc64_context = aaruf_crc64_init();
+
1392 if(crc64_context == NULL)
+
1393 {
+
1394 FATAL("Could not initialize CRC64.");
+
1395 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1396 return false;
+
1397 }
+
1398
+
1399 aaruf_crc64_update(crc64_context, (uint8_t *)ctx->cached_secondary_ddt2, ddt_header.length);
+
1400
+
1401 aaruf_crc64_final(crc64_context, &crc64);
+
1402 ddt_header.crc64 = crc64;
+
1403
+
1404 uint8_t *cmp_buffer = NULL;
+
1405 uint8_t lzma_properties[LZMA_PROPERTIES_LENGTH] = {0};
+
1406
+
1407 if(ddt_header.compression == None)
+
1408 {
+
1409
+
1410 cmp_buffer = (uint8_t *)ctx->cached_secondary_ddt2;
+
1411 ddt_header.cmpCrc64 = ddt_header.crc64;
+
1412 }
+
1413 else
+
1414 {
+
1415 cmp_buffer = malloc((size_t)ddt_header.length * 2); // Allocate double size for compression
+
1416 if(cmp_buffer == NULL)
+
1417 {
+
1418 TRACE("Failed to allocate memory for secondary DDT v2 compression");
+ +
1420 }
+
1421
+
1422 size_t dst_size = (size_t)ddt_header.length * 2 * 2;
+
1423 size_t props_size = LZMA_PROPERTIES_LENGTH;
+
1424 aaruf_lzma_encode_buffer(cmp_buffer, &dst_size, (uint8_t *)ctx->cached_secondary_ddt2, ddt_header.length,
+
1425 lzma_properties, &props_size, 9, ctx->lzma_dict_size, 4, 0, 2, 273, 8);
+
1426
+
1427 ddt_header.cmpLength = (uint32_t)dst_size;
+
1428
+
1429 if(ddt_header.cmpLength >= ddt_header.length)
+
1430 {
+
1431 ddt_header.compression = None;
+
1432 free(cmp_buffer);
+
1433
+
1434 cmp_buffer = (uint8_t *)ctx->cached_secondary_ddt2;
+
1435 }
+
1436 }
+
1437
+
1438 if(ddt_header.compression == None)
+
1439 {
+
1440 ddt_header.cmpLength = ddt_header.length;
+
1441 ddt_header.cmpCrc64 = ddt_header.crc64;
+
1442 }
+
1443 else
+
1444 ddt_header.cmpCrc64 = aaruf_crc64_data(cmp_buffer, (uint32_t)ddt_header.cmpLength);
+
1445
+
1446 if(ddt_header.compression == Lzma) ddt_header.cmpLength += LZMA_PROPERTIES_LENGTH;
+
1447
+
1448 // Write header
+
1449 if(ddt_header.compression == Lzma) fwrite(lzma_properties, LZMA_PROPERTIES_LENGTH, 1, ctx->imageStream);
+
1450
+
1451 written_bytes = fwrite(&ddt_header, sizeof(DdtHeader2), 1, ctx->imageStream);
+
1452 if(written_bytes != 1)
+
1453 {
+
1454 FATAL("Could not write DDT header to file.");
+
1455 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1456 return false;
+
1457 }
+
1458
+
1459 // Write data
+
1460 written_bytes = fwrite(cmp_buffer, ddt_header.cmpLength, 1, ctx->imageStream);
+
1461
+
1462 if(written_bytes != 1)
+
1463 {
+
1464 FATAL("Could not write DDT data to file.");
+
1465 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1466 return false;
+
1467 }
+
1468
+
1469 if(ddt_header.compression == Lzma) free(cmp_buffer);
+
1470
+
1471 // Update index: remove old entry and add new one for the evicted secondary DDT
+
1472 TRACE("Updating index for evicted secondary DDT");
+
1473
+
1474 // Remove old index entry for the cached DDT
+
1475 if(ctx->cached_ddt_offset != 0)
+
1476 {
+
1477 TRACE("Removing old index entry for DDT at offset %" PRIu64, ctx->cached_ddt_offset);
+
1478 IndexEntry *entry = NULL;
+
1479
+
1480 // Find and remove the old index entry
+
1481 for(unsigned int i = 0; i < utarray_len(ctx->index_entries); i++)
+
1482 {
+
1483 entry = (IndexEntry *)utarray_eltptr(ctx->index_entries, i);
+
1484 if(entry && entry->offset == ctx->cached_ddt_offset && entry->blockType == DeDuplicationTableSecondary)
+
1485 {
+
1486 TRACE("Found old DDT index entry at position %u, removing", i);
+
1487 utarray_erase(ctx->index_entries, i, 1);
+
1488 break;
+
1489 }
+
1490 }
+
1491 }
+
1492
+
1493 // Add new index entry for the newly written secondary DDT
+
1494 IndexEntry new_ddt_entry;
+
1495 new_ddt_entry.blockType = DeDuplicationTableSecondary;
+
1496 new_ddt_entry.dataType = UserData;
+
1497 new_ddt_entry.offset = end_of_file;
+
1498
+
1499 utarray_push_back(ctx->index_entries, &new_ddt_entry);
+
1500 TRACE("Added new DDT index entry at offset %" PRIu64, end_of_file);
+
1501
+
1502 // Step 4: Update the primary level table entry and flush it back to file
+
1503 uint64_t new_secondary_table_block_offset = end_of_file >> ctx->user_data_ddt_header.blockAlignmentShift;
+
1504
+
1505 // Update the primary table entry to point to the new location of the secondary table
+
1506 // Use ddtPosition which was calculated from sectorAddress, not cachedDdtOffset
+
1507
+
1508 ctx->user_data_ddt2[ddt_position] = new_secondary_table_block_offset;
+
1509
+
1510 // Write the updated primary table back to its original position in the file
+
1511 long saved_pos = ftell(ctx->imageStream);
+
1512 fseek(ctx->imageStream, ctx->primary_ddt_offset + sizeof(DdtHeader2), SEEK_SET);
+
1513
+
1514 size_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint64_t);
+
1515
+
1516 written_bytes = fwrite(ctx->user_data_ddt2, primary_table_size, 1, ctx->imageStream);
+
1517
+
1518 if(written_bytes != 1)
+
1519 {
+
1520 FATAL("Could not flush primary DDT table to file.");
+
1521 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1522 return false;
+
1523 }
+
1524
+
1525 // Update nextBlockPosition to ensure future blocks don't overwrite the DDT
+
1526 uint64_t ddt_total_size = sizeof(DdtHeader2) + ddt_header.length;
+
1527 ctx->next_block_position = end_of_file + ddt_total_size + alignment_mask & ~alignment_mask;
+
1528 block_offset = ctx->next_block_position;
+
1529 offset = 0;
+
1530 TRACE("Updated nextBlockPosition after DDT write to %" PRIu64, ctx->next_block_position);
+
1531
+
1532 fseek(ctx->imageStream, saved_pos, SEEK_SET);
+
1533
+
1534 // Free the cached table
+
1535
+
1536 free(ctx->cached_secondary_ddt2);
+
1537 ctx->cached_secondary_ddt2 = NULL;
+
1538
+
1539 // Restore file position
+
1540 fseek(ctx->imageStream, current_pos, SEEK_SET);
+
1541 }
+
1542
+
1543 // Step 5: Check if the specified block already has an existing secondary level table
+
1544 create_new_table = ctx->cached_secondary_ddt2 == NULL;
+
1545
+
1546 if(!create_new_table && secondary_ddt_offset != 0)
+
1547 {
+
1548 // Load existing table
+
1549 fseek(ctx->imageStream, secondary_ddt_offset, SEEK_SET);
+
1550 size_t read_bytes = fread(&ddt_header, 1, sizeof(DdtHeader2), ctx->imageStream);
+
1551
+
1552 if(read_bytes != sizeof(DdtHeader2) || ddt_header.identifier != DeDuplicationTable2 ||
+
1553 ddt_header.type != UserData)
+
1554 {
+
1555 FATAL("Invalid secondary DDT header at %" PRIu64, secondary_ddt_offset);
+
1556 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1557 return false;
+
1558 }
+
1559
+
1560 // Read the table data (assuming no compression for now)
+
1561 buffer = malloc(ddt_header.length);
+
1562 if(buffer == NULL)
+
1563 {
+
1564 FATAL("Cannot allocate memory for secondary DDT.");
+
1565 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1566 return false;
+
1567 }
+
1568
+
1569 read_bytes = fread(buffer, 1, ddt_header.length, ctx->imageStream);
+
1570 if(read_bytes != ddt_header.length)
+
1571 {
+
1572 FATAL("Could not read secondary DDT data.");
+
1573 free(buffer);
+
1574 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1575 return false;
+
1576 }
+
1577
+
1578 // Verify CRC
+
1579 crc64_context = aaruf_crc64_init();
+
1580 if(crc64_context == NULL)
+
1581 {
+
1582 FATAL("Could not initialize CRC64.");
+
1583 free(buffer);
+
1584 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1585 return false;
+
1586 }
+
1587
+
1588 aaruf_crc64_update(crc64_context, buffer, read_bytes);
+
1589 aaruf_crc64_final(crc64_context, &crc64);
+
1590
+
1591 if(crc64 != ddt_header.crc64)
+
1592 {
+
1593 FATAL("Secondary DDT CRC mismatch. Expected 0x%16lX but got 0x%16lX.", ddt_header.crc64, crc64);
+
1594 free(buffer);
+
1595 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1596 return false;
+
1597 }
+
1598
+
1599 // Cache the loaded table
+
1600
+
1601 ctx->cached_secondary_ddt2 = (uint64_t *)buffer;
+
1602
+
1603 ctx->cached_ddt_offset = secondary_ddt_offset;
+
1604 }
+
1605
+
1606 if(create_new_table)
+
1607 {
+
1608 // Create a new empty table
+
1609 size_t table_size = items_per_ddt_entry * sizeof(uint64_t);
+
1610
+
1611 buffer = calloc(1, table_size);
+
1612 if(buffer == NULL)
+
1613 {
+
1614 FATAL("Cannot allocate memory for new secondary DDT.");
+
1615 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1616 return false;
+
1617 }
+
1618
+
1619 ctx->cached_secondary_ddt2 = (uint64_t *)buffer;
+
1620
+
1621 ctx->cached_ddt_offset = 0; // Will be set when written to file
+
1622 ctx->cached_ddt_position = ddt_position; // Track which primary DDT position this new table belongs to
+
1623 TRACE("Created new secondary DDT for position %" PRIu64, ddt_position);
+
1624 }
+
1625
+
1626 // Step 6: Update the corresponding DDT entry
+
1627 if(*ddt_entry == 0)
+
1628 {
+
1629 block_index = block_offset >> ctx->user_data_ddt_header.blockAlignmentShift;
+
1630 *ddt_entry = offset & (1ULL << ctx->user_data_ddt_header.dataShift) - 1 |
+
1631 block_index << ctx->user_data_ddt_header.dataShift;
+
1632
+
1633 // Overflow detection for DDT entry
+
1634 if(*ddt_entry > 0xFFFFFFFFFFFFFFF)
+
1635 {
+
1636 FATAL("DDT overflow: media does not fit in big DDT");
+
1637 TRACE("Exiting set_ddt_multi_level_v2() = false");
+
1638 return false;
+
1639 }
+
1640
+
1641 *ddt_entry |= (uint64_t)sector_status << 60;
+
1642 }
+
1643
+
1644 TRACE("Setting big secondary DDT entry %d to %ull", sector_address % items_per_ddt_entry, (uint64_t)*ddt_entry);
+
1645 ctx->cached_secondary_ddt2[sector_address % items_per_ddt_entry] = *ddt_entry;
+
1646
+
1647 TRACE("Updated secondary DDT entry at position %" PRIu64, sector_address % items_per_ddt_entry);
+
1648 TRACE("Exiting set_ddt_multi_level_v2() = true");
+
1649 return true;
+
1650}
+
+
1651
+
+
1768bool set_ddt_tape(aaruformat_context *ctx, uint64_t sector_address, const uint64_t offset, const uint64_t block_offset,
+
1769 const uint8_t sector_status, uint64_t *ddt_entry)
+
1770{
+
1771 TRACE("Entering set_ddt_tape(%p, %" PRIu64 ", %llu, %llu, %d)", ctx, sector_address, offset, block_offset,
+
1772 sector_status);
+
1773
+
1774 // Check if the context and image stream are valid
+
1775 if(ctx == NULL || ctx->imageStream == NULL)
+
1776 {
+
1777 FATAL("Invalid context or image stream.");
+
1778 TRACE("Exiting set_ddt_tape() = false");
+
1779 return false;
+
1780 }
+
1781
+
1782 // Should not really be here
+
1783 if(!ctx->is_tape)
+
1784 {
+
1785 FATAL("Image is not tape, wrong function called.");
+
1786 TRACE("Exiting set_ddt_tape() = false");
+
1787 return false;
+
1788 }
+
1789
+
1790 if(*ddt_entry == 0)
+
1791 {
+
1792 const uint64_t block_index = block_offset >> ctx->user_data_ddt_header.blockAlignmentShift;
+
1793 *ddt_entry = offset & (1ULL << ctx->user_data_ddt_header.dataShift) - 1 |
+
1794 block_index << ctx->user_data_ddt_header.dataShift;
+
1795 // Overflow detection for DDT entry
+
1796 if(*ddt_entry > 0xFFFFFFFFFFFFFFF)
+
1797 {
+
1798 FATAL("DDT overflow: media does not fit in big DDT");
+
1799 TRACE("Exiting set_ddt_tape() = false");
+
1800 return false;
+
1801 }
+
1802
+
1803 *ddt_entry |= (uint64_t)sector_status << 60;
+
1804 }
+
1805
+
1806 // Create DDT hash entry
+
1807 TapeDdtHashEntry *new_entry = calloc(1, sizeof(TapeDdtHashEntry));
+
1808 TapeDdtHashEntry *old_entry = NULL;
+
1809 if(new_entry == NULL)
+
1810 {
+
1811 FATAL("Cannot allocate memory for new tape DDT hash entry.");
+
1812 TRACE("Exiting set_ddt_tape() = false");
+
1813 return false;
+
1814 }
+
1815
+
1816 TRACE("Setting tape DDT entry %d to %u", sector_address, (uint32_t)*ddt_entry);
+
1817
+
1818 new_entry->key = sector_address;
+
1819 new_entry->value = *ddt_entry;
+
1820
+
1821 // Insert entry into tape DDT
+
1822 HASH_REPLACE(hh, ctx->tape_ddt, key, sizeof(uint64_t), new_entry, old_entry);
+
1823 if(old_entry) free(old_entry);
+
1824
+
1825 TRACE("Exiting set_ddt_tape() = true");
+
1826 return true;
+
1827}
+
+ +
#define LZMA_PROPERTIES_LENGTH
Size in bytes of the fixed LZMA properties header (lc/lp/pb + dictionary size).
Definition consts.h:82
+
int32_t process_ddt_v2(aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt)
Processes a DDT v2 block from the image stream.
Definition ddt_v2.c:96
+
bool set_ddt_tape(aaruformat_context *ctx, uint64_t sector_address, const uint64_t offset, const uint64_t block_offset, const uint8_t sector_status, uint64_t *ddt_entry)
Sets a DDT entry for tape media using a hash-based lookup table.
Definition ddt_v2.c:1768
+
int32_t decode_ddt_single_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
Decodes a single-level DDT v2 entry for a given sector address.
Definition ddt_v2.c:581
+
bool set_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
Sets a multi-level DDT v2 entry for a given sector address.
Definition ddt_v2.c:1092
+
int32_t decode_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
Decodes a multi-level DDT v2 entry for a given sector address.
Definition ddt_v2.c:724
+
bool set_ddt_single_level_v2(aaruformat_context *ctx, uint64_t sector_address, const bool negative, const uint64_t offset, const uint64_t block_offset, const uint8_t sector_status, uint64_t *ddt_entry)
Sets a single-level DDT v2 entry for a given sector address.
Definition ddt_v2.c:1023
+
bool set_ddt_entry_v2(aaruformat_context *ctx, const uint64_t sector_address, bool negative, const uint64_t offset, const uint64_t block_offset, const uint8_t sector_status, uint64_t *ddt_entry)
Sets a DDT v2 entry for a given sector address.
Definition ddt_v2.c:988
+
int32_t decode_ddt_entry_v2(aaruformat_context *ctx, const uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
Decodes a DDT v2 entry for a given sector address.
Definition ddt_v2.c:507
+
int32_t aaruf_lzma_encode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, size_t src_size, uint8_t *out_props, size_t *out_props_size, int32_t level, uint32_t dict_size, int32_t lc, int32_t lp, int32_t pb, int32_t fb, int32_t num_threads)
Encodes a buffer using LZMA compression.
Definition lzma.c:65
+
uint64_t aaruf_crc64_data(const uint8_t *data, uint32_t len)
Definition crc64.c:160
+
int32_t aaruf_lzma_decode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, size_t *src_size, const uint8_t *props, size_t props_size)
Decodes an LZMA-compressed buffer.
Definition lzma.c:39
+
int aaruf_crc64_update(crc64_ctx *ctx, const uint8_t *data, uint32_t len)
Updates the CRC64 context with new data.
Definition crc64.c:55
+
crc64_ctx * aaruf_crc64_init()
Initializes a CRC64 context.
Definition crc64.c:32
+
int aaruf_crc64_final(crc64_ctx *ctx, uint64_t *crc)
Computes the final CRC64 value from the context.
Definition crc64.c:141
+
@ DeDuplicationTableSecondary
Block containing a secondary deduplication table (v2).
Definition enums.h:144
+
@ DeDuplicationTable2
Block containing a deduplication table v2.
Definition enums.h:143
+
@ SectorStatusNotDumped
Sector(s) not yet acquired during image dumping.
Definition enums.h:230
+
@ CdSectorPrefix
Compact Disc sector prefix (sync, header).
Definition enums.h:114
+
@ UserData
User (main) data.
Definition enums.h:46
+
@ CdSectorSuffix
Compact Disc sector suffix (EDC, ECC P, ECC Q).
Definition enums.h:115
+
@ Lzma
LZMA compression.
Definition enums.h:34
+
@ None
Not compressed.
Definition enums.h:33
+
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
Definition errors.h:75
+
#define AARUF_ERROR_NOT_ENOUGH_MEMORY
Memory allocation failure (critical).
Definition errors.h:48
+
#define AARUF_ERROR_CANNOT_READ_BLOCK
Generic block read failure (seek/read error).
Definition errors.h:46
+
#define AARUF_ERROR_INVALID_BLOCK_CRC
CRC64 mismatch indicating corruption.
Definition errors.h:57
+
#define AARUF_ERROR_NOT_AARUFORMAT
Input file/stream failed magic or structural validation.
Definition errors.h:40
+
#define AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK
Decompression routine failed or size mismatch.
Definition errors.h:56
+ +
int32_t aaruf_close_current_block(aaruformat_context *ctx)
Finalizes and writes the current data block to the AaruFormat image file.
Definition write.c:1383
+ +
#define FATAL(fmt,...)
Definition log.h:40
+
#define TRACE(fmt,...)
Definition log.h:25
+
Header preceding a version 2 hierarchical deduplication table.
Definition ddt.h:142
+
uint64_t cmpCrc64
CRC64-ECMA of compressed table payload.
Definition ddt.h:161
+
uint16_t type
Data classification (DataType) for sectors referenced by this table.
Definition ddt.h:144
+
uint64_t start
Base internal index covered by this table (used for secondary tables; currently informational).
Definition ddt.h:153
+
uint16_t overflow
Trailing dumped sectors beyond user area (overflow range), still mapped with entries.
Definition ddt.h:151
+
uint64_t crc64
CRC64-ECMA of uncompressed table payload.
Definition ddt.h:162
+
uint64_t entries
Number of entries contained in (uncompressed) table payload.
Definition ddt.h:158
+
uint8_t levels
Total number of hierarchy levels (root depth); > 0.
Definition ddt.h:146
+
uint64_t length
Uncompressed payload size in bytes.
Definition ddt.h:160
+
uint32_t identifier
Block identifier, must be BlockType::DeDuplicationTable2.
Definition ddt.h:143
+
uint8_t tableShift
2^tableShift = number of logical sectors per primary entry (multi-level only; 0 for single-level or s...
Definition ddt.h:156
+
uint64_t blocks
Total internal span (negative + usable + overflow) in logical sectors.
Definition ddt.h:150
+
uint16_t negative
Leading negative LBA count; added to external L to build internal index.
Definition ddt.h:149
+
uint8_t blockAlignmentShift
2^blockAlignmentShift = block alignment boundary in bytes.
Definition ddt.h:154
+
uint8_t tableLevel
Zero-based level index of this table (0 = root, increases downward).
Definition ddt.h:147
+
uint16_t compression
Compression algorithm for this table body (CompressionType).
Definition ddt.h:145
+
uint8_t dataShift
2^dataShift = sectors represented per increment in blockIndex field.
Definition ddt.h:155
+
uint64_t cmpLength
Compressed payload size in bytes.
Definition ddt.h:159
+
uint64_t previousLevelOffset
Absolute byte offset of the parent (previous) level table; 0 if root.
Definition ddt.h:148
+
uint64_t ImageSize
Size of the image payload in bytes (excludes headers/metadata)
Definition aaru.h:873
+
uint64_t Sectors
Total count of addressable logical sectors/blocks.
Definition aaru.h:874
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
uint32_t blockType
Block identifier of the referenced block (value from BlockType).
Definition index.h:110
+
uint64_t offset
Absolute byte offset in the image where the referenced block header begins.
Definition index.h:112
+
uint16_t dataType
Data classification (value from DataType) or unused for untyped blocks.
Definition index.h:111
+ +
uint64_t key
Key: sector address.
Definition context.h:142
+
uint64_t value
Value: DDT entry.
Definition context.h:143
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
DdtHeader2 user_data_ddt_header
Active user data DDT v2 header (primary table meta).
Definition context.h:189
+
bool compression_enabled
True if block compression enabled (writing path).
Definition context.h:299
+
uint64_t * user_data_ddt2
DDT entries (big variant) primary/secondary current.
Definition context.h:187
+
uint64_t * sector_suffix_ddt2
CD sector suffix DDT V2.
Definition context.h:186
+
uint64_t cached_ddt_offset
File offset of currently cached secondary DDT (0=none).
Definition context.h:190
+
bool is_tape
True if the image is a tape image.
Definition context.h:304
+
bool in_memory_ddt
True if primary (and possibly secondary) DDT loaded.
Definition context.h:196
+
TapeDdtHashEntry * tape_ddt
Hash table root for tape DDT entries.
Definition context.h:182
+
int ddt_version
DDT version in use (1=legacy, 2=v2 hierarchical).
Definition context.h:194
+
uint8_t * writing_buffer
Accumulation buffer for current block data.
Definition context.h:280
+
uint64_t * sector_prefix_ddt2
CD sector prefix DDT V2.
Definition context.h:185
+
uint64_t primary_ddt_offset
File offset of the primary DDT v2 table.
Definition context.h:192
+
uint64_t next_block_position
Absolute file offset where next block will be written.
Definition context.h:282
+
uint64_t * cached_secondary_ddt2
Cached secondary table (big entries) or NULL.
Definition context.h:188
+
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
+
UT_array * index_entries
Flattened index entries (UT_array of IndexEntry).
Definition context.h:252
+
ImageInfo image_info
Exposed high-level image info summary.
Definition context.h:260
+
uint32_t lzma_dict_size
LZMA dictionary size (writing path).
Definition context.h:297
+
uint64_t cached_ddt_position
Position index of cached secondary DDT.
Definition context.h:191
+
Minimal ECMA-182 CRC64 incremental state container (running value only).
Definition crc64.h:56
+
+
+
+ + + + diff --git a/docs/html/decls_8h.html b/docs/html/decls_8h.html new file mode 100644 index 0000000..fd921cb --- /dev/null +++ b/docs/html/decls_8h.html @@ -0,0 +1,8858 @@ + + + + + + + +libaaruformat: include/aaruformat/decls.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
decls.h File Reference
+
+
+
#include "aaru.h"
+#include "crc64.h"
+#include "md5.h"
+#include "sha1.h"
+#include "sha256.h"
+#include "simd.h"
+#include "spamsum.h"
+#include "structs/optical.h"
+
+

Go to the source code of this file.

+ + + + + + + +

+Macros

#define EXTERNC
#define AARU_CALL
#define AARU_EXPORT   EXTERNC
#define AARU_LOCAL
#define FORCE_INLINE   static inline __attribute__((always_inline))
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

int aaruf_identify (const char *filename)
 Identifies a file as an AaruFormat image using a file path.
int aaruf_identify_stream (FILE *image_stream)
 Identifies a file as an AaruFormat image using an open stream.
void * aaruf_open (const char *filepath)
 Opens an existing AaruFormat image file.
void * aaruf_create (const char *filepath, uint32_t media_type, uint32_t sector_size, uint64_t user_sectors, uint64_t negative_sectors, uint64_t overflow_sectors, const char *options, const uint8_t *application_name, uint8_t application_name_length, uint8_t application_major_version, uint8_t application_minor_version, bool is_tape)
 Creates a new AaruFormat image file.
int aaruf_close (void *context)
 Close an Aaru image context, flushing pending data structures and releasing resources.
int32_t aaruf_read_media_tag (void *context, uint8_t *data, int32_t tag, uint32_t *length)
 Reads a media tag from the AaruFormat image.
crc64_ctxaaruf_crc64_init ()
 Initializes a CRC64 context.
int aaruf_crc64_update (crc64_ctx *ctx, const uint8_t *data, uint32_t len)
 Updates the CRC64 context with new data.
int aaruf_crc64_final (crc64_ctx *ctx, uint64_t *crc)
 Computes the final CRC64 value from the context.
void aaruf_crc64_free (crc64_ctx *ctx)
 Frees a CRC64 context.
void aaruf_crc64_slicing (uint64_t *previous_crc, const uint8_t *data, uint32_t len)
 Updates a CRC64 value using the slicing-by-8 algorithm.
uint64_t aaruf_crc64_data (const uint8_t *data, uint32_t len)
int32_t aaruf_get_tracks (const void *context, uint8_t *buffer, size_t *length)
 Retrieve the array of track descriptors contained in an opened AaruFormat image.
int32_t aaruf_set_tracks (void *context, TrackEntry *tracks, const int count)
 Replace (or clear) the in-memory track table for an AaruFormat image context.
int32_t aaruf_read_sector (void *context, uint64_t sector_address, bool negative, uint8_t *data, uint32_t *length)
 Reads a sector from the AaruFormat image.
int32_t aaruf_read_sector_long (void *context, uint64_t sector_address, bool negative, uint8_t *data, uint32_t *length)
 Reads a complete sector with all metadata from the AaruFormat image.
int32_t aaruf_write_sector (void *context, uint64_t sector_address, bool negative, const uint8_t *data, uint8_t sector_status, uint32_t length)
 Writes a sector to the AaruFormat image.
int32_t aaruf_write_sector_long (void *context, uint64_t sector_address, bool negative, const uint8_t *data, uint8_t sector_status, uint32_t length)
 Writes a full ("long") raw sector from optical or block media, parsing structure and validating content.
int32_t aaruf_write_media_tag (void *context, const uint8_t *data, int32_t type, uint32_t length)
 Writes a media tag to the AaruFormat image, storing medium-specific metadata and descriptors.
int32_t aaruf_write_sector_tag (void *context, uint64_t sector_address, bool negative, const uint8_t *data, size_t length, int32_t tag)
 Writes per-sector tag data (auxiliary metadata) for a specific sector.
int32_t aaruf_verify_image (void *context)
 Verifies the integrity of an AaruFormat image file.
int32_t aaruf_cst_transform (const uint8_t *interleaved, uint8_t *sequential, size_t length)
 Transforms interleaved subchannel data to sequential format.
int32_t aaruf_cst_untransform (const uint8_t *sequential, uint8_t *interleaved, size_t length)
 Reverses the CST (Claunia's Subchannel Transform) transformation from sequential to interleaved data.
void * aaruf_ecc_cd_init ()
 Initializes a Compact Disc ECC context.
bool aaruf_ecc_cd_is_suffix_correct (void *context, const uint8_t *sector)
 Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 1).
bool aaruf_ecc_cd_is_suffix_correct_mode2 (void *context, const uint8_t *sector)
 Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 2).
bool aaruf_ecc_cd_check (void *context, const uint8_t *address, const uint8_t *data, uint32_t major_count, uint32_t minor_count, uint32_t major_mult, uint32_t minor_inc, const uint8_t *ecc, int32_t address_offset, int32_t data_offset, int32_t ecc_offset)
 Checks the ECC of a CD sector.
void aaruf_ecc_cd_write (void *context, const uint8_t *address, const uint8_t *data, uint32_t major_count, uint32_t minor_count, uint32_t major_mult, uint32_t minor_inc, uint8_t *ecc, int32_t address_offset, int32_t data_offset, int32_t ecc_offset)
 Writes ECC for a CD sector.
void aaruf_ecc_cd_write_sector (void *context, const uint8_t *address, const uint8_t *data, uint8_t *ecc, int32_t address_offset, int32_t data_offset, int32_t ecc_offset)
 Writes ECC for a full CD sector (both P and Q ECC).
void aaruf_cd_lba_to_msf (int64_t pos, uint8_t *minute, uint8_t *second, uint8_t *frame)
 Converts a CD LBA (Logical Block Address) to MSF (Minute:Second:Frame) format.
void aaruf_ecc_cd_reconstruct_prefix (uint8_t *sector, uint8_t type, int64_t lba)
 Reconstructs the prefix (sync, address, mode) of a CD sector.
void aaruf_ecc_cd_reconstruct (void *context, uint8_t *sector, uint8_t type)
 Reconstructs the EDC and ECC fields of a CD sector.
uint32_t aaruf_edc_cd_compute (void *context, uint32_t edc, const uint8_t *src, int size, int pos)
 Computes the EDC (Error Detection Code) for a CD sector.
int32_t aaruf_read_track_sector (void *context, uint8_t *data, uint64_t sector_address, uint32_t *length, uint8_t track)
 Reads a sector from a specific track in the AaruFormat image.
int32_t aaruf_read_sector_tag (const void *context, uint64_t sector_address, bool negative, uint8_t *buffer, uint32_t *length, int32_t tag)
 Reads a specific sector tag from the AaruFormat image.
int32_t aaruf_get_media_tag_type_for_datatype (int32_t type)
 Converts an image data type to an Aaru media tag type.
int32_t aaruf_get_datatype_for_media_tag_type (int32_t tag_type)
 Converts an Aaru media tag type to an image data type.
int32_t aaruf_get_xml_mediatype (int32_t type)
int32_t aaruf_get_geometry (const void *context, uint32_t *cylinders, uint32_t *heads, uint32_t *sectors_per_track)
 Retrieves the logical CHS geometry from the AaruFormat image.
int32_t aaruf_set_geometry (void *context, uint32_t cylinders, uint32_t heads, uint32_t sectors_per_track)
 Sets the logical CHS geometry for the AaruFormat image.
int32_t aaruf_set_media_sequence (void *context, int32_t sequence, int32_t last_sequence)
 Sets the media sequence information for multi-volume media sets.
int32_t aaruf_set_creator (void *context, const uint8_t *data, int32_t length)
 Sets the creator (person/operator) information for the image.
int32_t aaruf_set_comments (void *context, const uint8_t *data, int32_t length)
 Sets user comments or notes for the image.
int32_t aaruf_set_media_title (void *context, const uint8_t *data, int32_t length)
 Sets the media title or label for the image.
int32_t aaruf_set_media_manufacturer (void *context, const uint8_t *data, int32_t length)
 Sets the media manufacturer information for the image.
int32_t aaruf_set_media_model (void *context, const uint8_t *data, int32_t length)
 Sets the media model or product designation for the image.
int32_t aaruf_set_media_serial_number (void *context, const uint8_t *data, int32_t length)
 Sets the media serial number for the image.
int32_t aaruf_set_media_barcode (void *context, const uint8_t *data, int32_t length)
 Sets the media barcode information for the image.
int32_t aaruf_set_media_part_number (void *context, const uint8_t *data, int32_t length)
 Sets the media part number or model designation for the image.
int32_t aaruf_set_drive_manufacturer (void *context, const uint8_t *data, int32_t length)
 Sets the drive manufacturer information for the image.
int32_t aaruf_set_drive_model (void *context, const uint8_t *data, int32_t length)
 Sets the drive model information for the image.
int32_t aaruf_set_drive_serial_number (void *context, const uint8_t *data, int32_t length)
 Sets the drive serial number for the image.
int32_t aaruf_set_drive_firmware_revision (void *context, const uint8_t *data, int32_t length)
 Sets the drive firmware revision for the image.
int32_t aaruf_get_media_sequence (const void *context, int32_t *sequence, int32_t *last_sequence)
 Retrieves the media sequence metadata for multi-volume image sets.
int32_t aaruf_get_creator (const void *context, uint8_t *buffer, int32_t *length)
 Retrieves the recorded creator (operator) name from the MetadataBlock.
int32_t aaruf_get_comments (const void *context, uint8_t *buffer, int32_t *length)
 Retrieves the user comments or notes stored in the MetadataBlock.
int32_t aaruf_get_media_title (const void *context, uint8_t *buffer, int32_t *length)
 Retrieves the media title or label captured during image creation.
int32_t aaruf_get_media_manufacturer (const void *context, uint8_t *buffer, int32_t *length)
 Retrieves the recorded media manufacturer name.
int32_t aaruf_get_media_model (const void *context, uint8_t *buffer, int32_t *length)
 Retrieves the media model or product designation metadata.
int32_t aaruf_get_media_serial_number (const void *context, uint8_t *buffer, int32_t *length)
 Retrieves the media serial number recorded in the image metadata.
int32_t aaruf_get_media_barcode (const void *context, uint8_t *buffer, int32_t *length)
 Retrieves the barcode assigned to the physical media or its packaging.
int32_t aaruf_get_media_part_number (const void *context, uint8_t *buffer, int32_t *length)
 Retrieves the media part number recorded in the MetadataBlock.
int32_t aaruf_get_drive_manufacturer (const void *context, uint8_t *buffer, int32_t *length)
 Retrieves the drive manufacturer metadata captured during imaging.
int32_t aaruf_get_drive_model (const void *context, uint8_t *buffer, int32_t *length)
 Retrieves the device model information for the imaging drive.
int32_t aaruf_get_drive_serial_number (const void *context, uint8_t *buffer, int32_t *length)
 Retrieves the imaging drive's serial number metadata.
int32_t aaruf_get_drive_firmware_revision (const void *context, uint8_t *buffer, int32_t *length)
 Retrieves the firmware revision metadata for the imaging drive.
int32_t aaruf_get_cicm_metadata (const void *context, uint8_t *buffer, size_t *length)
 Retrieves the embedded CICM XML metadata sidecar from the image.
int32_t aaruf_get_aaru_json_metadata (const void *context, uint8_t *buffer, size_t *length)
 Retrieves the embedded Aaru metadata JSON from the image.
int32_t aaruf_set_aaru_json_metadata (void *context, uint8_t *data, size_t length)
 Sets the Aaru metadata JSON for the image during creation.
int32_t aaruf_get_user_sectors (const void *context, uint64_t *sectors)
 Retrieves the total number of user-accessible sectors in the AaruFormat image.
int32_t aaruf_get_negative_sectors (const void *context, uint16_t *sectors)
 Retrieves the number of negative (pre-gap) sectors in the AaruFormat image.
int32_t aaruf_get_overflow_sectors (const void *context, uint16_t *sectors)
 Retrieves the number of overflow (post-gap) sectors in the AaruFormat image.
int32_t aaruf_get_image_info (const void *context, ImageInfo *image_info)
 Retrieves a deep copy of the ImageInfo structure from the AaruFormat image.
int32_t aaruf_get_tape_file (const void *context, uint8_t partition, uint32_t file, uint64_t *starting_block, uint64_t *ending_block)
 Retrieves the block range for a specific tape file from an Aaru tape image.
int32_t aaruf_set_tape_file (void *context, uint8_t partition, uint32_t file, uint64_t starting_block, uint64_t ending_block)
 Sets or updates the block range for a specific tape file in an Aaru tape image.
int32_t aaruf_get_tape_partition (const void *context, uint8_t partition, uint64_t *starting_block, uint64_t *ending_block)
 Retrieves the block range for a specific tape partition from an Aaru tape image.
int32_t aaruf_set_tape_partition (void *context, uint8_t partition, uint64_t starting_block, uint64_t ending_block)
 Sets or updates the block range for a specific tape partition in an Aaru tape image.
int32_t aaruf_get_dumphw (void *context, uint8_t *buffer, size_t *length)
 Retrieves the dump hardware block containing acquisition environment information.
int32_t aaruf_set_dumphw (void *context, uint8_t *data, size_t length)
 Sets the dump hardware block for the image during creation.
spamsum_ctxaaruf_spamsum_init (void)
int aaruf_spamsum_update (spamsum_ctx *ctx, const uint8_t *data, uint32_t len)
 Updates the spamsum context with new data.
int aaruf_spamsum_final (spamsum_ctx *ctx, uint8_t *result)
void aaruf_spamsum_free (spamsum_ctx *ctx)
 Frees a spamsum (fuzzy hash) context.
void fuzzy_engine_step (spamsum_ctx *ctx, uint8_t c)
void roll_hash (spamsum_ctx *ctx, uint8_t c)
void fuzzy_try_reduce_blockhash (spamsum_ctx *ctx)
void fuzzy_try_fork_blockhash (spamsum_ctx *ctx)
size_t aaruf_flac_decode_redbook_buffer (uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size)
 Decodes a FLAC-compressed Red Book audio buffer.
size_t aaruf_flac_encode_redbook_buffer (uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size, uint32_t blocksize, int32_t do_mid_side_stereo, int32_t loose_mid_side_stereo, const char *apodization, uint32_t max_lpc_order, uint32_t qlp_coeff_precision, int32_t do_qlp_coeff_prec_search, int32_t do_exhaustive_model_search, uint32_t min_residual_partition_order, uint32_t max_residual_partition_order, const char *application_id, uint32_t application_id_len)
 Encodes a Red Book audio buffer to FLAC format.
int32_t aaruf_lzma_decode_buffer (uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, size_t *src_size, const uint8_t *props, size_t props_size)
 Decodes an LZMA-compressed buffer.
int32_t aaruf_lzma_encode_buffer (uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, size_t src_size, uint8_t *out_props, size_t *out_props_size, int32_t level, uint32_t dict_size, int32_t lc, int32_t lp, int32_t pb, int32_t fb, int32_t num_threads)
 Encodes a buffer using LZMA compression.
void aaruf_md5_init (md5_ctx *ctx)
void aaruf_md5_update (md5_ctx *ctx, const void *data, unsigned long size)
void aaruf_md5_final (md5_ctx *ctx, unsigned char *result)
void aaruf_md5_buffer (const void *data, unsigned long size, unsigned char *result)
void aaruf_sha1_init (sha1_ctx *ctx)
void aaruf_sha1_update (sha1_ctx *ctx, const void *data, unsigned long size)
void aaruf_sha1_final (sha1_ctx *ctx, unsigned char *result)
void aaruf_sha1_buffer (const void *data, unsigned long size, unsigned char *result)
void aaruf_sha256_init (sha256_ctx *ctx)
void aaruf_sha256_update (sha256_ctx *ctx, const void *data, unsigned long size)
void aaruf_sha256_final (sha256_ctx *ctx, unsigned char *result)
void aaruf_sha256_buffer (const void *data, unsigned long size, unsigned char *result)
+

Macro Definition Documentation

+ +

◆ AARU_CALL

+ + + +

◆ AARU_EXPORT

+ + + +

◆ AARU_LOCAL

+ +
+
+ + + + +
#define AARU_LOCAL
+
+
+ +

◆ EXTERNC

+ +
+
+ + + + +
#define EXTERNC
+
+ +

Definition at line 34 of file decls.h.

+ +
+
+ +

◆ FORCE_INLINE

+ +
+
+ + + + +
#define FORCE_INLINE   static inline __attribute__((always_inline))
+
+ +

Definition at line 63 of file decls.h.

+ +

Referenced by __attribute__(), and md5_process_block_loaded().

+ +
+
+

Function Documentation

+ +

◆ aaruf_cd_lba_to_msf()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
void aaruf_cd_lba_to_msf (const int64_t pos,
uint8_t * minute,
uint8_t * second,
uint8_t * frame )
+
+ +

Converts a CD LBA (Logical Block Address) to MSF (Minute:Second:Frame) format.

+
Parameters
+ + + + + +
posLBA position.
minutePointer to store the minute value.
secondPointer to store the second value.
framePointer to store the frame value.
+
+
+ +

Definition at line 370 of file ecc_cd.c.

+ +

References TRACE.

+ +

Referenced by aaruf_ecc_cd_reconstruct_prefix().

+ +
+
+ +

◆ aaruf_close()

+ +
+
+ + + + + + + +
int aaruf_close (void * context)
+
+ +

Close an Aaru image context, flushing pending data structures and releasing resources.

+

Public API entry point used to finalize an image being written or simply dispose of a context opened for reading. For write-mode contexts (ctx->isWriting true) the function performs the following ordered steps:

    +
  1. Rewrite the (possibly updated) main header at offset 0.
  2. +
  3. Close any open data block via aaruf_close_current_block().
  4. +
  5. Flush a cached secondary DDT (multi-level) if pending.
  6. +
  7. Flush either the primary DDT (multi-level) or the single-level DDT table.
  8. +
  9. Finalize and append checksum block(s) for all enabled algorithms.
  10. +
  11. Write auxiliary metadata blocks: tracks, MODE 2 subheaders, sector prefix.
  12. +
  13. Serialize the global index and patch header.indexOffset.
  14. +
  15. Clear deduplication hash map if used.
  16. +
+

Afterwards (or for read-mode contexts) all dynamically allocated buffers, arrays, hash tables and mapping structures are freed/unmapped. Media tags are removed from their hash table.

+

Error Handling:

    +
  • Returns -1 with errno = EINVAL if the provided pointer is NULL or not a valid context.
  • +
  • Returns -1 with errno set to AARUF_ERROR_CANNOT_WRITE_HEADER if a header write fails.
  • +
  • If any intermediate serialization helper returns an error status, that error value is propagated (converted to -1 with errno set accordingly by the caller if desired). In the current implementation aaruf_close() directly returns the negative error code for helper failures to preserve detail.
  • +
+
Parameters
+ + +
contextOpaque pointer returned by earlier open/create calls (must be an aaruformatContext).
+
+
+
Returns
0 on success; -1 or negative libaaruformat error code on failure.
+
Return values
+ + + + + +
0All pending data flushed (if writing) and resources released successfully.
-1Invalid context pointer or initial header rewrite failure (errno = EINVAL or AARUF_ERROR_CANNOT_WRITE_HEADER).
AARUF_ERROR_CANNOT_WRITE_HEADERA later write helper (e.g., index, DDT) failed and returned this code directly.
<othernegative libaaruformat code> Propagated from a write helper if future helpers add more error codes.
+
+
+
Note
On success the context memory itself is freed; the caller must not reuse the pointer.
+ +

Definition at line 3995 of file close.c.

+ +

References AARU_MAGIC, aaruf_close_current_block(), AARUF_ERROR_CANNOT_WRITE_HEADER, AARUF_STATUS_OK, aaruformat_context::checksums, aaruformat_context::cicm_block, mediaTagEntry::data, aaruformat_context::deduplicate, aaruformat_context::dump_hardware_entries_with_data, aaruformat_context::dump_hardware_header, aaruformat_context::ecc_cd_context, DumpHardwareHeader::entries, DumpHardwareEntriesWithData::extents, FATAL, DumpHardwareEntriesWithData::firmware, free_map(), aaruformat_context::header, aaruformat_context::imageStream, aaruformat_context::in_memory_ddt, aaruformat_context::index_entries, aaruformat_context::is_tape, aaruformat_context::is_writing, aaruformat_context::magic, DumpHardwareEntriesWithData::manufacturer, aaruformat_context::mapped_memory_ddt_size, aaruformat_context::mediaTags, aaruformat_context::metadata_block, aaruformat_context::mode2_subheaders, DumpHardwareEntriesWithData::model, aaruformat_context::readableSectorTags, DumpHardwareEntriesWithData::revision, aaruformat_context::sector_cpr_mai, aaruformat_context::sector_edc, aaruformat_context::sector_hash_map, aaruformat_context::sector_id, aaruformat_context::sector_ied, aaruformat_context::sector_prefix, aaruformat_context::sector_prefix_corrected, aaruformat_context::sector_prefix_ddt, aaruformat_context::sector_prefix_ddt2, aaruformat_context::sector_subchannel, aaruformat_context::sector_suffix, aaruformat_context::sector_suffix_corrected, aaruformat_context::sector_suffix_ddt, aaruformat_context::sector_suffix_ddt2, DumpHardwareEntriesWithData::serial, DumpHardwareEntriesWithData::softwareName, DumpHardwareEntriesWithData::softwareOperatingSystem, DumpHardwareEntriesWithData::softwareVersion, Checksums::spamsum, TRACE, aaruformat_context::track_entries, aaruformat_context::user_data_ddt, write_aaru_json_block(), write_cached_secondary_ddt(), write_checksum_block(), write_cicm_block(), write_dumphw_block(), write_dvd_long_sector_blocks(), write_dvd_title_key_decrypted_block(), write_geometry_block(), write_index_block(), write_media_tags(), write_metadata_block(), write_mode2_subheaders_block(), write_primary_ddt(), write_sector_prefix(), write_sector_prefix_ddt(), write_sector_subchannel(), write_sector_suffix(), write_sector_suffix_ddt(), write_single_level_ddt(), write_tape_ddt(), write_tape_file_block(), write_tape_partition_block(), write_tracks_block(), and aaruformat_context::writing_buffer.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ aaruf_crc64_data()

+ + + +

◆ aaruf_crc64_final()

+ +
+
+ + + + + + + + + + + +
int aaruf_crc64_final (crc64_ctx * ctx,
uint64_t * crc )
+
+ +

Computes the final CRC64 value from the context.

+
Parameters
+ + + +
ctxPointer to the CRC64 context.
crcPointer to store the resulting CRC64 value.
+
+
+
Returns
0 on success, -1 on error.
+ +

Definition at line 141 of file crc64.c.

+ +

References AARU_CALL, AARU_EXPORT, crc64_ctx::crc, and CRC64_ECMA_SEED.

+ +

Referenced by aaruf_close_current_block(), aaruf_crc64_data(), aaruf_verify_image(), decode_ddt_multi_level_v2(), process_ddt_v2(), set_ddt_multi_level_v2(), verify_index_v2(), verify_index_v3(), write_cached_secondary_ddt(), write_index_block(), and write_primary_ddt().

+ +
+
+ +

◆ aaruf_crc64_free()

+ +
+
+ + + + + + + +
void aaruf_crc64_free (crc64_ctx * ctx)
+
+ +

Frees a CRC64 context.

+
Parameters
+ + +
ctxPointer to the CRC64 context to free.
+
+
+ +

Definition at line 155 of file crc64.c.

+ +

References AARU_CALL, and AARU_EXPORT.

+ +

Referenced by aaruf_close_current_block(), aaruf_crc64_data(), aaruf_verify_image(), verify_index_v2(), and verify_index_v3().

+ +
+
+ +

◆ aaruf_crc64_init()

+ +
+
+ + + + + + + +
crc64_ctx * aaruf_crc64_init (void )
+
+ +

Initializes a CRC64 context.

+

Allocates and initializes a CRC64 context for checksum calculations.

+
Returns
Pointer to the initialized crc64_ctx structure, or NULL on failure.
+ +

Definition at line 32 of file crc64.c.

+ +

References AARU_CALL, AARU_EXPORT, crc64_ctx::crc, CRC64_ECMA_SEED, and TRACE.

+ +

Referenced by aaruf_close_current_block(), aaruf_crc64_data(), aaruf_verify_image(), decode_ddt_multi_level_v2(), process_ddt_v2(), set_ddt_multi_level_v2(), verify_index_v2(), verify_index_v3(), write_cached_secondary_ddt(), write_index_block(), and write_primary_ddt().

+ +
+
+ +

◆ aaruf_crc64_slicing()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_crc64_slicing (uint64_t * previous_crc,
const uint8_t * data,
uint32_t len )
+
+ +

Updates a CRC64 value using the slicing-by-8 algorithm.

+
Parameters
+ + + + +
previous_crcPointer to the previous CRC64 value (input/output).
dataPointer to the data buffer.
lenLength of the data buffer in bytes.
+
+
+ +

Definition at line 102 of file crc64.c.

+ +

References AARU_CALL, AARU_EXPORT, and crc64_table.

+ +

Referenced by aaruf_crc64_update().

+ +
+
+ +

◆ aaruf_crc64_update()

+ +
+
+ + + + + + + + + + + + + + + + +
int aaruf_crc64_update (crc64_ctx * ctx,
const uint8_t * data,
uint32_t len )
+
+ +

Updates the CRC64 context with new data.

+

Processes the given data buffer and updates the CRC64 value in the context.

+
Parameters
+ + + + +
ctxPointer to the CRC64 context.
dataPointer to the data buffer.
lenLength of the data buffer.
+
+
+
Returns
0 on success, or -1 on error.
+ +

Definition at line 55 of file crc64.c.

+ +

References AARU_CALL, AARU_EXPORT, aaruf_crc64_slicing(), crc64_ctx::crc, and TRACE.

+ +

Referenced by aaruf_close_current_block(), aaruf_crc64_data(), decode_ddt_multi_level_v2(), process_ddt_v2(), set_ddt_multi_level_v2(), update_crc64_from_stream(), verify_index_v2(), verify_index_v3(), write_cached_secondary_ddt(), write_index_block(), and write_primary_ddt().

+ +
+
+ +

◆ aaruf_create()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void * aaruf_create (const char * filepath,
const uint32_t media_type,
const uint32_t sector_size,
const uint64_t user_sectors,
const uint64_t negative_sectors,
const uint64_t overflow_sectors,
const char * options,
const uint8_t * application_name,
const uint8_t application_name_length,
const uint8_t application_major_version,
const uint8_t application_minor_version,
const bool is_tape )
+
+ +

Creates a new AaruFormat image file.

+

Allocates and initializes a new aaruformat context and image file with the specified parameters. This function sets up all necessary data structures including headers, DDT (deduplication table), caches, and index entries for writing a new AaruFormat image. It also handles file creation, memory allocation, and proper initialization of the writing context. The function supports both block-based media (disks, optical media) and sequential tape media with different initialization strategies optimized for each media type.

+

Media Type Handling: The function creates different internal structures based on the is_tape parameter:

+

Block Media (is_tape = false):

    +
  • Initializes full DDT (Deduplication Table) version 2 for sector-level deduplication
  • +
  • Allocates primary DDT table (userDataDdtMini or userDataDdtBig) as a preallocated array
  • +
  • Configures multi-level DDT support for large images (> 138,412,552 sectors)
  • +
  • Enables optional deduplication hash map for detecting duplicate sectors
  • +
  • Reserves space for DDT at the beginning of the file (after header, block-aligned)
  • +
  • Data blocks start after DDT table to maintain sequential layout
  • +
  • DDT size is fixed and known upfront based on sector count
  • +
+

Tape Media (is_tape = true):

    +
  • Initializes DDT for sector-level deduplication using a different strategy
  • +
  • Uses a growing hash table (tapeDdt) instead of a preallocated array
  • +
  • Sets ctx->is_tape flag and initializes ctx->tapeDdt to NULL (populated on first write)
  • +
  • Data blocks start immediately after the header (block-aligned)
  • +
  • Hash table grows dynamically as blocks are written
  • +
  • Optimized for sequential write patterns typical of tape media
  • +
  • Tape file/partition metadata is managed separately via additional hash tables
  • +
  • More memory-efficient for tapes with unknown final size
  • +
+

Initialization Flow:

    +
  1. Parse creation options (compression, alignment, deduplication, checksums)
  2. +
  3. Allocate and zero-initialize context structure
  4. +
  5. Create/open image file in binary write mode
  6. +
  7. Initialize AaruFormat header with application and version information
  8. +
  9. Set up image metadata and sector size information
  10. +
  11. Initialize block and header caches for performance
  12. +
  13. Initialize ECC context for Compact Disc support
  14. +
  15. Branch based on media type:
      +
    • Block media: Configure DDT structures and calculate offsets with preallocated array
    • +
    • Tape media: Set tape flags and initialize for dynamic hash table DDT
    • +
    +
  16. +
  17. Initialize index entries array for tracking all blocks
  18. +
  19. Configure compression, checksums, and deduplication based on options
  20. +
  21. Position file pointer at calculated data start position
  22. +
+

DDT Configuration (Block Media Only): The function automatically selects optimal DDT parameters:

    +
  • Single-level DDT (tableShift=0): For images < 138,412,552 sectors
  • +
  • Multi-level DDT (tableShift=22): For images ≥ 138,412,552 sectors
  • +
+

The DDT offset calculation ensures proper alignment:

    +
  • Primary DDT placed immediately after header (block-aligned)
  • +
  • Data blocks positioned after DDT table (block-aligned)
  • +
  • Alignment controlled by blockAlignmentShift from options
  • +
+
Parameters
+ + + + + + + + + + + + + +
filepathPath to the image file to create. The file will be created if it doesn't exist, or overwritten if it does. Must be a valid writable path.
media_typeMedia type identifier (e.g., CompactDisc, DVD, HardDisk, Tape formats). This affects how the image is structured and which features are enabled.
sector_sizeSize of each sector/block in bytes. Common values:
    +
  • 512 bytes: Hard disks, floppy disks
  • +
  • 2048 bytes: CD-ROM, DVD
  • +
  • Variable: Tape media (block size varies by format)
  • +
+
user_sectorsNumber of user data sectors/blocks in the image. This is the main data area excluding negative (lead-in) and overflow (lead-out) regions. For tape media, this may be an estimate as the final size is often unknown.
negative_sectorsNumber of negative sectors (typically lead-in area for optical media). Set to 0 for media types without lead-in areas. Not used for tape media.
overflow_sectorsNumber of overflow sectors (typically lead-out area for optical media). Set to 0 for media types without lead-out areas. Not used for tape media.
optionsString with creation options in key=value format, semicolon-separated. Supported options:
    +
  • "compress=true|false": Enable/disable LZMA compression
  • +
  • "deduplicate=true|false": Enable/disable sector deduplication (all media types)
  • +
  • "md5=true|false": Calculate MD5 checksum during write
  • +
  • "sha1=true|false": Calculate SHA-1 checksum during write
  • +
  • "sha256=true|false": Calculate SHA-256 checksum during write
  • +
  • "spamsum=true|false": Calculate SpamSum fuzzy hash during write
  • +
  • "blake3=true|false": Calculate BLAKE3 checksum during write
  • +
  • "block_alignment=N": Block alignment shift value (default varies)
  • +
  • "data_shift=N": Data shift value for DDT granularity
  • +
  • "table_shift=N": Table shift for multi-level DDT (-1 for auto, block media only)
  • +
  • "dictionary=N": LZMA dictionary size in bytes Example: "compress=true;deduplicate=true;md5=true;sha1=true"
  • +
+
application_namePointer to the application name string (UTF-8 encoded). This identifies the software that created the image. The string will be copied directly to the image header.
application_name_lengthLength of the application name string in bytes. Must be ≤ AARU_HEADER_APP_NAME_LEN (64 bytes).
application_major_versionMajor version of the creating application (0-255).
application_minor_versionMinor version of the creating application (0-255).
is_tapeBoolean flag indicating tape media type:
    +
  • true: Initialize for tape media (sequential, dynamic hash table DDT, file/partition metadata)
  • +
  • false: Initialize for block media (random access, preallocated array DDT)
  • +
+
+
+
+
Returns
Returns one of the following:
+
Return values
+ + + +
aaruformatContext*Successfully created and initialized context. The returned pointer contains:
    +
  • Properly initialized AaruFormat headers and metadata
  • +
  • For block media: Allocated and configured DDT structures with preallocated arrays
  • +
  • For tape media: Tape flags set, DDT initialized as NULL (grows on demand)
  • +
  • Initialized block and header caches for performance
  • +
  • Open file stream ready for writing operations
  • +
  • Index entries array ready for block tracking
  • +
  • ECC context initialized for Compact Disc support
  • +
  • Checksum contexts initialized based on options
  • +
+
NULLCreation failed. The specific error can be determined by checking errno, which will be set to:
    +
  • AARUF_ERROR_NOT_ENOUGH_MEMORY (-9) when memory allocation fails for:
      +
    • Context allocation
    • +
    • Readable sector tags array allocation
    • +
    • Application version string allocation
    • +
    • Image version string allocation
    • +
    • DDT table allocation (userDataDdtMini or userDataDdtBig, block media only)
    • +
    • Index entries array allocation
    • +
    +
  • +
  • AARUF_ERROR_CANNOT_CREATE_FILE (-19) when file operations fail:
      +
    • Unable to open the specified filepath for writing
    • +
    • File seek operations fail during initialization
    • +
    • File system errors or permission issues
    • +
    +
  • +
  • AARUF_ERROR_INVALID_APP_NAME_LENGTH (-20) when:
      +
    • application_name_length exceeds AARU_HEADER_APP_NAME_LEN (64 bytes)
    • +
    +
  • +
+
+
+
+
Note
Memory Management:
    +
  • The function performs extensive memory allocation for various context structures
  • +
  • On failure, all previously allocated memory is properly cleaned up
  • +
  • The returned context must be freed using aaruf_close() when finished
  • +
+
+
+File Operations:
    +
  • Creates a new file at the specified path (overwrites existing files)
  • +
  • Opens the file in binary read/write mode ("wb+")
  • +
  • Positions the file pointer at the calculated data start position
  • +
  • File alignment is handled based on parsed options
  • +
+
+
+DDT Initialization (Block Media Only):
    +
  • Uses DDT version 2 format with configurable compression and alignment
  • +
  • Calculates optimal table sizes based on sector counts and shift parameters
  • +
  • All DDT entries are initialized to zero (indicating unallocated sectors)
  • +
  • Multi-level DDT is used for images with ≥ 138,412,552 total sectors
  • +
  • Single-level DDT is used for smaller images for efficiency
  • +
  • DDT is a fixed-size preallocated array written to file at known offset
  • +
+
+
+Tape Media Initialization:
    +
  • Tape images use a dynamic hash table DDT for sector-level deduplication
  • +
  • File and partition metadata is managed via separate hash tables
  • +
  • ctx->is_tape is set to 1 to indicate tape mode throughout the library
  • +
  • ctx->tapeDdt is initialized to NULL and grows dynamically as blocks are written
  • +
  • Data blocks can start immediately after header for optimal sequential access
  • +
  • The hash table DDT allows for efficient deduplication without knowing final size
  • +
  • More memory-efficient for tapes with unpredictable or very large sizes
  • +
  • Deduplication hash map may still be used alongside tapeDdt if enabled in options
  • +
+
+
+Options Parsing:
    +
  • The options string is parsed to extract block_alignment, data_shift, and table_shift
  • +
  • These parameters affect memory usage, performance, and file organization
  • +
  • Invalid options may result in suboptimal performance but won't cause failure
  • +
  • Compression and checksums can be enabled independently via options
  • +
+
+
+Checksum Initialization:
    +
  • MD5, SHA-1, SHA-256, SpamSum, and BLAKE3 can be calculated during write
  • +
  • Checksum contexts are initialized only if requested in options
  • +
  • Checksums are computed incrementally as sectors/blocks are written
  • +
  • Final checksums are stored in checksum block during image finalization
  • +
+
+
Warning
The created context is in writing mode and expects proper finalization before closing to ensure index and metadata are written correctly.
+
+Application name length validation is strict - exceeding the limit will cause creation failure with AARUF_ERROR_INVALID_APP_NAME_LENGTH.
+
+For tape media, the DDT structure is fundamentally different (hash table vs array). The is_tape flag must accurately reflect the media type being created.
+
+The negative_sectors and overflow_sectors parameters are used only for block media. For tape media, these parameters are ignored.
+
See also
aaruf_close() for proper context cleanup and image finalization
+
+aaruf_write_sector() for writing sectors to block media images
+
+aaruf_set_tape_file() for defining tape file metadata
+
+aaruf_set_tape_partition() for defining tape partition metadata
+

< Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).

+ +

Definition at line 279 of file create.c.

+ +

References AARU_HEADER_APP_NAME_LEN, AARU_MAGIC, aaruf_ecc_cd_init(), AARUF_ERROR_CANNOT_CREATE_FILE, AARUF_ERROR_INVALID_APP_NAME_LENGTH, AARUF_ERROR_NOT_ENOUGH_MEMORY, aaruf_get_xml_mediatype(), aaruf_md5_init(), aaruf_sha1_init(), aaruf_sha256_init(), aaruf_spamsum_init(), AARUF_VERSION_V2, ImageInfo::Application, AaruHeaderV2::application, AaruHeaderV2::applicationMajorVersion, AaruHeaderV2::applicationMinorVersion, ImageInfo::ApplicationVersion, aaru_options::blake3, aaruformat_context::blake3_context, aaru_options::block_alignment, aaruformat_context::block_cache, aaruformat_context::block_header_cache, DdtHeader2::blockAlignmentShift, DdtHeader2::blocks, CacheHeader::cache, aaruformat_context::calculating_blake3, aaruformat_context::calculating_md5, aaruformat_context::calculating_sha1, aaruformat_context::calculating_sha256, aaruformat_context::calculating_spamsum, cleanup_failed_create(), aaru_options::compress, DdtHeader2::compression, aaruformat_context::compression_enabled, create_map(), ImageInfo::CreationTime, AaruHeaderV2::creationTime, aaru_options::data_shift, DdtHeader2::dataShift, aaru_options::deduplicate, aaruformat_context::deduplicate, DeDuplicationTable2, aaru_options::dictionary, aaruformat_context::ecc_cd_context, DdtHeader2::entries, FATAL, get_filetime_uint64(), aaruformat_context::header, AaruHeaderV2::identifier, DdtHeader2::identifier, aaruformat_context::image_info, AaruHeaderV2::imageMajorVersion, AaruHeaderV2::imageMinorVersion, ImageInfo::ImageSize, aaruformat_context::imageStream, aaruformat_context::in_memory_ddt, aaruformat_context::index_entries, AaruHeaderV2::indexOffset, aaruformat_context::is_tape, aaruformat_context::is_writing, aaruformat_context::last_written_block, ImageInfo::LastModificationTime, AaruHeaderV2::lastWrittenTime, DdtHeader2::levels, LIBAARUFORMAT_MAJOR_VERSION, LIBAARUFORMAT_MINOR_VERSION, aaruformat_context::library_major_version, aaruformat_context::library_minor_version, aaruformat_context::lzma_dict_size, aaruformat_context::magic, MAX_CACHE_SIZE, CacheHeader::max_items, MaxSectorTag, aaru_options::md5, aaruformat_context::md5_context, ImageInfo::MediaType, AaruHeaderV2::mediaType, ImageInfo::MetadataMediaType, DdtHeader2::negative, aaruformat_context::next_block_position, None, DdtHeader2::overflow, parse_options(), DdtHeader2::previousLevelOffset, aaruformat_context::primary_ddt_offset, aaruformat_context::readableSectorTags, aaruformat_context::rewinded, aaruformat_context::sector_hash_map, ImageInfo::Sectors, ImageInfo::SectorSize, aaru_options::sha1, aaruformat_context::sha1_context, aaru_options::sha256, aaruformat_context::sha256_context, aaruformat_context::shift, aaru_options::spamsum, aaruformat_context::spamsum_context, DdtHeader2::start, aaru_options::table_shift, DdtHeader2::tableLevel, DdtHeader2::tableShift, aaruformat_context::tape_ddt, TRACE, DdtHeader2::type, aaruformat_context::user_data_ddt2, aaruformat_context::user_data_ddt_header, UserData, and ImageInfo::Version.

+ +
+
+ +

◆ aaruf_cst_transform()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_cst_transform (const uint8_t * interleaved,
uint8_t * sequential,
const size_t length )
+
+ +

Transforms interleaved subchannel data to sequential format.

+

Converts interleaved subchannel data into a sequential format for further processing.

+
Parameters
+ + + + +
interleavedPointer to the interleaved data buffer.
sequentialPointer to the output sequential data buffer.
lengthLength of the data buffer.
+
+
+
Returns
AARUF_STATUS_OK on success, or an error code on failure.
+ +

Definition at line 35 of file cst.c.

+ +

References AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_NOT_ENOUGH_MEMORY, and AARUF_STATUS_OK.

+ +

Referenced by write_sector_subchannel().

+ +
+
+ +

◆ aaruf_cst_untransform()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_cst_untransform (const uint8_t * sequential,
uint8_t * interleaved,
const size_t length )
+
+ +

Reverses the CST (Claunia's Subchannel Transform) transformation from sequential to interleaved data.

+
Parameters
+ + + + +
sequentialPointer to the sequential data buffer.
interleavedPointer to the output buffer for interleaved data.
lengthLength of the data in bytes.
+
+
+
Returns
AARUF_STATUS_OK on success, or an error code on failure.
+ +

Definition at line 193 of file cst.c.

+ +

References AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_NOT_ENOUGH_MEMORY, and AARUF_STATUS_OK.

+ +

Referenced by process_data_block().

+ +
+
+ +

◆ aaruf_ecc_cd_check()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool aaruf_ecc_cd_check (void * context,
const uint8_t * address,
const uint8_t * data,
const uint32_t major_count,
const uint32_t minor_count,
const uint32_t major_mult,
const uint32_t minor_inc,
const uint8_t * ecc,
const int32_t address_offset,
const int32_t data_offset,
const int32_t ecc_offset )
+
+ +

Checks the ECC of a CD sector.

+
Parameters
+ + + + + + + + + + + + +
contextPointer to the ECC context.
addressPointer to the address field.
dataPointer to the data field.
major_countNumber of major iterations.
minor_countNumber of minor iterations.
major_multMajor multiplier.
minor_incMinor increment.
eccPointer to the ECC field.
address_offsetOffset for the address field.
data_offsetOffset for the data field.
ecc_offsetOffset for the ECC field.
+
+
+
Returns
true if ECC is correct, false otherwise.
+ +

Definition at line 227 of file ecc_cd.c.

+ +

References CdEccContext::ecc_b_table, CdEccContext::ecc_f_table, CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_ecc_cd_is_suffix_correct(), and aaruf_ecc_cd_is_suffix_correct_mode2().

+ +
+
+ +

◆ aaruf_ecc_cd_init()

+ +
+
+ + + + + + + +
void * aaruf_ecc_cd_init ()
+
+ +

Initializes a Compact Disc ECC context.

+

Allocates and initializes a context for Compact Disc ECC calculations.

+
Returns
Pointer to the initialized CdEccContext structure, or NULL on failure.
+ +

Definition at line 35 of file ecc_cd.c.

+ +

References CdEccContext::ecc_b_table, CdEccContext::ecc_f_table, CdEccContext::edc_table, CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_create(), and aaruf_open().

+ +
+
+ +

◆ aaruf_ecc_cd_is_suffix_correct()

+ +
+
+ + + + + + + + + + + +
bool aaruf_ecc_cd_is_suffix_correct (void * context,
const uint8_t * sector )
+
+ +

Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 1).

+
Parameters
+ + + +
contextPointer to the ECC context.
sectorPointer to the sector data.
+
+
+
Returns
true if the suffix is correct, false otherwise.
+ +

Definition at line 101 of file ecc_cd.c.

+ +

References aaruf_ecc_cd_check(), aaruf_edc_cd_compute(), CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ aaruf_ecc_cd_is_suffix_correct_mode2()

+ +
+
+ + + + + + + + + + + +
bool aaruf_ecc_cd_is_suffix_correct_mode2 (void * context,
const uint8_t * sector )
+
+ +

Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 2).

+
Parameters
+ + + +
contextPointer to the ECC context.
sectorPointer to the sector data.
+
+
+
Returns
true if the suffix is correct, false otherwise.
+ +

Definition at line 165 of file ecc_cd.c.

+ +

References aaruf_ecc_cd_check(), aaruf_edc_cd_compute(), CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ aaruf_ecc_cd_reconstruct()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_ecc_cd_reconstruct (void * context,
uint8_t * sector,
const uint8_t type )
+
+ +

Reconstructs the EDC and ECC fields of a CD sector.

+
Parameters
+ + + + +
contextPointer to the ECC context.
sectorPointer to the sector data (must be 2352 bytes).
typeTrack type (mode).
+
+
+ +

Definition at line 455 of file ecc_cd.c.

+ +

References aaruf_ecc_cd_write_sector(), aaruf_edc_cd_compute(), CdMode1, CdMode2Form1, CdMode2Form2, CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_read_sector_long().

+ +
+
+ +

◆ aaruf_ecc_cd_reconstruct_prefix()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_ecc_cd_reconstruct_prefix (uint8_t * sector,
const uint8_t type,
const int64_t lba )
+
+ +

Reconstructs the prefix (sync, address, mode) of a CD sector.

+
Parameters
+ + + + +
sectorPointer to the sector data (must be 2352 bytes).
typeTrack type (mode).
lbaLogical Block Address.
+
+
+ +

Definition at line 388 of file ecc_cd.c.

+ +

References aaruf_cd_lba_to_msf(), CdMode1, CdMode2Form1, CdMode2Form2, CdMode2Formless, and TRACE.

+ +

Referenced by aaruf_read_sector_long().

+ +
+
+ +

◆ aaruf_ecc_cd_write()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void aaruf_ecc_cd_write (void * context,
const uint8_t * address,
const uint8_t * data,
const uint32_t major_count,
const uint32_t minor_count,
const uint32_t major_mult,
const uint32_t minor_inc,
uint8_t * ecc,
const int32_t address_offset,
const int32_t data_offset,
const int32_t ecc_offset )
+
+ +

Writes ECC for a CD sector.

+
Parameters
+ + + + + + + + + + + + +
contextPointer to the ECC context.
addressPointer to the address field.
dataPointer to the data field.
major_countNumber of major iterations.
minor_countNumber of minor iterations.
major_multMajor multiplier.
minor_incMinor increment.
eccPointer to the ECC field to write.
address_offsetOffset for the address field.
data_offsetOffset for the data field.
ecc_offsetOffset for the ECC field.
+
+
+ +

Definition at line 292 of file ecc_cd.c.

+ +

References CdEccContext::ecc_b_table, CdEccContext::ecc_f_table, CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_ecc_cd_write_sector().

+ +
+
+ +

◆ aaruf_ecc_cd_write_sector()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void aaruf_ecc_cd_write_sector (void * context,
const uint8_t * address,
const uint8_t * data,
uint8_t * ecc,
const int32_t address_offset,
const int32_t data_offset,
const int32_t ecc_offset )
+
+ +

Writes ECC for a full CD sector (both P and Q ECC).

+
Parameters
+ + + + + + + + +
contextPointer to the ECC context.
addressPointer to the address field.
dataPointer to the data field.
eccPointer to the ECC field to write.
address_offsetOffset for the address field.
data_offsetOffset for the data field.
ecc_offsetOffset for the ECC field.
+
+
+ +

Definition at line 349 of file ecc_cd.c.

+ +

References aaruf_ecc_cd_write(), and TRACE.

+ +

Referenced by aaruf_ecc_cd_reconstruct().

+ +
+
+ +

◆ aaruf_edc_cd_compute()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
uint32_t aaruf_edc_cd_compute (void * context,
uint32_t edc,
const uint8_t * src,
int size,
int pos )
+
+ +

Computes the EDC (Error Detection Code) for a CD sector.

+
Parameters
+ + + + + + +
contextPointer to the ECC context.
edcInitial EDC value.
srcPointer to the data to compute EDC over.
sizeNumber of bytes to process.
posStarting position in the data.
+
+
+
Returns
Computed EDC value.
+ +

Definition at line 543 of file ecc_cd.c.

+ +

References CdEccContext::edc_table, CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_ecc_cd_is_suffix_correct(), aaruf_ecc_cd_is_suffix_correct_mode2(), aaruf_ecc_cd_reconstruct(), and aaruf_write_sector_long().

+ +
+
+ +

◆ aaruf_flac_decode_redbook_buffer()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
size_t aaruf_flac_decode_redbook_buffer (uint8_t * dst_buffer,
size_t dst_size,
const uint8_t * src_buffer,
size_t src_size )
+
+ +

Decodes a FLAC-compressed Red Book audio buffer.

+

Decompresses FLAC-compressed Red Book audio data into the destination buffer.

+
Parameters
+ + + + + +
dst_bufferPointer to the destination buffer.
dst_sizeSize of the destination buffer.
src_bufferPointer to the source (compressed) buffer.
src_sizeSize of the source buffer.
+
+
+
Returns
Number of bytes written to the destination buffer.
+ +

Definition at line 48 of file flac.c.

+ +

References AARU_CALL, AARU_EXPORT, aaru_flac_ctx::dst_buffer, aaru_flac_ctx::dst_len, aaru_flac_ctx::dst_pos, aaru_flac_ctx::error, error_callback(), read_callback(), aaru_flac_ctx::src_buffer, aaru_flac_ctx::src_len, aaru_flac_ctx::src_pos, and write_callback().

+ +

Referenced by aaruf_read_sector().

+ +
+
+ +

◆ aaruf_flac_encode_redbook_buffer()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
size_t aaruf_flac_encode_redbook_buffer (uint8_t * dst_buffer,
size_t dst_size,
const uint8_t * src_buffer,
size_t src_size,
uint32_t blocksize,
int32_t do_mid_side_stereo,
int32_t loose_mid_side_stereo,
const char * apodization,
uint32_t max_lpc_order,
uint32_t qlp_coeff_precision,
int32_t do_qlp_coeff_prec_search,
int32_t do_exhaustive_model_search,
uint32_t min_residual_partition_order,
uint32_t max_residual_partition_order,
const char * application_id,
uint32_t application_id_len )
+
+ +

Encodes a Red Book audio buffer to FLAC format.

+
Parameters
+ + + + + + + + + + + + + + + + + +
dst_bufferPointer to the destination buffer for FLAC data.
dst_sizeSize of the destination buffer in bytes.
src_bufferPointer to the source Red Book audio buffer.
src_sizeSize of the source buffer in bytes.
blocksizeFLAC block size.
do_mid_side_stereoEnable mid-side stereo encoding.
loose_mid_side_stereoEnable loose mid-side stereo encoding.
apodizationApodization string for FLAC encoder.
max_lpc_orderMaximum LPC order.
qlp_coeff_precisionQLP coefficient precision.
do_qlp_coeff_prec_searchEnable QLP coefficient precision search.
do_exhaustive_model_searchEnable exhaustive model search.
min_residual_partition_orderMinimum residual partition order.
max_residual_partition_orderMaximum residual partition order.
application_idApplication ID string for FLAC encoder.
application_id_lenLength of the application ID string.
+
+
+
Returns
Number of bytes written to the destination buffer.
+ +

Definition at line 175 of file flac.c.

+ +

References AARU_CALL, AARU_EXPORT, aaru_flac_ctx::dst_buffer, aaru_flac_ctx::dst_len, aaru_flac_ctx::dst_pos, encoder_write_callback(), aaru_flac_ctx::error, aaru_flac_ctx::src_buffer, aaru_flac_ctx::src_len, and aaru_flac_ctx::src_pos.

+ +

Referenced by aaruf_close_current_block().

+ +
+
+ +

◆ aaruf_get_aaru_json_metadata()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_aaru_json_metadata (const void * context,
uint8_t * buffer,
size_t * length )
+
+ +

Retrieves the embedded Aaru metadata JSON from the image.

+

Aaru metadata JSON is a structured metadata format that provides machine-readable, comprehensive information about the image, media, imaging session details, hardware configuration, optical disc tracks and sessions, checksums, and preservation metadata. This function extracts the raw JSON payload that was embedded in the AaruFormat image during creation. The JSON data is preserved in its original form without parsing or interpretation by the library, allowing callers to process the structured metadata using standard JSON parsing libraries.

+

This function supports a two-call pattern for buffer size determination:

    +
  1. First call with a buffer that may be too small returns AARUF_ERROR_BUFFER_TOO_SMALL and sets *length to the required size
  2. +
  3. Second call with a properly sized buffer retrieves the actual data
  4. +
+

Alternatively, if the caller already knows the buffer is large enough, a single call will succeed and populate the buffer with the Aaru JSON data.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, opened image context).
bufferPointer to a buffer that will receive the Aaru metadata JSON. Must be large enough to hold the entire JSON payload (at least *length bytes on input). The buffer will contain raw UTF-8 encoded JSON data on success.
lengthPointer to a size_t that serves dual purpose:
    +
  • On input: size of the provided buffer in bytes
  • +
  • On output: actual size of the Aaru metadata JSON in bytes If the function returns AARUF_ERROR_BUFFER_TOO_SMALL, this will be updated to contain the required buffer size for a subsequent successful call.
  • +
+
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully retrieved Aaru metadata JSON. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The Aaru JSON block is present in the image (identifier == AaruMetadataJsonBlock)
  • +
  • The provided buffer is large enough (>= required length)
  • +
  • The Aaru JSON data is successfully copied to the buffer
  • +
  • The *length parameter is set to the actual size of the JSON data
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_open() or aaruf_create()
  • +
+
AARUF_ERROR_CANNOT_READ_BLOCK(-6) The Aaru JSON block is not present. This occurs when:
    +
  • The image was created without Aaru metadata JSON
  • +
  • ctx->jsonBlock is NULL (no data loaded)
  • +
  • ctx->jsonBlockHeader.length is 0 (empty metadata)
  • +
  • ctx->jsonBlockHeader.identifier doesn't equal AaruMetadataJsonBlock
  • +
  • The Aaru JSON block was not found during image opening
  • +
  • The *length output parameter is set to 0 to indicate no data available
  • +
+
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer is insufficient. This occurs when:
    +
  • The input *length is less than ctx->jsonBlockHeader.length
  • +
  • The *length parameter is updated to contain the required buffer size
  • +
  • No data is copied to the buffer
  • +
  • The caller should allocate a larger buffer and call again
  • +
+
+
+
+
Note
Aaru JSON Format and Encoding:
    +
  • The JSON payload is stored in UTF-8 encoding
  • +
  • The payload may or may not be null-terminated
  • +
  • The library treats the JSON as opaque binary data
  • +
  • No JSON parsing, interpretation, or validation is performed by libaaruformat
  • +
  • JSON schema validation and parsing are the caller's responsibility
  • +
+
+
+Aaru Metadata JSON Purpose:
    +
  • Provides machine-readable structured metadata using modern JSON format
  • +
  • Includes comprehensive information about media, sessions, tracks, and checksums
  • +
  • Enables programmatic access to metadata without XML parsing overhead
  • +
  • Documents imaging session details, hardware configuration, and preservation data
  • +
  • Used by Aaru and compatible tools for metadata exchange and analysis
  • +
  • Complements or serves as alternative to CICM XML metadata
  • +
+
+
+Buffer Size Handling:
    +
  • First call with insufficient buffer returns required size in *length
  • +
  • Caller allocates properly sized buffer based on returned length
  • +
  • Second call with adequate buffer retrieves the actual JSON data
  • +
  • Single call succeeds if buffer is already large enough
  • +
+
+
+Data Availability:
    +
  • Aaru JSON blocks are optional in AaruFormat images
  • +
  • Not all images will contain Aaru metadata JSON
  • +
  • The presence of JSON data depends on how the image was created
  • +
  • Check return value to handle missing metadata gracefully
  • +
  • Images may contain CICM XML, Aaru JSON, both, or neither
  • +
+
+
+Distinction from CICM XML:
    +
  • CICM XML follows the Canary Islands Computer Museum schema (older format)
  • +
  • Aaru JSON follows the Aaru-specific metadata schema (newer format)
  • +
  • Both can coexist in the same image file
  • +
  • Aaru JSON may provide more detailed or different metadata than CICM XML
  • +
  • Different tools and workflows may prefer one format over the other
  • +
+
+
Warning
This function reads from the in-memory Aaru JSON block loaded during aaruf_open(). It does not perform file I/O operations. The entire JSON is kept in memory for the lifetime of the context.
+
+The buffer parameter must be valid and large enough to hold the JSON data. Passing a buffer smaller than the required size will result in AARUF_ERROR_BUFFER_TOO_SMALL with no partial data copied.
+
+This function does not validate JSON syntax or schema. Corrupted JSON data will be retrieved successfully and errors will only be detected when attempting to parse.
+
See also
AaruMetadataJsonBlockHeader for the on-disk structure definition.
+
+aaruf_get_cicm_metadata() for retrieving CICM XML metadata.
+
+process_aaru_metadata_json_block() for the loading process during image opening.
+ +

Definition at line 2099 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, AaruMetadataJsonBlock, FATAL, AaruMetadataJsonBlockHeader::identifier, aaruformat_context::json_block, aaruformat_context::json_block_header, AaruMetadataJsonBlockHeader::length, aaruformat_context::magic, and TRACE.

+ +
+
+ +

◆ aaruf_get_cicm_metadata()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_cicm_metadata (const void * context,
uint8_t * buffer,
size_t * length )
+
+ +

Retrieves the embedded CICM XML metadata sidecar from the image.

+

CICM (Canary Islands Computer Museum) XML is a standardized metadata format used for documenting preservation and archival information about media and disk images. This function extracts the raw CICM XML payload that was embedded in the AaruFormat image during creation. The XML data is preserved in its original form without parsing, interpretation, or validation by the library. The metadata typically includes detailed information about the physical media, imaging process, checksums, device information, and preservation metadata following the CICM schema.

+

This function supports a two-call pattern for buffer size determination:

    +
  1. First call with a buffer that may be too small returns AARUF_ERROR_BUFFER_TOO_SMALL and sets *length to the required size
  2. +
  3. Second call with a properly sized buffer retrieves the actual data
  4. +
+

Alternatively, if the caller already knows the buffer is large enough, a single call will succeed and populate the buffer with the CICM XML data.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, opened image context).
bufferPointer to a buffer that will receive the CICM XML metadata. Must be large enough to hold the entire XML payload (at least *length bytes on input). The buffer will contain raw UTF-8 encoded XML data on success.
lengthPointer to a size_t that serves dual purpose:
    +
  • On input: size of the provided buffer in bytes
  • +
  • On output: actual size of the CICM XML metadata in bytes If the function returns AARUF_ERROR_BUFFER_TOO_SMALL, this will be updated to contain the required buffer size for a subsequent successful call.
  • +
+
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully retrieved CICM XML metadata. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The CICM block is present in the image (identifier == CicmBlock)
  • +
  • The provided buffer is large enough (>= required length)
  • +
  • The CICM XML data is successfully copied to the buffer
  • +
  • The *length parameter is set to the actual size of the XML data
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_open() or aaruf_create()
  • +
+
AARUF_ERROR_CANNOT_READ_BLOCK(-6) The CICM block is not present. This occurs when:
    +
  • The image was created without CICM XML metadata
  • +
  • ctx->cicmBlock is NULL (no data loaded)
  • +
  • ctx->cicmBlockHeader.length is 0 (empty metadata)
  • +
  • ctx->cicmBlockHeader.identifier doesn't equal CicmBlock
  • +
  • The CICM block was not found during image opening
  • +
  • The *length output parameter is set to 0 to indicate no data available
  • +
+
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer is insufficient. This occurs when:
    +
  • The input *length is less than ctx->cicmBlockHeader.length
  • +
  • The *length parameter is updated to contain the required buffer size
  • +
  • No data is copied to the buffer
  • +
  • The caller should allocate a larger buffer and call again
  • +
+
+
+
+
Note
CICM XML Format:
    +
  • The XML is stored in UTF-8 encoding
  • +
  • The payload may or may not be null-terminated
  • +
  • The library treats the XML as opaque binary data
  • +
  • No XML parsing, interpretation, or validation is performed by libaaruformat
  • +
  • Schema validation and XML processing are the caller's responsibility
  • +
+
+
+CICM Metadata Purpose:
    +
  • Developed by the Canary Islands Computer Museum for digital preservation
  • +
  • Documents comprehensive preservation metadata
  • +
  • Includes checksums for data integrity verification
  • +
  • Records detailed device and media information
  • +
  • Supports archival and long-term preservation requirements
  • +
  • Provides standardized metadata for digital preservation workflows
  • +
  • Used by cultural heritage institutions and archives
  • +
+
+
+Buffer Size Handling:
    +
  • First call with insufficient buffer returns required size in *length
  • +
  • Caller allocates properly sized buffer based on returned length
  • +
  • Second call with adequate buffer retrieves the actual XML data
  • +
  • Single call succeeds if buffer is already large enough
  • +
+
+
+Data Availability:
    +
  • CICM blocks are optional in AaruFormat images
  • +
  • Not all images will contain CICM metadata
  • +
  • The presence of CICM data depends on how the image was created
  • +
  • Check return value to handle missing metadata gracefully
  • +
+
+
Warning
The XML data may contain sensitive information about the imaging environment, personnel, locations, or media content. Handle appropriately for your use case.
+
+This function reads from the in-memory CICM block loaded during aaruf_open(). It does not perform file I/O operations. The entire CICM XML is kept in memory for the lifetime of the context.
+
+The buffer parameter must be valid and large enough to hold the XML data. Passing a buffer smaller than the required size will result in AARUF_ERROR_BUFFER_TOO_SMALL with no partial data copied.
+
See also
CicmMetadataBlock for the on-disk structure definition.
+
+aaruf_set_cicm_metadata() for embedding CICM XML during image creation.
+ +

Definition at line 1944 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::cicm_block, aaruformat_context::cicm_block_header, CicmBlock, FATAL, CicmMetadataBlock::identifier, CicmMetadataBlock::length, aaruformat_context::magic, and TRACE.

+ +
+
+ +

◆ aaruf_get_comments()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_comments (const void * context,
uint8_t * buffer,
int32_t * length )
+
+ +

Retrieves the user comments or notes stored in the MetadataBlock.

+

Provides access to the UTF-16LE encoded comments associated with the image. Comments are often used for provenance notes, imaging details, or curator remarks. The function follows the same two-call buffer sizing pattern used by other metadata retrieval APIs: the caller may probe the required size before allocating memory.

+
Parameters
+ + + + +
contextPointer to a valid aaruformat context opened with aaruf_open() or aaruf_create().
bufferDestination buffer that receives the comments data. May be NULL when probing size.
lengthPointer to an int32_t. On input it contains the size of buffer in bytes; on output it is updated with the actual comments length.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Comments were available and copied successfully.
AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid or not a libaaruformat context.
AARUF_ERROR_METADATA_NOT_PRESENT(-30) No comments metadata exists in the image.
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The supplied buffer was too small. *length is updated with the required size and no data is copied.
+
+
+
Note
Comments are stored exactly as provided during image creation and may include multi-line text or other control characters. No validation or normalization is applied by the library.
+ +

Definition at line 2476 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::comments, MetadataBlockHeader::commentsLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_creator()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_creator (const void * context,
uint8_t * buffer,
int32_t * length )
+
+ +

Retrieves the recorded creator (operator) name from the MetadataBlock.

+

Copies the UTF-16LE encoded creator string that identifies the person or operator who created the image. The function supports the common two-call pattern: the caller first determines the required buffer size by passing a buffer that may be NULL or too small, then allocates sufficient memory and calls again to obtain the actual data. On success the buffer contains an opaque UTF-16LE string of length *length bytes (not null-terminated).

+
Parameters
+ + + + +
contextPointer to a valid aaruformat context opened for reading or writing.
bufferPointer to the destination buffer that will receive the creator string. May be NULL to query the required size.
lengthPointer to an int32_t that on input specifies the size of buffer in bytes and on output receives the actual length of the creator metadata.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) The creator string was copied successfully.
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is NULL or not an aaruformat context.
AARUF_ERROR_METADATA_NOT_PRESENT(-30) Creator metadata has not been recorded in the image.
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer was insufficient; *length contains the required size and no data was copied.
+
+
+
Note
The returned data is UTF-16LE encoded and may contain embedded null characters. Callers should treat it as an opaque byte array unless they explicitly handle UTF-16LE strings.
+
+The function does not allocate memory. Callers are responsible for ensuring buffer is large enough before requesting the data.
+ +

Definition at line 2404 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::creator, MetadataBlockHeader::creatorLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_datatype_for_media_tag_type()

+ +
+
+ + + + + + + +
int32_t aaruf_get_datatype_for_media_tag_type (const int32_t tag_type)
+
+ +

Converts an Aaru media tag type to an image data type.

+

Maps the given Aaru media tag type to the corresponding image data type. This is the inverse function of aaruf_get_media_tag_type_for_datatype.

+
Parameters
+ + +
tag_typeAaru media tag type identifier.
+
+
+
Returns
Corresponding image data type, or -1 if not found.
+ +

Definition at line 189 of file helpers.c.

+ +

References AACS_CPRM_MKB, AACS_DataKeys, AACS_LBAExtents, AACS_MediaIdentifier, AACS_MKB, AACS_SerialNumber, AACS_VolumeIdentifier, AacsDataKeys, AacsLbaExtents, AacsMediaIdentifier, AacsMediaKeyBlock, AacsSerialNumber, AacsVolumeIdentifier, ATA_IDENTIFY, AtaIdentify, ATAPI_IDENTIFY, AtapiIdentify, BD_BCA, BD_CartridgeStatus, BD_DDS, BD_DI, BD_SpareArea, BlurayBca, BlurayCartridgeStatus, BlurayDds, BlurayDi, BluraySpareArea, CD_ATIP, CD_FirstTrackPregap, CD_FullTOC, CD_LeadIn, CD_LeadOut, CD_MCN, CD_PMA, CD_SessionInfo, CD_TEXT, CD_TOC, CompactDiscAtip, CompactDiscFirstTrackPregap, CompactDiscLeadIn, CompactDiscLeadInCdText, CompactDiscLeadOut, CompactDiscMediaCatalogueNumber, CompactDiscPartialToc, CompactDiscPma, CompactDiscSessionInfo, CompactDiscToc, CprmMediaKeyBlock, DCB, DVD_ADIP, DVD_BCA, DVD_CMI, DVD_DiscKey, DVD_DiscKey_Decrypted, DVD_DMI, DVD_MediaIdentifier, DVD_MKB, DVD_PFI, DvdAdip, DvdBca, DvdDiscControlBlock, DvdDiscKey, DvdDiscKeyDecrypted, DVDDL_JumpIntervalSize, DVDDL_LayerCapacity, DVDDL_ManualLayerJumpLBA, DVDDL_MiddleZoneAddress, DvdDlJumpIntervalSize, DvdDlLayerCapacity, DvdDlManualLayerJumpLba, DvdDlMiddleZoneAddress, DvdDmi, DvdLeadInCmi, DvdMediaIdentifier, DvdMediaKeyBlock, DvdPfi, DVDR_MediaIdentifier, DVDR_PFI, DVDR_PreRecordedInfo, DVDR_RMD, DVDRAM_DDS, DVDRAM_MediumStatus, DVDRAM_SpareArea, DvdRamDds, DvdRamMediumStatus, DvdRamSpareArea, DvdRMediaIdentifier, DvdRPfi, DvdRPrerecordedInfo, DvdRRmd, Floppy_LeadOut, FloppyLeadOut, HDDVD_CPI, HDDVD_MediumStatus, HdDvdCpi, HdDvdMediumStatus, Hybrid_RecognizedLayers, HybridRecognizedLayers, MMC_CID, MMC_CSD, MMC_DiscInformation, MMC_ExtendedCSD, MMC_OCR, MMC_POWResourcesInformation, MMC_TrackResourcesInformation, MMC_WriteProtection, MultiMediaCardCid, MultiMediaCardCsd, MultiMediaCardExtendedCsd, MultiMediaCardOcr, PCMCIA_CIS, PcmciaCis, SCSI_INQUIRY, SCSI_MODEPAGE_2A, SCSI_MODESENSE_10, SCSI_MODESENSE_6, ScsiInquiry, ScsiMmcDiscInformation, ScsiMmcPowResourcesInformation, ScsiMmcTrackResourcesInformation, ScsiMmcWriteProtection, ScsiModePage2A, ScsiModeSense10, ScsiModeSense6, SD_CID, SD_CSD, SD_OCR, SD_SCR, SecureDigitalCid, SecureDigitalCsd, SecureDigitalOcr, SecureDigitalScr, USB_Descriptors, UsbDescriptors, Xbox_DMI, Xbox_PFI, Xbox_SecuritySector, XboxDmi, XboxPfi, and XboxSecuritySector.

+ +

Referenced by write_media_tags().

+ +
+
+ +

◆ aaruf_get_drive_firmware_revision()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_drive_firmware_revision (const void * context,
uint8_t * buffer,
int32_t * length )
+
+ +

Retrieves the firmware revision metadata for the imaging drive.

+

Returns the UTF-16LE encoded firmware revision string that was captured when the image was created. Firmware information is critical for reproducing imaging environments and diagnosing drive-specific behavior or bugs.

+
Parameters
+ + + + +
contextPointer to a valid aaruformat context.
bufferDestination buffer for the firmware revision string. May be NULL when probing size.
lengthPointer to an int32_t that specifies the buffer capacity in bytes on input and is updated with the actual metadata length on output.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Firmware revision metadata was present and copied successfully.
AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
AARUF_ERROR_METADATA_NOT_PRESENT(-30) No firmware metadata exists in the image.
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The supplied buffer was too small; *length is updated.
+
+
+
Note
Firmware revision formats vary between manufacturers (e.g., numeric, alphanumeric, dot-separated). The library stores the data verbatim without attempting normalization.
+ +

Definition at line 3178 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::drive_firmware_revision, MetadataBlockHeader::driveFirmwareRevisionLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_drive_manufacturer()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_drive_manufacturer (const void * context,
uint8_t * buffer,
int32_t * length )
+
+ +

Retrieves the drive manufacturer metadata captured during imaging.

+

Copies the UTF-16LE encoded manufacturer name of the device used to read or write the medium. This information documents the hardware involved in the imaging process, which is crucial for forensic reporting and reproducibility studies.

+
Parameters
+ + + + +
contextPointer to a valid aaruformat context.
bufferDestination buffer for the manufacturer string. May be NULL when querying required length.
lengthPointer to an int32_t specifying the buffer size on input and receiving the actual metadata length on output.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Drive manufacturer metadata was copied successfully.
AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
AARUF_ERROR_METADATA_NOT_PRESENT(-30) The image lacks drive manufacturer metadata.
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer is too small; *length holds the required size for a subsequent call.
+
+
+
Note
The returned manufacturer string corresponds to the value recorded by aaruf_set_drive_manufacturer() and may include branding or OEM designations.
+ +

Definition at line 2968 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::drive_manufacturer, MetadataBlockHeader::driveManufacturerLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_drive_model()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_drive_model (const void * context,
uint8_t * buffer,
int32_t * length )
+
+ +

Retrieves the device model information for the imaging drive.

+

Returns the UTF-16LE encoded model identifier for the drive used during acquisition. The model metadata provides finer granularity than the manufacturer name, enabling detailed documentation of imaging hardware capabilities and behavior.

+
Parameters
+ + + + +
contextPointer to a valid aaruformat context.
bufferBuffer that receives the model string; may be NULL while probing required capacity.
lengthPointer to an int32_t indicating buffer size on input and receiving the metadata length on output.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Drive model metadata was available and copied.
AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
AARUF_ERROR_METADATA_NOT_PRESENT(-30) No drive model metadata exists in the image.
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The supplied buffer was insufficient; *length is updated.
+
+
+
Note
Model strings can include firmware suffixes, interface hints, or OEM variations. Consume the data verbatim to maintain accurate provenance records.
+ +

Definition at line 3038 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::drive_model, MetadataBlockHeader::driveModelLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_drive_serial_number()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_drive_serial_number (const void * context,
uint8_t * buffer,
int32_t * length )
+
+ +

Retrieves the imaging drive's serial number metadata.

+

Copies the UTF-16LE encoded serial number reported for the drive used during the imaging session. This metadata enables correlation between images and specific hardware units for forensic chain of custody or quality assurance workflows.

+
Parameters
+ + + + +
contextPointer to a valid aaruformat context.
bufferDestination buffer for the serial number; may be NULL when querying size.
lengthPointer to an int32_t carrying the buffer size on input and receiving the actual serial number length on output.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Drive serial number metadata was copied to buffer.
AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
AARUF_ERROR_METADATA_NOT_PRESENT(-30) No drive serial number metadata is available.
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer was insufficient.
+
+
+
Note
Serial numbers are stored exactly as returned by the imaging hardware and may include leading zeros or spacing that should be preserved.
+ +

Definition at line 3108 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::drive_serial_number, MetadataBlockHeader::driveSerialNumberLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_dumphw()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_dumphw (void * context,
uint8_t * buffer,
size_t * length )
+
+ +

Retrieves the dump hardware block containing acquisition environment information.

+

Extracts the complete DumpHardwareBlock from the image, which documents the hardware and software environments used to create the image. A dump hardware block records one or more "dump environments" – typically combinations of physical devices (drives, controllers, adapters) and the software stacks that performed the read operations. This metadata is essential for understanding the imaging context, validating acquisition integrity, reproducing imaging conditions, and supporting forensic or archival documentation requirements.

+

Each environment entry includes hardware identification (manufacturer, model, revision, firmware, serial number), software identification (name, version, operating system), and optional extent ranges that specify which logical sectors or units were contributed by that particular environment. This structure supports complex imaging scenarios where multiple devices or software configurations were used to create a composite image.

+

The function reconstructs the complete on-disk binary representation of the dump hardware block, including the DumpHardwareHeader followed by all entries with their variable-length UTF-8 strings and extent arrays. The reconstructed block includes a calculated CRC64 checksum over the payload data for integrity verification.

+

This function supports a two-call pattern for buffer size determination:

    +
  1. First call with insufficient buffer (or NULL) returns AARUF_ERROR_BUFFER_TOO_SMALL and sets *length to the required size (sizeof(DumpHardwareHeader) + total payload length)
  2. +
  3. Second call with properly sized buffer retrieves the complete block data
  4. +
+

Alternatively, if the caller already knows the buffer is large enough, a single call will succeed and populate the buffer with the complete dump hardware block.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, opened image context).
bufferPointer to a buffer that will receive the dump hardware block data. Must be large enough to hold the complete block (at least *length bytes on input). May be NULL to query the required buffer size. The buffer will contain the DumpHardwareHeader followed by serialized entries, strings, and extent arrays on success.
lengthPointer to a size_t that serves dual purpose:
    +
  • On input: size of the provided buffer in bytes (ignored if buffer is NULL)
  • +
  • On output: actual size required/used for the dump hardware block in bytes If the function returns AARUF_ERROR_BUFFER_TOO_SMALL, this will be updated to contain the required buffer size for a subsequent successful call.
  • +
+
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully retrieved dump hardware block. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The dump hardware block is present (identifier == DumpHardwareBlock)
  • +
  • The provided buffer is large enough (>= required length)
  • +
  • All hardware entries with their strings and extents are copied to the buffer
  • +
  • The DumpHardwareHeader is written with calculated CRC64 at buffer offset 0
  • +
  • The *length parameter is set to the actual block size
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_open() or aaruf_create()
  • +
+
AARUF_ERROR_CANNOT_READ_BLOCK(-6) The dump hardware block is not present. This occurs when:
    +
  • The image was created without dump hardware information
  • +
  • ctx->dumpHardwareEntriesWithData is NULL (no data loaded)
  • +
  • ctx->dumpHardwareHeader.entries == 0 (no hardware entries)
  • +
  • ctx->dumpHardwareHeader.identifier doesn't equal DumpHardwareBlock
  • +
  • The dump hardware block was not found during image opening
  • +
+
AARUF_ERROR_BUFFER_TOO_SMALL(-12) The provided buffer is insufficient. This occurs when:
    +
  • buffer is NULL (size query mode)
  • +
  • The input *length is less than sizeof(DumpHardwareHeader) + payload length
  • +
  • The *length parameter is updated to contain the required buffer size
  • +
  • No data is copied to the buffer
  • +
  • The caller should allocate a larger buffer and call again
  • +
  • Also returned if calculated entry size exceeds buffer during iteration (sanity check)
  • +
+
+
+
+
Note
Dump Hardware Block Structure:
    +
  • DumpHardwareHeader (16 bytes): identifier, entries count, payload length, CRC64
  • +
  • For each entry (variable size):
      +
    • DumpHardwareEntry (36 bytes): length fields for all strings and extent count
    • +
    • Variable-length UTF-8 strings (in order): manufacturer, model, revision, firmware, serial, software name, software version, software operating system
    • +
    • Array of DumpExtent structures (16 bytes each) if extent count > 0
    • +
    +
  • +
  • All strings are UTF-8 encoded and NOT null-terminated in the serialized block
  • +
  • String lengths are in bytes, not character counts
  • +
+
+
+Dump Hardware Environments:
    +
  • Each entry represents one hardware/software combination used during imaging
  • +
  • Multiple entries support scenarios where different devices contributed different sectors
  • +
  • Extent arrays specify which logical sector ranges each environment contributed
  • +
  • Empty extent arrays (extents == 0) indicate the environment dumped the entire medium
  • +
  • Overlapping extents between entries may indicate verification passes or redundancy
  • +
+
+
+Hardware Identification Fields:
    +
  • manufacturer: Device manufacturer (e.g., "Plextor", "Sony", "Samsung")
  • +
  • model: Device model number (e.g., "PX-716A", "DRU-820A")
  • +
  • revision: Hardware revision identifier
  • +
  • firmware: Firmware version (e.g., "1.11", "KY08")
  • +
  • serial: Device serial number for unique identification
  • +
+
+
+Software Identification Fields:
    +
  • softwareName: Dumping software name (e.g., "Aaru", "ddrescue", "IsoBuster")
  • +
  • softwareVersion: Software version (e.g., "5.3.0", "1.25")
  • +
  • softwareOperatingSystem: Host OS (e.g., "Linux 5.10.0", "Windows 10", "macOS 12.0")
  • +
+
+
+CRC64 Calculation:
    +
  • The function calculates CRC64-ECMA over the payload (everything after the header)
  • +
  • The calculated CRC64 is stored in the returned DumpHardwareHeader
  • +
  • This allows verification of the serialized block integrity
  • +
  • The CRC64 is computed from buffer data, not from the original context
  • +
+
+
+Buffer Layout After Successful Call:
    +
  • Offset 0: DumpHardwareHeader with calculated CRC64
  • +
  • Offset 16: First DumpHardwareEntry
  • +
  • Followed by: First entry's UTF-8 strings (in documented order)
  • +
  • Followed by: First entry's DumpExtent array (if extents > 0)
  • +
  • Repeated for all remaining entries
  • +
+
+
+Use Cases:
    +
  • Forensic documentation requiring complete equipment chain of custody
  • +
  • Archival metadata for long-term preservation requirements
  • +
  • Reproducing imaging conditions for verification or re-imaging
  • +
  • Identifying firmware-specific issues or drive-specific behaviors
  • +
  • Multi-device imaging scenario documentation
  • +
  • Correlating imaging artifacts with specific hardware/software combinations
  • +
+
+
Warning
This function reads from the in-memory dump hardware data loaded during aaruf_open(). It does not perform file I/O operations. The data is reconstructed from the parsed context structures into the on-disk binary format.
+
+The buffer must be valid and large enough to hold the entire dump hardware block. Passing a buffer smaller than required will result in AARUF_ERROR_BUFFER_TOO_SMALL.
+
+String data in the serialized block is NOT null-terminated. Applications parsing the buffer must use the length fields in DumpHardwareEntry to determine string boundaries. The library adds null terminators only for in-memory convenience.
+
+The function performs bounds checking during serialization. If calculated entry sizes exceed the buffer length, AARUF_ERROR_BUFFER_TOO_SMALL is returned even after the initial size check. This should not occur with properly sized buffers but protects against data corruption.
+
See also
DumpHardwareHeader for the block header structure definition.
+
+DumpHardwareEntry for the per-environment entry structure definition.
+
+DumpExtent for the extent range structure definition.
+
+process_dumphw_block() for the loading process during image opening.
+ +

Definition at line 186 of file dump.c.

+ +

References AARU_MAGIC, aaruf_crc64_data(), AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, DumpHardwareHeader::crc64, aaruformat_context::dump_hardware_entries_with_data, aaruformat_context::dump_hardware_header, DumpHardwareBlock, DumpHardwareHeader::entries, DumpHardwareEntriesWithData::entry, DumpHardwareEntriesWithData::extents, DumpHardwareEntry::extents, FATAL, DumpHardwareEntriesWithData::firmware, DumpHardwareEntry::firmwareLength, DumpHardwareHeader::identifier, DumpHardwareHeader::length, aaruformat_context::magic, DumpHardwareEntriesWithData::manufacturer, DumpHardwareEntry::manufacturerLength, DumpHardwareEntriesWithData::model, DumpHardwareEntry::modelLength, DumpHardwareEntriesWithData::revision, DumpHardwareEntry::revisionLength, DumpHardwareEntriesWithData::serial, DumpHardwareEntry::serialLength, DumpHardwareEntriesWithData::softwareName, DumpHardwareEntry::softwareNameLength, DumpHardwareEntriesWithData::softwareOperatingSystem, DumpHardwareEntry::softwareOperatingSystemLength, DumpHardwareEntriesWithData::softwareVersion, DumpHardwareEntry::softwareVersionLength, and TRACE.

+ +
+
+ +

◆ aaruf_get_geometry()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_get_geometry (const void * context,
uint32_t * cylinders,
uint32_t * heads,
uint32_t * sectors_per_track )
+
+ +

Retrieves the logical CHS geometry from the AaruFormat image.

+

Reads the Cylinder-Head-Sector (CHS) geometry information from the image's geometry block and returns the values through output parameters. The geometry block contains legacy-style logical addressing parameters that describe how the storage medium was originally organized in terms of cylinders, heads (tracks per cylinder), and sectors per track. This information is essential for software that requires CHS addressing or for accurately representing the original medium's logical structure.

+
Parameters
+ + + + + +
contextPointer to the aaruformat context (must be a valid, opened image context).
cylindersPointer to store the number of cylinders. Updated on success.
headsPointer to store the number of heads (tracks per cylinder). Updated on success.
sectors_per_trackPointer to store the number of sectors per track. Updated on success.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + +
AARUF_STATUS_OK(0) Successfully retrieved geometry information. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The geometry block is present in the image (identifier == GeometryBlock)
  • +
  • All three output parameters are successfully populated with geometry values
  • +
  • The cylinders parameter contains the total number of cylinders
  • +
  • The heads parameter contains the number of heads per cylinder
  • +
  • The sectors_per_track parameter contains the number of sectors per track
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_open() or aaruf_create()
  • +
+
AARUF_ERROR_CANNOT_READ_BLOCK(-6) The geometry block is not present. This occurs when:
    +
  • The image was created without geometry information
  • +
  • The geometryBlock.identifier field doesn't equal GeometryBlock
  • +
  • The geometry block was not found during image opening
  • +
  • The image format doesn't support or require CHS geometry
  • +
+
+
+
+
Note
Geometry Interpretation:
    +
  • Total logical sectors = cylinders × heads × sectors_per_track
  • +
  • Sector size is not included in the geometry block and must be obtained separately (typically 512 bytes for most block devices, but can vary)
  • +
  • The geometry represents logical addressing, not necessarily physical medium geometry
  • +
  • Modern storage devices often report translated or synthetic geometry values
  • +
+
+
+CHS Addressing Context:
    +
  • CHS addressing was historically used for hard disk drives and floppy disks
  • +
  • Legacy BIOS and older operating systems relied on CHS parameters
  • +
  • LBA (Logical Block Addressing) has largely replaced CHS for modern devices
  • +
  • Some disk image formats and emulators still require CHS information
  • +
+
+
+Geometry Block Availability:
    +
  • Not all image types contain geometry blocks
  • +
  • Optical media (CDs, DVDs) typically don't have CHS geometry
  • +
  • Modern large-capacity drives may not have meaningful CHS values
  • +
  • Check the return value to determine if geometry is available
  • +
+
+
+Parameter Validation:
    +
  • All output parameters must be non-NULL valid pointers
  • +
  • The function does not validate the geometry values themselves
  • +
  • Geometry values of zero or unusually large values may indicate issues
  • +
+
+
Warning
The output parameters are only modified on success (AARUF_STATUS_OK). On error, their values remain unchanged. Initialize them before calling if default values are needed on failure.
+
+This function reads from the in-memory geometry block loaded during aaruf_open(). It does not perform file I/O operations.
+
+Geometry values may not accurately represent physical device geometry, especially for modern drives with zone-based recording or flash storage.
+ +

Definition at line 94 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, GeometryBlockHeader::cylinders, FATAL, aaruformat_context::geometry_block, GeometryBlock, GeometryBlockHeader::heads, GeometryBlockHeader::identifier, aaruformat_context::magic, GeometryBlockHeader::sectorsPerTrack, and TRACE.

+ +
+
+ +

◆ aaruf_get_image_info()

+ +
+
+ + + + + + + + + + + +
int32_t aaruf_get_image_info (const void * context,
ImageInfo * image_info )
+
+ +

Retrieves a deep copy of the ImageInfo structure from the AaruFormat image.

+

Returns a complete copy of the high-level image information summary containing metadata such as image size, sector count, sector size, version information, creation timestamps, and media type. This function performs a deep copy of all fields including string buffers, ensuring the caller receives a complete, independent copy of the image information.

+
Parameters
+ + + +
contextPointer to the aaruformat context (must be a valid, opened image context).
image_infoPointer to an ImageInfo structure to receive the copied data. Must be a valid pointer to allocated memory.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + +
AARUF_STATUS_OK(0) Successfully copied image info. The image_info parameter contains a complete copy of all fields including:
    +
  • HasPartitions: Whether image contains partitions/tracks
  • +
  • HasSessions: Whether image contains multiple sessions
  • +
  • ImageSize: Size of image payload in bytes
  • +
  • Sectors: Total count of addressable sectors/blocks
  • +
  • SectorSize: Size of each logical sector in bytes
  • +
  • Version: Image format version string (NUL-terminated)
  • +
  • Application: Creating application name (NUL-terminated)
  • +
  • ApplicationVersion: Application version string (NUL-terminated)
  • +
  • CreationTime: Image creation timestamp (Windows FILETIME)
  • +
  • LastModificationTime: Last modification timestamp (Windows FILETIME)
  • +
  • MediaType: Media type identifier
  • +
  • MetadataMediaType: Media type for sidecar generation
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC
  • +
  • The context was not properly initialized
  • +
+
+
+
+
Note
The ImageInfo structure contains fixed-size character arrays that are properly NUL-terminated, making it safe to use as C strings.
+
+This function performs a complete deep copy using memcpy, copying all fields including strings, integers, and timestamps.
+
+The caller is responsible for allocating the ImageInfo structure before calling this function. The structure is not dynamically allocated by this function.
+
Warning
The image_info parameter must point to valid, allocated memory of at least sizeof(ImageInfo) bytes. Passing NULL or invalid pointers will result in undefined behavior.
+
+This function reads from the in-memory image_info loaded during aaruf_open() or populated during aaruf_create(). It does not perform file I/O operations.
+ +

Definition at line 3634 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, aaruformat_context::image_info, aaruformat_context::magic, and TRACE.

+ +
+
+ +

◆ aaruf_get_media_barcode()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_media_barcode (const void * context,
uint8_t * buffer,
int32_t * length )
+
+ +

Retrieves the barcode assigned to the physical media or its packaging.

+

Returns the UTF-16LE encoded barcode string that was captured when the image was created. Barcodes are commonly used in institutional workflows for inventory tracking and automated retrieval.

+
Parameters
+ + + + +
contextPointer to a valid aaruformat context.
bufferBuffer that receives the barcode string; may be NULL when probing size requirements.
lengthPointer to an int32_t specifying the buffer size on input and receiving the actual barcode length on output.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Barcode metadata was present and copied successfully.
AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
AARUF_ERROR_METADATA_NOT_PRESENT(-30) No barcode metadata exists in the image.
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The supplied buffer was too small.
+
+
+
Note
Barcode values can be strict alphanumeric codes (e.g., LTO cartridge IDs) or full strings from custom labeling systems. Preserve the returned string exactly for catalog interoperability.
+ +

Definition at line 2825 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::media_barcode, MetadataBlockHeader::mediaBarcodeLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_media_manufacturer()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_media_manufacturer (const void * context,
uint8_t * buffer,
int32_t * length )
+
+ +

Retrieves the recorded media manufacturer name.

+

Provides access to the UTF-16LE encoded manufacturer metadata that identifies the company which produced the physical medium. This information is taken from the MetadataBlock and mirrors the value previously stored via aaruf_set_media_manufacturer().

+
Parameters
+ + + + +
contextPointer to a valid aaruformat context.
bufferBuffer that receives the manufacturer string. May be NULL when probing size.
lengthPointer to an int32_t specifying the buffer size on input and receiving the actual manufacturer string length on output.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Manufacturer metadata was available and copied.
AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
AARUF_ERROR_METADATA_NOT_PRESENT(-30) The image lacks manufacturer metadata.
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer was too small; *length indicates size.
+
+
+
Note
Values may include trailing spaces or vendor-specific capitalization. Treat the returned data as authoritative and avoid trimming unless required by the consuming application.
+ +

Definition at line 2616 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::media_manufacturer, MetadataBlockHeader::mediaManufacturerLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_media_model()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_media_model (const void * context,
uint8_t * buffer,
int32_t * length )
+
+ +

Retrieves the media model or product designation metadata.

+

Returns the UTF-16LE encoded model name that specifies the exact product variant of the physical medium. The function mirrors the set counterpart and is useful for accurately documenting media specifications during preservation workflows.

+
Parameters
+ + + + +
contextPointer to a valid aaruformat context.
bufferDestination buffer for the model string; may be NULL when querying required size.
lengthPointer to an int32_t that on input contains the buffer capacity in bytes and on output is updated with the actual metadata length.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Model metadata was successfully copied.
AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
AARUF_ERROR_METADATA_NOT_PRESENT(-30) No media model metadata is present in the image.
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The caller-provided buffer is too small.
+
+
+
Note
Model strings often contain performance ratings (e.g., "16x", "LTO-7"). The data is opaque and should be handled without modification unless necessary.
+ +

Definition at line 2686 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::media_model, MetadataBlockHeader::mediaModelLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_media_part_number()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_media_part_number (const void * context,
uint8_t * buffer,
int32_t * length )
+
+ +

Retrieves the media part number recorded in the MetadataBlock.

+

Provides access to the UTF-16LE encoded part number identifying the precise catalog or ordering code for the physical medium. Part numbers help archivists procure exact replacements and document specific media variants used during acquisition.

+
Parameters
+ + + + +
contextPointer to a valid aaruformat context.
bufferDestination buffer for the part number string. May be NULL while querying size.
lengthPointer to an int32_t that supplies the buffer size on input and is updated with the actual part number length on output.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Part number metadata was returned successfully.
AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
AARUF_ERROR_METADATA_NOT_PRESENT(-30) No part number metadata exists.
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer was insufficient; *length contains the required size.
+
+
+
Note
Part numbers may include manufacturer-specific formatting such as hyphens or suffix letters. The library stores and returns the data verbatim.
+ +

Definition at line 2896 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::media_part_number, MetadataBlockHeader::mediaPartNumberLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_media_sequence()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_media_sequence (const void * context,
int32_t * sequence,
int32_t * last_sequence )
+
+ +

Retrieves the media sequence metadata for multi-volume image sets.

+

Reads the media sequence fields stored in the MetadataBlock header and returns the current media number together with the final media number for the complete set. This information indicates the position of the imaged medium within a multi-volume collection (for example, "disc 2 of 5"). The function operates entirely on in-memory structures populated during aaruf_open(); no additional disk I/O is performed.

+
Parameters
+ + + + +
contextPointer to an initialized aaruformat context opened for reading or writing.
sequencePointer that receives the current media sequence number (typically 1-based).
last_sequencePointer that receives the total number of media in the set.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + +
AARUF_STATUS_OK(0) Metadata was present and the output parameters were populated.
AARUF_ERROR_NOT_AARUFORMAT(-1) The provided context pointer is NULL or not an aaruformat context (magic mismatch).
AARUF_ERROR_METADATA_NOT_PRESENT(-30) The MetadataBlock was not present in the image, making sequence data unavailable.
+
+
+
Note
For standalone media, both sequence and last_sequence are commonly set to 1. Some creators may also set them to 0 to indicate the absence of sequence semantics; callers should handle either pattern gracefully.
+
+The function does not validate logical consistency (e.g., whether sequence <= last_sequence); it simply returns the values stored in the image header.
+ +

Definition at line 2337 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, MetadataBlockHeader::lastMediaSequence, aaruformat_context::magic, MetadataBlockHeader::mediaSequence, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_media_serial_number()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_media_serial_number (const void * context,
uint8_t * buffer,
int32_t * length )
+
+ +

Retrieves the media serial number recorded in the image metadata.

+

Copies the UTF-16LE encoded serial number identifying the specific physical medium. Serial numbers are particularly important for forensic tracking and archival provenance, enabling correlation between the physical item and its digital representation.

+
Parameters
+ + + + +
contextPointer to a valid aaruformat context.
bufferDestination buffer for the serial number. May be NULL to determine required size.
lengthPointer to an int32_t that on input holds the buffer size and on output receives the actual serial number length.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Serial number metadata was copied into buffer.
AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
AARUF_ERROR_METADATA_NOT_PRESENT(-30) No serial number metadata was stored in the image.
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer was too small.
+
+
+
Note
Serial numbers may contain spaces, hyphens, or alphanumeric characters. The library does not normalize or validate these strings.
+ +

Definition at line 2756 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::media_serial_number, MetadataBlockHeader::mediaSerialNumberLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_media_tag_type_for_datatype()

+ +
+
+ + + + + + + +
int32_t aaruf_get_media_tag_type_for_datatype (const int32_t type)
+
+ +

Converts an image data type to an Aaru media tag type.

+

Maps the given image data type to the corresponding Aaru media tag type.

+
Parameters
+ + +
typeImage data type identifier.
+
+
+
Returns
Corresponding Aaru media tag type, or -1 if not found.
+ +

Definition at line 31 of file helpers.c.

+ +

References AACS_CPRM_MKB, AACS_DataKeys, AACS_LBAExtents, AACS_MediaIdentifier, AACS_MKB, AACS_SerialNumber, AACS_VolumeIdentifier, AacsDataKeys, AacsLbaExtents, AacsMediaIdentifier, AacsMediaKeyBlock, AacsSerialNumber, AacsVolumeIdentifier, ATA_IDENTIFY, AtaIdentify, ATAPI_IDENTIFY, AtapiIdentify, BD_BCA, BD_CartridgeStatus, BD_DDS, BD_DI, BD_SpareArea, BlurayBca, BlurayCartridgeStatus, BlurayDds, BlurayDi, BluraySpareArea, CD_ATIP, CD_FirstTrackPregap, CD_FullTOC, CD_LeadIn, CD_LeadOut, CD_MCN, CD_PMA, CD_SessionInfo, CD_TEXT, CD_TOC, CompactDiscAtip, CompactDiscFirstTrackPregap, CompactDiscLeadIn, CompactDiscLeadInCdText, CompactDiscLeadOut, CompactDiscMediaCatalogueNumber, CompactDiscPartialToc, CompactDiscPma, CompactDiscSessionInfo, CompactDiscToc, CprmMediaKeyBlock, DCB, DVD_ADIP, DVD_BCA, DVD_CMI, DVD_DiscKey, DVD_DiscKey_Decrypted, DVD_DMI, DVD_MediaIdentifier, DVD_MKB, DVD_PFI, DvdAdip, DvdBca, DvdDiscControlBlock, DvdDiscKey, DvdDiscKeyDecrypted, DVDDL_JumpIntervalSize, DVDDL_LayerCapacity, DVDDL_ManualLayerJumpLBA, DVDDL_MiddleZoneAddress, DvdDlJumpIntervalSize, DvdDlLayerCapacity, DvdDlManualLayerJumpLba, DvdDlMiddleZoneAddress, DvdDmi, DvdLeadInCmi, DvdMediaIdentifier, DvdMediaKeyBlock, DvdPfi, DVDR_MediaIdentifier, DVDR_PFI, DVDR_PreRecordedInfo, DVDR_RMD, DVDRAM_DDS, DVDRAM_MediumStatus, DVDRAM_SpareArea, DvdRamDds, DvdRamMediumStatus, DvdRamSpareArea, DvdRMediaIdentifier, DvdRPfi, DvdRPrerecordedInfo, DvdRRmd, Floppy_LeadOut, FloppyLeadOut, HDDVD_CPI, HDDVD_MediumStatus, HdDvdCpi, HdDvdMediumStatus, Hybrid_RecognizedLayers, HybridRecognizedLayers, MMC_CID, MMC_CSD, MMC_DiscInformation, MMC_ExtendedCSD, MMC_OCR, MMC_POWResourcesInformation, MMC_TrackResourcesInformation, MMC_WriteProtection, MultiMediaCardCid, MultiMediaCardCsd, MultiMediaCardExtendedCsd, MultiMediaCardOcr, PCMCIA_CIS, PcmciaCis, SCSI_INQUIRY, SCSI_MODEPAGE_2A, SCSI_MODESENSE_10, SCSI_MODESENSE_6, ScsiInquiry, ScsiMmcDiscInformation, ScsiMmcPowResourcesInformation, ScsiMmcTrackResourcesInformation, ScsiMmcWriteProtection, ScsiModePage2A, ScsiModeSense10, ScsiModeSense6, SD_CID, SD_CSD, SD_OCR, SD_SCR, SecureDigitalCid, SecureDigitalCsd, SecureDigitalOcr, SecureDigitalScr, USB_Descriptors, UsbDescriptors, Xbox_DMI, Xbox_PFI, Xbox_SecuritySector, XboxDmi, XboxPfi, and XboxSecuritySector.

+ +

Referenced by process_data_block().

+ +
+
+ +

◆ aaruf_get_media_title()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_media_title (const void * context,
uint8_t * buffer,
int32_t * length )
+
+ +

Retrieves the media title or label captured during image creation.

+

Returns the UTF-16LE encoded media title string, representing markings or labels present on the original physical media. This function allows applications to present or archive the media title alongside the image, preserving contextual information from the physical artifact.

+
Parameters
+ + + + +
contextPointer to a valid aaruformat context.
bufferDestination buffer for the UTF-16LE title string. May be NULL when querying size.
lengthPointer to an int32_t that on input holds the buffer capacity in bytes and on output receives the actual title length.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) The media title was available and copied to buffer.
AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
AARUF_ERROR_METADATA_NOT_PRESENT(-30) No media title metadata exists.
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The supplied buffer was insufficient.
+
+
+
Note
Titles may contain international characters, control codes, or mixed casing. The library does not attempt to sanitize or interpret the string.
+ +

Definition at line 2546 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::media_title, MetadataBlockHeader::mediaTitleLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_get_negative_sectors()

+ +
+
+ + + + + + + + + + + +
int32_t aaruf_get_negative_sectors (const void * context,
uint16_t * sectors )
+
+ +

Retrieves the number of negative (pre-gap) sectors in the AaruFormat image.

+

Returns the count of negative sectors that precede the standard user data area. Negative sectors are used to capture pre-gap data, lead-in areas, and other metadata that exists before the main user-accessible storage region. This is particularly important for optical media (CD, DVD, BD) where the lead-in contains the Table of Contents (TOC) and other essential disc structures, and for audio CDs where pre-gap sectors contain silence or hidden tracks. For most hard disk and floppy disk images, this value is typically zero.

+
Parameters
+ + + +
contextPointer to a valid aaruformat context (must be properly initialized).
sectorsPointer to a uint16_t that receives the negative sector count on success.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + +
AARUF_STATUS_OK(0) Successfully retrieved the negative sector count. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context magic number matches AARU_MAGIC
  • +
  • The sectors parameter is successfully populated with the negative sector count
  • +
  • The value is taken from ctx->user_data_ddt_header.negative
  • +
  • For optical media with lead-in data: sectors may be non-zero
  • +
  • For standard hard disk/floppy images: sectors is typically 0
  • +
  • Maximum value is 65,535 (uint16_t limit)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_open() or aaruf_create()
  • +
+
+
+
+
Note
Negative Sector Addressing:
    +
  • Negative sectors are addressed with the 'negative' flag set to true
  • +
  • Sector addresses range from 0 to (negative_sectors - 1)
  • +
  • When calling aaruf_read_sector() or aaruf_write_sector():
      +
    • Use negative=true
    • +
    • Use sector_address in range [0, negative_sectors - 1]
    • +
    • The actual logical position is before the user data area
    • +
    +
  • +
+
+
+Optical Media Context:
    +
  • CD-ROM/CD-DA: Negative sectors contain lead-in area with TOC (Table of Contents). The lead-in typically spans LBA -450000 to -1, though only a portion may be captured. Pre-gap sectors (usually 150 sectors/2 seconds before each track) may also be stored as negative sectors for the first track.
  • +
  • DVD: May contain lead-in with disc structure information, copyright data, and region codes. The lead-in area varies by format (DVD-ROM, DVD-R, DVD+R, etc.).
  • +
  • Blu-ray: Lead-in contains disc information, burst cutting area (BCA), and other metadata. The structure differs between BD-ROM, BD-R, and BD-RE.
  • +
+
+
+Hard Disk and Floppy Context:
    +
  • Hard disk drives: Negative sectors are typically zero unless capturing special manufacturer reserved areas (HPA, DCO) that precede the standard user area.
  • +
  • Floppy disks: Negative sectors are typically zero as floppies have a simple linear sector layout without lead-in areas.
  • +
+
+
+Audio CD Hidden Tracks:
    +
  • Some audio CDs contain hidden tracks in the pre-gap of the first track
  • +
  • These pre-gap sectors can extend up to several minutes before track 1
  • +
  • Negative sectors can capture this "hidden" audio data
  • +
  • The pre-gap for track 1 typically starts at LBA -150 (2 seconds)
  • +
+
+
+DDT Header Source:
    +
  • The value is retrieved from ctx->user_data_ddt_header.negative
  • +
  • The DDT (Deduplication and Data Table) header tracks all sector allocation
  • +
  • This field is populated during image creation with aaruf_create()
  • +
  • The value is fixed for read-only images opened with aaruf_open()
  • +
  • Maximum representable value is 65,535 (uint16_t)
  • +
+
+
+Total Addressable Space:
    +
  • Total sectors = negative_sectors + user_sectors + overflow_sectors
  • +
  • The negative region comes first in logical order
  • +
  • Followed by the user region [0, user_sectors - 1]
  • +
  • Followed by the overflow region if present
  • +
+
+
+Relationship to Image Creation:
    +
  • The negative_sectors value is specified when calling aaruf_create()
  • +
  • It should be set based on the medium type and imaging requirements:
      +
    • Optical discs: Set to the number of lead-in sectors captured
    • +
    • Hard disks: Typically 0, unless capturing HPA/DCO areas
    • +
    • Floppy disks: Typically 0
    • +
    • Audio CDs: May be non-zero to capture pre-gap hidden tracks
    • +
    +
  • +
+
+
Warning
The sectors parameter is only modified on success (AARUF_STATUS_OK). On error, its value remains unchanged. Initialize it before calling if a default value is needed on failure.
+
+This function reads from the in-memory DDT header loaded during aaruf_open() or set during aaruf_create(). It does not perform file I/O operations and executes quickly.
+
+The maximum negative sector count is 65,535 due to the uint16_t storage type. If imaging optical media with larger lead-in areas, some data may not be representable. This limit is generally sufficient for most practical cases.
+
+Negative sector data may contain copy-protected or encrypted content (e.g., CSS on DVDs, AACS on Blu-rays). Handle this data according to applicable laws and licensing agreements.
+ +

Definition at line 3417 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, aaruformat_context::magic, DdtHeader2::negative, TRACE, and aaruformat_context::user_data_ddt_header.

+ +
+
+ +

◆ aaruf_get_overflow_sectors()

+ +
+
+ + + + + + + + + + + +
int32_t aaruf_get_overflow_sectors (const void * context,
uint16_t * sectors )
+
+ +

Retrieves the number of overflow (post-gap) sectors in the AaruFormat image.

+

Returns the count of overflow sectors that follow the standard user data area. Overflow sectors are used to capture post-gap data, lead-out areas, and other metadata that exists after the main user-accessible storage region. This is particularly important for optical media (CD, DVD, BD) where the lead-out marks the physical end of the recorded data and contains disc finalization information, and for multi-session discs where gaps between sessions need to be preserved. For most hard disk and floppy disk images, this value is typically zero.

+
Parameters
+ + + +
contextPointer to a valid aaruformat context (must be properly initialized).
sectorsPointer to a uint16_t that receives the overflow sector count on success.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + +
AARUF_STATUS_OK(0) Successfully retrieved the overflow sector count. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context magic number matches AARU_MAGIC
  • +
  • The sectors parameter is successfully populated with the overflow sector count
  • +
  • The value is taken from ctx->user_data_ddt_header.overflow
  • +
  • For optical media with lead-out data: sectors may be non-zero
  • +
  • For standard hard disk/floppy images: sectors is typically 0
  • +
  • Maximum value is 65,535 (uint16_t limit)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_open() or aaruf_create()
  • +
+
+
+
+
Note
Overflow Sector Addressing:
    +
  • Overflow sectors are addressed with the 'negative' flag set to false
  • +
  • Sector addresses range from user_sectors to (user_sectors + overflow_sectors - 1)
  • +
  • When calling aaruf_read_sector() or aaruf_write_sector():
      +
    • Use negative=false
    • +
    • Use sector_address in range [user_sectors, user_sectors + overflow_sectors - 1]
    • +
    • The actual logical position is after the user data area
    • +
    +
  • +
+
+
+Optical Media Context:
    +
  • CD-ROM/CD-DA: Overflow sectors contain the lead-out area, which marks the physical end of the disc's recorded data. The lead-out consists of unreadable sectors filled with specific patterns.
  • +
  • DVD: May contain lead-out with disc finalization data, middle area (for dual-layer), and outer zone. DVD+R/RW discs may have substantial lead-out areas.
  • +
  • Blu-ray: Lead-out contains disc finalization markers and padding. For multi-layer discs, may include middle zones and outer areas.
  • +
+
+
+Multi-Session and Track Context:
    +
  • Multi-session optical discs have gaps between sessions
  • +
  • Audio CDs with post-gap after the last track may use overflow sectors
  • +
  • Track post-gaps (silence after audio tracks) typically 2 seconds/150 sectors
  • +
+
+
+Hard Disk and Floppy Context:
    +
  • Hard disk drives: Overflow sectors are typically zero unless capturing special manufacturer reserved areas (like DCO or HPA) that follow the standard user area.
  • +
  • Floppy disks: Overflow sectors are typically zero as floppies have a simple linear sector layout without lead-out areas. They may contain mastering information.
  • +
  • Some proprietary copy protection schemes may place data beyond the normal capacity, which could be captured as overflow sectors.
  • +
+
+
+DDT Header Source:
    +
  • The value is retrieved from ctx->user_data_ddt_header.overflow
  • +
  • The DDT (Deduplication and Data Table) header tracks all sector allocation
  • +
  • This field is populated during image creation with aaruf_create()
  • +
  • The value is fixed for read-only images opened with aaruf_open()
  • +
  • Maximum representable value is 65,535 (uint16_t)
  • +
+
+
+Total Addressable Space:
    +
  • Total sectors = negative_sectors + user_sectors + overflow_sectors
  • +
  • The negative region comes first in logical order
  • +
  • Followed by the user region [0, user_sectors - 1]
  • +
  • Followed by the overflow region at the end
  • +
  • Overflow represents the final addressable range in the image
  • +
+
+
+Relationship to Image Creation:
    +
  • The overflow_sectors value is specified when calling aaruf_create()
  • +
  • It should be set based on the medium type and imaging requirements:
      +
    • Optical discs: Set to the number of lead-out sectors captured
    • +
    • Multi-session discs: May include inter-session gaps
    • +
    • Hard disks: Typically 0, unless capturing post-user reserved areas
    • +
    • Floppy disks: Typically 0
    • +
    • Copy-protected media: May be non-zero to capture protection schemes
    • +
    +
  • +
+
+
+Forensic Imaging Considerations:
    +
  • Some copy protection schemes intentionally place data in overflow regions
  • +
  • These "overburn" areas extend beyond the disc's rated capacity
  • +
  • Overflow sectors ensure complete forensic capture of all readable data
  • +
  • Important for authenticity verification and copy protection analysis
  • +
+
+
Warning
The sectors parameter is only modified on success (AARUF_STATUS_OK). On error, its value remains unchanged. Initialize it before calling if a default value is needed on failure.
+
+This function reads from the in-memory DDT header loaded during aaruf_open() or set during aaruf_create(). It does not perform file I/O operations and executes quickly.
+
+The maximum overflow sector count is 65,535 due to the uint16_t storage type. If imaging optical media with larger lead-out areas or extensive overburn regions, some data may not be representable. This limit is generally sufficient for most practical cases.
+
+Overflow sector data may be difficult or impossible to read on some drives, as it often resides in lead-out areas or beyond rated capacity. The presence of overflow sectors in an image indicates the imaging drive was capable of reading these extended areas, but other drives may not be able to access them.
+ +

Definition at line 3552 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, aaruformat_context::magic, DdtHeader2::overflow, TRACE, and aaruformat_context::user_data_ddt_header.

+ +
+
+ +

◆ aaruf_get_tape_file()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_get_tape_file (const void * context,
const uint8_t partition,
const uint32_t file,
uint64_t * starting_block,
uint64_t * ending_block )
+
+ +

Retrieves the block range for a specific tape file from an Aaru tape image.

+

Queries the tape file hash table to locate a file by its partition and file number, returning the first and last block addresses that define the file's extent on the tape medium. This function provides the core lookup mechanism for accessing logical files stored in tape images.

+

Tape File Identification: Each tape file is uniquely identified by a combination of:

    +
  • Partition number (8-bit): The tape partition containing the file
  • +
  • File number (32-bit): The sequential file number within that partition
  • +
+

These two values are combined into a 64-bit composite key: key = (partition << 32) | file_number

+

This composite key is used to perform a hash table lookup in the context's tapeFiles table, which was previously populated by process_tape_files_block() during image initialization.

+

Block Range Semantics: The returned block range [FirstBlock, LastBlock] is inclusive on both ends:

    +
  • FirstBlock: The first block address where the file begins
  • +
  • LastBlock: The final block address where the file ends (inclusive)
  • +
  • Block count: (LastBlock - FirstBlock + 1)
  • +
+

Block addresses are absolute positions within the tape image's logical block space, not relative to the partition or file.

+

Typical Usage Flow:

    +
  1. Open an Aaru tape image with aaruf_open()
  2. +
  3. Call aaruf_get_tape_file() to get the block range for a specific file
  4. +
  5. Use the returned block range to read the file's data blocks
  6. +
  7. Repeat for other files as needed
  8. +
+

Error Handling: The function performs validation in the following order:

    +
  1. Context pointer validation (NULL check)
  2. +
  3. Magic number verification (ensures valid aaruformat context)
  4. +
  5. Hash table lookup for the specified partition/file combination
  6. +
+

If any validation fails, an appropriate error code is returned and the output parameters (starting_block, ending_block) are left unmodified.

+

Thread Safety: This function performs read-only operations on the context and is safe to call from multiple threads concurrently, provided the context is not being modified by other operations (e.g., during image opening/closing).

+

Performance Characteristics:

    +
  • Hash table lookup: O(1) average case
  • +
  • No I/O operations performed
  • +
  • Minimal stack usage
  • +
  • Suitable for high-frequency queries
  • +
+
Parameters
+ + + + + + +
contextPointer to an initialized aaruformat context. Must not be NULL. The context must have been successfully opened with aaruf_open() and contain a valid tape file hash table. The context is treated as const and is not modified by this operation.
partitionThe partition number (0-255) containing the requested file. For single-partition tapes, this is typically 0. Multi-partition tapes may have files in different partitions with potentially overlapping file numbers.
fileThe file number within the specified partition. File numbers are typically sequential starting from 0 or 1, but gaps may exist if files were deleted or the tape was written non-sequentially.
[out]starting_blockPointer to receive the first block address of the file. Must not be NULL. Only modified on success. The value written represents the inclusive start of the file's block range.
[out]ending_blockPointer to receive the last block address of the file. Must not be NULL. Only modified on success. The value written represents the inclusive end of the file's block range.
+
+
+
Return values
+ + + + +
AARUF_STATUS_OK(0) Successfully retrieved tape file information. Both output parameters have been populated with valid block addresses. The requested partition/file combination exists in the image's file table.
AARUF_ERROR_NOT_AARUFORMAT(-1) Invalid context or context validation failed. This is returned when:
    +
  • The context pointer is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (corrupted or wrong type) The output parameters are not modified.
  • +
+
AARUF_ERROR_TAPE_FILE_NOT_FOUND(-28) The requested partition/file combination does not exist in the image's tape file table. This is returned when:
    +
  • The specified partition number has no files
  • +
  • The specified file number doesn't exist in the given partition
  • +
  • The tape file block was not present or failed to load during image open The output parameters are not modified.
  • +
+
+
+
+
Note
The function logs entry and exit points via TRACE macros when tracing is enabled, including parameter values and return codes for debugging.
+
+The tape file hash table (ctx->tapeFiles) must have been populated during image initialization. If the image doesn't contain a TapeFileBlock, or if that block failed to load, all queries will return AARUF_ERROR_TAPE_FILE_NOT_FOUND.
+
+For images without tape file metadata, applications should fall back to direct block-based access or partition-level operations.
+
+The returned block addresses are logical block numbers. To read actual data, these must be translated through the appropriate read functions that handle the image's block encoding, compression, and DDT mapping.
+
Warning
The output parameter pointers must be valid. Passing NULL for either starting_block or ending_block will cause undefined behavior (likely a crash when the function attempts to dereference them on success).
+
+If the same partition/file combination appears multiple times in the TapeFileBlock, only the last occurrence is retained (due to HASH_REPLACE behavior in process_tape_files_block). This should not occur in valid images but may happen with corrupted or malformed tape file metadata.
+
See also
process_tape_files_block() for tape file table initialization
+
+TapeFileEntry for the structure defining file block ranges
+
+tapeFileHashEntry for the hash table entry structure
+
+aaruf_get_tape_partition() for partition-level queries (if available)
+ +

Definition at line 569 of file tape.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_TAPE_FILE_NOT_FOUND, AARUF_STATUS_OK, FATAL, TapeFileHashEntry::fileEntry, TapeFileEntry::FirstBlock, TapeFileEntry::LastBlock, aaruformat_context::magic, aaruformat_context::tape_files, and TRACE.

+ +
+
+ +

◆ aaruf_get_tape_partition()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_get_tape_partition (const void * context,
const uint8_t partition,
uint64_t * starting_block,
uint64_t * ending_block )
+
+ +

Retrieves the block range for a specific tape partition from an Aaru tape image.

+

Queries the tape partition hash table to locate a partition by its partition number, returning the first and last block addresses that define the partition's extent on the tape medium. This function provides the core lookup mechanism for accessing partition layout information in tape images.

+

Tape Partition Identification: Each tape partition is uniquely identified by its partition number (0-255). Most tapes have a single partition (partition 0), but multi-partition formats like LTO, DLT, and AIT support multiple partitions with independent block address spaces.

+

The partition number is used as the hash table key to perform a lookup in the context's tapePartitions table, which was previously populated by process_tape_partitions_block() during image initialization.

+

Block Range Semantics: The returned block range [FirstBlock, LastBlock] is inclusive on both ends:

    +
  • FirstBlock: The first block address in the partition (often 0, but format-dependent)
  • +
  • LastBlock: The final block address in the partition (inclusive)
  • +
  • Block count: (LastBlock - FirstBlock + 1)
  • +
+

Block addresses are local to each partition. Different partitions may have overlapping logical block numbers (e.g., both partition 0 and partition 1 can have blocks 0-1000). When accessing blocks, both the partition number and block number are required for unique identification.

+

Typical Usage Flow:

    +
  1. Open an Aaru tape image with aaruf_open()
  2. +
  3. Call aaruf_get_tape_partition() to get the block range for a specific partition
  4. +
  5. Use the returned block range to understand partition boundaries
  6. +
  7. Access files within the partition using aaruf_get_tape_file()
  8. +
  9. Repeat for other partitions as needed
  10. +
+

Error Handling: The function performs validation in the following order:

    +
  1. Context pointer validation (NULL check)
  2. +
  3. Magic number verification (ensures valid aaruformat context)
  4. +
  5. Hash table lookup for the specified partition number
  6. +
+

If any validation fails, an appropriate error code is returned and the output parameters (starting_block, ending_block) are left unmodified.

+

Thread Safety: This function performs read-only operations on the context and is safe to call from multiple threads concurrently, provided the context is not being modified by other operations (e.g., during image opening/closing).

+

Performance Characteristics:

    +
  • Hash table lookup: O(1) average case
  • +
  • No I/O operations performed
  • +
  • Minimal stack usage
  • +
  • Suitable for high-frequency queries
  • +
+

Partition Layout Information: The partition metadata is essential for:

    +
  • Understanding the physical organization of the tape
  • +
  • Determining partition boundaries for file access
  • +
  • Validating that file block ranges fall within partition limits
  • +
  • Supporting multi-partition tape formats correctly
  • +
  • Preserving original tape partitioning schemes
  • +
+
Parameters
+ + + + + +
contextPointer to an initialized aaruformat context. Must not be NULL. The context must have been successfully opened with aaruf_open() and contain a valid tape partition hash table. The context is treated as const and is not modified by this operation.
partitionThe partition number (0-255) to query. For single-partition tapes, this is typically 0. Multi-partition tapes may have multiple partitions numbered sequentially from 0.
[out]starting_blockPointer to receive the first block address of the partition. Must not be NULL. Only modified on success. The value written represents the inclusive start of the partition's block range (often 0, but format-dependent).
[out]ending_blockPointer to receive the last block address of the partition. Must not be NULL. Only modified on success. The value written represents the inclusive end of the partition's block range.
+
+
+
Return values
+ + + + +
AARUF_STATUS_OK(0) Successfully retrieved tape partition information. Both output parameters have been populated with valid block addresses. The requested partition exists in the image's partition table.
AARUF_ERROR_NOT_AARUFORMAT(-1) Invalid context or context validation failed. This is returned when:
    +
  • The context pointer is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (corrupted or wrong type) The output parameters are not modified.
  • +
+
AARUF_ERROR_TAPE_PARTITION_NOT_FOUND(-29) The requested partition number does not exist in the image's tape partition table. This is returned when:
    +
  • The specified partition number was not defined in the TapePartitionBlock
  • +
  • The tape partition block was not present or failed to load during image open
  • +
  • The partition number is out of range for this tape The output parameters are not modified.
  • +
+
+
+
+
Note
The function logs entry and exit points via TRACE macros when tracing is enabled, including parameter values and return codes for debugging.
+
+The tape partition hash table (ctx->tapePartitions) must have been populated during image initialization. If the image doesn't contain a TapePartitionBlock, or if that block failed to load, all queries will return AARUF_ERROR_TAPE_PARTITION_NOT_FOUND.
+
+For images without tape partition metadata, the entire tape may be treated as a single implicit partition, and applications should handle the absence of partition information gracefully.
+
+The returned block addresses are logical block numbers within the partition's address space. To read actual data, these must be combined with the partition number and translated through the appropriate read functions.
+
+Partition metadata is primarily informational and used for validation. File access is primarily driven by file metadata (TapeFileBlock), which references partition numbers to establish context.
+
Warning
The output parameter pointers must be valid. Passing NULL for either starting_block or ending_block will cause undefined behavior (likely a crash when the function attempts to dereference them on success).
+
+If the same partition number appears multiple times in the TapePartitionBlock, only the last occurrence is retained (due to HASH_REPLACE behavior in process_tape_partitions_block). This should not occur in valid images but may happen with corrupted or malformed partition metadata.
+
+Single-partition tapes may not include a TapePartitionBlock at all, in which case this function will always return AARUF_ERROR_TAPE_PARTITION_NOT_FOUND. Applications should handle this case and assume a default partition 0 spanning the entire tape.
+
See also
process_tape_partitions_block() for partition table initialization
+
+TapePartitionEntry for the structure defining partition block ranges
+
+TapePartitionHashEntry for the hash table entry structure
+
+aaruf_get_tape_file() for file-level queries within partitions
+
+aaruf_set_tape_partition() for setting partition information during write
+ +

Definition at line 982 of file tape.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_TAPE_PARTITION_NOT_FOUND, AARUF_STATUS_OK, FATAL, TapePartitionEntry::FirstBlock, TapePartitionEntry::LastBlock, aaruformat_context::magic, TapePartitionHashEntry::partitionEntry, aaruformat_context::tape_partitions, and TRACE.

+ +
+
+ +

◆ aaruf_get_tracks()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_tracks (const void * context,
uint8_t * buffer,
size_t * length )
+
+ +

Retrieve the array of track descriptors contained in an opened AaruFormat image.

+

Provides the caller with a contiguous array of all track entries found in the image. The function follows a two-step usage pattern allowing callers to query the required buffer size before performing the actual copy.

+

Usage pattern:

    +
  • First call with buffer == NULL (or *length smaller than required). The function sets *length to the required size and returns AARUF_ERROR_BUFFER_TOO_SMALL.
  • +
  • Allocate a buffer of at least *length bytes and call again. On success, the function copies all TrackEntry structures and returns AARUF_STATUS_OK with *length set to the bytes copied.
  • +
+

The returned data is a raw copy of internal TrackEntry structures (host endianness). The caller does not assume ownership of internal memory; only the caller-provided buffer should be freed by the caller.

+

Preconditions (

Precondition
):
    +
  • +
+
+
+context is a valid pointer to an aaruformatContext previously returned by an open function.
    +
  • +
+
+
+context->magic == AARU_MAGIC.
    +
  • +
+
+
+process_tracks_block() has run (implicitly done during image open) populating trackEntries.
+

Thread safety:

    +
  • Read-only access; safe for concurrent calls on different contexts.
  • +
  • Concurrent calls on the same context are safe only if no other thread is modifying/destroying it.
  • +
+

Buffer sizing logic:

    +
  • required_length = ctx->tracksHeader.entries * sizeof(TrackEntry)
  • +
  • If buffer == NULL OR *length < required_length => *length updated, return AARUF_ERROR_BUFFER_TOO_SMALL.
  • +
  • On success *length == required_length.
  • +
+

Error strategy:

    +
  • Validation failures: return specific error codes and log through FATAL()/TRACE().
  • +
  • No partial copies are performed.
  • +
+
Parameters
+ + + + +
contextOpaque pointer that MUST point to a valid aaruformatContext.
bufferDestination buffer for a copy of all TrackEntry structures, or NULL to query size.
lengthIn/Out: On entry capacity of buffer (ignored if buffer == NULL). On return required or copied size in bytes. Must not be NULL.
+
+
+
Returns
int32_t API status code.
+
Return values
+ + + + + +
AARUF_STATUS_OKSuccess; buffer filled.
AARUF_ERROR_NOT_AARUFORMATcontext is NULL or not a valid libaaruformat context.
AARUF_ERROR_TRACK_NOT_FOUNDNo tracks present (entries == 0 or internal array NULL).
AARUF_ERROR_BUFFER_TOO_SMALLSizing query / provided buffer insufficient; *length updated.
+
+
+
Warning
Passing an invalid context yields an error; no data is written to buffer.
+
+The function never performs partial copies.
+
Note
Order of TrackEntry elements matches on-disk order.
+
+Caller may further filter (e.g., data vs audio) after retrieval.
+
Since
1.0
+

Usage example (conceptual):

    +
  1. Open an image obtaining a valid aaruformatContext pointer.
  2. +
  3. Invoke aaruf_get_tracks(ctx, NULL, &size) to query required buffer size (expect AARUF_ERROR_BUFFER_TOO_SMALL).
  4. +
  5. Allocate a buffer of "size" bytes.
  6. +
  7. Invoke aaruf_get_tracks(ctx, buffer, &size) again; on AARUF_STATUS_OK iterate over (size / sizeof(TrackEntry)) entries.
  8. +
  9. Free the buffer and close the image when done.
  10. +
+ +

Definition at line 281 of file optical.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_TRACK_NOT_FOUND, AARUF_STATUS_OK, TracksHeader::entries, FATAL, aaruformat_context::magic, TRACE, aaruformat_context::track_entries, and aaruformat_context::tracks_header.

+ +
+
+ +

◆ aaruf_get_user_sectors()

+ +
+
+ + + + + + + + + + + +
int32_t aaruf_get_user_sectors (const void * context,
uint64_t * sectors )
+
+ +

Retrieves the total number of user-accessible sectors in the AaruFormat image.

+

Returns the count of standard user data sectors in the image, excluding any negative (pre-gap) or overflow (post-gap) sectors. This represents the primary addressable sector range that contains the main user data, typically corresponding to the logical capacity of the storage medium as it would be seen by an operating system or file system. For optical media, this excludes lead-in and lead-out areas. For hard disks, this represents the standard LBA-addressable range.

+
Parameters
+ + + +
contextPointer to a valid aaruformat context (must be properly initialized).
sectorsPointer to a uint64_t that receives the total user sector count on success.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + +
AARUF_STATUS_OK(0) Successfully retrieved the user sector count. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context magic number matches AARU_MAGIC
  • +
  • The sectors parameter is successfully populated with the user sector count
  • +
  • The value is taken from ctx->user_data_ddt_header.blocks
  • +
  • For block devices: sectors typically equals the total capacity in sectors
  • +
  • For optical media: sectors represents the user data area excluding lead-in/lead-out
  • +
  • For tape media: sectors may represent the total block count across all files
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_open() or aaruf_create()
  • +
+
+
+
+
Note
Sector Range Context:
    +
  • User sectors represent the standard addressable range: 0 to (user_sectors - 1)
  • +
  • Total addressable sectors = negative_sectors + user_sectors + overflow_sectors
  • +
  • Negative sectors precede user sectors (pre-gap, lead-in)
  • +
  • Overflow sectors follow user sectors (post-gap, lead-out)
  • +
  • Use aaruf_get_negative_sectors() to get the negative sector count
  • +
  • Use aaruf_get_overflow_sectors() to get the overflow sector count
  • +
+
+
+Media Type Considerations:
    +
  • Optical Media (CD/DVD/BD): User sectors exclude lead-in and lead-out areas. Negative sectors may contain TOC and pre-gap data. Overflow sectors may contain post-gap and lead-out data.
  • +
  • Hard Disk Drives: User sectors represent the full LBA range. Negative and overflow sectors are typically zero unless capturing special areas.
  • +
  • Floppy Disks: User sectors represent the standard formatted capacity.
  • +
  • Tape Media: User sectors may represent the total block count. Negative and overflow sectors are typically not used for tape.
  • +
+
+
+DDT Header Source:
    +
  • The value is retrieved from ctx->user_data_ddt_header.blocks
  • +
  • The DDT (Deduplication and Data Table) header tracks sector allocation
  • +
  • This field is populated during image creation with aaruf_create()
  • +
  • The value is fixed for read-only images opened with aaruf_open()
  • +
  • For write-enabled images, this represents the allocated capacity
  • +
+
+
+Addressing and I/O Operations:
    +
  • When reading/writing sectors with aaruf_read_sector() or aaruf_write_sector():
      +
    • Set negative=false and use sector_address in range [0, user_sectors - 1]
    • +
    • For negative sectors: set negative=true, sector_address in [0, negative_sectors - 1]
    • +
    • For overflow sectors: set negative=false, sector_address in [user_sectors, user_sectors + overflow_sectors
    • +
    +
  • +
+
+
    +
  • 1]
  • +
+
Note
Relationship to Image Creation:
    +
  • The user_sectors value is specified when calling aaruf_create()
  • +
  • It should match the logical capacity of the medium being imaged
  • +
  • For forensic images, ensure it matches the source medium exactly
  • +
  • For virtual disks, set it to the desired capacity
  • +
+
+ +

Definition at line 3292 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, DdtHeader2::blocks, FATAL, aaruformat_context::magic, TRACE, and aaruformat_context::user_data_ddt_header.

+ +
+
+ +

◆ aaruf_get_xml_mediatype()

+ + + +

◆ aaruf_identify()

+ +
+
+ + + + + + + +
int aaruf_identify (const char * filename)
+
+ +

Identifies a file as an AaruFormat image using a file path.

+

Opens the file at the given path and determines if it is an AaruFormat image by examining the file header for valid AaruFormat signatures and version information. This function provides a simple file-based interface that handles file opening, identification, and cleanup automatically. It delegates the actual identification logic to aaruf_identify_stream().

+
Parameters
+ + +
filenamePath to the file to identify (must be accessible and readable).
+
+
+
Returns
Returns one of the following values:
+
Return values
+ + + + +
100Maximum confidence - Definitive AaruFormat image. This is returned when:
    +
  • The file header contains a valid AaruFormat signature (DIC_MAGIC or AARU_MAGIC)
  • +
  • The image major version is less than or equal to the supported version (AARUF_VERSION)
  • +
  • The file structure passes all header validation checks
  • +
  • This indicates the file is definitely a supported AaruFormat image
  • +
+
0Not recognized - File is not an AaruFormat image. This is returned when:
    +
  • The file header doesn't contain a recognized AaruFormat signature
  • +
  • The image major version exceeds the maximum supported version
  • +
  • The file header cannot be read completely (file too small or corrupted)
  • +
  • The file format doesn't match AaruFormat specifications
  • +
+
Positiveerrno values - File access errors from system calls. Common values include:
    +
  • ENOENT (2) - File not found or path doesn't exist
  • +
  • EACCES (13) - Permission denied, file not readable
  • +
  • EISDIR (21) - Path refers to a directory, not a file
  • +
  • EMFILE (24) - Too many open files (process limit reached)
  • +
  • ENFILE (23) - System limit on open files reached
  • +
  • ENOMEM (12) - Insufficient memory to open file
  • +
  • EIO (5) - I/O error occurred during file access
  • +
  • Other platform-specific errno values from fopen()
  • +
+
+
+
+
Note
Identification Process:
    +
  • Opens the file in binary read mode ("rb")
  • +
  • Delegates identification to aaruf_identify_stream() for actual header analysis
  • +
  • Automatically closes the file stream regardless of identification result
  • +
  • Returns system errno values directly if file opening fails
  • +
+
+
+Confidence Scoring:
    +
  • Uses binary scoring: 100 (definitive match) or 0 (no match)
  • +
  • No intermediate confidence levels are returned
  • +
  • Designed for simple yes/no identification rather than probabilistic matching
  • +
+
+
+Version Compatibility:
    +
  • Only recognizes AaruFormat versions up to AARUF_VERSION
  • +
  • Future versions beyond library support are treated as unrecognized
  • +
  • Backwards compatible with older DIC_MAGIC identifiers
  • +
+
+
Warning
The function opens and closes the file for each identification. For repeated operations on the same file, consider using aaruf_identify_stream() with a pre-opened stream for better performance.
+
+File access permissions and availability are checked at runtime. Network files or files on removable media may cause variable access times.
+
+The function performs minimal file content validation. A positive result indicates the file appears to be AaruFormat but doesn't guarantee the entire file is valid or uncorrupted.
+ +

Definition at line 84 of file identify.c.

+ +

References aaruf_identify_stream().

+ +
+
+ +

◆ aaruf_identify_stream()

+ +
+
+ + + + + + + +
int aaruf_identify_stream (FILE * image_stream)
+
+ +

Identifies a file as an AaruFormat image using an open stream.

+

Determines if the provided stream is an AaruFormat image by reading and validating the file header at the beginning of the stream. This function performs the core identification logic by checking for valid AaruFormat signatures and version compatibility. It's designed to work with any FILE stream, making it suitable for integration with existing file handling code.

+
Parameters
+ + +
image_streamOpen FILE stream positioned at any location (will be repositioned to start).
+
+
+
Returns
Returns one of the following values:
+
Return values
+ + + +
100Maximum confidence - Definitive AaruFormat image. This is returned when:
    +
  • The stream is successfully repositioned to the beginning
  • +
  • The AaruFormat header is successfully read (AaruHeader structure)
  • +
  • The header identifier matches either DIC_MAGIC or AARU_MAGIC (valid signatures)
  • +
  • The image major version is less than or equal to AARUF_VERSION (supported version)
  • +
  • All validation checks pass indicating a compatible AaruFormat image
  • +
+
0Not recognized - Stream is not an AaruFormat image. This is returned when:
    +
  • The stream parameter is NULL
  • +
  • Cannot read a complete AaruHeader structure from the stream (file too small)
  • +
  • The header identifier doesn't match DIC_MAGIC or AARU_MAGIC (wrong format)
  • +
  • The image major version exceeds AARUF_VERSION (unsupported future version)
  • +
  • Any validation check fails indicating the stream is not a valid AaruFormat image
  • +
+
+
+
+
Note
Stream Handling:
    +
  • Always seeks to position 0 at the beginning of the function
  • +
  • Reads exactly one AaruHeader structure (size depends on format version)
  • +
  • Does not restore the original stream position after identification
  • +
  • Stream remains open and positioned after the header on function return
  • +
+
+
+Signature Recognition:
    +
  • DIC_MAGIC: Legacy identifier from original DiscImageChef format
  • +
  • AARU_MAGIC: Current AaruFormat identifier
  • +
  • Both signatures are accepted for backwards compatibility
  • +
  • Signature validation is performed using exact byte matching
  • +
+
+
+Version Validation:
    +
  • Only checks the major version number for compatibility
  • +
  • Minor version differences are ignored (assumed backwards compatible)
  • +
  • Future major versions are rejected to prevent compatibility issues
  • +
  • Version check prevents attempting to read unsupported format variants
  • +
+
+
+Confidence Scoring:
    +
  • Binary result: 100 (definitive) or 0 (not recognized)
  • +
  • No probabilistic or partial matching
  • +
  • Designed for definitive identification rather than format detection
  • +
+
+
Warning
The function modifies the stream position by seeking to the beginning and reading the header. The stream position is not restored.
+
+This function performs only header-level validation. A positive result indicates the file appears to have a valid AaruFormat header but doesn't guarantee the entire image structure is valid or uncorrupted.
+
+The stream must support seeking operations. Non-seekable streams (like pipes or network streams) may cause undefined behavior.
+
+No error codes are returned for I/O failures during header reading. Such failures result in a return value of 0 (not recognized).
+ +

Definition at line 163 of file identify.c.

+ +

References AARU_MAGIC, AARUF_VERSION, DIC_MAGIC, AaruHeader::identifier, and AaruHeader::imageMajorVersion.

+ +

Referenced by aaruf_identify().

+ +
+
+ +

◆ aaruf_lzma_decode_buffer()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_lzma_decode_buffer (uint8_t * dst_buffer,
size_t * dst_size,
const uint8_t * src_buffer,
size_t * src_len,
const uint8_t * props,
const size_t props_size )
+
+ +

Decodes an LZMA-compressed buffer.

+

Decompresses data from the source buffer into the destination buffer using LZMA.

+
Parameters
+ + + + + + + +
dst_bufferPointer to the destination buffer.
dst_sizePointer to the size of the destination buffer; updated with the actual size.
src_bufferPointer to the source (compressed) buffer.
src_lenPointer to the size of the source buffer; updated with the actual size read.
propsPointer to the LZMA properties.
props_sizeSize of the LZMA properties.
+
+
+
Returns
0 on success, or an error code on failure.
+ +

Definition at line 39 of file lzma.c.

+ +

References AARU_CALL, and AARU_EXPORT.

+ +

Referenced by aaruf_read_sector(), decode_ddt_multi_level_v2(), process_data_block(), process_ddt_v1(), and process_ddt_v2().

+ +
+
+ +

◆ aaruf_lzma_encode_buffer()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_lzma_encode_buffer (uint8_t * dst_buffer,
size_t * dst_size,
const uint8_t * src_buffer,
const size_t src_len,
uint8_t * out_props,
size_t * out_props_size,
const int32_t level,
const uint32_t dict_size,
const int32_t lc,
const int32_t lp,
const int32_t pb,
const int32_t fb,
const int32_t num_threads )
+
+ +

Encodes a buffer using LZMA compression.

+

Compresses data from the source buffer into the destination buffer using LZMA.

+
Parameters
+ + + + + + + + + + + + + + +
dst_bufferPointer to the destination buffer.
dst_sizePointer to the size of the destination buffer; updated with the actual size.
src_bufferPointer to the source (uncompressed) buffer.
src_lenSize of the source buffer.
out_propsPointer to the output LZMA properties.
out_props_sizePointer to the size of the output LZMA properties.
levelCompression level.
dict_sizeDictionary size.
lcLZMA literal context bits.
lpLZMA literal position bits.
pbLZMA position bits.
fbNumber of fast bytes.
num_threadsNumber of threads to use.
+
+
+
Returns
0 on success, or an error code on failure.
+ +

Definition at line 65 of file lzma.c.

+ +

References AARU_CALL, and AARU_EXPORT.

+ +

Referenced by aaruf_close_current_block(), set_ddt_multi_level_v2(), write_cached_secondary_ddt(), write_dvd_long_sector_blocks(), write_dvd_title_key_decrypted_block(), write_media_tags(), write_mode2_subheaders_block(), write_sector_prefix(), write_sector_prefix_ddt(), write_sector_subchannel(), write_sector_suffix(), write_sector_suffix_ddt(), and write_single_level_ddt().

+ +
+
+ +

◆ aaruf_md5_buffer()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_md5_buffer (const void * data,
unsigned long size,
unsigned char * result )
+
+ +

Definition at line 508 of file md5.c.

+ +

References AARU_CALL, AARU_EXPORT, aaruf_md5_final(), aaruf_md5_init(), and aaruf_md5_update().

+ +
+
+ +

◆ aaruf_md5_final()

+ +
+
+ + + + + + + + + + + +
void aaruf_md5_final (md5_ctx * ctx,
unsigned char * result )
+
+
+ +

◆ aaruf_md5_init()

+ +
+
+ + + + + + + +
void aaruf_md5_init (md5_ctx * ctx)
+
+ +

Definition at line 425 of file md5.c.

+ +

References md5_ctx::a, AARU_CALL, AARU_EXPORT, md5_ctx::b, md5_ctx::c, md5_ctx::d, md5_ctx::hi, and md5_ctx::lo.

+ +

Referenced by aaruf_create(), and aaruf_md5_buffer().

+ +
+
+ +

◆ aaruf_md5_update()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_md5_update (md5_ctx * ctx,
const void * data,
unsigned long size )
+
+
+ +

◆ aaruf_open()

+ +
+
+ + + + + + + +
void * aaruf_open (const char * filepath)
+
+ +

Opens an existing AaruFormat image file.

+

Opens the specified image file and returns a pointer to the initialized aaruformat context. This function performs comprehensive validation of the image file format, reads and processes all index entries, initializes data structures for reading operations, and sets up caches for optimal performance. It supports multiple AaruFormat versions and handles various block types including data blocks, deduplication tables, metadata, and checksums.

+
Parameters
+ + +
filepathPath to the image file to open.
+
+
+
Returns
Returns one of the following:
+
Return values
+ + + +
aaruformatContext*Successfully opened and initialized context. The returned pointer contains:
    +
  • Validated AaruFormat headers and metadata
  • +
  • Processed index entries with all discoverable blocks
  • +
  • Loaded deduplication tables (DDT) for efficient sector access
  • +
  • Initialized block and header caches for performance
  • +
  • Open file stream ready for reading operations
  • +
  • Populated image information and geometry data
  • +
  • ECC context initialized for error correction support
  • +
+
NULLOpening failed. The specific error can be determined by checking errno, which will be set to:
    +
  • AARUF_ERROR_NOT_ENOUGH_MEMORY (-9) when memory allocation fails for:
      +
    • Context allocation
    • +
    • Readable sector tags bitmap allocation
    • +
    • Application version string allocation
    • +
    • Image version string allocation
    • +
    +
  • +
  • AARUF_ERROR_FILE_TOO_SMALL (-2) when file reading fails:
      +
    • Cannot read the AaruFormat header (file too small or corrupted)
    • +
    • Cannot read the extended header for version 2+ formats
    • +
    +
  • +
  • AARUF_ERROR_NOT_AARUFORMAT (-1) when format validation fails:
      +
    • File identifier doesn't match DIC_MAGIC or AARU_MAGIC
    • +
    • File is not a valid AaruFormat image
    • +
    +
  • +
  • AARUF_ERROR_INCOMPATIBLE_VERSION (-3) when:
      +
    • Image major version exceeds the maximum supported version
    • +
    • Future format versions that cannot be read by this library
    • +
    +
  • +
  • AARUF_ERROR_CANNOT_READ_INDEX (-4) when index processing fails:
      +
    • Cannot seek to the index offset specified in the header
    • +
    • Cannot read the index signature
    • +
    • Index signature is not a recognized index block type
    • +
    • Index processing functions return NULL (corrupted index)
    • +
    +
  • +
  • Other error codes may be propagated from block processing functions:
      +
    • Data block processing errors
    • +
    • DDT processing errors
    • +
    • Metadata processing errors
    • +
    +
  • +
+
+
+
+
Note
Format Support:
    +
  • Supports AaruFormat versions 1.x and 2.x
  • +
  • Automatically detects and handles different index formats (v1, v2, v3)
  • +
  • Backwards compatible with older DIC format identifiers
  • +
  • Handles both small and large deduplication tables
  • +
+
+
+Block Processing:
    +
  • Processes all indexed blocks including data, DDT, geometry, metadata, tracks, CICM, dump hardware, and checksums
  • +
  • Non-critical block processing errors are logged but don't prevent opening
  • +
  • Critical errors (DDT processing failures) cause opening to fail
  • +
  • Unknown block types are logged but ignored
  • +
+
+
+Memory Management:
    +
  • Allocates memory for various context structures and caches
  • +
  • On failure, all previously allocated memory is properly cleaned up
  • +
  • The returned context must be freed using aaruf_close()
  • +
+
+
+Performance Optimization:
    +
  • Initializes block and header caches based on sector size and available memory
  • +
  • Cache sizes are calculated to optimize memory usage and access patterns
  • +
  • ECC context is pre-initialized for Compact Disc support
  • +
+
+
Warning
The function requires a valid user data deduplication table to be present. Images without a DDT will fail to open even if otherwise valid.
+
+File access is performed in binary read mode. The file must be accessible and not locked by other processes.
+
+Some memory allocations (version strings) are optional and failure doesn't prevent opening, but may affect functionality that depends on version information.
+

< Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).

+

< Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).

+

< Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).

+ +

Definition at line 125 of file open.c.

+ +

References AARU_HEADER_APP_NAME_LEN, AARU_MAGIC, aaruf_close(), aaruf_ecc_cd_init(), AARUF_ERROR_CANNOT_READ_INDEX, AARUF_ERROR_FILE_TOO_SMALL, AARUF_ERROR_INCOMPATIBLE_VERSION, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, aaruf_get_xml_mediatype(), AARUF_STATUS_OK, AARUF_VERSION, AARUF_VERSION_V2, AaruMetadataJsonBlock, ImageInfo::Application, AaruHeaderV2::application, AaruHeaderV2::applicationMajorVersion, AaruHeaderV2::applicationMinorVersion, ImageInfo::ApplicationVersion, aaruformat_context::block_cache, aaruformat_context::block_header_cache, BlockMedia, IndexEntry::blockType, CacheHeader::cache, ChecksumBlock, CicmBlock, cleanup_open_failure(), ImageInfo::CreationTime, AaruHeaderV2::creationTime, aaruformat_context::cylinders, DataBlock, IndexEntry::dataType, DeDuplicationTable, DeDuplicationTable2, DIC_MAGIC, DumpHardwareBlock, aaruformat_context::ecc_cd_context, FATAL, aaruformat_context::geometry_block, GeometryBlock, aaruformat_context::header, aaruformat_context::heads, AaruHeaderV2::identifier, GeometryBlockHeader::identifier, aaruformat_context::image_info, AaruHeaderV2::imageMajorVersion, AaruHeaderV2::imageMinorVersion, ImageInfo::ImageSize, aaruformat_context::imageStream, IndexBlock, IndexBlock2, IndexBlock3, AaruHeaderV2::indexOffset, ImageInfo::LastModificationTime, AaruHeaderV2::lastWrittenTime, LIBAARUFORMAT_MAJOR_VERSION, LIBAARUFORMAT_MINOR_VERSION, aaruformat_context::library_major_version, aaruformat_context::library_minor_version, aaruformat_context::magic, MAX_CACHE_SIZE, CacheHeader::max_items, MaxSectorTag, ImageInfo::MediaType, AaruHeaderV2::mediaType, MetadataBlock, ImageInfo::MetadataMediaType, IndexEntry::offset, process_aaru_metadata_json_block(), process_checksum_block(), process_cicm_block(), process_data_block(), process_ddt_v1(), process_ddt_v2(), process_dumphw_block(), process_geometry_block(), process_index_v1(), process_index_v2(), process_index_v3(), process_metadata_block(), process_tape_files_block(), process_tape_partitions_block(), process_tracks_block(), aaruformat_context::readableSectorTags, ImageInfo::Sectors, aaruformat_context::sectors_per_track, ImageInfo::SectorSize, aaruformat_context::shift, TapeFileBlock, TapePartitionBlock, TRACE, TracksBlock, and ImageInfo::Version.

+ +
+
+ +

◆ aaruf_read_media_tag()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_read_media_tag (void * context,
uint8_t * data,
const int32_t tag,
uint32_t * length )
+
+ +

Reads a media tag from the AaruFormat image.

+

Reads the specified media tag from the image and stores it in the provided buffer. Media tags contain metadata information about the storage medium such as disc information, lead-in/lead-out data, manufacturer-specific information, or other medium-specific metadata. This function uses a hash table lookup for efficient tag retrieval and supports buffer size querying when data pointer is NULL.

+
Parameters
+ + + + + +
contextPointer to the aaruformat context.
dataPointer to the buffer to store the tag data. Can be NULL to query tag length.
tagTag identifier to read (specific to media type and format).
lengthPointer to the length of the buffer on input; updated with actual tag length on output.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully read the media tag. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The requested media tag exists in the image's media tag hash table
  • +
  • The provided buffer is large enough to contain the tag data
  • +
  • The tag data is successfully copied to the output buffer
  • +
  • The length parameter is updated with the actual tag data length
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
+
AARUF_ERROR_MEDIA_TAG_NOT_PRESENT(-11) The requested media tag does not exist. This occurs when:
    +
  • The tag identifier is not found in the image's media tag hash table
  • +
  • The image was created without the requested metadata
  • +
  • The tag identifier is not supported for this media type
  • +
  • The length parameter is set to 0 when this error is returned
  • +
+
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer is insufficient. This occurs when:
    +
  • The data parameter is NULL (used for length querying)
  • +
  • The buffer length (*length) is smaller than the required tag data length
  • +
  • The length parameter is updated with the required size for retry
  • +
+
+
+
+
Note
Buffer Size Querying:
    +
  • Pass data as NULL to query the required buffer size without reading data
  • +
  • The length parameter will be updated with the required size
  • +
  • This allows proper buffer allocation before the actual read operation
  • +
+
+
+Media Tag Types:
    +
  • Tags are media-type specific (optical disc, floppy disk, hard disk, etc.)
  • +
  • Common tags include TOC data, lead-in/out, manufacturer data, defect lists
  • +
  • Tag availability depends on what was preserved during the imaging process
  • +
+
+
+Hash Table Lookup:
    +
  • Uses efficient O(1) hash table lookup for tag retrieval
  • +
  • Tag identifiers are integer values specific to the media format
  • +
  • Hash table is populated during image opening from indexed metadata blocks
  • +
+
+
Warning
The function performs a direct memory copy operation. Ensure the output buffer has sufficient space to prevent buffer overflows.
+
+Media tag data is stored as-is from the original medium. No format conversion or validation is performed on the tag content.
+ +

Definition at line 85 of file read.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_MEDIA_TAG_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, mediaTagEntry::data, FATAL, mediaTagEntry::length, aaruformat_context::magic, aaruformat_context::mediaTags, and TRACE.

+ +
+
+ +

◆ aaruf_read_sector()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_read_sector (void * context,
const uint64_t sector_address,
bool negative,
uint8_t * data,
uint32_t * length )
+
+ +

Reads a sector from the AaruFormat image.

+

Reads user data from the specified sector address in the image. This function reads only the user data portion of the sector, without any additional metadata or ECC/EDC information. It handles block-based deduplication, compression (LZMA/FLAC), and caching for optimal performance. The function supports both DDT v1 and v2 formats for sector-to-block mapping.

+
Parameters
+ + + + + + +
contextPointer to the aaruformat context.
sector_addressThe logical sector address to read from.
negativeIndicates if the sector address is negative.
dataPointer to buffer where sector data will be stored. Can be NULL to query length.
lengthPointer to variable containing buffer size on input, actual data length on output.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + + + + + + +
AARUF_STATUS_OK(0) Successfully read the sector data. This is returned when:
    +
  • The sector data is successfully retrieved from cache or decompressed from storage
  • +
  • Block header and data are successfully read and processed
  • +
  • Decompression (if needed) completes successfully
  • +
  • The sector data is copied to the output buffer
  • +
  • The length parameter is updated with the actual sector size
  • +
+
AARUF_STATUS_SECTOR_NOT_DUMPED(1) The sector was not dumped during imaging. This occurs when:
    +
  • The DDT entry indicates the sector status is SectorStatusNotDumped
  • +
  • The original imaging process skipped this sector due to read errors
  • +
  • The length parameter is set to the expected sector size for buffer allocation
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
+
AARUF_ERROR_SECTOR_OUT_OF_BOUNDS(-8) The sector address exceeds image bounds. This occurs when:
    +
  • sector_address is greater than or equal to ctx->imageInfo.Sectors
  • +
  • Attempting to read beyond the logical extent of the imaged medium
  • +
+
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer is insufficient. This occurs when:
    +
  • The data parameter is NULL (used for length querying)
  • +
  • The buffer length (*length) is smaller than the block's sector size
  • +
  • The length parameter is updated with the required size for retry
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Cannot allocate memory for block header (if not cached)
  • +
  • Cannot allocate memory for uncompressed block data
  • +
  • Cannot allocate memory for compressed data buffer (LZMA/FLAC)
  • +
  • Cannot allocate memory for decompressed block buffer
  • +
+
AARUF_ERROR_CANNOT_READ_HEADER(-6) Block header reading failed. This occurs when:
    +
  • Cannot read the complete BlockHeader structure from the image stream
  • +
  • File I/O errors prevent reading header data at the calculated block offset
  • +
  • Image file corruption or truncation
  • +
+
AARUF_ERROR_CANNOT_READ_BLOCK(-7) Block data reading failed. This occurs when:
    +
  • Cannot read uncompressed block data from the image stream
  • +
  • Cannot read LZMA properties from compressed blocks
  • +
  • Cannot read compressed data from LZMA or FLAC blocks
  • +
  • File I/O errors during block data access
  • +
+
AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK(-17) Decompression failed. This occurs when:
    +
  • LZMA decoder returns a non-zero error code during decompression
  • +
  • FLAC decoder fails to decompress audio data properly
  • +
  • Decompressed data size doesn't match the expected block length
  • +
  • Compression algorithm encounters corrupted or invalid compressed data
  • +
+
AARUF_ERROR_UNSUPPORTED_COMPRESSION(-13) Unsupported compression algorithm. This occurs when:
    +
  • The block header specifies a compression type not supported by this library
  • +
  • Future compression algorithms not implemented in this version
  • +
+
Othererror codes may be propagated from DDT decoding functions:
    +
  • From decode_ddt_entry_v1(): AARUF_ERROR_NOT_AARUFORMAT (-1)
  • +
  • From decode_ddt_entry_v2(): AARUF_ERROR_NOT_AARUFORMAT (-1), AARUF_ERROR_CANNOT_READ_BLOCK (-7), AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK (-17), AARUF_ERROR_INVALID_BLOCK_CRC (-18)
  • +
+
+
+
+
Note
DDT Processing:
    +
  • Automatically selects DDT v1 or v2 decoding based on ctx->ddtVersion
  • +
  • DDT decoding provides sector offset within block and block file offset
  • +
  • Handles deduplication where multiple sectors may reference the same block
  • +
+
+
+Caching Mechanism:
    +
  • Block headers are cached for performance (ctx->blockHeaderCache)
  • +
  • Decompressed block data is cached to avoid repeated decompression (ctx->blockCache)
  • +
  • Cache hits eliminate file I/O and decompression overhead
  • +
  • Cache sizes are determined during context initialization
  • +
+
+
+Compression Support:
    +
  • None: Direct reading of uncompressed block data
  • +
  • LZMA: Industry-standard compression with properties header
  • +
  • FLAC: Audio-optimized compression for CD audio blocks
  • +
  • Each compression type has specific decompression requirements and error conditions
  • +
+
+
+Buffer Size Querying:
    +
  • Pass data as NULL to query the required buffer size without reading data
  • +
  • The length parameter will be updated with the block's sector size
  • +
  • Useful for dynamic buffer allocation before the actual read operation
  • +
+
+
Warning
This function reads only user data. For complete sector data including metadata and ECC/EDC information, use aaruf_read_sector_long().
+
+Memory allocated for caching is managed by the context. Do not free cached block data as it may be reused by subsequent operations.
+
+Sector addresses are zero-based. The maximum valid address is ctx->imageInfo.Sectors - 1.
+ +

Definition at line 250 of file read.c.

+ +

References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_CANNOT_READ_HEADER, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_ERROR_SECTOR_OUT_OF_BOUNDS, AARUF_ERROR_UNSUPPORTED_COMPRESSION, aaruf_flac_decode_redbook_buffer(), aaruf_lzma_decode_buffer(), AARUF_STATUS_OK, AARUF_STATUS_SECTOR_NOT_DUMPED, add_to_cache_uint64(), aaruformat_context::block_cache, aaruformat_context::block_header_cache, BlockHeader::cmpLength, BlockHeader::compression, aaruformat_context::ddt_version, decode_ddt_entry_v1(), decode_ddt_entry_v2(), FATAL, find_in_cache_uint64(), Flac, aaruformat_context::image_info, aaruformat_context::imageStream, BlockHeader::length, Lzma, LZMA_PROPERTIES_LENGTH, aaruformat_context::magic, DdtHeader2::negative, None, DdtHeader2::overflow, ImageInfo::Sectors, ImageInfo::SectorSize, BlockHeader::sectorSize, SectorStatusNotDumped, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_read_sector_long(), and aaruf_read_track_sector().

+ +
+
+ +

◆ aaruf_read_sector_long()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_read_sector_long (void * context,
const uint64_t sector_address,
bool negative,
uint8_t * data,
uint32_t * length )
+
+ +

Reads a complete sector with all metadata from the AaruFormat image.

+

Reads the complete sector data including user data, ECC/EDC, subchannel data, and other metadata depending on the media type. For optical discs, this returns a full 2352-byte sector with sync, header, user data, and ECC/EDC. For block media with tags, this includes both the user data and tag information. The function handles complex sector reconstruction including ECC correction and format-specific metadata assembly.

+
Parameters
+ + + + + + +
contextPointer to the aaruformat context.
sector_addressThe logical sector address to read from.
negativeIndicates if the sector address is negative.
dataPointer to buffer where complete sector data will be stored. Can be NULL to query length.
lengthPointer to variable containing buffer size on input, actual data length on output.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + + + + + +
AARUF_STATUS_OK(0) Successfully read the complete sector with metadata. This is returned when:
    +
  • The sector data is successfully retrieved and reconstructed with all metadata
  • +
  • For optical discs: sync, header, user data, and ECC/EDC are assembled into 2352 bytes
  • +
  • For block media: user data and tags are combined according to media type
  • +
  • ECC reconstruction (if applicable) completes successfully
  • +
  • All required metadata (prefix/suffix, subheaders, etc.) is available and applied
  • +
+
AARUF_STATUS_SECTOR_NOT_DUMPED(1) The sector or metadata was not dumped. This can occur when:
    +
  • The underlying sector data was not dumped during imaging
  • +
  • CD prefix or suffix metadata indicates NotDumped status for the sector
  • +
  • ECC reconstruction cannot be performed due to missing correction data
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
+
AARUF_ERROR_INCORRECT_MEDIA_TYPE(-5) The media type doesn't support long sector reading. This occurs when:
    +
  • ctx->imageInfo.XmlMediaType is not OpticalDisc or BlockMedia
  • +
  • For BlockMedia: the specific media type is not supported (not Apple, Priam, etc.)
  • +
  • Media types that don't have extended sector formats
  • +
+
AARUF_ERROR_BUFFER_TOO_SMALL(-10) The buffer is insufficient for complete sector data. This occurs when:
    +
  • The data parameter is NULL (used for length querying)
  • +
  • For optical discs: buffer length is less than 2352 bytes
  • +
  • For block media: buffer length is less than (user data size + tag size)
  • +
  • The length parameter is updated with the required size for retry
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Cannot allocate memory for bare user data during optical disc processing
  • +
  • Cannot allocate memory for user data during block media processing
  • +
  • Memory allocation fails in underlying aaruf_read_sector() calls
  • +
+
AARUF_ERROR_TRACK_NOT_FOUND(-12) Cannot locate the sector's track. This occurs when:
    +
  • For optical discs: the sector address doesn't fall within any data track boundaries
  • +
  • No track contains the specified sector address (address not in any track.start to track.end range)
  • +
  • The track list is empty or corrupted
  • +
+
AARUF_ERROR_INVALID_TRACK_FORMAT(-14) The track has an unsupported format. This occurs when:
    +
  • The track type is not recognized (not Audio, Data, CdMode1, CdMode2*, etc.)
  • +
  • Internal track format validation fails
  • +
+
AARUF_ERROR_REACHED_UNREACHABLE_CODE(-15) Internal logic error. This occurs when:
    +
  • Required metadata structures (sectorPrefix, sectorSuffix, etc.) are unexpectedly NULL
  • +
  • Control flow reaches states that should be impossible with valid image data
  • +
  • Indicates potential image corruption or library bug
  • +
+
Allerror codes from aaruf_read_sector() may be propagated:
    +
  • AARUF_ERROR_SECTOR_OUT_OF_BOUNDS (-8) - Calculated sector address exceeds image bounds
  • +
  • AARUF_ERROR_CANNOT_READ_HEADER (-6) - Block header cannot be read
  • +
  • AARUF_ERROR_CANNOT_READ_BLOCK (-7) - Block data cannot be read
  • +
  • AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK (-17) - Decompression fails
  • +
  • AARUF_ERROR_UNSUPPORTED_COMPRESSION (-13) - Compression algorithm not supported
  • +
+
+
+
+
Note
Optical Disc Sector Reconstruction:
    +
  • Creates full 2352-byte sectors from separate user data, sync, header, and ECC/EDC components
  • +
  • Supports different CD modes: Mode 1, Mode 2 Form 1, Mode 2 Form 2, Mode 2 Formless
  • +
  • Handles ECC correction using stored correction data or reconstructed ECC
  • +
  • Uses prefix/suffix DDTs to determine correction strategy for each sector
  • +
+
+
+Block Media Tag Assembly:
    +
  • Combines user data (typically 512 bytes) with media-specific tags
  • +
  • Tag sizes vary by media type: Apple (12-20 bytes), Priam (24 bytes)
  • +
  • Tags contain manufacturer-specific information like spare sector mapping
  • +
+
+
+ECC Reconstruction Modes:
    +
  • Correct: Reconstructs ECC/EDC from user data (no stored correction data needed)
  • +
  • NotDumped: Indicates the metadata portion was not successfully read during imaging
  • +
  • Stored: Uses pre-computed correction data stored separately in the image
  • +
+
+
+Buffer Size Requirements:
    +
  • Optical discs: Always 2352 bytes (full raw sector)
  • +
  • Block media: User data size + tag size (varies by media type)
  • +
  • Pass data as NULL to query the exact required buffer size
  • +
+
+
Warning
For optical discs, this function requires track information to be available. Images without track data may not support long sector reading.
+
+The function performs complex sector reconstruction. Corrupted metadata or missing correction data may result in incorrect sector assembly.
+
+Not all AaruFormat images contain the metadata necessary for long sector reading. Some images may only support basic sector reading via aaruf_read_sector().
+ +

Definition at line 815 of file read.c.

+ +

References AARU_MAGIC, aaruf_ecc_cd_reconstruct(), aaruf_ecc_cd_reconstruct_prefix(), AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_INCORRECT_MEDIA_TYPE, AARUF_ERROR_INVALID_TRACK_FORMAT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_ERROR_REACHED_UNREACHABLE_CODE, AARUF_ERROR_SECTOR_OUT_OF_BOUNDS, AARUF_ERROR_TRACK_NOT_FOUND, aaruf_read_sector(), AARUF_STATUS_OK, AARUF_STATUS_SECTOR_NOT_DUMPED, AppleFileWare, AppleProfile, AppleSonyDS, AppleSonySS, AppleWidget, Audio, BlockMedia, CD_DFIX_MASK, CD_XFIX_MASK, CdMode1, CdMode2Form1, CdMode2Form2, CdMode2Formless, Correct, Data, aaruformat_context::data_tracks, DVDDownload, DVDPR, DVDPRDL, DVDPRW, DVDPRWDL, DVDR, DVDRAM, DVDRDL, DVDROM, DVDRW, DVDRWDL, aaruformat_context::ecc_cd_context, FATAL, aaruformat_context::image_info, aaruformat_context::magic, ImageInfo::MediaType, ImageInfo::MetadataMediaType, aaruformat_context::mode2_subheaders, Mode2Form1Ok, Mode2Form2NoCrc, Mode2Form2Ok, DdtHeader2::negative, NotDumped, aaruformat_context::number_of_data_tracks, Nuon, OpticalDisc, DdtHeader2::overflow, PriamDataTower, PS2DVD, PS3DVD, SACD, aaruformat_context::sector_cpr_mai, aaruformat_context::sector_edc, aaruformat_context::sector_id, aaruformat_context::sector_ied, aaruformat_context::sector_prefix, aaruformat_context::sector_prefix_corrected, aaruformat_context::sector_prefix_ddt, aaruformat_context::sector_prefix_ddt2, aaruformat_context::sector_subchannel, aaruformat_context::sector_suffix, aaruformat_context::sector_suffix_corrected, aaruformat_context::sector_suffix_ddt, aaruformat_context::sector_suffix_ddt2, ImageInfo::Sectors, SectorStatusMode1Correct, SectorStatusMode2Form1Ok, SectorStatusMode2Form2NoCrc, SectorStatusMode2Form2Ok, SectorStatusNotDumped, TrackEntry::start, TRACE, TrackEntry::type, and aaruformat_context::user_data_ddt_header.

+ +
+
+ +

◆ aaruf_read_sector_tag()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_read_sector_tag (const void * context,
const uint64_t sector_address,
const bool negative,
uint8_t * buffer,
uint32_t * length,
const int32_t tag )
+
+ +

Reads a specific sector tag from the AaruFormat image.

+

Reads sector-level metadata tags such as subchannel data, track information, DVD sector metadata, or Apple/Priam proprietary tags from the specified sector. Sector tags are ancillary data stored separately from the main user data and provide format-specific metadata like track flags, ISRC codes, DVD encryption information, or ECC/EDC data. This function validates tag type against media type and ensures the tag data is present in the image before returning it.

+
Parameters
+ + + + + + + +
contextPointer to the aaruformat context.
sector_addressThe logical sector address to read the tag from.
negativeIndicates if the sector address is negative (pre-track area).
bufferPointer to buffer where tag data will be stored. Can be NULL to query tag length.
lengthPointer to variable containing buffer size on input, actual tag length on output.
tagTag identifier specifying which sector tag to read (see SectorTagType enum).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + + + +
AARUF_STATUS_OK(0) Successfully read the sector tag. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The requested tag type exists and is applicable to the media type
  • +
  • The tag data is present in the image for the specified sector
  • +
  • The provided buffer is large enough to contain the tag data
  • +
  • The tag data is successfully copied to the output buffer
  • +
  • The length parameter is updated with the actual tag data length
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
+
AARUF_ERROR_SECTOR_OUT_OF_BOUNDS(-5) The sector address exceeds image bounds. This occurs when:
    +
  • negative is true and sector_address > ctx->userDataDdtHeader.negative - 1
  • +
  • negative is false and sector_address > ctx->imageInfo.Sectors + ctx->userDataDdtHeader.overflow - 1
  • +
  • Attempting to read beyond the logical extent of the imaged medium
  • +
+
AARUF_ERROR_INCORRECT_MEDIA_TYPE(-12) Tag type incompatible with media type. This occurs when:
    +
  • Optical disc tags (CdTrackFlags, CdTrackIsrc, CdSectorSubchannel, DvdSector*) requested from BlockMedia
  • +
  • Block media tags (AppleSonyTag, AppleProfileTag, PriamDataTowerTag) requested from OpticalDisc
  • +
  • Tag type is specific to a media format not present in the current image
  • +
+
AARUF_ERROR_INCORRECT_DATA_SIZE(-26) The provided buffer has incorrect size. This occurs when:
    +
  • The buffer parameter is NULL (used for length querying - NOT an error, updates length and returns this)
  • +
  • The buffer length (*length) doesn't match the required tag data length
  • +
  • The length parameter is updated with the required exact size for retry
  • +
+
AARUF_ERROR_SECTOR_TAG_NOT_PRESENT(-16) The requested tag is not stored in the image. This occurs when:
    +
  • The tag data was not captured during the imaging process
  • +
  • The storage pointer for the tag is NULL (e.g., ctx->sector_subchannel is NULL)
  • +
  • The imaging hardware/software did not support reading this tag type
  • +
  • The tag is optional and was not available on the source medium
  • +
+
AARUF_ERROR_TRACK_NOT_FOUND(-13) Track information not found for the sector. This occurs when:
    +
  • Requesting CdTrackFlags or CdTrackIsrc for a sector not within any track boundaries
  • +
  • The sector address doesn't fall within any track's start/end range in ctx->trackEntries[]
  • +
  • Track metadata was not properly initialized or is corrupted
  • +
+
AARUF_ERROR_INVALID_TAG(-27) The tag identifier is not recognized or supported. This occurs when:
    +
  • The tag parameter value doesn't match any known SectorTagType enum value
  • +
  • Future/unsupported tag types not implemented in this library version
  • +
+
+
+
+
Note
Supported Tag Types and Sizes: Optical Disc Tags (OpticalDisc media only):
    +
  • CdTrackFlags (11): 1 byte - Track control flags (audio/data, copy permitted, pre-emphasis)
  • +
  • CdTrackIsrc (9): 12 bytes - International Standard Recording Code (no null terminator)
  • +
  • CdSectorSubchannel (71): 96 bytes - Raw P-W subchannel data
  • +
  • DvdSectorCprMai (81): 6 bytes - DVD Copyright Management Information (CPR_MAI)
  • +
  • DvdSectorInformation (16): 1 byte - DVD sector information byte from ID field
  • +
  • DvdSectorNumber (17): 3 bytes - DVD sector number from ID field
  • +
  • DvdSectorIed (84): 2 bytes - DVD ID Error Detection code
  • +
  • DvdSectorEdc (85): 4 bytes - DVD Error Detection Code
  • +
  • DvdDiscKeyDecrypted (80): 5 bytes - Decrypted DVD title key for the sector
  • +
+
+

Block Media Tags (BlockMedia only):

    +
  • AppleSonyTag (73): 12 bytes - Apple Sony format 12-byte sector tag
  • +
  • AppleProfileTag (72): 20 bytes - Apple Profile format 20-byte sector tag
  • +
  • PriamDataTowerTag (74): 24 bytes - Priam DataTower format 24-byte sector tag
  • +
+
Note
Sector Address Correction:
    +
  • The function automatically adjusts sector addresses based on the negative parameter
  • +
  • Negative sectors are adjusted: corrected = sector_address - ctx->userDataDdtHeader.negative
  • +
  • Positive sectors are adjusted: corrected = sector_address + ctx->userDataDdtHeader.negative
  • +
  • Corrected addresses are used for indexing into tag data arrays
  • +
+
+
+Track-Based Tags (CdTrackFlags, CdTrackIsrc):
    +
  • These tags are per-track, not per-sector
  • +
  • Function searches ctx->trackEntries[] for track containing the sector
  • +
  • All sectors within a track return the same track-level metadata
  • +
  • Returns AARUF_ERROR_TRACK_NOT_FOUND if sector is outside all tracks
  • +
+
+
+DVD Sector Tags:
    +
  • DVD sector tags are extracted from the DVD ID field or associated metadata
  • +
  • DvdSectorInformation and DvdSectorNumber are derived from ctx->sector_id array
  • +
  • Multiple tags may share the same underlying storage (e.g., ID field breakdown)
  • +
  • Presence depends on the DVD reading capabilities during imaging
  • +
+
+
+Buffer Size Querying:
    +
  • Pass buffer as NULL to query the required buffer size without reading data
  • +
  • The length parameter will be updated with the exact required size
  • +
  • Returns AARUF_ERROR_INCORRECT_DATA_SIZE (not a fatal error in this context)
  • +
  • Allows proper buffer allocation before the actual read operation
  • +
+
+
+Tag Data Storage:
    +
  • Tag data is stored in dedicated context arrays (ctx->sector_subchannel, ctx->sector_cpr_mai, etc.)
  • +
  • Each tag type has a specific array with fixed-size entries per sector
  • +
  • NULL storage pointer indicates tag was not captured/available
  • +
  • Tag data is indexed using the corrected sector address
  • +
+
+
Warning
The buffer must be exactly the required size for each tag type. Unlike aaruf_read_sector(), this function enforces strict size matching.
+
+Tag availability is hardware and media dependent. Always check for AARUF_ERROR_SECTOR_TAG_NOT_PRESENT and handle gracefully.
+
+Track-based tags (CdTrackFlags, CdTrackIsrc) return the same value for all sectors within a track. Do not assume per-sector uniqueness.
+
+Some tags contain binary data without string termination (e.g., ISRC). Do not treat tag buffers as null-terminated strings without validation.
+ +

Definition at line 1463 of file read.c.

+ +

References AARU_MAGIC, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_INCORRECT_MEDIA_TYPE, AARUF_ERROR_INVALID_TAG, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_SECTOR_OUT_OF_BOUNDS, AARUF_ERROR_SECTOR_TAG_NOT_PRESENT, AARUF_ERROR_TRACK_NOT_FOUND, AARUF_STATUS_OK, AppleProfileTag, AppleSonyTag, BlockMedia, CdSectorSubchannel, CdTrackFlags, CdTrackIsrc, DvdCmi, DvdSectorEdc, DvdSectorIed, DvdSectorInformation, DvdSectorNumber, DvdTitleKeyDecrypted, TracksHeader::entries, FATAL, TrackEntry::flags, aaruformat_context::image_info, TrackEntry::isrc, aaruformat_context::magic, ImageInfo::MetadataMediaType, DdtHeader2::negative, OpticalDisc, DdtHeader2::overflow, PriamDataTowerTag, aaruformat_context::sector_cpr_mai, aaruformat_context::sector_decrypted_title_key, aaruformat_context::sector_edc, aaruformat_context::sector_id, aaruformat_context::sector_ied, aaruformat_context::sector_subchannel, ImageInfo::Sectors, TrackEntry::start, TRACE, aaruformat_context::track_entries, aaruformat_context::tracks_header, and aaruformat_context::user_data_ddt_header.

+ +
+
+ +

◆ aaruf_read_track_sector()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_read_track_sector (void * context,
uint8_t * data,
const uint64_t sector_address,
uint32_t * length,
const uint8_t track )
+
+ +

Reads a sector from a specific track in the AaruFormat image.

+

Reads user data from the specified sector address within a particular track. This function is specifically designed for optical disc images where sectors are organized by tracks. The sector address is relative to the start of the track. It validates the media type, locates the specified track by sequence number, calculates the absolute sector address, and delegates to aaruf_read_sector().

+
Parameters
+ + + + + + +
contextPointer to the aaruformat context.
dataPointer to buffer where sector data will be stored.
sector_addressThe sector address relative to the track start.
lengthPointer to variable containing buffer size on input, actual data length on output.
trackThe track sequence number to read from.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + +
AARUF_STATUS_OK(0) Successfully read the sector data from the specified track. This is returned when:
    +
  • The context is valid and the media type is OpticalDisc
  • +
  • The specified track sequence number exists in the data tracks array
  • +
  • The underlying aaruf_read_sector() call succeeds
  • +
  • The sector data is successfully retrieved and copied to the output buffer
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
+
AARUF_ERROR_INCORRECT_MEDIA_TYPE(-5) The media is not an optical disc. This occurs when:
    +
  • ctx->imageInfo.XmlMediaType is not OpticalDisc
  • +
  • This function is only applicable to CD, DVD, BD, and other optical disc formats
  • +
+
AARUF_ERROR_TRACK_NOT_FOUND(-12) The specified track does not exist. This occurs when:
    +
  • No track in ctx->dataTracks[] has a sequence number matching the requested track
  • +
  • The track may not contain data or may not have been imaged
  • +
  • Only data tracks are searched; audio-only tracks are not included
  • +
+
Allother error codes from aaruf_read_sector() may be returned:
    +
  • AARUF_STATUS_SECTOR_NOT_DUMPED (1) - Sector was not dumped during imaging
  • +
  • AARUF_ERROR_SECTOR_OUT_OF_BOUNDS (-8) - Calculated absolute sector address exceeds image bounds
  • +
  • AARUF_ERROR_BUFFER_TOO_SMALL (-10) - Data buffer is NULL or insufficient size
  • +
  • AARUF_ERROR_NOT_ENOUGH_MEMORY (-9) - Memory allocation fails during sector reading
  • +
  • AARUF_ERROR_CANNOT_READ_HEADER (-6) - Block header cannot be read from image stream
  • +
  • AARUF_ERROR_CANNOT_READ_BLOCK (-7) - Block data cannot be read from image stream
  • +
  • AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK (-17) - LZMA or FLAC decompression fails
  • +
  • AARUF_ERROR_UNSUPPORTED_COMPRESSION (-13) - Block uses unsupported compression
  • +
+
+
+
+
Note
Track-Relative Addressing:
    +
  • The sector_address parameter is relative to the start of the specified track
  • +
  • The function calculates the absolute sector address as: track.start + sector_address
  • +
  • Track boundaries are defined by track.start and track.end values
  • +
+
+
+Data Track Filtering:
    +
  • Only tracks in the ctx->dataTracks[] array are searched
  • +
  • Audio-only tracks without data content are not included in this search
  • +
  • The track sequence number is the logical track number from the disc TOC
  • +
+
+
+Function Delegation:
    +
  • This function is a wrapper that performs track validation and address calculation
  • +
  • The actual sector reading is performed by aaruf_read_sector()
  • +
  • All caching, decompression, and DDT processing occurs in the underlying function
  • +
+
+
Warning
This function is only applicable to optical disc media types. Attempting to use it with block media will result in AARUF_ERROR_INCORRECT_MEDIA_TYPE.
+
+The sector_address is relative to the track start, not the disc start. Ensure correct address calculation when working with multi-track discs.
+
+Track sequence numbers may not be contiguous. Always verify track existence before assuming a track number is valid.
+ +

Definition at line 663 of file read.c.

+ +

References AARU_MAGIC, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_INCORRECT_MEDIA_TYPE, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_TRACK_NOT_FOUND, aaruf_read_sector(), aaruformat_context::data_tracks, FATAL, aaruformat_context::image_info, aaruformat_context::magic, ImageInfo::MetadataMediaType, aaruformat_context::number_of_data_tracks, OpticalDisc, TrackEntry::sequence, TrackEntry::start, and TRACE.

+ +
+
+ +

◆ aaruf_set_aaru_json_metadata()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_aaru_json_metadata (void * context,
uint8_t * data,
size_t length )
+
+ +

Sets the Aaru metadata JSON for the image during creation.

+

Embeds Aaru metadata JSON into the image being created. The Aaru metadata JSON format is a structured, machine-readable representation of comprehensive image metadata including media information, imaging session details, hardware configuration, optical disc tracks and sessions, checksums, and preservation metadata. This function stores the JSON payload in its original form without parsing or validation, allowing callers to provide pre-generated JSON conforming to the Aaru metadata schema. The JSON data will be written to the image file during aaruf_close() as an AaruMetadataJsonBlock.

+

The function accepts raw UTF-8 encoded JSON data as an opaque byte array and creates an internal copy that persists for the lifetime of the context. If Aaru JSON metadata was previously set on this context, the old data is freed and replaced with the new JSON. The JSON is treated as opaque binary data by the library; no parsing, interpretation, or schema validation is performed during the set operation.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the Aaru metadata JSON data in UTF-8 encoding (opaque byte array). The JSON should conform to the Aaru metadata schema, though this is not validated. Must not be NULL.
lengthLength of the JSON data in bytes. The payload may or may not be null-terminated; the length should reflect the actual JSON data size.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set Aaru metadata JSON. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the JSON data succeeded
  • +
  • The JSON data is copied to ctx->jsonBlock
  • +
  • The jsonBlockHeader is initialized with identifier AaruMetadataJsonBlock
  • +
  • The jsonBlockHeader.length field is set to the provided length
  • +
  • Any previous Aaru JSON data is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the JSON data
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
Aaru JSON Format and Encoding:
    +
  • The JSON payload must be valid UTF-8 encoded data
  • +
  • The payload may or may not be null-terminated
  • +
  • The library treats the JSON as opaque binary data
  • +
  • No JSON parsing, interpretation, or validation is performed during set
  • +
  • Schema compliance is the caller's responsibility
  • +
  • Ensure the JSON conforms to the Aaru metadata schema for compatibility
  • +
+
+
+Aaru Metadata JSON Purpose:
    +
  • Provides machine-readable structured metadata using modern JSON format
  • +
  • Includes comprehensive information about media, sessions, tracks, and checksums
  • +
  • Enables programmatic access to metadata without XML parsing overhead
  • +
  • Documents imaging session details, hardware configuration, and preservation data
  • +
  • Used by Aaru and compatible tools for metadata exchange and analysis
  • +
  • Complements or serves as alternative to CICM XML metadata
  • +
+
+
+JSON Content Examples:
    +
  • Media type and physical characteristics
  • +
  • Track and session information for optical media
  • +
  • Partition and filesystem metadata
  • +
  • Checksums (MD5, SHA-1, SHA-256, etc.) for integrity verification
  • +
  • Hardware information (drive manufacturer, model, firmware)
  • +
  • Imaging software version and configuration
  • +
  • Timestamps for image creation and modification
  • +
+
+
+Memory Management:
    +
  • The function creates an internal copy of the JSON data
  • +
  • The caller retains ownership of the input data buffer
  • +
  • The caller may free the input data immediately after this function returns
  • +
  • The internal copy is freed automatically during aaruf_close()
  • +
  • Calling this function multiple times replaces previous JSON data
  • +
+
+
+Relationship to CICM XML:
    +
  • Both CICM XML and Aaru JSON can be set on the same image
  • +
  • CICM XML follows the Canary Islands Computer Museum schema (older format)
  • +
  • Aaru JSON follows the Aaru-specific metadata schema (newer format)
  • +
  • Setting one does not affect the other
  • +
  • Different tools may prefer one format over the other
  • +
  • Consider including both for maximum compatibility
  • +
+
+
Warning
The Aaru JSON block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted to disk.
+
+No validation is performed on the JSON data:
    +
  • Invalid JSON syntax will be stored and only detected during parsing
  • +
  • Schema violations will not be caught by this function
  • +
  • Ensure JSON is valid and schema-compliant before calling
  • +
  • Use a JSON validation library before embedding if correctness is critical
  • +
+
+
+The function accepts any length value:
    +
  • Ensure the length accurately reflects the JSON data size
  • +
  • Incorrect length values may cause truncation or include garbage data
  • +
  • For null-terminated JSON, length should not include the null terminator unless it is intended to be part of the stored data
  • +
+
+
See also
AaruMetadataJsonBlockHeader for the on-disk structure definition.
+
+aaruf_get_aaru_json_metadata() for retrieving Aaru JSON from opened images.
+
+write_aaru_json_block() for the serialization process during image closing.
+ +

Definition at line 2258 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, AaruMetadataJsonBlock, FATAL, AaruMetadataJsonBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::json_block, aaruformat_context::json_block_header, AaruMetadataJsonBlockHeader::length, aaruformat_context::magic, and TRACE.

+ +
+
+ +

◆ aaruf_set_comments()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_comments (void * context,
const uint8_t * data,
const int32_t length )
+
+ +

Sets user comments or notes for the image.

+

Records arbitrary user-provided comments, notes, or annotations associated with the AaruFormat image. This metadata field allows users to document the image's purpose, provenance, condition, or any other relevant information. Comments are stored in UTF-16LE encoding and can contain multi-line text, special characters, and detailed descriptions.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the comments string data in UTF-16LE encoding (opaque byte array).
lengthLength of the comments data in bytes (must include full UTF-16LE character sequences).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set comments. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the comments string succeeded
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The comments data is copied to ctx->imageInfo.Comments
  • +
  • The commentsLength field is set in the metadata block header
  • +
  • Any previous comments string is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the comments string
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
UTF-16LE Encoding:
    +
  • The data parameter must contain a valid UTF-16LE encoded string
  • +
  • Length must be in bytes, not character count
  • +
  • The library treats the data as opaque and does not validate encoding
  • +
  • Null termination is not required; length specifies the exact byte count
  • +
+
+
+Common Uses for Comments:
    +
  • Documentation of image source and creation date
  • +
  • Notes about media condition or read errors encountered
  • +
  • Preservation metadata and archival notes
  • +
  • User annotations for organizing image collections
  • +
  • Workflow status or processing history
  • +
+
+
+Memory Management:
    +
  • The function allocates a new buffer and copies the data
  • +
  • If previous comments exist, they are freed before replacement
  • +
  • The caller retains ownership of the input data buffer
  • +
  • The allocated memory is freed when the context is closed or destroyed
  • +
+
+
Warning
The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+ +

Definition at line 607 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::comments, MetadataBlockHeader::commentsLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_creator()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_creator (void * context,
const uint8_t * data,
const int32_t length )
+
+ +

Sets the creator (person/operator) information for the image.

+

Records the name of the person or operator who created the AaruFormat image. This metadata identifies the individual responsible for the imaging process, which is valuable for provenance tracking, accountability, and understanding the human context in which the image was created. The creator name is stored in UTF-16LE encoding and preserved exactly as provided by the caller.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the creator name string data in UTF-16LE encoding (opaque byte array).
lengthLength of the creator data in bytes (must include full UTF-16LE character sequences).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set creator information. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the creator string succeeded
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The creator data is copied to ctx->imageInfo.Creator
  • +
  • The creatorLength field is set in the metadata block header
  • +
  • Any previous creator string is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the creator string
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
UTF-16LE Encoding:
    +
  • The data parameter must contain a valid UTF-16LE encoded string
  • +
  • Length must be in bytes, not character count (UTF-16LE uses 2 or 4 bytes per character)
  • +
  • The library treats the data as opaque and does not validate UTF-16LE encoding
  • +
  • Null termination is not required; length specifies the exact byte count
  • +
  • Ensure even byte lengths to maintain UTF-16LE character alignment
  • +
+
+
+Creator Name Format:
    +
  • Typically contains the full name of the person who created the image
  • +
  • May include titles, credentials, or institutional affiliations
  • +
  • Common formats: "John Smith", "Dr. Jane Doe", "Smith, John (Archivist)"
  • +
  • Should identify the individual operator, not the software used
  • +
  • May include contact information or employee/operator ID in institutional settings
  • +
+
+
+Provenance and Accountability:
    +
  • Identifies who performed the imaging operation
  • +
  • Important for establishing chain of custody in forensic contexts
  • +
  • Provides contact point for questions about the imaging process
  • +
  • Supports institutional recordkeeping and quality assurance
  • +
  • May be required for compliance with archival standards
  • +
+
+
+Privacy Considerations:
    +
  • Consider privacy implications when recording personal names
  • +
  • Some organizations may use operator IDs instead of full names
  • +
  • Institutional policies may govern what personal information is recorded
  • +
  • GDPR and similar regulations may apply in some jurisdictions
  • +
+
+
+Memory Management:
    +
  • The function allocates a new buffer and copies the data
  • +
  • If a previous creator string exists, it is freed before replacement
  • +
  • The caller retains ownership of the input data buffer
  • +
  • The allocated memory is freed when the context is closed or destroyed
  • +
+
+
+Metadata Block Initialization:
    +
  • If the metadata block header is not yet initialized, this function initializes it
  • +
  • The metadataBlockHeader.identifier is set to MetadataBlock automatically
  • +
  • Multiple metadata setter functions can be called to build complete metadata
  • +
+
+
Warning
The data buffer must remain valid for the duration of this function call. After the function returns, the caller may free or reuse the data buffer.
+
+Invalid UTF-16LE encoding may cause issues when reading the metadata:
    +
  • The library does not validate UTF-16LE correctness
  • +
  • Malformed strings may display incorrectly or cause decoding errors
  • +
  • Ensure the data is properly encoded before calling this function
  • +
+
+
+The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+ +

Definition at line 493 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::creator, MetadataBlockHeader::creatorLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_drive_firmware_revision()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_drive_firmware_revision (void * context,
const uint8_t * data,
const int32_t length )
+
+ +

Sets the drive firmware revision for the image.

+

Records the firmware version or revision of the drive or device used to read or write the physical storage media. Firmware revisions can significantly affect drive behavior, error handling, performance, and compatibility. This metadata is crucial for understanding the imaging environment, troubleshooting issues, and ensuring reproducibility. Different firmware versions of the same drive model can behave quite differently, making this information essential for comprehensive documentation. The firmware revision is stored in UTF-16LE encoding.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the drive firmware revision string data in UTF-16LE encoding (opaque byte array).
lengthLength of the drive firmware revision data in bytes (must include full UTF-16LE character sequences).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set drive firmware revision. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the drive firmware revision string succeeded
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The drive firmware revision data is copied to ctx->imageInfo.DriveFirmwareRevision
  • +
  • The driveFirmwareRevisionLength field is set in the metadata block header
  • +
  • Any previous drive firmware revision string is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the drive firmware revision string
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
Firmware Revision Examples:
    +
  • Optical drives: "1.07", "1.00a", "VER A302"
  • +
  • Tape drives: "B8S1", "7760", "V4.0"
  • +
  • Hard drives: "CC45", "80.00A80", "HPG9"
  • +
  • Format varies by manufacturer and device type
  • +
+
+
+Firmware Impact on Imaging:
    +
  • Different firmware versions may have different error recovery strategies
  • +
  • Bug fixes in newer firmware can improve read reliability
  • +
  • Some firmware versions have known issues with specific media types
  • +
  • Performance characteristics may vary between firmware revisions
  • +
  • Firmware can affect features like C2 error reporting on optical drives
  • +
+
+
+Troubleshooting and Support:
    +
  • Essential for diagnosing drive-specific problems
  • +
  • Manufacturer support often requires firmware version information
  • +
  • Helps identify if issues are resolved in newer firmware
  • +
  • Enables correlation of problems with known firmware bugs
  • +
  • Supports decision-making about firmware updates
  • +
+
+
+Reproducibility and Documentation:
    +
  • Complete environment documentation for scientific reproducibility
  • +
  • Important for forensic work requiring detailed equipment records
  • +
  • Helps explain variations in imaging results over time
  • +
  • Supports compliance with archival and preservation standards
  • +
  • Enables future researchers to understand imaging conditions
  • +
+
+
+Historical Tracking:
    +
  • Documents firmware changes over the life of imaging equipment
  • +
  • Helps assess impact of firmware updates on imaging quality
  • +
  • Useful for long-term archival projects spanning years
  • +
  • Aids in understanding evolution of drive technology
  • +
+
+
Warning
The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+
+Firmware revisions are device-specific and format varies widely:
    +
  • No standard format exists across manufacturers
  • +
  • May include letters, numbers, dots, or other characters
  • +
  • Should be recorded exactly as reported by the device
  • +
+
+ +

Definition at line 1793 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::drive_firmware_revision, MetadataBlockHeader::driveFirmwareRevisionLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_drive_manufacturer()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_drive_manufacturer (void * context,
const uint8_t * data,
const int32_t length )
+
+ +

Sets the drive manufacturer information for the image.

+

Records the name of the company that manufactured the drive or device used to read or write the physical storage media. This metadata provides valuable context about the imaging process, as different drives may have different capabilities, error handling characteristics, and compatibility with specific media types. The manufacturer name is stored in UTF-16LE encoding.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the drive manufacturer string data in UTF-16LE encoding (opaque byte array).
lengthLength of the drive manufacturer data in bytes (must include full UTF-16LE character sequences).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set drive manufacturer. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the drive manufacturer string succeeded
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The drive manufacturer data is copied to ctx->imageInfo.DriveManufacturer
  • +
  • The driveManufacturerLength field is set in the metadata block header
  • +
  • Any previous drive manufacturer string is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the drive manufacturer string
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
Common Drive Manufacturers:
    +
  • Optical drives: Pioneer, Plextor, LG, ASUS, Sony, Samsung
  • +
  • Tape drives: HP, IBM, Quantum, Tandberg, Exabyte
  • +
  • Hard drives: Seagate, Western Digital, Hitachi, Toshiba
  • +
  • Floppy drives: Teac, Panasonic, Mitsumi, Sony
  • +
+
+
+Imaging Context and Quality:
    +
  • Different manufacturers have varying error recovery capabilities
  • +
  • Some drives are better suited for archival-quality imaging
  • +
  • Plextor drives were historically preferred for optical disc preservation
  • +
  • Professional-grade drives often have better read accuracy
  • +
  • Important for understanding potential limitations in the imaging process
  • +
+
+
+Forensic and Provenance Value:
    +
  • Documents the complete imaging environment
  • +
  • Helps assess reliability and trustworthiness of the image
  • +
  • Useful for troubleshooting or reproducing imaging results
  • +
  • May be required for forensic chain of custody
  • +
  • Supports quality assurance and validation processes
  • +
+
+
Warning
The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+ +

Definition at line 1412 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::drive_manufacturer, MetadataBlockHeader::driveManufacturerLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_drive_model()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_drive_model (void * context,
const uint8_t * data,
const int32_t length )
+
+ +

Sets the drive model information for the image.

+

Records the specific model or product designation of the drive or device used to read or write the physical storage media. This metadata provides detailed information about the imaging equipment, which can be important for understanding the capabilities, limitations, and characteristics of the imaging process. Different drive models within the same manufacturer's product line may have significantly different features and performance characteristics. The model information is stored in UTF-16LE encoding.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the drive model string data in UTF-16LE encoding (opaque byte array).
lengthLength of the drive model data in bytes (must include full UTF-16LE character sequences).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set drive model. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the drive model string succeeded
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The drive model data is copied to ctx->imageInfo.DriveModel
  • +
  • The driveModelLength field is set in the metadata block header
  • +
  • Any previous drive model string is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the drive model string
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
Drive Model Examples:
    +
  • Optical drives: "DVR-111D" (Pioneer), "PX-716A" (Plextor), "GH24NSB0" (LG)
  • +
  • Tape drives: "Ultrium 7-SCSI" (HP), "TS1140" (IBM), "SDLT600" (Quantum)
  • +
  • Hard drives: "ST2000DM008" (Seagate), "WD40EZRZ" (Western Digital)
  • +
  • Floppy drives: "FD-235HF" (Teac), "JU-257A633P" (Panasonic)
  • +
+
+
+Model-Specific Characteristics:
    +
  • Different models may have different error correction algorithms
  • +
  • Some models are known for superior read quality (e.g., Plextor Premium)
  • +
  • Certain models may have bugs or quirks in specific firmware versions
  • +
  • Professional models often have features not available in consumer versions
  • +
  • Important for reproducing imaging conditions or troubleshooting issues
  • +
+
+
+Forensic Documentation:
    +
  • Complete drive identification aids in forensic reporting
  • +
  • Helps establish the reliability of the imaging process
  • +
  • May be required for compliance with forensic standards
  • +
  • Supports validation and verification procedures
  • +
  • Enables assessment of tool suitability for the imaging task
  • +
+
+
+Historical and Research Value:
    +
  • Documents evolution of imaging technology over time
  • +
  • Helps identify best practices for specific media types
  • +
  • Useful for academic research on digital preservation
  • +
  • Aids in understanding drive availability and obsolescence
  • +
+
+
Warning
The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+ +

Definition at line 1534 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::drive_model, MetadataBlockHeader::driveModelLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_drive_serial_number()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_drive_serial_number (void * context,
const uint8_t * data,
const int32_t length )
+
+ +

Sets the drive serial number for the image.

+

Records the unique serial number of the drive or device used to read or write the physical storage media. This metadata provides a unique identifier for the specific piece of hardware used in the imaging process, which is particularly important for forensic work, equipment tracking, and quality assurance. The serial number enables correlation between multiple images created with the same drive and can help identify drive-specific issues or characteristics. The serial number is stored in UTF-16LE encoding.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the drive serial number string data in UTF-16LE encoding (opaque byte array).
lengthLength of the drive serial number data in bytes (must include full UTF-16LE character sequences).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set drive serial number. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the drive serial number string succeeded
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The drive serial number data is copied to ctx->imageInfo.DriveSerialNumber
  • +
  • The driveSerialNumberLength field is set in the metadata block header
  • +
  • Any previous drive serial number string is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the drive serial number string
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
Serial Number Sources:
    +
  • Hard drives and SSDs: Retrieved via ATA/SCSI IDENTIFY commands
  • +
  • Optical drives: Available through SCSI inquiry or ATA identify
  • +
  • Tape drives: Typically reported via SCSI inquiry data
  • +
  • USB devices: May have USB serial numbers or internal device serials
  • +
  • Some older or consumer devices may not report serial numbers
  • +
+
+
+Forensic Applications:
    +
  • Critical for forensic chain of custody documentation
  • +
  • Uniquely identifies the specific hardware used for imaging
  • +
  • Enables tracking of drive calibration and maintenance history
  • +
  • Supports correlation of images created with the same equipment
  • +
  • May be required by forensic standards and best practices
  • +
+
+
+Equipment Management:
    +
  • Helps track drive usage and workload for maintenance planning
  • +
  • Enables identification of drives requiring replacement or service
  • +
  • Supports equipment inventory and asset management systems
  • +
  • Useful for identifying drives with known issues or recalls
  • +
  • Facilitates warranty and support claim processing
  • +
+
+
+Quality Assurance:
    +
  • Enables analysis of drive-specific error patterns
  • +
  • Helps identify if multiple imaging issues stem from the same drive
  • +
  • Supports statistical quality control processes
  • +
  • Aids in evaluating drive reliability over time
  • +
  • Can reveal degradation or calibration drift in aging hardware
  • +
+
+
Warning
The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+ +

Definition at line 1658 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::drive_serial_number, MetadataBlockHeader::driveSerialNumberLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_dumphw()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_dumphw (void * context,
uint8_t * data,
size_t length )
+
+ +

Sets the dump hardware block for the image during creation.

+

Embeds dump hardware information into the image being created. The dump hardware block documents the hardware and software environments used to create the image, recording one or more "dump +environments" – typically combinations of physical devices (drives, controllers, adapters) and the software stacks that performed the read operations. This metadata is essential for understanding the imaging context, validating acquisition integrity, reproducing imaging conditions, and supporting forensic or archival documentation requirements.

+

Each environment entry includes hardware identification (manufacturer, model, revision, firmware, serial number), software identification (name, version, operating system), and optional extent ranges that specify which logical sectors or units were contributed by that particular environment. This structure supports complex imaging scenarios where multiple devices or software configurations were used to create a composite image.

+

The function accepts a complete, pre-serialized DumpHardwareBlock in the on-disk binary format (as returned by aaruf_get_dumphw() or manually constructed). The block is validated for correct identifier, length consistency, and CRC64 integrity before being parsed and stored in the context. The function deserializes the binary block, extracts all entries with their variable-length UTF-8 strings and extent arrays, and creates null-terminated in-memory copies for internal use.

+

Validation performed:

    +
  1. Context validation (non-NULL, correct magic, write mode)
  2. +
  3. Data buffer validation (non-NULL, non-zero length)
  4. +
  5. Block identifier validation (must be DumpHardwareBlock)
  6. +
  7. Length consistency (buffer length must equal sizeof(DumpHardwareHeader) + header.length)
  8. +
  9. CRC64 integrity verification (calculated CRC64 must match header.crc64)
  10. +
+

Parsing process:

    +
  1. Read and validate the DumpHardwareHeader from the buffer
  2. +
  3. Allocate array for all dump hardware entries
  4. +
  5. For each entry:
      +
    • Read the DumpHardwareEntry structure (36 bytes)
    • +
    • Allocate and copy each non-empty UTF-8 string with +1 byte for null terminator
    • +
    • Allocate and copy the DumpExtent array if extents > 0
    • +
    +
  6. +
  7. Free any previously set dump hardware data
  8. +
  9. Store the new parsed data in ctx->dumpHardwareEntriesWithData
  10. +
  11. Store the header in ctx->dumpHardwareHeader
  12. +
+

Memory management: If any memory allocation fails during parsing, all previously allocated memory for the new data is freed via the free_copy_and_error label, and AARUF_ERROR_NOT_ENOUGH_MEMORY is returned. Any existing dump hardware data in the context is freed before storing new data, ensuring no memory leaks when replacing dump hardware information.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the dump hardware block data in on-disk binary format. Must contain a complete DumpHardwareBlock starting with DumpHardwareHeader followed by all entries, strings, and extent arrays. Must not be NULL.
lengthLength of the dump hardware block data in bytes. Must equal sizeof(DumpHardwareHeader) + header.length for validation to succeed.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + + +
AARUF_STATUS_OK(0) Successfully set dump hardware block. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • The data buffer contains a valid DumpHardwareBlock
  • +
  • The block identifier is DumpHardwareBlock
  • +
  • The length is consistent (buffer length == header size + payload length)
  • +
  • The CRC64 checksum is valid
  • +
  • All memory allocations succeeded
  • +
  • All entries with strings and extents are parsed and stored
  • +
  • Any previous dump hardware data is freed
  • +
  • ctx->dumpHardwareEntriesWithData is populated with parsed entries
  • +
  • ctx->dumpHardwareHeader is updated with the new header
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_CANNOT_READ_BLOCK(-6) Invalid block identifier. This occurs when:
    +
  • The identifier field in the DumpHardwareHeader doesn't equal DumpHardwareBlock
  • +
  • The data buffer doesn't contain a valid dump hardware block
  • +
  • The block type is incorrect or corrupted
  • +
+
AARUF_ERROR_INCORRECT_DATA_SIZE(-11) Invalid data or length. This occurs when:
    +
  • The data parameter is NULL
  • +
  • The length parameter is 0 (empty block)
  • +
  • The buffer length doesn't match sizeof(DumpHardwareHeader) + header.length
  • +
  • Length inconsistency indicates corrupted or incomplete block data
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-10) CRC64 checksum mismatch. This occurs when:
    +
  • The calculated CRC64 over the payload doesn't match header.crc64
  • +
  • Block data is corrupted or tampered with
  • +
  • Block was not properly constructed or serialized
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • calloc() or malloc() failed to allocate memory for entries array
  • +
  • Failed to allocate memory for any string field (manufacturer, model, etc.)
  • +
  • Failed to allocate memory for extent arrays
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • All partially allocated memory is freed before returning
  • +
+
+
+
+
Note
Dump Hardware Block Format:
    +
  • The data buffer must contain a complete serialized DumpHardwareBlock
  • +
  • Format: DumpHardwareHeader + repeated entries with strings and extents
  • +
  • All strings are UTF-8 encoded and NOT null-terminated in the buffer
  • +
  • The function adds null terminators when copying strings to internal storage
  • +
  • String lengths are in bytes, not character counts
  • +
+
+
+Creating Block Data:
    +
  • Use aaruf_get_dumphw() to retrieve a block from an existing image
  • +
  • Manually construct by serializing DumpHardwareHeader, entries, strings, and extents
  • +
  • Calculate CRC64-ECMA over the payload (everything after the header)
  • +
  • Ensure all length fields accurately reflect the data sizes
  • +
  • Ensure total buffer size equals sizeof(DumpHardwareHeader) + payload length
  • +
+
+
+Hardware Identification Fields:
    +
  • manufacturer: Device manufacturer (e.g., "Plextor", "Sony", "Samsung")
  • +
  • model: Device model number (e.g., "PX-716A", "DRU-820A")
  • +
  • revision: Hardware revision identifier
  • +
  • firmware: Firmware version (e.g., "1.11", "KY08")
  • +
  • serial: Device serial number for unique identification
  • +
+
+
+Software Identification Fields:
    +
  • softwareName: Dumping software name (e.g., "Aaru", "ddrescue", "IsoBuster")
  • +
  • softwareVersion: Software version (e.g., "5.3.0", "1.25")
  • +
  • softwareOperatingSystem: Host OS (e.g., "Linux 5.10.0", "Windows 10", "macOS 12.0")
  • +
+
+
+Extent Arrays:
    +
  • Each DumpExtent specifies a [start, end] logical sector range
  • +
  • Extents indicate which sectors this environment contributed
  • +
  • Empty extent arrays (extents == 0) mean the environment dumped entire medium
  • +
  • Extents are stored in the order provided in the input buffer
  • +
+
+
+Memory Ownership:
    +
  • The function creates internal copies of all data
  • +
  • The caller retains ownership of the input data buffer
  • +
  • The caller may free the input buffer immediately after this function returns
  • +
  • Internal copies are freed during aaruf_close() or when replaced by another call
  • +
+
+
+Replacing Existing Data:
    +
  • Calling this function multiple times replaces previous dump hardware data
  • +
  • All previous entries, strings, and extents are freed before storing new data
  • +
  • No memory leaks occur when updating dump hardware information
  • +
+
+
Warning
The dump hardware block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted to disk.
+
+CRC64 validation protects against corrupted blocks, but construction errors in the input buffer (incorrect lengths, misaligned data) may cause parsing to fail or produce incorrect results even with a valid checksum.
+
+The function assumes the input buffer is properly formatted and packed according to the DumpHardwareBlock specification. Malformed input may cause crashes or memory corruption.
+
See also
DumpHardwareHeader for the block header structure definition.
+
+DumpHardwareEntry for the per-environment entry structure definition.
+
+DumpExtent for the extent range structure definition.
+
+aaruf_get_dumphw() for retrieving dump hardware from opened images.
+
+write_dumphw_block() for the serialization process during image closing.
+ +

Definition at line 531 of file dump.c.

+ +

References AARU_MAGIC, aaruf_crc64_data(), AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, compare_extents(), COPY_STRING_FIELD, DumpHardwareHeader::crc64, aaruformat_context::dump_hardware_entries_with_data, aaruformat_context::dump_hardware_header, DumpHardwareBlock, DumpHardwareHeader::entries, DumpHardwareEntriesWithData::entry, DumpHardwareEntriesWithData::extents, DumpHardwareEntry::extents, FATAL, free_dump_hardware_entries(), DumpHardwareHeader::identifier, aaruformat_context::is_writing, DumpHardwareHeader::length, aaruformat_context::magic, and TRACE.

+ +
+
+ +

◆ aaruf_set_geometry()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_set_geometry (void * context,
const uint32_t cylinders,
const uint32_t heads,
const uint32_t sectors_per_track )
+
+ +

Sets the logical CHS geometry for the AaruFormat image.

+

Configures the Cylinder-Head-Sector (CHS) geometry information for the image being created or modified. This function populates both the geometry block (used for storage in the image file) and the image information structure (used for runtime calculations). The geometry block contains legacy-style logical addressing parameters that describe how the storage medium should be logically organized in terms of cylinders, heads (tracks per cylinder), and sectors per track. This information is crucial for creating images that will be used with software requiring CHS addressing or for accurately preserving the original medium's logical structure.

+
Parameters
+ + + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
cylindersThe number of cylinders to set for the geometry.
headsThe number of heads (tracks per cylinder) to set for the geometry.
sectors_per_trackThe number of sectors per track to set for the geometry.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + +
AARUF_STATUS_OK(0) Successfully set geometry information. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • The geometry block identifier is set to GeometryBlock
  • +
  • The geometry block fields (cylinders, heads, sectorsPerTrack) are updated
  • +
  • The image info fields (Cylinders, Heads, SectorsPerTrack) are synchronized
  • +
  • All parameters are stored for subsequent write operations
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
+
+
+
Note
Dual Storage:
    +
  • Geometry is stored in two locations within the context:
      +
    1. ctx->geometryBlock: Written to the image file as a GeometryBlock during close
    2. +
    3. ctx->imageInfo: Used for runtime calculations and metadata queries
    4. +
    +
  • +
  • Both locations are kept synchronized by this function
  • +
+
+
+Geometry Calculation:
    +
  • Total logical sectors = cylinders × heads × sectors_per_track
  • +
  • Ensure the product matches the actual sector count in the image
  • +
  • Mismatched geometry may cause issues with legacy software or emulators
  • +
  • Sector size is separate and should be set via other API calls
  • +
+
+
+CHS Addressing Requirements:
    +
  • Required for images intended for legacy BIOS or MBR partition schemes
  • +
  • Essential for floppy disk images and older hard disk images
  • +
  • May be optional or synthetic for modern large-capacity drives
  • +
  • Some virtualization platforms require valid CHS geometry
  • +
+
+
+Parameter Constraints:
    +
  • No validation is performed on the geometry values
  • +
  • Zero values are technically accepted but may cause issues
  • +
  • Extremely large values may overflow in calculations (cylinders × heads × sectors_per_track)
  • +
  • Common constraints for legacy systems:
      +
    • Cylinders: typically 1-1024 for BIOS, up to 65535 for modern systems
    • +
    • Heads: typically 1-255 for most systems
    • +
    • Sectors per track: typically 1-63 for BIOS, up to 255 for modern systems
    • +
    +
  • +
+
+
+Write Mode Requirement:
    +
  • This function is intended for use during image creation
  • +
  • Should be called after aaruf_create() and before writing sector data
  • +
  • The geometry block is serialized during aaruf_close()
  • +
  • Must be used with a write-enabled context
  • +
+
+
+Historical Context:
    +
  • CHS geometry was the original addressing scheme for disk drives
  • +
  • Physical CHS reflected actual disk platters, heads, and sector layout
  • +
  • Logical CHS often differs from physical due to zone-bit recording and translation
  • +
  • Modern drives use LBA (Logical Block Addressing) internally
  • +
+
+
Warning
This function does not validate geometry consistency:
    +
  • Does not check if cylinders × heads × sectors_per_track equals image sector count
  • +
  • Does not prevent overflow in the multiplication
  • +
  • Caller must ensure geometry values are appropriate for the medium type
  • +
  • Invalid geometry may cause boot failures or data access issues
  • +
+
+
+The geometry block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+
+Changing geometry after writing sector data may create inconsistencies. Set geometry before beginning sector write operations for best results.
+
+Some image formats and use cases don't require CHS geometry:
    +
  • Optical media (CD/DVD/BD) use different addressing schemes
  • +
  • Modern GPT-partitioned disks don't rely on CHS
  • +
  • Flash-based storage typically doesn't have meaningful CHS geometry
  • +
  • Setting geometry for such media types is harmless but unnecessary
  • +
+
+ +

Definition at line 229 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::cylinders, GeometryBlockHeader::cylinders, FATAL, aaruformat_context::geometry_block, GeometryBlock, aaruformat_context::heads, GeometryBlockHeader::heads, GeometryBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::sectors_per_track, GeometryBlockHeader::sectorsPerTrack, and TRACE.

+ +
+
+ +

◆ aaruf_set_media_barcode()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_media_barcode (void * context,
const uint8_t * data,
const int32_t length )
+
+ +

Sets the media barcode information for the image.

+

Records the barcode affixed to the physical storage media or its packaging. Barcodes are commonly used in professional archival and library environments for automated inventory management, tracking, and retrieval systems. This metadata enables correlation between physical media location systems and digital image files. The barcode is stored in UTF-16LE encoding.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the media barcode string data in UTF-16LE encoding (opaque byte array).
lengthLength of the media barcode data in bytes (must include full UTF-16LE character sequences).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set media barcode. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the media barcode string succeeded
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The media barcode data is copied to ctx->imageInfo.MediaBarcode
  • +
  • The mediaBarcodeLength field is set in the metadata block header
  • +
  • Any previous media barcode string is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the media barcode string
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
Common Barcode Uses:
    +
  • Library and archival tape management systems
  • +
  • Automated tape library robotics (e.g., LTO tape cartridges)
  • +
  • Inventory tracking in large media collections
  • +
  • Asset management in corporate or institutional settings
  • +
  • Chain of custody tracking in forensic environments
  • +
+
+
+Barcode Types and Formats:
    +
  • Code 39 and Code 128 are common for media labeling
  • +
  • LTO tapes use specific 6 or 8-character barcode formats
  • +
  • May include library-specific prefixes or location codes
  • +
  • Some systems use 2D barcodes (QR codes, Data Matrix)
  • +
  • Barcode should be recorded exactly as it appears
  • +
+
+
+Integration with Physical Systems:
    +
  • Enables automated correlation between physical and digital catalogs
  • +
  • Supports robotic tape library operations
  • +
  • Facilitates retrieval from off-site storage facilities
  • +
  • Links to broader asset management databases
  • +
  • Critical for large-scale archival operations
  • +
+
+
+Preservation Context:
    +
  • Important for long-term archival planning
  • +
  • Helps maintain inventory accuracy over time
  • +
  • Supports audit and compliance requirements
  • +
  • Enables efficient physical media location and retrieval
  • +
+
+
Warning
The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+ +

Definition at line 1176 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::media_barcode, MetadataBlockHeader::mediaBarcodeLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_media_manufacturer()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_media_manufacturer (void * context,
const uint8_t * data,
const int32_t length )
+
+ +

Sets the media manufacturer information for the image.

+

Records the name of the company that manufactured the physical storage media. This metadata is valuable for preservation and forensic purposes, as it can help identify the media type, quality characteristics, and manufacturing period. The manufacturer name is stored in UTF-16LE encoding.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the media manufacturer string data in UTF-16LE encoding (opaque byte array).
lengthLength of the media manufacturer data in bytes (must include full UTF-16LE character sequences).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set media manufacturer. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the media manufacturer string succeeded
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The media manufacturer data is copied to ctx->imageInfo.MediaManufacturer
  • +
  • The mediaManufacturerLength field is set in the metadata block header
  • +
  • Any previous media manufacturer string is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the media manufacturer string
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
Common Media Manufacturers:
    +
  • Optical discs: Verbatim, Sony, Maxell, TDK, Taiyo Yuden
  • +
  • Magnetic tapes: Fujifilm, Maxell, Sony, IBM
  • +
  • Floppy disks: 3M, Maxell, Sony, Verbatim
  • +
  • Flash media: SanDisk, Kingston, Samsung
  • +
+
+
+Identification Methods:
    +
  • May be printed on the media surface or packaging
  • +
  • Can sometimes be detected from media ID codes (e.g., ATIP for CD-R)
  • +
  • Historical records or catalogs may provide this information
  • +
  • Important for understanding media quality and longevity characteristics
  • +
+
+
+Preservation Value:
    +
  • Helps assess expected media lifespan and degradation patterns
  • +
  • Useful for identifying counterfeit or remarked media
  • +
  • Aids in research about media quality and failure modes
  • +
  • Provides context for archival planning and migration strategies
  • +
+
+
Warning
The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+ +

Definition at line 832 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::media_manufacturer, MetadataBlockHeader::mediaManufacturerLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_media_model()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_media_model (void * context,
const uint8_t * data,
const int32_t length )
+
+ +

Sets the media model or product designation for the image.

+

Records the specific model, product line, or type designation of the physical storage media. This is more specific than the manufacturer and identifies the exact product variant. This metadata helps in identifying specific media characteristics, performance specifications, and compatibility information. The model information is stored in UTF-16LE encoding.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the media model string data in UTF-16LE encoding (opaque byte array).
lengthLength of the media model data in bytes (must include full UTF-16LE character sequences).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set media model. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the media model string succeeded
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The media model data is copied to ctx->imageInfo.MediaModel
  • +
  • The mediaModelLength field is set in the metadata block header
  • +
  • Any previous media model string is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the media model string
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
Model Designation Examples:
    +
  • Optical discs: "DVD+R 16x", "CD-R 80min", "BD-R DL 50GB"
  • +
  • Tapes: "LTO-7", "DLT-IV", "AIT-3"
  • +
  • Floppy disks: "HD 1.44MB", "DD 720KB"
  • +
  • Flash cards: "SDHC Class 10", "CompactFlash 1000x"
  • +
+
+
+Model Information Usage:
    +
  • Identifies specific capacity and speed ratings
  • +
  • Indicates format compatibility (e.g., DVD-R vs DVD+R)
  • +
  • Helps determine recording characteristics and quality tier
  • +
  • Useful for matching replacement media or troubleshooting issues
  • +
+
+
Warning
The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+ +

Definition at line 939 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::media_model, MetadataBlockHeader::mediaModelLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_media_part_number()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_media_part_number (void * context,
const uint8_t * data,
const int32_t length )
+
+ +

Sets the media part number or model designation for the image.

+

Records the manufacturer's part number or catalog designation for the specific type of physical storage media. This is distinct from the media model in that it represents the exact ordering or catalog number used for procurement and inventory purposes. Part numbers are particularly important for sourcing compatible replacement media and for precise identification in technical documentation. The part number is stored in UTF-16LE encoding.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the media part number string data in UTF-16LE encoding (opaque byte array).
lengthLength of the media part number data in bytes (must include full UTF-16LE character sequences).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set media part number. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the media part number string succeeded
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The media part number data is copied to ctx->imageInfo.MediaPartNumber
  • +
  • The mediaPartNumberLength field is set in the metadata block header
  • +
  • Any previous media part number string is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the media part number string
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
Part Number Examples:
    +
  • Optical media: "MR-25332" (Verbatim DVD+R), "CDR80JC" (Sony CD-R)
  • +
  • Tape media: "C7973A" (HP LTO-3), "TK88" (Maxell DLT-IV)
  • +
  • Floppy disks: "MF2HD" (3.5" high-density), "2D" (5.25" double-density)
  • +
  • May include regional variations or packaging size indicators
  • +
+
+
+Practical Applications:
    +
  • Procurement and ordering of compatible replacement media
  • +
  • Cross-referencing with manufacturer specifications and datasheets
  • +
  • Identifying specific product revisions or manufacturing batches
  • +
  • Ensuring compatibility for archival media migration projects
  • +
  • Tracking costs and suppliers in institutional settings
  • +
+
+
+Relationship to Model:
    +
  • Part number is more specific than model designation
  • +
  • Model might be "DVD+R 16x", part number "MR-25332"
  • +
  • Part numbers may vary by region, packaging quantity, or color
  • +
  • Critical for exact product identification in catalogs and databases
  • +
+
+
+Documentation and Compliance:
    +
  • Useful for creating detailed preservation documentation
  • +
  • Supports compliance with archival standards and best practices
  • +
  • Enables precise replication of archival environments
  • +
  • Facilitates research on media types and failure modes
  • +
+
+
Warning
The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+ +

Definition at line 1297 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::media_part_number, MetadataBlockHeader::mediaPartNumberLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_media_sequence()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_media_sequence (void * context,
const int32_t sequence,
const int32_t last_sequence )
+
+ +

Sets the media sequence information for multi-volume media sets.

+

Configures the sequence numbering for media that is part of a larger set, such as multi-disk software distributions, backup sets spanning multiple tapes, or optical disc sets. This function records both the current media's position in the sequence and the total number of media in the complete set. This metadata is essential for proper ordering and completeness verification when working with multi-volume archives.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
sequenceThe sequence number of this media (1-based index indicating position in the set).
last_sequenceThe total number of media in the complete set (indicates the final sequence number).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + +
AARUF_STATUS_OK(0) Successfully set media sequence information. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The mediaSequence field is set to the provided sequence value
  • +
  • The lastMediaSequence field is set to the provided last_sequence value
  • +
  • Both values are stored for serialization during image close
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
+
+
+
Note
Sequence Numbering:
    +
  • Sequence numbers are typically 1-based (first disc is 1, not 0)
  • +
  • The sequence parameter should be in the range [1, last_sequence]
  • +
  • last_sequence indicates the total count of media in the set
  • +
  • Example: For a 3-disc set, disc 2 would have sequence=2, last_sequence=3
  • +
+
+
+Common Use Cases:
    +
  • Multi-CD/DVD software installations (e.g., "Disc 2 of 4")
  • +
  • Backup tape sets spanning multiple volumes
  • +
  • Split archive formats requiring sequential processing
  • +
  • Multi-floppy disk software distributions
  • +
  • Large data sets divided across multiple optical discs
  • +
+
+
+Metadata Block Initialization:
    +
  • If the metadata block header is not yet initialized, this function initializes it
  • +
  • The metadataBlockHeader.identifier is set to MetadataBlock automatically
  • +
  • Multiple metadata setter functions can be called to build complete metadata
  • +
  • All metadata is written to the image file during aaruf_close()
  • +
+
+
+Single Media Images:
    +
  • For standalone media not part of a set, use sequence=1, last_sequence=1
  • +
  • Setting both values to 0 may be used to indicate "not part of a sequence"
  • +
  • The function does not validate that sequence <= last_sequence
  • +
+
+
+Parameter Validation:
    +
  • No validation is performed on sequence numbers
  • +
  • Negative values are accepted but may be semantically incorrect
  • +
  • sequence > last_sequence is not prevented but indicates an error condition
  • +
  • Callers should ensure sequence and last_sequence are logically consistent
  • +
+
+
+Archive Integrity:
    +
  • Proper sequence metadata is crucial for multi-volume restoration
  • +
  • Archival software may refuse to extract if sequence information is incorrect
  • +
  • Missing volumes can be detected by checking sequence completeness
  • +
  • Helps prevent data loss from incomplete multi-volume sets
  • +
+
+
+Historical Context:
    +
  • Multi-volume sets were common in the floppy disk era due to size constraints
  • +
  • CD/DVD sets were used for large software distributions (operating systems, games)
  • +
  • Tape backup systems still use multi-volume sets for large archives
  • +
  • Modern optical media (BD-R DL) reduced the need for multi-disc sets
  • +
+
+
Warning
This function does not validate the logical consistency of sequence numbers:
    +
  • Does not check if sequence <= last_sequence
  • +
  • Does not prevent negative or zero values if semantically inappropriate
  • +
  • Caller must ensure values represent a valid sequence relationship
  • +
+
+
+The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+
+Incorrect sequence information may prevent proper reconstruction:
    +
  • Software relying on sequence numbers may fail to recognize media order
  • +
  • Archival systems may incorrectly report missing volumes
  • +
  • Restoration processes may fail if sequence is inconsistent
  • +
+
+ +

Definition at line 363 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, MetadataBlockHeader::lastMediaSequence, aaruformat_context::magic, MetadataBlockHeader::mediaSequence, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_media_serial_number()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_media_serial_number (void * context,
const uint8_t * data,
const int32_t length )
+
+ +

Sets the media serial number for the image.

+

Records the unique serial number assigned to the physical storage media by the manufacturer. This metadata provides a unique identifier for the specific piece of media, which is invaluable for tracking, authentication, and forensic analysis. Not all media types have serial numbers; this is most common with professional-grade media and some consumer optical discs. The serial number is stored in UTF-16LE encoding.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the media serial number string data in UTF-16LE encoding (opaque byte array).
lengthLength of the media serial number data in bytes (must include full UTF-16LE character sequences).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set media serial number. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the media serial number string succeeded
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The media serial number data is copied to ctx->imageInfo.MediaSerialNumber
  • +
  • The mediaSerialNumberLength field is set in the metadata block header
  • +
  • Any previous media serial number string is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the media serial number string
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
Serial Number Availability:
    +
  • Professional tape media (LTO, DLT, etc.) typically have printed serial numbers
  • +
  • Some optical discs have embedded media IDs that can serve as serial numbers
  • +
  • Hard drives and SSDs have electronically-readable serial numbers
  • +
  • Consumer recordable media (CD-R, DVD-R) rarely have unique serial numbers
  • +
  • May be printed on labels, hubs, or cartridge shells
  • +
+
+
+Forensic and Archival Importance:
    +
  • Uniquely identifies the specific physical media instance
  • +
  • Critical for chain of custody in forensic investigations
  • +
  • Enables tracking of media throughout its lifecycle
  • +
  • Helps prevent mix-ups in large media collections
  • +
  • Can verify authenticity and detect counterfeits
  • +
+
+
+Format Considerations:
    +
  • Serial numbers may be alphanumeric, numeric, or contain special characters
  • +
  • Format varies widely between manufacturers and media types
  • +
  • May include check digits or formatting separators
  • +
  • Should be recorded exactly as it appears on the media
  • +
+
+
Warning
The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+ +

Definition at line 1054 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::media_serial_number, MetadataBlockHeader::mediaSerialNumberLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_media_title()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_media_title (void * context,
const uint8_t * data,
const int32_t length )
+
+ +

Sets the media title or label for the image.

+

Records the title, label, or name printed or written on the physical storage media. This metadata is particularly useful for identifying discs, tapes, or other media that have user-applied labels or manufacturer-printed titles. The title is stored in UTF-16LE encoding to support international characters and special symbols.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the media title string data in UTF-16LE encoding (opaque byte array).
lengthLength of the media title data in bytes (must include full UTF-16LE character sequences).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set media title. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • Memory allocation for the media title string succeeded
  • +
  • The metadata block header is initialized (identifier set to MetadataBlock)
  • +
  • The media title data is copied to ctx->imageInfo.MediaTitle
  • +
  • The mediaTitleLength field is set in the metadata block header
  • +
  • Any previous media title string is properly freed before replacement
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • malloc() failed to allocate the required memory for the media title string
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • The requested allocation size is too large
  • +
+
+
+
+
Note
Common Media Title Examples:
    +
  • Handwritten labels on optical discs or tapes
  • +
  • Pre-printed software names on distribution media (e.g., "Windows 95 Setup Disk 1")
  • +
  • Volume labels or disc names (e.g., "BACKUP_2024", "INSTALL_CD")
  • +
  • Game titles printed on cartridges or discs
  • +
  • Album or movie titles on multimedia discs
  • +
+
+
+Preservation Context:
    +
  • Important for archival purposes to record exactly what appears on the media
  • +
  • Helps identify media in large collections
  • +
  • May differ from filesystem volume labels
  • +
  • Useful for matching physical media to digital images
  • +
+
+
+UTF-16LE Encoding:
    +
  • The data parameter must contain a valid UTF-16LE encoded string
  • +
  • Length must be in bytes, not character count
  • +
  • Supports international characters, emoji, and special symbols
  • +
  • Null termination is not required; length specifies the exact byte count
  • +
+
+
Warning
The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
+ +

Definition at line 720 of file metadata.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::media_title, MetadataBlockHeader::mediaTitleLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

+ +
+
+ +

◆ aaruf_set_tape_file()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_set_tape_file (void * context,
const uint8_t partition,
const uint32_t file,
const uint64_t starting_block,
const uint64_t ending_block )
+
+ +

Sets or updates the block range for a specific tape file in an Aaru tape image.

+

Creates or modifies a tape file entry in the context's hash table, defining the logical file's extent on the tape medium by its partition number, file number, and block range. This function is the write-mode counterpart to aaruf_get_tape_file() and is used when creating or modifying tape images to establish the file structure metadata.

+

Tape File Registration: When writing a tape image, this function should be called for each logical file to register its location. Each file is uniquely identified by:

    +
  • Partition number (8-bit): The tape partition containing the file
  • +
  • File number (32-bit): The sequential file number within that partition
  • +
+

These values are combined into a 64-bit composite key: key = (partition << 32) | file_number

+

The file entry (including the block range) is then stored in the context's tapeFiles hash table and will be written to the image's TapeFileBlock during finalization.

+

Block Range Definition: The block range [starting_block, ending_block] defines the file's extent:

    +
  • starting_block: The first block address where the file begins (inclusive)
  • +
  • ending_block: The final block address where the file ends (inclusive)
  • +
  • Block count: (ending_block - starting_block + 1)
  • +
+

Block addresses must be absolute positions within the tape image's logical block space. The caller is responsible for ensuring:

    +
  • starting_block <= ending_block (no validation is performed)
  • +
  • Block ranges don't conflict with other files (no validation is performed)
  • +
  • All blocks in the range have been or will be written to the image
  • +
+

Typical Usage Flow:

    +
  1. Open or create an Aaru tape image with write access
  2. +
  3. Write the file's data blocks to the image
  4. +
  5. Call aaruf_set_tape_file() to register the file's block range
  6. +
  7. Repeat for all files on the tape
  8. +
  9. Close the image (TapeFileBlock will be written during finalization)
  10. +
+

Update/Replace Behavior: If a file entry with the same partition/file combination already exists:

    +
  • The old entry is automatically freed
  • +
  • The new entry replaces it in the hash table
  • +
  • A TRACE message indicates the replacement
  • +
+

This allows updating file metadata or correcting errors without manual deletion.

+

Error Handling: The function performs validation in the following order:

    +
  1. Context pointer validation (NULL check)
  2. +
  3. Magic number verification (ensures valid aaruformat context)
  4. +
  5. Write mode verification (ensures image is opened for writing)
  6. +
  7. Memory allocation for the hash entry
  8. +
+

If any validation fails, an appropriate error code is returned and no modifications are made to the context's tape file table.

+

Thread Safety: This function modifies the shared context's hash table and is NOT thread-safe. Concurrent calls to aaruf_set_tape_file() or other functions that modify ctx->tapeFiles may result in data corruption or memory leaks. The caller must ensure exclusive access through external synchronization if needed.

+

Memory Management:

    +
  • Allocates a new hash table entry (tapeFileHashEntry) for each call
  • +
  • HASH_REPLACE automatically frees replaced entries
  • +
  • All hash entries are freed when the context is closed
  • +
  • On allocation failure, no entry is added and an error is returned
  • +
+

Performance Characteristics:

    +
  • Hash table insertion/replacement: O(1) average case
  • +
  • No I/O operations performed (metadata written during image close)
  • +
  • Minimal stack usage
  • +
  • Suitable for bulk file registration operations
  • +
+
Parameters
+ + + + + + +
contextPointer to an initialized aaruformat context. Must not be NULL. The context must have been opened with write access (isWriting=true). The context's tapeFiles hash table will be updated with the new entry.
partitionThe partition number (0-255) where the file is located. For single-partition tapes, this is typically 0. Multi-partition tapes can have files in different partitions with potentially overlapping file numbers.
fileThe file number within the specified partition. File numbers are typically sequential (0, 1, 2, ...) but gaps are allowed. The same file number can exist in different partitions without conflict.
starting_blockThe first block address of the file (inclusive). This should be the absolute block number in the image where the file's first byte begins. Must be <= ending_block (not validated).
ending_blockThe last block address of the file (inclusive). This should be the absolute block number in the image where the file's last byte ends. Must be >= starting_block (not validated).
+
+
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set tape file information. The hash table has been updated with the file entry. If an entry with the same partition/file combination existed, it has been replaced. The metadata will be written to the TapeFileBlock when the image is closed.
AARUF_ERROR_NOT_AARUFORMAT(-1) Invalid context or context validation failed. This is returned when:
    +
  • The context pointer is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (corrupted or wrong type) No modifications are made to the context.
  • +
+
AARUF_READ_ONLY(-22) The context is not opened for writing. This is returned when ctx->isWriting is false, indicating the image was opened in read-only mode. Tape file metadata cannot be modified in read-only mode. No modifications are made to the context.
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. The system could not allocate memory for the hash table entry (tapeFileHashEntry). This is a critical error indicating low memory conditions. No modifications are made to the context.
+
+
+
Note
The function logs entry and exit points via TRACE macros when tracing is enabled, including parameter values and return codes for debugging.
+
+The tape file metadata is not immediately written to disk. It remains in the context's hash table until the image is closed, at which point all entries are serialized and written to a TapeFileBlock.
+
+No validation is performed on the block range values. The caller is responsible for ensuring that starting_block <= ending_block and that the range is valid for the image being created.
+
+No validation is performed to detect overlapping file ranges. Multiple files can reference the same or overlapping block ranges, which may be intentional (e.g., for multi-track or multi-partition scenarios).
+
+If the same partition/file combination is set multiple times, only the last values are retained. This can be used to update file metadata but also means accidental duplicate calls will silently overwrite previous values.
+
Warning
This function is NOT thread-safe. Concurrent modifications to the tape file table may result in undefined behavior, memory corruption, or memory leaks.
+
+The caller must ensure the image is opened with write access before calling this function. Attempting to modify read-only images will fail with AARUF_READ_ONLY.
+
+Parameter validation is minimal. Invalid block ranges (starting_block > ending_block) are accepted and will be written to the image, potentially causing problems when reading the image later.
+
+If memory allocation fails (AARUF_ERROR_NOT_ENOUGH_MEMORY), the file entry is not added. The caller should handle this error appropriately, potentially by freeing memory and retrying or aborting the write operation.
+
See also
aaruf_get_tape_file() for retrieving tape file information from images
+
+process_tape_files_block() for tape file table initialization during read
+
+TapeFileEntry for the structure defining file block ranges
+
+tapeFileHashEntry for the hash table entry structure
+ +

Definition at line 770 of file tape.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, TapeFileEntry::File, TapeFileHashEntry::fileEntry, TapeFileEntry::FirstBlock, aaruformat_context::is_writing, TapeFileHashEntry::key, TapeFileEntry::LastBlock, aaruformat_context::magic, TapeFileEntry::Partition, aaruformat_context::tape_files, and TRACE.

+ +
+
+ +

◆ aaruf_set_tape_partition()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_set_tape_partition (void * context,
const uint8_t partition,
const uint64_t starting_block,
const uint64_t ending_block )
+
+ +

Sets or updates the block range for a specific tape partition in an Aaru tape image.

+

Creates or modifies a tape partition entry in the context's hash table, defining the physical partition's extent on the tape medium by its partition number and block range. This function is the write-mode counterpart to aaruf_get_tape_partition() and is used when creating or modifying tape images to establish the partition structure metadata.

+

Tape Partition Registration: When writing a tape image, this function should be called for each physical partition to register its block range. Each partition is uniquely identified by its partition number (0-255), and most tapes have a single partition (partition 0), though formats like LTO, DLT, and AIT support multiple partitions.

+

The partition entry (including the block range) is stored in the context's tapePartitions hash table and will be written to the image's TapePartitionBlock during finalization.

+

Block Range Definition: The block range [starting_block, ending_block] defines the partition's extent:

    +
  • starting_block: The first block address in the partition (often 0, but format-dependent)
  • +
  • ending_block: The final block address in the partition (inclusive)
  • +
  • Block count: (ending_block - starting_block + 1)
  • +
+

Block addresses are local to each partition. The caller is responsible for ensuring:

    +
  • starting_block <= ending_block (no validation is performed)
  • +
  • Partition ranges don't overlap (no validation is performed)
  • +
  • All blocks in the range have been or will be written to the image
  • +
  • Files referencing this partition have block addresses within this range
  • +
+

Typical Usage Flow:

    +
  1. Open or create an Aaru tape image with write access
  2. +
  3. Define partition layout by calling aaruf_set_tape_partition() for each partition
  4. +
  5. Write data blocks to the image within the defined partition ranges
  6. +
  7. Register files within partitions using aaruf_set_tape_file()
  8. +
  9. Close the image (TapePartitionBlock will be written during finalization)
  10. +
+

Update/Replace Behavior: If a partition entry with the same partition number already exists:

    +
  • The old entry is automatically freed
  • +
  • The new entry replaces it in the hash table
  • +
  • A TRACE message indicates the replacement
  • +
+

This allows updating partition metadata or correcting errors without manual deletion.

+

Error Handling: The function performs validation in the following order:

    +
  1. Context pointer validation (NULL check)
  2. +
  3. Magic number verification (ensures valid aaruformat context)
  4. +
  5. Write mode verification (ensures image is opened for writing)
  6. +
  7. Memory allocation for the hash entry
  8. +
+

If any validation fails, an appropriate error code is returned and no modifications are made to the context's tape partition table.

+

Thread Safety: This function modifies the shared context's hash table and is NOT thread-safe. Concurrent calls to aaruf_set_tape_partition() or other functions that modify ctx->tapePartitions may result in data corruption or memory leaks. The caller must ensure exclusive access through external synchronization if needed.

+

Memory Management:

    +
  • Allocates a new hash table entry (TapePartitionHashEntry) for each call
  • +
  • HASH_REPLACE automatically frees replaced entries
  • +
  • All hash entries are freed when the context is closed
  • +
  • On allocation failure, no entry is added and an error is returned
  • +
+

Performance Characteristics:

    +
  • Hash table insertion/replacement: O(1) average case
  • +
  • No I/O operations performed (metadata written during image close)
  • +
  • Minimal stack usage
  • +
  • Suitable for bulk partition registration operations
  • +
+

Partition Organization: Proper partition metadata is essential for:

    +
  • Documenting the physical layout of multi-partition tapes
  • +
  • Validating file block ranges against partition boundaries
  • +
  • Preserving the original tape's partitioning scheme for archival purposes
  • +
  • Supporting tape formats that require specific partition structures
  • +
  • Enabling applications to understand and navigate complex tape layouts
  • +
+
Parameters
+ + + + + +
contextPointer to an initialized aaruformat context. Must not be NULL. The context must have been opened with write access (isWriting=true). The context's tapePartitions hash table will be updated with the new entry.
partitionThe partition number (0-255) to set. For single-partition tapes, this is typically 0. Multi-partition tapes use sequential numbers (0, 1, 2, ...) though the numbering scheme is format-specific.
starting_blockThe first block address of the partition (inclusive). This defines where the partition begins in the tape's block address space. Often 0 for the first partition, but format-dependent. Must be <= ending_block (not validated).
ending_blockThe last block address of the partition (inclusive). This defines where the partition ends in the tape's block address space. Must be >= starting_block (not validated).
+
+
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully set tape partition information. The hash table has been updated with the partition entry. If an entry with the same partition number existed, it has been replaced. The metadata will be written to the TapePartitionBlock when the image is closed.
AARUF_ERROR_NOT_AARUFORMAT(-1) Invalid context or context validation failed. This is returned when:
    +
  • The context pointer is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (corrupted or wrong type) No modifications are made to the context.
  • +
+
AARUF_READ_ONLY(-22) The context is not opened for writing. This is returned when ctx->isWriting is false, indicating the image was opened in read-only mode. Tape partition metadata cannot be modified in read-only mode. No modifications are made to the context.
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. The system could not allocate memory for the hash table entry (TapePartitionHashEntry). This is a critical error indicating low memory conditions. No modifications are made to the context.
+
+
+
Note
The function logs entry and exit points via TRACE macros when tracing is enabled, including parameter values and return codes for debugging.
+
+The tape partition metadata is not immediately written to disk. It remains in the context's hash table until the image is closed, at which point all entries are serialized and written to a TapePartitionBlock.
+
+No validation is performed on the block range values. The caller is responsible for ensuring that starting_block <= ending_block and that the range is valid for the image being created.
+
+No validation is performed to detect overlapping partition ranges. Partitions with overlapping block addresses may be accepted but will likely cause problems when reading the image or accessing files.
+
+If the same partition number is set multiple times, only the last values are retained. This can be used to update partition metadata but also means accidental duplicate calls will silently overwrite previous values.
+
+For single-partition tapes, it may be acceptable to omit the TapePartitionBlock entirely. Applications reading such images should assume a default partition 0 spanning the entire tape if no partition metadata is present.
+
+Block addresses are local to each partition. Files within a partition reference blocks relative to that partition's address space, not the global tape address space (though in practice, many formats use absolute addressing).
+
Warning
This function is NOT thread-safe. Concurrent modifications to the tape partition table may result in undefined behavior, memory corruption, or memory leaks.
+
+The caller must ensure the image is opened with write access before calling this function. Attempting to modify read-only images will fail with AARUF_READ_ONLY.
+
+Parameter validation is minimal. Invalid block ranges (starting_block > ending_block) are accepted and will be written to the image, potentially causing problems when reading the image later.
+
+If memory allocation fails (AARUF_ERROR_NOT_ENOUGH_MEMORY), the partition entry is not added. The caller should handle this error appropriately, potentially by freeing memory and retrying or aborting the write operation.
+
+Partition metadata should be consistent with file metadata. Files should only reference partitions that have been defined, and their block ranges should fall within the partition boundaries. No automatic validation is performed.
+
See also
aaruf_get_tape_partition() for retrieving tape partition information from images
+
+process_tape_partitions_block() for partition table initialization during read
+
+TapePartitionEntry for the structure defining partition block ranges
+
+TapePartitionHashEntry for the hash table entry structure
+
+aaruf_set_tape_file() for setting file metadata within partitions
+ +

Definition at line 1196 of file tape.c.

+ +

References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, TapePartitionEntry::FirstBlock, aaruformat_context::is_writing, TapePartitionHashEntry::key, TapePartitionEntry::LastBlock, aaruformat_context::magic, TapePartitionEntry::Number, TapePartitionHashEntry::partitionEntry, aaruformat_context::tape_partitions, and TRACE.

+ +
+
+ +

◆ aaruf_set_tracks()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_tracks (void * context,
TrackEntry * tracks,
const int count )
+
+ +

Replace (or clear) the in-memory track table for an AaruFormat image context.

+

Copies an array of caller-provided TrackEntry structures into the internal context, replacing any previously stored track metadata. A CRC64 is recomputed over the new table and stored in the associated TracksHeader. Passing a count of 0 clears existing track information.

+

Typical usage:

    +
  • Prepare an array of TrackEntry structures describing each track (filled by the caller).
  • +
  • Call aaruf_set_tracks() with the array and the track count to load them into the context.
  • +
  • Subsequently the table can be retrieved with aaruf_get_tracks().
  • +
+

Memory ownership:

    +
  • The function allocates (or frees when clearing) internal storage sized to (count * sizeof(TrackEntry)).
  • +
  • The caller retains ownership of the input array (if any) and may free or reuse it after the call.
  • +
+

Validation performed:

    +
  • context must be non-NULL and reference aaruformatContext with magic == AARU_MAGIC.
  • +
  • tracks must be non-NULL when count > 0.
  • +
  • count must be >= 0. (Negative values produce AARUF_ERROR_INVALID_TRACK_FORMAT.)
  • +
  • (Implementation detail) count is truncated to uint16_t for header storage; values > UINT16_MAX will silently wrap. Callers should ensure count <= 65535. This behavior may change in a future version.
  • +
+

Concurrency & thread-safety:

    +
  • Not thread-safe. Mutates shared context state. External synchronization is required if multiple threads access the same context.
  • +
+

Side effects:

    +
  • Frees any existing internal track table before allocating the new one.
  • +
  • Updates ctx->tracksHeader.identifier, entries, crc64.
  • +
  • When clearing (count == 0) sets header to zero and frees internal table.
  • +
+

Error handling & atomicity:

    +
  • On allocation failure the previous track table is already freed (non-atomic replace) and the header is zeroed (no partial new state left). Caller must repopulate.
  • +
  • No partial copies: either all tracks are stored or none.
  • +
+
Parameters
+ + + + +
contextOpaque pointer that MUST point to a valid aaruformatContext returned by an open/create call.
tracksPointer to an array of TrackEntry structures to copy. Must not be NULL if count > 0. Ignored (may be NULL) when count == 0.
countNumber of TrackEntry elements in tracks. If 0, existing tracks are cleared. Must be >= 0 and (recommended) <= UINT16_MAX.
+
+
+
Returns
int32_t API status code indicating success or the nature of the failure.
+
Return values
+ + + + + +
AARUF_STATUS_OKSuccess (tracks replaced or cleared).
AARUF_ERROR_NOT_AARUFORMATcontext is NULL or not a recognized libaaruformat context.
AARUF_ERROR_INVALID_TRACK_FORMATInvalid input (tracks NULL with count > 0, or count < 0).
AARUF_ERROR_NOT_ENOUGH_MEMORYMemory allocation failed while copying tracks.
+
+
+
Warning
Not thread-safe. Do not invoke concurrently with readers/writers of the same context.
+
Note
After success, aaruf_get_tracks() can be used to read back the stored table.
+
See also
aaruf_get_tracks()
+
Since
1.0
+

Usage example (conceptual):

    +
  1. Prepare an array of TrackEntry structures (N elements) and fill the fields.
  2. +
  3. Call aaruf_set_tracks(ctx, array, N) to store them; check for AARUF_STATUS_OK.
  4. +
  5. To clear all tracks later call aaruf_set_tracks(ctx, NULL, 0).
  6. +
  7. Use aaruf_get_tracks() afterwards to retrieve them if needed.
  8. +
+ +

Definition at line 392 of file optical.c.

+ +

References AARU_MAGIC, aaruf_crc64_data(), AARUF_ERROR_INVALID_TRACK_FORMAT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_STATUS_OK, TracksHeader::crc64, aaruformat_context::data_tracks, TracksHeader::entries, FATAL, ImageInfo::HasPartitions, ImageInfo::HasSessions, TracksHeader::identifier, aaruformat_context::image_info, aaruformat_context::magic, aaruformat_context::number_of_data_tracks, TrackEntry::sequence, TRACE, aaruformat_context::track_entries, aaruformat_context::tracks_header, and TracksBlock.

+ +
+
+ +

◆ aaruf_sha1_buffer()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_sha1_buffer (const void * data,
unsigned long size,
unsigned char * result )
+
+ +

Definition at line 155 of file sha1.c.

+ +

References AARU_CALL, AARU_EXPORT, aaruf_sha1_final(), aaruf_sha1_init(), and aaruf_sha1_update().

+ +
+
+ +

◆ aaruf_sha1_final()

+ +
+
+ + + + + + + + + + + +
void aaruf_sha1_final (sha1_ctx * ctx,
unsigned char * result )
+
+ +

Definition at line 124 of file sha1.c.

+ +

References AARU_CALL, AARU_EXPORT, aaruf_sha1_update(), sha1_ctx::buffer, sha1_ctx::count, and sha1_ctx::state.

+ +

Referenced by aaruf_sha1_buffer(), and write_checksum_block().

+ +
+
+ +

◆ aaruf_sha1_init()

+ +
+
+ + + + + + + +
void aaruf_sha1_init (sha1_ctx * ctx)
+
+ +

Definition at line 34 of file sha1.c.

+ +

References AARU_CALL, AARU_EXPORT, sha1_ctx::buffer, sha1_ctx::count, and sha1_ctx::state.

+ +

Referenced by aaruf_create(), and aaruf_sha1_buffer().

+ +
+
+ +

◆ aaruf_sha1_update()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_sha1_update (sha1_ctx * ctx,
const void * data,
unsigned long size )
+
+
+ +

◆ aaruf_sha256_buffer()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_sha256_buffer (const void * data,
unsigned long size,
unsigned char * result )
+
+ +

Definition at line 141 of file sha256.c.

+ +

References AARU_CALL, AARU_EXPORT, aaruf_sha256_final(), aaruf_sha256_init(), and aaruf_sha256_update().

+ +
+
+ +

◆ aaruf_sha256_final()

+ +
+
+ + + + + + + + + + + +
void aaruf_sha256_final (sha256_ctx * ctx,
unsigned char * result )
+
+
+ +

◆ aaruf_sha256_init()

+ +
+
+ + + + + + + +
void aaruf_sha256_init (sha256_ctx * ctx)
+
+ +

Definition at line 76 of file sha256.c.

+ +

References AARU_CALL, AARU_EXPORT, sha256_ctx::bitcount, sha256_ctx::buffer, and sha256_ctx::state.

+ +

Referenced by aaruf_create(), and aaruf_sha256_buffer().

+ +
+
+ +

◆ aaruf_sha256_update()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_sha256_update (sha256_ctx * ctx,
const void * data,
unsigned long size )
+
+
+ +

◆ aaruf_spamsum_final()

+ + + +

◆ aaruf_spamsum_free()

+ +
+
+ + + + + + + +
void aaruf_spamsum_free (spamsum_ctx * ctx)
+
+ +

Frees a spamsum (fuzzy hash) context.

+
Parameters
+ + +
ctxPointer to the spamsum context to free.
+
+
+ +

Definition at line 75 of file spamsum.c.

+ +

References AARU_CALL, and AARU_EXPORT.

+ +

Referenced by cleanup_failed_create(), and write_checksum_block().

+ +
+
+ +

◆ aaruf_spamsum_init()

+ +
+
+ + + + + + + +
spamsum_ctx * aaruf_spamsum_init (void )
+
+ +

Definition at line 37 of file spamsum.c.

+ +

References AARU_CALL, AARU_EXPORT, spamsum_ctx::bh, spamsum_ctx::bh_end, blockhash_ctx::h, blockhash_ctx::half_h, and HASH_INIT.

+ +

Referenced by aaruf_create().

+ +
+
+ +

◆ aaruf_spamsum_update()

+ +
+
+ + + + + + + + + + + + + + + + +
int aaruf_spamsum_update (spamsum_ctx * ctx,
const uint8_t * data,
const uint32_t len )
+
+ +

Updates the spamsum context with new data.

+
Parameters
+ + + + +
ctxPointer to the spamsum context.
dataPointer to the data to process.
lenLength of the data in bytes.
+
+
+
Returns
0 on success, -1 on error.
+ +

Definition at line 59 of file spamsum.c.

+ +

References AARU_CALL, AARU_EXPORT, fuzzy_engine_step(), and spamsum_ctx::total_size.

+ +

Referenced by aaruf_write_sector(), and aaruf_write_sector_long().

+ +
+
+ +

◆ aaruf_verify_image()

+ +
+
+ + + + + + + +
int32_t aaruf_verify_image (void * context)
+
+ +

Verifies the integrity of an AaruFormat image file.

+

Checks the integrity of all blocks and deduplication tables in the image by validating CRC64 checksums for each indexed block. This function performs comprehensive verification of data blocks, DDT v1 and v2 tables, tracks blocks, and other structural components. It reads blocks in chunks to optimize memory usage during verification and supports version-specific CRC endianness handling.

+
Parameters
+ + +
contextPointer to the aaruformat context.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + + +
AARUF_STATUS_OK(0) Successfully verified image integrity. This is returned when:
    +
  • All indexed blocks are successfully read and processed
  • +
  • All CRC64 checksums match their expected values
  • +
  • Index verification passes for the detected index version
  • +
  • All block headers are readable and valid
  • +
  • Memory allocation for verification buffer succeeds
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
+
AARUF_ERROR_CANNOT_READ_HEADER(-6) Failed to read critical headers. This occurs when:
    +
  • Cannot read the index signature from the image stream
  • +
  • File I/O errors prevent reading header structures
  • +
+
AARUF_ERROR_CANNOT_READ_INDEX(-4) Index processing or validation failed. This occurs when:
    +
  • Index signature is not a recognized type (IndexBlock, IndexBlock2, or IndexBlock3)
  • +
  • Index verification functions return error codes
  • +
  • Index processing functions return NULL (corrupted or invalid index)
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Cannot allocate VERIFY_SIZE (1MB) buffer for reading block data during verification
  • +
  • System is out of available memory for verification operations
  • +
+
AARUF_ERROR_CANNOT_READ_BLOCK(-7) Block reading failed. This occurs when:
    +
  • Cannot read block headers (DataBlock, DeDuplicationTable, DeDuplicationTable2, TracksBlock)
  • +
  • File I/O errors prevent reading block structure data
  • +
  • CRC64 context initialization fails (internal error)
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-18) CRC verification failed. This occurs when:
    +
  • Calculated CRC64 doesn't match the expected CRC64 in block headers
  • +
  • Data corruption is detected in any verified block
  • +
  • This applies to DataBlock, DeDuplicationTable, DeDuplicationTable2, and TracksBlock types
  • +
+
+
+
+
Note
Verification Process:
    +
  • Reads blocks in VERIFY_SIZE (1MB) chunks to optimize memory usage
  • +
  • Supports version-specific CRC64 endianness (v1 uses byte-swapped CRC64)
  • +
  • Verifies only blocks that have CRC checksums (skips blocks without checksums)
  • +
  • Unknown block types are logged but don't cause verification failure
  • +
+
+
+Block Types Verified:
    +
  • DataBlock: Verifies compressed data CRC64 against block header
  • +
  • DeDuplicationTable (v1): Verifies DDT data CRC64 with version-specific endianness
  • +
  • DeDuplicationTable2 (v2): Verifies DDT data CRC64 (no endianness conversion)
  • +
  • TracksBlock: Verifies track entries CRC64 with version-specific endianness
  • +
  • Other block types are ignored during verification
  • +
+
+
+Performance Considerations:
    +
  • Uses chunked reading to minimize memory footprint during verification
  • +
  • Processes blocks sequentially to maintain good disk access patterns
  • +
  • CRC64 contexts are created and destroyed for each block to prevent memory leaks
  • +
+
+
Warning
This function performs read-only verification and does not modify the image. It requires the image to be properly opened with a valid context.
+
+Verification failure indicates data corruption or tampering. Images that fail verification should not be trusted for data recovery operations.
+
+The function allocates a 1MB buffer for verification. Ensure sufficient memory is available before calling this function on resource-constrained systems.
+ +

Definition at line 130 of file verify.c.

+ +

References AARU_MAGIC, aaruf_crc64_final(), aaruf_crc64_free(), aaruf_crc64_init(), AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_CANNOT_READ_HEADER, AARUF_ERROR_CANNOT_READ_INDEX, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_STATUS_OK, AARUF_VERSION_V1, IndexEntry::blockType, bswap_64, BlockHeader::cmpCrc64, DdtHeader2::cmpCrc64, DdtHeader::cmpCrc64, BlockHeader::cmpLength, DdtHeader2::cmpLength, DdtHeader::cmpLength, TracksHeader::crc64, DataBlock, DeDuplicationTable, DeDuplicationTable2, TracksHeader::entries, FATAL, aaruformat_context::header, AaruHeaderV2::imageMajorVersion, aaruformat_context::imageStream, IndexBlock, IndexBlock2, IndexBlock3, AaruHeaderV2::indexOffset, aaruformat_context::magic, IndexEntry::offset, process_index_v1(), process_index_v2(), process_index_v3(), TRACE, TracksBlock, update_crc64_from_stream(), verify_index_v1(), verify_index_v2(), verify_index_v3(), and VERIFY_SIZE.

+ +
+
+ +

◆ aaruf_write_media_tag()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_write_media_tag (void * context,
const uint8_t * data,
const int32_t type,
const uint32_t length )
+
+ +

Writes a media tag to the AaruFormat image, storing medium-specific metadata and descriptors.

+

This function stores arbitrary media-specific metadata (media tags) in the AaruFormat image context for later serialization during image finalization. Media tags represent higher-level descriptors and metadata structures that characterize the storage medium beyond sector data, including disc information structures, lead-in/lead-out data, manufacturer identifiers, drive capabilities, and format-specific metadata. The function uses a hash table for efficient tag storage and retrieval, automatically replacing existing tags of the same type and managing memory for tag data.

+

Supported Media Tag Categories:

+

Optical Disc Metadata (CD/DVD/BD/HD DVD):

    +
  • CD_TOC (0): Table of Contents from READ TOC/PMA/ATIP command (Format 0000b - Formatted TOC)
      +
    • Contains track entries, session boundaries, lead-in/lead-out addressing, and track types
    • +
    • Essential for multi-session and mixed-mode CD structure representation
    • +
    +
  • +
  • CD_FullTOC (1): Full TOC (Format 0010b) including session info and point/ADR/control fields
      +
    • Provides complete session structure with ADR field interpretation and sub-Q channel details
    • +
    +
  • +
  • CD_SessionInfo (2): Session information (Format 0001b) for multi-session discs
  • +
  • CD_TEXT (3): CD-TEXT data from lead-in area (artist, title, performer, songwriter metadata)
  • +
  • CD_ATIP (4): Absolute Time In Pregroove (CD-R/RW timing calibration and media manufacturer data)
  • +
  • CD_PMA (5): Power Management Area (CD-R/RW recording session management metadata)
  • +
  • DVD_PFI (6): Physical Format Information (DVD layer characteristics, book type, linear density)
  • +
  • DVD_DMI (7): Disc Manufacturing Information (DVD unique identifier and replication metadata)
  • +
  • DVD_BCA (8): Burst Cutting Area (copy protection and regional management data for DVD-Video)
  • +
  • BD_DI (28): Disc Information (Blu-ray layer count, recording format, disc size, channel bit length)
  • +
  • BD_BCA (29): Blu-ray Burst Cutting Area (unique disc identifier and anti-counterfeiting data)
  • +
+

Recordable Media Structures:

    +
  • DVDR_RMD (17): Recorded Media Data (last border-out RMD for DVD-R/-RW finalization state)
  • +
  • DVDR_PreRecordedInfo (18): Pre-recorded information area from lead-in (DVD-R physical specs)
  • +
  • DVDR_MediaIdentifier (19): Writable media identifier (DVD-R/-RW unique ID from manufacturer)
  • +
  • BD_DDS (30): Disc Definition Structure (BD-R/RE recording management and spare area allocation)
  • +
  • BD_SpareArea (32): BD spare area allocation map (defect management for recordable Blu-ray)
  • +
+

Copy Protection and Security:

    +
  • AACS_VolumeIdentifier (33): AACS Volume Identifier (content identifier for AACS-protected media)
  • +
  • AACS_SerialNumber (34): Pre-recorded media serial number (unique per AACS disc pressing)
  • +
  • AACS_MediaIdentifier (35): AACS Media Identifier (cryptographic binding to physical medium)
  • +
  • AACS_MKB (36): AACS Media Key Block (encrypted title keys and revocation lists)
  • +
  • AACS_DataKeys (37): Extracted AACS title/volume keys (when decrypted, for archival purposes)
  • +
  • AACS_CPRM_MKB (39): CPRM Media Key Block (Content Protection for Recordable Media)
  • +
+

Device and Drive Information:

    +
  • SCSI_INQUIRY (45): SCSI INQUIRY standard data (device type, vendor, model, firmware revision)
  • +
  • SCSI_MODEPAGE_2A (46): SCSI Mode Page 2Ah (CD/DVD/BD capabilities and supported features)
  • +
  • ATA_IDENTIFY (47): ATA IDENTIFY DEVICE response (512 bytes of drive capabilities and geometry)
  • +
  • ATAPI_IDENTIFY (48): ATA PACKET IDENTIFY DEVICE (ATAPI drive identification and features)
  • +
  • MMC_WriteProtection (41): Write protection status from MMC GET CONFIGURATION command
  • +
  • MMC_DiscInformation (42): Disc Information (recordable status, erasable flag, last session)
  • +
+

Flash and Solid-State Media:

    +
  • SD_CID (50): SecureDigital Card ID register (manufacturer, OEM, product name, serial number)
  • +
  • SD_CSD (51): SecureDigital Card Specific Data (capacity, speed class, file format)
  • +
  • SD_SCR (52): SecureDigital Configuration Register (SD spec version, bus widths, security)
  • +
  • SD_OCR (53): SecureDigital Operation Conditions Register (voltage ranges, capacity type)
  • +
  • MMC_CID (54): MMC Card ID (similar to SD_CID for eMMC/MMC devices)
  • +
  • MMC_CSD (55): MMC Card Specific Data (MMC device parameters)
  • +
  • MMC_ExtendedCSD (57): MMC Extended CSD (512 bytes of extended MMC capabilities)
  • +
+

Gaming Console Media:

    +
  • Xbox_SecuritySector (58): Xbox/Xbox 360 Security Sector (SS.bin - anti-piracy signature data)
  • +
  • Xbox_DMI (66): Xbox Disc Manufacturing Info (manufacturing plant and batch metadata)
  • +
  • Xbox_PFI (67): Xbox Physical Format Information (Xbox-specific DVD layer configuration)
  • +
+

Specialized Structures:

    +
  • CD_FirstTrackPregap (61): First track pregap (index 0 contents, typically silent on audio CDs)
  • +
  • CD_LeadOut (62): Lead-out area contents (post-data region signaling disc end)
  • +
  • CD_LeadIn (68): Raw lead-in data (TOC frames and sub-Q channel from pre-data region)
  • +
  • Floppy_LeadOut (59): Manufacturer/duplication cylinder (floppy copy protection metadata)
  • +
  • PCMCIA_CIS (49): PCMCIA/CardBus Card Information Structure tuple chain
  • +
  • USB_Descriptors (65): Concatenated USB descriptors (device/config/interface for USB drives)
  • +
+

Data Processing Pipeline:

    +
  1. Context Validation: Verifies context is valid AaruFormat context with write permissions
  2. +
  3. Parameter Validation: Checks data pointer is non-NULL and length is non-zero
  4. +
  5. Memory Allocation: Allocates new buffer for tag data and mediaTagEntry structure
  6. +
  7. Data Copying: Performs deep copy of tag data to ensure context owns the memory
  8. +
  9. Hash Table Insertion: Adds or replaces entry in mediaTags hash table using uthash HASH_REPLACE_INT
  10. +
  11. Cleanup: Frees old media tag entry and data if replacement occurred
  12. +
  13. Return Success: Returns AARUF_STATUS_OK on successful completion
  14. +
+

Memory Management Strategy:

    +
  • Deep Copy Semantics: Function performs deep copy of input data; caller retains ownership of original buffer
  • +
  • Automatic Replacement: Existing tag of same type is automatically freed when replaced
  • +
  • Hash Table Storage: Media tags stored in uthash-based hash table for O(1) lookup by type
  • +
  • Deferred Serialization: Tag data remains in memory until aaruf_close() serializes to image file
  • +
  • Cleanup on Close: All media tag memory automatically freed during aaruf_close()
  • +
+

Tag Type Identification: The type parameter accepts MediaTagType enumeration values (0-68) that identify the semantic meaning of the tag data. The library does not validate tag data structure or size against the type identifier - callers are responsible for providing correctly formatted tag data matching the declared type. Type values are preserved as-is and used during serialization to identify tag purpose during image reading.

+

Replacement Behavior: When a media tag of the same type already exists in the context:

    +
  • The old tag entry is removed from the hash table
  • +
  • The old tag's data buffer is freed
  • +
  • The old tag entry structure is freed
  • +
  • The new tag replaces the old tag in the hash table
  • +
  • No warning or error is generated for replacement This allows incremental updates to media tags during image creation.
  • +
+

Serialization and Persistence: Media tags written via this function are not immediately written to the image file. Instead, they are accumulated in the context's mediaTags hash table and serialized during aaruf_close() as part of the image finalization process. The serialization creates a metadata block in the image file that preserves all media tags with their type identifiers and data lengths.

+

Thread Safety and Concurrency: This function is NOT thread-safe. The context contains mutable shared state including:

    +
  • mediaTags hash table modification
  • +
  • Memory allocation and deallocation
  • +
  • No internal locking or synchronization External synchronization required for concurrent access from multiple threads.
  • +
+

Performance Considerations:

    +
  • Hash table insertion is O(1) average case for new tags
  • +
  • Hash table replacement is O(1) for existing tags
  • +
  • Memory allocation overhead proportional to tag data size
  • +
  • No disk I/O occurs during this call (deferred to aaruf_close())
  • +
  • Suitable for frequent tag updates during image creation workflow
  • +
+

Typical Usage Scenarios:

    +
  • Optical Disc Imaging: Store TOC, PMA, ATIP, CD-TEXT from READ TOC family commands
  • +
  • Copy Protection Preservation: Store BCA, AACS structures, media identifiers for archival
  • +
  • Drive Capabilities: Store INQUIRY, Mode Page 2Ah, IDENTIFY data for forensic metadata
  • +
  • Flash Card Imaging: Store CID, CSD, SCR, OCR registers from SD/MMC cards
  • +
  • Console Game Preservation: Store Xbox security sectors and manufacturing metadata
  • +
  • Recordable Media: Store RMD, media identifiers, spare area maps for write-once media
  • +
+

Validation and Error Handling:

    +
  • Context validity checked via magic number comparison (AARU_MAGIC)
  • +
  • Write permission verified via isWriting flag
  • +
  • NULL data pointer triggers AARUF_ERROR_INCORRECT_DATA_SIZE
  • +
  • Zero length triggers AARUF_ERROR_INCORRECT_DATA_SIZE
  • +
  • Memory allocation failures return AARUF_ERROR_NOT_ENOUGH_MEMORY
  • +
  • No validation of tag data structure or size against type identifier
  • +
+

Data Format Requirements: The function accepts arbitrary binary data without format validation. Callers must ensure:

    +
  • Tag data matches the declared MediaTagType structure and size
  • +
  • Binary data is properly byte-ordered for the target platform
  • +
  • Variable-length tags include proper internal length fields if required
  • +
  • Tag data represents a complete, self-contained structure
  • +
+

Integration with Image Creation Workflow: Media tags should typically be written after creating the image context (aaruf_create()) but before writing sector data. However, tags can be added or updated at any point during the writing process. Common workflow:

    +
  1. Create image context with aaruf_create()
  2. +
  3. Set tracks with aaruf_set_tracks() if applicable
  4. +
  5. Write media tags with write_media_tag() for all available metadata
  6. +
  7. Write sector data with aaruf_write_sector() or aaruf_write_sector_long()
  8. +
  9. Close image with aaruf_close() to finalize and serialize all metadata
  10. +
+
Parameters
+ + + + + +
contextPointer to a valid aaruformatContext with magic == AARU_MAGIC opened for writing. Must be created via aaruf_create() and not yet closed. The context's isWriting flag must be true, indicating write mode is active.
dataPointer to the media tag data buffer to write. Must be a valid non-NULL pointer to a buffer containing the complete tag data. The function performs a deep copy of this data, so the caller retains ownership and may free or modify the source buffer after this call returns. The data format must match the structure expected for the specified type parameter.
typeInteger identifier specifying the type of media tag (MediaTagType enumeration). Values range from 0 (CD_TOC) to 68 (CD_LeadIn). The type identifies the semantic meaning of the tag data and is preserved in the image file for interpretation during reading. The library does not validate that the data structure matches the declared type - caller responsibility to ensure correctness.
lengthLength in bytes of the media tag data buffer. Must be greater than zero. Specifies how many bytes to copy from the data buffer. No maximum length enforced, but extremely large tags may cause memory allocation failures.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + +
AARUF_STATUS_OK(0) Successfully wrote the media tag. This is returned when:
    +
  • Context is valid with correct magic number (AARU_MAGIC)
  • +
  • Context is in writing mode (isWriting == true)
  • +
  • Data pointer is non-NULL and length is non-zero
  • +
  • Memory allocation succeeded for both tag data and entry structure
  • +
  • Tag entry successfully inserted into mediaTags hash table
  • +
  • If replacing existing tag, old tag successfully freed
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) Invalid context provided. This occurs when:
    +
  • context parameter is NULL (no context provided)
  • +
  • Context magic number != AARU_MAGIC (wrong context type, corrupted context, or uninitialized)
  • +
  • Context was not created by aaruf_create() or has been corrupted
  • +
+
AARUF_READ_ONLY(-22) Attempting to write to read-only image. This occurs when:
    +
  • Context isWriting flag is false
  • +
  • Image was opened with aaruf_open() instead of aaruf_create()
  • +
  • Context is in read-only mode and modifications are not permitted
  • +
+
AARUF_ERROR_INCORRECT_DATA_SIZE(-8) Invalid data or length parameters. This occurs when:
    +
  • data parameter is NULL (no tag data provided)
  • +
  • length parameter is zero (no data to write)
  • +
  • Parameters indicate invalid or empty tag data
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Failed to allocate buffer for tag data copy (malloc(length) failed)
  • +
  • Failed to allocate mediaTagEntry structure (malloc(sizeof(mediaTagEntry)) failed)
  • +
  • System is out of available memory for requested allocation size
  • +
  • Memory allocation fails due to resource exhaustion or fragmentation
  • +
+
+
+
+
Note
Cross-References: This function is the write counterpart to aaruf_read_media_tag(). See also: +
+
+Memory Ownership: The function performs a deep copy of tag data. After successful return, the context owns the copied tag data and the caller may free or modify the original data buffer. On failure, no memory is retained by the context - caller maintains full ownership of input buffer regardless of success or failure.
+
+Tag Uniqueness: Only one media tag of each type can exist in an image. Writing a tag with a type that already exists will replace the previous tag, freeing its memory and using the new tag data. No error or warning is generated for replacements.
+
+Deferred Serialization: Media tags are not written to disk until aaruf_close() is called. All tags remain in memory throughout the image creation process. For images with many or large media tags, memory usage may be significant.
+
+No Type Validation: The library does not validate that tag data matches the declared type. Callers must ensure data structure correctness. Mismatched data may cause reading applications to fail or misinterpret tag contents.
+
Warning
Memory Growth: Each media tag consumes memory equal to tag data size plus mediaTagEntry structure overhead. Large tags or many tags can significantly increase memory usage. Monitor memory consumption when writing extensive metadata.
+
+Type Correctness: No validation occurs for tag data format against type identifier. Providing incorrectly formatted data or mismatched type identifiers will create a valid image file with invalid tag data that may cause failures when reading. Ensure data format matches MediaTagType specification requirements.
+
+Replacement Silent: Replacing an existing tag does not generate warnings or errors. Applications expecting to detect duplicate tag writes must track this externally. The most recent write_media_tag() call for each type determines the final tag value.
+
See also
aaruf_read_media_tag() for corresponding media tag reading functionality
+
+aaruf_create() for image context creation in write mode
+
+aaruf_close() for media tag serialization and memory cleanup
+
+MediaTagType enumeration for valid type identifier values and meanings
+ +

Definition at line 1780 of file write.c.

+ +

References AARU_MAGIC, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, mediaTagEntry::data, FATAL, aaruformat_context::is_writing, mediaTagEntry::length, aaruformat_context::magic, aaruformat_context::mediaTags, TRACE, and mediaTagEntry::type.

+ +
+
+ +

◆ aaruf_write_sector()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_write_sector (void * context,
uint64_t sector_address,
bool negative,
const uint8_t * data,
uint8_t sector_status,
uint32_t length )
+
+ +

Writes a sector to the AaruFormat image.

+

Writes the given data to the specified sector address in the image, with the given status and length. This function handles buffering data into blocks, automatically closing blocks when necessary (sector size changes or block size limits are reached), and managing the deduplication table (DDT) entries.

+
Parameters
+ + + + + + + +
contextPointer to the aaruformat context.
sector_addressLogical sector address to write.
negativeIndicates if the sector address is negative.
dataPointer to the data buffer to write.
sector_statusStatus of the sector to write.
lengthLength of the data buffer.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + + +
AARUF_STATUS_OK(0) Successfully wrote the sector data. This is returned when:
    +
  • The sector data is successfully copied to the writing buffer
  • +
  • The DDT entry is successfully updated for the sector address
  • +
  • Block management operations complete successfully
  • +
  • Buffer positions and offsets are properly updated
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
+
AARUF_READ_ONLY(-22) Attempting to write to a read-only image. This occurs when:
    +
  • The context's isWriting flag is false
  • +
  • The image was opened in read-only mode
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Failed to allocate memory for the writing buffer when creating a new block
  • +
  • The system is out of available memory for buffer allocation
  • +
+
AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER(-23) Failed to write block header to the image file. This can occur during automatic block closure when:
    +
  • The fwrite() call for the block header fails
  • +
  • Disk space is insufficient or file system errors occur
  • +
+
AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA(-24) Failed to write block data to the image file. This can occur during automatic block closure when:
    +
  • The fwrite() call for the block data fails
  • +
  • Disk space is insufficient or file system errors occur
  • +
+
AARUF_ERROR_CANNOT_SET_DDT_ENTRY(-25) Failed to update the deduplication table (DDT) entry. This occurs when:
    +
  • The DDT entry for the specified sector address could not be set or updated
  • +
  • Internal DDT management functions return failure
  • +
  • DDT table corruption or memory issues prevent entry updates
  • +
+
+
+
+
Note
Block Management:
    +
  • The function automatically closes the current block when sector size changes
  • +
  • Blocks are also closed when they reach the maximum size (determined by dataShift)
  • +
  • New blocks are created automatically when needed with appropriate headers
  • +
+
+
+Memory Management:
    +
  • Writing buffers are allocated on-demand when creating new blocks
  • +
  • Buffer memory is freed when blocks are closed
  • +
  • Buffer size is calculated based on sector size and data shift parameters
  • +
+
+
+DDT Updates:
    +
  • Each written sector updates the corresponding DDT entry
  • +
  • DDT entries track block offset, position, and sector status
  • +
  • Uses DDT version 2 format for entries
  • +
+
+
Warning
The function may trigger automatic block closure, which can result in disk I/O operations and potential write errors even for seemingly simple sector writes.
+ +

Definition at line 98 of file write.c.

+ +

References AARU_MAGIC, aaruf_close_current_block(), AARUF_ERROR_CANNOT_SET_DDT_ENTRY, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_ERROR_SECTOR_OUT_OF_BOUNDS, aaruf_md5_update(), AARUF_READ_ONLY, aaruf_sha1_update(), aaruf_sha256_update(), aaruf_spamsum_update(), AARUF_STATUS_OK, Audio, aaruformat_context::blake3_context, aaruformat_context::calculating_blake3, aaruformat_context::calculating_md5, aaruformat_context::calculating_sha1, aaruformat_context::calculating_sha256, aaruformat_context::calculating_spamsum, BlockHeader::compression, aaruformat_context::compression_enabled, aaruformat_context::current_block_header, aaruformat_context::current_block_offset, aaruformat_context::current_track_type, Data, DataBlock, DdtHeader2::dataShift, aaruformat_context::deduplicate, TrackEntry::end, TracksHeader::entries, FATAL, Flac, BlockHeader::identifier, aaruformat_context::image_info, insert_map(), aaruformat_context::is_writing, JaguarCD, aaruformat_context::last_written_block, lookup_map(), Lzma, aaruformat_context::magic, aaruformat_context::md5_context, ImageInfo::MediaType, ImageInfo::MetadataMediaType, DdtHeader2::negative, aaruformat_context::next_block_position, None, OpticalDisc, DdtHeader2::overflow, aaruformat_context::rewinded, aaruformat_context::sector_hash_map, ImageInfo::Sectors, BlockHeader::sectorSize, TrackEntry::sequence, TrackEntry::session, set_ddt_entry_v2(), aaruformat_context::sha1_context, aaruformat_context::sha256_context, aaruformat_context::spamsum_context, TrackEntry::start, TRACE, aaruformat_context::track_entries, aaruformat_context::tracks_header, BlockHeader::type, TrackEntry::type, aaruformat_context::user_data_ddt_header, UserData, VideoNow, VideoNowColor, VideoNowXp, aaruformat_context::writing_buffer, aaruformat_context::writing_buffer_position, and aaruformat_context::writing_long.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ aaruf_write_sector_long()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_write_sector_long (void * context,
uint64_t sector_address,
bool negative,
const uint8_t * data,
uint8_t sector_status,
uint32_t length )
+
+ +

Writes a full ("long") raw sector from optical or block media, parsing structure and validating content.

+

This function processes complete raw sectors including structural metadata, error correction codes, and subchannel information. It is the primary entry point for ingesting raw sector data where the caller provides the complete sector including synchronization patterns, headers, user data, and error correction information. The function intelligently parses the sector structure based on media type and track information, validates correctness, and delegates user data writing to aaruf_write_sector().

+

Supported Media Types and Sector Formats:

+

Optical Disc Media (2352-byte sectors):

    +
  • Audio tracks: Raw PCM audio data (2352 bytes) passed directly to aaruf_write_sector()
  • +
  • Data tracks: Raw data sectors passed directly to aaruf_write_sector()
  • +
  • CD Mode 1: Sync(12) + Header(4) + UserData(2048) + EDC(4) + Reserved(8) + ECC_P(172) + ECC_Q(104)
      +
    • Validates sync pattern (00 FF FF FF FF FF FF FF FF FF FF 00), mode byte (01), and MSF timing
    • +
    • Checks EDC/ECC correctness using aaruf_ecc_cd_is_suffix_correct()
    • +
    • Stores anomalous prefixes/suffixes in separate buffers with mini-DDT indexing
    • +
    +
  • +
  • CD Mode 2 Form 1: Sync(12) + Header(4) + Subheader(8) + UserData(2048) + EDC(4) + ECC_P(172) + ECC_Q(104)
      +
    • Validates sync pattern, mode byte (02), and Form 1 identification in subheader
    • +
    • Checks both EDC and ECC correctness for Form 1 sectors
    • +
    • Extracts and stores 8-byte subheader separately in mode2_subheaders buffer
    • +
    +
  • +
  • CD Mode 2 Form 2: Sync(12) + Header(4) + Subheader(8) + UserData(2324) + EDC(4)
      +
    • Validates sync pattern, mode byte (02), and Form 2 identification in subheader
    • +
    • Checks EDC correctness, handles missing EDC (zero) as valid state
    • +
    • No ECC validation for Form 2 sectors (not present in format)
    • +
    +
  • +
  • CD Mode 2 Formless: Similar to Form 2 but without form determination from subheader
  • +
+

Block Media (512+ byte sectors with tags):

    +
  • Apple Profile/FileWare: 512-byte sectors + 20-byte Profile tags
  • +
  • Apple Sony SS/DS: 512-byte sectors + 12-byte Sony tags
  • +
  • Apple Widget: 512-byte sectors with tag conversion support
  • +
  • Priam DataTower: 512-byte sectors + 24-byte Priam tags
  • +
  • Supports automatic tag format conversion between Sony (12), Profile (20), and Priam (24) byte formats
  • +
  • Tag data stored in sector_subchannel buffer for preservation
  • +
+

Data Processing Pipeline:

    +
  1. Context and Parameter Validation: Verifies context magic, write permissions, and sector bounds
  2. +
  3. Track Resolution: Locates track entry covering the sector address to determine track type
  4. +
  5. Rewind Detection: Detects out-of-order writing and disables hash calculations to maintain integrity
  6. +
  7. Hash Updates: Updates MD5, SHA1, SHA256, SpamSum, and BLAKE3 contexts for user-range sectors
  8. +
  9. Structure Parsing: Splits raw sector into prefix, user data, and suffix components
  10. +
  11. Validation: Checks sync patterns, timing fields, EDC/ECC correctness, and format compliance
  12. +
  13. Metadata Storage: Stores anomalous or non-standard components in dedicated buffers
  14. +
  15. User Data Delegation: Calls aaruf_write_sector() with extracted user data and derived status
  16. +
+

Memory Management Strategy:

    +
  • DDT Arrays: Lazily allocated 64-bit arrays sized for total addressable space (negative + user + overflow)
      +
    • sectorPrefixDdt2: Tracks prefix status and buffer offsets (high 4 bits = status, low 60 bits = offset/16)
    • +
    • sectorSuffixDdt2: Tracks suffix status and buffer offsets (high 4 bits = status, low 60 bits = offset/288)
    • +
    +
  • +
  • Prefix Buffer: Dynamically growing buffer storing non-standard 16-byte CD prefixes
  • +
  • Suffix Buffer: Dynamically growing buffer storing non-standard CD suffixes (288 bytes for Mode 1, 4 bytes for Mode 2 Form 2, 280 bytes for Mode 2 Form 1)
  • +
  • Subheader Buffer: Fixed-size buffer (8 bytes per sector) for Mode 2 subheaders
  • +
  • Subchannel Buffer: Fixed-size buffer for block media tag data
  • +
  • All buffers use doubling reallocation strategy when capacity exceeded
  • +
+

Address Space Management: The function handles three logical address regions:

    +
  • Negative Region: Pre-gap sectors (sector_address < negative region size, negative=true)
  • +
  • User Region: Main data sectors (0 ≤ sector_address < Sectors, negative=false)
  • +
  • Overflow Region: Post-data sectors (sector_address ≥ Sectors, negative=false) Internal corrected_sector_address provides linear indexing: corrected = address ± negative_size
  • +
+

Sector Status Classification: Status codes stored in high nibble of mini-DDT entries:

    +
  • SectorStatusMode1Correct: Valid Mode 1 sector with correct sync, timing, EDC, and ECC
  • +
  • SectorStatusMode2Form1Ok: Valid Mode 2 Form 1 with correct subheader, EDC, and ECC
  • +
  • SectorStatusMode2Form2Ok: Valid Mode 2 Form 2 with correct subheader and EDC
  • +
  • SectorStatusMode2Form2NoCrc: Mode 2 Form 2 with zero EDC (acceptable state)
  • +
  • SectorStatusErrored: Sector with validation errors, anomalous data stored in buffers
  • +
  • SectorStatusNotDumped: All-zero sectors treated as not dumped
  • +
+

Deduplication Integration: Long sector processing does not directly perform deduplication - this occurs in the delegated aaruf_write_sector() call for the extracted user data portion. The prefix/suffix/subheader metadata is stored separately and not subject to deduplication.

+

Hash Calculation Behavior:

    +
  • Hashes computed on complete raw sector data (all 2352 bytes for optical, full tag+data for block)
  • +
  • Only performed for sectors in user address range (not negative or overflow regions)
  • +
  • Permanently disabled upon rewind detection to prevent corrupted streaming digests
  • +
  • Supports MD5, SHA1, SHA256, SpamSum, and BLAKE3 simultaneously when enabled
  • +
+

Error Recovery and Validation:

    +
  • Sync pattern validation for optical sectors (CD standard 12-byte sync)
  • +
  • MSF timing validation (Minutes:Seconds:Frames converted to LBA must match sector_address)
  • +
  • Mode byte validation (01 for Mode 1, 02 for Mode 2)
  • +
  • EDC validation using aaruf_edc_cd_compute() for computed vs stored comparison
  • +
  • ECC validation using aaruf_ecc_cd_is_suffix_correct() and aaruf_ecc_cd_is_suffix_correct_mode2()
  • +
  • Form determination from subheader flags (bit 5 of bytes 18 and 22)
  • +
  • Tag format validation and conversion for block media
  • +
+

Thread Safety and Concurrency: This function is NOT thread-safe. The context contains mutable shared state including:

    +
  • Buffer pointers and offsets
  • +
  • Hash computation contexts
  • +
  • Rewind detection state
  • +
  • DDT modification operations External synchronization required for concurrent access.
  • +
+

Performance Considerations:

    +
  • Buffer allocation occurs lazily on first use
  • +
  • Buffer growth uses doubling strategy to amortize allocation cost
  • +
  • Validation operations are optimized for common cases (correct sectors)
  • +
  • Memory copying minimized for standard compliant sectors
  • +
  • Hash updates operate on full sector to maintain streaming performance
  • +
+
Parameters
+ + + + + + + +
contextPointer to a valid aaruformatContext with magic == AARU_MAGIC opened for writing.
sector_addressLogical Block Address (LBA) for the sector. For negative regions, this is the negative-space address; for user/overflow regions, this is the standard 0-based LBA.
negativetrue if sector_address refers to the negative (pre-gap) region; false for user or overflow regions.
dataPointer to the complete raw sector buffer. Must contain:
    +
  • For optical: exactly 2352 bytes of raw sector data
  • +
  • For block media: 512 bytes + tag data (12, 20, or 24 bytes depending on format)
  • +
+
sector_statusInitial sector status hint from caller. May be overridden based on validation results when delegating to aaruf_write_sector().
lengthLength in bytes of the data buffer. Must be exactly 2352 for optical discs. For block media: 512 (no tags), 524 (Sony), 532 (Profile), or 536 (Priam).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + + + + + +
AARUF_STATUS_OK(0) Sector successfully processed and user data written. This occurs when:
    +
  • Raw sector structure parsed and validated successfully
  • +
  • Prefix/suffix/subheader metadata stored appropriately
  • +
  • User data portion successfully delegated to aaruf_write_sector()
  • +
  • All buffer allocations and DDT updates completed successfully
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) Invalid context provided. This occurs when:
    +
  • context parameter is NULL
  • +
  • Context magic number != AARU_MAGIC (wrong context type or corruption)
  • +
+
AARUF_READ_ONLY(-22) Attempting to write to read-only image. This occurs when:
    +
  • Context isWriting flag is false
  • +
  • Image was opened without write permissions
  • +
+
AARUF_ERROR_SECTOR_OUT_OF_BOUNDS(-7) Sector address outside valid ranges. This occurs when:
    +
  • negative=true and sector_address >= negative region size
  • +
  • negative=false and sector_address >= (Sectors + overflow region size)
  • +
+
AARUF_ERROR_INCORRECT_DATA_SIZE(-8) Invalid sector size for media type. This occurs when:
    +
  • length != 2352 for optical disc media
  • +
  • length not in {512, 524, 532, 536} for supported block media types
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Failed to allocate mini-DDT arrays (sectorPrefixDdt2, sectorSuffixDdt2)
  • +
  • Failed to allocate or grow prefix buffer (sector_prefix)
  • +
  • Failed to allocate or grow suffix buffer (sector_suffix)
  • +
  • Failed to allocate subheader buffer (mode2_subheaders)
  • +
  • Failed to allocate subchannel buffer (sector_subchannel)
  • +
  • System out of memory during buffer reallocation
  • +
+
AARUF_ERROR_INCORRECT_MEDIA_TYPE(-26) Unsupported media type for long sectors. This occurs when:
    +
  • Media type is not OpticalDisc or supported BlockMedia variant
  • +
  • Block media type does not support the provided tag format
  • +
+
AARUF_ERROR_CANNOT_SET_DDT_ENTRY(-25) DDT update failed. Propagated from aaruf_write_sector() when:
    +
  • User data DDT entry could not be updated
  • +
  • DDT table corruption prevents entry modification
  • +
+
AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER(-23) Block header write failed. Propagated from aaruf_write_sector() when:
    +
  • Automatic block closure triggered by user data write fails
  • +
  • File system error prevents header write
  • +
+
AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA(-24) Block data write failed. Propagated from aaruf_write_sector() when:
    +
  • User data portion write fails during block flush
  • +
  • Insufficient disk space or I/O error occurs
  • +
+
+
+
+
Note
Cross-References: This function is the primary companion to aaruf_write_sector() for raw sector ingestion. See also: +
+
+Buffer Management: All dynamically allocated buffers (prefix, suffix, subheader, subchannel) are automatically freed during aaruf_close(). Applications should not attempt to access these buffers directly or free them manually.
+
+Metadata Persistence: Prefix, suffix, and subheader data captured by this function is serialized to the image file during aaruf_close() as separate metadata blocks with corresponding mini-DDT tables for efficient access during reading.
+
+Tag Format Conversion: For block media, automatic conversion between Sony, Profile, and Priam tag formats ensures compatibility regardless of source format. Conversion preserves all semantic information while adapting to target media type requirements.
+
Warning
Rewind Detection: Writing sectors out of strictly increasing order triggers rewind detection, permanently disabling hash calculations for the session. This prevents corrupted streaming digests but means hash values will be unavailable if non-sequential writing occurs. Plan sector writing order carefully if digest calculation is required.
+
+Memory Growth: Prefix and suffix buffers grow dynamically and can consume significant memory for images with many non-standard sectors. Monitor memory usage when processing damaged or non-compliant optical media.
+
+Media Type Constraints: This function only supports OpticalDisc and specific BlockMedia types. Other media types will return AARUF_ERROR_INCORRECT_MEDIA_TYPE. Use aaruf_write_sector() directly for unsupported media types.
+
See also
aaruf_write_sector() for user data writing and deduplication
+
+aaruf_read_sector_long() for corresponding long sector reading functionality
+
+aaruf_close() for metadata serialization and cleanup
+ +

Definition at line 532 of file write.c.

+ +

References AARU_MAGIC, aaruf_ecc_cd_is_suffix_correct(), aaruf_ecc_cd_is_suffix_correct_mode2(), aaruf_edc_cd_compute(), AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_INCORRECT_MEDIA_TYPE, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_ERROR_SECTOR_OUT_OF_BOUNDS, aaruf_md5_update(), AARUF_READ_ONLY, aaruf_sha1_update(), aaruf_sha256_update(), aaruf_spamsum_update(), aaruf_write_sector(), AppleFileWare, AppleProfile, AppleSonyDS, AppleSonySS, AppleWidget, Audio, aaruformat_context::blake3_context, BlockMedia, bytes_to_priam_tag(), bytes_to_profile_tag(), bytes_to_sony_tag(), aaruformat_context::calculating_blake3, aaruformat_context::calculating_md5, aaruformat_context::calculating_sha1, aaruformat_context::calculating_sha256, aaruformat_context::calculating_spamsum, CdMode1, CdMode2Form1, CdMode2Form2, CdMode2Formless, Data, DVDDownload, DVDPR, DVDPRDL, DVDPRW, DVDPRWDL, DVDR, DVDRAM, DVDRDL, DVDROM, DVDRW, DVDRWDL, aaruformat_context::ecc_cd_context, TrackEntry::end, TracksHeader::entries, FATAL, aaruformat_context::image_info, aaruformat_context::is_writing, aaruformat_context::last_written_block, aaruformat_context::magic, aaruformat_context::md5_context, ImageInfo::MediaType, ImageInfo::MetadataMediaType, aaruformat_context::mode2_subheaders, DdtHeader2::negative, Nuon, OpticalDisc, DdtHeader2::overflow, priam_tag_to_bytes(), priam_tag_to_profile(), priam_tag_to_sony(), PriamDataTower, profile_tag_to_bytes(), profile_tag_to_priam(), profile_tag_to_sony(), PS2DVD, PS3DVD, aaruformat_context::rewinded, SACD, aaruformat_context::sector_cpr_mai, aaruformat_context::sector_edc, aaruformat_context::sector_id, aaruformat_context::sector_ied, aaruformat_context::sector_prefix, aaruformat_context::sector_prefix_ddt2, aaruformat_context::sector_prefix_length, aaruformat_context::sector_prefix_offset, aaruformat_context::sector_subchannel, aaruformat_context::sector_suffix, aaruformat_context::sector_suffix_ddt2, aaruformat_context::sector_suffix_length, aaruformat_context::sector_suffix_offset, ImageInfo::Sectors, SectorStatusErrored, SectorStatusMode1Correct, SectorStatusMode2Form1Ok, SectorStatusMode2Form2NoCrc, SectorStatusMode2Form2Ok, SectorStatusNotDumped, TrackEntry::sequence, aaruformat_context::sha1_context, aaruformat_context::sha256_context, sony_tag_to_bytes(), sony_tag_to_priam(), sony_tag_to_profile(), aaruformat_context::spamsum_context, TrackEntry::start, TRACE, aaruformat_context::track_entries, aaruformat_context::tracks_header, TrackEntry::type, aaruformat_context::user_data_ddt_header, and aaruformat_context::writing_long.

+ +
+
+ +

◆ aaruf_write_sector_tag()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_write_sector_tag (void * context,
const uint64_t sector_address,
const bool negative,
const uint8_t * data,
const size_t length,
const int32_t tag )
+
+ +

Writes per-sector tag data (auxiliary metadata) for a specific sector.

+

This function stores auxiliary metadata associated with individual sectors, such as CD subchannel data, DVD auxiliary fields, track metadata, or proprietary tag formats used by specific storage systems. Unlike media tags (which apply to the entire medium), sector tags are per-sector metadata that provide additional context, error correction, copy protection, or device-specific information for each individual sector.

+

The function validates the tag type against the media type, verifies the data size matches the expected length for that tag type, allocates buffers as needed, and stores the tag data at the appropriate offset within the tag buffer. Some tags (like track flags and ISRC) update track metadata rather than per-sector buffers.

+

Supported tag types and their characteristics:

+

Optical Disc (CD/DVD) Tags:

    +
  • CdTrackFlags (1 byte): Track control flags for CD tracks
      +
    • Updates track metadata in ctx->trackEntries for the track containing the sector
    • +
    • Includes flags like copy permitted, data track, four-channel audio, etc.
    • +
    +
  • +
  • CdTrackIsrc (12 bytes): International Standard Recording Code for CD tracks
      +
    • Updates track metadata in ctx->trackEntries for the track containing the sector
    • +
    • Identifies the recording for copyright and royalty purposes
    • +
    +
  • +
  • CdSectorSubchannel (96 bytes): CD subchannel data (P-W subchannels)
      +
    • Stored in ctx->sector_subchannel buffer
    • +
    • Contains control information, track numbers, timecodes, and CD-TEXT data
    • +
    +
  • +
  • DvdSectorCprMai (6 bytes): DVD Copyright Management Information
      +
    • Stored in ctx->sector_cpr_mai buffer
    • +
    • Contains copy protection and media authentication information
    • +
    +
  • +
  • DvdSectorInformation (1 byte): DVD sector information field
      +
    • Stored in first byte of ctx->sector_id buffer (4 bytes per sector)
    • +
    • Contains sector type and layer information
    • +
    +
  • +
  • DvdSectorNumber (3 bytes): DVD sector number field
      +
    • Stored in bytes 1-3 of ctx->sector_id buffer (4 bytes per sector)
    • +
    • Physical sector address encoded in the sector header
    • +
    +
  • +
  • DvdSectorIed (2 bytes): DVD ID Error Detection field
      +
    • Stored in ctx->sector_ied buffer
    • +
    • Error detection code for the sector ID field
    • +
    +
  • +
  • DvdSectorEdc (4 bytes): DVD Error Detection Code
      +
    • Stored in ctx->sector_edc buffer
    • +
    • Error detection code for the entire sector
    • +
    +
  • +
  • DvdDiscKeyDecrypted (5 bytes): Decrypted DVD title key
      +
    • Stored in ctx->sector_decrypted_title_key buffer
    • +
    • Used for accessing encrypted DVD content
    • +
    +
  • +
+

Block Media (Proprietary Format) Tags:

    +
  • AppleSonyTag (12 bytes): Apple II Sony 3.5" disk tag data
      +
    • Stored in ctx->sector_subchannel buffer
    • +
    • Contains file system metadata used by Apple II systems
    • +
    +
  • +
  • AppleProfileTag (20 bytes): Apple ProFile/FileWare hard drive tag data
      +
    • Stored in ctx->sector_subchannel buffer
    • +
    • Contains file system and bad block metadata
    • +
    +
  • +
  • PriamDataTowerTag (24 bytes): Priam Data Tower hard drive tag data
      +
    • Stored in ctx->sector_subchannel buffer
    • +
    • Contains proprietary metadata used by Priam drives
    • +
    +
  • +
+

Sector addressing: The function supports both positive and negative sector addressing:

    +
  • Negative sectors: Lead-in area before sector 0 (for optical media)
  • +
  • Positive sectors: Main data area and lead-out overflow area
  • +
  • Internal correction adjusts addresses to buffer offsets
  • +
+

Buffer allocation: Tag buffers are allocated on-demand when the first tag of a given type is written. Buffers are sized to accommodate all sectors (negative + normal + overflow) and persist for the lifetime of the context. Memory is freed during aaruf_close().

+
Parameters
+ + + + + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
sector_addressThe logical sector number to write the tag for. Must be within valid bounds for the image (0 to Sectors-1 for positive, 0 to negative-1 when using negative addressing).
negativeIf true, sector_address refers to a negative (lead-in) sector; if false, it refers to a positive sector (main data or overflow area).
dataPointer to the tag data to write. Must not be NULL. The data size must exactly match the expected size for the tag type.
lengthLength of the tag data in bytes. Must match the required size for the tag type.
tagTag type identifier (from the tag enumeration). Determines which buffer to write to and the expected data size.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + + + + +
AARUF_STATUS_OK(0) Successfully wrote sector tag. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • The sector address is within valid bounds
  • +
  • The tag type is supported and appropriate for the media type
  • +
  • The data length matches the required size for the tag type
  • +
  • Memory allocation succeeded (if buffer needed to be created)
  • +
  • Tag data was copied to the appropriate buffer or track metadata updated
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_SECTOR_OUT_OF_BOUNDS(-4) Sector address is invalid. This occurs when:
    +
  • negative is true and sector_address > negative-1
  • +
  • negative is false and sector_address > Sectors+overflow-1
  • +
  • Attempting to write beyond the image boundaries
  • +
+
AARUF_ERROR_INCORRECT_DATA_SIZE(-11) Invalid data or length. This occurs when:
    +
  • The data parameter is NULL
  • +
  • The length parameter is 0
  • +
  • The length doesn't match the required size for the tag type
  • +
  • Tag size validation failed
  • +
+
AARUF_ERROR_INCORRECT_MEDIA_TYPE(-26) Invalid media type for tag. This occurs when:
    +
  • Attempting to write optical disc tags (CD/DVD) to block media
  • +
  • Attempting to write block media tags to optical disc
  • +
  • Tag type is incompatible with ctx->imageInfo.XmlMediaType
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • calloc() failed to allocate buffer for tag data
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • Buffer allocation is required but cannot be satisfied
  • +
+
AARUF_ERROR_TRACK_NOT_FOUND(-25) Track not found for sector. This occurs when:
    +
  • Writing CdTrackFlags or CdTrackIsrc tags
  • +
  • The specified sector is not contained within any defined track
  • +
  • Track metadata has not been initialized
  • +
+
AARUF_ERROR_INVALID_TAG(-27) Unsupported or unknown tag type. This occurs when:
    +
  • The tag parameter doesn't match any known tag type
  • +
  • The tag type is not implemented
  • +
  • Invalid tag identifier provided
  • +
+
+
+
+
Note
Tag Data Persistence:
    +
  • Tag data is stored in memory until aaruf_close() is called
  • +
  • Tags are written as separate data blocks during image finalization
  • +
  • CD subchannel and DVD auxiliary fields are written by dedicated block writers
  • +
  • Track metadata (flags, ISRC) is written as part of the tracks block
  • +
+
+
+Buffer Reuse:
    +
  • Some tag types share the same buffer (ctx->sector_subchannel)
  • +
  • CD subchannel uses 96 bytes per sector
  • +
  • Apple Sony tag uses 12 bytes per sector
  • +
  • Apple Profile tag uses 20 bytes per sector
  • +
  • Priam Data Tower tag uses 24 bytes per sector
  • +
  • Ensure consistent tag type usage within a single image
  • +
+
+
+DVD Sector ID Split:
    +
  • DVD sector ID is 4 bytes but written as two separate tags
  • +
  • DvdSectorInformation writes byte 0 (sector info)
  • +
  • DvdSectorNumber writes bytes 1-3 (sector number)
  • +
  • Both tags share ctx->sector_id buffer
  • +
+
+
+Tag Size Validation:
    +
  • Each tag type has a fixed expected size
  • +
  • Size mismatches are rejected with AARUF_ERROR_INCORRECT_DATA_SIZE
  • +
  • This prevents partial writes and buffer corruption
  • +
+
+
+Media Type Validation:
    +
  • Optical disc tags require XmlMediaType == OpticalDisc
  • +
  • Block media tags require XmlMediaType == BlockMedia
  • +
  • This prevents incompatible tag types from being written
  • +
+
+
+Multiple Writes to Same Sector:
    +
  • Writing the same tag type to the same sector multiple times replaces the previous value
  • +
  • No warning or error is generated for overwrites
  • +
  • Last write wins
  • +
+
+
Warning
Tag data is not immediately written to disk. All tag data is buffered in memory and written during aaruf_close(). Ensure sufficient memory is available for large images with extensive tag data.
+
+Mixing incompatible tag types that share buffers (e.g., CD subchannel and Apple tags) will cause data corruption. Only use tag types appropriate for your media format.
+
+For track-based tags (CdTrackFlags, CdTrackIsrc), tracks must be defined before writing tags. Call aaruf_set_tracks() to initialize track metadata first.
+
See also
aaruf_write_media_tag() for writing whole-medium tags.
+
+aaruf_write_sector_long() for writing sectors with embedded tag data.
+
+write_sector_subchannel() for the serialization of CD subchannel data.
+
+write_dvd_long_sector_blocks() for the serialization of DVD auxiliary data.
+ +

Definition at line 2048 of file write.c.

+ +

References AARU_MAGIC, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_INCORRECT_MEDIA_TYPE, AARUF_ERROR_INVALID_TAG, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_ERROR_SECTOR_OUT_OF_BOUNDS, AARUF_ERROR_TRACK_NOT_FOUND, AARUF_READ_ONLY, AARUF_STATUS_OK, AppleProfileTag, AppleSonyTag, BlockMedia, CdSectorSubchannel, CdTrackFlags, CdTrackIsrc, DvdCmi, DvdSectorEdc, DvdSectorIed, DvdSectorInformation, DvdSectorNumber, DvdTitleKeyDecrypted, TracksHeader::entries, FATAL, TrackEntry::flags, aaruformat_context::image_info, aaruformat_context::is_writing, TrackEntry::isrc, aaruformat_context::magic, ImageInfo::MetadataMediaType, DdtHeader2::negative, OpticalDisc, DdtHeader2::overflow, PriamDataTowerTag, aaruformat_context::sector_cpr_mai, aaruformat_context::sector_decrypted_title_key, aaruformat_context::sector_edc, aaruformat_context::sector_id, aaruformat_context::sector_ied, aaruformat_context::sector_subchannel, ImageInfo::Sectors, TrackEntry::start, TRACE, aaruformat_context::track_entries, aaruformat_context::tracks_header, and aaruformat_context::user_data_ddt_header.

+ +
+
+ +

◆ fuzzy_engine_step()

+ + + +

◆ fuzzy_try_fork_blockhash()

+ +
+
+ + + + + +
+ + + + + + + +
void fuzzy_try_fork_blockhash (spamsum_ctx * ctx)
+
+inline
+
+
+ +

◆ fuzzy_try_reduce_blockhash()

+ +
+
+ + + + + +
+ + + + + + + +
void fuzzy_try_reduce_blockhash (spamsum_ctx * ctx)
+
+inline
+
+
+ +

◆ roll_hash()

+ +
+
+ + + + + +
+ + + + + + + + + + + +
void roll_hash (spamsum_ctx * ctx,
uint8_t c )
+
+inline
+
+
+
+
+ +
+ + + + diff --git a/docs/html/decls_8h.js b/docs/html/decls_8h.js new file mode 100644 index 0000000..dd36186 --- /dev/null +++ b/docs/html/decls_8h.js @@ -0,0 +1,111 @@ +var decls_8h = +[ + [ "AARU_CALL", "decls_8h.html#a018e0da1c1f7e4f6187a982c0e40e056", null ], + [ "AARU_EXPORT", "decls_8h.html#a9001412c35f3c92d3a9320d27b0d97f9", null ], + [ "AARU_LOCAL", "decls_8h.html#a8a7eac34f7a0caaa0d4a57e9627ba173", null ], + [ "EXTERNC", "decls_8h.html#a95e1d92b2619a326b2e86600f3d23100", null ], + [ "FORCE_INLINE", "decls_8h.html#ac032d233a8ebfcd82fd49d0824eefb18", null ], + [ "aaruf_cd_lba_to_msf", "decls_8h.html#a033bfc0dd219563f45b7e5c85dd5d3fa", null ], + [ "aaruf_close", "decls_8h.html#a6823e139f81a9dfd08efcb0e9b213a49", null ], + [ "aaruf_crc64_data", "decls_8h.html#a0fee4834bf0747bcd933c4e754aa4692", null ], + [ "aaruf_crc64_final", "decls_8h.html#ae48cfb59c6585e9ffd4cd1a97044891f", null ], + [ "aaruf_crc64_free", "decls_8h.html#a4943569a8623eb2e3e0adc276c433097", null ], + [ "aaruf_crc64_init", "decls_8h.html#a66567ca64e31a687d4982cb254b45196", null ], + [ "aaruf_crc64_slicing", "decls_8h.html#a83ecd1f5636915aebacfd29fc6306520", null ], + [ "aaruf_crc64_update", "decls_8h.html#a1fb4423a841ccd728e3ad0d028cbc9b4", null ], + [ "aaruf_create", "decls_8h.html#a7065a9fefcaabfecc4184528f01ef013", null ], + [ "aaruf_cst_transform", "decls_8h.html#a0b29337ce6fedc79bf7d1a84d92173d6", null ], + [ "aaruf_cst_untransform", "decls_8h.html#adee4702d830dc13b78e0a6803658c40e", null ], + [ "aaruf_ecc_cd_check", "decls_8h.html#a562bb88bbf499eac272182acb5528dea", null ], + [ "aaruf_ecc_cd_init", "decls_8h.html#ac1a30bb251ac148f485c51593c0740c1", null ], + [ "aaruf_ecc_cd_is_suffix_correct", "decls_8h.html#afbc09e16b1a654de04706e07c3212ecb", null ], + [ "aaruf_ecc_cd_is_suffix_correct_mode2", "decls_8h.html#ab77ca170a2e8d2f0a2a7ea1a8a51690a", null ], + [ "aaruf_ecc_cd_reconstruct", "decls_8h.html#a9c9e2440119b8d7e67cb2c40125bf295", null ], + [ "aaruf_ecc_cd_reconstruct_prefix", "decls_8h.html#a73c3788f7376196abd596d6d846466b1", null ], + [ "aaruf_ecc_cd_write", "decls_8h.html#a892f09f0b28f1183064eef6eb4d46f42", null ], + [ "aaruf_ecc_cd_write_sector", "decls_8h.html#a322819729519cc5e0fcd625510158e18", null ], + [ "aaruf_edc_cd_compute", "decls_8h.html#a67c65c3f2ca5cdf1596c16fa35558df1", null ], + [ "aaruf_flac_decode_redbook_buffer", "decls_8h.html#af0ff6ad1495d50a8fa0ce0005be69471", null ], + [ "aaruf_flac_encode_redbook_buffer", "decls_8h.html#a102023fe64e4bd24cd6d4124f0d74e54", null ], + [ "aaruf_get_aaru_json_metadata", "decls_8h.html#a01cf0abe0b137236d4be0b91a29d4818", null ], + [ "aaruf_get_cicm_metadata", "decls_8h.html#a42f191c2ea4c70c9d7b373c19b59c812", null ], + [ "aaruf_get_comments", "decls_8h.html#a9628bcfd2642649a6bcbf1f46d6b6705", null ], + [ "aaruf_get_creator", "decls_8h.html#a38d72be7e7854d6cb0bba89172e27b03", null ], + [ "aaruf_get_datatype_for_media_tag_type", "decls_8h.html#a8d042b26980b56b5dd872f21fa33de70", null ], + [ "aaruf_get_drive_firmware_revision", "decls_8h.html#a3db92f6bebf60195d6ab327e17988cee", null ], + [ "aaruf_get_drive_manufacturer", "decls_8h.html#a5d487a858c48838bcc9f3bba4b5944a1", null ], + [ "aaruf_get_drive_model", "decls_8h.html#a54d724659818ea4486f9981672f6d01e", null ], + [ "aaruf_get_drive_serial_number", "decls_8h.html#a1892cc8395305d7e85d04544ded62131", null ], + [ "aaruf_get_dumphw", "decls_8h.html#a36af83897e131ba792c51ae8caec9984", null ], + [ "aaruf_get_geometry", "decls_8h.html#abbcf276c3518b3e666885ab250fd374e", null ], + [ "aaruf_get_image_info", "decls_8h.html#a65c73217edb9661accbbe3de4f555b62", null ], + [ "aaruf_get_media_barcode", "decls_8h.html#a580c8bf133cf3481deca14779b8b5419", null ], + [ "aaruf_get_media_manufacturer", "decls_8h.html#a515c264f726f8b0a5104778b383ad1d4", null ], + [ "aaruf_get_media_model", "decls_8h.html#a509892f76c9a03a030693740d043adfc", null ], + [ "aaruf_get_media_part_number", "decls_8h.html#a4cdfb46f5630fcf1fe6447b37ad18ae2", null ], + [ "aaruf_get_media_sequence", "decls_8h.html#aa683ff7387ba3f505b1756da1b408f7e", null ], + [ "aaruf_get_media_serial_number", "decls_8h.html#a4cb7b7200e36efb4983cf2c5c5543313", null ], + [ "aaruf_get_media_tag_type_for_datatype", "decls_8h.html#a554f1cbd4c013c46788b2276c3244c32", null ], + [ "aaruf_get_media_title", "decls_8h.html#af1ca27c052c6cde38a8d6d71e10936db", null ], + [ "aaruf_get_negative_sectors", "decls_8h.html#a8e00d26a8e751fbd412868ac4f92a3c0", null ], + [ "aaruf_get_overflow_sectors", "decls_8h.html#aeeae64b120a10bac5e3d757a07a9691a", null ], + [ "aaruf_get_tape_file", "decls_8h.html#a1c8d4faf14212a4c46c1fb47bf25ac1e", null ], + [ "aaruf_get_tape_partition", "decls_8h.html#ab1ca1a092699df0f43ea050812f6c6b1", null ], + [ "aaruf_get_tracks", "decls_8h.html#a2ce65757ca5209f17d467c51ba7d445d", null ], + [ "aaruf_get_user_sectors", "decls_8h.html#a7e63f10ff3ea353c8c3944cd836a85ee", null ], + [ "aaruf_get_xml_mediatype", "decls_8h.html#ac5f5334a51424028574a5433a0e24b20", null ], + [ "aaruf_identify", "decls_8h.html#a74c444fbd394f58aefd2fabff221231b", null ], + [ "aaruf_identify_stream", "decls_8h.html#a6f30353aff3ece1e889542c26f7146e2", null ], + [ "aaruf_lzma_decode_buffer", "decls_8h.html#a12f3cbc43c2f57a11fbba32a71ba2704", null ], + [ "aaruf_lzma_encode_buffer", "decls_8h.html#a0e69fad529047d6fe9440b1fc66c3f85", null ], + [ "aaruf_md5_buffer", "decls_8h.html#abe1156eceb456b48e92389d9f2a20601", null ], + [ "aaruf_md5_final", "decls_8h.html#a6b98055d07ba51f0daef5b03ce2fe725", null ], + [ "aaruf_md5_init", "decls_8h.html#a1e614476485ba9f46e3ac79858210f63", null ], + [ "aaruf_md5_update", "decls_8h.html#a6e19e853bea5db901de83fa2fa29055c", null ], + [ "aaruf_open", "decls_8h.html#afc4932cdc795ffb2ef3a33d5b8c57656", null ], + [ "aaruf_read_media_tag", "decls_8h.html#a48f93ec154d0aed7cb713391a7717b46", null ], + [ "aaruf_read_sector", "decls_8h.html#a53397980f6b05e3ad0145f2941de16d2", null ], + [ "aaruf_read_sector_long", "decls_8h.html#a719a992be38ee90a5e302725c18a791b", null ], + [ "aaruf_read_sector_tag", "decls_8h.html#ae5a85524a6e27339c02c4a5791e0db57", null ], + [ "aaruf_read_track_sector", "decls_8h.html#a33f54ac12ab867e9a9b2347c239e6c6e", null ], + [ "aaruf_set_aaru_json_metadata", "decls_8h.html#a8090a039e00ee003569939332d21094e", null ], + [ "aaruf_set_comments", "decls_8h.html#af7fcca1ab5ff0422ec81ec6e99001b38", null ], + [ "aaruf_set_creator", "decls_8h.html#a1da2dd0571762fa7c13bc956ec12dfab", null ], + [ "aaruf_set_drive_firmware_revision", "decls_8h.html#add7cede9e5544ae12ae2b22eaf48e54c", null ], + [ "aaruf_set_drive_manufacturer", "decls_8h.html#a3acb21067897f9cfc40e6288050a60c1", null ], + [ "aaruf_set_drive_model", "decls_8h.html#a1b4d35ee16a27a13f1bc16b0a17d65d1", null ], + [ "aaruf_set_drive_serial_number", "decls_8h.html#aef269305958754978beedf4c44618d98", null ], + [ "aaruf_set_dumphw", "decls_8h.html#ad98012dc12a51d9eadbd79a25aab8299", null ], + [ "aaruf_set_geometry", "decls_8h.html#a21f4b3cf398b1a1c008c9a070ef9277b", null ], + [ "aaruf_set_media_barcode", "decls_8h.html#a4499e33d2fd3f8b514e510180972ec6f", null ], + [ "aaruf_set_media_manufacturer", "decls_8h.html#a3d46262ff1f9d51d57d1e95648f4083b", null ], + [ "aaruf_set_media_model", "decls_8h.html#a8eed9fbf0341f48bac755524f4c99ef2", null ], + [ "aaruf_set_media_part_number", "decls_8h.html#a05157a196fb583605599414d7ab06f53", null ], + [ "aaruf_set_media_sequence", "decls_8h.html#a00537ecc9cb55b4ce3c92d61a8cea094", null ], + [ "aaruf_set_media_serial_number", "decls_8h.html#a2dff9d23775ba429c38efd251844092d", null ], + [ "aaruf_set_media_title", "decls_8h.html#a37f50b38ceaee7db0b7731ee978b8241", null ], + [ "aaruf_set_tape_file", "decls_8h.html#a01c915ab49a4b47fd6768a2055208c48", null ], + [ "aaruf_set_tape_partition", "decls_8h.html#a9daeeb54c74dd2707d95ab47e8ab0a00", null ], + [ "aaruf_set_tracks", "decls_8h.html#a518d8d68debf1b9a24af3eb6bc2f9e49", null ], + [ "aaruf_sha1_buffer", "decls_8h.html#a1e8667b4e2bc168a5411d9671a44a73c", null ], + [ "aaruf_sha1_final", "decls_8h.html#a0396232d1020b16b2cb4bf0b1aa2b021", null ], + [ "aaruf_sha1_init", "decls_8h.html#a9bcd5c47b9b593c95be9d4f82253739a", null ], + [ "aaruf_sha1_update", "decls_8h.html#abead53c8e55f1f99900fdae16d9da70f", null ], + [ "aaruf_sha256_buffer", "decls_8h.html#a7bae173c313a0752035e6eac045326e8", null ], + [ "aaruf_sha256_final", "decls_8h.html#a6456150dad701ca7f071940ef169c4cf", null ], + [ "aaruf_sha256_init", "decls_8h.html#a075527f7b15b70dc7028cf91d9062a90", null ], + [ "aaruf_sha256_update", "decls_8h.html#ab5f178e5ec94596e44a3fdb001d4a5f8", null ], + [ "aaruf_spamsum_final", "decls_8h.html#ab1f4894af1962e933767248c4fb0e2e8", null ], + [ "aaruf_spamsum_free", "decls_8h.html#a6fe74704e44be7adfaa2ce676f3c3de4", null ], + [ "aaruf_spamsum_init", "decls_8h.html#a793dac760aedda6414ba4014eb2ed0c7", null ], + [ "aaruf_spamsum_update", "decls_8h.html#a5a9767f3b860752b493aa7bee9d39a8d", null ], + [ "aaruf_verify_image", "decls_8h.html#a8cbf4d8059c4b36e8ab5e18fec057b52", null ], + [ "aaruf_write_media_tag", "decls_8h.html#aa041a789fbae70c1e1ec3e38f1ab369d", null ], + [ "aaruf_write_sector", "decls_8h.html#a4b8cd2bb5fd9e2c670a0a13695c6f9e3", null ], + [ "aaruf_write_sector_long", "decls_8h.html#a69ca66242c0becf7640b3d1cc8da8f9c", null ], + [ "aaruf_write_sector_tag", "decls_8h.html#a6a8994cd006711347fb03cec465eafa6", null ], + [ "fuzzy_engine_step", "decls_8h.html#a680150d4b3df13261af758c504a1f848", null ], + [ "fuzzy_try_fork_blockhash", "decls_8h.html#a24c6d35239a8d1fee6e93aa12bbd5bd6", null ], + [ "fuzzy_try_reduce_blockhash", "decls_8h.html#a906ad6bd1809bf999874c848af7c648b", null ], + [ "roll_hash", "decls_8h.html#a9f287da4a58c0d3ab8f0243de5fe3f8d", null ] +]; \ No newline at end of file diff --git a/docs/html/decls_8h_source.html b/docs/html/decls_8h_source.html new file mode 100644 index 0000000..3c7b6c1 --- /dev/null +++ b/docs/html/decls_8h_source.html @@ -0,0 +1,486 @@ + + + + + + + +libaaruformat: include/aaruformat/decls.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
decls.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_DECLS_H
+
20#define LIBAARUFORMAT_DECLS_H
+
21
+
22#include "aaru.h"
+
23#include "crc64.h"
+
24#include "md5.h"
+
25#include "sha1.h"
+
26#include "sha256.h"
+
27#include "simd.h"
+
28#include "spamsum.h"
+
29#include "structs/optical.h"
+
30
+
31#ifdef __cplusplus
+
32#define EXTERNC extern "C"
+
33#else
+
34#define EXTERNC
+
35#endif
+
36
+
37#if defined(_WIN32)
+
38#define AARU_CALL __stdcall
+
39#define AARU_EXPORT EXTERNC __declspec(dllexport)
+
40#define AARU_LOCAL
+
41#ifndef PATH_MAX
+
42#define PATH_MAX _MAX_PATH
+
43#endif
+
44#else
+
45#define AARU_CALL
+
46#if defined(__APPLE__)
+
47#define AARU_EXPORT EXTERNC __attribute__((visibility("default")))
+
48#define AARU_LOCAL __attribute__((visibility("hidden")))
+
49#else
+
50#if __GNUC__ >= 4
+
51#define AARU_EXPORT EXTERNC __attribute__((visibility("default")))
+
52#define AARU_LOCAL __attribute__((visibility("hidden")))
+
53#else
+
54#define AARU_EXPORT EXTERNC
+
55#define AARU_LOCAL
+
56#endif
+
57#endif
+
58#endif
+
59
+
60#ifdef _MSC_VER
+
61#define FORCE_INLINE static inline
+
62#else
+
63#define FORCE_INLINE static inline __attribute__((always_inline))
+
64#endif
+
65
+
66AARU_EXPORT int AARU_CALL aaruf_identify(const char *filename);
+
67
+
68AARU_EXPORT int AARU_CALL aaruf_identify_stream(FILE *image_stream);
+
69
+
70AARU_EXPORT void *AARU_CALL aaruf_open(const char *filepath);
+
71
+
72AARU_EXPORT void *AARU_CALL aaruf_create(const char *filepath, uint32_t media_type, uint32_t sector_size,
+
73 uint64_t user_sectors, uint64_t negative_sectors, uint64_t overflow_sectors,
+
74 const char *options, const uint8_t *application_name,
+
75 uint8_t application_name_length, uint8_t application_major_version,
+
76 uint8_t application_minor_version, bool is_tape);
+
77
+
78AARU_EXPORT int AARU_CALL aaruf_close(void *context);
+
79
+
80AARU_EXPORT int32_t AARU_CALL aaruf_read_media_tag(void *context, uint8_t *data, int32_t tag, uint32_t *length);
+
81
+ +
83AARU_EXPORT int AARU_CALL aaruf_crc64_update(crc64_ctx *ctx, const uint8_t *data, uint32_t len);
+
84AARU_EXPORT int AARU_CALL aaruf_crc64_final(crc64_ctx *ctx, uint64_t *crc);
+ +
86AARU_EXPORT void AARU_CALL aaruf_crc64_slicing(uint64_t *previous_crc, const uint8_t *data, uint32_t len);
+
87AARU_EXPORT uint64_t AARU_CALL aaruf_crc64_data(const uint8_t *data, uint32_t len);
+
88
+
89AARU_EXPORT int32_t AARU_CALL aaruf_get_tracks(const void *context, uint8_t *buffer, size_t *length);
+
90AARU_EXPORT int32_t AARU_CALL aaruf_set_tracks(void *context, TrackEntry *tracks, const int count);
+
91
+
92AARU_EXPORT int32_t AARU_CALL aaruf_read_sector(void *context, uint64_t sector_address, bool negative, uint8_t *data,
+
93 uint32_t *length);
+
94AARU_EXPORT int32_t AARU_CALL aaruf_read_sector_long(void *context, uint64_t sector_address, bool negative,
+
95 uint8_t *data, uint32_t *length);
+
96
+
97AARU_EXPORT int32_t AARU_CALL aaruf_write_sector(void *context, uint64_t sector_address, bool negative,
+
98 const uint8_t *data, uint8_t sector_status, uint32_t length);
+
99AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_long(void *context, uint64_t sector_address, bool negative,
+
100 const uint8_t *data, uint8_t sector_status, uint32_t length);
+
101AARU_EXPORT int32_t AARU_CALL aaruf_write_media_tag(void *context, const uint8_t *data, int32_t type, uint32_t length);
+
102AARU_EXPORT int32_t AARU_CALL aaruf_write_sector_tag(void *context, uint64_t sector_address, bool negative,
+
103 const uint8_t *data, size_t length, int32_t tag);
+
104
+
105AARU_EXPORT int32_t AARU_CALL aaruf_verify_image(void *context);
+
106
+
107AARU_EXPORT int32_t AARU_CALL aaruf_cst_transform(const uint8_t *interleaved, uint8_t *sequential, size_t length);
+
108
+
109AARU_EXPORT int32_t AARU_CALL aaruf_cst_untransform(const uint8_t *sequential, uint8_t *interleaved, size_t length);
+
110
+ +
112
+
113AARU_EXPORT bool AARU_CALL aaruf_ecc_cd_is_suffix_correct(void *context, const uint8_t *sector);
+
114
+
115AARU_EXPORT bool AARU_CALL aaruf_ecc_cd_is_suffix_correct_mode2(void *context, const uint8_t *sector);
+
116
+
117AARU_EXPORT bool AARU_CALL aaruf_ecc_cd_check(void *context, const uint8_t *address, const uint8_t *data,
+
118 uint32_t major_count, uint32_t minor_count, uint32_t major_mult,
+
119 uint32_t minor_inc, const uint8_t *ecc, int32_t address_offset,
+
120 int32_t data_offset, int32_t ecc_offset);
+
121
+
122AARU_EXPORT void AARU_CALL aaruf_ecc_cd_write(void *context, const uint8_t *address, const uint8_t *data,
+
123 uint32_t major_count, uint32_t minor_count, uint32_t major_mult,
+
124 uint32_t minor_inc, uint8_t *ecc, int32_t address_offset,
+
125 int32_t data_offset, int32_t ecc_offset);
+
126
+
127AARU_EXPORT void AARU_CALL aaruf_ecc_cd_write_sector(void *context, const uint8_t *address, const uint8_t *data,
+
128 uint8_t *ecc, int32_t address_offset, int32_t data_offset,
+
129 int32_t ecc_offset);
+
130
+
131AARU_LOCAL void AARU_CALL aaruf_cd_lba_to_msf(int64_t pos, uint8_t *minute, uint8_t *second, uint8_t *frame);
+
132
+
133AARU_EXPORT void AARU_CALL aaruf_ecc_cd_reconstruct_prefix(uint8_t *sector, uint8_t type, int64_t lba);
+
134
+
135AARU_EXPORT void AARU_CALL aaruf_ecc_cd_reconstruct(void *context, uint8_t *sector, uint8_t type);
+
136
+
137AARU_EXPORT uint32_t AARU_CALL aaruf_edc_cd_compute(void *context, uint32_t edc, const uint8_t *src, int size, int pos);
+
138
+
139AARU_EXPORT int32_t AARU_CALL aaruf_read_track_sector(void *context, uint8_t *data, uint64_t sector_address,
+
140 uint32_t *length, uint8_t track);
+
141int32_t aaruf_read_sector_tag(const void *context, uint64_t sector_address, bool negative, uint8_t *buffer,
+
142 uint32_t *length, int32_t tag);
+
143
+ + +
146AARU_LOCAL int32_t AARU_CALL aaruf_get_xml_mediatype(int32_t type);
+
147
+
148AARU_EXPORT int32_t AARU_CALL aaruf_get_geometry(const void *context, uint32_t *cylinders, uint32_t *heads,
+
149 uint32_t *sectors_per_track);
+
150AARU_EXPORT int32_t AARU_CALL aaruf_set_geometry(void *context, uint32_t cylinders, uint32_t heads,
+
151 uint32_t sectors_per_track);
+
152AARU_EXPORT int32_t AARU_CALL aaruf_set_media_sequence(void *context, int32_t sequence, int32_t last_sequence);
+
153AARU_EXPORT int32_t AARU_CALL aaruf_set_creator(void *context, const uint8_t *data, int32_t length);
+
154AARU_EXPORT int32_t AARU_CALL aaruf_set_comments(void *context, const uint8_t *data, int32_t length);
+
155AARU_EXPORT int32_t AARU_CALL aaruf_set_media_title(void *context, const uint8_t *data, int32_t length);
+
156AARU_EXPORT int32_t AARU_CALL aaruf_set_media_manufacturer(void *context, const uint8_t *data, int32_t length);
+
157AARU_EXPORT int32_t AARU_CALL aaruf_set_media_model(void *context, const uint8_t *data, int32_t length);
+
158AARU_EXPORT int32_t AARU_CALL aaruf_set_media_serial_number(void *context, const uint8_t *data, int32_t length);
+
159AARU_EXPORT int32_t AARU_CALL aaruf_set_media_barcode(void *context, const uint8_t *data, int32_t length);
+
160AARU_EXPORT int32_t AARU_CALL aaruf_set_media_part_number(void *context, const uint8_t *data, int32_t length);
+
161AARU_EXPORT int32_t AARU_CALL aaruf_set_drive_manufacturer(void *context, const uint8_t *data, int32_t length);
+
162AARU_EXPORT int32_t AARU_CALL aaruf_set_drive_model(void *context, const uint8_t *data, int32_t length);
+
163AARU_EXPORT int32_t AARU_CALL aaruf_set_drive_serial_number(void *context, const uint8_t *data, int32_t length);
+
164AARU_EXPORT int32_t AARU_CALL aaruf_set_drive_firmware_revision(void *context, const uint8_t *data, int32_t length);
+
165AARU_EXPORT int32_t AARU_CALL aaruf_get_media_sequence(const void *context, int32_t *sequence, int32_t *last_sequence);
+
166AARU_EXPORT int32_t AARU_CALL aaruf_get_creator(const void *context, uint8_t *buffer, int32_t *length);
+
167AARU_EXPORT int32_t AARU_CALL aaruf_get_comments(const void *context, uint8_t *buffer, int32_t *length);
+
168AARU_EXPORT int32_t AARU_CALL aaruf_get_media_title(const void *context, uint8_t *buffer, int32_t *length);
+
169AARU_EXPORT int32_t AARU_CALL aaruf_get_media_manufacturer(const void *context, uint8_t *buffer, int32_t *length);
+
170AARU_EXPORT int32_t AARU_CALL aaruf_get_media_model(const void *context, uint8_t *buffer, int32_t *length);
+
171AARU_EXPORT int32_t AARU_CALL aaruf_get_media_serial_number(const void *context, uint8_t *buffer, int32_t *length);
+
172AARU_EXPORT int32_t AARU_CALL aaruf_get_media_barcode(const void *context, uint8_t *buffer, int32_t *length);
+
173AARU_EXPORT int32_t AARU_CALL aaruf_get_media_part_number(const void *context, uint8_t *buffer, int32_t *length);
+
174AARU_EXPORT int32_t AARU_CALL aaruf_get_drive_manufacturer(const void *context, uint8_t *buffer, int32_t *length);
+
175AARU_EXPORT int32_t AARU_CALL aaruf_get_drive_model(const void *context, uint8_t *buffer, int32_t *length);
+
176AARU_EXPORT int32_t AARU_CALL aaruf_get_drive_serial_number(const void *context, uint8_t *buffer, int32_t *length);
+
177AARU_EXPORT int32_t AARU_CALL aaruf_get_drive_firmware_revision(const void *context, uint8_t *buffer, int32_t *length);
+
178AARU_EXPORT int32_t AARU_CALL aaruf_get_cicm_metadata(const void *context, uint8_t *buffer, size_t *length);
+
179AARU_EXPORT int32_t AARU_CALL aaruf_get_aaru_json_metadata(const void *context, uint8_t *buffer, size_t *length);
+
180AARU_EXPORT int32_t AARU_CALL aaruf_set_aaru_json_metadata(void *context, uint8_t *data, size_t length);
+
181AARU_EXPORT int32_t AARU_CALL aaruf_get_user_sectors(const void *context, uint64_t *sectors);
+
182AARU_EXPORT int32_t AARU_CALL aaruf_get_negative_sectors(const void *context, uint16_t *sectors);
+
183AARU_EXPORT int32_t AARU_CALL aaruf_get_overflow_sectors(const void *context, uint16_t *sectors);
+
184AARU_EXPORT int32_t AARU_CALL aaruf_get_image_info(const void *context, ImageInfo *image_info);
+
185
+
186AARU_EXPORT int32_t AARU_CALL aaruf_get_tape_file(const void *context, uint8_t partition, uint32_t file,
+
187 uint64_t *starting_block, uint64_t *ending_block);
+
188AARU_EXPORT int32_t AARU_CALL aaruf_set_tape_file(void *context, uint8_t partition, uint32_t file,
+
189 uint64_t starting_block, uint64_t ending_block);
+
190AARU_EXPORT int32_t AARU_CALL aaruf_get_tape_partition(const void *context, uint8_t partition, uint64_t *starting_block,
+
191 uint64_t *ending_block);
+
192AARU_EXPORT int32_t AARU_CALL aaruf_set_tape_partition(void *context, uint8_t partition, uint64_t starting_block,
+
193 uint64_t ending_block);
+
194
+
195AARU_EXPORT int32_t AARU_CALL aaruf_get_dumphw(void *context, uint8_t *buffer, size_t *length);
+
196AARU_EXPORT int32_t AARU_CALL aaruf_set_dumphw(void *context, uint8_t *data, size_t length);
+
197
+ +
199AARU_EXPORT int AARU_CALL aaruf_spamsum_update(spamsum_ctx *ctx, const uint8_t *data, uint32_t len);
+
200AARU_EXPORT int AARU_CALL aaruf_spamsum_final(spamsum_ctx *ctx, uint8_t *result);
+ +
202
+
203AARU_LOCAL void fuzzy_engine_step(spamsum_ctx *ctx, uint8_t c);
+
204AARU_LOCAL void roll_hash(spamsum_ctx *ctx, uint8_t c);
+ + +
207
+
208AARU_EXPORT size_t AARU_CALL aaruf_flac_decode_redbook_buffer(uint8_t *dst_buffer, size_t dst_size,
+
209 const uint8_t *src_buffer, size_t src_size);
+
210
+ +
212 uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size, uint32_t blocksize,
+
213 int32_t do_mid_side_stereo, int32_t loose_mid_side_stereo, const char *apodization, uint32_t max_lpc_order,
+
214 uint32_t qlp_coeff_precision, int32_t do_qlp_coeff_prec_search, int32_t do_exhaustive_model_search,
+
215 uint32_t min_residual_partition_order, uint32_t max_residual_partition_order, const char *application_id,
+
216 uint32_t application_id_len);
+
217
+
218AARU_EXPORT int32_t AARU_CALL aaruf_lzma_decode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer,
+
219 size_t *src_size, const uint8_t *props, size_t props_size);
+
220
+
221AARU_EXPORT int32_t AARU_CALL aaruf_lzma_encode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer,
+
222 size_t src_size, uint8_t *out_props, size_t *out_props_size,
+
223 int32_t level, uint32_t dict_size, int32_t lc, int32_t lp,
+
224 int32_t pb, int32_t fb, int32_t num_threads);
+
225
+ +
227AARU_EXPORT void AARU_CALL aaruf_md5_update(md5_ctx *ctx, const void *data, unsigned long size);
+
228AARU_EXPORT void AARU_CALL aaruf_md5_final(md5_ctx *ctx, unsigned char *result);
+
229AARU_EXPORT void AARU_CALL aaruf_md5_buffer(const void *data, unsigned long size, unsigned char *result);
+
230
+ +
232AARU_EXPORT void AARU_CALL aaruf_sha1_update(sha1_ctx *ctx, const void *data, unsigned long size);
+
233AARU_EXPORT void AARU_CALL aaruf_sha1_final(sha1_ctx *ctx, unsigned char *result);
+
234AARU_EXPORT void AARU_CALL aaruf_sha1_buffer(const void *data, unsigned long size, unsigned char *result);
+
235
+ +
237AARU_EXPORT void AARU_CALL aaruf_sha256_update(sha256_ctx *ctx, const void *data, unsigned long size);
+
238AARU_EXPORT void AARU_CALL aaruf_sha256_final(sha256_ctx *ctx, unsigned char *result);
+
239AARU_EXPORT void AARU_CALL aaruf_sha256_buffer(const void *data, unsigned long size, unsigned char *result);
+
240
+
241#if defined(__x86_64__) || defined(__amd64) || defined(_M_AMD64) || defined(_M_X64) || defined(__I386__) || \
+
242 defined(__i386__) || defined(__THW_INTEL) || defined(_M_IX86)
+
243
+
244AARU_EXPORT int have_clmul();
+
245AARU_EXPORT int have_ssse3();
+
246AARU_EXPORT int have_avx2();
+
247
+
248AARU_EXPORT CLMUL uint64_t AARU_CALL aaruf_crc64_clmul(uint64_t crc, const uint8_t *data, long length);
+
249#endif
+
250
+
251#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
+
252AARU_EXPORT int have_neon();
+
253AARU_EXPORT int have_arm_crc32();
+
254AARU_EXPORT int have_arm_crypto();
+
255
+
256AARU_EXPORT TARGET_WITH_SIMD uint64_t AARU_CALL aaruf_crc64_vmull(uint64_t previous_crc, const uint8_t *data, long len);
+
257#endif
+
258
+
259#endif // LIBAARUFORMAT_DECLS_H
+
Public high-level API types: media classifications, per-sector / per-media tag enums and image summar...
+
CRC64 (ECMA-182) core context and precomputed slicing-by-4 tables.
+
int32_t aaruf_set_media_sequence(void *context, int32_t sequence, int32_t last_sequence)
Sets the media sequence information for multi-volume media sets.
Definition metadata.c:363
+
#define AARU_CALL
Definition decls.h:45
+
int32_t aaruf_set_tape_file(void *context, uint8_t partition, uint32_t file, uint64_t starting_block, uint64_t ending_block)
Sets or updates the block range for a specific tape file in an Aaru tape image.
Definition tape.c:770
+
int32_t aaruf_get_aaru_json_metadata(const void *context, uint8_t *buffer, size_t *length)
Retrieves the embedded Aaru metadata JSON from the image.
Definition metadata.c:2099
+
void aaruf_cd_lba_to_msf(int64_t pos, uint8_t *minute, uint8_t *second, uint8_t *frame)
Converts a CD LBA (Logical Block Address) to MSF (Minute:Second:Frame) format.
Definition ecc_cd.c:370
+
void aaruf_sha1_final(sha1_ctx *ctx, unsigned char *result)
Definition sha1.c:124
+
int32_t aaruf_set_media_part_number(void *context, const uint8_t *data, int32_t length)
Sets the media part number or model designation for the image.
Definition metadata.c:1297
+
void aaruf_sha256_init(sha256_ctx *ctx)
Definition sha256.c:76
+
int32_t aaruf_cst_transform(const uint8_t *interleaved, uint8_t *sequential, size_t length)
Transforms interleaved subchannel data to sequential format.
Definition cst.c:35
+
int32_t aaruf_lzma_encode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, size_t src_size, uint8_t *out_props, size_t *out_props_size, int32_t level, uint32_t dict_size, int32_t lc, int32_t lp, int32_t pb, int32_t fb, int32_t num_threads)
Encodes a buffer using LZMA compression.
Definition lzma.c:65
+
uint64_t aaruf_crc64_data(const uint8_t *data, uint32_t len)
Definition crc64.c:160
+
size_t aaruf_flac_encode_redbook_buffer(uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size, uint32_t blocksize, int32_t do_mid_side_stereo, int32_t loose_mid_side_stereo, const char *apodization, uint32_t max_lpc_order, uint32_t qlp_coeff_precision, int32_t do_qlp_coeff_prec_search, int32_t do_exhaustive_model_search, uint32_t min_residual_partition_order, uint32_t max_residual_partition_order, const char *application_id, uint32_t application_id_len)
Encodes a Red Book audio buffer to FLAC format.
Definition flac.c:175
+
int32_t aaruf_lzma_decode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, size_t *src_size, const uint8_t *props, size_t props_size)
Decodes an LZMA-compressed buffer.
Definition lzma.c:39
+
int32_t aaruf_get_drive_serial_number(const void *context, uint8_t *buffer, int32_t *length)
Retrieves the imaging drive's serial number metadata.
Definition metadata.c:3108
+
int32_t aaruf_set_drive_model(void *context, const uint8_t *data, int32_t length)
Sets the drive model information for the image.
Definition metadata.c:1534
+
int32_t aaruf_get_tape_file(const void *context, uint8_t partition, uint32_t file, uint64_t *starting_block, uint64_t *ending_block)
Retrieves the block range for a specific tape file from an Aaru tape image.
Definition tape.c:569
+
int32_t aaruf_set_creator(void *context, const uint8_t *data, int32_t length)
Sets the creator (person/operator) information for the image.
Definition metadata.c:493
+
void aaruf_md5_init(md5_ctx *ctx)
Definition md5.c:425
+
void aaruf_sha1_buffer(const void *data, unsigned long size, unsigned char *result)
Definition sha1.c:155
+
int aaruf_crc64_update(crc64_ctx *ctx, const uint8_t *data, uint32_t len)
Updates the CRC64 context with new data.
Definition crc64.c:55
+
int32_t aaruf_set_geometry(void *context, uint32_t cylinders, uint32_t heads, uint32_t sectors_per_track)
Sets the logical CHS geometry for the AaruFormat image.
Definition metadata.c:229
+
void fuzzy_try_fork_blockhash(spamsum_ctx *ctx)
Definition spamsum.c:175
+
int32_t aaruf_get_tracks(const void *context, uint8_t *buffer, size_t *length)
Retrieve the array of track descriptors contained in an opened AaruFormat image.
Definition optical.c:281
+
int32_t aaruf_set_media_serial_number(void *context, const uint8_t *data, int32_t length)
Sets the media serial number for the image.
Definition metadata.c:1054
+
void aaruf_ecc_cd_write_sector(void *context, const uint8_t *address, const uint8_t *data, uint8_t *ecc, int32_t address_offset, int32_t data_offset, int32_t ecc_offset)
Writes ECC for a full CD sector (both P and Q ECC).
Definition ecc_cd.c:349
+
int32_t aaruf_read_track_sector(void *context, uint8_t *data, uint64_t sector_address, uint32_t *length, uint8_t track)
Reads a sector from a specific track in the AaruFormat image.
Definition read.c:663
+
int32_t aaruf_get_dumphw(void *context, uint8_t *buffer, size_t *length)
Retrieves the dump hardware block containing acquisition environment information.
Definition dump.c:186
+
int32_t aaruf_set_media_title(void *context, const uint8_t *data, int32_t length)
Sets the media title or label for the image.
Definition metadata.c:720
+
int32_t aaruf_get_creator(const void *context, uint8_t *buffer, int32_t *length)
Retrieves the recorded creator (operator) name from the MetadataBlock.
Definition metadata.c:2404
+
int32_t aaruf_set_drive_manufacturer(void *context, const uint8_t *data, int32_t length)
Sets the drive manufacturer information for the image.
Definition metadata.c:1412
+
int32_t aaruf_set_media_manufacturer(void *context, const uint8_t *data, int32_t length)
Sets the media manufacturer information for the image.
Definition metadata.c:832
+
int32_t aaruf_get_drive_firmware_revision(const void *context, uint8_t *buffer, int32_t *length)
Retrieves the firmware revision metadata for the imaging drive.
Definition metadata.c:3178
+
int32_t aaruf_get_cicm_metadata(const void *context, uint8_t *buffer, size_t *length)
Retrieves the embedded CICM XML metadata sidecar from the image.
Definition metadata.c:1944
+
int32_t aaruf_set_media_barcode(void *context, const uint8_t *data, int32_t length)
Sets the media barcode information for the image.
Definition metadata.c:1176
+
int32_t aaruf_read_media_tag(void *context, uint8_t *data, int32_t tag, uint32_t *length)
Reads a media tag from the AaruFormat image.
Definition read.c:85
+
void aaruf_crc64_free(crc64_ctx *ctx)
Frees a CRC64 context.
Definition crc64.c:155
+
int32_t aaruf_write_sector(void *context, uint64_t sector_address, bool negative, const uint8_t *data, uint8_t sector_status, uint32_t length)
Writes a sector to the AaruFormat image.
Definition write.c:98
+
int32_t aaruf_get_media_serial_number(const void *context, uint8_t *buffer, int32_t *length)
Retrieves the media serial number recorded in the image metadata.
Definition metadata.c:2756
+
int32_t aaruf_get_media_part_number(const void *context, uint8_t *buffer, int32_t *length)
Retrieves the media part number recorded in the MetadataBlock.
Definition metadata.c:2896
+
int32_t aaruf_get_media_model(const void *context, uint8_t *buffer, int32_t *length)
Retrieves the media model or product designation metadata.
Definition metadata.c:2686
+
int32_t aaruf_get_media_manufacturer(const void *context, uint8_t *buffer, int32_t *length)
Retrieves the recorded media manufacturer name.
Definition metadata.c:2616
+
int32_t aaruf_set_tracks(void *context, TrackEntry *tracks, const int count)
Replace (or clear) the in-memory track table for an AaruFormat image context.
Definition optical.c:392
+
int32_t aaruf_read_sector(void *context, uint64_t sector_address, bool negative, uint8_t *data, uint32_t *length)
Reads a sector from the AaruFormat image.
Definition read.c:250
+
int32_t aaruf_get_drive_model(const void *context, uint8_t *buffer, int32_t *length)
Retrieves the device model information for the imaging drive.
Definition metadata.c:3038
+
int32_t aaruf_get_media_tag_type_for_datatype(int32_t type)
Converts an image data type to an Aaru media tag type.
Definition helpers.c:31
+
bool aaruf_ecc_cd_check(void *context, const uint8_t *address, const uint8_t *data, uint32_t major_count, uint32_t minor_count, uint32_t major_mult, uint32_t minor_inc, const uint8_t *ecc, int32_t address_offset, int32_t data_offset, int32_t ecc_offset)
Checks the ECC of a CD sector.
Definition ecc_cd.c:227
+
int32_t aaruf_get_media_barcode(const void *context, uint8_t *buffer, int32_t *length)
Retrieves the barcode assigned to the physical media or its packaging.
Definition metadata.c:2825
+
int aaruf_spamsum_update(spamsum_ctx *ctx, const uint8_t *data, uint32_t len)
Updates the spamsum context with new data.
Definition spamsum.c:59
+
int32_t aaruf_get_drive_manufacturer(const void *context, uint8_t *buffer, int32_t *length)
Retrieves the drive manufacturer metadata captured during imaging.
Definition metadata.c:2968
+
void aaruf_sha256_final(sha256_ctx *ctx, unsigned char *result)
Definition sha256.c:115
+
int32_t aaruf_get_image_info(const void *context, ImageInfo *image_info)
Retrieves a deep copy of the ImageInfo structure from the AaruFormat image.
Definition metadata.c:3634
+
crc64_ctx * aaruf_crc64_init()
Initializes a CRC64 context.
Definition crc64.c:32
+
uint32_t aaruf_edc_cd_compute(void *context, uint32_t edc, const uint8_t *src, int size, int pos)
Computes the EDC (Error Detection Code) for a CD sector.
Definition ecc_cd.c:543
+
void fuzzy_engine_step(spamsum_ctx *ctx, uint8_t c)
Definition spamsum.c:84
+
int aaruf_close(void *context)
Close an Aaru image context, flushing pending data structures and releasing resources.
Definition close.c:3995
+
int32_t aaruf_write_sector_long(void *context, uint64_t sector_address, bool negative, const uint8_t *data, uint8_t sector_status, uint32_t length)
Writes a full ("long") raw sector from optical or block media, parsing structure and validating conte...
Definition write.c:532
+
int32_t aaruf_write_sector_tag(void *context, uint64_t sector_address, bool negative, const uint8_t *data, size_t length, int32_t tag)
Writes per-sector tag data (auxiliary metadata) for a specific sector.
Definition write.c:2048
+
void aaruf_md5_final(md5_ctx *ctx, unsigned char *result)
Definition md5.c:475
+
void aaruf_md5_update(md5_ctx *ctx, const void *data, unsigned long size)
Definition md5.c:436
+
int aaruf_identify_stream(FILE *image_stream)
Identifies a file as an AaruFormat image using an open stream.
Definition identify.c:163
+
void aaruf_spamsum_free(spamsum_ctx *ctx)
Frees a spamsum (fuzzy hash) context.
Definition spamsum.c:75
+
void * aaruf_create(const char *filepath, uint32_t media_type, uint32_t sector_size, uint64_t user_sectors, uint64_t negative_sectors, uint64_t overflow_sectors, const char *options, const uint8_t *application_name, uint8_t application_name_length, uint8_t application_major_version, uint8_t application_minor_version, bool is_tape)
Creates a new AaruFormat image file.
Definition create.c:279
+
int32_t aaruf_read_sector_long(void *context, uint64_t sector_address, bool negative, uint8_t *data, uint32_t *length)
Reads a complete sector with all metadata from the AaruFormat image.
Definition read.c:815
+
void aaruf_ecc_cd_reconstruct_prefix(uint8_t *sector, uint8_t type, int64_t lba)
Reconstructs the prefix (sync, address, mode) of a CD sector.
Definition ecc_cd.c:388
+
int aaruf_identify(const char *filename)
Identifies a file as an AaruFormat image using a file path.
Definition identify.c:84
+
spamsum_ctx * aaruf_spamsum_init(void)
Definition spamsum.c:37
+
void aaruf_sha256_buffer(const void *data, unsigned long size, unsigned char *result)
Definition sha256.c:141
+
int32_t aaruf_get_user_sectors(const void *context, uint64_t *sectors)
Retrieves the total number of user-accessible sectors in the AaruFormat image.
Definition metadata.c:3292
+
int32_t aaruf_set_aaru_json_metadata(void *context, uint8_t *data, size_t length)
Sets the Aaru metadata JSON for the image during creation.
Definition metadata.c:2258
+
void aaruf_crc64_slicing(uint64_t *previous_crc, const uint8_t *data, uint32_t len)
Updates a CRC64 value using the slicing-by-8 algorithm.
Definition crc64.c:102
+
void aaruf_ecc_cd_write(void *context, const uint8_t *address, const uint8_t *data, uint32_t major_count, uint32_t minor_count, uint32_t major_mult, uint32_t minor_inc, uint8_t *ecc, int32_t address_offset, int32_t data_offset, int32_t ecc_offset)
Writes ECC for a CD sector.
Definition ecc_cd.c:292
+
#define AARU_LOCAL
Definition decls.h:55
+
int32_t aaruf_verify_image(void *context)
Verifies the integrity of an AaruFormat image file.
Definition verify.c:130
+
int32_t aaruf_get_datatype_for_media_tag_type(int32_t tag_type)
Converts an Aaru media tag type to an image data type.
Definition helpers.c:189
+
int32_t aaruf_get_negative_sectors(const void *context, uint16_t *sectors)
Retrieves the number of negative (pre-gap) sectors in the AaruFormat image.
Definition metadata.c:3417
+
int32_t aaruf_set_media_model(void *context, const uint8_t *data, int32_t length)
Sets the media model or product designation for the image.
Definition metadata.c:939
+
#define AARU_EXPORT
Definition decls.h:54
+
void fuzzy_try_reduce_blockhash(spamsum_ctx *ctx)
Definition spamsum.c:155
+
int32_t aaruf_get_comments(const void *context, uint8_t *buffer, int32_t *length)
Retrieves the user comments or notes stored in the MetadataBlock.
Definition metadata.c:2476
+
void aaruf_sha1_init(sha1_ctx *ctx)
Definition sha1.c:34
+
void aaruf_ecc_cd_reconstruct(void *context, uint8_t *sector, uint8_t type)
Reconstructs the EDC and ECC fields of a CD sector.
Definition ecc_cd.c:455
+
int32_t aaruf_set_tape_partition(void *context, uint8_t partition, uint64_t starting_block, uint64_t ending_block)
Sets or updates the block range for a specific tape partition in an Aaru tape image.
Definition tape.c:1196
+
void roll_hash(spamsum_ctx *ctx, uint8_t c)
Definition spamsum.c:137
+
int32_t aaruf_write_media_tag(void *context, const uint8_t *data, int32_t type, uint32_t length)
Writes a media tag to the AaruFormat image, storing medium-specific metadata and descriptors.
Definition write.c:1780
+
int32_t aaruf_get_media_sequence(const void *context, int32_t *sequence, int32_t *last_sequence)
Retrieves the media sequence metadata for multi-volume image sets.
Definition metadata.c:2337
+
int32_t aaruf_get_tape_partition(const void *context, uint8_t partition, uint64_t *starting_block, uint64_t *ending_block)
Retrieves the block range for a specific tape partition from an Aaru tape image.
Definition tape.c:982
+
int aaruf_spamsum_final(spamsum_ctx *ctx, uint8_t *result)
Definition spamsum.c:191
+
void aaruf_sha256_update(sha256_ctx *ctx, const void *data, unsigned long size)
Definition sha256.c:90
+
bool aaruf_ecc_cd_is_suffix_correct_mode2(void *context, const uint8_t *sector)
Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 2).
Definition ecc_cd.c:165
+
int32_t aaruf_get_geometry(const void *context, uint32_t *cylinders, uint32_t *heads, uint32_t *sectors_per_track)
Retrieves the logical CHS geometry from the AaruFormat image.
Definition metadata.c:94
+
void aaruf_md5_buffer(const void *data, unsigned long size, unsigned char *result)
Definition md5.c:508
+
void aaruf_sha1_update(sha1_ctx *ctx, const void *data, unsigned long size)
Definition sha1.c:89
+
void * aaruf_ecc_cd_init()
Initializes a Compact Disc ECC context.
Definition ecc_cd.c:35
+
int32_t aaruf_get_xml_mediatype(int32_t type)
Definition helpers.c:339
+
int32_t aaruf_set_dumphw(void *context, uint8_t *data, size_t length)
Sets the dump hardware block for the image during creation.
Definition dump.c:531
+
int32_t aaruf_set_drive_firmware_revision(void *context, const uint8_t *data, int32_t length)
Sets the drive firmware revision for the image.
Definition metadata.c:1793
+
int32_t aaruf_cst_untransform(const uint8_t *sequential, uint8_t *interleaved, size_t length)
Reverses the CST (Claunia's Subchannel Transform) transformation from sequential to interleaved data.
Definition cst.c:193
+
int aaruf_crc64_final(crc64_ctx *ctx, uint64_t *crc)
Computes the final CRC64 value from the context.
Definition crc64.c:141
+
int32_t aaruf_read_sector_tag(const void *context, uint64_t sector_address, bool negative, uint8_t *buffer, uint32_t *length, int32_t tag)
Reads a specific sector tag from the AaruFormat image.
Definition read.c:1463
+
int32_t aaruf_get_overflow_sectors(const void *context, uint16_t *sectors)
Retrieves the number of overflow (post-gap) sectors in the AaruFormat image.
Definition metadata.c:3552
+
int32_t aaruf_set_drive_serial_number(void *context, const uint8_t *data, int32_t length)
Sets the drive serial number for the image.
Definition metadata.c:1658
+
size_t aaruf_flac_decode_redbook_buffer(uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size)
Decodes a FLAC-compressed Red Book audio buffer.
Definition flac.c:48
+
int32_t aaruf_get_media_title(const void *context, uint8_t *buffer, int32_t *length)
Retrieves the media title or label captured during image creation.
Definition metadata.c:2546
+
int32_t aaruf_set_comments(void *context, const uint8_t *data, int32_t length)
Sets user comments or notes for the image.
Definition metadata.c:607
+
bool aaruf_ecc_cd_is_suffix_correct(void *context, const uint8_t *sector)
Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 1).
Definition ecc_cd.c:101
+
void * aaruf_open(const char *filepath)
Opens an existing AaruFormat image file.
Definition open.c:125
+ +
On-disk structures describing optical disc tracks (Track list block).
+ + + + +
High-level summary of an opened Aaru image containing metadata and media characteristics.
Definition aaru.h:870
+
Single optical disc track descriptor (sequence, type, LBAs, session, ISRC, flags).
Definition optical.h:72
+
Minimal ECMA-182 CRC64 incremental state container (running value only).
Definition crc64.h:56
+
Definition md5.h:32
+ + + +
+
+
+ + + + diff --git a/docs/html/dir_19ac67bde96fa7098d9c89fb8e36db69.html b/docs/html/dir_19ac67bde96fa7098d9c89fb8e36db69.html new file mode 100644 index 0000000..d1f9978 --- /dev/null +++ b/docs/html/dir_19ac67bde96fa7098d9c89fb8e36db69.html @@ -0,0 +1,120 @@ + + + + + + + +libaaruformat: src/index Directory Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
index Directory Reference
+
+
+ + + + + +

+Files

 
index_v1.c
 
index_v2.c
 
index_v3.c
+
+
+ +
+ + + + diff --git a/docs/html/dir_19ac67bde96fa7098d9c89fb8e36db69.js b/docs/html/dir_19ac67bde96fa7098d9c89fb8e36db69.js new file mode 100644 index 0000000..6c6b940 --- /dev/null +++ b/docs/html/dir_19ac67bde96fa7098d9c89fb8e36db69.js @@ -0,0 +1,6 @@ +var dir_19ac67bde96fa7098d9c89fb8e36db69 = +[ + [ "index_v1.c", "index__v1_8c.html", "index__v1_8c" ], + [ "index_v2.c", "index__v2_8c.html", "index__v2_8c" ], + [ "index_v3.c", "index__v3_8c.html", "index__v3_8c" ] +]; \ No newline at end of file diff --git a/docs/html/dir_40ed6a89610fc2370cf3ffcd6469b940.html b/docs/html/dir_40ed6a89610fc2370cf3ffcd6469b940.html new file mode 100644 index 0000000..3f47ce9 --- /dev/null +++ b/docs/html/dir_40ed6a89610fc2370cf3ffcd6469b940.html @@ -0,0 +1,120 @@ + + + + + + + +libaaruformat: src/compression Directory Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
compression Directory Reference
+
+
+ + + + + +

+Files

 
cst.c
 
flac.c
 
lzma.c
+
+
+ +
+ + + + diff --git a/docs/html/dir_40ed6a89610fc2370cf3ffcd6469b940.js b/docs/html/dir_40ed6a89610fc2370cf3ffcd6469b940.js new file mode 100644 index 0000000..c57fced --- /dev/null +++ b/docs/html/dir_40ed6a89610fc2370cf3ffcd6469b940.js @@ -0,0 +1,6 @@ +var dir_40ed6a89610fc2370cf3ffcd6469b940 = +[ + [ "cst.c", "cst_8c.html", "cst_8c" ], + [ "flac.c", "flac_8c.html", "flac_8c" ], + [ "lzma.c", "lzma_8c.html", "lzma_8c" ] +]; \ No newline at end of file diff --git a/docs/html/dir_6387aeb6e475a334d8dc12d69f21999e.html b/docs/html/dir_6387aeb6e475a334d8dc12d69f21999e.html new file mode 100644 index 0000000..7b71ec2 --- /dev/null +++ b/docs/html/dir_6387aeb6e475a334d8dc12d69f21999e.html @@ -0,0 +1,139 @@ + + + + + + + +libaaruformat: include/aaruformat/structs Directory Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
structs Directory Reference
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + +

+Files

 
checksum.h
 On-disk layout definitions for the checksum block (BlockType::ChecksumBlock).
 
data.h
 On-disk layout structures for data-bearing and geometry blocks.
 
ddt.h
 On-disk headers for Deduplication Data Tables (DDT) versions 1 and 2.
 
dump.h
 Packed on-disk structures describing hardware and software used during image acquisition.
 
header.h
 On-disk container header structures (v1 and v2) for Aaru images.
 
index.h
 On‑disk index block header and entry structures (versions 1, 2 and 3).
 
lisa_tag.h
 Structure definitions and conversion/serialization function declarations for Lisa family disk tags.
 
optical.h
 On-disk structures describing optical disc tracks (Track list block).
 
options.h
 < For bool type used in aaru_options.
 
tape.h
 Data structures for tape media support in Aaru disk images.
+
+
+ +
+ + + + diff --git a/docs/html/dir_6387aeb6e475a334d8dc12d69f21999e.js b/docs/html/dir_6387aeb6e475a334d8dc12d69f21999e.js new file mode 100644 index 0000000..2f0f0ac --- /dev/null +++ b/docs/html/dir_6387aeb6e475a334d8dc12d69f21999e.js @@ -0,0 +1,14 @@ +var dir_6387aeb6e475a334d8dc12d69f21999e = +[ + [ "checksum.h", "checksum_8h.html", "checksum_8h" ], + [ "data.h", "data_8h.html", "data_8h" ], + [ "ddt.h", "ddt_8h.html", "ddt_8h" ], + [ "dump.h", "dump_8h.html", "dump_8h" ], + [ "header.h", "header_8h.html", "header_8h" ], + [ "index.h", "index_8h.html", "index_8h" ], + [ "lisa_tag.h", "lisa__tag_8h.html", "lisa__tag_8h" ], + [ "metadata.h", "metadata_8h.html", "metadata_8h" ], + [ "optical.h", "optical_8h.html", "optical_8h" ], + [ "options.h", "options_8h.html", "options_8h" ], + [ "tape.h", "tape_8h.html", "tape_8h" ] +]; \ No newline at end of file diff --git a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html new file mode 100644 index 0000000..1b752b9 --- /dev/null +++ b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html @@ -0,0 +1,142 @@ + + + + + + + +libaaruformat: src Directory Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
src Directory Reference
+
+
+ + + + + + + + +

+Directories

 
blocks
 
checksum
 
compression
 
crc64
 
ddt
 
index
+ + + + + + + + + + + + + + + + + +

+Files

 
close.c
 Implements image finalization and resource cleanup for libaaruformat.
 
create.c
 
dump.c
 
helpers.c
 
identify.c
 
lisa_tag.c
 Parsing, conversion and serialization helpers for Lisa (Apple Lisa / Profile / Priam / Sony) disk block tags.
 
lru.c
 
open.c
 
options.c
 
read.c
 
time.c
 
verify.c
 
write.c
+
+
+ +
+ + + + diff --git a/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.js b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.js new file mode 100644 index 0000000..d7a56f5 --- /dev/null +++ b/docs/html/dir_68267d1309a1af8e8297ef4c3efbcdba.js @@ -0,0 +1,23 @@ +var dir_68267d1309a1af8e8297ef4c3efbcdba = +[ + [ "blocks", "dir_b2e0cd1ddd0a904cb261e9b68779deb4.html", "dir_b2e0cd1ddd0a904cb261e9b68779deb4" ], + [ "checksum", "dir_6b3196bdf3f485a11a190486a5644c9a.html", "dir_6b3196bdf3f485a11a190486a5644c9a" ], + [ "compression", "dir_40ed6a89610fc2370cf3ffcd6469b940.html", "dir_40ed6a89610fc2370cf3ffcd6469b940" ], + [ "crc64", "dir_b86b57f9d61b104fa8483aa475f863ae.html", "dir_b86b57f9d61b104fa8483aa475f863ae" ], + [ "ddt", "dir_a6e99c46e07b25cfb1b3942f86972439.html", "dir_a6e99c46e07b25cfb1b3942f86972439" ], + [ "index", "dir_19ac67bde96fa7098d9c89fb8e36db69.html", "dir_19ac67bde96fa7098d9c89fb8e36db69" ], + [ "close.c", "close_8c.html", "close_8c" ], + [ "create.c", "create_8c.html", "create_8c" ], + [ "dump.c", "dump_8c.html", "dump_8c" ], + [ "helpers.c", "helpers_8c.html", "helpers_8c" ], + [ "identify.c", "identify_8c.html", "identify_8c" ], + [ "lisa_tag.c", "lisa__tag_8c.html", "lisa__tag_8c" ], + [ "lru.c", "lru_8c.html", "lru_8c" ], + [ "metadata.c", "metadata_8c.html", "metadata_8c" ], + [ "open.c", "open_8c.html", "open_8c" ], + [ "options.c", "options_8c.html", "options_8c" ], + [ "read.c", "read_8c.html", "read_8c" ], + [ "time.c", "time_8c.html", "time_8c" ], + [ "verify.c", "verify_8c.html", "verify_8c" ], + [ "write.c", "write_8c.html", "write_8c" ] +]; \ No newline at end of file diff --git a/docs/html/dir_6b3196bdf3f485a11a190486a5644c9a.html b/docs/html/dir_6b3196bdf3f485a11a190486a5644c9a.html new file mode 100644 index 0000000..b1e2a13 --- /dev/null +++ b/docs/html/dir_6b3196bdf3f485a11a190486a5644c9a.html @@ -0,0 +1,123 @@ + + + + + + + +libaaruformat: src/checksum Directory Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
checksum Directory Reference
+
+
+ + + + + + + + +

+Files

 
ecc_cd.c
 
md5.c
 
sha1.c
 
sha256.c
 
simd.c
 
spamsum.c
+
+
+ +
+ + + + diff --git a/docs/html/dir_6b3196bdf3f485a11a190486a5644c9a.js b/docs/html/dir_6b3196bdf3f485a11a190486a5644c9a.js new file mode 100644 index 0000000..0c13150 --- /dev/null +++ b/docs/html/dir_6b3196bdf3f485a11a190486a5644c9a.js @@ -0,0 +1,9 @@ +var dir_6b3196bdf3f485a11a190486a5644c9a = +[ + [ "ecc_cd.c", "ecc__cd_8c.html", "ecc__cd_8c" ], + [ "md5.c", "md5_8c.html", "md5_8c" ], + [ "sha1.c", "sha1_8c.html", "sha1_8c" ], + [ "sha256.c", "sha256_8c.html", "sha256_8c" ], + [ "simd.c", "simd_8c.html", null ], + [ "spamsum.c", "spamsum_8c.html", "spamsum_8c" ] +]; \ No newline at end of file diff --git a/docs/html/dir_a6e99c46e07b25cfb1b3942f86972439.html b/docs/html/dir_a6e99c46e07b25cfb1b3942f86972439.html new file mode 100644 index 0000000..80ca399 --- /dev/null +++ b/docs/html/dir_a6e99c46e07b25cfb1b3942f86972439.html @@ -0,0 +1,120 @@ + + + + + + + +libaaruformat: src/ddt Directory Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
ddt Directory Reference
+
+
+ + + + + +

+Files

 
ddt_v1.c
 
ddt_v2.c
 
hash_map.c
+
+
+ +
+ + + + diff --git a/docs/html/dir_a6e99c46e07b25cfb1b3942f86972439.js b/docs/html/dir_a6e99c46e07b25cfb1b3942f86972439.js new file mode 100644 index 0000000..516a9a4 --- /dev/null +++ b/docs/html/dir_a6e99c46e07b25cfb1b3942f86972439.js @@ -0,0 +1,6 @@ +var dir_a6e99c46e07b25cfb1b3942f86972439 = +[ + [ "ddt_v1.c", "ddt__v1_8c.html", "ddt__v1_8c" ], + [ "ddt_v2.c", "ddt__v2_8c.html", "ddt__v2_8c" ], + [ "hash_map.c", "hash__map_8c.html", "hash__map_8c" ] +]; \ No newline at end of file diff --git a/docs/html/dir_aeff2545c9dfcfc842fe9d84b123cb31.html b/docs/html/dir_aeff2545c9dfcfc842fe9d84b123cb31.html new file mode 100644 index 0000000..f9d0f00 --- /dev/null +++ b/docs/html/dir_aeff2545c9dfcfc842fe9d84b123cb31.html @@ -0,0 +1,138 @@ + + + + + + + +libaaruformat: include/aaruformat Directory Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
aaruformat Directory Reference
+
+
+ + + +

+Directories

 
structs
+ + + + + + + + + + + + + + + + + + +

+Files

 
consts.h
 Core public constants and compile‑time limits for the Aaru container format implementation.
 
context.h
 Central runtime context structures for libaaruformat (image state, caches, checksum buffers).
 
crc64.h
 CRC64 (ECMA-182) core context and precomputed slicing-by-4 tables.
 
decls.h
 
endian.h
 
enums.h
 
errors.h
 Public error and status code definitions for libaaruformat.
 
flac.h
 
hash_map.h
 
lru.h
 
simd.h
 
spamsum.h
 
structs.h
+
+
+ +
+ + + + diff --git a/docs/html/dir_aeff2545c9dfcfc842fe9d84b123cb31.js b/docs/html/dir_aeff2545c9dfcfc842fe9d84b123cb31.js new file mode 100644 index 0000000..e0a3df7 --- /dev/null +++ b/docs/html/dir_aeff2545c9dfcfc842fe9d84b123cb31.js @@ -0,0 +1,17 @@ +var dir_aeff2545c9dfcfc842fe9d84b123cb31 = +[ + [ "structs", "dir_6387aeb6e475a334d8dc12d69f21999e.html", "dir_6387aeb6e475a334d8dc12d69f21999e" ], + [ "consts.h", "consts_8h.html", "consts_8h" ], + [ "context.h", "context_8h.html", "context_8h" ], + [ "crc64.h", "crc64_8h.html", "crc64_8h" ], + [ "decls.h", "decls_8h.html", "decls_8h" ], + [ "endian.h", "endian_8h.html", "endian_8h" ], + [ "enums.h", "enums_8h.html", "enums_8h" ], + [ "errors.h", "errors_8h.html", "errors_8h" ], + [ "flac.h", "flac_8h.html", "flac_8h" ], + [ "hash_map.h", "hash__map_8h.html", "hash__map_8h" ], + [ "lru.h", "lru_8h.html", "lru_8h" ], + [ "simd.h", "simd_8h.html", "simd_8h" ], + [ "spamsum.h", "spamsum_8h.html", "spamsum_8h" ], + [ "structs.h", "structs_8h.html", null ] +]; \ No newline at end of file diff --git a/docs/html/dir_b2e0cd1ddd0a904cb261e9b68779deb4.html b/docs/html/dir_b2e0cd1ddd0a904cb261e9b68779deb4.html new file mode 100644 index 0000000..ccd5158 --- /dev/null +++ b/docs/html/dir_b2e0cd1ddd0a904cb261e9b68779deb4.html @@ -0,0 +1,123 @@ + + + + + + + +libaaruformat: src/blocks Directory Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
blocks Directory Reference
+
+
+ + + + + + + + +

+Files

 
checksum.c
 
data.c
 
dump.c
 
optical.c
 
tape.c
+
+
+ +
+ + + + diff --git a/docs/html/dir_b2e0cd1ddd0a904cb261e9b68779deb4.js b/docs/html/dir_b2e0cd1ddd0a904cb261e9b68779deb4.js new file mode 100644 index 0000000..c914e39 --- /dev/null +++ b/docs/html/dir_b2e0cd1ddd0a904cb261e9b68779deb4.js @@ -0,0 +1,9 @@ +var dir_b2e0cd1ddd0a904cb261e9b68779deb4 = +[ + [ "checksum.c", "checksum_8c.html", "checksum_8c" ], + [ "data.c", "data_8c.html", "data_8c" ], + [ "dump.c", "blocks_2dump_8c.html", "blocks_2dump_8c" ], + [ "metadata.c", "blocks_2metadata_8c.html", "blocks_2metadata_8c" ], + [ "optical.c", "optical_8c.html", "optical_8c" ], + [ "tape.c", "tape_8c.html", "tape_8c" ] +]; \ No newline at end of file diff --git a/docs/html/dir_b86b57f9d61b104fa8483aa475f863ae.html b/docs/html/dir_b86b57f9d61b104fa8483aa475f863ae.html new file mode 100644 index 0000000..847f92c --- /dev/null +++ b/docs/html/dir_b86b57f9d61b104fa8483aa475f863ae.html @@ -0,0 +1,122 @@ + + + + + + + +libaaruformat: src/crc64 Directory Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
crc64 Directory Reference
+
+ +
+ +
+ + + + diff --git a/docs/html/dir_b86b57f9d61b104fa8483aa475f863ae.js b/docs/html/dir_b86b57f9d61b104fa8483aa475f863ae.js new file mode 100644 index 0000000..20fff5e --- /dev/null +++ b/docs/html/dir_b86b57f9d61b104fa8483aa475f863ae.js @@ -0,0 +1,8 @@ +var dir_b86b57f9d61b104fa8483aa475f863ae = +[ + [ "arm_vmull.c", "arm__vmull_8c.html", null ], + [ "arm_vmull.h", "arm__vmull_8h.html", null ], + [ "crc64.c", "crc64_8c.html", "crc64_8c" ], + [ "crc64_clmul.c", "crc64__clmul_8c.html", null ], + [ "crc64_vmull.c", "crc64__vmull_8c.html", null ] +]; \ No newline at end of file diff --git a/docs/html/dir_d44c64559bbebec7f509842c48db8b23.html b/docs/html/dir_d44c64559bbebec7f509842c48db8b23.html new file mode 100644 index 0000000..5972e8e --- /dev/null +++ b/docs/html/dir_d44c64559bbebec7f509842c48db8b23.html @@ -0,0 +1,129 @@ + + + + + + + +libaaruformat: include Directory Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
include Directory Reference
+
+
+ + + +

+Directories

 
aaruformat
+ + + + + + + + + +

+Files

 
aaru.h
 Public high-level API types: media classifications, per-sector / per-media tag enums and image summary.
 
aaruformat.h
 
internal.h
 
log.h
 
md5.h
 
sha1.h
 
sha256.h
+
+
+ +
+ + + + diff --git a/docs/html/dir_d44c64559bbebec7f509842c48db8b23.js b/docs/html/dir_d44c64559bbebec7f509842c48db8b23.js new file mode 100644 index 0000000..ffd80c5 --- /dev/null +++ b/docs/html/dir_d44c64559bbebec7f509842c48db8b23.js @@ -0,0 +1,11 @@ +var dir_d44c64559bbebec7f509842c48db8b23 = +[ + [ "aaruformat", "dir_aeff2545c9dfcfc842fe9d84b123cb31.html", "dir_aeff2545c9dfcfc842fe9d84b123cb31" ], + [ "aaru.h", "aaru_8h.html", "aaru_8h" ], + [ "aaruformat.h", "aaruformat_8h.html", "aaruformat_8h" ], + [ "internal.h", "internal_8h.html", "internal_8h" ], + [ "log.h", "log_8h.html", "log_8h" ], + [ "md5.h", "md5_8h.html", "md5_8h" ], + [ "sha1.h", "sha1_8h.html", "sha1_8h" ], + [ "sha256.h", "sha256_8h.html", "sha256_8h" ] +]; \ No newline at end of file diff --git a/docs/html/doxygen.css b/docs/html/doxygen.css new file mode 100644 index 0000000..5d2eecd --- /dev/null +++ b/docs/html/doxygen.css @@ -0,0 +1,2461 @@ +/* The standard CSS for doxygen 1.14.0*/ + +html { +/* page base colors */ +--page-background-color: white; +--page-foreground-color: black; +--page-link-color: #3D578C; +--page-visited-link-color: #3D578C; +--page-external-link-color: #334975; + +/* index */ +--index-odd-item-bg-color: #F8F9FC; +--index-even-item-bg-color: white; +--index-header-color: black; +--index-separator-color: #A0A0A0; + +/* header */ +--header-background-color: #F9FAFC; +--header-separator-color: #C4CFE5; +--group-header-separator-color: #D9E0EE; +--group-header-color: #354C7B; +--inherit-header-color: gray; + +--footer-foreground-color: #2A3D61; +--footer-logo-width: 75px; +--citation-label-color: #334975; +--glow-color: cyan; + +--title-background-color: white; +--title-separator-color: #C4CFE5; +--directory-separator-color: #9CAFD4; +--separator-color: #4A6AAA; + +--blockquote-background-color: #F7F8FB; +--blockquote-border-color: #9CAFD4; + +--scrollbar-thumb-color: #C4CFE5; +--scrollbar-background-color: #F9FAFC; + +--icon-background-color: #728DC1; +--icon-foreground-color: white; +/* +--icon-doc-image: url('doc.svg'); +--icon-folder-open-image: url('folderopen.svg'); +--icon-folder-closed-image: url('folderclosed.svg');*/ +--icon-folder-open-fill-color: #C4CFE5; +--icon-folder-fill-color: #D8DFEE; +--icon-folder-border-color: #4665A2; +--icon-doc-fill-color: #D8DFEE; +--icon-doc-border-color: #4665A2; + +/* brief member declaration list */ +--memdecl-background-color: #F9FAFC; +--memdecl-separator-color: #DEE4F0; +--memdecl-foreground-color: #555; +--memdecl-template-color: #4665A2; +--memdecl-border-color: #D5DDEC; + +/* detailed member list */ +--memdef-border-color: #A8B8D9; +--memdef-title-background-color: #E2E8F2; +--memdef-proto-background-color: #EEF1F7; +--memdef-proto-text-color: #253555; +--memdef-doc-background-color: white; +--memdef-param-name-color: #602020; +--memdef-template-color: #4665A2; + +/* tables */ +--table-cell-border-color: #2D4068; +--table-header-background-color: #374F7F; +--table-header-foreground-color: #FFFFFF; + +/* labels */ +--label-background-color: #728DC1; +--label-left-top-border-color: #5373B4; +--label-right-bottom-border-color: #C4CFE5; +--label-foreground-color: white; + +/** navigation bar/tree/menu */ +--nav-background-color: #F9FAFC; +--nav-foreground-color: #364D7C; +--nav-border-color: #C4CFE5; +--nav-breadcrumb-separator-color: #C4CFE5; +--nav-breadcrumb-active-bg: #EEF1F7; +--nav-breadcrumb-color: #354C7B; +--nav-breadcrumb-border-color: #E1E7F2; +--nav-splitbar-bg-color: #DCE2EF; +--nav-splitbar-handle-color: #9CAFD4; +--nav-font-size-level1: 13px; +--nav-font-size-level2: 10px; +--nav-font-size-level3: 9px; +--nav-text-normal-color: #283A5D; +--nav-text-hover-color: white; +--nav-text-active-color: white; +--nav-menu-button-color: #364D7C; +--nav-menu-background-color: white; +--nav-menu-foreground-color: #555555; +--nav-menu-active-bg: #DCE2EF; +--nav-menu-active-color: #9CAFD4; +--nav-menu-toggle-color: rgba(255, 255, 255, 0.5); +--nav-arrow-color: #B6C4DF; +--nav-arrow-selected-color: #90A5CE; + +/* sync icon */ +--sync-icon-border-color: #C4CFE5; +--sync-icon-background-color: #F9FAFC; +--sync-icon-selected-background-color: #EEF1F7; +--sync-icon-color: #C4CFE5; +--sync-icon-selected-color: #6884BD; + +/* table of contents */ +--toc-background-color: #F4F6FA; +--toc-border-color: #D8DFEE; +--toc-header-color: #4665A2; +--toc-down-arrow-image: url("data:image/svg+xml;utf8,&%238595;"); + +/** search field */ +--search-background-color: white; +--search-foreground-color: #909090; +--search-active-color: black; +--search-filter-background-color: rgba(255,255,255,.7); +--search-filter-backdrop-filter: blur(4px); +--search-filter-foreground-color: black; +--search-filter-border-color: rgba(150,150,150,.4); +--search-filter-highlight-text-color: white; +--search-filter-highlight-bg-color: #3D578C; +--search-results-foreground-color: #425E97; +--search-results-background-color: rgba(255,255,255,.8); +--search-results-backdrop-filter: blur(4px); +--search-results-border-color: rgba(150,150,150,.4); +--search-box-border-color: #B6C4DF; +--search-close-icon-bg-color: #A0A0A0; +--search-close-icon-fg-color: white; + +/** code fragments */ +--code-keyword-color: #008000; +--code-type-keyword-color: #604020; +--code-flow-keyword-color: #E08000; +--code-comment-color: #800000; +--code-preprocessor-color: #806020; +--code-string-literal-color: #002080; +--code-char-literal-color: #008080; +--code-xml-cdata-color: black; +--code-vhdl-digit-color: #FF00FF; +--code-vhdl-char-color: #000000; +--code-vhdl-keyword-color: #700070; +--code-vhdl-logic-color: #FF0000; +--code-link-color: #4665A2; +--code-external-link-color: #4665A2; +--fragment-foreground-color: black; +--fragment-background-color: #FBFCFD; +--fragment-border-color: #C4CFE5; +--fragment-lineno-border-color: #00FF00; +--fragment-lineno-background-color: #E8E8E8; +--fragment-lineno-foreground-color: black; +--fragment-lineno-link-fg-color: #4665A2; +--fragment-lineno-link-bg-color: #D8D8D8; +--fragment-lineno-link-hover-fg-color: #4665A2; +--fragment-lineno-link-hover-bg-color: #C8C8C8; +--fragment-copy-ok-color: #2EC82E; +--tooltip-foreground-color: black; +--tooltip-background-color: rgba(255,255,255,0.8); +--tooltip-arrow-background-color: white; +--tooltip-border-color: rgba(150,150,150,0.7); +--tooltip-backdrop-filter: blur(3px); +--tooltip-doc-color: grey; +--tooltip-declaration-color: #006318; +--tooltip-link-color: #4665A2; +--tooltip-shadow: 0 4px 8px 0 rgba(0,0,0,.25); +--fold-line-color: #808080; + +/** font-family */ +--font-family-normal: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; +--font-family-monospace: 'JetBrains Mono',Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace,fixed; +--font-family-nav: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; +--font-family-title: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; +--font-family-toc: Verdana,'DejaVu Sans',Geneva,sans-serif; +--font-family-search: Arial,Verdana,sans-serif; +--font-family-icon: Arial,Helvetica; +--font-family-tooltip: Roboto,sans-serif; + +/** special sections */ +--warning-color-bg: #f8d1cc; +--warning-color-hl: #b61825; +--warning-color-text: #75070f; +--note-color-bg: #faf3d8; +--note-color-hl: #f3a600; +--note-color-text: #5f4204; +--todo-color-bg: #e4f3ff; +--todo-color-hl: #1879C4; +--todo-color-text: #274a5c; +--test-color-bg: #e8e8ff; +--test-color-hl: #3939C4; +--test-color-text: #1a1a5c; +--deprecated-color-bg: #ecf0f3; +--deprecated-color-hl: #5b6269; +--deprecated-color-text: #43454a; +--bug-color-bg: #e4dafd; +--bug-color-hl: #5b2bdd; +--bug-color-text: #2a0d72; +--invariant-color-bg: #d8f1e3; +--invariant-color-hl: #44b86f; +--invariant-color-text: #265532; +} + +@media (prefers-color-scheme: dark) { + html:not(.dark-mode) { + color-scheme: dark; + +/* page base colors */ +--page-background-color: black; +--page-foreground-color: #C9D1D9; +--page-link-color: #90A5CE; +--page-visited-link-color: #90A5CE; +--page-external-link-color: #A3B4D7; + +/* index */ +--index-odd-item-bg-color: #0B101A; +--index-even-item-bg-color: black; +--index-header-color: #C4CFE5; +--index-separator-color: #334975; + +/* header */ +--header-background-color: #070B11; +--header-separator-color: #141C2E; +--group-header-separator-color: #1D2A43; +--group-header-color: #90A5CE; +--inherit-header-color: #A0A0A0; + +--footer-foreground-color: #5B7AB7; +--footer-logo-width: 60px; +--citation-label-color: #90A5CE; +--glow-color: cyan; + +--title-background-color: #090D16; +--title-separator-color: #212F4B; +--directory-separator-color: #283A5D; +--separator-color: #283A5D; + +--blockquote-background-color: #101826; +--blockquote-border-color: #283A5D; + +--scrollbar-thumb-color: #2C3F65; +--scrollbar-background-color: #070B11; + +--icon-background-color: #334975; +--icon-foreground-color: #C4CFE5; +--icon-folder-open-fill-color: #4665A2; +--icon-folder-fill-color: #5373B4; +--icon-folder-border-color: #C4CFE5; +--icon-doc-fill-color: #6884BD; +--icon-doc-border-color: #C4CFE5; + +/* brief member declaration list */ +--memdecl-background-color: #0B101A; +--memdecl-separator-color: #2C3F65; +--memdecl-foreground-color: #BBB; +--memdecl-template-color: #7C95C6; +--memdecl-border-color: #233250; + +/* detailed member list */ +--memdef-border-color: #233250; +--memdef-title-background-color: #1B2840; +--memdef-proto-background-color: #19243A; +--memdef-proto-text-color: #9DB0D4; +--memdef-doc-background-color: black; +--memdef-param-name-color: #D28757; +--memdef-template-color: #7C95C6; + +/* tables */ +--table-cell-border-color: #283A5D; +--table-header-background-color: #283A5D; +--table-header-foreground-color: #C4CFE5; + +/* labels */ +--label-background-color: #354C7B; +--label-left-top-border-color: #4665A2; +--label-right-bottom-border-color: #283A5D; +--label-foreground-color: #CCCCCC; + +/** navigation bar/tree/menu */ +--nav-background-color: #101826; +--nav-foreground-color: #364D7C; +--nav-border-color: #212F4B; +--nav-breadcrumb-separator-color: #212F4B; +--nav-breadcrumb-active-bg: #1D2A43; +--nav-breadcrumb-color: #90A5CE; +--nav-breadcrumb-border-color: #2A3D61; +--nav-splitbar-bg-color: #283A5D; +--nav-splitbar-handle-color: #4665A2; +--nav-font-size-level1: 13px; +--nav-font-size-level2: 10px; +--nav-font-size-level3: 9px; +--nav-text-normal-color: #B6C4DF; +--nav-text-hover-color: #DCE2EF; +--nav-text-active-color: #DCE2EF; +--nav-menu-button-color: #B6C4DF; +--nav-menu-background-color: #05070C; +--nav-menu-foreground-color: #BBBBBB; +--nav-menu-active-bg: #1D2A43; +--nav-menu-active-color: #C9D3E7; +--nav-menu-toggle-color: rgba(255, 255, 255, 0.2); +--nav-arrow-color: #4665A2; +--nav-arrow-selected-color: #6884BD; + +/* sync icon */ +--sync-icon-border-color: #212F4B; +--sync-icon-background-color: #101826; +--sync-icon-selected-background-color: #1D2A43; +--sync-icon-color: #4665A2; +--sync-icon-selected-color: #5373B4; + +/* table of contents */ +--toc-background-color: #151E30; +--toc-border-color: #202E4A; +--toc-header-color: #A3B4D7; +--toc-down-arrow-image: url("data:image/svg+xml;utf8,&%238595;"); + +/** search field */ +--search-background-color: black; +--search-foreground-color: #C5C5C5; +--search-active-color: #F5F5F5; +--search-filter-background-color: #101826; +--search-filter-foreground-color: #90A5CE; +--search-filter-backdrop-filter: none; +--search-filter-border-color: #7C95C6; +--search-filter-highlight-text-color: #BCC9E2; +--search-filter-highlight-bg-color: #283A5D; +--search-results-background-color: black; +--search-results-foreground-color: #90A5CE; +--search-results-backdrop-filter: none; +--search-results-border-color: #334975; +--search-box-border-color: #334975; +--search-close-icon-bg-color: #909090; +--search-close-icon-fg-color: black; + +/** code fragments */ +--code-keyword-color: #CC99CD; +--code-type-keyword-color: #AB99CD; +--code-flow-keyword-color: #E08000; +--code-comment-color: #717790; +--code-preprocessor-color: #65CABE; +--code-string-literal-color: #7EC699; +--code-char-literal-color: #00E0F0; +--code-xml-cdata-color: #C9D1D9; +--code-vhdl-digit-color: #FF00FF; +--code-vhdl-char-color: #C0C0C0; +--code-vhdl-keyword-color: #CF53C9; +--code-vhdl-logic-color: #FF0000; +--code-link-color: #79C0FF; +--code-external-link-color: #79C0FF; +--fragment-foreground-color: #C9D1D9; +--fragment-background-color: #090D16; +--fragment-border-color: #30363D; +--fragment-lineno-border-color: #30363D; +--fragment-lineno-background-color: black; +--fragment-lineno-foreground-color: #6E7681; +--fragment-lineno-link-fg-color: #6E7681; +--fragment-lineno-link-bg-color: #303030; +--fragment-lineno-link-hover-fg-color: #8E96A1; +--fragment-lineno-link-hover-bg-color: #505050; +--fragment-copy-ok-color: #0EA80E; +--tooltip-foreground-color: #C9D1D9; +--tooltip-background-color: #202020; +--tooltip-arrow-background-color: #202020; +--tooltip-backdrop-filter: none; +--tooltip-border-color: #C9D1D9; +--tooltip-doc-color: #D9E1E9; +--tooltip-declaration-color: #20C348; +--tooltip-link-color: #79C0FF; +--tooltip-shadow: none; +--fold-line-color: #808080; + +/** font-family */ +--font-family-normal: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; +--font-family-monospace: 'JetBrains Mono',Consolas,Monaco,'Andale Mono','Ubuntu Mono',monospace,fixed; +--font-family-nav: 'Lucida Grande',Geneva,Helvetica,Arial,sans-serif; +--font-family-title: system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol"; +--font-family-toc: Verdana,'DejaVu Sans',Geneva,sans-serif; +--font-family-search: Arial,Verdana,sans-serif; +--font-family-icon: Arial,Helvetica; +--font-family-tooltip: Roboto,sans-serif; + +/** special sections */ +--warning-color-bg: #2e1917; +--warning-color-hl: #ad2617; +--warning-color-text: #f5b1aa; +--note-color-bg: #3b2e04; +--note-color-hl: #f1b602; +--note-color-text: #ceb670; +--todo-color-bg: #163750; +--todo-color-hl: #1982D2; +--todo-color-text: #dcf0fa; +--test-color-bg: #121258; +--test-color-hl: #4242cf; +--test-color-text: #c0c0da; +--deprecated-color-bg: #2e323b; +--deprecated-color-hl: #738396; +--deprecated-color-text: #abb0bd; +--bug-color-bg: #2a2536; +--bug-color-hl: #7661b3; +--bug-color-text: #ae9ed6; +--invariant-color-bg: #303a35; +--invariant-color-hl: #76ce96; +--invariant-color-text: #cceed5; +}} +body { + background-color: var(--page-background-color); + color: var(--page-foreground-color); +} + +body, table, div, p, dl { + font-weight: 400; + font-size: 14px; + font-family: var(--font-family-normal); + line-height: 22px; +} + +body.resizing { + user-select: none; + -webkit-user-select: none; +} + +#doc-content { + scrollbar-width: thin; +} + +/* @group Heading Levels */ + +.title { + font-family: var(--font-family-normal); + line-height: 28px; + font-size: 160%; + font-weight: 400; + margin: 10px 2px; +} + +h1.groupheader { + font-size: 150%; +} + +h2.groupheader { + box-shadow: 12px 0 var(--page-background-color), + -12px 0 var(--page-background-color), + 12px 1px var(--group-header-separator-color), + -12px 1px var(--group-header-separator-color); + color: var(--group-header-color); + font-size: 150%; + font-weight: normal; + margin-top: 1.75em; + padding-top: 8px; + padding-bottom: 4px; + width: 100%; +} + +td h2.groupheader { + box-shadow: 13px 0 var(--page-background-color), + -13px 0 var(--page-background-color), + 13px 1px var(--group-header-separator-color), + -13px 1px var(--group-header-separator-color); +} + +h3.groupheader { + font-size: 100%; +} + +h1, h2, h3, h4, h5, h6 { + -webkit-transition: text-shadow 0.5s linear; + -moz-transition: text-shadow 0.5s linear; + -ms-transition: text-shadow 0.5s linear; + -o-transition: text-shadow 0.5s linear; + transition: text-shadow 0.5s linear; + margin-right: 15px; +} + +h1.glow, h2.glow, h3.glow, h4.glow, h5.glow, h6.glow { + text-shadow: 0 0 15px var(--glow-color); +} + +dt { + font-weight: bold; +} + +p.startli, p.startdd { + margin-top: 2px; +} + +th p.starttd, th p.intertd, th p.endtd { + font-size: 100%; + font-weight: 700; +} + +p.starttd { + margin-top: 0px; +} + +p.endli { + margin-bottom: 0px; +} + +p.enddd { + margin-bottom: 4px; +} + +p.endtd { + margin-bottom: 2px; +} + +p.interli { +} + +p.interdd { +} + +p.intertd { +} + +/* @end */ + +caption { + font-weight: bold; +} + +span.legend { + font-size: 70%; + text-align: center; +} + +h3.version { + font-size: 90%; + text-align: center; +} + +div.navtab { + margin-right: 6px; + padding-right: 6px; + text-align: right; + line-height: 110%; + background-color: var(--nav-background-color); +} + +div.navtab table { + border-spacing: 0; +} + +td.navtab { + padding-right: 6px; + padding-left: 6px; +} + +td.navtabHL { + padding-right: 6px; + padding-left: 6px; + border-radius: 0 6px 6px 0; + background-color: var(--nav-menu-active-bg); +} + +div.qindex{ + text-align: center; + width: 100%; + line-height: 140%; + font-size: 130%; + color: var(--index-separator-color); +} + +#main-menu a:focus { + outline: auto; + z-index: 10; + position: relative; +} + +dt.alphachar{ + font-size: 180%; + font-weight: bold; +} + +.alphachar a{ + color: var(--index-header-color); +} + +.alphachar a:hover, .alphachar a:visited{ + text-decoration: none; +} + +.classindex dl { + padding: 25px; + column-count:1 +} + +.classindex dd { + display:inline-block; + margin-left: 50px; + width: 90%; + line-height: 1.15em; +} + +.classindex dl.even { + background-color: var(--index-even-item-bg-color); +} + +.classindex dl.odd { + background-color: var(--index-odd-item-bg-color); +} + +@media(min-width: 1120px) { + .classindex dl { + column-count:2 + } +} + +@media(min-width: 1320px) { + .classindex dl { + column-count:3 + } +} + + +/* @group Link Styling */ + +a { + color: var(--page-link-color); + font-weight: normal; + text-decoration: none; +} + +.contents a:visited { + color: var(--page-visited-link-color); +} + +span.label a:hover { + text-decoration: none; + background: linear-gradient(to bottom, transparent 0,transparent calc(100% - 1px), currentColor 100%); +} + +a.el { + font-weight: bold; +} + +a.elRef { +} + +a.el, a.el:visited, a.code, a.code:visited, a.line, a.line:visited { + color: var(--page-link-color); +} + +a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited { + color: var(--page-external-link-color); +} + +a.code.hl_class { /* style for links to class names in code snippets */ } +a.code.hl_struct { /* style for links to struct names in code snippets */ } +a.code.hl_union { /* style for links to union names in code snippets */ } +a.code.hl_interface { /* style for links to interface names in code snippets */ } +a.code.hl_protocol { /* style for links to protocol names in code snippets */ } +a.code.hl_category { /* style for links to category names in code snippets */ } +a.code.hl_exception { /* style for links to exception names in code snippets */ } +a.code.hl_service { /* style for links to service names in code snippets */ } +a.code.hl_singleton { /* style for links to singleton names in code snippets */ } +a.code.hl_concept { /* style for links to concept names in code snippets */ } +a.code.hl_namespace { /* style for links to namespace names in code snippets */ } +a.code.hl_package { /* style for links to package names in code snippets */ } +a.code.hl_define { /* style for links to macro names in code snippets */ } +a.code.hl_function { /* style for links to function names in code snippets */ } +a.code.hl_variable { /* style for links to variable names in code snippets */ } +a.code.hl_typedef { /* style for links to typedef names in code snippets */ } +a.code.hl_enumvalue { /* style for links to enum value names in code snippets */ } +a.code.hl_enumeration { /* style for links to enumeration names in code snippets */ } +a.code.hl_signal { /* style for links to Qt signal names in code snippets */ } +a.code.hl_slot { /* style for links to Qt slot names in code snippets */ } +a.code.hl_friend { /* style for links to friend names in code snippets */ } +a.code.hl_dcop { /* style for links to KDE3 DCOP names in code snippets */ } +a.code.hl_property { /* style for links to property names in code snippets */ } +a.code.hl_event { /* style for links to event names in code snippets */ } +a.code.hl_sequence { /* style for links to sequence names in code snippets */ } +a.code.hl_dictionary { /* style for links to dictionary names in code snippets */ } + +/* @end */ + +dl.el { + margin-left: -1cm; +} + +ul.check { + list-style:none; + text-indent: -16px; + padding-left: 38px; +} +li.unchecked:before { + content: "\2610\A0"; +} +li.checked:before { + content: "\2611\A0"; +} + +ol { + text-indent: 0px; +} + +ul { + text-indent: 0px; + overflow: visible; +} + +ul.multicol { + -moz-column-gap: 1em; + -webkit-column-gap: 1em; + column-gap: 1em; + -moz-column-count: 3; + -webkit-column-count: 3; + column-count: 3; + list-style-type: none; +} + +#side-nav ul { + overflow: visible; /* reset ul rule for scroll bar in GENERATE_TREEVIEW window */ +} + +#main-nav ul { + overflow: visible; /* reset ul rule for the navigation bar drop down lists */ +} + +.fragment { + text-align: left; + direction: ltr; + overflow-x: auto; + overflow-y: hidden; + position: relative; + min-height: 12px; + margin: 10px 0px; + padding: 10px 10px; + border: 1px solid var(--fragment-border-color); + border-radius: 4px; + background-color: var(--fragment-background-color); + color: var(--fragment-foreground-color); +} + +pre.fragment { + word-wrap: break-word; + font-size: 10pt; + line-height: 125%; + font-family: var(--font-family-monospace); +} + +span.tt { + white-space: pre; + font-family: var(--font-family-monospace); +} + +.clipboard { + width: 24px; + height: 24px; + right: 5px; + top: 5px; + opacity: 0; + position: absolute; + display: inline; + overflow: hidden; + justify-content: center; + align-items: center; + cursor: pointer; +} + +.clipboard.success { + border: 1px solid var(--fragment-foreground-color); + border-radius: 4px; +} + +.fragment:hover .clipboard, .clipboard.success { + opacity: .4; +} + +.clipboard:hover, .clipboard.success { + opacity: 1 !important; +} + +.clipboard:active:not([class~=success]) svg { + transform: scale(.91); +} + +.clipboard.success svg { + fill: var(--fragment-copy-ok-color); +} + +.clipboard.success { + border-color: var(--fragment-copy-ok-color); +} + +div.line { + font-family: var(--font-family-monospace); + font-size: 13px; + min-height: 13px; + line-height: 1.2; + text-wrap: wrap; + word-break: break-all; + white-space: -moz-pre-wrap; /* Moz */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + white-space: pre-wrap; /* CSS3 */ + word-wrap: break-word; /* IE 5.5+ */ + text-indent: -62px; + padding-left: 62px; + padding-bottom: 0px; + margin: 0px; + -webkit-transition-property: background-color, box-shadow; + -webkit-transition-duration: 0.5s; + -moz-transition-property: background-color, box-shadow; + -moz-transition-duration: 0.5s; + -ms-transition-property: background-color, box-shadow; + -ms-transition-duration: 0.5s; + -o-transition-property: background-color, box-shadow; + -o-transition-duration: 0.5s; + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +div.line:after { + content:"\000A"; + white-space: pre; +} + +div.line.glow { + background-color: var(--glow-color); + box-shadow: 0 0 10px var(--glow-color); +} + +span.fold { + display: inline-block; + width: 12px; + height: 12px; + margin-left: 4px; + margin-right: 1px; +} + +span.foldnone { + display: inline-block; + position: relative; + cursor: pointer; + user-select: none; +} + +span.fold.plus, span.fold.minus { + width: 10px; + height: 10px; + background-color: var(--fragment-background-color); + position: relative; + border: 1px solid var(--fold-line-color); + margin-right: 1px; +} + +span.fold.plus::before, span.fold.minus::before { + content: ''; + position: absolute; + background-color: var(--fold-line-color); +} + +span.fold.plus::before { + width: 2px; + height: 6px; + top: 2px; + left: 4px; +} + +span.fold.plus::after { + content: ''; + position: absolute; + width: 6px; + height: 2px; + top: 4px; + left: 2px; + background-color: var(--fold-line-color); +} + +span.fold.minus::before { + width: 6px; + height: 2px; + top: 4px; + left: 2px; +} + +span.lineno { + padding-right: 4px; + margin-right: 9px; + text-align: right; + border-right: 2px solid var(--fragment-lineno-border-color); + color: var(--fragment-lineno-foreground-color); + background-color: var(--fragment-lineno-background-color); + white-space: pre; +} +span.lineno a, span.lineno a:visited { + color: var(--fragment-lineno-link-fg-color); + background-color: var(--fragment-lineno-link-bg-color); +} + +span.lineno a:hover { + color: var(--fragment-lineno-link-hover-fg-color); + background-color: var(--fragment-lineno-link-hover-bg-color); +} + +.lineno { + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +div.classindex ul { + list-style: none; + padding-left: 0; +} + +div.classindex span.ai { + display: inline-block; +} + +div.groupHeader { + box-shadow: 13px 0 var(--page-background-color), + -13px 0 var(--page-background-color), + 13px 1px var(--group-header-separator-color), + -13px 1px var(--group-header-separator-color); + color: var(--group-header-color); + font-size: 110%; + font-weight: 500; + margin-left: 0px; + margin-top: 0em; + margin-bottom: 6px; + padding-top: 8px; + padding-bottom: 4px; +} + +div.groupText { + margin-left: 16px; + font-style: italic; +} + +body { + color: var(--page-foreground-color); + margin: 0; +} + +div.contents { + margin-top: 10px; + margin-left: 12px; + margin-right: 12px; +} + +p.formulaDsp { + text-align: center; +} + +img.dark-mode-visible { + display: none; +} +img.light-mode-visible { + display: none; +} + +img.formulaInl, img.inline { + vertical-align: middle; +} + +div.center { + text-align: center; + margin-top: 0px; + margin-bottom: 0px; + padding: 0px; +} + +div.center img { + border: 0px; +} + +address.footer { + text-align: right; + padding-right: 12px; +} + +img.footer { + border: 0px; + vertical-align: middle; + width: var(--footer-logo-width); +} + +.compoundTemplParams { + color: var(--memdecl-template-color); + font-size: 80%; + line-height: 120%; +} + +/* @group Code Colorization */ + +span.keyword { + color: var(--code-keyword-color); +} + +span.keywordtype { + color: var(--code-type-keyword-color); +} + +span.keywordflow { + color: var(--code-flow-keyword-color); +} + +span.comment { + color: var(--code-comment-color); +} + +span.preprocessor { + color: var(--code-preprocessor-color); +} + +span.stringliteral { + color: var(--code-string-literal-color); +} + +span.charliteral { + color: var(--code-char-literal-color); +} + +span.xmlcdata { + color: var(--code-xml-cdata-color); +} + +span.vhdldigit { + color: var(--code-vhdl-digit-color); +} + +span.vhdlchar { + color: var(--code-vhdl-char-color); +} + +span.vhdlkeyword { + color: var(--code-vhdl-keyword-color); +} + +span.vhdllogic { + color: var(--code-vhdl-logic-color); +} + +blockquote { + background-color: var(--blockquote-background-color); + border-left: 2px solid var(--blockquote-border-color); + margin: 0 24px 0 4px; + padding: 0 12px 0 16px; +} + +/* @end */ + +td.tiny { + font-size: 75%; +} + +.dirtab { + padding: 4px; + border-collapse: collapse; + border: 1px solid var(--table-cell-border-color); +} + +th.dirtab { + background-color: var(--table-header-background-color); + color: var(--table-header-foreground-color); + font-weight: bold; +} + +hr { + border: none; + margin-top: 16px; + margin-bottom: 16px; + height: 1px; + box-shadow: 13px 0 var(--page-background-color), + -13px 0 var(--page-background-color), + 13px 1px var(--group-header-separator-color), + -13px 1px var(--group-header-separator-color); +} + +hr.footer { + height: 1px; +} + +/* @group Member Descriptions */ + +table.memberdecls { + border-spacing: 0px; + padding: 0px; +} + +.memberdecls td, .fieldtable tr { + transition-property: background-color, box-shadow; + transition-duration: 0.5s; +} + +.memberdecls td.glow, .fieldtable tr.glow { + background-color: var(--glow-color); + box-shadow: 0 0 15px var(--glow-color); +} + +.memberdecls tr[class^='memitem'] { + font-family: var(--font-family-monospace); +} + +.mdescLeft, .mdescRight, +.memItemLeft, .memItemRight { + padding-top: 2px; + padding-bottom: 2px; +} + +.memTemplParams { + padding-left: 10px; + padding-top: 5px; +} + +.memItemLeft, .memItemRight, .memTemplParams { + background-color: var(--memdecl-background-color); +} + +.mdescLeft, .mdescRight { + padding: 0px 8px 4px 8px; + color: var(--memdecl-foreground-color); +} + +tr[class^='memdesc'] { + box-shadow: inset 0px 1px 3px 0px rgba(0,0,0,.075); +} + +.mdescLeft { + border-left: 1px solid var(--memdecl-border-color); + border-bottom: 1px solid var(--memdecl-border-color); +} + +.mdescRight { + border-right: 1px solid var(--memdecl-border-color); + border-bottom: 1px solid var(--memdecl-border-color); +} + +.memTemplParams { + color: var(--memdecl-template-color); + white-space: nowrap; + font-size: 80%; + border-left: 1px solid var(--memdecl-border-color); + border-right: 1px solid var(--memdecl-border-color); +} + +td.ititle { + border: 1px solid var(--memdecl-border-color); + border-top-left-radius: 4px; + border-top-right-radius: 4px; + padding-left: 10px; +} + +tr:not(:first-child) > td.ititle { + border-top: 0; + border-radius: 0; +} + +.memItemLeft { + white-space: nowrap; + border-left: 1px solid var(--memdecl-border-color); + border-bottom: 1px solid var(--memdecl-border-color); + padding-left: 10px; + transition: none; +} + +.memItemRight { + width: 100%; + border-right: 1px solid var(--memdecl-border-color); + border-bottom: 1px solid var(--memdecl-border-color); + padding-right: 10px; + transition: none; +} + +tr.heading + tr[class^='memitem'] td.memItemLeft, +tr.groupHeader + tr[class^='memitem'] td.memItemLeft, +tr.inherit_header + tr[class^='memitem'] td.memItemLeft { + border-top: 1px solid var(--memdecl-border-color); + border-top-left-radius: 4px; +} + +tr.heading + tr[class^='memitem'] td.memItemRight, +tr.groupHeader + tr[class^='memitem'] td.memItemRight, +tr.inherit_header + tr[class^='memitem'] td.memItemRight { + border-top: 1px solid var(--memdecl-border-color); + border-top-right-radius: 4px; +} + +tr.heading + tr[class^='memitem'] td.memTemplParams, +tr.heading + tr td.ititle, +tr.groupHeader + tr[class^='memitem'] td.memTemplParams, +tr.groupHeader + tr td.ititle, +tr.inherit_header + tr[class^='memitem'] td.memTemplParams { + border-top: 1px solid var(--memdecl-border-color); + border-top-left-radius: 4px; + border-top-right-radius: 4px; +} + +table.memberdecls tr:last-child td.memItemLeft, +table.memberdecls tr:last-child td.mdescLeft, +table.memberdecls tr[class^='memitem']:has(+ tr.groupHeader) td.memItemLeft, +table.memberdecls tr[class^='memitem']:has(+ tr.inherit_header) td.memItemLeft, +table.memberdecls tr[class^='memdesc']:has(+ tr.groupHeader) td.mdescLeft, +table.memberdecls tr[class^='memdesc']:has(+ tr.inherit_header) td.mdescLeft { + border-bottom-left-radius: 4px; +} + +table.memberdecls tr:last-child td.memItemRight, +table.memberdecls tr:last-child td.mdescRight, +table.memberdecls tr[class^='memitem']:has(+ tr.groupHeader) td.memItemRight, +table.memberdecls tr[class^='memitem']:has(+ tr.inherit_header) td.memItemRight, +table.memberdecls tr[class^='memdesc']:has(+ tr.groupHeader) td.mdescRight, +table.memberdecls tr[class^='memdesc']:has(+ tr.inherit_header) td.mdescRight { + border-bottom-right-radius: 4px; +} + +tr.template .memItemLeft, tr.template .memItemRight { + border-top: none; + padding-top: 0; +} + + +/* @end */ + +/* @group Member Details */ + +/* Styles for detailed member documentation */ + +.memtitle { + padding: 8px; + border-top: 1px solid var(--memdef-border-color); + border-left: 1px solid var(--memdef-border-color); + border-right: 1px solid var(--memdef-border-color); + border-top-right-radius: 4px; + border-top-left-radius: 4px; + margin-bottom: -1px; + background-color: var(--memdef-proto-background-color); + line-height: 1.25; + font-family: var(--font-family-monospace); + font-weight: 500; + font-size: 16px; + float:left; + box-shadow: 0 10px 0 -1px var(--memdef-proto-background-color), + 0 2px 8px 0 rgba(0,0,0,.075); + position: relative; +} + +.memtitle:after { + content: ''; + display: block; + background: var(--memdef-proto-background-color); + height: 10px; + bottom: -10px; + left: 0px; + right: -14px; + position: absolute; + border-top-right-radius: 6px; +} + +.permalink +{ + font-family: var(--font-family-monospace); + font-weight: 500; + line-height: 1.25; + font-size: 16px; + display: inline-block; + vertical-align: middle; +} + +.memtemplate { + font-size: 80%; + color: var(--memdef-template-color); + font-family: var(--font-family-monospace); + font-weight: normal; + margin-left: 9px; +} + +.mempage { + width: 100%; +} + +.memitem { + padding: 0; + margin-bottom: 10px; + margin-right: 5px; + display: table !important; + width: 100%; + box-shadow: 0 2px 8px 0 rgba(0,0,0,.075); + border-radius: 4px; +} + +.memitem.glow { + box-shadow: 0 0 15px var(--glow-color); +} + +.memname { + font-family: var(--font-family-monospace); + font-size: 13px; + font-weight: 400; + margin-left: 6px; +} + +.memname td { + vertical-align: bottom; +} + +.memproto, dl.reflist dt { + border-top: 1px solid var(--memdef-border-color); + border-left: 1px solid var(--memdef-border-color); + border-right: 1px solid var(--memdef-border-color); + padding: 6px 0px 6px 0px; + color: var(--memdef-proto-text-color); + font-weight: bold; + background-color: var(--memdef-proto-background-color); + border-top-right-radius: 4px; + border-bottom: 1px solid var(--memdef-border-color); +} + +.overload { + font-family: var(--font-family-monospace); + font-size: 65%; +} + +.memdoc, dl.reflist dd { + border-bottom: 1px solid var(--memdef-border-color); + border-left: 1px solid var(--memdef-border-color); + border-right: 1px solid var(--memdef-border-color); + padding: 6px 10px 2px 10px; + border-top-width: 0; + border-bottom-left-radius: 4px; + border-bottom-right-radius: 4px; +} + +dl.reflist dt { + padding: 5px; +} + +dl.reflist dd { + margin: 0px 0px 10px 0px; + padding: 5px; +} + +.paramkey { + text-align: right; +} + +.paramtype { + white-space: nowrap; + padding: 0px; + padding-bottom: 1px; +} + +.paramname { + white-space: nowrap; + padding: 0px; + padding-bottom: 1px; + margin-left: 2px; +} + +.paramname em { + color: var(--memdef-param-name-color); + font-style: normal; + margin-right: 1px; +} + +.paramname .paramdefval { + font-family: var(--font-family-monospace); +} + +.params, .retval, .exception, .tparams { + margin-left: 0px; + padding-left: 0px; +} + +.params .paramname, .retval .paramname, .tparams .paramname, .exception .paramname { + font-weight: bold; + vertical-align: top; +} + +.params .paramtype, .tparams .paramtype { + font-style: italic; + vertical-align: top; +} + +.params .paramdir, .tparams .paramdir { + font-family: var(--font-family-monospace); + vertical-align: top; +} + +table.mlabels { + border-spacing: 0px; +} + +td.mlabels-left { + width: 100%; + padding: 0px; +} + +td.mlabels-right { + vertical-align: bottom; + padding: 0px; + white-space: nowrap; +} + +span.mlabels { + margin-left: 8px; +} + +span.mlabel { + background-color: var(--label-background-color); + border-top:1px solid var(--label-left-top-border-color); + border-left:1px solid var(--label-left-top-border-color); + border-right:1px solid var(--label-right-bottom-border-color); + border-bottom:1px solid var(--label-right-bottom-border-color); + text-shadow: none; + color: var(--label-foreground-color); + margin-right: 4px; + padding: 2px 3px; + border-radius: 3px; + font-size: 7pt; + white-space: nowrap; + vertical-align: middle; +} + + + +/* @end */ + +/* these are for tree view inside a (index) page */ + +div.directory { + margin: 10px 0px; + width: 100%; +} + +.directory table { + border-collapse:collapse; +} + +.directory td { + margin: 0px; + padding: 0px; + vertical-align: top; +} + +.directory td.entry { + white-space: nowrap; + padding-right: 6px; + padding-top: 3px; +} + +.directory td.entry a { + outline:none; +} + +.directory td.entry a img { + border: none; +} + +.directory td.desc { + width: 100%; + padding-left: 6px; + padding-right: 6px; + padding-top: 3px; + border-left: 1px solid rgba(0,0,0,0.05); +} + +.directory tr.odd { + padding-left: 6px; + background-color: var(--index-odd-item-bg-color); +} + +.directory tr.even { + padding-left: 6px; + background-color: var(--index-even-item-bg-color); +} + +.directory img { + vertical-align: -30%; +} + +.directory .levels { + white-space: nowrap; + width: 100%; + text-align: right; + font-size: 9pt; +} + +.directory .levels span { + cursor: pointer; + padding-left: 2px; + padding-right: 2px; + color: var(--page-link-color); +} + +.arrow { + color: var(--nav-background-color); + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; + cursor: pointer; + font-size: 80%; + display: inline-block; + width: 16px; + height: 14px; + transition: opacity 0.3s ease; +} + +span.arrowhead { + position: relative; + padding: 0; + margin: 0 0 0 2px; + display: inline-block; + width: 5px; + height: 5px; + border-right: 2px solid var(--nav-arrow-color); + border-bottom: 2px solid var(--nav-arrow-color); + transform: rotate(-45deg); + transition: transform 0.3s ease; +} + +span.arrowhead.opened { + transform: rotate(45deg); +} + +.selected span.arrowhead { + border-right: 2px solid var(--nav-arrow-selected-color); + border-bottom: 2px solid var(--nav-arrow-selected-color); +} + +.icon { + font-family: var(--font-family-icon); + line-height: normal; + font-weight: bold; + font-size: 12px; + height: 14px; + width: 16px; + display: inline-block; + background-color: var(--icon-background-color); + color: var(--icon-foreground-color); + text-align: center; + border-radius: 4px; + margin-left: 2px; + margin-right: 2px; +} + +.icona { + width: 24px; + height: 22px; + display: inline-block; +} + +.iconfolder { + width: 24px; + height: 18px; + margin-top: 6px; + vertical-align:top; + display: inline-block; + position: relative; +} + +.icondoc { + width: 24px; + height: 18px; + margin-top: 3px; + vertical-align:top; + display: inline-block; + position: relative; +} + +.folder-icon { + width: 16px; + height: 11px; + background-color: var(--icon-folder-fill-color); + border: 1px solid var(--icon-folder-border-color); + border-radius: 0 2px 2px 2px; + position: relative; + box-sizing: content-box; +} + +.folder-icon::after { + content: ''; + position: absolute; + top: 2px; + left: -1px; + width: 16px; + height: 7px; + background-color: var(--icon-folder-open-fill-color); + border: 1px solid var(--icon-folder-border-color); + border-radius: 7px 7px 2px 2px; + transform-origin: top left; + opacity: 0; + transition: all 0.3s linear; +} + +.folder-icon::before { + content: ''; + position: absolute; + top: -3px; + left: -1px; + width: 6px; + height: 2px; + background-color: var(--icon-folder-fill-color); + border-top: 1px solid var(--icon-folder-border-color); + border-left: 1px solid var(--icon-folder-border-color); + border-right: 1px solid var(--icon-folder-border-color); + border-radius: 2px 2px 0 0; +} + +.folder-icon.open::after { + top: 3px; + opacity: 1; +} + +.doc-icon { + left: 6px; + width: 12px; + height: 16px; + background-color: var(--icon-doc-border-color); + clip-path: polygon(0 0, 66% 0, 100% 25%, 100% 100%, 0 100%); + position: relative; + display: inline-block; +} +.doc-icon::before { + content: ""; + left: 1px; + top: 1px; + width: 10px; + height: 14px; + background-color: var(--icon-doc-fill-color); + clip-path: polygon(0 0, 66% 0, 100% 25%, 100% 100%, 0 100%); + position: absolute; + box-sizing: border-box; +} +.doc-icon::after { + content: ""; + left: 7px; + top: 0px; + width: 3px; + height: 3px; + background-color: transparent; + position: absolute; + border: 1px solid var(--icon-doc-border-color); +} + + + + +/* @end */ + +div.dynheader { + margin-top: 8px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +span.dynarrow { + position: relative; + display: inline-block; + width: 12px; + bottom: 1px; +} + +address { + font-style: normal; + color: var(--footer-foreground-color); +} + +table.doxtable caption { + caption-side: top; +} + +table.doxtable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.doxtable td, table.doxtable th { + border: 1px solid var(--table-cell-border-color); + padding: 3px 7px 2px; +} + +table.doxtable th { + background-color: var(--table-header-background-color); + color: var(--table-header-foreground-color); + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +table.fieldtable { + margin-bottom: 10px; + border: 1px solid var(--memdef-border-color); + border-spacing: 0px; + border-radius: 4px; + box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.15); +} + +.fieldtable td, .fieldtable th { + padding: 3px 7px 2px; +} + +.fieldtable td.fieldtype, .fieldtable td.fieldname, .fieldtable td.fieldinit { + white-space: nowrap; + border-right: 1px solid var(--memdef-border-color); + border-bottom: 1px solid var(--memdef-border-color); + vertical-align: top; +} + +.fieldtable td.fieldname { + padding-top: 3px; +} + +.fieldtable td.fieldinit { + padding-top: 3px; + text-align: right; +} + + +.fieldtable td.fielddoc { + border-bottom: 1px solid var(--memdef-border-color); +} + +.fieldtable td.fielddoc p:first-child { + margin-top: 0px; +} + +.fieldtable td.fielddoc p:last-child { + margin-bottom: 2px; +} + +.fieldtable tr:last-child td { + border-bottom: none; +} + +.fieldtable th { + background-color: var(--memdef-title-background-color); + font-size: 90%; + color: var(--memdef-proto-text-color); + padding-bottom: 4px; + padding-top: 5px; + text-align:left; + font-weight: 400; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom: 1px solid var(--memdef-border-color); +} + +/* ----------- navigation breadcrumb styling ----------- */ + +#nav-path ul { + height: 30px; + line-height: 30px; + color: var(--nav-text-normal-color); + overflow: hidden; + margin: 0px; + padding-left: 4px; + background-image: none; + background: var(--page-background-color); + border-bottom: 1px solid var(--nav-breadcrumb-separator-color); + font-size: var(--nav-font-size-level1); + font-family: var(--font-family-nav); + position: relative; + z-index: 100; +} + +#main-nav { + border-bottom: 1px solid var(--nav-border-color); +} + +.navpath li { + list-style-type:none; + float:left; + color: var(--nav-foreground-color); +} + +.navpath li.footer { + list-style-type:none; + float:right; + padding-left:10px; + padding-right:15px; + background-image:none; + background-repeat:no-repeat; + background-position:right; + font-size: 8pt; + color: var(--footer-foreground-color); +} + +#nav-path li.navelem { + background-image: none; + display: flex; + align-items: center; + padding-left: 15px; +} + +.navpath li.navelem a { + text-shadow: none; + display: inline-block; + color: var(--nav-breadcrumb-color); + position: relative; + top: 0px; + height: 30px; + margin-right: -20px; +} + +#nav-path li.navelem:after { + content: ''; + display: inline-block; + position: relative; + top: 0; + right: -15px; + width: 30px; + height: 30px; + transform: scaleX(0.5) scale(0.707) rotate(45deg); + z-index: 10; + background: var(--page-background-color); + box-shadow: 2px -2px 0 2px var(--nav-breadcrumb-separator-color); + border-radius: 0 5px 0 50px; +} + +#nav-path li.navelem:first-child { + margin-left: -6px; +} + +#nav-path li.navelem:hover, +#nav-path li.navelem:hover:after { + background-color: var(--nav-breadcrumb-active-bg); +} + +/* ---------------------- */ + +div.summary +{ + float: right; + font-size: 8pt; + padding-right: 5px; + width: 50%; + text-align: right; +} + +div.summary a +{ + white-space: nowrap; +} + +table.classindex +{ + margin: 10px; + white-space: nowrap; + margin-left: 3%; + margin-right: 3%; + width: 94%; + border: 0; + border-spacing: 0; + padding: 0; +} + +div.ingroups +{ + font-size: 8pt; + width: 50%; + text-align: left; +} + +div.ingroups a +{ + white-space: nowrap; +} + +div.header +{ + margin: 0px; + background-color: var(--header-background-color); + border-bottom: 1px solid var(--header-separator-color); +} + +div.headertitle +{ + padding: 5px 5px 5px 10px; +} + +dl { + padding: 0 0 0 0; +} + +dl.bug dt a, dl.deprecated dt a, dl.todo dt a, dl.test a { + font-weight: bold !important; +} + +dl.warning, dl.attention, dl.important, dl.note, dl.deprecated, dl.bug, +dl.invariant, dl.pre, dl.post, dl.todo, dl.test, dl.remark { + padding: 10px; + margin: 10px 0px; + overflow: hidden; + margin-left: 0; + border-radius: 4px; +} + +dl.section dd { + margin-bottom: 2px; +} + +dl.warning, dl.attention, dl.important { + background: var(--warning-color-bg); + border-left: 8px solid var(--warning-color-hl); + color: var(--warning-color-text); +} + +dl.warning dt, dl.attention dt, dl.important dt { + color: var(--warning-color-hl); +} + +dl.note, dl.remark { + background: var(--note-color-bg); + border-left: 8px solid var(--note-color-hl); + color: var(--note-color-text); +} + +dl.note dt, dl.remark dt { + color: var(--note-color-hl); +} + +dl.todo { + background: var(--todo-color-bg); + border-left: 8px solid var(--todo-color-hl); + color: var(--todo-color-text); +} + +dl.todo dt { + color: var(--todo-color-hl); +} + +dl.test { + background: var(--test-color-bg); + border-left: 8px solid var(--test-color-hl); + color: var(--test-color-text); +} + +dl.test dt { + color: var(--test-color-hl); +} + +dl.bug dt a { + color: var(--bug-color-hl) !important; +} + +dl.bug { + background: var(--bug-color-bg); + border-left: 8px solid var(--bug-color-hl); + color: var(--bug-color-text); +} + +dl.bug dt a { + color: var(--bug-color-hl) !important; +} + +dl.deprecated { + background: var(--deprecated-color-bg); + border-left: 8px solid var(--deprecated-color-hl); + color: var(--deprecated-color-text); +} + +dl.deprecated dt a { + color: var(--deprecated-color-hl) !important; +} + +dl.note dd, dl.warning dd, dl.pre dd, dl.post dd, +dl.remark dd, dl.attention dd, dl.important dd, dl.invariant dd, +dl.bug dd, dl.deprecated dd, dl.todo dd, dl.test dd { + margin-inline-start: 0px; +} + +dl.invariant, dl.pre, dl.post { + background: var(--invariant-color-bg); + border-left: 8px solid var(--invariant-color-hl); + color: var(--invariant-color-text); +} + +dl.invariant dt, dl.pre dt, dl.post dt { + color: var(--invariant-color-hl); +} + + +#projectrow +{ + height: 56px; +} + +#projectlogo +{ + text-align: center; + vertical-align: bottom; + border-collapse: separate; +} + +#projectlogo img +{ + border: 0px none; +} + +#projectalign +{ + vertical-align: middle; + padding-left: 0.5em; +} + +#projectname +{ + font-size: 200%; + font-family: var(--font-family-title); + margin: 0; + padding: 0; +} + +#side-nav #projectname +{ + font-size: 130%; +} + +#projectbrief +{ + font-size: 90%; + font-family: var(--font-family-title); + margin: 0px; + padding: 0px; +} + +#projectnumber +{ + font-size: 50%; + font-family: var(--font-family-title); + margin: 0px; + padding: 0px; +} + +#titlearea +{ + padding: 0 0 0 5px; + margin: 0px; + border-bottom: 1px solid var(--title-separator-color); + background-color: var(--title-background-color); +} + +.image +{ + text-align: center; +} + +.dotgraph +{ + text-align: center; +} + +.mscgraph +{ + text-align: center; +} + +.plantumlgraph +{ + text-align: center; +} + +.diagraph +{ + text-align: center; +} + +.caption +{ + font-weight: bold; +} + +dl.citelist { + margin-bottom:50px; +} + +dl.citelist dt { + color:var(--citation-label-color); + float:left; + font-weight:bold; + margin-right:10px; + padding:5px; + text-align:right; + width:52px; +} + +dl.citelist dd { + margin:2px 0 2px 72px; + padding:5px 0; +} + +div.toc { + padding: 14px 25px; + background-color: var(--toc-background-color); + border: 1px solid var(--toc-border-color); + border-radius: 7px 7px 7px 7px; + float: right; + height: auto; + margin: 0 8px 10px 10px; + width: 200px; +} + +div.toc li { + background: var(--toc-down-arrow-image) no-repeat scroll 0 5px transparent; + font: 10px/1.2 var(--font-family-toc); + margin-top: 5px; + padding-left: 10px; + padding-top: 2px; +} + +div.toc h3 { + font: bold 12px/1.2 var(--font-family-toc); + color: var(--toc-header-color); + border-bottom: 0 none; + margin: 0; +} + +div.toc ul { + list-style: none outside none; + border: medium none; + padding: 0px; +} + +div.toc li[class^='level'] { + margin-left: 15px; +} + +div.toc li.level1 { + margin-left: 0px; +} + +div.toc li.empty { + background-image: none; + margin-top: 0px; +} + +span.emoji { + /* font family used at the site: https://unicode.org/emoji/charts/full-emoji-list.html + * font-family: "Noto Color Emoji", "Apple Color Emoji", "Segoe UI Emoji", Times, Symbola, Aegyptus, Code2000, Code2001, Code2002, Musica, serif, LastResort; + */ +} + +span.obfuscator { + display: none; +} + +.inherit_header { + font-weight: 400; + cursor: pointer; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.inherit_header td { + padding: 6px 0 2px 0; +} + +.inherit { + display: none; +} + +tr.heading h2 { + margin-top: 12px; + margin-bottom: 12px; +} + +/* tooltip related style info */ + +.ttc { + position: absolute; + display: none; +} + +#powerTip { + cursor: default; + color: var(--tooltip-foreground-color); + background-color: var(--tooltip-background-color); + backdrop-filter: var(--tooltip-backdrop-filter); + -webkit-backdrop-filter: var(--tooltip-backdrop-filter); + border: 1px solid var(--tooltip-border-color); + border-radius: 4px; + box-shadow: var(--tooltip-shadow); + display: none; + font-size: smaller; + max-width: 80%; + padding: 1ex 1em 1em; + position: absolute; + z-index: 2147483647; +} + +#powerTip div.ttdoc { + color: var(--tooltip-doc-color); + font-style: italic; +} + +#powerTip div.ttname a { + font-weight: bold; +} + +#powerTip a { + color: var(--tooltip-link-color); +} + +#powerTip div.ttname { + font-weight: bold; +} + +#powerTip div.ttdeci { + color: var(--tooltip-declaration-color); +} + +#powerTip div { + margin: 0px; + padding: 0px; + font-size: 12px; + font-family: var(--font-family-tooltip); + line-height: 16px; +} + +#powerTip:before, #powerTip:after { + content: ""; + position: absolute; + margin: 0px; +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.s:after, #powerTip.s:before, +#powerTip.w:after, #powerTip.w:before, +#powerTip.e:after, #powerTip.e:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.nw:after, #powerTip.nw:before, +#powerTip.sw:after, #powerTip.sw:before { + border: solid transparent; + content: " "; + height: 0; + width: 0; + position: absolute; +} + +#powerTip.n:after, #powerTip.s:after, +#powerTip.w:after, #powerTip.e:after, +#powerTip.nw:after, #powerTip.ne:after, +#powerTip.sw:after, #powerTip.se:after { + border-color: rgba(255, 255, 255, 0); +} + +#powerTip.n:before, #powerTip.s:before, +#powerTip.w:before, #powerTip.e:before, +#powerTip.nw:before, #powerTip.ne:before, +#powerTip.sw:before, #powerTip.se:before { + border-color: rgba(128, 128, 128, 0); +} + +#powerTip.n:after, #powerTip.n:before, +#powerTip.ne:after, #powerTip.ne:before, +#powerTip.nw:after, #powerTip.nw:before { + top: 100%; +} + +#powerTip.n:after, #powerTip.ne:after, #powerTip.nw:after { + border-top-color: var(--tooltip-arrow-background-color); + border-width: 10px; + margin: 0px -10px; +} +#powerTip.n:before, #powerTip.ne:before, #powerTip.nw:before { + border-top-color: var(--tooltip-border-color); + border-width: 11px; + margin: 0px -11px; +} +#powerTip.n:after, #powerTip.n:before { + left: 50%; +} + +#powerTip.nw:after, #powerTip.nw:before { + right: 14px; +} + +#powerTip.ne:after, #powerTip.ne:before { + left: 14px; +} + +#powerTip.s:after, #powerTip.s:before, +#powerTip.se:after, #powerTip.se:before, +#powerTip.sw:after, #powerTip.sw:before { + bottom: 100%; +} + +#powerTip.s:after, #powerTip.se:after, #powerTip.sw:after { + border-bottom-color: var(--tooltip-arrow-background-color); + border-width: 10px; + margin: 0px -10px; +} + +#powerTip.s:before, #powerTip.se:before, #powerTip.sw:before { + border-bottom-color: var(--tooltip-border-color); + border-width: 11px; + margin: 0px -11px; +} + +#powerTip.s:after, #powerTip.s:before { + left: 50%; +} + +#powerTip.sw:after, #powerTip.sw:before { + right: 14px; +} + +#powerTip.se:after, #powerTip.se:before { + left: 14px; +} + +#powerTip.e:after, #powerTip.e:before { + left: 100%; +} +#powerTip.e:after { + border-left-color: var(--tooltip-border-color); + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.e:before { + border-left-color: var(--tooltip-border-color); + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +#powerTip.w:after, #powerTip.w:before { + right: 100%; +} +#powerTip.w:after { + border-right-color: var(--tooltip-border-color); + border-width: 10px; + top: 50%; + margin-top: -10px; +} +#powerTip.w:before { + border-right-color: var(--tooltip-border-color); + border-width: 11px; + top: 50%; + margin-top: -11px; +} + +@media print +{ + #top { display: none; } + #side-nav { display: none; } + #nav-path { display: none; } + body { overflow:visible; } + h1, h2, h3, h4, h5, h6 { page-break-after: avoid; } + .summary { display: none; } + .memitem { page-break-inside: avoid; } + #doc-content + { + margin-left:0 !important; + height:auto !important; + width:auto !important; + overflow:inherit; + display:inline; + } +} + +/* @group Markdown */ + +table.markdownTable { + border-collapse:collapse; + margin-top: 4px; + margin-bottom: 4px; +} + +table.markdownTable td, table.markdownTable th { + border: 1px solid var(--table-cell-border-color); + padding: 3px 7px 2px; +} + +table.markdownTable tr { +} + +th.markdownTableHeadLeft, th.markdownTableHeadRight, th.markdownTableHeadCenter, th.markdownTableHeadNone { + background-color: var(--table-header-background-color); + color: var(--table-header-foreground-color); + font-size: 110%; + padding-bottom: 4px; + padding-top: 5px; +} + +th.markdownTableHeadLeft, td.markdownTableBodyLeft { + text-align: left +} + +th.markdownTableHeadRight, td.markdownTableBodyRight { + text-align: right +} + +th.markdownTableHeadCenter, td.markdownTableBodyCenter { + text-align: center +} + +tt, code, kbd +{ + display: inline-block; +} +tt, code, kbd +{ + vertical-align: top; +} +/* @end */ + +u { + text-decoration: underline; +} + +details>summary { + list-style-type: none; +} + +details > summary::-webkit-details-marker { + display: none; +} + +details>summary::before { + content: "\25ba"; + padding-right:4px; + font-size: 80%; +} + +details[open]>summary::before { + content: "\25bc"; + padding-right:4px; + font-size: 80%; +} + +:root { + scrollbar-width: thin; + scrollbar-color: var(--scrollbar-thumb-color) var(--scrollbar-background-color); +} + +::-webkit-scrollbar { + background-color: var(--scrollbar-background-color); + height: 12px; + width: 12px; +} +::-webkit-scrollbar-thumb { + border-radius: 6px; + box-shadow: inset 0 0 12px 12px var(--scrollbar-thumb-color); + border: solid 2px transparent; +} +::-webkit-scrollbar-corner { + background-color: var(--scrollbar-background-color); +} + diff --git a/docs/html/doxygen.svg b/docs/html/doxygen.svg new file mode 100644 index 0000000..79a7635 --- /dev/null +++ b/docs/html/doxygen.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/html/doxygen_crawl.html b/docs/html/doxygen_crawl.html new file mode 100644 index 0000000..87ebb49 --- /dev/null +++ b/docs/html/doxygen_crawl.html @@ -0,0 +1,1978 @@ + + + +Validator / crawler helper + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/docs/html/dump_8c.html b/docs/html/dump_8c.html new file mode 100644 index 0000000..b8a5d32 --- /dev/null +++ b/docs/html/dump_8c.html @@ -0,0 +1,560 @@ + + + + + + + +libaaruformat: src/dump.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
dump.c File Reference
+
+
+ +

Go to the source code of this file.

+ + + +

+Macros

#define COPY_STRING_FIELD(field)
+ + + + + + +

+Functions

static void free_dump_hardware_entries (DumpHardwareEntriesWithData *entries, uint32_t count)
int32_t aaruf_get_dumphw (void *context, uint8_t *buffer, size_t *length)
 Retrieves the dump hardware block containing acquisition environment information.
int32_t aaruf_set_dumphw (void *context, uint8_t *data, size_t length)
 Sets the dump hardware block for the image during creation.
+

Macro Definition Documentation

+ +

◆ COPY_STRING_FIELD

+ +
+
+ + + + + + + +
#define COPY_STRING_FIELD( field)
+
+Value:
do { \
+
const size_t field##_length = copy[e].entry.field##Length; \
+
if(field##_length > 0) \
+
{ \
+
if(field##_length > length - pos) goto invalid_data; \
+
copy[e].field = (uint8_t *)calloc(1, field##_length + 1); \
+
if(copy[e].field == NULL) goto free_copy_and_error; \
+
memcpy(copy[e].field, data + pos, field##_length); \
+
pos += field##_length; \
+
} \
+
} while(0)
+
+

Referenced by aaruf_set_dumphw().

+ +
+
+

Function Documentation

+ +

◆ aaruf_get_dumphw()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_get_dumphw (void * context,
uint8_t * buffer,
size_t * length )
+
+ +

Retrieves the dump hardware block containing acquisition environment information.

+

Extracts the complete DumpHardwareBlock from the image, which documents the hardware and software environments used to create the image. A dump hardware block records one or more "dump environments" – typically combinations of physical devices (drives, controllers, adapters) and the software stacks that performed the read operations. This metadata is essential for understanding the imaging context, validating acquisition integrity, reproducing imaging conditions, and supporting forensic or archival documentation requirements.

+

Each environment entry includes hardware identification (manufacturer, model, revision, firmware, serial number), software identification (name, version, operating system), and optional extent ranges that specify which logical sectors or units were contributed by that particular environment. This structure supports complex imaging scenarios where multiple devices or software configurations were used to create a composite image.

+

The function reconstructs the complete on-disk binary representation of the dump hardware block, including the DumpHardwareHeader followed by all entries with their variable-length UTF-8 strings and extent arrays. The reconstructed block includes a calculated CRC64 checksum over the payload data for integrity verification.

+

This function supports a two-call pattern for buffer size determination:

    +
  1. First call with insufficient buffer (or NULL) returns AARUF_ERROR_BUFFER_TOO_SMALL and sets *length to the required size (sizeof(DumpHardwareHeader) + total payload length)
  2. +
  3. Second call with properly sized buffer retrieves the complete block data
  4. +
+

Alternatively, if the caller already knows the buffer is large enough, a single call will succeed and populate the buffer with the complete dump hardware block.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, opened image context).
bufferPointer to a buffer that will receive the dump hardware block data. Must be large enough to hold the complete block (at least *length bytes on input). May be NULL to query the required buffer size. The buffer will contain the DumpHardwareHeader followed by serialized entries, strings, and extent arrays on success.
lengthPointer to a size_t that serves dual purpose:
    +
  • On input: size of the provided buffer in bytes (ignored if buffer is NULL)
  • +
  • On output: actual size required/used for the dump hardware block in bytes If the function returns AARUF_ERROR_BUFFER_TOO_SMALL, this will be updated to contain the required buffer size for a subsequent successful call.
  • +
+
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully retrieved dump hardware block. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The dump hardware block is present (identifier == DumpHardwareBlock)
  • +
  • The provided buffer is large enough (>= required length)
  • +
  • All hardware entries with their strings and extents are copied to the buffer
  • +
  • The DumpHardwareHeader is written with calculated CRC64 at buffer offset 0
  • +
  • The *length parameter is set to the actual block size
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_open() or aaruf_create()
  • +
+
AARUF_ERROR_CANNOT_READ_BLOCK(-6) The dump hardware block is not present. This occurs when:
    +
  • The image was created without dump hardware information
  • +
  • ctx->dumpHardwareEntriesWithData is NULL (no data loaded)
  • +
  • ctx->dumpHardwareHeader.entries == 0 (no hardware entries)
  • +
  • ctx->dumpHardwareHeader.identifier doesn't equal DumpHardwareBlock
  • +
  • The dump hardware block was not found during image opening
  • +
+
AARUF_ERROR_BUFFER_TOO_SMALL(-12) The provided buffer is insufficient. This occurs when:
    +
  • buffer is NULL (size query mode)
  • +
  • The input *length is less than sizeof(DumpHardwareHeader) + payload length
  • +
  • The *length parameter is updated to contain the required buffer size
  • +
  • No data is copied to the buffer
  • +
  • The caller should allocate a larger buffer and call again
  • +
  • Also returned if calculated entry size exceeds buffer during iteration (sanity check)
  • +
+
+
+
+
Note
Dump Hardware Block Structure:
    +
  • DumpHardwareHeader (16 bytes): identifier, entries count, payload length, CRC64
  • +
  • For each entry (variable size):
      +
    • DumpHardwareEntry (36 bytes): length fields for all strings and extent count
    • +
    • Variable-length UTF-8 strings (in order): manufacturer, model, revision, firmware, serial, software name, software version, software operating system
    • +
    • Array of DumpExtent structures (16 bytes each) if extent count > 0
    • +
    +
  • +
  • All strings are UTF-8 encoded and NOT null-terminated in the serialized block
  • +
  • String lengths are in bytes, not character counts
  • +
+
+
+Dump Hardware Environments:
    +
  • Each entry represents one hardware/software combination used during imaging
  • +
  • Multiple entries support scenarios where different devices contributed different sectors
  • +
  • Extent arrays specify which logical sector ranges each environment contributed
  • +
  • Empty extent arrays (extents == 0) indicate the environment dumped the entire medium
  • +
  • Overlapping extents between entries may indicate verification passes or redundancy
  • +
+
+
+Hardware Identification Fields:
    +
  • manufacturer: Device manufacturer (e.g., "Plextor", "Sony", "Samsung")
  • +
  • model: Device model number (e.g., "PX-716A", "DRU-820A")
  • +
  • revision: Hardware revision identifier
  • +
  • firmware: Firmware version (e.g., "1.11", "KY08")
  • +
  • serial: Device serial number for unique identification
  • +
+
+
+Software Identification Fields:
    +
  • softwareName: Dumping software name (e.g., "Aaru", "ddrescue", "IsoBuster")
  • +
  • softwareVersion: Software version (e.g., "5.3.0", "1.25")
  • +
  • softwareOperatingSystem: Host OS (e.g., "Linux 5.10.0", "Windows 10", "macOS 12.0")
  • +
+
+
+CRC64 Calculation:
    +
  • The function calculates CRC64-ECMA over the payload (everything after the header)
  • +
  • The calculated CRC64 is stored in the returned DumpHardwareHeader
  • +
  • This allows verification of the serialized block integrity
  • +
  • The CRC64 is computed from buffer data, not from the original context
  • +
+
+
+Buffer Layout After Successful Call:
    +
  • Offset 0: DumpHardwareHeader with calculated CRC64
  • +
  • Offset 16: First DumpHardwareEntry
  • +
  • Followed by: First entry's UTF-8 strings (in documented order)
  • +
  • Followed by: First entry's DumpExtent array (if extents > 0)
  • +
  • Repeated for all remaining entries
  • +
+
+
+Use Cases:
    +
  • Forensic documentation requiring complete equipment chain of custody
  • +
  • Archival metadata for long-term preservation requirements
  • +
  • Reproducing imaging conditions for verification or re-imaging
  • +
  • Identifying firmware-specific issues or drive-specific behaviors
  • +
  • Multi-device imaging scenario documentation
  • +
  • Correlating imaging artifacts with specific hardware/software combinations
  • +
+
+
Warning
This function reads from the in-memory dump hardware data loaded during aaruf_open(). It does not perform file I/O operations. The data is reconstructed from the parsed context structures into the on-disk binary format.
+
+The buffer must be valid and large enough to hold the entire dump hardware block. Passing a buffer smaller than required will result in AARUF_ERROR_BUFFER_TOO_SMALL.
+
+String data in the serialized block is NOT null-terminated. Applications parsing the buffer must use the length fields in DumpHardwareEntry to determine string boundaries. The library adds null terminators only for in-memory convenience.
+
+The function performs bounds checking during serialization. If calculated entry sizes exceed the buffer length, AARUF_ERROR_BUFFER_TOO_SMALL is returned even after the initial size check. This should not occur with properly sized buffers but protects against data corruption.
+
See also
DumpHardwareHeader for the block header structure definition.
+
+DumpHardwareEntry for the per-environment entry structure definition.
+
+DumpExtent for the extent range structure definition.
+
+process_dumphw_block() for the loading process during image opening.
+ +

Definition at line 186 of file dump.c.

+ +

References AARU_MAGIC, aaruf_crc64_data(), AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, DumpHardwareHeader::crc64, aaruformat_context::dump_hardware_entries_with_data, aaruformat_context::dump_hardware_header, DumpHardwareBlock, DumpHardwareHeader::entries, DumpHardwareEntriesWithData::entry, DumpHardwareEntriesWithData::extents, DumpHardwareEntry::extents, FATAL, DumpHardwareEntriesWithData::firmware, DumpHardwareEntry::firmwareLength, DumpHardwareHeader::identifier, DumpHardwareHeader::length, aaruformat_context::magic, DumpHardwareEntriesWithData::manufacturer, DumpHardwareEntry::manufacturerLength, DumpHardwareEntriesWithData::model, DumpHardwareEntry::modelLength, DumpHardwareEntriesWithData::revision, DumpHardwareEntry::revisionLength, DumpHardwareEntriesWithData::serial, DumpHardwareEntry::serialLength, DumpHardwareEntriesWithData::softwareName, DumpHardwareEntry::softwareNameLength, DumpHardwareEntriesWithData::softwareOperatingSystem, DumpHardwareEntry::softwareOperatingSystemLength, DumpHardwareEntriesWithData::softwareVersion, DumpHardwareEntry::softwareVersionLength, and TRACE.

+ +
+
+ +

◆ aaruf_set_dumphw()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t aaruf_set_dumphw (void * context,
uint8_t * data,
size_t length )
+
+ +

Sets the dump hardware block for the image during creation.

+

Embeds dump hardware information into the image being created. The dump hardware block documents the hardware and software environments used to create the image, recording one or more "dump +environments" – typically combinations of physical devices (drives, controllers, adapters) and the software stacks that performed the read operations. This metadata is essential for understanding the imaging context, validating acquisition integrity, reproducing imaging conditions, and supporting forensic or archival documentation requirements.

+

Each environment entry includes hardware identification (manufacturer, model, revision, firmware, serial number), software identification (name, version, operating system), and optional extent ranges that specify which logical sectors or units were contributed by that particular environment. This structure supports complex imaging scenarios where multiple devices or software configurations were used to create a composite image.

+

The function accepts a complete, pre-serialized DumpHardwareBlock in the on-disk binary format (as returned by aaruf_get_dumphw() or manually constructed). The block is validated for correct identifier, length consistency, and CRC64 integrity before being parsed and stored in the context. The function deserializes the binary block, extracts all entries with their variable-length UTF-8 strings and extent arrays, and creates null-terminated in-memory copies for internal use.

+

Validation performed:

    +
  1. Context validation (non-NULL, correct magic, write mode)
  2. +
  3. Data buffer validation (non-NULL, non-zero length)
  4. +
  5. Block identifier validation (must be DumpHardwareBlock)
  6. +
  7. Length consistency (buffer length must equal sizeof(DumpHardwareHeader) + header.length)
  8. +
  9. CRC64 integrity verification (calculated CRC64 must match header.crc64)
  10. +
+

Parsing process:

    +
  1. Read and validate the DumpHardwareHeader from the buffer
  2. +
  3. Allocate array for all dump hardware entries
  4. +
  5. For each entry:
      +
    • Read the DumpHardwareEntry structure (36 bytes)
    • +
    • Allocate and copy each non-empty UTF-8 string with +1 byte for null terminator
    • +
    • Allocate and copy the DumpExtent array if extents > 0
    • +
    +
  6. +
  7. Free any previously set dump hardware data
  8. +
  9. Store the new parsed data in ctx->dumpHardwareEntriesWithData
  10. +
  11. Store the header in ctx->dumpHardwareHeader
  12. +
+

Memory management: If any memory allocation fails during parsing, all previously allocated memory for the new data is freed via the free_copy_and_error label, and AARUF_ERROR_NOT_ENOUGH_MEMORY is returned. Any existing dump hardware data in the context is freed before storing new data, ensuring no memory leaks when replacing dump hardware information.

+
Parameters
+ + + + +
contextPointer to the aaruformat context (must be a valid, write-enabled image context).
dataPointer to the dump hardware block data in on-disk binary format. Must contain a complete DumpHardwareBlock starting with DumpHardwareHeader followed by all entries, strings, and extent arrays. Must not be NULL.
lengthLength of the dump hardware block data in bytes. Must equal sizeof(DumpHardwareHeader) + header.length for validation to succeed.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + + +
AARUF_STATUS_OK(0) Successfully set dump hardware block. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • The context is opened in write mode (ctx->isWriting is true)
  • +
  • The data buffer contains a valid DumpHardwareBlock
  • +
  • The block identifier is DumpHardwareBlock
  • +
  • The length is consistent (buffer length == header size + payload length)
  • +
  • The CRC64 checksum is valid
  • +
  • All memory allocations succeeded
  • +
  • All entries with strings and extents are parsed and stored
  • +
  • Any previous dump hardware data is freed
  • +
  • ctx->dumpHardwareEntriesWithData is populated with parsed entries
  • +
  • ctx->dumpHardwareHeader is updated with the new header
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
  • The context was not properly initialized by aaruf_create()
  • +
+
AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
    +
  • The image was opened with aaruf_open() instead of aaruf_create()
  • +
  • The context's isWriting flag is false
  • +
  • Attempting to modify a read-only image
  • +
+
AARUF_ERROR_CANNOT_READ_BLOCK(-6) Invalid block identifier. This occurs when:
    +
  • The identifier field in the DumpHardwareHeader doesn't equal DumpHardwareBlock
  • +
  • The data buffer doesn't contain a valid dump hardware block
  • +
  • The block type is incorrect or corrupted
  • +
+
AARUF_ERROR_INCORRECT_DATA_SIZE(-11) Invalid data or length. This occurs when:
    +
  • The data parameter is NULL
  • +
  • The length parameter is 0 (empty block)
  • +
  • The buffer length doesn't match sizeof(DumpHardwareHeader) + header.length
  • +
  • Length inconsistency indicates corrupted or incomplete block data
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-10) CRC64 checksum mismatch. This occurs when:
    +
  • The calculated CRC64 over the payload doesn't match header.crc64
  • +
  • Block data is corrupted or tampered with
  • +
  • Block was not properly constructed or serialized
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
    +
  • calloc() or malloc() failed to allocate memory for entries array
  • +
  • Failed to allocate memory for any string field (manufacturer, model, etc.)
  • +
  • Failed to allocate memory for extent arrays
  • +
  • System is out of memory or memory is severely fragmented
  • +
  • All partially allocated memory is freed before returning
  • +
+
+
+
+
Note
Dump Hardware Block Format:
    +
  • The data buffer must contain a complete serialized DumpHardwareBlock
  • +
  • Format: DumpHardwareHeader + repeated entries with strings and extents
  • +
  • All strings are UTF-8 encoded and NOT null-terminated in the buffer
  • +
  • The function adds null terminators when copying strings to internal storage
  • +
  • String lengths are in bytes, not character counts
  • +
+
+
+Creating Block Data:
    +
  • Use aaruf_get_dumphw() to retrieve a block from an existing image
  • +
  • Manually construct by serializing DumpHardwareHeader, entries, strings, and extents
  • +
  • Calculate CRC64-ECMA over the payload (everything after the header)
  • +
  • Ensure all length fields accurately reflect the data sizes
  • +
  • Ensure total buffer size equals sizeof(DumpHardwareHeader) + payload length
  • +
+
+
+Hardware Identification Fields:
    +
  • manufacturer: Device manufacturer (e.g., "Plextor", "Sony", "Samsung")
  • +
  • model: Device model number (e.g., "PX-716A", "DRU-820A")
  • +
  • revision: Hardware revision identifier
  • +
  • firmware: Firmware version (e.g., "1.11", "KY08")
  • +
  • serial: Device serial number for unique identification
  • +
+
+
+Software Identification Fields:
    +
  • softwareName: Dumping software name (e.g., "Aaru", "ddrescue", "IsoBuster")
  • +
  • softwareVersion: Software version (e.g., "5.3.0", "1.25")
  • +
  • softwareOperatingSystem: Host OS (e.g., "Linux 5.10.0", "Windows 10", "macOS 12.0")
  • +
+
+
+Extent Arrays:
    +
  • Each DumpExtent specifies a [start, end] logical sector range
  • +
  • Extents indicate which sectors this environment contributed
  • +
  • Empty extent arrays (extents == 0) mean the environment dumped entire medium
  • +
  • Extents are stored in the order provided in the input buffer
  • +
+
+
+Memory Ownership:
    +
  • The function creates internal copies of all data
  • +
  • The caller retains ownership of the input data buffer
  • +
  • The caller may free the input buffer immediately after this function returns
  • +
  • Internal copies are freed during aaruf_close() or when replaced by another call
  • +
+
+
+Replacing Existing Data:
    +
  • Calling this function multiple times replaces previous dump hardware data
  • +
  • All previous entries, strings, and extents are freed before storing new data
  • +
  • No memory leaks occur when updating dump hardware information
  • +
+
+
Warning
The dump hardware block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted to disk.
+
+CRC64 validation protects against corrupted blocks, but construction errors in the input buffer (incorrect lengths, misaligned data) may cause parsing to fail or produce incorrect results even with a valid checksum.
+
+The function assumes the input buffer is properly formatted and packed according to the DumpHardwareBlock specification. Malformed input may cause crashes or memory corruption.
+
See also
DumpHardwareHeader for the block header structure definition.
+
+DumpHardwareEntry for the per-environment entry structure definition.
+
+DumpExtent for the extent range structure definition.
+
+aaruf_get_dumphw() for retrieving dump hardware from opened images.
+
+write_dumphw_block() for the serialization process during image closing.
+ +

Definition at line 531 of file dump.c.

+ +

References AARU_MAGIC, aaruf_crc64_data(), AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, compare_extents(), COPY_STRING_FIELD, DumpHardwareHeader::crc64, aaruformat_context::dump_hardware_entries_with_data, aaruformat_context::dump_hardware_header, DumpHardwareBlock, DumpHardwareHeader::entries, DumpHardwareEntriesWithData::entry, DumpHardwareEntriesWithData::extents, DumpHardwareEntry::extents, FATAL, free_dump_hardware_entries(), DumpHardwareHeader::identifier, aaruformat_context::is_writing, DumpHardwareHeader::length, aaruformat_context::magic, and TRACE.

+ +
+
+ +

◆ free_dump_hardware_entries()

+ +
+
+ + + + + +
+ + + + + + + + + + + +
void free_dump_hardware_entries (DumpHardwareEntriesWithData * entries,
uint32_t count )
+
+static
+
+ +

Definition at line 26 of file dump.c.

+ +

Referenced by aaruf_set_dumphw().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/dump_8c.js b/docs/html/dump_8c.js new file mode 100644 index 0000000..01f4183 --- /dev/null +++ b/docs/html/dump_8c.js @@ -0,0 +1,7 @@ +var dump_8c = +[ + [ "COPY_STRING_FIELD", "dump_8c.html#a6b41f4a00a255e6704583614ef33571f", null ], + [ "aaruf_get_dumphw", "dump_8c.html#a36af83897e131ba792c51ae8caec9984", null ], + [ "aaruf_set_dumphw", "dump_8c.html#ad98012dc12a51d9eadbd79a25aab8299", null ], + [ "free_dump_hardware_entries", "dump_8c.html#ab98a236ef7ac4de15fb37a2e3c3ce633", null ] +]; \ No newline at end of file diff --git a/docs/html/dump_8c_source.html b/docs/html/dump_8c_source.html new file mode 100644 index 0000000..789652d --- /dev/null +++ b/docs/html/dump_8c_source.html @@ -0,0 +1,559 @@ + + + + + + + +libaaruformat: src/dump.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
dump.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <stdint.h>
+
20#include <stdlib.h>
+
21
+
22#include "aaruformat.h"
+
23#include "internal.h"
+
24#include "log.h"
+
25
+
+
26static void free_dump_hardware_entries(DumpHardwareEntriesWithData *entries, uint32_t count)
+
27{
+
28 if(entries == NULL) return;
+
29
+
30 for(uint32_t e = 0; e < count; e++)
+
31 {
+
32 free(entries[e].manufacturer);
+
33 free(entries[e].model);
+
34 free(entries[e].revision);
+
35 free(entries[e].firmware);
+
36 free(entries[e].serial);
+
37 free(entries[e].softwareName);
+
38 free(entries[e].softwareVersion);
+
39 free(entries[e].softwareOperatingSystem);
+
40 free(entries[e].extents);
+
41 }
+
42
+
43 free(entries);
+
44}
+
+
45
+
+
186int32_t aaruf_get_dumphw(void *context, uint8_t *buffer, size_t *length)
+
187{
+
188 size_t length_value = 0;
+
189 if(length != NULL) length_value = *length;
+
190
+
191 TRACE("Entering aaruf_get_dumphw(%p, %p, %zu)", context, buffer, length_value);
+
192
+
193 aaruformat_context *ctx = NULL;
+
194
+
195 if(context == NULL)
+
196 {
+
197 FATAL("Invalid context");
+
198
+
199 TRACE("Exiting aaruf_get_dumphw() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
201 }
+
202
+
203 if(length == NULL)
+
204 {
+
205 FATAL("Invalid length pointer");
+
206
+
207 TRACE("Exiting aaruf_get_dumphw() = AARUF_ERROR_INCORRECT_DATA_SIZE");
+ +
209 }
+
210
+
211 ctx = context;
+
212
+
213 // Not a libaaruformat context
+
214 if(ctx->magic != AARU_MAGIC)
+
215 {
+
216 FATAL("Invalid context");
+
217
+
218 TRACE("Exiting aaruf_get_dumphw() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
220 }
+
221
+
222 if(ctx->dump_hardware_entries_with_data == NULL || ctx->dump_hardware_header.entries == 0 ||
+ +
224 {
+
225 FATAL("No dump hardware information present");
+
226
+
227 TRACE("Exiting aaruf_get_dumphw() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
229 }
+
230
+
231 size_t required_length = sizeof(DumpHardwareHeader) + (size_t)ctx->dump_hardware_header.length;
+
232 if(required_length < sizeof(DumpHardwareHeader))
+
233 {
+
234 FATAL("Dump hardware payload length overflow");
+
235
+
236 TRACE("Exiting aaruf_get_dumphw() = AARUF_ERROR_INCORRECT_DATA_SIZE");
+ +
238 }
+
239
+
240 if(buffer == NULL || *length < required_length)
+
241 {
+
242 TRACE("Buffer too small for dump hardware block, required %zu bytes", required_length);
+
243 *length = required_length;
+
244
+
245 TRACE("Exiting aaruf_get_dumphw() = AARUF_ERROR_BUFFER_TOO_SMALL");
+ +
247 }
+
248
+
249 *length = required_length;
+
250
+
251 // Start to iterate and copy the data
+
252 size_t offset = 0;
+
253 for(uint32_t i = 0; i < ctx->dump_hardware_header.entries; i++)
+
254 {
+
255 size_t entry_size = sizeof(DumpHardwareEntry);
+
256
+ +
258
+
259 const size_t extent_bytes = (size_t)entry->extents * sizeof(DumpExtent);
+
260 if(entry->extents != 0 && extent_bytes / sizeof(DumpExtent) != entry->extents)
+
261 {
+
262 FATAL("Dump hardware extent size overflow");
+
263 TRACE("Exiting aaruf_get_dumphw() = AARUF_ERROR_INCORRECT_DATA_SIZE");
+ +
265 }
+
266
+
267 const size_t additive_lengths[] = {entry->manufacturerLength,
+
268 entry->modelLength,
+
269 entry->revisionLength,
+
270 entry->firmwareLength,
+
271 entry->serialLength,
+
272 entry->softwareNameLength,
+ + +
275 extent_bytes};
+
276
+
277 for(size_t j = 0; j < sizeof(additive_lengths) / sizeof(additive_lengths[0]); j++)
+
278 {
+
279 if(additive_lengths[j] > SIZE_MAX - entry_size)
+
280 {
+
281 FATAL("Dump hardware entry size overflow");
+
282 TRACE("Exiting aaruf_get_dumphw() = AARUF_ERROR_INCORRECT_DATA_SIZE");
+ +
284 }
+
285 entry_size += additive_lengths[j];
+
286 }
+
287
+
288 if(offset + entry_size > *length)
+
289 {
+
290 FATAL("Calculated size exceeds provided buffer length");
+
291 TRACE("Exiting aaruf_get_dumphw() = AARUF_ERROR_BUFFER_TOO_SMALL");
+ +
293 }
+
294
+
295 memcpy(buffer + offset, &ctx->dump_hardware_entries_with_data[i].entry, sizeof(DumpHardwareEntry));
+
296 offset += sizeof(DumpHardwareEntry);
+ + +
299 {
+
300 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].manufacturer,
+ + +
303 }
+ + +
306 {
+
307 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].model,
+ + +
310 }
+ + +
313 {
+
314 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].revision,
+ + +
317 }
+ + +
320 {
+
321 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].firmware,
+ + +
324 }
+ + +
327 {
+
328 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].serial,
+ + +
331 }
+ + +
334 {
+
335 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].softwareName,
+ + +
338 }
+ + +
341 {
+
342 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].softwareVersion,
+ + +
345 }
+ + +
348 {
+
349 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].softwareOperatingSystem,
+ + +
352 }
+
353 if(entry->extents > 0 && ctx->dump_hardware_entries_with_data[i].extents != NULL)
+
354 {
+
355 memcpy(buffer + offset, ctx->dump_hardware_entries_with_data[i].extents, extent_bytes);
+
356 offset += extent_bytes;
+
357 }
+
358 }
+
359
+
360 // Calculate CRC64
+ + +
363
+
364 // Copy header
+
365 memcpy(buffer, &ctx->dump_hardware_header, sizeof(DumpHardwareHeader));
+
366
+
367 TRACE("Exiting aaruf_get_dumphw() = AARUF_STATUS_OK");
+
368 return AARUF_STATUS_OK;
+
369}
+
+
370
+
+
531int32_t aaruf_set_dumphw(void *context, uint8_t *data, size_t length)
+
532{
+
533 TRACE("Entering aaruf_set_dumphw(%p, %p, %zu)", context, data, length);
+
534
+
535 // Check context is correct AaruFormat context
+
536 if(context == NULL)
+
537 {
+
538 FATAL("Invalid context");
+
539
+
540 TRACE("Exiting aaruf_set_dumphw() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
542 }
+
543
+
544 aaruformat_context *ctx = context;
+
545
+
546 // Not a libaaruformat context
+
547 if(ctx->magic != AARU_MAGIC)
+
548 {
+
549 FATAL("Invalid context");
+
550
+
551 TRACE("Exiting aaruf_set_dumphw() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
553 }
+
554
+
555 // Check we are writing
+
556 if(!ctx->is_writing)
+
557 {
+
558 FATAL("Trying to write a read-only image");
+
559
+
560 TRACE("Exiting aaruf_set_dumphw() = AARUF_READ_ONLY");
+
561 return AARUF_READ_ONLY;
+
562 }
+
563
+
564 if(data == NULL || length == 0)
+
565 {
+
566 FATAL("Invalid data or length");
+
567
+
568 TRACE("Exiting aaruf_set_dumphw() = AARUF_ERROR_INCORRECT_DATA_SIZE");
+ +
570 }
+
571
+
572 if(length < sizeof(DumpHardwareHeader))
+
573 {
+
574 FATAL("Dump hardware block shorter than header");
+
575
+
576 TRACE("Exiting aaruf_set_dumphw() = AARUF_ERROR_INCORRECT_DATA_SIZE");
+ +
578 }
+
579
+
580 DumpHardwareHeader header;
+
581 memcpy(&header, data, sizeof(DumpHardwareHeader));
+
582 if(header.identifier != DumpHardwareBlock)
+
583 {
+
584 FATAL("Invalid dump hardware block identifier");
+
585
+
586 TRACE("Exiting aaruf_set_dumphw() = AARUF_ERROR_CANNOT_READ_BLOCK");
+ +
588 }
+
589
+
590 if(length != sizeof(DumpHardwareHeader) + header.length)
+
591 {
+
592 FATAL("Invalid dump hardware block length");
+
593
+
594 TRACE("Exiting aaruf_set_dumphw() = AARUF_ERROR_INCORRECT_DATA_SIZE");
+ +
596 }
+
597
+
598 uint64_t crc64 = aaruf_crc64_data(data + sizeof(DumpHardwareHeader), header.length);
+
599 if(header.crc64 != crc64)
+
600 {
+
601 FATAL("Invalid dump hardware block CRC64");
+
602
+
603 TRACE("Exiting aaruf_set_dumphw() = AARUF_ERROR_INVALID_BLOCK_CRC");
+ +
605 }
+
606
+
607 DumpHardwareEntriesWithData *copy = NULL;
+
608 if(header.entries > 0)
+
609 {
+
610 copy = calloc(header.entries, sizeof(DumpHardwareEntriesWithData));
+
611 if(copy == NULL)
+
612 {
+
613 TRACE("Could not allocate memory for dump hardware block entries");
+
614 TRACE("Exiting aaruf_set_dumphw() = AARUF_ERROR_NOT_ENOUGH_MEMORY");
+ +
616 }
+
617 }
+
618
+
619 TRACE("Processing %u dump hardware block entries", header.entries);
+
620
+
621 size_t pos = sizeof(DumpHardwareHeader);
+
622
+
623#define COPY_STRING_FIELD(field) \
+
624 do { \
+
625 const size_t field##_length = copy[e].entry.field##Length; \
+
626 if(field##_length > 0) \
+
627 { \
+
628 if(field##_length > length - pos) goto invalid_data; \
+
629 copy[e].field = (uint8_t *)calloc(1, field##_length + 1); \
+
630 if(copy[e].field == NULL) goto free_copy_and_error; \
+
631 memcpy(copy[e].field, data + pos, field##_length); \
+
632 pos += field##_length; \
+
633 } \
+
634 } while(0)
+
635
+
636 for(uint32_t e = 0; e < header.entries; e++)
+
637 {
+
638 if(length - pos < sizeof(DumpHardwareEntry)) goto invalid_data;
+
639
+
640 memcpy(&copy[e].entry, data + pos, sizeof(DumpHardwareEntry));
+
641 pos += sizeof(DumpHardwareEntry);
+
642
+
643 COPY_STRING_FIELD(manufacturer);
+
644 COPY_STRING_FIELD(model);
+
645 COPY_STRING_FIELD(revision);
+
646 COPY_STRING_FIELD(firmware);
+
647 COPY_STRING_FIELD(serial);
+
648 COPY_STRING_FIELD(softwareName);
+
649 COPY_STRING_FIELD(softwareVersion);
+
650 COPY_STRING_FIELD(softwareOperatingSystem);
+
651
+
652 const uint32_t extent_count = copy[e].entry.extents;
+
653 if(extent_count > 0)
+
654 {
+
655 const size_t extent_bytes = (size_t)extent_count * sizeof(DumpExtent);
+
656 if(extent_bytes / sizeof(DumpExtent) != extent_count || extent_bytes > length - pos) goto invalid_data;
+
657
+
658 copy[e].extents = (DumpExtent *)malloc(extent_bytes);
+
659 if(copy[e].extents == NULL) goto free_copy_and_error;
+
660
+
661 memcpy(copy[e].extents, data + pos, extent_bytes);
+
662 pos += extent_bytes;
+
663
+
664 qsort(copy[e].extents, extent_count, sizeof(DumpExtent), compare_extents);
+
665 TRACE("Sorted %u extents for entry %u", extent_count, e);
+
666 }
+
667 }
+
668
+
669#undef COPY_STRING_FIELD
+
670
+
671 if(pos != length)
+
672 {
+
673 FATAL("Dump hardware block contains trailing data");
+
674 goto invalid_data;
+
675 }
+
676
+ + +
679 ctx->dump_hardware_header = header;
+
680
+
681 TRACE("Exiting aaruf_set_dumphw() = AARUF_STATUS_OK");
+
682 return AARUF_STATUS_OK;
+
683
+
684invalid_data:
+
685 TRACE("Dump hardware block truncated or malformed");
+ +
687 TRACE("Exiting aaruf_set_dumphw() = AARUF_ERROR_INCORRECT_DATA_SIZE");
+ +
689
+
690free_copy_and_error:
+ +
692 TRACE("Exiting aaruf_set_dumphw() = AARUF_ERROR_NOT_ENOUGH_MEMORY");
+ +
694}
+
+ +
#define AARU_MAGIC
Magic identifier for AaruFormat container (ASCII "AARUFRMT").
Definition consts.h:64
+
uint64_t aaruf_crc64_data(const uint8_t *data, uint32_t len)
Definition crc64.c:160
+
int32_t aaruf_get_dumphw(void *context, uint8_t *buffer, size_t *length)
Retrieves the dump hardware block containing acquisition environment information.
Definition dump.c:186
+
#define COPY_STRING_FIELD(field)
+
static void free_dump_hardware_entries(DumpHardwareEntriesWithData *entries, uint32_t count)
Definition dump.c:26
+
int32_t aaruf_set_dumphw(void *context, uint8_t *data, size_t length)
Sets the dump hardware block for the image during creation.
Definition dump.c:531
+
@ DumpHardwareBlock
Block containing an array of hardware used to create the image.
Definition enums.h:156
+
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
Definition errors.h:75
+
#define AARUF_READ_ONLY
Operation requires write mode but context is read-only.
Definition errors.h:61
+
#define AARUF_ERROR_NOT_ENOUGH_MEMORY
Memory allocation failure (critical).
Definition errors.h:48
+
#define AARUF_ERROR_CANNOT_READ_BLOCK
Generic block read failure (seek/read error).
Definition errors.h:46
+
#define AARUF_ERROR_INCORRECT_DATA_SIZE
Data size does not match expected size.
Definition errors.h:65
+
#define AARUF_ERROR_INVALID_BLOCK_CRC
CRC64 mismatch indicating corruption.
Definition errors.h:57
+
#define AARUF_ERROR_NOT_AARUFORMAT
Input file/stream failed magic or structural validation.
Definition errors.h:40
+
#define AARUF_ERROR_BUFFER_TOO_SMALL
Caller-supplied buffer insufficient for data.
Definition errors.h:49
+ +
int compare_extents(const void *a, const void *b)
Comparison function for sorting DumpExtent arrays by start sector.
Definition helpers.c:451
+ +
#define FATAL(fmt,...)
Definition log.h:40
+
#define TRACE(fmt,...)
Definition log.h:25
+
Inclusive [start,end] logical sector range contributed by a single hardware environment.
Definition context.h:333
+
In-memory representation of a dump hardware entry plus decoded variable-length fields & extents.
Definition context.h:314
+
uint8_t * firmware
Firmware version string or NULL.
Definition context.h:320
+
uint8_t * revision
Hardware revision string or NULL.
Definition context.h:319
+
uint8_t * model
Model string or NULL.
Definition context.h:318
+
uint8_t * softwareName
Dump software name or NULL.
Definition context.h:322
+
struct DumpExtent * extents
Array of extents (entry.extents elements) or NULL.
Definition context.h:316
+
uint8_t * manufacturer
Manufacturer string (UTF-8) or NULL.
Definition context.h:317
+
uint8_t * softwareVersion
Dump software version or NULL.
Definition context.h:323
+
uint8_t * serial
Serial number string or NULL.
Definition context.h:321
+
DumpHardwareEntry entry
Fixed-size header with lengths & counts.
Definition context.h:315
+
uint8_t * softwareOperatingSystem
Host operating system string or NULL.
Definition context.h:324
+
Per-environment length table describing subsequent UTF-8 strings and optional extent array.
Definition dump.h:113
+
uint32_t softwareNameLength
Length in bytes of dumping software name string.
Definition dump.h:119
+
uint32_t manufacturerLength
Length in bytes of manufacturer UTF-8 string.
Definition dump.h:114
+
uint32_t softwareVersionLength
Length in bytes of dumping software version string.
Definition dump.h:120
+
uint32_t firmwareLength
Length in bytes of firmware version string.
Definition dump.h:117
+
uint32_t extents
Number of DumpExtent records following the strings (0 = none).
Definition dump.h:122
+
uint32_t modelLength
Length in bytes of model UTF-8 string.
Definition dump.h:115
+
uint32_t serialLength
Length in bytes of device serial number string.
Definition dump.h:118
+
uint32_t revisionLength
Length in bytes of revision / hardware revision string.
Definition dump.h:116
+
uint32_t softwareOperatingSystemLength
Length in bytes of host operating system string.
Definition dump.h:121
+
Header that precedes a sequence of dump hardware entries and their variable-length payload.
Definition dump.h:91
+
uint64_t crc64
CRC64-ECMA of the payload (byte-swapped for legacy v1 images, handled automatically).
Definition dump.h:95
+
uint32_t identifier
Block identifier, must be BlockType::DumpHardwareBlock.
Definition dump.h:92
+
uint32_t length
Total payload bytes after this header (sum of entries, strings, and extents arrays).
Definition dump.h:94
+
uint16_t entries
Number of DumpHardwareEntry records that follow.
Definition dump.h:93
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
bool is_writing
True if context opened/created for writing.
Definition context.h:292
+
uint64_t magic
File magic (AARU_MAGIC) post-open.
Definition context.h:174
+
struct DumpHardwareEntriesWithData * dump_hardware_entries_with_data
Array of dump hardware entries + strings.
Definition context.h:212
+
DumpHardwareHeader dump_hardware_header
Dump hardware header.
Definition context.h:232
+
+
+
+ + + + diff --git a/docs/html/dump_8h.html b/docs/html/dump_8h.html new file mode 100644 index 0000000..e2ccb2e --- /dev/null +++ b/docs/html/dump_8h.html @@ -0,0 +1,195 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/dump.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
dump.h File Reference
+
+
+ +

Packed on-disk structures describing hardware and software used during image acquisition. +More...

+
#include <stdint.h>
+
+

Go to the source code of this file.

+ + + + + + +

+Data Structures

struct  DumpHardwareHeader
 Header that precedes a sequence of dump hardware entries and their variable-length payload. More...
struct  DumpHardwareEntry
 Per-environment length table describing subsequent UTF-8 strings and optional extent array. More...
+ + + +

+Typedefs

typedef struct DumpHardwareHeader DumpHardwareHeader
typedef struct DumpHardwareEntry DumpHardwareEntry
+

Detailed Description

+

Packed on-disk structures describing hardware and software used during image acquisition.

+

A Dump Hardware block (identifier = BlockType::DumpHardwareBlock) records one or more dump "environments" – typically combinations of a physical device (drive, controller, adapter) and the software stack that performed the read operation. Each environment is represented by a DumpHardwareEntry followed by a sequence of UTF‑8 strings and an optional array of extent ranges (DumpExtent, defined in context.h) that delimit portions of the medium this environment contributed to.

+

Binary layout (little-endian, packed, all multi-byte integers LE):

+

DumpHardwareHeader (sizeof = 16 bytes) identifier (4) -> BlockType::DumpHardwareBlock entries (2) -> number of following hardware entries length (4) -> total bytes of payload that follow this header crc64 (8) -> CRC64-ECMA of the payload bytes

+

Repeated for i in [0, entries): DumpHardwareEntry (36 bytes) manufacturerLength (4) modelLength (4) revisionLength (4) firmwareLength (4) serialLength (4) softwareNameLength (4) softwareVersionLength (4) softwareOperatingSystemLength (4) extents (4) -> number of DumpExtent structs after the strings

+

Variable-length UTF-8 strings (not NUL-terminated on disk) appear immediately after the entry, in the exact order of the length fields above; each string is present only if its length > 0. The reader allocates an extra byte to append '\0' for in-memory convenience.

+

Array of 'extents' DumpExtent structures (each 16 bytes: start, end) follows the strings if extents > 0. The semantic of each extent is an inclusive [start, end] logical sector (or unit) range contributed by this hardware/software combination.

+

CRC semantics:

    +
  • crc64 covers exactly 'length' bytes immediately following the header.
  • +
  • For legacy images with header.imageMajorVersion <= AARUF_VERSION_V1 the original C# writer produced a byte-swapped CRC; the library compensates internally (see process_dumphw_block()).
  • +
+

Invariants / validation recommendations:

    +
  • identifier == BlockType::DumpHardwareBlock
  • +
  • Accumulated size of all (entry + strings + extents arrays) == length
  • +
  • All length fields are trusted only after bounds checking against remaining payload bytes
  • +
  • Strings are raw UTF-8 data with no implicit terminator
  • +
  • extents * sizeof(DumpExtent) fits inside remaining payload
  • +
+

Memory management notes (runtime library):

    +
  • Each string is malloc'ed with +1 byte for terminator during processing.
  • +
  • Extents array is malloc'ed per entry when extents > 0.
  • +
  • See aaruformatContext::dumpHardwareEntriesWithData for owning pointers.
  • +
+
Warning
Structures are packed; never rely on natural alignment when mapping from a byte buffer.
+
See also
DumpHardwareHeader
+
+DumpHardwareEntry
+
+DumpExtent (in context.h)
+
+BlockType
+ +

Definition in file dump.h.

+

Typedef Documentation

+ +

◆ DumpHardwareEntry

+ +
+
+ + + + +
typedef struct DumpHardwareEntry DumpHardwareEntry
+
+ +
+
+ +

◆ DumpHardwareHeader

+ +
+
+ + + + +
typedef struct DumpHardwareHeader DumpHardwareHeader
+
+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/dump_8h.js b/docs/html/dump_8h.js new file mode 100644 index 0000000..62632fd --- /dev/null +++ b/docs/html/dump_8h.js @@ -0,0 +1,7 @@ +var dump_8h = +[ + [ "DumpHardwareHeader", "structDumpHardwareHeader.html", "structDumpHardwareHeader" ], + [ "DumpHardwareEntry", "structDumpHardwareEntry.html", "structDumpHardwareEntry" ], + [ "DumpHardwareEntry", "dump_8h.html#afd61d0986223157fbb7355586be9dcf1", null ], + [ "DumpHardwareHeader", "dump_8h.html#aa981a0ca569affe1e54ca0e382adb1cd", null ] +]; \ No newline at end of file diff --git a/docs/html/dump_8h_source.html b/docs/html/dump_8h_source.html new file mode 100644 index 0000000..57157ce --- /dev/null +++ b/docs/html/dump_8h_source.html @@ -0,0 +1,175 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/dump.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
dump.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_DUMP_H
+
20#define LIBAARUFORMAT_DUMP_H
+
21
+
22#include <stdint.h> /* Fixed-width integer types for on‑disk packed structures */
+
23
+
24#pragma pack(push, 1)
+
25
+
86
+
+
90typedef struct DumpHardwareHeader
+
91{
+
92 uint32_t identifier;
+
93 uint16_t entries;
+
94 uint32_t length;
+
95 uint64_t crc64;
+ +
+
97
+
+
112typedef struct DumpHardwareEntry
+
113{
+ +
115 uint32_t modelLength;
+
116 uint32_t revisionLength;
+
117 uint32_t firmwareLength;
+
118 uint32_t serialLength;
+ + + +
122 uint32_t extents;
+ +
+
124
+
125#pragma pack(pop)
+
126
+
127#endif // LIBAARUFORMAT_DUMP_H
+
Per-environment length table describing subsequent UTF-8 strings and optional extent array.
Definition dump.h:113
+
uint32_t softwareNameLength
Length in bytes of dumping software name string.
Definition dump.h:119
+
uint32_t manufacturerLength
Length in bytes of manufacturer UTF-8 string.
Definition dump.h:114
+
uint32_t softwareVersionLength
Length in bytes of dumping software version string.
Definition dump.h:120
+
uint32_t firmwareLength
Length in bytes of firmware version string.
Definition dump.h:117
+
uint32_t extents
Number of DumpExtent records following the strings (0 = none).
Definition dump.h:122
+
uint32_t modelLength
Length in bytes of model UTF-8 string.
Definition dump.h:115
+
uint32_t serialLength
Length in bytes of device serial number string.
Definition dump.h:118
+
uint32_t revisionLength
Length in bytes of revision / hardware revision string.
Definition dump.h:116
+
uint32_t softwareOperatingSystemLength
Length in bytes of host operating system string.
Definition dump.h:121
+
Header that precedes a sequence of dump hardware entries and their variable-length payload.
Definition dump.h:91
+
uint64_t crc64
CRC64-ECMA of the payload (byte-swapped for legacy v1 images, handled automatically).
Definition dump.h:95
+
uint32_t identifier
Block identifier, must be BlockType::DumpHardwareBlock.
Definition dump.h:92
+
uint32_t length
Total payload bytes after this header (sum of entries, strings, and extents arrays).
Definition dump.h:94
+
uint16_t entries
Number of DumpHardwareEntry records that follow.
Definition dump.h:93
+
+
+
+ + + + diff --git a/docs/html/dynsections.js b/docs/html/dynsections.js new file mode 100644 index 0000000..d89724e --- /dev/null +++ b/docs/html/dynsections.js @@ -0,0 +1,198 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ + +function toggleVisibility(linkObj) { + return dynsection.toggleVisibility(linkObj); +} + +let dynsection = { + // helper function + updateStripes : function() { + $('table.directory tr'). + removeClass('even').filter(':visible:even').addClass('even'); + $('table.directory tr'). + removeClass('odd').filter(':visible:odd').addClass('odd'); + }, + + toggleVisibility : function(linkObj) { + const base = $(linkObj).attr('id'); + const summary = $('#'+base+'-summary'); + const content = $('#'+base+'-content'); + const trigger = $('#'+base+'-trigger'); + const src=$(trigger).attr('src'); + if (content.is(':visible')===true) { + content.slideUp('fast'); + summary.show(); + $(linkObj).find('.arrowhead').addClass('closed').removeClass('opened'); + } else { + content.slideDown('fast'); + summary.hide(); + $(linkObj).find('.arrowhead').removeClass('closed').addClass('opened'); + } + return false; + }, + + toggleLevel : function(level) { + $('table.directory tr').each(function() { + const l = this.id.split('_').length-1; + const i = $('#img'+this.id.substring(3)); + const a = $('#arr'+this.id.substring(3)); + if (l'); + // add vertical lines to other rows + $('span[class=lineno]').not(':eq(0)').append(''); + // add toggle controls to lines with fold divs + $('div[class=foldopen]').each(function() { + // extract specific id to use + const id = $(this).attr('id').replace('foldopen',''); + // extract start and end foldable fragment attributes + const start = $(this).attr('data-start'); + const end = $(this).attr('data-end'); + // replace normal fold span with controls for the first line of a foldable fragment + $(this).find('span[class=fold]:first').replaceWith(''); + // append div for folded (closed) representation + $(this).after(''); + // extract the first line from the "open" section to represent closed content + const line = $(this).children().first().clone(); + // remove any glow that might still be active on the original line + $(line).removeClass('glow'); + if (start) { + // if line already ends with a start marker (e.g. trailing {), remove it + $(line).html($(line).html().replace(new RegExp('\\s*'+start+'\\s*$','g'),'')); + } + // replace minus with plus symbol + $(line).find('span[class=fold]').addClass('plus').removeClass('minus'); + // append ellipsis + $(line).append(' '+start+''+end); + // insert constructed line into closed div + $('#foldclosed'+id).html(line); + }); + }, +}; +/* @license-end */ +$(function() { + $('.code,.codeRef').each(function() { + $(this).data('powertip',$('#a'+$(this).attr('href').replace(/.*\//,'').replace(/[^a-z_A-Z0-9]/g,'_')).html()); + $.fn.powerTip.smartPlacementLists.s = [ 's', 'n', 'ne', 'se' ]; + $(this).powerTip({ placement: 's', smartPlacement: true, mouseOnToPopup: true }); + }); +}); diff --git a/docs/html/ecc__cd_8c.html b/docs/html/ecc__cd_8c.html new file mode 100644 index 0000000..df1699a --- /dev/null +++ b/docs/html/ecc__cd_8c.html @@ -0,0 +1,681 @@ + + + + + + + +libaaruformat: src/checksum/ecc_cd.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
ecc_cd.c File Reference
+
+
+
#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include "aaruformat.h"
+#include "log.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + +

+Functions

void * aaruf_ecc_cd_init ()
 Initializes a Compact Disc ECC context.
bool aaruf_ecc_cd_is_suffix_correct (void *context, const uint8_t *sector)
 Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 1).
bool aaruf_ecc_cd_is_suffix_correct_mode2 (void *context, const uint8_t *sector)
 Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 2).
bool aaruf_ecc_cd_check (void *context, const uint8_t *address, const uint8_t *data, const uint32_t major_count, const uint32_t minor_count, const uint32_t major_mult, const uint32_t minor_inc, const uint8_t *ecc, const int32_t address_offset, const int32_t data_offset, const int32_t ecc_offset)
 Checks the ECC of a CD sector.
void aaruf_ecc_cd_write (void *context, const uint8_t *address, const uint8_t *data, const uint32_t major_count, const uint32_t minor_count, const uint32_t major_mult, const uint32_t minor_inc, uint8_t *ecc, const int32_t address_offset, const int32_t data_offset, const int32_t ecc_offset)
 Writes ECC for a CD sector.
void aaruf_ecc_cd_write_sector (void *context, const uint8_t *address, const uint8_t *data, uint8_t *ecc, const int32_t address_offset, const int32_t data_offset, const int32_t ecc_offset)
 Writes ECC for a full CD sector (both P and Q ECC).
void aaruf_cd_lba_to_msf (const int64_t pos, uint8_t *minute, uint8_t *second, uint8_t *frame)
 Converts a CD LBA (Logical Block Address) to MSF (Minute:Second:Frame) format.
void aaruf_ecc_cd_reconstruct_prefix (uint8_t *sector, const uint8_t type, const int64_t lba)
 Reconstructs the prefix (sync, address, mode) of a CD sector.
void aaruf_ecc_cd_reconstruct (void *context, uint8_t *sector, const uint8_t type)
 Reconstructs the EDC and ECC fields of a CD sector.
uint32_t aaruf_edc_cd_compute (void *context, uint32_t edc, const uint8_t *src, int size, int pos)
 Computes the EDC (Error Detection Code) for a CD sector.
+

Function Documentation

+ +

◆ aaruf_cd_lba_to_msf()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
void aaruf_cd_lba_to_msf (const int64_t pos,
uint8_t * minute,
uint8_t * second,
uint8_t * frame )
+
+ +

Converts a CD LBA (Logical Block Address) to MSF (Minute:Second:Frame) format.

+
Parameters
+ + + + + +
posLBA position.
minutePointer to store the minute value.
secondPointer to store the second value.
framePointer to store the frame value.
+
+
+ +

Definition at line 370 of file ecc_cd.c.

+ +

References TRACE.

+ +

Referenced by aaruf_ecc_cd_reconstruct_prefix().

+ +
+
+ +

◆ aaruf_ecc_cd_check()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool aaruf_ecc_cd_check (void * context,
const uint8_t * address,
const uint8_t * data,
const uint32_t major_count,
const uint32_t minor_count,
const uint32_t major_mult,
const uint32_t minor_inc,
const uint8_t * ecc,
const int32_t address_offset,
const int32_t data_offset,
const int32_t ecc_offset )
+
+ +

Checks the ECC of a CD sector.

+
Parameters
+ + + + + + + + + + + + +
contextPointer to the ECC context.
addressPointer to the address field.
dataPointer to the data field.
major_countNumber of major iterations.
minor_countNumber of minor iterations.
major_multMajor multiplier.
minor_incMinor increment.
eccPointer to the ECC field.
address_offsetOffset for the address field.
data_offsetOffset for the data field.
ecc_offsetOffset for the ECC field.
+
+
+
Returns
true if ECC is correct, false otherwise.
+ +

Definition at line 227 of file ecc_cd.c.

+ +

References CdEccContext::ecc_b_table, CdEccContext::ecc_f_table, CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_ecc_cd_is_suffix_correct(), and aaruf_ecc_cd_is_suffix_correct_mode2().

+ +
+
+ +

◆ aaruf_ecc_cd_init()

+ +
+
+ + + + + + + +
void * aaruf_ecc_cd_init ()
+
+ +

Initializes a Compact Disc ECC context.

+

Allocates and initializes a context for Compact Disc ECC calculations.

+
Returns
Pointer to the initialized CdEccContext structure, or NULL on failure.
+ +

Definition at line 35 of file ecc_cd.c.

+ +

References CdEccContext::ecc_b_table, CdEccContext::ecc_f_table, CdEccContext::edc_table, CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_create(), and aaruf_open().

+ +
+
+ +

◆ aaruf_ecc_cd_is_suffix_correct()

+ +
+
+ + + + + + + + + + + +
bool aaruf_ecc_cd_is_suffix_correct (void * context,
const uint8_t * sector )
+
+ +

Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 1).

+
Parameters
+ + + +
contextPointer to the ECC context.
sectorPointer to the sector data.
+
+
+
Returns
true if the suffix is correct, false otherwise.
+ +

Definition at line 101 of file ecc_cd.c.

+ +

References aaruf_ecc_cd_check(), aaruf_edc_cd_compute(), CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ aaruf_ecc_cd_is_suffix_correct_mode2()

+ +
+
+ + + + + + + + + + + +
bool aaruf_ecc_cd_is_suffix_correct_mode2 (void * context,
const uint8_t * sector )
+
+ +

Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 2).

+
Parameters
+ + + +
contextPointer to the ECC context.
sectorPointer to the sector data.
+
+
+
Returns
true if the suffix is correct, false otherwise.
+ +

Definition at line 165 of file ecc_cd.c.

+ +

References aaruf_ecc_cd_check(), aaruf_edc_cd_compute(), CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ aaruf_ecc_cd_reconstruct()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_ecc_cd_reconstruct (void * context,
uint8_t * sector,
const uint8_t type )
+
+ +

Reconstructs the EDC and ECC fields of a CD sector.

+
Parameters
+ + + + +
contextPointer to the ECC context.
sectorPointer to the sector data (must be 2352 bytes).
typeTrack type (mode).
+
+
+ +

Definition at line 455 of file ecc_cd.c.

+ +

References aaruf_ecc_cd_write_sector(), aaruf_edc_cd_compute(), CdMode1, CdMode2Form1, CdMode2Form2, CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_read_sector_long().

+ +
+
+ +

◆ aaruf_ecc_cd_reconstruct_prefix()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_ecc_cd_reconstruct_prefix (uint8_t * sector,
const uint8_t type,
const int64_t lba )
+
+ +

Reconstructs the prefix (sync, address, mode) of a CD sector.

+
Parameters
+ + + + +
sectorPointer to the sector data (must be 2352 bytes).
typeTrack type (mode).
lbaLogical Block Address.
+
+
+ +

Definition at line 388 of file ecc_cd.c.

+ +

References aaruf_cd_lba_to_msf(), CdMode1, CdMode2Form1, CdMode2Form2, CdMode2Formless, and TRACE.

+ +

Referenced by aaruf_read_sector_long().

+ +
+
+ +

◆ aaruf_ecc_cd_write()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void aaruf_ecc_cd_write (void * context,
const uint8_t * address,
const uint8_t * data,
const uint32_t major_count,
const uint32_t minor_count,
const uint32_t major_mult,
const uint32_t minor_inc,
uint8_t * ecc,
const int32_t address_offset,
const int32_t data_offset,
const int32_t ecc_offset )
+
+ +

Writes ECC for a CD sector.

+
Parameters
+ + + + + + + + + + + + +
contextPointer to the ECC context.
addressPointer to the address field.
dataPointer to the data field.
major_countNumber of major iterations.
minor_countNumber of minor iterations.
major_multMajor multiplier.
minor_incMinor increment.
eccPointer to the ECC field to write.
address_offsetOffset for the address field.
data_offsetOffset for the data field.
ecc_offsetOffset for the ECC field.
+
+
+ +

Definition at line 292 of file ecc_cd.c.

+ +

References CdEccContext::ecc_b_table, CdEccContext::ecc_f_table, CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_ecc_cd_write_sector().

+ +
+
+ +

◆ aaruf_ecc_cd_write_sector()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void aaruf_ecc_cd_write_sector (void * context,
const uint8_t * address,
const uint8_t * data,
uint8_t * ecc,
const int32_t address_offset,
const int32_t data_offset,
const int32_t ecc_offset )
+
+ +

Writes ECC for a full CD sector (both P and Q ECC).

+
Parameters
+ + + + + + + + +
contextPointer to the ECC context.
addressPointer to the address field.
dataPointer to the data field.
eccPointer to the ECC field to write.
address_offsetOffset for the address field.
data_offsetOffset for the data field.
ecc_offsetOffset for the ECC field.
+
+
+ +

Definition at line 349 of file ecc_cd.c.

+ +

References aaruf_ecc_cd_write(), and TRACE.

+ +

Referenced by aaruf_ecc_cd_reconstruct().

+ +
+
+ +

◆ aaruf_edc_cd_compute()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
uint32_t aaruf_edc_cd_compute (void * context,
uint32_t edc,
const uint8_t * src,
int size,
int pos )
+
+ +

Computes the EDC (Error Detection Code) for a CD sector.

+
Parameters
+ + + + + + +
contextPointer to the ECC context.
edcInitial EDC value.
srcPointer to the data to compute EDC over.
sizeNumber of bytes to process.
posStarting position in the data.
+
+
+
Returns
Computed EDC value.
+ +

Definition at line 543 of file ecc_cd.c.

+ +

References CdEccContext::edc_table, CdEccContext::inited_edc, and TRACE.

+ +

Referenced by aaruf_ecc_cd_is_suffix_correct(), aaruf_ecc_cd_is_suffix_correct_mode2(), aaruf_ecc_cd_reconstruct(), and aaruf_write_sector_long().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/ecc__cd_8c.js b/docs/html/ecc__cd_8c.js new file mode 100644 index 0000000..f0eb1a0 --- /dev/null +++ b/docs/html/ecc__cd_8c.js @@ -0,0 +1,13 @@ +var ecc__cd_8c = +[ + [ "aaruf_cd_lba_to_msf", "ecc__cd_8c.html#a4e5ee3f9330f970b761de5566458ac3b", null ], + [ "aaruf_ecc_cd_check", "ecc__cd_8c.html#a1cd08adea9a778c2463b90ab9295dc3f", null ], + [ "aaruf_ecc_cd_init", "ecc__cd_8c.html#ac1a30bb251ac148f485c51593c0740c1", null ], + [ "aaruf_ecc_cd_is_suffix_correct", "ecc__cd_8c.html#afbc09e16b1a654de04706e07c3212ecb", null ], + [ "aaruf_ecc_cd_is_suffix_correct_mode2", "ecc__cd_8c.html#ab77ca170a2e8d2f0a2a7ea1a8a51690a", null ], + [ "aaruf_ecc_cd_reconstruct", "ecc__cd_8c.html#a5bf5a19fd4ec540968f0b4c3d641e973", null ], + [ "aaruf_ecc_cd_reconstruct_prefix", "ecc__cd_8c.html#a9dc3231aea6933691f5881914e8da1f6", null ], + [ "aaruf_ecc_cd_write", "ecc__cd_8c.html#a330d4bda939de120a160592c0bdb703d", null ], + [ "aaruf_ecc_cd_write_sector", "ecc__cd_8c.html#ab541a4ae9c6568d4dad8df5101ebad58", null ], + [ "aaruf_edc_cd_compute", "ecc__cd_8c.html#a67c65c3f2ca5cdf1596c16fa35558df1", null ] +]; \ No newline at end of file diff --git a/docs/html/ecc__cd_8c_source.html b/docs/html/ecc__cd_8c_source.html new file mode 100644 index 0000000..1ab6961 --- /dev/null +++ b/docs/html/ecc__cd_8c_source.html @@ -0,0 +1,619 @@ + + + + + + + +libaaruformat: src/checksum/ecc_cd.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
ecc_cd.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 * ECC algorithm from ECM(c) 2002-2011 Neill Corlett
+
5 *
+
6 * This library is free software; you can redistribute it and/or modify
+
7 * it under the terms of the GNU Lesser General Public License as
+
8 * published by the Free Software Foundation; either version 2.1 of the
+
9 * License, or (at your option) any later version.
+
10 *
+
11 * This library is distributed in the hope that it will be useful, but
+
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
14 * Lesser General Public License for more details.
+
15 *
+
16 * You should have received a copy of the GNU Lesser General Public
+
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
18 */
+
19
+
20#include <stdbool.h>
+
21#include <stdint.h>
+
22#include <stdlib.h>
+
23#include <string.h>
+
24
+
25#include "aaruformat.h"
+
26#include "log.h"
+
27
+
+ +
36{
+
37 TRACE("Entering aaruf_ecc_cd_init()");
+
38 CdEccContext *context = NULL;
+
39 uint32_t edc = 0, i = 0, j = 0;
+
40
+
41 TRACE("Creating context");
+
42 context = (CdEccContext *)malloc(sizeof(CdEccContext));
+
43
+
44 if(context == NULL) return NULL;
+
45
+
46 TRACE("Allocating memory for ECC F table");
+
47 context->ecc_f_table = (uint8_t *)malloc(sizeof(uint8_t) * 256);
+
48
+
49 if(context->ecc_f_table == NULL)
+
50 {
+
51 free(context);
+
52 return NULL;
+
53 }
+
54
+
55 TRACE("Allocating memory for ECC B table");
+
56 context->ecc_b_table = (uint8_t *)malloc(sizeof(uint8_t) * 256);
+
57
+
58 if(context->ecc_b_table == NULL)
+
59 {
+
60 free(context->ecc_f_table);
+
61 free(context);
+
62 return NULL;
+
63 }
+
64
+
65 TRACE("Allocating memory for EDC table");
+
66
+
67 context->edc_table = (uint32_t *)malloc(sizeof(uint32_t) * 256);
+
68
+
69 if(context->edc_table == NULL)
+
70 {
+
71 free(context->ecc_f_table);
+
72 free(context->ecc_b_table);
+
73 free(context);
+
74 return NULL;
+
75 }
+
76
+
77 TRACE("Initializing EDC tables");
+
78 for(i = 0; i < 256; i++)
+
79 {
+
80 edc = i;
+
81 j = i << 1 ^ ((i & 0x80) == 0x80 ? 0x11D : 0);
+
82 context->ecc_f_table[i] = (uint8_t)j;
+
83 context->ecc_b_table[i ^ j] = (uint8_t)i;
+
84 for(j = 0; j < 8; j++) edc = edc >> 1 ^ ((edc & 1) > 0 ? 0xD8018001 : 0);
+
85 context->edc_table[i] = edc;
+
86 }
+
87
+
88 context->inited_edc = true;
+
89
+
90 TRACE("Exiting aaruf_ecc_cd_init()");
+
91 return context;
+
92}
+
+
93
+
+
101bool aaruf_ecc_cd_is_suffix_correct(void *context, const uint8_t *sector)
+
102{
+
103 TRACE("Entering aaruf_ecc_cd_is_suffix_correct(%p, %p)", context, sector);
+
104 uint32_t edc;
+
105 int size, pos;
+
106
+
107 if(context == NULL || sector == NULL)
+
108 {
+
109 TRACE("Exiting aaruf_ecc_cd_is_suffix_correct() without initialized context");
+
110 return false;
+
111 }
+
112
+
113 const CdEccContext *ctx = context;
+
114 if(!ctx->inited_edc)
+
115 {
+
116 TRACE("Exiting aaruf_ecc_cd_is_suffix_correct() without initialized context");
+
117 return false;
+
118 }
+
119
+
120 if(sector[0x814] != 0x00 ||
+
121 // reserved (8 bytes)
+
122 sector[0x815] != 0x00 || sector[0x816] != 0x00 || sector[0x817] != 0x00 || sector[0x818] != 0x00 ||
+
123 sector[0x819] != 0x00 || sector[0x81A] != 0x00 || sector[0x81B] != 0x00)
+
124 {
+
125 TRACE("Exiting aaruf_ecc_cd_is_suffix_correct() = false");
+
126 return false;
+
127 }
+
128
+
129 const bool correct_ecc_p = aaruf_ecc_cd_check(context, sector, sector, 86, 24, 2, 86, sector, 0xC, 0x10, 0x81C);
+
130 if(!correct_ecc_p)
+
131 {
+
132 TRACE("Exiting aaruf_ecc_cd_is_suffix_correct() = false");
+
133 return false;
+
134 }
+
135
+
136 const bool correct_ecc_q =
+
137 aaruf_ecc_cd_check(context, sector, sector, 52, 43, 86, 88, sector, 0xC, 0x10, 0x81C + 0xAC);
+
138 if(!correct_ecc_q)
+
139 {
+
140 TRACE("Exiting aaruf_ecc_cd_is_suffix_correct() = false");
+
141 return false;
+
142 }
+
143
+
144 uint32_t stored_edc;
+
145 memcpy(&stored_edc, sector + 0x810, 4);
+
146 uint32_t calculated_edc = aaruf_edc_cd_compute(context, 0, sector, 0x810, 0);
+
147
+
148 if(stored_edc != calculated_edc)
+
149 {
+
150 TRACE("Exiting aaruf_ecc_cd_is_suffix_correct() = false");
+
151 return false;
+
152 }
+
153
+
154 TRACE("Exiting aaruf_ecc_cd_is_suffix_correct() = %u == %u", calculated_edc, stored_edc);
+
155 return calculated_edc == stored_edc;
+
156}
+
+
157
+
+
165bool aaruf_ecc_cd_is_suffix_correct_mode2(void *context, const uint8_t *sector)
+
166{
+
167 TRACE("Entering aaruf_ecc_cd_is_suffix_correct_mode2(%p, %p)", context, sector);
+
168 uint32_t edc;
+
169 int size, pos;
+
170 uint8_t zeroaddress[4] = {0};
+
171
+
172 if(context == NULL || sector == NULL)
+
173 {
+
174 TRACE("Exiting aaruf_ecc_cd_is_suffix_correct_mode2() without initialized context");
+
175 return false;
+
176 }
+
177
+
178 CdEccContext *ctx = context;
+
179
+
180 if(!ctx->inited_edc)
+
181 {
+
182 TRACE("Exiting aaruf_ecc_cd_is_suffix_correct_mode2() without initialized context");
+
183 return false;
+
184 }
+
185
+
186 const int form2 = sector[0x12] & 0x20;
+
187
+
188 const bool correct_ecc_p = aaruf_ecc_cd_check(context, zeroaddress, sector, 86, 24, 2, 86, sector, 0, 0x10, 0x81C);
+
189 if(!correct_ecc_p)
+
190 {
+
191 TRACE("Exiting aaruf_ecc_cd_is_suffix_correct_mode2() = false");
+
192 return false;
+
193 }
+
194
+
195 const bool correct_ecc_q =
+
196 aaruf_ecc_cd_check(context, zeroaddress, sector, 52, 43, 86, 88, sector, 0, 0x10, 0x81C + 0xAC);
+
197 if(!correct_ecc_q)
+
198 {
+
199 TRACE("Exiting aaruf_ecc_cd_is_suffix_correct_mode2() = false");
+
200 return false;
+
201 }
+
202
+
203 uint32_t stored_edc;
+
204 memcpy(&stored_edc, form2 ? sector + 0x92C : sector + 0x818, 4);
+
205 const uint32_t calculated_edc = aaruf_edc_cd_compute(context, 0, sector, form2 ? 0x91C : 0x808, 0x10);
+
206
+
207 TRACE("Exiting aaruf_ecc_cd_is_suffix_correct_mode2() = %u == %u", calculated_edc, stored_edc);
+
208 return calculated_edc == stored_edc;
+
209}
+
+
210
+
+
227bool aaruf_ecc_cd_check(void *context, const uint8_t *address, const uint8_t *data, const uint32_t major_count,
+
228 const uint32_t minor_count, const uint32_t major_mult, const uint32_t minor_inc,
+
229 const uint8_t *ecc, const int32_t address_offset, const int32_t data_offset,
+
230 const int32_t ecc_offset)
+
231{
+
232 TRACE("Entering aaruf_ecc_cd_check(%p, %p, %p, %u, %u, %u, %u, %p, %d, %d, %d)", context, address, data,
+
233 major_count, minor_count, major_mult, minor_inc, ecc, address_offset, data_offset, ecc_offset);
+
234
+
235 if(context == NULL || address == NULL || data == NULL || ecc == NULL)
+
236 {
+
237 TRACE("Exiting aaruf_ecc_cd_check() with missing data");
+
238 return false;
+
239 }
+
240
+
241 CdEccContext *ctx = context;
+
242
+
243 if(!ctx->inited_edc)
+
244 {
+
245 TRACE("Exiting aaruf_ecc_cd_check() without initialized context");
+
246 return false;
+
247 }
+
248
+
249 uint32_t size = major_count * minor_count;
+
250 for(uint32_t major = 0; major < major_count; major++)
+
251 {
+
252 uint32_t idx = (major >> 1) * major_mult + (major & 1);
+
253 uint8_t ecc_a = 0;
+
254 uint8_t ecc_b = 0;
+
255 for(uint32_t minor = 0; minor < minor_count; minor++)
+
256 {
+
257 uint8_t temp = idx < 4 ? address[idx + address_offset] : data[idx + data_offset - 4];
+
258 idx += minor_inc;
+
259 if(idx >= size) idx -= size;
+
260 ecc_a ^= temp;
+
261 ecc_b ^= temp;
+
262 ecc_a = ctx->ecc_f_table[ecc_a];
+
263 }
+
264
+
265 ecc_a = ctx->ecc_b_table[ctx->ecc_f_table[ecc_a] ^ ecc_b];
+
266 if(ecc[major + ecc_offset] != ecc_a || ecc[major + major_count + ecc_offset] != (ecc_a ^ ecc_b))
+
267 {
+
268 TRACE("Exiting aaruf_ecc_cd_check() = false, ECC mismatch at major %u", major);
+
269 return false;
+
270 }
+
271 }
+
272
+
273 TRACE("Exiting aaruf_ecc_cd_check() = true, ECC matches");
+
274 return true;
+
275}
+
+
276
+
+
292void aaruf_ecc_cd_write(void *context, const uint8_t *address, const uint8_t *data, const uint32_t major_count,
+
293 const uint32_t minor_count, const uint32_t major_mult, const uint32_t minor_inc, uint8_t *ecc,
+
294 const int32_t address_offset, const int32_t data_offset, const int32_t ecc_offset)
+
295{
+
296 TRACE("Entering aaruf_ecc_cd_write(%p, %p, %p, %u, %u, %u, %u, %p, %d, %d, %d)", context, address, data,
+
297 major_count, minor_count, major_mult, minor_inc, ecc, address_offset, data_offset, ecc_offset);
+
298
+
299 if(context == NULL || address == NULL || data == NULL || ecc == NULL)
+
300 {
+
301 TRACE("Exiting aaruf_ecc_cd_write() with missing data");
+
302 return;
+
303 }
+
304
+
305 CdEccContext *ctx = context;
+
306
+
307 if(!ctx->inited_edc)
+
308 {
+
309 TRACE("Exiting aaruf_ecc_cd_write() without initialized context");
+
310 return;
+
311 }
+
312
+
313 uint32_t size = major_count * minor_count;
+
314 for(uint32_t major = 0; major < major_count; major++)
+
315 {
+
316 uint32_t idx = (major >> 1) * major_mult + (major & 1);
+
317 uint8_t ecc_a = 0;
+
318 uint8_t ecc_b = 0;
+
319
+
320 for(uint32_t minor = 0; minor < minor_count; minor++)
+
321 {
+
322 uint8_t temp = idx < 4 ? address[idx + address_offset] : data[idx + data_offset - 4];
+
323 idx += minor_inc;
+
324 if(idx >= size) idx -= size;
+
325 ecc_a ^= temp;
+
326 ecc_b ^= temp;
+
327 ecc_a = ctx->ecc_f_table[ecc_a];
+
328 }
+
329
+
330 ecc_a = ctx->ecc_b_table[ctx->ecc_f_table[ecc_a] ^ ecc_b];
+
331 ecc[major + ecc_offset] = ecc_a;
+
332 ecc[major + major_count + ecc_offset] = ecc_a ^ ecc_b;
+
333 }
+
334
+
335 TRACE("Exiting aaruf_ecc_cd_write()");
+
336}
+
+
337
+
+
349void aaruf_ecc_cd_write_sector(void *context, const uint8_t *address, const uint8_t *data, uint8_t *ecc,
+
350 const int32_t address_offset, const int32_t data_offset, const int32_t ecc_offset)
+
351{
+
352 TRACE("Entering aaruf_ecc_cd_write_sector(%p, %p, %p, %p, %d, %d, %d)", context, address, data, ecc, address_offset,
+
353 data_offset, ecc_offset);
+
354
+
355 aaruf_ecc_cd_write(context, address, data, 86, 24, 2, 86, ecc, address_offset, data_offset, ecc_offset); // P
+
356 aaruf_ecc_cd_write(context, address, data, 52, 43, 86, 88, ecc, address_offset, data_offset,
+
357 ecc_offset + 0xAC); // Q
+
358
+
359 TRACE("Exiting aaruf_ecc_cd_write_sector()");
+
360}
+
+
361
+
+
370void aaruf_cd_lba_to_msf(const int64_t pos, uint8_t *minute, uint8_t *second, uint8_t *frame)
+
371{
+
372 TRACE("Entering aaruf_cd_lba_to_msf(%lld, %p, %p, %p)", pos, minute, second, frame);
+
373
+
374 *minute = (uint8_t)((pos + 150) / 75 / 60);
+
375 *second = (uint8_t)((pos + 150) / 75 % 60);
+
376 *frame = (uint8_t)((pos + 150) % 75);
+
377
+
378 TRACE("Exiting aaruf_cd_lba_to_msf() = %u:%u:%u", *minute, *second, *frame);
+
379}
+
+
380
+
+
388void aaruf_ecc_cd_reconstruct_prefix(uint8_t *sector, const uint8_t type, const int64_t lba)
+
389{
+
390 TRACE("Entering aaruf_ecc_cd_reconstruct_prefix(%p, %u, %lld)", sector, type, lba);
+
391
+
392 uint8_t minute, second, frame;
+
393
+
394 if(sector == NULL) return;
+
395
+
396 //
+
397 // Sync
+
398 //
+
399 sector[0x000] = 0x00;
+
400 sector[0x001] = 0xFF;
+
401 sector[0x002] = 0xFF;
+
402 sector[0x003] = 0xFF;
+
403 sector[0x004] = 0xFF;
+
404 sector[0x005] = 0xFF;
+
405 sector[0x006] = 0xFF;
+
406 sector[0x007] = 0xFF;
+
407 sector[0x008] = 0xFF;
+
408 sector[0x009] = 0xFF;
+
409 sector[0x00A] = 0xFF;
+
410 sector[0x00B] = 0x00;
+
411
+
412 aaruf_cd_lba_to_msf(lba, &minute, &second, &frame);
+
413
+
414 sector[0x00C] = (uint8_t)(((minute / 10) << 4) + minute % 10);
+
415 sector[0x00D] = (uint8_t)(((second / 10) << 4) + second % 10);
+
416 sector[0x00E] = (uint8_t)(((frame / 10) << 4) + frame % 10);
+
417
+
418 switch((TrackType)type)
+
419 {
+
420 case CdMode1:
+
421 //
+
422 // Mode
+
423 //
+
424 sector[0x00F] = 0x01;
+
425 break;
+
426 case CdMode2Form1:
+
427 case CdMode2Form2:
+
428 case CdMode2Formless:
+
429 //
+
430 // Mode
+
431 //
+
432 sector[0x00F] = 0x02;
+
433 //
+
434 // Flags
+
435 //
+
436 sector[0x010] = sector[0x014];
+
437 sector[0x011] = sector[0x015];
+
438 sector[0x012] = sector[0x016];
+
439 sector[0x013] = sector[0x017];
+
440 break;
+
441 default:
+
442 return;
+
443 }
+
444
+
445 TRACE("Exiting aaruf_ecc_cd_reconstruct_prefix()");
+
446}
+
+
447
+
+
455void aaruf_ecc_cd_reconstruct(void *context, uint8_t *sector, const uint8_t type)
+
456{
+
457 TRACE("Entering aaruf_ecc_cd_reconstruct(%p, %p, %u)", context, sector, type);
+
458
+
459 uint32_t computed_edc;
+
460 uint8_t zeroaddress[4];
+
461
+
462 if(context == NULL || sector == NULL)
+
463 {
+
464 TRACE("Exiting aaruf_ecc_cd_reconstruct() with missing data");
+
465 return;
+
466 }
+
467
+
468 CdEccContext *ctx = context;
+
469
+
470 if(!ctx->inited_edc)
+
471 {
+
472 TRACE("Exiting aaruf_ecc_cd_reconstruct() without initialized context");
+
473 return;
+
474 }
+
475
+
476 switch(type)
+
477 {
+
478 //
+
479 // Compute EDC
+
480 //
+
481 case CdMode1:
+
482 computed_edc = aaruf_edc_cd_compute(context, 0, sector, 0x810, 0);
+
483 memcpy(sector + 0x810, &computed_edc, 4);
+
484 break;
+
485 case CdMode2Form1:
+
486 computed_edc = aaruf_edc_cd_compute(context, 0, sector, 0x808, 0x10);
+
487 memcpy(sector + 0x818, &computed_edc, 4);
+
488 break;
+
489 case CdMode2Form2:
+
490 computed_edc = aaruf_edc_cd_compute(context, 0, sector, 0x91C, 0x10);
+
491 memcpy(sector + 0x92C, &computed_edc, 4);
+
492 break;
+
493 default:
+
494 TRACE("Exiting aaruf_ecc_cd_reconstruct() with unknown type %u", type);
+
495 return;
+
496 }
+
497
+
498 memset(&zeroaddress, 0, 4);
+
499
+
500 switch(type)
+
501 {
+
502 //
+
503 // Compute ECC
+
504 //
+
505 case CdMode1:
+
506 //
+
507 // Reserved
+
508 //
+
509 sector[0x814] = 0x00;
+
510 sector[0x815] = 0x00;
+
511 sector[0x816] = 0x00;
+
512 sector[0x817] = 0x00;
+
513 sector[0x818] = 0x00;
+
514 sector[0x819] = 0x00;
+
515 sector[0x81A] = 0x00;
+
516 sector[0x81B] = 0x00;
+
517 aaruf_ecc_cd_write_sector(context, sector, sector, sector, 0xC, 0x10, 0x81C);
+
518 break;
+
519 case CdMode2Form1:
+
520 aaruf_ecc_cd_write_sector(context, zeroaddress, sector, sector, 0, 0x10, 0x81C);
+
521 break;
+
522 default:
+
523 TRACE("Exiting aaruf_ecc_cd_reconstruct() with unknown type %u", type);
+
524 return;
+
525 }
+
526
+
527 //
+
528 // Done
+
529 //
+
530 TRACE("Exiting aaruf_ecc_cd_reconstruct()");
+
531}
+
+
532
+
+
543uint32_t aaruf_edc_cd_compute(void *context, uint32_t edc, const uint8_t *src, int size, int pos)
+
544{
+
545 TRACE("Entering aaruf_edc_cd_compute(%p, %u, %p, %d, %d)", context, edc, src, size, pos);
+
546
+
547 if(context == NULL || src == NULL)
+
548 {
+
549 TRACE("Exiting aaruf_edc_cd_compute() with missing data");
+
550 return 0;
+
551 }
+
552
+
553 CdEccContext *ctx = context;
+
554
+
555 if(!ctx->inited_edc)
+
556 {
+
557 TRACE("Exiting aaruf_edc_cd_compute() without initialized context");
+
558 return 0;
+
559 }
+
560
+
561 for(; size > 0; size--) edc = edc >> 8 ^ ctx->edc_table[(edc ^ src[pos++]) & 0xFF];
+
562
+
563 TRACE("Exiting aaruf_edc_cd_compute() = 0x%08X", edc);
+
564 return edc;
+
565}
+
+ +
bool aaruf_ecc_cd_check(void *context, const uint8_t *address, const uint8_t *data, const uint32_t major_count, const uint32_t minor_count, const uint32_t major_mult, const uint32_t minor_inc, const uint8_t *ecc, const int32_t address_offset, const int32_t data_offset, const int32_t ecc_offset)
Checks the ECC of a CD sector.
Definition ecc_cd.c:227
+
void aaruf_ecc_cd_write(void *context, const uint8_t *address, const uint8_t *data, const uint32_t major_count, const uint32_t minor_count, const uint32_t major_mult, const uint32_t minor_inc, uint8_t *ecc, const int32_t address_offset, const int32_t data_offset, const int32_t ecc_offset)
Writes ECC for a CD sector.
Definition ecc_cd.c:292
+
void aaruf_cd_lba_to_msf(const int64_t pos, uint8_t *minute, uint8_t *second, uint8_t *frame)
Converts a CD LBA (Logical Block Address) to MSF (Minute:Second:Frame) format.
Definition ecc_cd.c:370
+
void aaruf_ecc_cd_reconstruct(void *context, uint8_t *sector, const uint8_t type)
Reconstructs the EDC and ECC fields of a CD sector.
Definition ecc_cd.c:455
+
uint32_t aaruf_edc_cd_compute(void *context, uint32_t edc, const uint8_t *src, int size, int pos)
Computes the EDC (Error Detection Code) for a CD sector.
Definition ecc_cd.c:543
+
void aaruf_ecc_cd_reconstruct_prefix(uint8_t *sector, const uint8_t type, const int64_t lba)
Reconstructs the prefix (sync, address, mode) of a CD sector.
Definition ecc_cd.c:388
+
void aaruf_ecc_cd_write_sector(void *context, const uint8_t *address, const uint8_t *data, uint8_t *ecc, const int32_t address_offset, const int32_t data_offset, const int32_t ecc_offset)
Writes ECC for a full CD sector (both P and Q ECC).
Definition ecc_cd.c:349
+
bool aaruf_ecc_cd_is_suffix_correct_mode2(void *context, const uint8_t *sector)
Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 2).
Definition ecc_cd.c:165
+
void * aaruf_ecc_cd_init()
Initializes a Compact Disc ECC context.
Definition ecc_cd.c:35
+
bool aaruf_ecc_cd_is_suffix_correct(void *context, const uint8_t *sector)
Checks if the suffix (EDC/ECC) of a CD sector is correct (Mode 1).
Definition ecc_cd.c:101
+
TrackType
Track (partitioning element) types for optical media.
Definition enums.h:194
+
@ CdMode1
Compact Disc Mode 1 data track.
Definition enums.h:197
+
@ CdMode2Form2
Compact Disc Mode 2 Form 2 data track.
Definition enums.h:200
+
@ CdMode2Form1
Compact Disc Mode 2 Form 1 data track.
Definition enums.h:199
+
@ CdMode2Formless
Compact Disc Mode 2 (formless) data track.
Definition enums.h:198
+ +
#define TRACE(fmt,...)
Definition log.h:25
+
Lookup tables and state for Compact Disc EDC/ECC (P/Q) regeneration / verification.
Definition context.h:86
+
uint8_t * ecc_f_table
Forward (F) ECC table.
Definition context.h:89
+
bool inited_edc
True once EDC/ECC tables have been initialized.
Definition context.h:87
+
uint32_t * edc_table
EDC (CRC) lookup table.
Definition context.h:90
+
uint8_t * ecc_b_table
Backward (B) ECC table (allocated, size implementation-defined).
Definition context.h:88
+
+
+
+ + + + diff --git a/docs/html/endian_8h.html b/docs/html/endian_8h.html new file mode 100644 index 0000000..1562d84 --- /dev/null +++ b/docs/html/endian_8h.html @@ -0,0 +1,190 @@ + + + + + + + +libaaruformat: include/aaruformat/endian.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
endian.h File Reference
+
+
+
#include <stdint.h>
+
+

Go to the source code of this file.

+ + + + + +

+Macros

#define bswap_16(x)
#define bswap_32(x)
#define bswap_64(x)
+

Macro Definition Documentation

+ +

◆ bswap_16

+ +
+
+ + + + + + + +
#define bswap_16( x)
+
+Value:
((uint16_t)((((uint16_t)(x) & 0xff00) >> 8) | (((uint16_t)(x) & 0x00ff) << 8)))
+
+

Definition at line 77 of file endian.h.

+ +
+
+ +

◆ bswap_32

+ +
+
+ + + + + + + +
#define bswap_32( x)
+
+Value:
((uint32_t)((((uint32_t)(x) & 0xff000000) >> 24) | (((uint32_t)(x) & 0x00ff0000) >> 8) | \
+
(((uint32_t)(x) & 0x0000ff00) << 8) | (((uint32_t)(x) & 0x000000ff) << 24)))
+
+

Definition at line 78 of file endian.h.

+ +
+
+ +

◆ bswap_64

+ +
+
+ + + + + + + +
#define bswap_64( x)
+
+Value:
((uint64_t)((((uint64_t)(x) & 0xff00000000000000ULL) >> 56) | (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \
+
(((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | (((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \
+
(((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \
+
(((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | (((uint64_t)(x) & 0x00000000000000ffULL) << 56)))
+
+

Definition at line 81 of file endian.h.

+ +

Referenced by aaruf_verify_image(), process_data_block(), process_dumphw_block(), process_tracks_block(), verify_index_v1(), verify_index_v2(), and verify_index_v3().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/endian_8h.js b/docs/html/endian_8h.js new file mode 100644 index 0000000..261d917 --- /dev/null +++ b/docs/html/endian_8h.js @@ -0,0 +1,6 @@ +var endian_8h = +[ + [ "bswap_16", "endian_8h.html#ad409605fabe125b1d222acb94a3f480f", null ], + [ "bswap_32", "endian_8h.html#a5bcbf8b6ee067af4c2fd60ef3bdb39d2", null ], + [ "bswap_64", "endian_8h.html#a0c0b427a2547aa727e2c5262a174e26b", null ] +]; \ No newline at end of file diff --git a/docs/html/endian_8h_source.html b/docs/html/endian_8h_source.html new file mode 100644 index 0000000..9ee0edb --- /dev/null +++ b/docs/html/endian_8h_source.html @@ -0,0 +1,199 @@ + + + + + + + +libaaruformat: include/aaruformat/endian.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
endian.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_ENDIAN_H
+
20#define LIBAARUFORMAT_ENDIAN_H
+
21
+
22#ifdef _MSC_VER
+
23
+
24#include <stdlib.h>
+
25#define bswap_16(x) _byteswap_ushort(x)
+
26#define bswap_32(x) _byteswap_ulong(x)
+
27#define bswap_64(x) _byteswap_uint64(x)
+
28
+
29#elif defined(__APPLE__)
+
30
+
31// Mac OS X / Darwin features
+
32#include <libkern/OSByteOrder.h>
+
33
+
34#define bswap_16(x) OSSwapInt16(x)
+
35#define bswap_32(x) OSSwapInt32(x)
+
36#define bswap_64(x) OSSwapInt64(x)
+
37
+
38#elif defined(__sun) || defined(sun)
+
39
+
40#include <sys/byteorder.h>
+
41#define bswap_16(x) BSWAP_16(x)
+
42#define bswap_32(x) BSWAP_32(x)
+
43#define bswap_64(x) BSWAP_64(x)
+
44
+
45#elif defined(__FreeBSD__)
+
46
+
47#include <sys/endian.h>
+
48#define bswap_16(x) bswap16(x)
+
49#define bswap_32(x) bswap32(x)
+
50#define bswap_64(x) bswap64(x)
+
51
+
52#elif defined(__OpenBSD__)
+
53
+
54#include <sys/types.h>
+
55#define bswap_16(x) swap16(x)
+
56#define bswap_32(x) swap32(x)
+
57#define bswap_64(x) swap64(x)
+
58
+
59#elif defined(__NetBSD__)
+
60
+
61#include <machine/bswap.h>
+
62#include <sys/types.h>
+
63#if defined(__BSWAP_RENAME) && !defined(__bswap_32)
+
64#define bswap_16(x) bswap16(x)
+
65#define bswap_32(x) bswap32(x)
+
66#define bswap_64(x) bswap64(x)
+
67#endif
+
68
+
69#elif defined(__linux__)
+
70
+
71#include <byteswap.h>
+
72
+
73#else
+
74
+
75#include <stdint.h>
+
76
+
77#define bswap_16(x) ((uint16_t)((((uint16_t)(x) & 0xff00) >> 8) | (((uint16_t)(x) & 0x00ff) << 8)))
+
+
78#define bswap_32(x) \
+
79 ((uint32_t)((((uint32_t)(x) & 0xff000000) >> 24) | (((uint32_t)(x) & 0x00ff0000) >> 8) | \
+
80 (((uint32_t)(x) & 0x0000ff00) << 8) | (((uint32_t)(x) & 0x000000ff) << 24)))
+
+
+
81#define bswap_64(x) \
+
82 ((uint64_t)((((uint64_t)(x) & 0xff00000000000000ULL) >> 56) | (((uint64_t)(x) & 0x00ff000000000000ULL) >> 40) | \
+
83 (((uint64_t)(x) & 0x0000ff0000000000ULL) >> 24) | (((uint64_t)(x) & 0x000000ff00000000ULL) >> 8) | \
+
84 (((uint64_t)(x) & 0x00000000ff000000ULL) << 8) | (((uint64_t)(x) & 0x0000000000ff0000ULL) << 24) | \
+
85 (((uint64_t)(x) & 0x000000000000ff00ULL) << 40) | (((uint64_t)(x) & 0x00000000000000ffULL) << 56)))
+
+
86
+
87#endif
+
88
+
89#endif // LIBAARUFORMAT_ENDIAN_H
+
+
+
+ + + + diff --git a/docs/html/enums_8h.html b/docs/html/enums_8h.html new file mode 100644 index 0000000..6ab7f33 --- /dev/null +++ b/docs/html/enums_8h.html @@ -0,0 +1,825 @@ + + + + + + + +libaaruformat: include/aaruformat/enums.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
enums.h File Reference
+
+
+ +

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + +

+Enumerations

enum  CompressionType { None = 0 +, Lzma = 1 +, Flac = 2 +, LzmaClauniaSubchannelTransform = 3 + }
 List of known compression types. More...
enum  DataType {
+  NoData = 0 +, UserData = 1 +, CompactDiscPartialToc = 2 +, CompactDiscSessionInfo = 3 +,
+  CompactDiscToc = 4 +, CompactDiscPma = 5 +, CompactDiscAtip = 6 +, CompactDiscLeadInCdText = 7 +,
+  DvdPfi = 8 +, DvdLeadInCmi = 9 +, DvdDiscKey = 10 +, DvdBca = 11 +,
+  DvdDmi = 12 +, DvdMediaIdentifier = 13 +, DvdMediaKeyBlock = 14 +, DvdRamDds = 15 +,
+  DvdRamMediumStatus = 16 +, DvdRamSpareArea = 17 +, DvdRRmd = 18 +, DvdRPrerecordedInfo = 19 +,
+  DvdRMediaIdentifier = 20 +, DvdRPfi = 21 +, DvdAdip = 22 +, HdDvdCpi = 23 +,
+  HdDvdMediumStatus = 24 +, DvdDlLayerCapacity = 25 +, DvdDlMiddleZoneAddress = 26 +, DvdDlJumpIntervalSize = 27 +,
+  DvdDlManualLayerJumpLba = 28 +, BlurayDi = 29 +, BlurayBca = 30 +, BlurayDds = 31 +,
+  BlurayCartridgeStatus = 32 +, BluraySpareArea = 33 +, AacsVolumeIdentifier = 34 +, AacsSerialNumber = 35 +,
+  AacsMediaIdentifier = 36 +, AacsMediaKeyBlock = 37 +, AacsDataKeys = 38 +, AacsLbaExtents = 39 +,
+  CprmMediaKeyBlock = 40 +, HybridRecognizedLayers = 41 +, ScsiMmcWriteProtection = 42 +, ScsiMmcDiscInformation = 43 +,
+  ScsiMmcTrackResourcesInformation = 44 +, ScsiMmcPowResourcesInformation = 45 +, ScsiInquiry = 46 +, ScsiModePage2A = 47 +,
+  AtaIdentify = 48 +, AtapiIdentify = 49 +, PcmciaCis = 50 +, SecureDigitalCid = 51 +,
+  SecureDigitalCsd = 52 +, SecureDigitalScr = 53 +, SecureDigitalOcr = 54 +, MultiMediaCardCid = 55 +,
+  MultiMediaCardCsd = 56 +, MultiMediaCardOcr = 57 +, MultiMediaCardExtendedCsd = 58 +, XboxSecuritySector = 59 +,
+  FloppyLeadOut = 60 +, DvdDiscControlBlock = 61 +, CompactDiscFirstTrackPregap = 62 +, CompactDiscLeadOut = 63 +,
+  ScsiModeSense6 = 64 +, ScsiModeSense10 = 65 +, UsbDescriptors = 66 +, XboxDmi = 67 +,
+  XboxPfi = 68 +, CdSectorPrefix = 69 +, CdSectorSuffix = 70 +, CdSectorSubchannel = 71 +,
+  AppleProfileTag = 72 +, AppleSonyTag = 73 +, PriamDataTowerTag = 74 +, CompactDiscMediaCatalogueNumber = 75 +,
+  CdSectorPrefixCorrected = 76 +, CdSectorSuffixCorrected = 77 +, CompactDiscMode2Subheader = 78 +, CompactDiscLeadIn = 79 +,
+  DvdDiscKeyDecrypted = 80 +, DvdSectorCprMai = 81 +, DvdSectorTitleKeyDecrypted = 82 +, DvdSectorId = 83 +,
+  DvdSectorIed = 84 +, DvdSectorEdc = 85 +, DvdSectorEccPi = 86 +, DvdEccBlockPo = 87 +
+ }
 List of known data types stored within an Aaru image. More...
enum  BlockType {
+  DataBlock = 0x4B4C4244 +, DeDuplicationTable = 0x2A544444 +, DeDuplicationTable2 = 0x32544444 +, DeDuplicationTableSecondary = 0x53545444 +,
+  IndexBlock = 0x58444E49 +, IndexBlock2 = 0x32584449 +, IndexBlock3 = 0x33584449 +, GeometryBlock = 0x4D4F4547 +,
+  MetadataBlock = 0x4154454D +, TracksBlock = 0x534B5254 +, CicmBlock = 0x4D434943 +, ChecksumBlock = 0x4D534B43 +,
+  DataPositionMeasurementBlock = 0x2A4D5044 +, SnapshotBlock = 0x50414E53 +, ParentBlock = 0x50524E54 +, DumpHardwareBlock = 0x2A504D44 +,
+  TapeFileBlock = 0x454C4654 +, TapePartitionBlock = 0x54425054 +, AaruMetadataJsonBlock = 0x444D534A +
+ }
 List of known block types contained in an Aaru image. More...
enum  ChecksumAlgorithm {
+  Invalid = 0 +, Md5 = 1 +, Sha1 = 2 +, Sha256 = 3 +,
+  SpamSum = 4 +, Blake3 = 5 +
+ }
 Supported checksum / hash algorithms. More...
enum  CdFixFlags {
+  NotDumped = 0x10000000 +, Correct = 0x20000000 +, Mode2Form1Ok = 0x30000000 +, Mode2Form2Ok = 0x40000000 +,
+  Mode2Form2NoCrc = 0x50000000 +
+ }
 Flags describing Compact Disc sector fix-up status. More...
enum  TrackType {
+  Audio = 0 +, Data = 1 +, CdMode1 = 2 +, CdMode2Formless = 3 +,
+  CdMode2Form1 = 4 +, CdMode2Form2 = 5 +
+ }
 Track (partitioning element) types for optical media. More...
enum  AaruformatStatus { AARUF_STATUS_INVALID_CONTEXT = -1 + }
 Status / error codes specific to libaaruformat. More...
enum  XmlMediaType { OpticalDisc = 0 +, BlockMedia = 1 +, LinearMedia = 2 +, AudioMedia = 3 + }
 Enumeration of media types defined in CICM metadata. More...
enum  SectorStatus {
+  SectorStatusNotDumped = 0x0 +, SectorStatusDumped = 0x1 +, SectorStatusErrored = 0x2 +, SectorStatusMode1Correct = 0x3 +,
+  SectorStatusMode2Form1Ok = 0x4 +, SectorStatusMode2Form2Ok = 0x5 +, SectorStatusMode2Form2NoCrc = 0x6 +, SectorStatusTwin = 0x7 +,
+  SectorStatusUnrecorded = 0x8 +, SectorStatusEncrypted = 0x9 +, SectorStatusUnencrypted = 0xA +
+ }
 Acquisition / content status for one or more sectors. More...
enum  FeaturesCompatible { AARU_FEATURE_RW_BLAKE3 = 0x1 + }
 Bit-mask of optional, backward-compatible features stored in an image. More...
+

Enumeration Type Documentation

+ +

◆ AaruformatStatus

+ +
+
+ + + + +
enum AaruformatStatus
+
+ +

Status / error codes specific to libaaruformat.

+ + +
Enumerator
AARUF_STATUS_INVALID_CONTEXT 

Provided context/handle is invalid.

+
+ +

Definition at line 207 of file enums.h.

+ +
+
+ +

◆ BlockType

+ +
+
+ + + + +
enum BlockType
+
+ +

List of known block types contained in an Aaru image.

+ + + + + + + + + + + + + + + + + + + + +
Enumerator
DataBlock 

Block containing data.

+
DeDuplicationTable 

Block containing a deduplication table (v1).

+
DeDuplicationTable2 

Block containing a deduplication table v2.

+
DeDuplicationTableSecondary 

Block containing a secondary deduplication table (v2).

+
IndexBlock 

Block containing the index (v1).

+
IndexBlock2 

Block containing the index v2.

+
IndexBlock3 

Block containing the index v3.

+
GeometryBlock 

Block containing logical geometry.

+
MetadataBlock 

Block containing metadata.

+
TracksBlock 

Block containing optical disc tracks.

+
CicmBlock 

Block containing CICM XML metadata.

+
ChecksumBlock 

Block containing contents checksums.

+
DataPositionMeasurementBlock 

Block containing data position measurements (reserved / TODO).

+
SnapshotBlock 

Block containing a snapshot index (reserved / TODO).

+
ParentBlock 

Block describing how to locate the parent image (reserved / TODO).

+
DumpHardwareBlock 

Block containing an array of hardware used to create the image.

+
TapeFileBlock 

Block containing list of files for a tape image.

+
TapePartitionBlock 

Block containing list of partitions for a tape image.

+
AaruMetadataJsonBlock 

Block containing JSON version of Aaru Metadata.

+
+ +

Definition at line 139 of file enums.h.

+ +
+
+ +

◆ CdFixFlags

+ +
+
+ + + + +
enum CdFixFlags
+
+ +

Flags describing Compact Disc sector fix-up status.

+ + + + + + +
Enumerator
NotDumped 

Sector(s) have not yet been dumped.

+
Correct 

Sector(s) contain valid MODE 1 data with regenerable suffix/prefix.

+
Mode2Form1Ok 

Sector suffix valid for MODE 2 Form 1; regenerable.

+
Mode2Form2Ok 

Sector suffix valid for MODE 2 Form 2 with correct CRC.

+
Mode2Form2NoCrc 

Sector suffix valid for MODE 2 Form 2 but CRC absent/empty.

+
+ +

Definition at line 180 of file enums.h.

+ +
+
+ +

◆ ChecksumAlgorithm

+ +
+
+ + + + +
enum ChecksumAlgorithm
+
+ +

Supported checksum / hash algorithms.

+ + + + + + + +
Enumerator
Invalid 

Invalid / unspecified algorithm.

+
Md5 

MD5 hash.

+
Sha1 

SHA-1 hash.

+
Sha256 

SHA-256 hash.

+
SpamSum 

SpamSum (context-triggered piecewise hash).

+
Blake3 

BLAKE3 hash.

+
+ +

Definition at line 166 of file enums.h.

+ +
+
+ +

◆ CompressionType

+ +
+
+ + + + +
enum CompressionType
+
+ +

List of known compression types.

+ + + + + +
Enumerator
None 

Not compressed.

+
Lzma 

LZMA compression.

+
Flac 

FLAC compression.

+
LzmaClauniaSubchannelTransform 

LZMA applied to Claunia Subchannel Transform processed data.

+
+ +

Definition at line 31 of file enums.h.

+ +
+
+ +

◆ DataType

+ +
+
+ + + + +
enum DataType
+
+ +

List of known data types stored within an Aaru image.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Enumerator
NoData 

No data.

+
UserData 

User (main) data.

+
CompactDiscPartialToc 

Compact Disc partial Table of Contents.

+
CompactDiscSessionInfo 

Compact Disc session information.

+
CompactDiscToc 

Compact Disc full Table of Contents.

+
CompactDiscPma 

Compact Disc Power Management Area (PMA).

+
CompactDiscAtip 

Compact Disc Absolute Time In Pregroove (ATIP).

+
CompactDiscLeadInCdText 

Compact Disc lead-in CD-Text.

+
DvdPfi 

DVD Physical Format Information.

+
DvdLeadInCmi 

DVD lead-in Copyright Management Information (CMI).

+
DvdDiscKey 

DVD disc key.

+
DvdBca 

DVD Burst Cutting Area (BCA).

+
DvdDmi 

DVD Disc Manufacturing Information (DMI).

+
DvdMediaIdentifier 

DVD media identifier.

+
DvdMediaKeyBlock 

DVD Media Key Block (MKB).

+
DvdRamDds 

DVD-RAM Disc Definition Structure (DDS).

+
DvdRamMediumStatus 

DVD-RAM medium status.

+
DvdRamSpareArea 

DVD-RAM spare area information.

+
DvdRRmd 

DVD-R RMD (Recording Management Data).

+
DvdRPrerecordedInfo 

DVD-R pre‑recorded information.

+
DvdRMediaIdentifier 

DVD-R media identifier.

+
DvdRPfi 

DVD-R Physical Format Information.

+
DvdAdip 

DVD Address In Pregroove (ADIP).

+
HdDvdCpi 

HD DVD Copy Protection Information (CPI).

+
HdDvdMediumStatus 

HD DVD medium status.

+
DvdDlLayerCapacity 

DVD dual-layer capacity.

+
DvdDlMiddleZoneAddress 

DVD dual-layer middle zone address.

+
DvdDlJumpIntervalSize 

DVD dual-layer jump interval size.

+
DvdDlManualLayerJumpLba 

DVD dual-layer manual layer jump LBA.

+
BlurayDi 

Blu-ray Disc Information (DI).

+
BlurayBca 

Blu-ray Burst Cutting Area (BCA).

+
BlurayDds 

Blu-ray Disc Definition Structure (DDS).

+
BlurayCartridgeStatus 

Blu-ray cartridge status.

+
BluraySpareArea 

Blu-ray spare area information.

+
AacsVolumeIdentifier 

AACS volume identifier.

+
AacsSerialNumber 

AACS serial number.

+
AacsMediaIdentifier 

AACS media identifier.

+
AacsMediaKeyBlock 

AACS Media Key Block (MKB).

+
AacsDataKeys 

AACS data keys.

+
AacsLbaExtents 

AACS LBA extents.

+
CprmMediaKeyBlock 

CPRM Media Key Block (MKB).

+
HybridRecognizedLayers 

Recognized layers (hybrid media).

+
ScsiMmcWriteProtection 

MMC write-protection data.

+
ScsiMmcDiscInformation 

MMC disc information.

+
ScsiMmcTrackResourcesInformation 

MMC track resources information.

+
ScsiMmcPowResourcesInformation 

MMC POW (Persistent Optical Write?) resources information.

+
ScsiInquiry 

SCSI INQUIRY response.

+
ScsiModePage2A 

SCSI MODE PAGE 2Ah.

+
AtaIdentify 

ATA IDENTIFY DEVICE data.

+
AtapiIdentify 

ATAPI IDENTIFY PACKET DEVICE data.

+
PcmciaCis 

PCMCIA Card Information Structure (CIS).

+
SecureDigitalCid 

Secure Digital CID register.

+
SecureDigitalCsd 

Secure Digital CSD register.

+
SecureDigitalScr 

Secure Digital SCR register.

+
SecureDigitalOcr 

Secure Digital OCR register.

+
MultiMediaCardCid 

MultiMediaCard CID register.

+
MultiMediaCardCsd 

MultiMediaCard CSD register.

+
MultiMediaCardOcr 

MultiMediaCard OCR register.

+
MultiMediaCardExtendedCsd 

MultiMediaCard Extended CSD register.

+
XboxSecuritySector 

Xbox Security Sector.

+
FloppyLeadOut 

Floppy lead‑out data.

+
DvdDiscControlBlock 

DVD Disc Control Block.

+
CompactDiscFirstTrackPregap 

Compact Disc first track pre-gap.

+
CompactDiscLeadOut 

Compact Disc lead‑out.

+
ScsiModeSense6 

SCSI MODE SENSE (6) response.

+
ScsiModeSense10 

SCSI MODE SENSE (10) response.

+
UsbDescriptors 

USB descriptors set.

+
XboxDmi 

Xbox DMI.

+
XboxPfi 

Xbox Physical Format Information (PFI).

+
CdSectorPrefix 

Compact Disc sector prefix (sync, header).

+
CdSectorSuffix 

Compact Disc sector suffix (EDC, ECC P, ECC Q).

+
CdSectorSubchannel 

Compact Disc subchannel data.

+
AppleProfileTag 

Apple Profile (20‑byte) tag.

+
AppleSonyTag 

Apple Sony (12‑byte) tag.

+
PriamDataTowerTag 

Priam Data Tower (24‑byte) tag.

+
CompactDiscMediaCatalogueNumber 

Compact Disc Media Catalogue Number (lead‑in, 13 ASCII bytes).

+
CdSectorPrefixCorrected 

Compact Disc sector prefix (sync, header) corrected-only stored.

+
CdSectorSuffixCorrected 

Compact Disc sector suffix (EDC, ECC P, ECC Q) corrected-only stored.

+
CompactDiscMode2Subheader 

Compact Disc MODE 2 subheader.

+
CompactDiscLeadIn 

Compact Disc lead‑in.

+
DvdDiscKeyDecrypted 

Decrypted DVD Disc Key.

+
DvdSectorCprMai 

DVD Copyright Management Information (CPR_MAI)

+
DvdSectorTitleKeyDecrypted 

Decrypted DVD Title Key.

+
DvdSectorId 

DVD Identification Data (ID)

+
DvdSectorIed 

DVD ID Error Detection Code (IED)

+
DvdSectorEdc 

DVD Error Detection Code (EDC)

+
DvdSectorEccPi 

DVD Error Correction Code (ECC) Parity of Inner Code (PI)

+
DvdEccBlockPo 

DVD Error Correction Code (ECC) Parity of Outer Code (PO)

+
+ +

Definition at line 43 of file enums.h.

+ +
+
+ +

◆ FeaturesCompatible

+ +
+
+ + + + +
enum FeaturesCompatible
+
+ +

Bit-mask of optional, backward-compatible features stored in an image.

+

These flags advertise additional data structures or capabilities embedded in the image that older readers MAY safely ignore. An unknown bit MUST be treated as "feature unsupported" without failing to open the image. Writers set the bits for features they included; readers test them to enable extended behaviors.

+

Usage example:

uint64_t features = header->featuresCompatible; // value read from on-disk header
+
if(features & AARU_FEATURE_RW_BLAKE3)
+
{
+
// Image contains BLAKE3 checksums; enable BLAKE3 verification path.
+
}
+
@ AARU_FEATURE_RW_BLAKE3
BLAKE3 checksum is present (read/write support for BLAKE3 hashes).
Definition enums.h:265
+

Future compatible features SHALL use the next available bit (1ULL << n).

+ + +
Enumerator
AARU_FEATURE_RW_BLAKE3 

BLAKE3 checksum is present (read/write support for BLAKE3 hashes).

+
+ +

Definition at line 263 of file enums.h.

+ +
+
+ +

◆ SectorStatus

+ +
+
+ + + + +
enum SectorStatus
+
+ +

Acquisition / content status for one or more sectors.

+ + + + + + + + + + + + +
Enumerator
SectorStatusNotDumped 

Sector(s) not yet acquired during image dumping.

+
SectorStatusDumped 

Sector(s) successfully dumped without error.

+
SectorStatusErrored 

Error during dumping; data may be incomplete or corrupt.

+
SectorStatusMode1Correct 

Valid MODE 1 data with regenerable suffix/prefix.

+
SectorStatusMode2Form1Ok 

Suffix verified/regenerable for MODE 2 Form 1.

+
SectorStatusMode2Form2Ok 

Suffix matches MODE 2 Form 2 with valid CRC.

+
SectorStatusMode2Form2NoCrc 

Suffix matches MODE 2 Form 2 but CRC empty/missing.

+
SectorStatusTwin 

Pointer references a twin sector table.

+
SectorStatusUnrecorded 

Sector physically unrecorded; repeated reads non-deterministic.

+
SectorStatusEncrypted 

Content encrypted and stored encrypted in image.

+
SectorStatusUnencrypted 

Content originally encrypted but stored decrypted in image.

+
+ +

Definition at line 228 of file enums.h.

+ +
+
+ +

◆ TrackType

+ +
+
+ + + + +
enum TrackType
+
+ +

Track (partitioning element) types for optical media.

+ + + + + + + +
Enumerator
Audio 

Audio track.

+
Data 

Generic data track (not further specified).

+
CdMode1 

Compact Disc Mode 1 data track.

+
CdMode2Formless 

Compact Disc Mode 2 (formless) data track.

+
CdMode2Form1 

Compact Disc Mode 2 Form 1 data track.

+
CdMode2Form2 

Compact Disc Mode 2 Form 2 data track.

+
+ +

Definition at line 193 of file enums.h.

+ +
+
+ +

◆ XmlMediaType

+ +
+
+ + + + +
enum XmlMediaType
+
+ +

Enumeration of media types defined in CICM metadata.

+ + + + + +
Enumerator
OpticalDisc 

Purely optical discs.

+
BlockMedia 

Media that is physically block-based or abstracted like that.

+
LinearMedia 

Media that can be accessed by-byte or by-bit, like chips.

+
AudioMedia 

Media that can only store data when modulated to audio.

+
+ +

Definition at line 216 of file enums.h.

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/enums_8h.js b/docs/html/enums_8h.js new file mode 100644 index 0000000..e076bc9 --- /dev/null +++ b/docs/html/enums_8h.js @@ -0,0 +1,168 @@ +var enums_8h = +[ + [ "AaruformatStatus", "enums_8h.html#af887903d155851fe30d08053c4b2c1b8", [ + [ "AARUF_STATUS_INVALID_CONTEXT", "enums_8h.html#af887903d155851fe30d08053c4b2c1b8a2ee503de2bb99eb6a677fd9871a9c44d", null ] + ] ], + [ "BlockType", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3", [ + [ "DataBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3a5a0811c5ee97536aef900cecb8787713", null ], + [ "DeDuplicationTable", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3ac9f1e20a51c73f238aa322e180c42bd4", null ], + [ "DeDuplicationTable2", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3aba4d0f50b26af1d0292daaa0d70feacf", null ], + [ "DeDuplicationTableSecondary", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3a76b6a78e4e765794c4cca2dde5bfc3fb", null ], + [ "IndexBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3ab8d63dc690b2ba82f066fdc31ab5adad", null ], + [ "IndexBlock2", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3a6ee3c4c583df36e3dfe796593c1e9439", null ], + [ "IndexBlock3", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3a318acaf230a8ad091ef405caf7e4f411", null ], + [ "GeometryBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3a76691ea3f772bf28e7446d171e205db2", null ], + [ "MetadataBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3ad5a8c9e1ce6a2acd795dc1e7561addf8", null ], + [ "TracksBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3ae550bdf57660fcbf3500155c29d4637e", null ], + [ "CicmBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3aa90947995922dcd8b27c998978aba359", null ], + [ "ChecksumBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3a3e451c2577a6c790f33f99c2da189d46", null ], + [ "DataPositionMeasurementBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3adb070ea0a488e0519514d18b2579d450", null ], + [ "SnapshotBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3a7c4697ba513490ff05ea4daf1044957f", null ], + [ "ParentBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3aaf2b82002c359bb1547a4b3f6d39cd28", null ], + [ "DumpHardwareBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3ad33812deb344562478c4e0d208a114db", null ], + [ "TapeFileBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3ac3a117f2498bf736a76d5d3a3830540a", null ], + [ "TapePartitionBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3a60609bbcd07339a8bf589e66ef4a3041", null ], + [ "AaruMetadataJsonBlock", "enums_8h.html#a54420623f26ab6bb61042b41cccf37a3a8ac77889f0c345ed861ed653a3063032", null ] + ] ], + [ "CdFixFlags", "enums_8h.html#ab72dc399e3946b3c40a5ad8c8e3254b7", [ + [ "NotDumped", "enums_8h.html#ab72dc399e3946b3c40a5ad8c8e3254b7ab3fac5cd103786d64f7ee67bcb9ac458", null ], + [ "Correct", "enums_8h.html#ab72dc399e3946b3c40a5ad8c8e3254b7a1b85919d51f4333b17766b19a7c7372d", null ], + [ "Mode2Form1Ok", "enums_8h.html#ab72dc399e3946b3c40a5ad8c8e3254b7aa0182bd12e0fed2c6f2ea368cc9a94a8", null ], + [ "Mode2Form2Ok", "enums_8h.html#ab72dc399e3946b3c40a5ad8c8e3254b7a347d3d74e3c5f56a3e41eb82e59b952f", null ], + [ "Mode2Form2NoCrc", "enums_8h.html#ab72dc399e3946b3c40a5ad8c8e3254b7abe4c0f68addb6b935a63401cafcb8d28", null ] + ] ], + [ "ChecksumAlgorithm", "enums_8h.html#abda1f9cb04c30fc71ee8c6081d21ee0e", [ + [ "Invalid", "enums_8h.html#abda1f9cb04c30fc71ee8c6081d21ee0eae962ea8b0b3a376575ad0e616eeac474", null ], + [ "Md5", "enums_8h.html#abda1f9cb04c30fc71ee8c6081d21ee0ea6b71eaa2d57de3fc320990a29ce48d36", null ], + [ "Sha1", "enums_8h.html#abda1f9cb04c30fc71ee8c6081d21ee0ea57867fd2e139c87d4ae5faef0078a903", null ], + [ "Sha256", "enums_8h.html#abda1f9cb04c30fc71ee8c6081d21ee0eacce7cd78517eecf9be314e0d47e2788c", null ], + [ "SpamSum", "enums_8h.html#abda1f9cb04c30fc71ee8c6081d21ee0ead603a5fa54bfacf5bf36eca36c6b54cb", null ], + [ "Blake3", "enums_8h.html#abda1f9cb04c30fc71ee8c6081d21ee0ea38ec9844caac88b80addcad50704f0fd", null ] + ] ], + [ "CompressionType", "enums_8h.html#affec749ed88365143745313ae9168263", [ + [ "None", "enums_8h.html#affec749ed88365143745313ae9168263ac9d3e887722f2bc482bcca9d41c512af", null ], + [ "Lzma", "enums_8h.html#affec749ed88365143745313ae9168263a002db7938c70152bf9af1797cb87c32f", null ], + [ "Flac", "enums_8h.html#affec749ed88365143745313ae9168263adce52e91e4d88a577ecf67cbe7beac31", null ], + [ "LzmaClauniaSubchannelTransform", "enums_8h.html#affec749ed88365143745313ae9168263ab6147cfb5a7f96c11a4e4aafd9cc8ce0", null ] + ] ], + [ "DataType", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6", [ + [ "NoData", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a7f6b1dc06a7ab741e7f56df8050b05b6", null ], + [ "UserData", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a73bb26133ccd01972725933b00ec3a06", null ], + [ "CompactDiscPartialToc", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a5143bb6ee06b07d1dd061dc94fa2037b", null ], + [ "CompactDiscSessionInfo", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a03663fbb4ba4732a9d8d1248a8ec648e", null ], + [ "CompactDiscToc", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a7f0e3600c8aa318fc02efe7a53d8e7dc", null ], + [ "CompactDiscPma", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ae110212b0a62900f189a4a44d7b81aec", null ], + [ "CompactDiscAtip", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a227dd7be38401cddb44e30786706549f", null ], + [ "CompactDiscLeadInCdText", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a39f992c770260c608ca8ec0ced94c243", null ], + [ "DvdPfi", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a0c915e97615e48fe041f29f0f9640298", null ], + [ "DvdLeadInCmi", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a80ef5f6d2b4321636b70ddd6b9d57e7a", null ], + [ "DvdDiscKey", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a00532938ab561a501dd27181f9f6f419", null ], + [ "DvdBca", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6aafb8c649465ee8c962517de0c74acff5", null ], + [ "DvdDmi", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a76a2b08c187de11e9dc41bf258723945", null ], + [ "DvdMediaIdentifier", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ac933f80f49861d44e5a89127f7809004", null ], + [ "DvdMediaKeyBlock", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6aeecff235ea5f2b6a475fe6eb59fcfba9", null ], + [ "DvdRamDds", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a2f674ba347d80429ef3177ee966835f1", null ], + [ "DvdRamMediumStatus", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a30b33fb0be8e0749219d56a11715e984", null ], + [ "DvdRamSpareArea", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ab21319d7f501c7b4a4dc7a50d66b2f10", null ], + [ "DvdRRmd", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6af5c17a3c1c5602eb3caa2413bcea3081", null ], + [ "DvdRPrerecordedInfo", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6aa8f7df4d3c47f3ac216e99e14be6edfc", null ], + [ "DvdRMediaIdentifier", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ab4de7e0701da0337783a5ba86487314d", null ], + [ "DvdRPfi", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a03e6afb5f49a132381fad890ec374881", null ], + [ "DvdAdip", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a823514f7dfe66daa362df399e17ff314", null ], + [ "HdDvdCpi", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a196905fee9361f3b1965e82ea745142a", null ], + [ "HdDvdMediumStatus", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a8121b6cf4b77f13b115d4758b00fc880", null ], + [ "DvdDlLayerCapacity", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a1a094d927eb17a2b559a05321b3c0dae", null ], + [ "DvdDlMiddleZoneAddress", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ac08ff47e61624e64dce9dc0d209f1a82", null ], + [ "DvdDlJumpIntervalSize", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6af229a41f083199af8520dd1e5dd6310b", null ], + [ "DvdDlManualLayerJumpLba", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ae8b9f27db282b83a4fb8b80e4f18e8da", null ], + [ "BlurayDi", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a87d824a9987888180fb826f633c27210", null ], + [ "BlurayBca", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ac61ed90fcfd8386b6e8269bd69895c13", null ], + [ "BlurayDds", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6af57987d7cbc5739aed5317192308238d", null ], + [ "BlurayCartridgeStatus", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ac46f573ecc193059e928f8f82ae0f55b", null ], + [ "BluraySpareArea", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a9a7723fde7bf407e5c96647feaf01496", null ], + [ "AacsVolumeIdentifier", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a71d80a2659a37aa0031f0f3665235f1d", null ], + [ "AacsSerialNumber", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6acbc06e4362c034d96f0bb68c19236ebf", null ], + [ "AacsMediaIdentifier", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a30ded561dc14000b0d5710874ba1bfa5", null ], + [ "AacsMediaKeyBlock", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a337b98986f77c8afe00faccbc9892419", null ], + [ "AacsDataKeys", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a86fa84620924b1b23a9239ca159d6e9c", null ], + [ "AacsLbaExtents", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a84cef642f10e93f29a974de59720bf5f", null ], + [ "CprmMediaKeyBlock", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a55be40c7e02f369c7551d492e47688c0", null ], + [ "HybridRecognizedLayers", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ab848200e8bd993a8765d420e88ded3b1", null ], + [ "ScsiMmcWriteProtection", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6abcb8addc6a7d146e2456bae416ca4c1b", null ], + [ "ScsiMmcDiscInformation", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a2f179d34916838aec356ba3167e5556d", null ], + [ "ScsiMmcTrackResourcesInformation", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a04bf8ba63a86c8537f0df0184e6ceac1", null ], + [ "ScsiMmcPowResourcesInformation", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a58f12e34f463ab8f4d3252db7ad85444", null ], + [ "ScsiInquiry", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a76a61fecf5bdc6c70cf4612b915540a0", null ], + [ "ScsiModePage2A", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a40de49c07f3944726647dd9419d921a7", null ], + [ "AtaIdentify", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a851c2bac1a6469787afdd5bc0569fb68", null ], + [ "AtapiIdentify", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6aa20aaed517e472e1fdccc5ebbf5140b0", null ], + [ "PcmciaCis", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6aad4c69101015cba2f3bd4727e5a29aa0", null ], + [ "SecureDigitalCid", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a624fcfd820df761f5fb3240b5f244383", null ], + [ "SecureDigitalCsd", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a8b8b6078afd12ecfc796fee80565eb7d", null ], + [ "SecureDigitalScr", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6aa79662d7d9a34932734d98880e9e79a9", null ], + [ "SecureDigitalOcr", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a49565e498f53e98c7e343d8df86d988a", null ], + [ "MultiMediaCardCid", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ab357cd602ae4f4a4c181d41b431284b0", null ], + [ "MultiMediaCardCsd", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a4cc34aca09ad35e66617022bbd5285c4", null ], + [ "MultiMediaCardOcr", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a275b42c769cece350112d95b8a7d5cff", null ], + [ "MultiMediaCardExtendedCsd", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ae82d2f62f8b38c6a46c2fce10f2b782e", null ], + [ "XboxSecuritySector", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a672680fe426a1b029cb10bce29581069", null ], + [ "FloppyLeadOut", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ad28a6e4b3a2ac2917dec6684f2e6a08e", null ], + [ "DvdDiscControlBlock", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6acf45c1ba8c7e4682090a86d37c9f81da", null ], + [ "CompactDiscFirstTrackPregap", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ac6e9e105af039dd66ece2786815bebf1", null ], + [ "CompactDiscLeadOut", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a235926f47e66e672c2f50ef0ffda0e97", null ], + [ "ScsiModeSense6", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ac983f831b4dbfc2f22b97d4faf5bf06d", null ], + [ "ScsiModeSense10", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ad2ac24fd520d174efe61e8560f639466", null ], + [ "UsbDescriptors", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6acbb8948479c06b5704788a3f9839571c", null ], + [ "XboxDmi", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ab4857ad3c31dd87c208b4f28d82d386e", null ], + [ "XboxPfi", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ae574d4d21fa0d883e192fa8a2138d28d", null ], + [ "CdSectorPrefix", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a4cc94cd48947bd2bb9ab37d56b8eab98", null ], + [ "CdSectorSuffix", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6aee38da0d8fd8047e5468514ff9be0f75", null ], + [ "CdSectorSubchannel", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a0e53a44004fde98a09614db19b16638e", null ], + [ "AppleProfileTag", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a17075a1bffaf0da39e0baacabc84a0fe", null ], + [ "AppleSonyTag", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a459369a1461803ec0cc998b606d53b07", null ], + [ "PriamDataTowerTag", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a6ed24283290264c28e919adf5a273f99", null ], + [ "CompactDiscMediaCatalogueNumber", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a659af4091b52ae305eb043955c95fde6", null ], + [ "CdSectorPrefixCorrected", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a334601eb11ca43681ee5ddd87d40098c", null ], + [ "CdSectorSuffixCorrected", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a59517cdd9c835f2b32130cc49e31d151", null ], + [ "CompactDiscMode2Subheader", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6af6d3ec9140499909db18dae9cfbfd056", null ], + [ "CompactDiscLeadIn", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6aab1aa75c45db39c45a13b87b8ebf44a3", null ], + [ "DvdDiscKeyDecrypted", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a9cb28a1556497feb7a678cfddcf71d76", null ], + [ "DvdSectorCprMai", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a39dc93795ee5d8befec5ee5607cb1a9b", null ], + [ "DvdSectorTitleKeyDecrypted", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ab5223833b1f998e3475f800f6509c2f9", null ], + [ "DvdSectorId", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6ac1c178060cb3287b7283b83000f28dab", null ], + [ "DvdSectorIed", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a3340d65528decaa438460aaf53f2febe", null ], + [ "DvdSectorEdc", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a9761d07be6a71826f3f0146d091f2176", null ], + [ "DvdSectorEccPi", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6abb62769f9eb8d50d3fe96c2eccfe82de", null ], + [ "DvdEccBlockPo", "enums_8h.html#ad8ed01ff3ff33333d8e19db4d2818bb6a9773bd9f1ecc63ab9b38641c4637ba44", null ] + ] ], + [ "FeaturesCompatible", "enums_8h.html#af104aa102cdba100b9f245bef4abd42d", [ + [ "AARU_FEATURE_RW_BLAKE3", "enums_8h.html#af104aa102cdba100b9f245bef4abd42da8cc0519eeba84d57f99c239f687616b4", null ] + ] ], + [ "SectorStatus", "enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0", [ + [ "SectorStatusNotDumped", "enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0a032ffcff283d253414768f0fa035af4d", null ], + [ "SectorStatusDumped", "enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0a018d08672ed62f6f147db4f25ce3917c", null ], + [ "SectorStatusErrored", "enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0ab92ec5c02efb2acf7fe8a6312fe30c80", null ], + [ "SectorStatusMode1Correct", "enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0a98ca0ee5ee0653575fc98b501a3387cf", null ], + [ "SectorStatusMode2Form1Ok", "enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0af8e8f72cb68b416548d729560b23ff7d", null ], + [ "SectorStatusMode2Form2Ok", "enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0aa651286b685968cf12dbf8949c7c209d", null ], + [ "SectorStatusMode2Form2NoCrc", "enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0a6a9daca7b82c2929eaf1b081ba7c7437", null ], + [ "SectorStatusTwin", "enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0a129be26463a6af01b2babe9f687c94c7", null ], + [ "SectorStatusUnrecorded", "enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0a3937b7d580c278a8068b6c2c3a5592c9", null ], + [ "SectorStatusEncrypted", "enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0a5bd0d03e870d18a055ae43f100ca3b0f", null ], + [ "SectorStatusUnencrypted", "enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0a4f144fd3d47ebf7e4103c3b89e051735", null ] + ] ], + [ "TrackType", "enums_8h.html#ad80740dd555f7d3688d2c4d9f44d3b04", [ + [ "Audio", "enums_8h.html#ad80740dd555f7d3688d2c4d9f44d3b04ad3c111fe8a0e835609a6187d6e9d2e57", null ], + [ "Data", "enums_8h.html#ad80740dd555f7d3688d2c4d9f44d3b04aa9703801ac7bd790f6f980532e4224c0", null ], + [ "CdMode1", "enums_8h.html#ad80740dd555f7d3688d2c4d9f44d3b04aa2aea1fa4875ff43b28267ad736cec62", null ], + [ "CdMode2Formless", "enums_8h.html#ad80740dd555f7d3688d2c4d9f44d3b04aff99910681f4abb6ac45b08562b2797e", null ], + [ "CdMode2Form1", "enums_8h.html#ad80740dd555f7d3688d2c4d9f44d3b04af90c2d371aa1e99d911ec2173587186c", null ], + [ "CdMode2Form2", "enums_8h.html#ad80740dd555f7d3688d2c4d9f44d3b04ab68a4bd72f7e85f28dcb9c5a5441743a", null ] + ] ], + [ "XmlMediaType", "enums_8h.html#abaa37b51ab0a4cc3d5d1a0b4820c8466", [ + [ "OpticalDisc", "enums_8h.html#abaa37b51ab0a4cc3d5d1a0b4820c8466aaf46f69508c3a90e5588c71f410a7f12", null ], + [ "BlockMedia", "enums_8h.html#abaa37b51ab0a4cc3d5d1a0b4820c8466ad45ebea105994c5fe86200f36d9e6ccd", null ], + [ "LinearMedia", "enums_8h.html#abaa37b51ab0a4cc3d5d1a0b4820c8466ad7ed6261e5a619889a8d6d8e686e4d29", null ], + [ "AudioMedia", "enums_8h.html#abaa37b51ab0a4cc3d5d1a0b4820c8466a9e97480bb5bfd42a31c819b7226778d7", null ] + ] ] +]; \ No newline at end of file diff --git a/docs/html/enums_8h_source.html b/docs/html/enums_8h_source.html new file mode 100644 index 0000000..513d1f8 --- /dev/null +++ b/docs/html/enums_8h_source.html @@ -0,0 +1,497 @@ + + + + + + + +libaaruformat: include/aaruformat/enums.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
enums.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_ENUMS_H
+
20#define LIBAARUFORMAT_ENUMS_H
+
21
+
22#ifndef _MSC_VER
+
23#pragma clang diagnostic push
+
24#pragma ide diagnostic ignored "OCUnusedGlobalDeclarationInspection"
+
25#endif
+
26
+
+
31typedef enum
+
32{
+
33 None = 0,
+
34 Lzma = 1,
+
35 Flac = 2,
+ + +
+
38
+
+
43typedef enum
+
44{
+
45 NoData = 0,
+ + + + + + + +
53 DvdPfi = 8,
+ + +
56 DvdBca = 11,
+
57 DvdDmi = 12,
+ + +
60 DvdRamDds = 15,
+ + +
63 DvdRRmd = 18,
+ + +
66 DvdRPfi = 21,
+
67 DvdAdip = 22,
+
68 HdDvdCpi = 23,
+ + + + + +
74 BlurayDi = 29,
+
75 BlurayBca = 30,
+
76 BlurayDds = 31,
+ + + + + + + + + + + + + + + + + + +
95 PcmciaCis = 50,
+ + + + + + + + + + + + + + + + +
112 XboxDmi = 67,
+
113 XboxPfi = 68,
+ + + + + + + + + + + + + + + + + + + +
133} DataType;
+
+
134
+
+
139typedef enum
+
140{
+
141 DataBlock = 0x4B4C4244,
+
142 DeDuplicationTable = 0x2A544444,
+
143 DeDuplicationTable2 = 0x32544444,
+ +
145 IndexBlock = 0x58444E49,
+
146 IndexBlock2 = 0x32584449,
+
147 IndexBlock3 = 0x33584449,
+
148 GeometryBlock = 0x4D4F4547,
+
149 MetadataBlock = 0x4154454D,
+
150 TracksBlock = 0x534B5254,
+
151 CicmBlock = 0x4D434943,
+
152 ChecksumBlock = 0x4D534B43,
+ +
154 SnapshotBlock = 0x50414E53,
+
155 ParentBlock = 0x50524E54,
+
156 DumpHardwareBlock = 0x2A504D44,
+
157 TapeFileBlock = 0x454C4654,
+
158 TapePartitionBlock = 0x54425054,
+ +
160} BlockType;
+
+
161
+
+
166typedef enum
+
167{
+ +
169 Md5 = 1,
+
170 Sha1 = 2,
+
171 Sha256 = 3,
+ +
173 Blake3 = 5,
+ +
+
175
+
+
180typedef enum
+
181{
+
182 NotDumped = 0x10000000,
+
183 Correct = 0x20000000,
+
184 Mode2Form1Ok = 0x30000000,
+
185 Mode2Form2Ok = 0x40000000,
+
186 Mode2Form2NoCrc = 0x50000000
+
187} CdFixFlags;
+
+
188
+
+
193typedef enum
+
194{
+
195 Audio = 0,
+
196 Data = 1,
+ + + + +
201} TrackType;
+
+
202
+
+
207typedef enum
+
208{
+ + +
+
211
+
+
216typedef enum
+
217{
+ + + + + +
+
223
+ +
242
+
+
263typedef enum
+
264{
+ + +
+
267
+
268#ifndef _MSC_VER
+
269#pragma clang diagnostic pop
+
270#endif
+
271
+
272#endif // LIBAARUFORMAT_ENUMS_H
+
BlockType
List of known block types contained in an Aaru image.
Definition enums.h:140
+
@ IndexBlock3
Block containing the index v3.
Definition enums.h:147
+
@ ChecksumBlock
Block containing contents checksums.
Definition enums.h:152
+
@ DataBlock
Block containing data.
Definition enums.h:141
+
@ TapePartitionBlock
Block containing list of partitions for a tape image.
Definition enums.h:158
+
@ IndexBlock2
Block containing the index v2.
Definition enums.h:146
+
@ GeometryBlock
Block containing logical geometry.
Definition enums.h:148
+
@ DeDuplicationTableSecondary
Block containing a secondary deduplication table (v2).
Definition enums.h:144
+
@ SnapshotBlock
Block containing a snapshot index (reserved / TODO).
Definition enums.h:154
+
@ AaruMetadataJsonBlock
Block containing JSON version of Aaru Metadata.
Definition enums.h:159
+
@ CicmBlock
Block containing CICM XML metadata.
Definition enums.h:151
+
@ ParentBlock
Block describing how to locate the parent image (reserved / TODO).
Definition enums.h:155
+
@ IndexBlock
Block containing the index (v1).
Definition enums.h:145
+
@ DeDuplicationTable2
Block containing a deduplication table v2.
Definition enums.h:143
+
@ TapeFileBlock
Block containing list of files for a tape image.
Definition enums.h:157
+
@ DeDuplicationTable
Block containing a deduplication table (v1).
Definition enums.h:142
+
@ DumpHardwareBlock
Block containing an array of hardware used to create the image.
Definition enums.h:156
+
@ MetadataBlock
Block containing metadata.
Definition enums.h:149
+
@ DataPositionMeasurementBlock
Block containing data position measurements (reserved / TODO).
Definition enums.h:153
+
@ TracksBlock
Block containing optical disc tracks.
Definition enums.h:150
+
SectorStatus
Acquisition / content status for one or more sectors.
Definition enums.h:229
+
@ SectorStatusDumped
Sector(s) successfully dumped without error.
Definition enums.h:231
+
@ SectorStatusNotDumped
Sector(s) not yet acquired during image dumping.
Definition enums.h:230
+
@ SectorStatusTwin
Pointer references a twin sector table.
Definition enums.h:237
+
@ SectorStatusUnrecorded
Sector physically unrecorded; repeated reads non-deterministic.
Definition enums.h:238
+
@ SectorStatusUnencrypted
Content originally encrypted but stored decrypted in image.
Definition enums.h:240
+
@ SectorStatusEncrypted
Content encrypted and stored encrypted in image.
Definition enums.h:239
+
@ SectorStatusMode2Form2NoCrc
Suffix matches MODE 2 Form 2 but CRC empty/missing.
Definition enums.h:236
+
@ SectorStatusMode1Correct
Valid MODE 1 data with regenerable suffix/prefix.
Definition enums.h:233
+
@ SectorStatusMode2Form2Ok
Suffix matches MODE 2 Form 2 with valid CRC.
Definition enums.h:235
+
@ SectorStatusErrored
Error during dumping; data may be incomplete or corrupt.
Definition enums.h:232
+
@ SectorStatusMode2Form1Ok
Suffix verified/regenerable for MODE 2 Form 1.
Definition enums.h:234
+
CdFixFlags
Flags describing Compact Disc sector fix-up status.
Definition enums.h:181
+
@ Correct
Sector(s) contain valid MODE 1 data with regenerable suffix/prefix.
Definition enums.h:183
+
@ Mode2Form2Ok
Sector suffix valid for MODE 2 Form 2 with correct CRC.
Definition enums.h:185
+
@ Mode2Form1Ok
Sector suffix valid for MODE 2 Form 1; regenerable.
Definition enums.h:184
+
@ NotDumped
Sector(s) have not yet been dumped.
Definition enums.h:182
+
@ Mode2Form2NoCrc
Sector suffix valid for MODE 2 Form 2 but CRC absent/empty.
Definition enums.h:186
+
XmlMediaType
Enumeration of media types defined in CICM metadata.
Definition enums.h:217
+
@ AudioMedia
Media that can only store data when modulated to audio.
Definition enums.h:221
+
@ OpticalDisc
Purely optical discs.
Definition enums.h:218
+
@ BlockMedia
Media that is physically block-based or abstracted like that.
Definition enums.h:219
+
@ LinearMedia
Media that can be accessed by-byte or by-bit, like chips.
Definition enums.h:220
+
ChecksumAlgorithm
Supported checksum / hash algorithms.
Definition enums.h:167
+
@ Blake3
BLAKE3 hash.
Definition enums.h:173
+
@ Sha1
SHA-1 hash.
Definition enums.h:170
+
@ Md5
MD5 hash.
Definition enums.h:169
+
@ Sha256
SHA-256 hash.
Definition enums.h:171
+
@ SpamSum
SpamSum (context-triggered piecewise hash).
Definition enums.h:172
+
@ Invalid
Invalid / unspecified algorithm.
Definition enums.h:168
+
TrackType
Track (partitioning element) types for optical media.
Definition enums.h:194
+
@ CdMode1
Compact Disc Mode 1 data track.
Definition enums.h:197
+
@ Data
Generic data track (not further specified).
Definition enums.h:196
+
@ CdMode2Form2
Compact Disc Mode 2 Form 2 data track.
Definition enums.h:200
+
@ Audio
Audio track.
Definition enums.h:195
+
@ CdMode2Form1
Compact Disc Mode 2 Form 1 data track.
Definition enums.h:199
+
@ CdMode2Formless
Compact Disc Mode 2 (formless) data track.
Definition enums.h:198
+
DataType
List of known data types stored within an Aaru image.
Definition enums.h:44
+
@ DvdDiscKey
DVD disc key.
Definition enums.h:55
+
@ CompactDiscSessionInfo
Compact Disc session information.
Definition enums.h:48
+
@ DvdRPfi
DVD-R Physical Format Information.
Definition enums.h:66
+
@ ScsiMmcTrackResourcesInformation
MMC track resources information.
Definition enums.h:89
+
@ DvdPfi
DVD Physical Format Information.
Definition enums.h:53
+
@ CdSectorSubchannel
Compact Disc subchannel data.
Definition enums.h:116
+
@ AppleProfileTag
Apple Profile (20‑byte) tag.
Definition enums.h:117
+
@ HdDvdCpi
HD DVD Copy Protection Information (CPI).
Definition enums.h:68
+
@ DvdDlLayerCapacity
DVD dual-layer capacity.
Definition enums.h:70
+
@ CompactDiscAtip
Compact Disc Absolute Time In Pregroove (ATIP).
Definition enums.h:51
+
@ CompactDiscLeadOut
Compact Disc lead‑out.
Definition enums.h:108
+
@ MultiMediaCardOcr
MultiMediaCard OCR register.
Definition enums.h:102
+
@ ScsiMmcDiscInformation
MMC disc information.
Definition enums.h:88
+
@ DvdRamDds
DVD-RAM Disc Definition Structure (DDS).
Definition enums.h:60
+
@ DvdRamMediumStatus
DVD-RAM medium status.
Definition enums.h:61
+
@ AacsMediaIdentifier
AACS media identifier.
Definition enums.h:81
+
@ DvdSectorIed
DVD ID Error Detection Code (IED)
Definition enums.h:129
+
@ CdSectorPrefixCorrected
Compact Disc sector prefix (sync, header) corrected-only stored.
Definition enums.h:121
+
@ AacsMediaKeyBlock
AACS Media Key Block (MKB).
Definition enums.h:82
+
@ DvdSectorCprMai
DVD Copyright Management Information (CPR_MAI)
Definition enums.h:126
+
@ CompactDiscLeadInCdText
Compact Disc lead-in CD-Text.
Definition enums.h:52
+
@ ScsiModePage2A
SCSI MODE PAGE 2Ah.
Definition enums.h:92
+
@ AppleSonyTag
Apple Sony (12‑byte) tag.
Definition enums.h:118
+
@ SecureDigitalOcr
Secure Digital OCR register.
Definition enums.h:99
+
@ MultiMediaCardCsd
MultiMediaCard CSD register.
Definition enums.h:101
+
@ CdSectorPrefix
Compact Disc sector prefix (sync, header).
Definition enums.h:114
+
@ CompactDiscPartialToc
Compact Disc partial Table of Contents.
Definition enums.h:47
+
@ CprmMediaKeyBlock
CPRM Media Key Block (MKB).
Definition enums.h:85
+
@ ScsiMmcPowResourcesInformation
MMC POW (Persistent Optical Write?) resources information.
Definition enums.h:90
+
@ CdSectorSuffixCorrected
Compact Disc sector suffix (EDC, ECC P, ECC Q) corrected-only stored.
Definition enums.h:122
+
@ SecureDigitalCid
Secure Digital CID register.
Definition enums.h:96
+
@ CompactDiscMediaCatalogueNumber
Compact Disc Media Catalogue Number (lead‑in, 13 ASCII bytes).
Definition enums.h:120
+
@ XboxSecuritySector
Xbox Security Sector.
Definition enums.h:104
+
@ PriamDataTowerTag
Priam Data Tower (24‑byte) tag.
Definition enums.h:119
+
@ AacsVolumeIdentifier
AACS volume identifier.
Definition enums.h:79
+
@ UserData
User (main) data.
Definition enums.h:46
+
@ DvdDmi
DVD Disc Manufacturing Information (DMI).
Definition enums.h:57
+
@ ScsiInquiry
SCSI INQUIRY response.
Definition enums.h:91
+
@ CompactDiscToc
Compact Disc full Table of Contents.
Definition enums.h:49
+
@ NoData
No data.
Definition enums.h:45
+
@ DvdLeadInCmi
DVD lead-in Copyright Management Information (CMI).
Definition enums.h:54
+
@ HdDvdMediumStatus
HD DVD medium status.
Definition enums.h:69
+
@ DvdAdip
DVD Address In Pregroove (ADIP).
Definition enums.h:67
+
@ AacsLbaExtents
AACS LBA extents.
Definition enums.h:84
+
@ AtaIdentify
ATA IDENTIFY DEVICE data.
Definition enums.h:93
+
@ AacsDataKeys
AACS data keys.
Definition enums.h:83
+
@ BlurayDi
Blu-ray Disc Information (DI).
Definition enums.h:74
+
@ SecureDigitalCsd
Secure Digital CSD register.
Definition enums.h:97
+
@ DvdSectorEdc
DVD Error Detection Code (EDC)
Definition enums.h:130
+
@ DvdEccBlockPo
DVD Error Correction Code (ECC) Parity of Outer Code (PO)
Definition enums.h:132
+
@ BluraySpareArea
Blu-ray spare area information.
Definition enums.h:78
+
@ DvdDiscKeyDecrypted
Decrypted DVD Disc Key.
Definition enums.h:125
+
@ AtapiIdentify
ATAPI IDENTIFY PACKET DEVICE data.
Definition enums.h:94
+
@ SecureDigitalScr
Secure Digital SCR register.
Definition enums.h:98
+
@ DvdRPrerecordedInfo
DVD-R pre‑recorded information.
Definition enums.h:64
+
@ CompactDiscLeadIn
Compact Disc lead‑in.
Definition enums.h:124
+
@ PcmciaCis
PCMCIA Card Information Structure (CIS).
Definition enums.h:95
+
@ DvdBca
DVD Burst Cutting Area (BCA).
Definition enums.h:56
+
@ DvdRamSpareArea
DVD-RAM spare area information.
Definition enums.h:62
+
@ MultiMediaCardCid
MultiMediaCard CID register.
Definition enums.h:100
+
@ XboxDmi
Xbox DMI.
Definition enums.h:112
+
@ DvdRMediaIdentifier
DVD-R media identifier.
Definition enums.h:65
+
@ DvdSectorTitleKeyDecrypted
Decrypted DVD Title Key.
Definition enums.h:127
+
@ HybridRecognizedLayers
Recognized layers (hybrid media).
Definition enums.h:86
+
@ DvdSectorEccPi
DVD Error Correction Code (ECC) Parity of Inner Code (PI)
Definition enums.h:131
+
@ ScsiMmcWriteProtection
MMC write-protection data.
Definition enums.h:87
+
@ DvdDlMiddleZoneAddress
DVD dual-layer middle zone address.
Definition enums.h:71
+
@ DvdSectorId
DVD Identification Data (ID)
Definition enums.h:128
+
@ BlurayCartridgeStatus
Blu-ray cartridge status.
Definition enums.h:77
+
@ BlurayBca
Blu-ray Burst Cutting Area (BCA).
Definition enums.h:75
+
@ CompactDiscFirstTrackPregap
Compact Disc first track pre-gap.
Definition enums.h:107
+
@ DvdMediaIdentifier
DVD media identifier.
Definition enums.h:58
+
@ ScsiModeSense6
SCSI MODE SENSE (6) response.
Definition enums.h:109
+
@ UsbDescriptors
USB descriptors set.
Definition enums.h:111
+
@ AacsSerialNumber
AACS serial number.
Definition enums.h:80
+
@ DvdDiscControlBlock
DVD Disc Control Block.
Definition enums.h:106
+
@ FloppyLeadOut
Floppy lead‑out data.
Definition enums.h:105
+
@ ScsiModeSense10
SCSI MODE SENSE (10) response.
Definition enums.h:110
+
@ CompactDiscPma
Compact Disc Power Management Area (PMA).
Definition enums.h:50
+
@ XboxPfi
Xbox Physical Format Information (PFI).
Definition enums.h:113
+
@ MultiMediaCardExtendedCsd
MultiMediaCard Extended CSD register.
Definition enums.h:103
+
@ DvdDlManualLayerJumpLba
DVD dual-layer manual layer jump LBA.
Definition enums.h:73
+
@ CdSectorSuffix
Compact Disc sector suffix (EDC, ECC P, ECC Q).
Definition enums.h:115
+
@ DvdMediaKeyBlock
DVD Media Key Block (MKB).
Definition enums.h:59
+
@ DvdDlJumpIntervalSize
DVD dual-layer jump interval size.
Definition enums.h:72
+
@ BlurayDds
Blu-ray Disc Definition Structure (DDS).
Definition enums.h:76
+
@ DvdRRmd
DVD-R RMD (Recording Management Data).
Definition enums.h:63
+
@ CompactDiscMode2Subheader
Compact Disc MODE 2 subheader.
Definition enums.h:123
+
FeaturesCompatible
Bit-mask of optional, backward-compatible features stored in an image.
Definition enums.h:264
+
@ AARU_FEATURE_RW_BLAKE3
BLAKE3 checksum is present (read/write support for BLAKE3 hashes).
Definition enums.h:265
+
AaruformatStatus
Status / error codes specific to libaaruformat.
Definition enums.h:208
+
@ AARUF_STATUS_INVALID_CONTEXT
Provided context/handle is invalid.
Definition enums.h:209
+
CompressionType
List of known compression types.
Definition enums.h:32
+
@ Lzma
LZMA compression.
Definition enums.h:34
+
@ LzmaClauniaSubchannelTransform
LZMA applied to Claunia Subchannel Transform processed data.
Definition enums.h:36
+
@ None
Not compressed.
Definition enums.h:33
+
@ Flac
FLAC compression.
Definition enums.h:35
+
+
+
+ + + + diff --git a/docs/html/errors_8h.html b/docs/html/errors_8h.html new file mode 100644 index 0000000..7f4cff4 --- /dev/null +++ b/docs/html/errors_8h.html @@ -0,0 +1,931 @@ + + + + + + + +libaaruformat: include/aaruformat/errors.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
errors.h File Reference
+
+
+ +

Public error and status code definitions for libaaruformat. +More...

+ +

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Macros

Fatal / library-level error codes (negative)
#define AARUF_ERROR_NOT_AARUFORMAT   (-1)
 Input file/stream failed magic or structural validation.
#define AARUF_ERROR_FILE_TOO_SMALL   (-2)
 File size insufficient for mandatory header / structures.
#define AARUF_ERROR_INCOMPATIBLE_VERSION   (-3)
 Image uses a newer incompatible on-disk version.
#define AARUF_ERROR_CANNOT_READ_INDEX   (-4)
 Index block unreadable / truncated / bad identifier.
#define AARUF_ERROR_SECTOR_OUT_OF_BOUNDS   (-5)
 Requested logical sector outside media bounds.
#define AARUF_ERROR_CANNOT_READ_HEADER   (-6)
 Failed to read container header.
#define AARUF_ERROR_CANNOT_READ_BLOCK   (-7)
 Generic block read failure (seek/read error).
#define AARUF_ERROR_UNSUPPORTED_COMPRESSION   (-8)
 Block marked with unsupported compression algorithm.
#define AARUF_ERROR_NOT_ENOUGH_MEMORY   (-9)
 Memory allocation failure (critical).
#define AARUF_ERROR_BUFFER_TOO_SMALL   (-10)
 Caller-supplied buffer insufficient for data.
#define AARUF_ERROR_MEDIA_TAG_NOT_PRESENT   (-11)
 Requested media tag absent.
#define AARUF_ERROR_INCORRECT_MEDIA_TYPE   (-12)
 Operation incompatible with image media type.
#define AARUF_ERROR_TRACK_NOT_FOUND   (-13)
 Referenced track number not present.
#define AARUF_ERROR_REACHED_UNREACHABLE_CODE   (-14)
 Internal logic assertion hit unexpected path.
#define AARUF_ERROR_INVALID_TRACK_FORMAT   (-15)
 Track metadata internally inconsistent or malformed.
#define AARUF_ERROR_SECTOR_TAG_NOT_PRESENT   (-16)
 Requested sector tag (e.g. subchannel/prefix) not stored.
#define AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK   (-17)
 Decompression routine failed or size mismatch.
#define AARUF_ERROR_INVALID_BLOCK_CRC   (-18)
 CRC64 mismatch indicating corruption.
#define AARUF_ERROR_CANNOT_CREATE_FILE   (-19)
 Output file could not be created / opened for write.
#define AARUF_ERROR_INVALID_APP_NAME_LENGTH   (-20)
 Application name field length invalid (sanity limit).
#define AARUF_ERROR_CANNOT_WRITE_HEADER   (-21)
 Failure writing container header.
#define AARUF_READ_ONLY   (-22)
 Operation requires write mode but context is read-only.
#define AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER   (-23)
 Failure writing block header.
#define AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA   (-24)
 Failure writing block payload.
#define AARUF_ERROR_CANNOT_SET_DDT_ENTRY   (-25)
 Failed to encode/store a DDT entry (overflow or IO).
#define AARUF_ERROR_INCORRECT_DATA_SIZE   (-26)
 Data size does not match expected size.
#define AARUF_ERROR_INVALID_TAG   (-27)
 Invalid or unsupported media or sector tag format.
#define AARUF_ERROR_TAPE_FILE_NOT_FOUND   (-28)
 Requested tape file number not present in image.
#define AARUF_ERROR_TAPE_PARTITION_NOT_FOUND   (-29)
 Requested tape partition not present in image.
#define AARUF_ERROR_METADATA_NOT_PRESENT   (-30)
 Requested metadata not present in image.
Non-fatal sector status codes (non-negative)

Returned through output parameters to describe individual sector state.

+
#define AARUF_STATUS_OK   0
 Sector present and read without uncorrectable errors.
#define AARUF_STATUS_SECTOR_NOT_DUMPED   1
 Sector not captured (gap / missing / intentionally skipped).
#define AARUF_STATUS_SECTOR_WITH_ERRORS   2
 Sector present but with unrecoverable or flagged errors.
#define AARUF_STATUS_SECTOR_DELETED   3
 Sector logically marked deleted (e.g. filesystem deleted area).
+ + + +

+Functions

static const char * aaruformat_error_string (int code)
 Convert an AaruFormat error or status code to a static human-readable string.
+

Detailed Description

+

Public error and status code definitions for libaaruformat.

+

Negative values represent fatal / non-recoverable error conditions returned by library functions. Non-negative values (>=0) are either success (0) or sector-level status annotations used when decoding per-sector metadata (e.g. a sector not dumped or with corrected/unrecoverable errors).

+

Usage guidelines:

    +
  • Always test for < 0 to check generic failure without enumerating all codes.
  • +
  • Use exact comparisons for caller-specific handling (e.g. retry on AARUF_ERROR_CANNOT_READ_BLOCK).
  • +
  • Sector status codes are never returned as fatal function results; they appear in output parameters populated by read/identify routines.
  • +
+

Helper: see aaruformat_error_string() for a human-readable textual description suitable for logs.

+ +

Definition in file errors.h.

+

Macro Definition Documentation

+ +

◆ AARUF_ERROR_BUFFER_TOO_SMALL

+ + + +

◆ AARUF_ERROR_CANNOT_CREATE_FILE

+ +
+
+ + + + +
#define AARUF_ERROR_CANNOT_CREATE_FILE   (-19)
+
+ +

Output file could not be created / opened for write.

+ +

Definition at line 58 of file errors.h.

+ +

Referenced by aaruf_create(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK

+ +
+
+ + + + +
#define AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK   (-17)
+
+ +

Decompression routine failed or size mismatch.

+ +

Definition at line 56 of file errors.h.

+ +

Referenced by aaruf_read_sector(), aaruformat_error_string(), decode_ddt_multi_level_v2(), process_data_block(), process_ddt_v1(), and process_ddt_v2().

+ +
+
+ +

◆ AARUF_ERROR_CANNOT_READ_BLOCK

+ + + +

◆ AARUF_ERROR_CANNOT_READ_HEADER

+ +
+
+ + + + +
#define AARUF_ERROR_CANNOT_READ_HEADER   (-6)
+
+ +

Failed to read container header.

+ +

Definition at line 45 of file errors.h.

+ +

Referenced by aaruf_read_sector(), aaruf_verify_image(), aaruformat_error_string(), verify_index_v1(), verify_index_v2(), and verify_index_v3().

+ +
+
+ +

◆ AARUF_ERROR_CANNOT_READ_INDEX

+ +
+
+ + + + +
#define AARUF_ERROR_CANNOT_READ_INDEX   (-4)
+
+ +

Index block unreadable / truncated / bad identifier.

+ +

Definition at line 43 of file errors.h.

+ +

Referenced by aaruf_open(), aaruf_verify_image(), aaruformat_error_string(), verify_index_v1(), verify_index_v2(), and verify_index_v3().

+ +
+
+ +

◆ AARUF_ERROR_CANNOT_SET_DDT_ENTRY

+ +
+
+ + + + +
#define AARUF_ERROR_CANNOT_SET_DDT_ENTRY   (-25)
+
+ +

Failed to encode/store a DDT entry (overflow or IO).

+ +

Definition at line 64 of file errors.h.

+ +

Referenced by aaruf_write_sector(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA

+ +
+
+ + + + +
#define AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA   (-24)
+
+ +

Failure writing block payload.

+ +

Definition at line 63 of file errors.h.

+ +

Referenced by aaruf_close_current_block(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER

+ +
+
+ + + + +
#define AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER   (-23)
+
+ +

Failure writing block header.

+ +

Definition at line 62 of file errors.h.

+ +

Referenced by aaruf_close_current_block(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_CANNOT_WRITE_HEADER

+ +
+
+ + + + +
#define AARUF_ERROR_CANNOT_WRITE_HEADER   (-21)
+
+ +

Failure writing container header.

+ +

Definition at line 60 of file errors.h.

+ +

Referenced by aaruf_close(), aaruformat_error_string(), write_cached_secondary_ddt(), write_index_block(), write_primary_ddt(), and write_single_level_ddt().

+ +
+
+ +

◆ AARUF_ERROR_FILE_TOO_SMALL

+ +
+
+ + + + +
#define AARUF_ERROR_FILE_TOO_SMALL   (-2)
+
+ +

File size insufficient for mandatory header / structures.

+ +

Definition at line 41 of file errors.h.

+ +

Referenced by aaruf_open(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_INCOMPATIBLE_VERSION

+ +
+
+ + + + +
#define AARUF_ERROR_INCOMPATIBLE_VERSION   (-3)
+
+ +

Image uses a newer incompatible on-disk version.

+ +

Definition at line 42 of file errors.h.

+ +

Referenced by aaruf_open(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_INCORRECT_DATA_SIZE

+ +
+
+ + + + +
#define AARUF_ERROR_INCORRECT_DATA_SIZE   (-26)
+
+
+ +

◆ AARUF_ERROR_INCORRECT_MEDIA_TYPE

+ +
+
+ + + + +
#define AARUF_ERROR_INCORRECT_MEDIA_TYPE   (-12)
+
+ +

Operation incompatible with image media type.

+ +

Definition at line 51 of file errors.h.

+ +

Referenced by aaruf_read_sector_long(), aaruf_read_sector_tag(), aaruf_read_track_sector(), aaruf_write_sector_long(), aaruf_write_sector_tag(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_INVALID_APP_NAME_LENGTH

+ +
+
+ + + + +
#define AARUF_ERROR_INVALID_APP_NAME_LENGTH   (-20)
+
+ +

Application name field length invalid (sanity limit).

+ +

Definition at line 59 of file errors.h.

+ +

Referenced by aaruf_create(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_INVALID_BLOCK_CRC

+ +
+
+ + + + +
#define AARUF_ERROR_INVALID_BLOCK_CRC   (-18)
+
+ +

CRC64 mismatch indicating corruption.

+ +

Definition at line 57 of file errors.h.

+ +

Referenced by aaruf_set_dumphw(), aaruf_verify_image(), aaruformat_error_string(), decode_ddt_multi_level_v2(), process_ddt_v2(), verify_index_v1(), verify_index_v2(), and verify_index_v3().

+ +
+
+ +

◆ AARUF_ERROR_INVALID_TAG

+ +
+
+ + + + +
#define AARUF_ERROR_INVALID_TAG   (-27)
+
+ +

Invalid or unsupported media or sector tag format.

+ +

Definition at line 66 of file errors.h.

+ +

Referenced by aaruf_read_sector_tag(), and aaruf_write_sector_tag().

+ +
+
+ +

◆ AARUF_ERROR_INVALID_TRACK_FORMAT

+ +
+
+ + + + +
#define AARUF_ERROR_INVALID_TRACK_FORMAT   (-15)
+
+ +

Track metadata internally inconsistent or malformed.

+ +

Definition at line 54 of file errors.h.

+ +

Referenced by aaruf_read_sector_long(), aaruf_set_tracks(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_MEDIA_TAG_NOT_PRESENT

+ +
+
+ + + + +
#define AARUF_ERROR_MEDIA_TAG_NOT_PRESENT   (-11)
+
+ +

Requested media tag absent.

+ +

Definition at line 50 of file errors.h.

+ +

Referenced by aaruf_read_media_tag(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_METADATA_NOT_PRESENT

+ + + +

◆ AARUF_ERROR_NOT_AARUFORMAT

+ +
+
+ + + + +
#define AARUF_ERROR_NOT_AARUFORMAT   (-1)
+
+ +

Input file/stream failed magic or structural validation.

+ +

Definition at line 40 of file errors.h.

+ +

Referenced by aaruf_close_current_block(), aaruf_get_aaru_json_metadata(), aaruf_get_cicm_metadata(), aaruf_get_comments(), aaruf_get_creator(), aaruf_get_drive_firmware_revision(), aaruf_get_drive_manufacturer(), aaruf_get_drive_model(), aaruf_get_drive_serial_number(), aaruf_get_dumphw(), aaruf_get_geometry(), aaruf_get_image_info(), aaruf_get_media_barcode(), aaruf_get_media_manufacturer(), aaruf_get_media_model(), aaruf_get_media_part_number(), aaruf_get_media_sequence(), aaruf_get_media_serial_number(), aaruf_get_media_title(), aaruf_get_negative_sectors(), aaruf_get_overflow_sectors(), aaruf_get_tape_file(), aaruf_get_tape_partition(), aaruf_get_tracks(), aaruf_get_user_sectors(), aaruf_open(), aaruf_read_media_tag(), aaruf_read_sector(), aaruf_read_sector_long(), aaruf_read_sector_tag(), aaruf_read_track_sector(), aaruf_set_aaru_json_metadata(), aaruf_set_comments(), aaruf_set_creator(), aaruf_set_drive_firmware_revision(), aaruf_set_drive_manufacturer(), aaruf_set_drive_model(), aaruf_set_drive_serial_number(), aaruf_set_dumphw(), aaruf_set_geometry(), aaruf_set_media_barcode(), aaruf_set_media_manufacturer(), aaruf_set_media_model(), aaruf_set_media_part_number(), aaruf_set_media_sequence(), aaruf_set_media_serial_number(), aaruf_set_media_title(), aaruf_set_tape_file(), aaruf_set_tape_partition(), aaruf_set_tracks(), aaruf_verify_image(), aaruf_write_media_tag(), aaruf_write_sector(), aaruf_write_sector_long(), aaruf_write_sector_tag(), aaruformat_error_string(), decode_ddt_entry_v1(), decode_ddt_entry_v2(), decode_ddt_multi_level_v2(), decode_ddt_single_level_v2(), process_data_block(), process_ddt_v1(), process_ddt_v2(), verify_index_v1(), verify_index_v2(), and verify_index_v3().

+ +
+
+ +

◆ AARUF_ERROR_NOT_ENOUGH_MEMORY

+ + + +

◆ AARUF_ERROR_REACHED_UNREACHABLE_CODE

+ +
+
+ + + + +
#define AARUF_ERROR_REACHED_UNREACHABLE_CODE   (-14)
+
+ +

Internal logic assertion hit unexpected path.

+ +

Definition at line 53 of file errors.h.

+ +

Referenced by aaruf_read_sector_long(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_SECTOR_OUT_OF_BOUNDS

+ +
+
+ + + + +
#define AARUF_ERROR_SECTOR_OUT_OF_BOUNDS   (-5)
+
+ +

Requested logical sector outside media bounds.

+ +

Definition at line 44 of file errors.h.

+ +

Referenced by aaruf_read_sector(), aaruf_read_sector_long(), aaruf_read_sector_tag(), aaruf_write_sector(), aaruf_write_sector_long(), aaruf_write_sector_tag(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_SECTOR_TAG_NOT_PRESENT

+ +
+
+ + + + +
#define AARUF_ERROR_SECTOR_TAG_NOT_PRESENT   (-16)
+
+ +

Requested sector tag (e.g. subchannel/prefix) not stored.

+ +

Definition at line 55 of file errors.h.

+ +

Referenced by aaruf_read_sector_tag(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_TAPE_FILE_NOT_FOUND

+ +
+
+ + + + +
#define AARUF_ERROR_TAPE_FILE_NOT_FOUND   (-28)
+
+ +

Requested tape file number not present in image.

+ +

Definition at line 67 of file errors.h.

+ +

Referenced by aaruf_get_tape_file().

+ +
+
+ +

◆ AARUF_ERROR_TAPE_PARTITION_NOT_FOUND

+ +
+
+ + + + +
#define AARUF_ERROR_TAPE_PARTITION_NOT_FOUND   (-29)
+
+ +

Requested tape partition not present in image.

+ +

Definition at line 68 of file errors.h.

+ +

Referenced by aaruf_get_tape_partition().

+ +
+
+ +

◆ AARUF_ERROR_TRACK_NOT_FOUND

+ +
+
+ + + + +
#define AARUF_ERROR_TRACK_NOT_FOUND   (-13)
+
+ +

Referenced track number not present.

+ +

Definition at line 52 of file errors.h.

+ +

Referenced by aaruf_get_tracks(), aaruf_read_sector_long(), aaruf_read_sector_tag(), aaruf_read_track_sector(), aaruf_write_sector_tag(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_ERROR_UNSUPPORTED_COMPRESSION

+ +
+
+ + + + +
#define AARUF_ERROR_UNSUPPORTED_COMPRESSION   (-8)
+
+ +

Block marked with unsupported compression algorithm.

+ +

Definition at line 47 of file errors.h.

+ +

Referenced by aaruf_read_sector(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_READ_ONLY

+ + + +

◆ AARUF_STATUS_OK

+ +
+
+ + + + +
#define AARUF_STATUS_OK   0
+
+ +

Sector present and read without uncorrectable errors.

+ +

Definition at line 75 of file errors.h.

+ +

Referenced by aaruf_close(), aaruf_close_current_block(), aaruf_cst_transform(), aaruf_cst_untransform(), aaruf_get_aaru_json_metadata(), aaruf_get_cicm_metadata(), aaruf_get_comments(), aaruf_get_creator(), aaruf_get_drive_firmware_revision(), aaruf_get_drive_manufacturer(), aaruf_get_drive_model(), aaruf_get_drive_serial_number(), aaruf_get_dumphw(), aaruf_get_geometry(), aaruf_get_image_info(), aaruf_get_media_barcode(), aaruf_get_media_manufacturer(), aaruf_get_media_model(), aaruf_get_media_part_number(), aaruf_get_media_sequence(), aaruf_get_media_serial_number(), aaruf_get_media_title(), aaruf_get_negative_sectors(), aaruf_get_overflow_sectors(), aaruf_get_tape_file(), aaruf_get_tape_partition(), aaruf_get_tracks(), aaruf_get_user_sectors(), aaruf_open(), aaruf_read_media_tag(), aaruf_read_sector(), aaruf_read_sector_long(), aaruf_read_sector_tag(), aaruf_set_aaru_json_metadata(), aaruf_set_comments(), aaruf_set_creator(), aaruf_set_drive_firmware_revision(), aaruf_set_drive_manufacturer(), aaruf_set_drive_model(), aaruf_set_drive_serial_number(), aaruf_set_dumphw(), aaruf_set_geometry(), aaruf_set_media_barcode(), aaruf_set_media_manufacturer(), aaruf_set_media_model(), aaruf_set_media_part_number(), aaruf_set_media_sequence(), aaruf_set_media_serial_number(), aaruf_set_media_title(), aaruf_set_tape_file(), aaruf_set_tape_partition(), aaruf_set_tracks(), aaruf_verify_image(), aaruf_write_media_tag(), aaruf_write_sector(), aaruf_write_sector_tag(), aaruformat_error_string(), decode_ddt_entry_v1(), decode_ddt_multi_level_v2(), decode_ddt_single_level_v2(), process_data_block(), process_ddt_v1(), process_ddt_v2(), update_crc64_from_stream(), verify_index_v1(), verify_index_v2(), verify_index_v3(), write_cached_secondary_ddt(), write_index_block(), write_primary_ddt(), and write_single_level_ddt().

+ +
+
+ +

◆ AARUF_STATUS_SECTOR_DELETED

+ +
+
+ + + + +
#define AARUF_STATUS_SECTOR_DELETED   3
+
+ +

Sector logically marked deleted (e.g. filesystem deleted area).

+ +

Definition at line 78 of file errors.h.

+ +

Referenced by aaruformat_error_string().

+ +
+
+ +

◆ AARUF_STATUS_SECTOR_NOT_DUMPED

+ +
+
+ + + + +
#define AARUF_STATUS_SECTOR_NOT_DUMPED   1
+
+ +

Sector not captured (gap / missing / intentionally skipped).

+ +

Definition at line 76 of file errors.h.

+ +

Referenced by aaruf_read_sector(), aaruf_read_sector_long(), and aaruformat_error_string().

+ +
+
+ +

◆ AARUF_STATUS_SECTOR_WITH_ERRORS

+ +
+
+ + + + +
#define AARUF_STATUS_SECTOR_WITH_ERRORS   2
+
+ +

Sector present but with unrecoverable or flagged errors.

+ +

Definition at line 77 of file errors.h.

+ +

Referenced by aaruformat_error_string().

+ +
+
+

Function Documentation

+ +

◆ aaruformat_error_string()

+ +
+
+ + + + + +
+ + + + + + + +
const char * aaruformat_error_string (int code)
+
+inlinestatic
+
+
+
+
+ +
+ + + + diff --git a/docs/html/errors_8h.js b/docs/html/errors_8h.js new file mode 100644 index 0000000..c9c9c60 --- /dev/null +++ b/docs/html/errors_8h.js @@ -0,0 +1,38 @@ +var errors_8h = +[ + [ "AARUF_ERROR_BUFFER_TOO_SMALL", "errors_8h.html#ae7eea5936a22100db46aac3e4312cdae", null ], + [ "AARUF_ERROR_CANNOT_CREATE_FILE", "errors_8h.html#a05c6aa0d46349e5060d75d5b6308d1e3", null ], + [ "AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK", "errors_8h.html#ac9f4e38e8d5a1f940c9cd0c7f6788c37", null ], + [ "AARUF_ERROR_CANNOT_READ_BLOCK", "errors_8h.html#a67753dacbd0ffdd397e563a8a5ecd271", null ], + [ "AARUF_ERROR_CANNOT_READ_HEADER", "errors_8h.html#a3459a04771fe04f8f77bfa90563a4375", null ], + [ "AARUF_ERROR_CANNOT_READ_INDEX", "errors_8h.html#ab6c57651868e0f35e3821680ebb2b17a", null ], + [ "AARUF_ERROR_CANNOT_SET_DDT_ENTRY", "errors_8h.html#a9c9c207061d0957b1cf76c1a79296a36", null ], + [ "AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA", "errors_8h.html#a0ebe2ffd752f049954b4125ee8840bb5", null ], + [ "AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER", "errors_8h.html#af86dd78bcb33b547113460822ed96c3e", null ], + [ "AARUF_ERROR_CANNOT_WRITE_HEADER", "errors_8h.html#af180a859e926a3826486d78078076919", null ], + [ "AARUF_ERROR_FILE_TOO_SMALL", "errors_8h.html#acebe3e4bcc498066fe65d9e24e16c7f5", null ], + [ "AARUF_ERROR_INCOMPATIBLE_VERSION", "errors_8h.html#a626d70083785adf028130ac349f270c5", null ], + [ "AARUF_ERROR_INCORRECT_DATA_SIZE", "errors_8h.html#a8fc3ecb14777e72bebad62084b6caf16", null ], + [ "AARUF_ERROR_INCORRECT_MEDIA_TYPE", "errors_8h.html#a26707b86af4dd4f3bae7d57abd4345b0", null ], + [ "AARUF_ERROR_INVALID_APP_NAME_LENGTH", "errors_8h.html#a24494b154606028b04c1d71367545e5c", null ], + [ "AARUF_ERROR_INVALID_BLOCK_CRC", "errors_8h.html#aa8dcb9cad962fc5f5f84d5e1ec41fae7", null ], + [ "AARUF_ERROR_INVALID_TAG", "errors_8h.html#ad3340e78aca685a8ea4739fdfd04292f", null ], + [ "AARUF_ERROR_INVALID_TRACK_FORMAT", "errors_8h.html#a604a2b6b7bf491f7e62a817b6c887f32", null ], + [ "AARUF_ERROR_MEDIA_TAG_NOT_PRESENT", "errors_8h.html#ad87e52bef1f48eebb49458a5f64f7016", null ], + [ "AARUF_ERROR_METADATA_NOT_PRESENT", "errors_8h.html#a99ff8f6884fd5e21840b2e35240bc265", null ], + [ "AARUF_ERROR_NOT_AARUFORMAT", "errors_8h.html#abb63e240b11d790da83bd34507b57851", null ], + [ "AARUF_ERROR_NOT_ENOUGH_MEMORY", "errors_8h.html#a35a771e3648bf971a004d4b2be9b5ec4", null ], + [ "AARUF_ERROR_REACHED_UNREACHABLE_CODE", "errors_8h.html#afac13facfc59d6710c31daee0302e39d", null ], + [ "AARUF_ERROR_SECTOR_OUT_OF_BOUNDS", "errors_8h.html#a3f6069602fee5f1264befab13708c0ef", null ], + [ "AARUF_ERROR_SECTOR_TAG_NOT_PRESENT", "errors_8h.html#aa70d43d59e04b7147c14771c4821e670", null ], + [ "AARUF_ERROR_TAPE_FILE_NOT_FOUND", "errors_8h.html#a64fa67cb4d9323e914641c70c731a5b2", null ], + [ "AARUF_ERROR_TAPE_PARTITION_NOT_FOUND", "errors_8h.html#a14db41b6e45622397fa6339bc79d2b9f", null ], + [ "AARUF_ERROR_TRACK_NOT_FOUND", "errors_8h.html#a32b645da87003df886a5742d23f8ca19", null ], + [ "AARUF_ERROR_UNSUPPORTED_COMPRESSION", "errors_8h.html#aec106e533b79916d14e4d48a3d95e8c8", null ], + [ "AARUF_READ_ONLY", "errors_8h.html#a1df49eaa19eaa14891b6aaab966a9bc6", null ], + [ "AARUF_STATUS_OK", "errors_8h.html#a1d6e49f7e8a1fa489efa0a582e90b5de", null ], + [ "AARUF_STATUS_SECTOR_DELETED", "errors_8h.html#a77bf05aa252de9f7f7a81b4a8bda1294", null ], + [ "AARUF_STATUS_SECTOR_NOT_DUMPED", "errors_8h.html#ab629288e7ddaf4dd8419621e6963e2cf", null ], + [ "AARUF_STATUS_SECTOR_WITH_ERRORS", "errors_8h.html#ac313b4e3653f14a377c01902f1fc4fbe", null ], + [ "aaruformat_error_string", "errors_8h.html#aec12cc4bb15cd7f404ec3bcd62810dc7", null ] +]; \ No newline at end of file diff --git a/docs/html/errors_8h_source.html b/docs/html/errors_8h_source.html new file mode 100644 index 0000000..6521a54 --- /dev/null +++ b/docs/html/errors_8h_source.html @@ -0,0 +1,267 @@ + + + + + + + +libaaruformat: include/aaruformat/errors.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
errors.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_ERRORS_H
+
20#define LIBAARUFORMAT_ERRORS_H
+
21
+
37
+
40#define AARUF_ERROR_NOT_AARUFORMAT (-1)
+
41#define AARUF_ERROR_FILE_TOO_SMALL (-2)
+
42#define AARUF_ERROR_INCOMPATIBLE_VERSION (-3)
+
43#define AARUF_ERROR_CANNOT_READ_INDEX (-4)
+
44#define AARUF_ERROR_SECTOR_OUT_OF_BOUNDS (-5)
+
45#define AARUF_ERROR_CANNOT_READ_HEADER (-6)
+
46#define AARUF_ERROR_CANNOT_READ_BLOCK (-7)
+
47#define AARUF_ERROR_UNSUPPORTED_COMPRESSION (-8)
+
48#define AARUF_ERROR_NOT_ENOUGH_MEMORY (-9)
+
49#define AARUF_ERROR_BUFFER_TOO_SMALL (-10)
+
50#define AARUF_ERROR_MEDIA_TAG_NOT_PRESENT (-11)
+
51#define AARUF_ERROR_INCORRECT_MEDIA_TYPE (-12)
+
52#define AARUF_ERROR_TRACK_NOT_FOUND (-13)
+
53#define AARUF_ERROR_REACHED_UNREACHABLE_CODE (-14)
+
54#define AARUF_ERROR_INVALID_TRACK_FORMAT (-15)
+
55#define AARUF_ERROR_SECTOR_TAG_NOT_PRESENT (-16)
+
56#define AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK (-17)
+
57#define AARUF_ERROR_INVALID_BLOCK_CRC (-18)
+
58#define AARUF_ERROR_CANNOT_CREATE_FILE (-19)
+
59#define AARUF_ERROR_INVALID_APP_NAME_LENGTH (-20)
+
60#define AARUF_ERROR_CANNOT_WRITE_HEADER (-21)
+
61#define AARUF_READ_ONLY (-22)
+
62#define AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER (-23)
+
63#define AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA (-24)
+
64#define AARUF_ERROR_CANNOT_SET_DDT_ENTRY (-25)
+
65#define AARUF_ERROR_INCORRECT_DATA_SIZE (-26)
+
66#define AARUF_ERROR_INVALID_TAG (-27)
+
67#define AARUF_ERROR_TAPE_FILE_NOT_FOUND (-28)
+
68#define AARUF_ERROR_TAPE_PARTITION_NOT_FOUND (-29)
+
69#define AARUF_ERROR_METADATA_NOT_PRESENT (-30)
+
71
+
75#define AARUF_STATUS_OK 0
+
76#define AARUF_STATUS_SECTOR_NOT_DUMPED 1
+
77#define AARUF_STATUS_SECTOR_WITH_ERRORS 2
+
78#define AARUF_STATUS_SECTOR_DELETED 3
+
79
+
81
+
+
90static inline const char *aaruformat_error_string(int code)
+
91{
+
92 switch(code)
+
93 {
+
94 /* Errors */
+ +
96 return "Not an AaruFormat image";
+ +
98 return "File too small";
+ +
100 return "Incompatible image version";
+ +
102 return "Cannot read index";
+ +
104 return "Sector out of bounds";
+ +
106 return "Cannot read header";
+ +
108 return "Cannot read block";
+ +
110 return "Unsupported compression";
+ +
112 return "Not enough memory";
+ +
114 return "Buffer too small";
+ +
116 return "Media tag not present";
+ +
118 return "Incorrect media type";
+ +
120 return "Track not found";
+ +
122 return "Internal unreachable code reached";
+ +
124 return "Invalid track format";
+ +
126 return "Sector tag not present";
+ +
128 return "Cannot decompress block";
+ +
130 return "Invalid block CRC";
+ +
132 return "Cannot create file";
+ +
134 return "Invalid application name length";
+ +
136 return "Cannot write header";
+
137 case AARUF_READ_ONLY:
+
138 return "Read-only context";
+ +
140 return "Cannot write block header";
+ +
142 return "Cannot write block data";
+ +
144 return "Cannot set DDT entry";
+
145
+
146 /* Status */
+
147 case AARUF_STATUS_OK:
+
148 return "OK";
+ +
150 return "Sector not dumped";
+ +
152 return "Sector with errors";
+ +
154 return "Sector deleted";
+
155 }
+
156 return "Unknown error/status";
+
157}
+
+
158
+
159#endif // LIBAARUFORMAT_ERRORS_H
+
#define AARUF_ERROR_CANNOT_CREATE_FILE
Output file could not be created / opened for write.
Definition errors.h:58
+
#define AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA
Failure writing block payload.
Definition errors.h:63
+
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
Definition errors.h:75
+
#define AARUF_READ_ONLY
Operation requires write mode but context is read-only.
Definition errors.h:61
+
#define AARUF_ERROR_INVALID_APP_NAME_LENGTH
Application name field length invalid (sanity limit).
Definition errors.h:59
+
#define AARUF_ERROR_INCORRECT_MEDIA_TYPE
Operation incompatible with image media type.
Definition errors.h:51
+
#define AARUF_ERROR_TRACK_NOT_FOUND
Referenced track number not present.
Definition errors.h:52
+
#define AARUF_ERROR_CANNOT_READ_HEADER
Failed to read container header.
Definition errors.h:45
+
#define AARUF_ERROR_NOT_ENOUGH_MEMORY
Memory allocation failure (critical).
Definition errors.h:48
+
#define AARUF_ERROR_SECTOR_OUT_OF_BOUNDS
Requested logical sector outside media bounds.
Definition errors.h:44
+
#define AARUF_ERROR_INVALID_TRACK_FORMAT
Track metadata internally inconsistent or malformed.
Definition errors.h:54
+
#define AARUF_ERROR_INCOMPATIBLE_VERSION
Image uses a newer incompatible on-disk version.
Definition errors.h:42
+
#define AARUF_ERROR_CANNOT_READ_BLOCK
Generic block read failure (seek/read error).
Definition errors.h:46
+
#define AARUF_STATUS_SECTOR_DELETED
Sector logically marked deleted (e.g. filesystem deleted area).
Definition errors.h:78
+
#define AARUF_ERROR_CANNOT_SET_DDT_ENTRY
Failed to encode/store a DDT entry (overflow or IO).
Definition errors.h:64
+
#define AARUF_ERROR_SECTOR_TAG_NOT_PRESENT
Requested sector tag (e.g. subchannel/prefix) not stored.
Definition errors.h:55
+
#define AARUF_ERROR_INVALID_BLOCK_CRC
CRC64 mismatch indicating corruption.
Definition errors.h:57
+
#define AARUF_STATUS_SECTOR_NOT_DUMPED
Sector not captured (gap / missing / intentionally skipped).
Definition errors.h:76
+
#define AARUF_ERROR_CANNOT_READ_INDEX
Index block unreadable / truncated / bad identifier.
Definition errors.h:43
+
#define AARUF_ERROR_NOT_AARUFORMAT
Input file/stream failed magic or structural validation.
Definition errors.h:40
+
#define AARUF_STATUS_SECTOR_WITH_ERRORS
Sector present but with unrecoverable or flagged errors.
Definition errors.h:77
+
#define AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK
Decompression routine failed or size mismatch.
Definition errors.h:56
+
#define AARUF_ERROR_FILE_TOO_SMALL
File size insufficient for mandatory header / structures.
Definition errors.h:41
+
#define AARUF_ERROR_MEDIA_TAG_NOT_PRESENT
Requested media tag absent.
Definition errors.h:50
+
#define AARUF_ERROR_BUFFER_TOO_SMALL
Caller-supplied buffer insufficient for data.
Definition errors.h:49
+
#define AARUF_ERROR_UNSUPPORTED_COMPRESSION
Block marked with unsupported compression algorithm.
Definition errors.h:47
+
static const char * aaruformat_error_string(int code)
Convert an AaruFormat error or status code to a static human-readable string.
Definition errors.h:90
+
#define AARUF_ERROR_CANNOT_WRITE_HEADER
Failure writing container header.
Definition errors.h:60
+
#define AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER
Failure writing block header.
Definition errors.h:62
+
#define AARUF_ERROR_REACHED_UNREACHABLE_CODE
Internal logic assertion hit unexpected path.
Definition errors.h:53
+
+
+
+ + + + diff --git a/docs/html/files.html b/docs/html/files.html new file mode 100644 index 0000000..86e5d52 --- /dev/null +++ b/docs/html/files.html @@ -0,0 +1,190 @@ + + + + + + + +libaaruformat: File List + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
File List
+
+
+
Here is a list of all files with brief descriptions:
+
[detail level 1234]
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
 
include
 
aaruformat
 
structs
 
checksum.h
On-disk layout definitions for the checksum block (BlockType::ChecksumBlock)
 
data.h
On-disk layout structures for data-bearing and geometry blocks
 
ddt.h
On-disk headers for Deduplication Data Tables (DDT) versions 1 and 2
 
dump.h
Packed on-disk structures describing hardware and software used during image acquisition
 
header.h
On-disk container header structures (v1 and v2) for Aaru images
 
index.h
On‑disk index block header and entry structures (versions 1, 2 and 3)
 
lisa_tag.h
Structure definitions and conversion/serialization function declarations for Lisa family disk tags
 
metadata.h
Packed on-disk metadata block headers for descriptive strings and CICM XML (if present)
 
optical.h
On-disk structures describing optical disc tracks (Track list block)
 
options.h
< For bool type used in aaru_options
 
tape.h
Data structures for tape media support in Aaru disk images
 
consts.h
Core public constants and compile‑time limits for the Aaru container format implementation
 
context.h
Central runtime context structures for libaaruformat (image state, caches, checksum buffers)
 
crc64.h
CRC64 (ECMA-182) core context and precomputed slicing-by-4 tables
 
decls.h
 
endian.h
 
enums.h
 
errors.h
Public error and status code definitions for libaaruformat
 
flac.h
 
hash_map.h
 
lru.h
 
simd.h
 
spamsum.h
 
structs.h
 
aaru.h
Public high-level API types: media classifications, per-sector / per-media tag enums and image summary
 
aaruformat.h
 
internal.h
 
log.h
 
md5.h
 
sha1.h
 
sha256.h
 
src
 
blocks
 
checksum.c
 
data.c
 
dump.c
 
metadata.c
 
optical.c
 
tape.c
 
checksum
 
ecc_cd.c
 
md5.c
 
sha1.c
 
sha256.c
 
simd.c
 
spamsum.c
 
compression
 
cst.c
 
flac.c
 
lzma.c
 
crc64
 
arm_vmull.c
 
arm_vmull.h
 
crc64.c
 
crc64_clmul.c
 
crc64_vmull.c
 
ddt
 
ddt_v1.c
 
ddt_v2.c
 
hash_map.c
 
index
 
index_v1.c
 
index_v2.c
 
index_v3.c
 
close.c
Implements image finalization and resource cleanup for libaaruformat
 
create.c
 
dump.c
 
helpers.c
 
identify.c
 
lisa_tag.c
Parsing, conversion and serialization helpers for Lisa (Apple Lisa / Profile / Priam / Sony) disk block tags
 
lru.c
 
metadata.c
 
open.c
 
options.c
 
read.c
 
time.c
 
verify.c
 
write.c
+
+
+
+
+ + + + diff --git a/docs/html/files_dup.js b/docs/html/files_dup.js new file mode 100644 index 0000000..89e9042 --- /dev/null +++ b/docs/html/files_dup.js @@ -0,0 +1,5 @@ +var files_dup = +[ + [ "include", "dir_d44c64559bbebec7f509842c48db8b23.html", "dir_d44c64559bbebec7f509842c48db8b23" ], + [ "src", "dir_68267d1309a1af8e8297ef4c3efbcdba.html", "dir_68267d1309a1af8e8297ef4c3efbcdba" ] +]; \ No newline at end of file diff --git a/docs/html/flac_8c.html b/docs/html/flac_8c.html new file mode 100644 index 0000000..cbbc6a2 --- /dev/null +++ b/docs/html/flac_8c.html @@ -0,0 +1,492 @@ + + + + + + + +libaaruformat: src/compression/flac.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
flac.c File Reference
+
+
+
#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include "aaruformat.h"
+#include "flac.h"
+#include "FLAC/metadata.h"
+#include "FLAC/stream_decoder.h"
+#include "FLAC/stream_encoder.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + +

+Functions

static FLAC__StreamDecoderReadStatus read_callback (const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
static FLAC__StreamDecoderWriteStatus write_callback (const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *const buffer[], void *client_data)
static void error_callback (const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
size_t aaruf_flac_decode_redbook_buffer (uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size)
 Decodes a FLAC-compressed Red Book audio buffer.
static FLAC__StreamEncoderWriteStatus encoder_write_callback (const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data)
size_t aaruf_flac_encode_redbook_buffer (uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size, uint32_t blocksize, int32_t do_mid_side_stereo, int32_t loose_mid_side_stereo, const char *apodization, uint32_t max_lpc_order, uint32_t qlp_coeff_precision, int32_t do_qlp_coeff_prec_search, int32_t do_exhaustive_model_search, uint32_t min_residual_partition_order, uint32_t max_residual_partition_order, const char *application_id, uint32_t application_id_len)
 Encodes a Red Book audio buffer to FLAC format.
+

Function Documentation

+ +

◆ aaruf_flac_decode_redbook_buffer()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + +
size_t aaruf_flac_decode_redbook_buffer (uint8_t * dst_buffer,
size_t dst_size,
const uint8_t * src_buffer,
size_t src_size )
+
+ +

Decodes a FLAC-compressed Red Book audio buffer.

+

Decompresses FLAC-compressed Red Book audio data into the destination buffer.

+
Parameters
+ + + + + +
dst_bufferPointer to the destination buffer.
dst_sizeSize of the destination buffer.
src_bufferPointer to the source (compressed) buffer.
src_sizeSize of the source buffer.
+
+
+
Returns
Number of bytes written to the destination buffer.
+ +

Definition at line 48 of file flac.c.

+ +

References AARU_CALL, AARU_EXPORT, aaru_flac_ctx::dst_buffer, aaru_flac_ctx::dst_len, aaru_flac_ctx::dst_pos, aaru_flac_ctx::error, error_callback(), read_callback(), aaru_flac_ctx::src_buffer, aaru_flac_ctx::src_len, aaru_flac_ctx::src_pos, and write_callback().

+ +

Referenced by aaruf_read_sector().

+ +
+
+ +

◆ aaruf_flac_encode_redbook_buffer()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
size_t aaruf_flac_encode_redbook_buffer (uint8_t * dst_buffer,
size_t dst_size,
const uint8_t * src_buffer,
size_t src_size,
uint32_t blocksize,
int32_t do_mid_side_stereo,
int32_t loose_mid_side_stereo,
const char * apodization,
uint32_t max_lpc_order,
uint32_t qlp_coeff_precision,
int32_t do_qlp_coeff_prec_search,
int32_t do_exhaustive_model_search,
uint32_t min_residual_partition_order,
uint32_t max_residual_partition_order,
const char * application_id,
uint32_t application_id_len )
+
+ +

Encodes a Red Book audio buffer to FLAC format.

+
Parameters
+ + + + + + + + + + + + + + + + + +
dst_bufferPointer to the destination buffer for FLAC data.
dst_sizeSize of the destination buffer in bytes.
src_bufferPointer to the source Red Book audio buffer.
src_sizeSize of the source buffer in bytes.
blocksizeFLAC block size.
do_mid_side_stereoEnable mid-side stereo encoding.
loose_mid_side_stereoEnable loose mid-side stereo encoding.
apodizationApodization string for FLAC encoder.
max_lpc_orderMaximum LPC order.
qlp_coeff_precisionQLP coefficient precision.
do_qlp_coeff_prec_searchEnable QLP coefficient precision search.
do_exhaustive_model_searchEnable exhaustive model search.
min_residual_partition_orderMinimum residual partition order.
max_residual_partition_orderMaximum residual partition order.
application_idApplication ID string for FLAC encoder.
application_id_lenLength of the application ID string.
+
+
+
Returns
Number of bytes written to the destination buffer.
+ +

Definition at line 175 of file flac.c.

+ +

References AARU_CALL, AARU_EXPORT, aaru_flac_ctx::dst_buffer, aaru_flac_ctx::dst_len, aaru_flac_ctx::dst_pos, encoder_write_callback(), aaru_flac_ctx::error, aaru_flac_ctx::src_buffer, aaru_flac_ctx::src_len, and aaru_flac_ctx::src_pos.

+ +

Referenced by aaruf_close_current_block().

+ +
+
+ +

◆ encoder_write_callback()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FLAC__StreamEncoderWriteStatus encoder_write_callback (const FLAC__StreamEncoder * encoder,
const FLAC__byte buffer[],
size_t bytes,
uint32_t samples,
uint32_t current_frame,
void * client_data )
+
+static
+
+ +

Definition at line 275 of file flac.c.

+ +

References aaru_flac_ctx::dst_buffer, aaru_flac_ctx::dst_len, and aaru_flac_ctx::dst_pos.

+ +

Referenced by aaruf_flac_encode_redbook_buffer().

+ +
+
+ +

◆ error_callback()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + +
void error_callback (const FLAC__StreamDecoder * decoder,
FLAC__StreamDecoderErrorStatus status,
void * client_data )
+
+static
+
+ +

Definition at line 141 of file flac.c.

+ +

References aaru_flac_ctx::error.

+ +

Referenced by aaruf_flac_decode_redbook_buffer().

+ +
+
+ +

◆ read_callback()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
FLAC__StreamDecoderReadStatus read_callback (const FLAC__StreamDecoder * decoder,
FLAC__byte buffer[],
size_t * bytes,
void * client_data )
+
+static
+
+ +

Definition at line 97 of file flac.c.

+ +

References aaru_flac_ctx::src_buffer, aaru_flac_ctx::src_len, and aaru_flac_ctx::src_pos.

+ +

Referenced by aaruf_flac_decode_redbook_buffer().

+ +
+
+ +

◆ write_callback()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
FLAC__StreamDecoderWriteStatus write_callback (const FLAC__StreamDecoder * decoder,
const FLAC__Frame * frame,
const FLAC__int32 *const buffer[],
void * client_data )
+
+static
+
+ +

Definition at line 112 of file flac.c.

+ +

References aaru_flac_ctx::dst_buffer, aaru_flac_ctx::dst_len, and aaru_flac_ctx::dst_pos.

+ +

Referenced by aaruf_flac_decode_redbook_buffer().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/flac_8c.js b/docs/html/flac_8c.js new file mode 100644 index 0000000..806b99f --- /dev/null +++ b/docs/html/flac_8c.js @@ -0,0 +1,9 @@ +var flac_8c = +[ + [ "aaruf_flac_decode_redbook_buffer", "flac_8c.html#af0ff6ad1495d50a8fa0ce0005be69471", null ], + [ "aaruf_flac_encode_redbook_buffer", "flac_8c.html#a102023fe64e4bd24cd6d4124f0d74e54", null ], + [ "encoder_write_callback", "flac_8c.html#a4c8139a16dc0f340140a71a2322f9c26", null ], + [ "error_callback", "flac_8c.html#ae0a385215d06bca05d1212caa0d0fa23", null ], + [ "read_callback", "flac_8c.html#a4ae2146e619c2a746b41c778f71f2e8c", null ], + [ "write_callback", "flac_8c.html#ad65b9acb1c0c9401aacf5e711c2c6cf7", null ] +]; \ No newline at end of file diff --git a/docs/html/flac_8c_source.html b/docs/html/flac_8c_source.html new file mode 100644 index 0000000..ab6b16b --- /dev/null +++ b/docs/html/flac_8c_source.html @@ -0,0 +1,392 @@ + + + + + + + +libaaruformat: src/compression/flac.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
flac.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <stdint.h>
+
20#include <stdlib.h>
+
21#include <string.h>
+
22
+
23#include "aaruformat.h"
+
24
+
25#include "flac.h"
+
26#include "FLAC/metadata.h"
+
27#include "FLAC/stream_decoder.h"
+
28#include "FLAC/stream_encoder.h"
+
29
+
30static FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[],
+
31 size_t *bytes, void *client_data);
+
32static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame,
+
33 const FLAC__int32 *const buffer[], void *client_data);
+
34static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status,
+
35 void *client_data);
+
36
+
+
48AARU_EXPORT size_t AARU_CALL aaruf_flac_decode_redbook_buffer(uint8_t *dst_buffer, size_t dst_size,
+
49 const uint8_t *src_buffer, size_t src_size)
+
50{
+
51 FLAC__StreamDecoder *decoder = NULL;
+
52 FLAC__StreamDecoderInitStatus init_status = FLAC__STREAM_DECODER_INIT_STATUS_OK;
+
53 aaru_flac_ctx *ctx = (aaru_flac_ctx *)malloc(sizeof(aaru_flac_ctx));
+
54 size_t ret_size = 0;
+
55
+
56 memset(ctx, 0, sizeof(aaru_flac_ctx));
+
57
+
58 ctx->src_buffer = src_buffer;
+
59 ctx->src_len = src_size;
+
60 ctx->src_pos = 0;
+
61 ctx->dst_buffer = dst_buffer;
+
62 ctx->dst_len = dst_size;
+
63 ctx->dst_pos = 0;
+
64 ctx->error = 0;
+
65
+
66 decoder = FLAC__stream_decoder_new();
+
67
+
68 if(!decoder)
+
69 {
+
70 free(ctx);
+
71 return -1;
+
72 }
+
73
+
74 FLAC__stream_decoder_set_md5_checking(decoder, false);
+
75
+
76 init_status = FLAC__stream_decoder_init_stream(decoder, read_callback, NULL, NULL, NULL, NULL, write_callback, NULL,
+
77 error_callback, ctx);
+
78
+
79 if(init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK)
+
80 {
+
81 free(ctx);
+
82 return -1;
+
83 }
+
84
+
85 // TODO: Return error somehow
+
86 FLAC__stream_decoder_process_until_end_of_stream(decoder);
+
87
+
88 FLAC__stream_decoder_delete(decoder);
+
89
+
90 ret_size = ctx->dst_pos;
+
91
+
92 free(ctx);
+
93
+
94 return ret_size;
+
95}
+
+
96
+
+
97static FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[],
+
98 size_t *bytes, void *client_data)
+
99{
+
100 aaru_flac_ctx *ctx = (aaru_flac_ctx *)client_data;
+
101
+
102 if(ctx->src_len - ctx->src_pos < *bytes) *bytes = ctx->src_len - ctx->src_pos;
+
103
+
104 if(*bytes == 0) return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM;
+
105
+
106 memcpy(buffer, ctx->src_buffer + ctx->src_pos, *bytes);
+
107 ctx->src_pos += *bytes;
+
108
+
109 return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
+
110}
+
+
111
+
+
112static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame,
+
113 const FLAC__int32 *const buffer[], void *client_data)
+
114{
+
115 aaru_flac_ctx *ctx = (aaru_flac_ctx *)client_data;
+
116 uint16_t *buffer16 = (uint16_t *)(ctx->dst_buffer + ctx->dst_pos);
+
117
+
118 // Why FLAC does not interleave the channels as PCM do, oh the mistery, we could use memcpy instead of looping
+
119 for(size_t i = 0; i < frame->header.blocksize && ctx->dst_pos < ctx->dst_len; i++)
+
120 {
+
121 // Left channel
+
122 *(buffer16++) = (FLAC__int16)buffer[0][i];
+
123 // Right channel
+
124 *(buffer16++) = (FLAC__int16)buffer[1][i];
+
125
+
126 ctx->dst_pos += 4;
+
127
+
128 /* TODO: Big-endian (use bswap?)
+
129 // Left channel
+
130 ctx->dst_buffer[ctx->dst_pos++] = (FLAC__uint16)(FLAC__int16)buffer[0][i];
+
131 ctx->dst_buffer[ctx->dst_pos++] = (FLAC__uint16)(FLAC__int16)buffer[0][i] >> 8;
+
132 // Right channel
+
133 ctx->dst_buffer[ctx->dst_pos++] = (FLAC__uint16)(FLAC__int16)buffer[1][i];
+
134 ctx->dst_buffer[ctx->dst_pos++] = (FLAC__uint16)(FLAC__int16)buffer[1][i] >> 8;
+
135 */
+
136 }
+
137
+
138 return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
+
139}
+
+
140
+
+
141static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
+
142{
+
143 aaru_flac_ctx *ctx = (aaru_flac_ctx *)client_data;
+
144
+
145 fprintf(stderr, "Got error callback: %s\n", FLAC__StreamDecoderErrorStatusString[status]);
+
146
+
147 ctx->error = 1;
+
148}
+
+
149
+
150static FLAC__StreamEncoderWriteStatus encoder_write_callback(const FLAC__StreamEncoder *encoder,
+
151 const FLAC__byte buffer[], size_t bytes, uint32_t samples,
+
152 uint32_t current_frame, void *client_data);
+
153
+
+ +
176 uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size, uint32_t blocksize,
+
177 int32_t do_mid_side_stereo, int32_t loose_mid_side_stereo, const char *apodization, uint32_t max_lpc_order,
+
178 uint32_t qlp_coeff_precision, int32_t do_qlp_coeff_prec_search, int32_t do_exhaustive_model_search,
+
179 uint32_t min_residual_partition_order, uint32_t max_residual_partition_order, const char *application_id,
+
180 uint32_t application_id_len)
+
181{
+
182 FLAC__StreamEncoder *encoder = NULL;
+
183 aaru_flac_ctx *ctx = (aaru_flac_ctx *)malloc(sizeof(aaru_flac_ctx));
+
184 FLAC__StreamEncoderInitStatus init_status = FLAC__STREAM_ENCODER_INIT_STATUS_OK;
+
185 size_t ret_size = 0;
+
186 FLAC__int32 *pcm = NULL;
+
187 int i = 0;
+
188 int16_t *buffer16 = (int16_t *)src_buffer;
+
189 FLAC__StreamMetadata *metadata[1];
+
190
+
191 memset(ctx, 0, sizeof(aaru_flac_ctx));
+
192
+
193 ctx->src_buffer = src_buffer;
+
194 ctx->src_len = src_size;
+
195 ctx->src_pos = 0;
+
196 ctx->dst_buffer = dst_buffer;
+
197 ctx->dst_len = dst_size;
+
198 ctx->dst_pos = 0;
+
199 ctx->error = 0;
+
200
+
201 encoder = FLAC__stream_encoder_new();
+
202
+
203 if(!encoder)
+
204 {
+
205 free(ctx);
+
206 return -1;
+
207 }
+
208
+
209 // TODO: Error detection here
+
210 FLAC__stream_encoder_set_verify(encoder, false);
+
211 FLAC__stream_encoder_set_streamable_subset(encoder, false);
+
212 FLAC__stream_encoder_set_channels(encoder, 2);
+
213 FLAC__stream_encoder_set_bits_per_sample(encoder, 16);
+
214 FLAC__stream_encoder_set_sample_rate(encoder, 44100);
+
215 FLAC__stream_encoder_set_blocksize(encoder, blocksize);
+
216 // true compresses more
+
217 FLAC__stream_encoder_set_do_mid_side_stereo(encoder, do_mid_side_stereo);
+
218 // false compresses more
+
219 FLAC__stream_encoder_set_loose_mid_side_stereo(encoder, loose_mid_side_stereo);
+
220 // Apodization
+
221 FLAC__stream_encoder_set_apodization(encoder, apodization);
+
222 FLAC__stream_encoder_set_max_lpc_order(encoder, max_lpc_order);
+
223 FLAC__stream_encoder_set_qlp_coeff_precision(encoder, qlp_coeff_precision);
+
224 FLAC__stream_encoder_set_do_qlp_coeff_prec_search(encoder, do_qlp_coeff_prec_search);
+
225 FLAC__stream_encoder_set_do_exhaustive_model_search(encoder, do_exhaustive_model_search);
+
226 FLAC__stream_encoder_set_min_residual_partition_order(encoder, min_residual_partition_order);
+
227 FLAC__stream_encoder_set_max_residual_partition_order(encoder, max_residual_partition_order);
+
228 FLAC__stream_encoder_set_total_samples_estimate(encoder, src_size / 4);
+
229
+
230 /* TODO: This is ignored by FLAC, need to replace it
+
231 if((metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT)) != NULL)
+
232 {
+
233 memset(&vorbis_entry, 0, sizeof(FLAC__StreamMetadata_VorbisComment_Entry));
+
234 vorbis_entry.entry = (unsigned char *)"Aaru.Compression.Native";
+
235 vorbis_entry.length = strlen("Aaru.Compression.Native");
+
236
+
237 FLAC__metadata_object_vorbiscomment_set_vendor_string(metadata[0], vorbis_entry, true);
+
238 }
+
239 */
+
240
+
241 if(application_id_len > 0 && application_id != NULL)
+
242 if((metadata[0] = FLAC__metadata_object_new(FLAC__METADATA_TYPE_APPLICATION)) != NULL)
+
243 FLAC__metadata_object_application_set_data(metadata[0], (unsigned char *)application_id, application_id_len,
+
244 true);
+
245
+
246 FLAC__stream_encoder_set_metadata(encoder, metadata, 1);
+
247
+
248 init_status = FLAC__stream_encoder_init_stream(encoder, encoder_write_callback, NULL, NULL, NULL, ctx);
+
249
+
250 if(init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK)
+
251 {
+
252 free(ctx);
+
253 return -1;
+
254 }
+
255
+
256 pcm = malloc((src_size / 2) * sizeof(FLAC__int32));
+
257
+
258 for(i = 0; i < src_size / 2; i++) pcm[i] = (FLAC__int32) * (buffer16++);
+
259
+
260 FLAC__stream_encoder_process_interleaved(encoder, pcm, src_size / 4);
+
261
+
262 FLAC__stream_encoder_finish(encoder);
+
263
+
264 FLAC__stream_encoder_delete(encoder);
+
265
+
266 ret_size = ctx->dst_pos;
+
267
+
268 free(ctx);
+
269 free(pcm);
+
270 FLAC__metadata_object_delete(metadata[0]);
+
271
+
272 return ret_size;
+
273}
+
+
274
+
+
275static FLAC__StreamEncoderWriteStatus encoder_write_callback(const FLAC__StreamEncoder *encoder,
+
276 const FLAC__byte buffer[], size_t bytes, uint32_t samples,
+
277 uint32_t current_frame, void *client_data)
+
278{
+
279 aaru_flac_ctx *ctx = (aaru_flac_ctx *)client_data;
+
280
+
281 if(bytes > ctx->dst_len - ctx->dst_pos) bytes = ctx->dst_len - ctx->dst_pos;
+
282
+
283 memcpy(ctx->dst_buffer + ctx->dst_pos, buffer, bytes);
+
284
+
285 ctx->dst_pos += bytes;
+
286
+
287 return FLAC__STREAM_ENCODER_WRITE_STATUS_OK;
+
288}
+
+ +
#define AARU_CALL
Definition decls.h:45
+
#define AARU_EXPORT
Definition decls.h:54
+
size_t aaruf_flac_encode_redbook_buffer(uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size, uint32_t blocksize, int32_t do_mid_side_stereo, int32_t loose_mid_side_stereo, const char *apodization, uint32_t max_lpc_order, uint32_t qlp_coeff_precision, int32_t do_qlp_coeff_prec_search, int32_t do_exhaustive_model_search, uint32_t min_residual_partition_order, uint32_t max_residual_partition_order, const char *application_id, uint32_t application_id_len)
Encodes a Red Book audio buffer to FLAC format.
Definition flac.c:175
+
static FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder *decoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
Definition flac.c:97
+
static FLAC__StreamEncoderWriteStatus encoder_write_callback(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame, void *client_data)
Definition flac.c:275
+
static FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder, const FLAC__Frame *frame, const FLAC__int32 *const buffer[], void *client_data)
Definition flac.c:112
+
static void error_callback(const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderErrorStatus status, void *client_data)
Definition flac.c:141
+
size_t aaruf_flac_decode_redbook_buffer(uint8_t *dst_buffer, size_t dst_size, const uint8_t *src_buffer, size_t src_size)
Decodes a FLAC-compressed Red Book audio buffer.
Definition flac.c:48
+ + +
size_t dst_pos
Definition flac.h:29
+
uint8_t error
Definition flac.h:30
+
size_t dst_len
Definition flac.h:28
+
const uint8_t * src_buffer
Definition flac.h:24
+
size_t src_pos
Definition flac.h:26
+
size_t src_len
Definition flac.h:25
+
uint8_t * dst_buffer
Definition flac.h:27
+
+
+
+ + + + diff --git a/docs/html/flac_8h.html b/docs/html/flac_8h.html new file mode 100644 index 0000000..fb5232f --- /dev/null +++ b/docs/html/flac_8h.html @@ -0,0 +1,120 @@ + + + + + + + +libaaruformat: include/aaruformat/flac.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
flac.h File Reference
+
+
+ +

Go to the source code of this file.

+ + + +

+Data Structures

struct  aaru_flac_ctx
+
+
+ +
+ + + + diff --git a/docs/html/flac_8h.js b/docs/html/flac_8h.js new file mode 100644 index 0000000..00b176a --- /dev/null +++ b/docs/html/flac_8h.js @@ -0,0 +1,4 @@ +var flac_8h = +[ + [ "aaru_flac_ctx", "structaaru__flac__ctx.html", "structaaru__flac__ctx" ] +]; \ No newline at end of file diff --git a/docs/html/flac_8h_source.html b/docs/html/flac_8h_source.html new file mode 100644 index 0000000..afb5ed1 --- /dev/null +++ b/docs/html/flac_8h_source.html @@ -0,0 +1,149 @@ + + + + + + + +libaaruformat: include/aaruformat/flac.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
flac.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_FLAC_H
+
20#define LIBAARUFORMAT_FLAC_H
+
21
+
+
22typedef struct
+
23{
+
24 const uint8_t *src_buffer;
+
25 size_t src_len;
+
26 size_t src_pos;
+
27 uint8_t *dst_buffer;
+
28 size_t dst_len;
+
29 size_t dst_pos;
+
30 uint8_t error;
+ +
+
32
+
33#endif // LIBAARUFORMAT_FLAC_H
+ +
size_t dst_pos
Definition flac.h:29
+
uint8_t error
Definition flac.h:30
+
size_t dst_len
Definition flac.h:28
+
const uint8_t * src_buffer
Definition flac.h:24
+
size_t src_pos
Definition flac.h:26
+
size_t src_len
Definition flac.h:25
+
uint8_t * dst_buffer
Definition flac.h:27
+
+
+
+ + + + diff --git a/docs/html/functions.html b/docs/html/functions.html new file mode 100644 index 0000000..4c911f1 --- /dev/null +++ b/docs/html/functions.html @@ -0,0 +1,113 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- a -

+
+
+
+ + + + diff --git a/docs/html/functions_b.html b/docs/html/functions_b.html new file mode 100644 index 0000000..40879ee --- /dev/null +++ b/docs/html/functions_b.html @@ -0,0 +1,122 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- b -

+
+
+
+ + + + diff --git a/docs/html/functions_c.html b/docs/html/functions_c.html new file mode 100644 index 0000000..1236b54 --- /dev/null +++ b/docs/html/functions_c.html @@ -0,0 +1,141 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- c -

+
+
+
+ + + + diff --git a/docs/html/functions_d.html b/docs/html/functions_d.html new file mode 100644 index 0000000..f95ffde --- /dev/null +++ b/docs/html/functions_d.html @@ -0,0 +1,135 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- d -

+
+
+
+ + + + diff --git a/docs/html/functions_dup.js b/docs/html/functions_dup.js new file mode 100644 index 0000000..0246e54 --- /dev/null +++ b/docs/html/functions_dup.js @@ -0,0 +1,25 @@ +var functions_dup = +[ + [ "a", "functions.html", null ], + [ "b", "functions_b.html", null ], + [ "c", "functions_c.html", null ], + [ "d", "functions_d.html", null ], + [ "e", "functions_e.html", null ], + [ "f", "functions_f.html", null ], + [ "g", "functions_g.html", null ], + [ "h", "functions_h.html", null ], + [ "i", "functions_i.html", null ], + [ "j", "functions_j.html", null ], + [ "k", "functions_k.html", null ], + [ "l", "functions_l.html", null ], + [ "m", "functions_m.html", null ], + [ "n", "functions_n.html", null ], + [ "o", "functions_o.html", null ], + [ "p", "functions_p.html", null ], + [ "r", "functions_r.html", null ], + [ "s", "functions_s.html", null ], + [ "t", "functions_t.html", null ], + [ "u", "functions_u.html", null ], + [ "v", "functions_v.html", null ], + [ "w", "functions_w.html", null ] +]; \ No newline at end of file diff --git a/docs/html/functions_e.html b/docs/html/functions_e.html new file mode 100644 index 0000000..a025fb5 --- /dev/null +++ b/docs/html/functions_e.html @@ -0,0 +1,115 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- e -

+
+
+
+ + + + diff --git a/docs/html/functions_f.html b/docs/html/functions_f.html new file mode 100644 index 0000000..31e1b1f --- /dev/null +++ b/docs/html/functions_f.html @@ -0,0 +1,116 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- f -

+
+
+
+ + + + diff --git a/docs/html/functions_g.html b/docs/html/functions_g.html new file mode 100644 index 0000000..2745c69 --- /dev/null +++ b/docs/html/functions_g.html @@ -0,0 +1,108 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- g -

+
+
+
+ + + + diff --git a/docs/html/functions_h.html b/docs/html/functions_h.html new file mode 100644 index 0000000..feb7de6 --- /dev/null +++ b/docs/html/functions_h.html @@ -0,0 +1,123 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- h -

+
+
+
+ + + + diff --git a/docs/html/functions_i.html b/docs/html/functions_i.html new file mode 100644 index 0000000..048a300 --- /dev/null +++ b/docs/html/functions_i.html @@ -0,0 +1,119 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- i -

+
+
+
+ + + + diff --git a/docs/html/functions_j.html b/docs/html/functions_j.html new file mode 100644 index 0000000..059c9a3 --- /dev/null +++ b/docs/html/functions_j.html @@ -0,0 +1,108 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- j -

+
+
+
+ + + + diff --git a/docs/html/functions_k.html b/docs/html/functions_k.html new file mode 100644 index 0000000..9226d6d --- /dev/null +++ b/docs/html/functions_k.html @@ -0,0 +1,108 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- k -

+
+
+
+ + + + diff --git a/docs/html/functions_l.html b/docs/html/functions_l.html new file mode 100644 index 0000000..8efeaca --- /dev/null +++ b/docs/html/functions_l.html @@ -0,0 +1,118 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- l -

+
+
+
+ + + + diff --git a/docs/html/functions_m.html b/docs/html/functions_m.html new file mode 100644 index 0000000..c2b9d55 --- /dev/null +++ b/docs/html/functions_m.html @@ -0,0 +1,142 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- m -

+
+
+
+ + + + diff --git a/docs/html/functions_n.html b/docs/html/functions_n.html new file mode 100644 index 0000000..5a3cc6e --- /dev/null +++ b/docs/html/functions_n.html @@ -0,0 +1,112 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- n -

+
+
+
+ + + + diff --git a/docs/html/functions_o.html b/docs/html/functions_o.html new file mode 100644 index 0000000..bb6e83a --- /dev/null +++ b/docs/html/functions_o.html @@ -0,0 +1,108 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- o -

+
+
+
+ + + + diff --git a/docs/html/functions_p.html b/docs/html/functions_p.html new file mode 100644 index 0000000..1d2124d --- /dev/null +++ b/docs/html/functions_p.html @@ -0,0 +1,113 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- p -

+
+
+
+ + + + diff --git a/docs/html/functions_r.html b/docs/html/functions_r.html new file mode 100644 index 0000000..3f8cc5c --- /dev/null +++ b/docs/html/functions_r.html @@ -0,0 +1,113 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- r -

+
+
+
+ + + + diff --git a/docs/html/functions_s.html b/docs/html/functions_s.html new file mode 100644 index 0000000..38ed7bb --- /dev/null +++ b/docs/html/functions_s.html @@ -0,0 +1,153 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- s -

+
+
+
+ + + + diff --git a/docs/html/functions_t.html b/docs/html/functions_t.html new file mode 100644 index 0000000..d4ecb62 --- /dev/null +++ b/docs/html/functions_t.html @@ -0,0 +1,117 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- t -

+
+
+
+ + + + diff --git a/docs/html/functions_u.html b/docs/html/functions_u.html new file mode 100644 index 0000000..030d998 --- /dev/null +++ b/docs/html/functions_u.html @@ -0,0 +1,110 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- u -

+
+
+
+ + + + diff --git a/docs/html/functions_v.html b/docs/html/functions_v.html new file mode 100644 index 0000000..02b8115 --- /dev/null +++ b/docs/html/functions_v.html @@ -0,0 +1,111 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- v -

+
+
+
+ + + + diff --git a/docs/html/functions_vars.html b/docs/html/functions_vars.html new file mode 100644 index 0000000..a0922bc --- /dev/null +++ b/docs/html/functions_vars.html @@ -0,0 +1,113 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- a -

+
+
+
+ + + + diff --git a/docs/html/functions_vars.js b/docs/html/functions_vars.js new file mode 100644 index 0000000..2ad3e82 --- /dev/null +++ b/docs/html/functions_vars.js @@ -0,0 +1,25 @@ +var functions_vars = +[ + [ "a", "functions_vars.html", null ], + [ "b", "functions_vars_b.html", null ], + [ "c", "functions_vars_c.html", null ], + [ "d", "functions_vars_d.html", null ], + [ "e", "functions_vars_e.html", null ], + [ "f", "functions_vars_f.html", null ], + [ "g", "functions_vars_g.html", null ], + [ "h", "functions_vars_h.html", null ], + [ "i", "functions_vars_i.html", null ], + [ "j", "functions_vars_j.html", null ], + [ "k", "functions_vars_k.html", null ], + [ "l", "functions_vars_l.html", null ], + [ "m", "functions_vars_m.html", null ], + [ "n", "functions_vars_n.html", null ], + [ "o", "functions_vars_o.html", null ], + [ "p", "functions_vars_p.html", null ], + [ "r", "functions_vars_r.html", null ], + [ "s", "functions_vars_s.html", null ], + [ "t", "functions_vars_t.html", null ], + [ "u", "functions_vars_u.html", null ], + [ "v", "functions_vars_v.html", null ], + [ "w", "functions_vars_w.html", null ] +]; \ No newline at end of file diff --git a/docs/html/functions_vars_b.html b/docs/html/functions_vars_b.html new file mode 100644 index 0000000..3d96750 --- /dev/null +++ b/docs/html/functions_vars_b.html @@ -0,0 +1,122 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- b -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_c.html b/docs/html/functions_vars_c.html new file mode 100644 index 0000000..05be17f --- /dev/null +++ b/docs/html/functions_vars_c.html @@ -0,0 +1,141 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- c -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_d.html b/docs/html/functions_vars_d.html new file mode 100644 index 0000000..4227712 --- /dev/null +++ b/docs/html/functions_vars_d.html @@ -0,0 +1,135 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- d -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_e.html b/docs/html/functions_vars_e.html new file mode 100644 index 0000000..ec57835 --- /dev/null +++ b/docs/html/functions_vars_e.html @@ -0,0 +1,115 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- e -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_f.html b/docs/html/functions_vars_f.html new file mode 100644 index 0000000..f1615ef --- /dev/null +++ b/docs/html/functions_vars_f.html @@ -0,0 +1,116 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- f -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_g.html b/docs/html/functions_vars_g.html new file mode 100644 index 0000000..c4da25b --- /dev/null +++ b/docs/html/functions_vars_g.html @@ -0,0 +1,108 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- g -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_h.html b/docs/html/functions_vars_h.html new file mode 100644 index 0000000..5975cfa --- /dev/null +++ b/docs/html/functions_vars_h.html @@ -0,0 +1,123 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- h -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_i.html b/docs/html/functions_vars_i.html new file mode 100644 index 0000000..8b59234 --- /dev/null +++ b/docs/html/functions_vars_i.html @@ -0,0 +1,119 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- i -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_j.html b/docs/html/functions_vars_j.html new file mode 100644 index 0000000..7e1241b --- /dev/null +++ b/docs/html/functions_vars_j.html @@ -0,0 +1,108 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- j -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_k.html b/docs/html/functions_vars_k.html new file mode 100644 index 0000000..e3c9e36 --- /dev/null +++ b/docs/html/functions_vars_k.html @@ -0,0 +1,108 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- k -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_l.html b/docs/html/functions_vars_l.html new file mode 100644 index 0000000..ed6fea8 --- /dev/null +++ b/docs/html/functions_vars_l.html @@ -0,0 +1,118 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- l -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_m.html b/docs/html/functions_vars_m.html new file mode 100644 index 0000000..4dcec44 --- /dev/null +++ b/docs/html/functions_vars_m.html @@ -0,0 +1,142 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- m -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_n.html b/docs/html/functions_vars_n.html new file mode 100644 index 0000000..f5e4123 --- /dev/null +++ b/docs/html/functions_vars_n.html @@ -0,0 +1,112 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- n -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_o.html b/docs/html/functions_vars_o.html new file mode 100644 index 0000000..540f535 --- /dev/null +++ b/docs/html/functions_vars_o.html @@ -0,0 +1,108 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- o -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_p.html b/docs/html/functions_vars_p.html new file mode 100644 index 0000000..d289423 --- /dev/null +++ b/docs/html/functions_vars_p.html @@ -0,0 +1,113 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- p -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_r.html b/docs/html/functions_vars_r.html new file mode 100644 index 0000000..e6a3742 --- /dev/null +++ b/docs/html/functions_vars_r.html @@ -0,0 +1,113 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- r -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_s.html b/docs/html/functions_vars_s.html new file mode 100644 index 0000000..045a26d --- /dev/null +++ b/docs/html/functions_vars_s.html @@ -0,0 +1,153 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- s -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_t.html b/docs/html/functions_vars_t.html new file mode 100644 index 0000000..3ce9713 --- /dev/null +++ b/docs/html/functions_vars_t.html @@ -0,0 +1,117 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- t -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_u.html b/docs/html/functions_vars_u.html new file mode 100644 index 0000000..732223e --- /dev/null +++ b/docs/html/functions_vars_u.html @@ -0,0 +1,110 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- u -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_v.html b/docs/html/functions_vars_v.html new file mode 100644 index 0000000..f292408 --- /dev/null +++ b/docs/html/functions_vars_v.html @@ -0,0 +1,111 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- v -

+
+
+
+ + + + diff --git a/docs/html/functions_vars_w.html b/docs/html/functions_vars_w.html new file mode 100644 index 0000000..fa66111 --- /dev/null +++ b/docs/html/functions_vars_w.html @@ -0,0 +1,110 @@ + + + + + + + +libaaruformat: Data Fields - Variables + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the structures/unions they belong to:
+ +

- w -

+
+
+
+ + + + diff --git a/docs/html/functions_w.html b/docs/html/functions_w.html new file mode 100644 index 0000000..2bab2f2 --- /dev/null +++ b/docs/html/functions_w.html @@ -0,0 +1,110 @@ + + + + + + + +libaaruformat: Data Fields + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all struct and union fields with links to the structures/unions they belong to:
+ +

- w -

+
+
+
+ + + + diff --git a/docs/html/globals.html b/docs/html/globals.html new file mode 100644 index 0000000..4c204c5 --- /dev/null +++ b/docs/html/globals.html @@ -0,0 +1,107 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- _ -

    +
  • __attribute__() : lru.c
  • +
+
+
+
+ + + + diff --git a/docs/html/globals_a.html b/docs/html/globals_a.html new file mode 100644 index 0000000..fe3d783 --- /dev/null +++ b/docs/html/globals_a.html @@ -0,0 +1,323 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- a -

+
+
+
+ + + + diff --git a/docs/html/globals_b.html b/docs/html/globals_b.html new file mode 100644 index 0000000..80451b7 --- /dev/null +++ b/docs/html/globals_b.html @@ -0,0 +1,137 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- b -

+
+
+
+ + + + diff --git a/docs/html/globals_c.html b/docs/html/globals_c.html new file mode 100644 index 0000000..af45f86 --- /dev/null +++ b/docs/html/globals_c.html @@ -0,0 +1,201 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- c -

+
+
+
+ + + + diff --git a/docs/html/globals_d.html b/docs/html/globals_d.html new file mode 100644 index 0000000..6edc904 --- /dev/null +++ b/docs/html/globals_d.html @@ -0,0 +1,235 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- d -

+
+
+
+ + + + diff --git a/docs/html/globals_defs.html b/docs/html/globals_defs.html new file mode 100644 index 0000000..43ddd10 --- /dev/null +++ b/docs/html/globals_defs.html @@ -0,0 +1,289 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all macros with links to the files they belong to:
+ +

- a -

    +
  • AARU_CALL : decls.h
  • +
  • AARU_EXPORT : decls.h
  • +
  • AARU_HEADER_APP_NAME_LEN : header.h
  • +
  • AARU_LOCAL : decls.h, sha1.c, sha256.c
  • +
  • AARU_MAGIC : consts.h
  • +
  • AARU_RESTRICT : md5.c
  • +
  • AARUF_ERROR_BUFFER_TOO_SMALL : errors.h
  • +
  • AARUF_ERROR_CANNOT_CREATE_FILE : errors.h
  • +
  • AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK : errors.h
  • +
  • AARUF_ERROR_CANNOT_READ_BLOCK : errors.h
  • +
  • AARUF_ERROR_CANNOT_READ_HEADER : errors.h
  • +
  • AARUF_ERROR_CANNOT_READ_INDEX : errors.h
  • +
  • AARUF_ERROR_CANNOT_SET_DDT_ENTRY : errors.h
  • +
  • AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA : errors.h
  • +
  • AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER : errors.h
  • +
  • AARUF_ERROR_CANNOT_WRITE_HEADER : errors.h
  • +
  • AARUF_ERROR_FILE_TOO_SMALL : errors.h
  • +
  • AARUF_ERROR_INCOMPATIBLE_VERSION : errors.h
  • +
  • AARUF_ERROR_INCORRECT_DATA_SIZE : errors.h
  • +
  • AARUF_ERROR_INCORRECT_MEDIA_TYPE : errors.h
  • +
  • AARUF_ERROR_INVALID_APP_NAME_LENGTH : errors.h
  • +
  • AARUF_ERROR_INVALID_BLOCK_CRC : errors.h
  • +
  • AARUF_ERROR_INVALID_TAG : errors.h
  • +
  • AARUF_ERROR_INVALID_TRACK_FORMAT : errors.h
  • +
  • AARUF_ERROR_MEDIA_TAG_NOT_PRESENT : errors.h
  • +
  • AARUF_ERROR_METADATA_NOT_PRESENT : errors.h
  • +
  • AARUF_ERROR_NOT_AARUFORMAT : errors.h
  • +
  • AARUF_ERROR_NOT_ENOUGH_MEMORY : errors.h
  • +
  • AARUF_ERROR_REACHED_UNREACHABLE_CODE : errors.h
  • +
  • AARUF_ERROR_SECTOR_OUT_OF_BOUNDS : errors.h
  • +
  • AARUF_ERROR_SECTOR_TAG_NOT_PRESENT : errors.h
  • +
  • AARUF_ERROR_TAPE_FILE_NOT_FOUND : errors.h
  • +
  • AARUF_ERROR_TAPE_PARTITION_NOT_FOUND : errors.h
  • +
  • AARUF_ERROR_TRACK_NOT_FOUND : errors.h
  • +
  • AARUF_ERROR_UNSUPPORTED_COMPRESSION : errors.h
  • +
  • AARUF_READ_ONLY : errors.h
  • +
  • AARUF_STATUS_OK : errors.h
  • +
  • AARUF_STATUS_SECTOR_DELETED : errors.h
  • +
  • AARUF_STATUS_SECTOR_NOT_DUMPED : errors.h
  • +
  • AARUF_STATUS_SECTOR_WITH_ERRORS : errors.h
  • +
  • AARUF_VERSION : consts.h
  • +
  • AARUF_VERSION_V1 : consts.h
  • +
  • AARUF_VERSION_V2 : consts.h
  • +
  • ALIGNED_ : simd.h
  • +
+ + +

- b -

+ + +

- c -

+ + +

- d -

+ + +

- e -

+ + +

- f -

+ + +

- g -

+ + +

- h -

+ + +

- i -

+ + +

- l -

+ + +

- m -

+ + +

- n -

+ + +

- o -

+ + +

- r -

+ + +

- s -

+ + +

- t -

+ + +

- u -

+ + +

- v -

+
+
+
+ + + + diff --git a/docs/html/globals_dup.js b/docs/html/globals_dup.js new file mode 100644 index 0000000..45561af --- /dev/null +++ b/docs/html/globals_dup.js @@ -0,0 +1,29 @@ +var globals_dup = +[ + [ "_", "globals.html", null ], + [ "a", "globals_a.html", null ], + [ "b", "globals_b.html", null ], + [ "c", "globals_c.html", null ], + [ "d", "globals_d.html", null ], + [ "e", "globals_e.html", null ], + [ "f", "globals_f.html", null ], + [ "g", "globals_g.html", null ], + [ "h", "globals_h.html", null ], + [ "i", "globals_i.html", null ], + [ "j", "globals_j.html", null ], + [ "k", "globals_k.html", null ], + [ "l", "globals_l.html", null ], + [ "m", "globals_m.html", null ], + [ "n", "globals_n.html", null ], + [ "o", "globals_o.html", null ], + [ "p", "globals_p.html", null ], + [ "q", "globals_q.html", null ], + [ "r", "globals_r.html", null ], + [ "s", "globals_s.html", null ], + [ "t", "globals_t.html", null ], + [ "u", "globals_u.html", null ], + [ "v", "globals_v.html", null ], + [ "w", "globals_w.html", null ], + [ "x", "globals_x.html", null ], + [ "z", "globals_z.html", null ] +]; \ No newline at end of file diff --git a/docs/html/globals_e.html b/docs/html/globals_e.html new file mode 100644 index 0000000..518d51b --- /dev/null +++ b/docs/html/globals_e.html @@ -0,0 +1,169 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- e -

+
+
+
+ + + + diff --git a/docs/html/globals_enum.html b/docs/html/globals_enum.html new file mode 100644 index 0000000..e853492 --- /dev/null +++ b/docs/html/globals_enum.html @@ -0,0 +1,117 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enums with links to the files they belong to:
+
+
+
+ + + + diff --git a/docs/html/globals_eval.html b/docs/html/globals_eval.html new file mode 100644 index 0000000..f98dc7a --- /dev/null +++ b/docs/html/globals_eval.html @@ -0,0 +1,170 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- a -

+
+
+
+ + + + diff --git a/docs/html/globals_eval.js b/docs/html/globals_eval.js new file mode 100644 index 0000000..9334a84 --- /dev/null +++ b/docs/html/globals_eval.js @@ -0,0 +1,27 @@ +var globals_eval = +[ + [ "a", "globals_eval.html", null ], + [ "b", "globals_eval_b.html", null ], + [ "c", "globals_eval_c.html", null ], + [ "d", "globals_eval_d.html", null ], + [ "e", "globals_eval_e.html", null ], + [ "f", "globals_eval_f.html", null ], + [ "g", "globals_eval_g.html", null ], + [ "h", "globals_eval_h.html", null ], + [ "i", "globals_eval_i.html", null ], + [ "j", "globals_eval_j.html", null ], + [ "l", "globals_eval_l.html", null ], + [ "m", "globals_eval_m.html", null ], + [ "n", "globals_eval_n.html", null ], + [ "o", "globals_eval_o.html", null ], + [ "p", "globals_eval_p.html", null ], + [ "q", "globals_eval_q.html", null ], + [ "r", "globals_eval_r.html", null ], + [ "s", "globals_eval_s.html", null ], + [ "t", "globals_eval_t.html", null ], + [ "u", "globals_eval_u.html", null ], + [ "v", "globals_eval_v.html", null ], + [ "w", "globals_eval_w.html", null ], + [ "x", "globals_eval_x.html", null ], + [ "z", "globals_eval_z.html", null ] +]; \ No newline at end of file diff --git a/docs/html/globals_eval_b.html b/docs/html/globals_eval_b.html new file mode 100644 index 0000000..12ecd26 --- /dev/null +++ b/docs/html/globals_eval_b.html @@ -0,0 +1,127 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- b -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_c.html b/docs/html/globals_eval_c.html new file mode 100644 index 0000000..bab7842 --- /dev/null +++ b/docs/html/globals_eval_c.html @@ -0,0 +1,182 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- c -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_d.html b/docs/html/globals_eval_d.html new file mode 100644 index 0000000..097194c --- /dev/null +++ b/docs/html/globals_eval_d.html @@ -0,0 +1,223 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- d -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_e.html b/docs/html/globals_eval_e.html new file mode 100644 index 0000000..fc07261 --- /dev/null +++ b/docs/html/globals_eval_e.html @@ -0,0 +1,166 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- e -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_f.html b/docs/html/globals_eval_f.html new file mode 100644 index 0000000..c7579bd --- /dev/null +++ b/docs/html/globals_eval_f.html @@ -0,0 +1,123 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- f -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_g.html b/docs/html/globals_eval_g.html new file mode 100644 index 0000000..e41fdb1 --- /dev/null +++ b/docs/html/globals_eval_g.html @@ -0,0 +1,115 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- g -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_h.html b/docs/html/globals_eval_h.html new file mode 100644 index 0000000..8f4164d --- /dev/null +++ b/docs/html/globals_eval_h.html @@ -0,0 +1,125 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- h -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_i.html b/docs/html/globals_eval_i.html new file mode 100644 index 0000000..8c29ad2 --- /dev/null +++ b/docs/html/globals_eval_i.html @@ -0,0 +1,124 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- i -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_j.html b/docs/html/globals_eval_j.html new file mode 100644 index 0000000..6980fec --- /dev/null +++ b/docs/html/globals_eval_j.html @@ -0,0 +1,109 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- j -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_l.html b/docs/html/globals_eval_l.html new file mode 100644 index 0000000..3591e1c --- /dev/null +++ b/docs/html/globals_eval_l.html @@ -0,0 +1,128 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- l -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_m.html b/docs/html/globals_eval_m.html new file mode 100644 index 0000000..ddc07a0 --- /dev/null +++ b/docs/html/globals_eval_m.html @@ -0,0 +1,151 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- m -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_n.html b/docs/html/globals_eval_n.html new file mode 100644 index 0000000..acd938c --- /dev/null +++ b/docs/html/globals_eval_n.html @@ -0,0 +1,126 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- n -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_o.html b/docs/html/globals_eval_o.html new file mode 100644 index 0000000..c9e3ec0 --- /dev/null +++ b/docs/html/globals_eval_o.html @@ -0,0 +1,109 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- o -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_p.html b/docs/html/globals_eval_p.html new file mode 100644 index 0000000..aff9ddd --- /dev/null +++ b/docs/html/globals_eval_p.html @@ -0,0 +1,131 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- p -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_q.html b/docs/html/globals_eval_q.html new file mode 100644 index 0000000..7db5ef7 --- /dev/null +++ b/docs/html/globals_eval_q.html @@ -0,0 +1,121 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- q -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_r.html b/docs/html/globals_eval_r.html new file mode 100644 index 0000000..7cb2c65 --- /dev/null +++ b/docs/html/globals_eval_r.html @@ -0,0 +1,143 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- r -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_s.html b/docs/html/globals_eval_s.html new file mode 100644 index 0000000..23372f7 --- /dev/null +++ b/docs/html/globals_eval_s.html @@ -0,0 +1,193 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- s -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_t.html b/docs/html/globals_eval_t.html new file mode 100644 index 0000000..7be4448 --- /dev/null +++ b/docs/html/globals_eval_t.html @@ -0,0 +1,127 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- t -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_u.html b/docs/html/globals_eval_u.html new file mode 100644 index 0000000..abe74b0 --- /dev/null +++ b/docs/html/globals_eval_u.html @@ -0,0 +1,116 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- u -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_v.html b/docs/html/globals_eval_v.html new file mode 100644 index 0000000..0a69459 --- /dev/null +++ b/docs/html/globals_eval_v.html @@ -0,0 +1,116 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- v -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_w.html b/docs/html/globals_eval_w.html new file mode 100644 index 0000000..a63cdbd --- /dev/null +++ b/docs/html/globals_eval_w.html @@ -0,0 +1,109 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- w -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_x.html b/docs/html/globals_eval_x.html new file mode 100644 index 0000000..5c2fe32 --- /dev/null +++ b/docs/html/globals_eval_x.html @@ -0,0 +1,120 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- x -

+
+
+
+ + + + diff --git a/docs/html/globals_eval_z.html b/docs/html/globals_eval_z.html new file mode 100644 index 0000000..8c75c3a --- /dev/null +++ b/docs/html/globals_eval_z.html @@ -0,0 +1,111 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all enum values with links to the files they belong to:
+ +

- z -

+
+
+
+ + + + diff --git a/docs/html/globals_f.html b/docs/html/globals_f.html new file mode 100644 index 0000000..ccd0168 --- /dev/null +++ b/docs/html/globals_f.html @@ -0,0 +1,140 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- f -

+
+
+
+ + + + diff --git a/docs/html/globals_func.html b/docs/html/globals_func.html new file mode 100644 index 0000000..39feb69 --- /dev/null +++ b/docs/html/globals_func.html @@ -0,0 +1,107 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- _ -

    +
  • __attribute__() : lru.c
  • +
+
+
+
+ + + + diff --git a/docs/html/globals_func.js b/docs/html/globals_func.js new file mode 100644 index 0000000..3db5ff7 --- /dev/null +++ b/docs/html/globals_func.js @@ -0,0 +1,20 @@ +var globals_func = +[ + [ "_", "globals_func.html", null ], + [ "a", "globals_func_a.html", null ], + [ "b", "globals_func_b.html", null ], + [ "c", "globals_func_c.html", null ], + [ "d", "globals_func_d.html", null ], + [ "e", "globals_func_e.html", null ], + [ "f", "globals_func_f.html", null ], + [ "g", "globals_func_g.html", null ], + [ "i", "globals_func_i.html", null ], + [ "l", "globals_func_l.html", null ], + [ "m", "globals_func_m.html", null ], + [ "p", "globals_func_p.html", null ], + [ "r", "globals_func_r.html", null ], + [ "s", "globals_func_s.html", null ], + [ "u", "globals_func_u.html", null ], + [ "v", "globals_func_v.html", null ], + [ "w", "globals_func_w.html", null ] +]; \ No newline at end of file diff --git a/docs/html/globals_func_a.html b/docs/html/globals_func_a.html new file mode 100644 index 0000000..e822523 --- /dev/null +++ b/docs/html/globals_func_a.html @@ -0,0 +1,210 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- a -

+
+
+
+ + + + diff --git a/docs/html/globals_func_b.html b/docs/html/globals_func_b.html new file mode 100644 index 0000000..c4e0557 --- /dev/null +++ b/docs/html/globals_func_b.html @@ -0,0 +1,110 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- b -

+
+
+
+ + + + diff --git a/docs/html/globals_func_c.html b/docs/html/globals_func_c.html new file mode 100644 index 0000000..92d7ce7 --- /dev/null +++ b/docs/html/globals_func_c.html @@ -0,0 +1,110 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- c -

+
+
+
+ + + + diff --git a/docs/html/globals_func_d.html b/docs/html/globals_func_d.html new file mode 100644 index 0000000..e26b83b --- /dev/null +++ b/docs/html/globals_func_d.html @@ -0,0 +1,110 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- d -

+
+
+
+ + + + diff --git a/docs/html/globals_func_e.html b/docs/html/globals_func_e.html new file mode 100644 index 0000000..564ed51 --- /dev/null +++ b/docs/html/globals_func_e.html @@ -0,0 +1,108 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- e -

    +
  • encoder_write_callback() : flac.c
  • +
  • error_callback() : flac.c
  • +
+
+
+
+ + + + diff --git a/docs/html/globals_func_f.html b/docs/html/globals_func_f.html new file mode 100644 index 0000000..7a909da --- /dev/null +++ b/docs/html/globals_func_f.html @@ -0,0 +1,114 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- f -

+
+
+
+ + + + diff --git a/docs/html/globals_func_g.html b/docs/html/globals_func_g.html new file mode 100644 index 0000000..570ab25 --- /dev/null +++ b/docs/html/globals_func_g.html @@ -0,0 +1,107 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- g -

+
+
+
+ + + + diff --git a/docs/html/globals_func_i.html b/docs/html/globals_func_i.html new file mode 100644 index 0000000..e26fdd2 --- /dev/null +++ b/docs/html/globals_func_i.html @@ -0,0 +1,107 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- i -

+
+
+
+ + + + diff --git a/docs/html/globals_func_l.html b/docs/html/globals_func_l.html new file mode 100644 index 0000000..a17953a --- /dev/null +++ b/docs/html/globals_func_l.html @@ -0,0 +1,107 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- l -

+
+
+
+ + + + diff --git a/docs/html/globals_func_m.html b/docs/html/globals_func_m.html new file mode 100644 index 0000000..fc20cfc --- /dev/null +++ b/docs/html/globals_func_m.html @@ -0,0 +1,107 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- m -

    +
  • md5_process_block_loaded() : md5.c
  • +
+
+
+
+ + + + diff --git a/docs/html/globals_func_p.html b/docs/html/globals_func_p.html new file mode 100644 index 0000000..d9da215 --- /dev/null +++ b/docs/html/globals_func_p.html @@ -0,0 +1,128 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- p -

+
+
+
+ + + + diff --git a/docs/html/globals_func_r.html b/docs/html/globals_func_r.html new file mode 100644 index 0000000..d7b65d6 --- /dev/null +++ b/docs/html/globals_func_r.html @@ -0,0 +1,111 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- r -

+
+
+
+ + + + diff --git a/docs/html/globals_func_s.html b/docs/html/globals_func_s.html new file mode 100644 index 0000000..2a40bda --- /dev/null +++ b/docs/html/globals_func_s.html @@ -0,0 +1,115 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- s -

+
+
+
+ + + + diff --git a/docs/html/globals_func_u.html b/docs/html/globals_func_u.html new file mode 100644 index 0000000..13ebb23 --- /dev/null +++ b/docs/html/globals_func_u.html @@ -0,0 +1,107 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- u -

    +
  • update_crc64_from_stream() : verify.c
  • +
+
+
+
+ + + + diff --git a/docs/html/globals_func_v.html b/docs/html/globals_func_v.html new file mode 100644 index 0000000..aa4babf --- /dev/null +++ b/docs/html/globals_func_v.html @@ -0,0 +1,109 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- v -

+
+
+
+ + + + diff --git a/docs/html/globals_func_w.html b/docs/html/globals_func_w.html new file mode 100644 index 0000000..34ac5e2 --- /dev/null +++ b/docs/html/globals_func_w.html @@ -0,0 +1,130 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions with links to the files they belong to:
+ +

- w -

    +
  • write_aaru_json_block() : close.c
  • +
  • write_cached_secondary_ddt() : close.c
  • +
  • write_callback() : flac.c
  • +
  • write_checksum_block() : close.c
  • +
  • write_cicm_block() : close.c
  • +
  • write_dumphw_block() : close.c
  • +
  • write_dvd_long_sector_blocks() : close.c
  • +
  • write_dvd_title_key_decrypted_block() : close.c
  • +
  • write_geometry_block() : close.c
  • +
  • write_index_block() : close.c
  • +
  • write_media_tags() : close.c
  • +
  • write_metadata_block() : close.c
  • +
  • write_mode2_subheaders_block() : close.c
  • +
  • write_primary_ddt() : close.c
  • +
  • write_sector_prefix() : close.c
  • +
  • write_sector_prefix_ddt() : close.c
  • +
  • write_sector_subchannel() : close.c
  • +
  • write_sector_suffix() : close.c
  • +
  • write_sector_suffix_ddt() : close.c
  • +
  • write_single_level_ddt() : close.c
  • +
  • write_tape_ddt() : close.c
  • +
  • write_tape_file_block() : close.c
  • +
  • write_tape_partition_block() : close.c
  • +
  • write_tracks_block() : close.c
  • +
+
+
+
+ + + + diff --git a/docs/html/globals_g.html b/docs/html/globals_g.html new file mode 100644 index 0000000..285cffe --- /dev/null +++ b/docs/html/globals_g.html @@ -0,0 +1,120 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- g -

+
+
+
+ + + + diff --git a/docs/html/globals_h.html b/docs/html/globals_h.html new file mode 100644 index 0000000..76a214e --- /dev/null +++ b/docs/html/globals_h.html @@ -0,0 +1,130 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- h -

+
+
+
+ + + + diff --git a/docs/html/globals_i.html b/docs/html/globals_i.html new file mode 100644 index 0000000..90dd2fd --- /dev/null +++ b/docs/html/globals_i.html @@ -0,0 +1,132 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- i -

+
+
+
+ + + + diff --git a/docs/html/globals_j.html b/docs/html/globals_j.html new file mode 100644 index 0000000..3d1d785 --- /dev/null +++ b/docs/html/globals_j.html @@ -0,0 +1,109 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- j -

+
+
+
+ + + + diff --git a/docs/html/globals_k.html b/docs/html/globals_k.html new file mode 100644 index 0000000..4a5bc12 --- /dev/null +++ b/docs/html/globals_k.html @@ -0,0 +1,107 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- k -

+
+
+
+ + + + diff --git a/docs/html/globals_l.html b/docs/html/globals_l.html new file mode 100644 index 0000000..d22c186 --- /dev/null +++ b/docs/html/globals_l.html @@ -0,0 +1,134 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- l -

+
+
+
+ + + + diff --git a/docs/html/globals_m.html b/docs/html/globals_m.html new file mode 100644 index 0000000..f6d6596 --- /dev/null +++ b/docs/html/globals_m.html @@ -0,0 +1,169 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- m -

+
+
+
+ + + + diff --git a/docs/html/globals_n.html b/docs/html/globals_n.html new file mode 100644 index 0000000..ef17e05 --- /dev/null +++ b/docs/html/globals_n.html @@ -0,0 +1,127 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- n -

+
+
+
+ + + + diff --git a/docs/html/globals_o.html b/docs/html/globals_o.html new file mode 100644 index 0000000..a0e7308 --- /dev/null +++ b/docs/html/globals_o.html @@ -0,0 +1,110 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- o -

+
+
+
+ + + + diff --git a/docs/html/globals_p.html b/docs/html/globals_p.html new file mode 100644 index 0000000..659445d --- /dev/null +++ b/docs/html/globals_p.html @@ -0,0 +1,155 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- p -

+
+
+
+ + + + diff --git a/docs/html/globals_q.html b/docs/html/globals_q.html new file mode 100644 index 0000000..a1c4715 --- /dev/null +++ b/docs/html/globals_q.html @@ -0,0 +1,121 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- q -

+
+
+
+ + + + diff --git a/docs/html/globals_r.html b/docs/html/globals_r.html new file mode 100644 index 0000000..61cffd2 --- /dev/null +++ b/docs/html/globals_r.html @@ -0,0 +1,152 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- r -

+
+
+
+ + + + diff --git a/docs/html/globals_s.html b/docs/html/globals_s.html new file mode 100644 index 0000000..302e566 --- /dev/null +++ b/docs/html/globals_s.html @@ -0,0 +1,220 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- s -

+
+
+
+ + + + diff --git a/docs/html/globals_t.html b/docs/html/globals_t.html new file mode 100644 index 0000000..1859581 --- /dev/null +++ b/docs/html/globals_t.html @@ -0,0 +1,138 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- t -

+
+
+
+ + + + diff --git a/docs/html/globals_type.html b/docs/html/globals_type.html new file mode 100644 index 0000000..b493809 --- /dev/null +++ b/docs/html/globals_type.html @@ -0,0 +1,178 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all typedefs with links to the files they belong to:
+ +

- a -

+ + +

- b -

+ + +

- c -

+ + +

- d -

+ + +

- g -

    +
  • GeometryBlockHeader : data.h
  • +
+ + +

- i -

+ + +

- m -

+ + +

- p -

+ + +

- s -

+ + +

- t -

+
+
+
+ + + + diff --git a/docs/html/globals_u.html b/docs/html/globals_u.html new file mode 100644 index 0000000..c56cb53 --- /dev/null +++ b/docs/html/globals_u.html @@ -0,0 +1,118 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- u -

+
+
+
+ + + + diff --git a/docs/html/globals_v.html b/docs/html/globals_v.html new file mode 100644 index 0000000..862e943 --- /dev/null +++ b/docs/html/globals_v.html @@ -0,0 +1,120 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- v -

+
+
+
+ + + + diff --git a/docs/html/globals_vars.html b/docs/html/globals_vars.html new file mode 100644 index 0000000..56b516e --- /dev/null +++ b/docs/html/globals_vars.html @@ -0,0 +1,107 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all variables with links to the files they belong to:
+
+
+
+ + + + diff --git a/docs/html/globals_w.html b/docs/html/globals_w.html new file mode 100644 index 0000000..eeaab6b --- /dev/null +++ b/docs/html/globals_w.html @@ -0,0 +1,133 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- w -

    +
  • Wafer : aaru.h
  • +
  • WOD : aaru.h
  • +
  • write_aaru_json_block() : close.c
  • +
  • write_cached_secondary_ddt() : close.c
  • +
  • write_callback() : flac.c
  • +
  • write_checksum_block() : close.c
  • +
  • write_cicm_block() : close.c
  • +
  • write_dumphw_block() : close.c
  • +
  • write_dvd_long_sector_blocks() : close.c
  • +
  • write_dvd_title_key_decrypted_block() : close.c
  • +
  • write_geometry_block() : close.c
  • +
  • write_index_block() : close.c
  • +
  • write_media_tags() : close.c
  • +
  • write_metadata_block() : close.c
  • +
  • write_mode2_subheaders_block() : close.c
  • +
  • write_primary_ddt() : close.c
  • +
  • write_sector_prefix() : close.c
  • +
  • write_sector_prefix_ddt() : close.c
  • +
  • write_sector_subchannel() : close.c
  • +
  • write_sector_suffix() : close.c
  • +
  • write_sector_suffix_ddt() : close.c
  • +
  • write_single_level_ddt() : close.c
  • +
  • write_tape_ddt() : close.c
  • +
  • write_tape_file_block() : close.c
  • +
  • write_tape_partition_block() : close.c
  • +
  • write_tracks_block() : close.c
  • +
  • WUOD : aaru.h
  • +
+
+
+
+ + + + diff --git a/docs/html/globals_x.html b/docs/html/globals_x.html new file mode 100644 index 0000000..63a8150 --- /dev/null +++ b/docs/html/globals_x.html @@ -0,0 +1,121 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- x -

+
+
+
+ + + + diff --git a/docs/html/globals_z.html b/docs/html/globals_z.html new file mode 100644 index 0000000..94dcfd7 --- /dev/null +++ b/docs/html/globals_z.html @@ -0,0 +1,111 @@ + + + + + + + +libaaruformat: Globals + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Here is a list of all functions, variables, defines, enums, and typedefs with links to the files they belong to:
+ +

- z -

+
+
+
+ + + + diff --git a/docs/html/group__MediaTags.html b/docs/html/group__MediaTags.html new file mode 100644 index 0000000..5be56f0 --- /dev/null +++ b/docs/html/group__MediaTags.html @@ -0,0 +1,384 @@ + + + + + + + +libaaruformat: Per-media metadata tag types + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Per-media metadata tag types
+
+
+ +

High-level descriptors captured for the whole medium (lead-in/out, inquiry data, identification registers). +More...

+ + + +

+Enumerations

enum  MediaTagType {
+  CD_TOC = 0 +, CD_SessionInfo = 1 +, CD_FullTOC = 2 +, CD_PMA = 3 +,
+  CD_ATIP = 4 +, CD_TEXT = 5 +, CD_MCN = 6 +, DVD_PFI = 7 +,
+  DVD_CMI = 8 +, DVD_DiscKey = 9 +, DVD_BCA = 10 +, DVD_DMI = 11 +,
+  DVD_MediaIdentifier = 12 +, DVD_MKB = 13 +, DVDRAM_DDS = 14 +, DVDRAM_MediumStatus = 15 +,
+  DVDRAM_SpareArea = 16 +, DVDR_RMD = 17 +, DVDR_PreRecordedInfo = 18 +, DVDR_MediaIdentifier = 19 +,
+  DVDR_PFI = 20 +, DVD_ADIP = 21 +, HDDVD_CPI = 22 +, HDDVD_MediumStatus = 23 +,
+  DVDDL_LayerCapacity = 24 +, DVDDL_MiddleZoneAddress = 25 +, DVDDL_JumpIntervalSize = 26 +, DVDDL_ManualLayerJumpLBA = 27 +,
+  BD_DI = 28 +, BD_BCA = 29 +, BD_DDS = 30 +, BD_CartridgeStatus = 31 +,
+  BD_SpareArea = 32 +, AACS_VolumeIdentifier = 33 +, AACS_SerialNumber = 34 +, AACS_MediaIdentifier = 35 +,
+  AACS_MKB = 36 +, AACS_DataKeys = 37 +, AACS_LBAExtents = 38 +, AACS_CPRM_MKB = 39 +,
+  Hybrid_RecognizedLayers = 40 +, MMC_WriteProtection = 41 +, MMC_DiscInformation = 42 +, MMC_TrackResourcesInformation = 43 +,
+  MMC_POWResourcesInformation = 44 +, SCSI_INQUIRY = 45 +, SCSI_MODEPAGE_2A = 46 +, ATA_IDENTIFY = 47 +,
+  ATAPI_IDENTIFY = 48 +, PCMCIA_CIS = 49 +, SD_CID = 50 +, SD_CSD = 51 +,
+  SD_SCR = 52 +, SD_OCR = 53 +, MMC_CID = 54 +, MMC_CSD = 55 +,
+  MMC_OCR = 56 +, MMC_ExtendedCSD = 57 +, Xbox_SecuritySector = 58 +, Floppy_LeadOut = 59 +,
+  DCB = 60 +, CD_FirstTrackPregap = 61 +, CD_LeadOut = 62 +, SCSI_MODESENSE_6 = 63 +,
+  SCSI_MODESENSE_10 = 64 +, USB_Descriptors = 65 +, Xbox_DMI = 66 +, Xbox_PFI = 67 +,
+  CD_LeadIn = 68 +, MiniDiscType = 69 +, MiniDiscD5 = 70 +, MiniDiscUTOC = 71 +,
+  MiniDiscDTOC = 72 +, DVD_DiscKey_Decrypted = 73 +
+ }
+

Detailed Description

+

High-level descriptors captured for the whole medium (lead-in/out, inquiry data, identification registers).

+

Media tags are coarse-grained data blocks not tied to individual sectors. Absence indicates either unreadability (hardware limitation / error) or irrelevance for the specific media. Consumers should treat absence as unknown, not failure. Enum values are stable and serialized; append only.

+

Enumeration Type Documentation

+ +

◆ MediaTagType

+ +
+
+ + + + +
enum MediaTagType
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Enumerator
CD_TOC 

Standard CD Table Of Contents (lead-in, first session)

+
CD_SessionInfo 

Per-session summary (start/end addresses, track count)

+
CD_FullTOC 

Complete multi-session TOC including hidden tracks.

+
CD_PMA 

Program Memory Area (temporary track info before finalization)

+
CD_ATIP 

Absolute Time In Pregroove (writable media timing & power metadata)

+
CD_TEXT 

CD-Text blocks (titles, performers, etc.)

+
CD_MCN 

Media Catalogue Number (EAN/UPC style identifier)

+
DVD_PFI 

Physical Format Information (layer geometry & book type)

+
DVD_CMI 

Copyright Management Information (CSS/CPRM flags)

+
DVD_DiscKey 

Encrypted disc key block (CSS)

+
DVD_BCA 

Burst Cutting Area (etched manufacturer / AACS info)

+
DVD_DMI 

Disc Manufacturer Information (lead-in descriptor)

+
DVD_MediaIdentifier 

Writable media dye / manufacturer ID.

+
DVD_MKB 

Media Key Block (AACS/DVD)

+
DVDRAM_DDS 

Defect Data Structure (DVD-RAM mapping)

+
DVDRAM_MediumStatus 

Medium Status (allocated spare info)

+
DVDRAM_SpareArea 

Spare area descriptors.

+
DVDR_RMD 

Recorded Media Data (RMD) last border-out.

+
DVDR_PreRecordedInfo 

Pre-recorded info area (lead-in)

+
DVDR_MediaIdentifier 

DVD-R/-RW writable media identifier.

+
DVDR_PFI 

DVD-R physical format (layer data)

+
DVD_ADIP 

Address In Pregroove (DVD+ / wobble timing)

+
HDDVD_CPI 

Content Protection Info (HD DVD)

+
HDDVD_MediumStatus 

HD DVD Medium status (spares/defects)

+
DVDDL_LayerCapacity 

Dual layer capacity & break info.

+
DVDDL_MiddleZoneAddress 

Middle zone start LBA.

+
DVDDL_JumpIntervalSize 

Jump interval size (opposite track path)

+
DVDDL_ManualLayerJumpLBA 

Manual layer jump LBA (OTP)

+
BD_DI 

Disc Information (BD)

+
BD_BCA 

Blu-ray Burst Cutting Area.

+
BD_DDS 

Disc Definition Structure (recordable)

+
BD_CartridgeStatus 

Cartridge presence / write protect (BD-RE/BD-R in caddy)

+
BD_SpareArea 

BD spare area allocation map.

+
AACS_VolumeIdentifier 

AACS Volume Identifier.

+
AACS_SerialNumber 

Pre-recorded media serial number (AACS)

+
AACS_MediaIdentifier 

AACS Media Identifier (unique per disc)

+
AACS_MKB 

AACS Media Key Block.

+
AACS_DataKeys 

Extracted AACS title/volume keys (when decrypted)

+
AACS_LBAExtents 

LBA extents requiring bus encryption.

+
AACS_CPRM_MKB 

CPRM Media Key Block.

+
Hybrid_RecognizedLayers 

Hybrid disc recognized layer combinations (e.g. CD/DVD/BD)

+
MMC_WriteProtection 

Write protection status (MMC GET CONFIG)

+
MMC_DiscInformation 

Disc Information (recordable status, erasable, last session)

+
MMC_TrackResourcesInformation 

Track Resources (allocated/open track data)

+
MMC_POWResourcesInformation 

Pseudo OverWrite resources (BD-R POW)

+
SCSI_INQUIRY 

SCSI INQUIRY standard data (SPC-*)

+
SCSI_MODEPAGE_2A 

SCSI Mode Page 2Ah (CD/DVD capabilities)

+
ATA_IDENTIFY 

ATA IDENTIFY DEVICE (512 bytes)

+
ATAPI_IDENTIFY 

ATA PACKET IDENTIFY DEVICE.

+
PCMCIA_CIS 

PCMCIA/CardBus CIS tuple chain.

+
SD_CID 

SecureDigital Card ID register.

+
SD_CSD 

SecureDigital Card Specific Data.

+
SD_SCR 

SecureDigital Configuration Register.

+
SD_OCR 

SecureDigital Operation Conditions (voltage)

+
MMC_CID 

MMC Card ID.

+
MMC_CSD 

MMC Card Specific Data.

+
MMC_OCR 

MMC Operation Conditions.

+
MMC_ExtendedCSD 

MMC Extended CSD (512 bytes)

+
Xbox_SecuritySector 

Xbox/Xbox 360 Security Sector (SS.bin)

+
Floppy_LeadOut 

Manufacturer / duplication cylinder (floppy special data)

+
DCB 

DVD Disc Control Blocks.

+
CD_FirstTrackPregap 

First track pregap (index 0)

+
CD_LeadOut 

Lead-out area contents.

+
SCSI_MODESENSE_6 

Raw MODE SENSE (6) data.

+
SCSI_MODESENSE_10 

Raw MODE SENSE (10) data.

+
USB_Descriptors 

Concatenated USB descriptors (device/config/interface)

+
Xbox_DMI 

Xbox Disc Manufacturing Info (DMI)

+
Xbox_PFI 

Xbox Physical Format Information (PFI)

+
CD_LeadIn 

Raw lead-in (TOC frames)

+
MiniDiscType 

8 bytes response that seems to define type of MiniDisc

+
MiniDiscD5 

4 bytes response to vendor command D5h

+
MiniDiscUTOC 

User TOC, contains fragments, track names, and can be from 1 to 3 sectors of 2336 bytes.

+
MiniDiscDTOC 

Not entirely clear kind of TOC that only appears on MD-DATA discs.

+
DVD_DiscKey_Decrypted 

Decrypted DVD disc key.

+
+ +

Definition at line 932 of file aaru.h.

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/group__MediaTags.js b/docs/html/group__MediaTags.js new file mode 100644 index 0000000..fcdc7c7 --- /dev/null +++ b/docs/html/group__MediaTags.js @@ -0,0 +1,79 @@ +var group__MediaTags = +[ + [ "MediaTagType", "group__MediaTags.html#gabdd09c559df8f34ae68fcb2ff1892ebe", [ + [ "CD_TOC", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea19936e1f9f92973f04c4206aabd63fc0", null ], + [ "CD_SessionInfo", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea3a6c6117044b4ff4e82eaca80aeffa5d", null ], + [ "CD_FullTOC", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeac41725b478131a32c6732bdc0716fc37", null ], + [ "CD_PMA", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeae8ebe2642dea52941221494e628dde43", null ], + [ "CD_ATIP", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea53d8953b8b5b6a61eba7e702521e531b", null ], + [ "CD_TEXT", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea6dea4e03372f3a5c04ee2a749880658e", null ], + [ "CD_MCN", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea6e31c5432c226da563183be0df9b535d", null ], + [ "DVD_PFI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea3c321569dc733d489eef07f5dc24a77a", null ], + [ "DVD_CMI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea23e0bce46fca436974a6fcbeb7e28366", null ], + [ "DVD_DiscKey", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea5d578c2ca1c95f0d229ddd9c2049400d", null ], + [ "DVD_BCA", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaae59a529c9f6e6e9afce9d4182f36788", null ], + [ "DVD_DMI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaadc5743c51f052e6e5a0b5449fdb4c12", null ], + [ "DVD_MediaIdentifier", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea6b893be6d1d457d464dd30d1e4126ae7", null ], + [ "DVD_MKB", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaafbeb4b604c8c02ad7205917948ef8ee", null ], + [ "DVDRAM_DDS", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea51bf18728367fbb92aebcfc877b5073f", null ], + [ "DVDRAM_MediumStatus", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaea5a748ee575bccffbe6acb00f9344f3", null ], + [ "DVDRAM_SpareArea", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea22d63ec3e13a2124275d8e5a17495a68", null ], + [ "DVDR_RMD", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaa6b1df1daac25656b57d3884cc76cfce", null ], + [ "DVDR_PreRecordedInfo", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea4eea08851cae61e2e5a151679c24d8fa", null ], + [ "DVDR_MediaIdentifier", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea2b455bad21ec128c687a04b7727f7148", null ], + [ "DVDR_PFI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea6ad222e2ed126add477aff995adc7d6e", null ], + [ "DVD_ADIP", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeac7c0f66e7a8d749c648b00af8863b67e", null ], + [ "HDDVD_CPI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeae7b93271a5caf33ce79503a1873e460e", null ], + [ "HDDVD_MediumStatus", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea75c19a67aee7ea51d0456f7212194918", null ], + [ "DVDDL_LayerCapacity", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea98e0119351bfcc3a96da5cf3d2e29ba3", null ], + [ "DVDDL_MiddleZoneAddress", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea853784fa692db695ec8f108a8cdd6ecd", null ], + [ "DVDDL_JumpIntervalSize", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea084726467616b3569039fdaa83a2531d", null ], + [ "DVDDL_ManualLayerJumpLBA", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea2163f38afb7b3c035610257ef491e0bf", null ], + [ "BD_DI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaffb17871a6a508af15eacc2f96349f61", null ], + [ "BD_BCA", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea9aae209cf8153d11507c506369f7494d", null ], + [ "BD_DDS", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea008f96361a248e4d4425402672ee1955", null ], + [ "BD_CartridgeStatus", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea482effdb660ead9def2fd03e60ed5644", null ], + [ "BD_SpareArea", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea1266c42d020713df4fa1a550fd72c5ae", null ], + [ "AACS_VolumeIdentifier", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea996c276a1ef9bd0450765cbf7d65c3aa", null ], + [ "AACS_SerialNumber", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea4d71cd8420cfe39624125c89f534c763", null ], + [ "AACS_MediaIdentifier", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea90c88c940ebc0178839d7224e723f5c1", null ], + [ "AACS_MKB", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea582480c2ac97445bccf117bf57c0d5c5", null ], + [ "AACS_DataKeys", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea53360a1de5bb9ed6ad0d9a2e1fa5987c", null ], + [ "AACS_LBAExtents", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaa7492b2607662192d7ab324e07ebe931", null ], + [ "AACS_CPRM_MKB", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaa63c093172a0a107e6004db645b85d4b", null ], + [ "Hybrid_RecognizedLayers", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea9dd5869095cb1fc785fd619da232a8cb", null ], + [ "MMC_WriteProtection", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeafc1040d1dec1cbae6d7b5b5faa91d672", null ], + [ "MMC_DiscInformation", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea5efb5d5b4be2b779de7c851aec3073e2", null ], + [ "MMC_TrackResourcesInformation", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea70fe49a37b43f7c59555107774b601bc", null ], + [ "MMC_POWResourcesInformation", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea8e1457b78bfece7ba405fcc8780fabb7", null ], + [ "SCSI_INQUIRY", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeabcbe501e664018ecf867f5b618e8277e", null ], + [ "SCSI_MODEPAGE_2A", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea000b6f0b3062df2a587f1490b58aaa20", null ], + [ "ATA_IDENTIFY", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea67902436f41ef62eb2404a0642e4ba26", null ], + [ "ATAPI_IDENTIFY", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea3a158af5d463f6535a84a4bb9d993dd4", null ], + [ "PCMCIA_CIS", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaea8ebc0474ea18414f182146c7f38db8", null ], + [ "SD_CID", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaf44743291e02e818e016f273ca1a121e", null ], + [ "SD_CSD", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeabc2e7406d62921895e3dcafc488eee96", null ], + [ "SD_SCR", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea5075bf29e39d7806cd9ecb5be6297619", null ], + [ "SD_OCR", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeae8db5476a87a3257c7e2705af1191ccb", null ], + [ "MMC_CID", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea0308fc707575b084ba1d0c6d16dc4809", null ], + [ "MMC_CSD", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea0a8c84bb9e459ec4e2270df915333f20", null ], + [ "MMC_OCR", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeace4662d46311a22be1eeb992b1037d5f", null ], + [ "MMC_ExtendedCSD", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea6d0f27fc4872800de6463d373fbda75b", null ], + [ "Xbox_SecuritySector", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea732b4820de4ba58e20953581fc1b0414", null ], + [ "Floppy_LeadOut", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea8588ae2ee995dfda8014f67a8072c59a", null ], + [ "DCB", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea7ce91d5bad8ca3fa18e2296b28cd644f", null ], + [ "CD_FirstTrackPregap", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaf55cf5503503f10b3e34eb16fa28d712", null ], + [ "CD_LeadOut", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea6bc1632b0f411e02fee79e4109f76146", null ], + [ "SCSI_MODESENSE_6", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea35dde3eb642e833bc907172c12cf72ca", null ], + [ "SCSI_MODESENSE_10", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea2ea4f436ea5c928fad353248467584db", null ], + [ "USB_Descriptors", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea32d2347b98e6b47e29cb1da692c6ad47", null ], + [ "Xbox_DMI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea4d51ede590eaa583c19b4d12ab7163b1", null ], + [ "Xbox_PFI", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebeaeb88743e8c01a171df432876e5dd1a2f", null ], + [ "CD_LeadIn", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea3d8ba887e5b5cbd30a150980bcb6f48b", null ], + [ "MiniDiscType", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea668f4d55999da66ca23e8d943bbdf446", null ], + [ "MiniDiscD5", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea07d05a8c30e7516139ae761ac9eaefc1", null ], + [ "MiniDiscUTOC", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea7d3b34c3cd93d13905a87b466859b2a7", null ], + [ "MiniDiscDTOC", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea05624139ec685ba219acbc9ea0e49100", null ], + [ "DVD_DiscKey_Decrypted", "group__MediaTags.html#ggabdd09c559df8f34ae68fcb2ff1892ebea109296d460fd5fc05446914dad9a0834", null ] + ] ] +]; \ No newline at end of file diff --git a/docs/html/group__MediaTypes.html b/docs/html/group__MediaTypes.html new file mode 100644 index 0000000..ee84876 --- /dev/null +++ b/docs/html/group__MediaTypes.html @@ -0,0 +1,1542 @@ + + + + + + + +libaaruformat: Media type classification + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Media type classification
+
+
+ +

Comprehensive list of supported physical / logical media. +More...

+ + + + +

+Data Structures

struct  ImageInfo
 High-level summary of an opened Aaru image containing metadata and media characteristics. More...
+ + + +

+Enumerations

enum  MediaType {
+  Unknown = 0 +, UnknownMO = 1 +, GENERIC_HDD = 2 +, Microdrive = 3 +,
+  Zone_HDD = 4 +, FlashDrive = 5 +, CD = 10 +, CDDA = 11 +,
+  CDG = 12 +, CDEG = 13 +, CDI = 14 +, CDROM = 15 +,
+  CDROMXA = 16 +, CDPLUS = 17 +, CDMO = 18 +, CDR = 19 +,
+  CDRW = 20 +, CDMRW = 21 +, VCD = 22 +, SVCD = 23 +,
+  PCD = 24 +, SACD = 25 +, DDCD = 26 +, DDCDR = 27 +,
+  DDCDRW = 28 +, DTSCD = 29 +, CDMIDI = 30 +, CDV = 31 +,
+  PD650 = 32 +, PD650_WORM = 33 +, CDIREADY = 34 +, FMTOWNS = 35 +,
+  DVDROM = 40 +, DVDR = 41 +, DVDRW = 42 +, DVDPR = 43 +,
+  DVDPRW = 44 +, DVDPRWDL = 45 +, DVDRDL = 46 +, DVDPRDL = 47 +,
+  DVDRAM = 48 +, DVDRWDL = 49 +, DVDDownload = 50 +, HDDVDROM = 51 +,
+  HDDVDRAM = 52 +, HDDVDR = 53 +, HDDVDRW = 54 +, HDDVDRDL = 55 +,
+  HDDVDRWDL = 56 +, BDROM = 60 +, BDR = 61 +, BDRE = 62 +,
+  BDRXL = 63 +, BDREXL = 64 +, EVD = 70 +, FVD = 71 +,
+  HVD = 72 +, CBHD = 73 +, HDVMD = 74 +, VCDHD = 75 +,
+  SVOD = 76 +, FDDVD = 77 +, LD = 80 +, LDROM = 81 +,
+  LDROM2 = 82 +, LVROM = 83 +, MegaLD = 84 +, HiMD = 90 +,
+  MD = 91 +, MDData = 92 +, MDData2 = 93 +, UDO = 100 +,
+  UDO2 +, UDO2_WORM +, PlayStationMemoryCard = 110 +, PlayStationMemoryCard2 = 111 +,
+  PS1CD = 112 +, PS2CD = 113 +, PS2DVD = 114 +, PS3DVD = 115 +,
+  PS3BD = 116 +, PS4BD = 117 +, UMD = 118 +, PlayStationVitaGameCard = 119 +,
+  XGD = 130 +, XGD2 = 131 +, XGD3 = 132 +, XGD4 = 133 +,
+  MEGACD = 150 +, SATURNCD = 151 +, GDROM = 152 +, GDR = 153 +,
+  SegaCard = 154 +, MilCD = 155 +, HuCard = 170 +, SuperCDROM2 = 171 +,
+  JaguarCD = 172 +, ThreeDO = 173 +, PCFX = 174 +, NeoGeoCD = 175 +,
+  CDTV = 176 +, CD32 = 177 +, Nuon = 178 +, Playdia = 179 +,
+  Apple32SS = 180 +, Apple32DS = 181 +, Apple33SS = 182 +, Apple33DS = 183 +,
+  AppleSonySS = 184 +, AppleSonyDS = 185 +, AppleFileWare = 186 +, DOS_525_SS_DD_8 = 190 +,
+  DOS_525_SS_DD_9 = 191 +, DOS_525_DS_DD_8 = 192 +, DOS_525_DS_DD_9 = 193 +, DOS_525_HD = 194 +,
+  DOS_35_SS_DD_8 = 195 +, DOS_35_SS_DD_9 = 196 +, DOS_35_DS_DD_8 = 197 +, DOS_35_DS_DD_9 = 198 +,
+  DOS_35_HD = 199 +, DOS_35_ED = 200 +, DMF = 201 +, DMF_82 = 202 +,
+  XDF_525 = 203 +, XDF_35 = 204 +, IBM23FD = 210 +, IBM33FD_128 = 211 +,
+  IBM33FD_256 = 212 +, IBM33FD_512 = 213 +, IBM43FD_128 = 214 +, IBM43FD_256 = 215 +,
+  IBM53FD_256 = 216 +, IBM53FD_512 = 217 +, IBM53FD_1024 = 218 +, RX01 = 220 +,
+  RX02 = 221 +, RX03 = 222 +, RX50 = 223 +, ACORN_525_SS_SD_40 = 230 +,
+  ACORN_525_SS_SD_80 = 231 +, ACORN_525_SS_DD_40 = 232 +, ACORN_525_SS_DD_80 = 233 +, ACORN_525_DS_DD = 234 +,
+  ACORN_35_DS_DD = 235 +, ACORN_35_DS_HD = 236 +, ATARI_525_SD = 240 +, ATARI_525_ED = 241 +,
+  ATARI_525_DD = 242 +, ATARI_35_SS_DD = 243 +, ATARI_35_DS_DD = 244 +, ATARI_35_SS_DD_11 = 245 +,
+  ATARI_35_DS_DD_11 = 246 +, CBM_35_DD = 250 +, CBM_AMIGA_35_DD = 251 +, CBM_AMIGA_35_HD = 252 +,
+  CBM_1540 = 253 +, CBM_1540_Ext = 254 +, CBM_1571 = 255 +, NEC_8_SD = 260 +,
+  NEC_8_DD = 261 +, NEC_525_SS = 262 +, NEC_525_DS = 263 +, NEC_525_HD = 264 +,
+  NEC_35_HD_8 = 265 +, NEC_35_HD_15 = 266 +, NEC_35_TD = 267 +, SHARP_525 = NEC_525_HD +,
+  SHARP_525_9 = 268 +, SHARP_35 = NEC_35_HD_8 +, SHARP_35_9 = 269 +, ECMA_99_8 = 270 +,
+  ECMA_99_15 = 271 +, ECMA_99_26 = 272 +, ECMA_100 = DOS_35_DS_DD_9 +, ECMA_125 = DOS_35_HD +,
+  ECMA_147 = DOS_35_ED +, ECMA_54 = 273 +, ECMA_59 = 274 +, ECMA_66 +,
+  ECMA_69_8 = 276 +, ECMA_69_15 = 277 +, ECMA_69_26 = 278 +, ECMA_70 = 279 +,
+  ECMA_78 = 280 +, ECMA_78_2 = 281 +, FDFORMAT_525_DD = 290 +, FDFORMAT_525_HD = 291 +,
+  FDFORMAT_35_DD = 292 +, FDFORMAT_35_HD = 293 +, Apricot_35 = 309 +, ADR2120 = 310 +,
+  ADR260 = 311 +, ADR30 = 312 +, ADR50 = 313 +, AIT1 = 320 +,
+  AIT1Turbo = 321 +, AIT2 = 322 +, AIT2Turbo = 323 +, AIT3 = 324 +,
+  AIT3Ex = 325 +, AIT3Turbo = 326 +, AIT4 = 327 +, AIT5 = 328 +,
+  AITETurbo = 329 +, SAIT1 = 330 +, SAIT2 = 331 +, Bernoulli = 340 +,
+  Bernoulli2 = 341 +, Ditto = 342 +, DittoMax = 343 +, Jaz = 344 +,
+  Jaz2 = 345 +, PocketZip = 346 +, REV120 = 347 +, REV35 = 348 +,
+  REV70 = 349 +, ZIP100 = 350 +, ZIP250 = 351 +, ZIP750 = 352 +,
+  CompactCassette = 360 +, Data8 = 361 +, MiniDV = 362 +, Dcas25 = 363 +,
+  Dcas85 = 364 +, Dcas103 = 365 +, CFast = 370 +, CompactFlash = 371 +,
+  CompactFlashType2 = 372 +, DigitalAudioTape = 380 +, DAT160 = 381 +, DAT320 = 382 +,
+  DAT72 = 383 +, DDS1 = 384 +, DDS2 = 385 +, DDS3 = 386 +,
+  DDS4 = 387 +, CompactTapeI = 390 +, CompactTapeII = 391 +, DECtapeII = 392 +,
+  DLTtapeIII = 393 +, DLTtapeIIIxt = 394 +, DLTtapeIV = 395 +, DLTtapeS4 = 396 +,
+  SDLT1 = 397 +, SDLT2 = 398 +, VStapeI = 399 +, Exatape15m = 400 +,
+  Exatape22m = 401 +, Exatape22mAME = 402 +, Exatape28m = 403 +, Exatape40m = 404 +,
+  Exatape45m = 405 +, Exatape54m = 406 +, Exatape75m = 407 +, Exatape76m = 408 +,
+  Exatape80m = 409 +, Exatape106m = 410 +, Exatape160mXL = 411 +, Exatape112m = 412 +,
+  Exatape125m = 413 +, Exatape150m = 414 +, Exatape170m = 415 +, Exatape225m = 416 +,
+  ExpressCard34 = 420 +, ExpressCard54 = 421 +, PCCardTypeI = 422 +, PCCardTypeII = 423 +,
+  PCCardTypeIII = 424 +, PCCardTypeIV = 425 +, EZ135 = 430 +, EZ230 = 431 +,
+  Quest = 432 +, SparQ = 433 +, SQ100 = 434 +, SQ200 = 435 +,
+  SQ300 = 436 +, SQ310 = 437 +, SQ327 = 438 +, SQ400 = 439 +,
+  SQ800 = 440 +, SQ1500 = 441 +, SQ2000 = 442 +, SyJet = 443 +,
+  FamicomGamePak = 450 +, GameBoyAdvanceGamePak = 451 +, GameBoyGamePak = 452 +, GOD = 453 +,
+  N64DD = 454 +, N64GamePak = 455 +, NESGamePak = 456 +, Nintendo3DSGameCard = 457 +,
+  NintendoDiskCard = 458 +, NintendoDSGameCard = 459 +, NintendoDSiGameCard = 460 +, SNESGamePak = 461 +,
+  SNESGamePakUS = 462 +, WOD = 463 +, WUOD = 464 +, SwitchGameCard = 465 +,
+  IBM3470 = 470 +, IBM3480 = 471 +, IBM3490 = 472 +, IBM3490E = 473 +,
+  IBM3592 = 474 +, LTO = 480 +, LTO2 = 481 +, LTO3 = 482 +,
+  LTO3WORM = 483 +, LTO4 = 484 +, LTO4WORM = 485 +, LTO5 = 486 +,
+  LTO5WORM = 487 +, LTO6 = 488 +, LTO6WORM = 489 +, LTO7 = 490 +,
+  LTO7WORM = 491 +, MemoryStick = 510 +, MemoryStickDuo = 511 +, MemoryStickMicro = 512 +,
+  MemoryStickPro = 513 +, MemoryStickProDuo = 514 +, microSD = 520 +, miniSD = 521 +,
+  SecureDigital = 522 +, MMC = 530 +, MMCmicro = 531 +, RSMMC = 532 +,
+  MMCplus = 533 +, MMCmobile = 534 +, MLR1 = 540 +, MLR1SL = 541 +,
+  MLR3 = 542 +, SLR1 = 543 +, SLR2 = 544 +, SLR3 = 545 +,
+  SLR32 = 546 +, SLR32SL = 547 +, SLR4 = 548 +, SLR5 = 549 +,
+  SLR5SL = 550 +, SLR6 = 551 +, SLRtape7 = 552 +, SLRtape7SL = 553 +,
+  SLRtape24 = 554 +, SLRtape24SL = 555 +, SLRtape40 = 556 +, SLRtape50 = 557 +,
+  SLRtape60 = 558 +, SLRtape75 = 559 +, SLRtape100 = 560 +, SLRtape140 = 561 +,
+  QIC11 = 570 +, QIC120 = 571 +, QIC1350 = 572 +, QIC150 = 573 +,
+  QIC24 = 574 +, QIC3010 = 575 +, QIC3020 = 576 +, QIC3080 = 577 +,
+  QIC3095 = 578 +, QIC320 = 579 +, QIC40 = 580 +, QIC525 = 581 +,
+  QIC80 = 582 +, STK4480 = 590 +, STK4490 = 591 +, STK9490 = 592 +,
+  T9840A = 593 +, T9840B = 594 +, T9840C = 595 +, T9840D = 596 +,
+  T9940A = 597 +, T9940B = 598 +, T10000A = 599 +, T10000B = 600 +,
+  T10000C = 601 +, T10000D = 602 +, Travan = 610 +, Travan1Ex = 611 +,
+  Travan3 = 612 +, Travan3Ex = 613 +, Travan4 = 614 +, Travan5 = 615 +,
+  Travan7 = 616 +, VXA1 = 620 +, VXA2 = 621 +, VXA3 = 622 +,
+  ECMA_153 = 630 +, ECMA_153_512 = 631 +, ECMA_154 = 632 +, ECMA_183_512 = 633 +,
+  ECMA_183 = 634 +, ECMA_184_512 = 635 +, ECMA_184 = 636 +, ECMA_189 = 637 +,
+  ECMA_190 = 638 +, ECMA_195 = 639 +, ECMA_195_512 = 640 +, ECMA_201 = 641 +,
+  ECMA_201_ROM = 642 +, ECMA_223 = 643 +, ECMA_223_512 = 644 +, ECMA_238 = 645 +,
+  ECMA_239 = 646 +, ECMA_260 = 647 +, ECMA_260_Double = 648 +, ECMA_280 = 649 +,
+  ECMA_317 = 650 +, ECMA_322 = 651 +, ECMA_322_2k = 652 +, GigaMo = 653 +,
+  GigaMo2 = 654 +, CompactFloppy = 660 +, DemiDiskette = 661 +, Floptical = 662 +,
+  HiFD = 663 +, QuickDisk = 664 +, UHD144 = 665 +, VideoFloppy = 666 +,
+  Wafer = 667 +, ZXMicrodrive = 668 +, BeeCard = 670 +, Borsu = 671 +,
+  DataStore = 672 +, DIR = 673 +, DST = 674 +, DTF = 675 +,
+  DTF2 = 676 +, Flextra3020 = 677 +, Flextra3225 = 678 +, HiTC1 = 679 +,
+  HiTC2 = 680 +, LT1 = 681 +, MiniCard = 872 +, Orb = 683 +,
+  Orb5 = 684 +, SmartMedia = 685 +, xD = 686 +, XQD = 687 +,
+  DataPlay = 688 +, AppleProfile = 690 +, AppleWidget = 691 +, AppleHD20 = 692 +,
+  PriamDataTower = 693 +, Pippin = 694 +, RA60 = 700 +, RA80 = 701 +,
+  RA81 = 702 +, RC25 = 703 +, RD31 = 704 +, RD32 = 705 +,
+  RD51 = 706 +, RD52 = 707 +, RD53 = 708 +, RD54 = 709 +,
+  RK06 = 710 +, RK06_18 = 711 +, RK07 = 712 +, RK07_18 = 713 +,
+  RM02 = 714 +, RM03 = 715 +, RM05 = 716 +, RP02 = 717 +,
+  RP02_18 = 718 +, RP03 = 719 +, RP03_18 = 720 +, RP04 = 721 +,
+  RP04_18 = 722 +, RP05 = 723 +, RP05_18 = 724 +, RP06 = 725 +,
+  RP06_18 = 726 +, LS120 = 730 +, LS240 = 731 +, FD32MB = 732 +,
+  RDX = 733 +, RDX320 = 734 +, VideoNow = 740 +, VideoNowColor = 741 +,
+  VideoNowXp = 742 +
+ }
 Enumerates every recognized media / cartridge / optical / tape / card / disk format. More...
+

Detailed Description

+

Comprehensive list of supported physical / logical media.

+

Grouped by numeric ranges in the enum.

+

Enumeration Type Documentation

+ +

◆ MediaType

+ +
+
+ + + + +
enum MediaType
+
+ +

Enumerates every recognized media / cartridge / optical / tape / card / disk format.

+

The numeric values are ABI- and file-format-stable. They are stored verbatim in serialized Aaru images and MUST NOT be changed. Only append new identifiers. When adding new values document them clearly.

+

Typical usage patterns:

    +
  • Switch over a MediaType to choose decoding / geometry heuristics.
  • +
  • Persist the numeric value in sidecar metadata (never stringify and parse unless necessary).
  • +
  • Provide user-facing localization by mapping the enum to translated labels externally.
  • +
+

Ranges (do not reorder existing values):

    +
  • 0–9: Generic / unknown basic categories.
  • +
  • 10–39: Compact Disc (CD) family (Red/Yellow/Green/Orange Books & variants).
  • +
  • 40–50: DVD family.
  • +
  • 51–59: HD-DVD family.
  • +
  • 60–69: Blu-ray family.
  • +
  • 70–79: Rare / niche optical formats.
  • +
  • 80–89: LaserDisc and derivatives.
  • +
  • 90–99: MiniDisc related.
  • +
  • 100–109: Plasmon UDO.
  • +
  • 110–169: Console / game optical & cartridge media (Sony / Sega / others).
  • +
  • 170–229: Additional console & early optical / cartridge variants.
  • +
  • 180–289: Floppy standards (Apple / IBM / NEC / ECMA / vendor-specific).
  • +
  • 290–309: Non-standard / extended PC floppy formats.
  • +
  • 310–359: Tape & removable disk (OnStream, AIT, Iomega, etc.).
  • +
  • 360–399: Audio/video and DEC / Exabyte families.
  • +
  • 400–699: Removable cards (PCMCIA, MemoryStick, SD, MMC), additional tape/storage families.
  • +
  • 700–739: DEC hard disks & Imation removable media.
  • +
  • 740–749: Niche video disc formats (VideoNow, etc.).
  • +
  • 750+: Extended / rare or future additions.
  • +
+

Invariants / recommendations:

    +
  • Treat Unknown (0) as a safe default; do not assume geometry.
  • +
  • Where possible, prefer feature probing (e.g. presence of TOC) instead of relying solely on the enum.
  • +
  • New client code should always have a default clause in switch statements to remain forward compatible.
  • +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Enumerator
Unknown 

Unknown disk type.

+
UnknownMO 

Unknown magneto-optical.

+
GENERIC_HDD 

Generic hard disk.

+
Microdrive 

Microdrive type hard disk.

+
Zone_HDD 

Zoned hard disk.

+
FlashDrive 

USB flash drives.

+
CD 

Any unknown or standard violating CD.

+
CDDA 

CD Digital Audio (Red Book)

+
CDG 

CD+G (Red Book)

+
CDEG 

CD+EG (Red Book)

+
CDI 

CD-i (Green Book)

+
CDROM 

CD-ROM (Yellow Book)

+
CDROMXA 

CD-ROM XA (Yellow Book)

+
CDPLUS 

CD+ (Blue Book)

+
CDMO 

CD-MO (Orange Book)

+
CDR 

CD-Recordable (Orange Book)

+
CDRW 

CD-ReWritable (Orange Book)

+
CDMRW 

Mount-Rainier CD-RW.

+
VCD 

Video CD (White Book)

+
SVCD 

Super Video CD (White Book)

+
PCD 

Photo CD (Beige Book)

+
SACD 

Super Audio CD (Scarlet Book)

+
DDCD 

Double-Density CD-ROM (Purple Book)

+
DDCDR 

DD CD-R (Purple Book)

+
DDCDRW 

DD CD-RW (Purple Book)

+
DTSCD 

DTS audio CD (non-standard)

+
CDMIDI 

CD-MIDI (Red Book)

+
CDV 

CD-Video (ISO/IEC 61104)

+
PD650 

120mm, Phase-Change, 1298496 sectors, 512 bytes/sector, PD650, ECMA-240, ISO 15485

+
PD650_WORM 

120mm, Write-Once, 1281856 sectors, 512 bytes/sector, PD650, ECMA-240, ISO 15485

+
CDIREADY 

CD-i Ready, contains a track before the first TOC track, in mode 2, and all TOC tracks are Audio.

+

Subchannel marks track as audio pause.

+
FMTOWNS 

Fujitsu FM Towns bootable CD (mixed-mode proprietary extensions)

+
DVDROM 

DVD-ROM (applies to DVD Video and DVD Audio)

+
DVDR 

DVD-R.

+
DVDRW 

DVD-RW.

+
DVDPR 

DVD+R.

+
DVDPRW 

DVD+RW.

+
DVDPRWDL 

DVD+RW DL.

+
DVDRDL 

DVD-R DL.

+
DVDPRDL 

DVD+R DL.

+
DVDRAM 

DVD-RAM.

+
DVDRWDL 

DVD-RW DL.

+
DVDDownload 

DVD-Download.

+
HDDVDROM 

HD DVD-ROM (applies to HD DVD Video)

+
HDDVDRAM 

HD DVD-RAM.

+
HDDVDR 

HD DVD-R.

+
HDDVDRW 

HD DVD-RW.

+
HDDVDRDL 

HD DVD-R DL.

+
HDDVDRWDL 

HD DVD-RW DL.

+
BDROM 

BD-ROM (and BD Video)

+
BDR 

BD-R.

+
BDRE 

BD-RE.

+
BDRXL 

BD-R XL.

+
BDREXL 

BD-RE XL.

+
EVD 

Enhanced Versatile Disc.

+
FVD 

Forward Versatile Disc.

+
HVD 

Holographic Versatile Disc.

+
CBHD 

China Blue High Definition.

+
HDVMD 

High Definition Versatile Multilayer Disc.

+
VCDHD 

Versatile Compact Disc High Density.

+
SVOD 

Stacked Volumetric Optical Disc.

+
FDDVD 

Five Dimensional disc.

+
LD 

Pioneer LaserDisc.

+
LDROM 

Pioneer LaserDisc data.

+
LDROM2 
LVROM 
MegaLD 
HiMD 

Sony Hi-MD.

+
MD 

Sony MiniDisc.

+
MDData 

MiniDisc DATA (HiFD style data-only variant)

+
MDData2 

High-capacity MiniDisc DATA 2.

+
UDO 

5.25", Phase-Change, 1834348 sectors, 8192 bytes/sector, Ultra Density Optical, ECMA-350, ISO 17345

+
UDO2 

5.25", Phase-Change, 3669724 sectors, 8192 bytes/sector, Ultra Density Optical 2, ECMA-380, ISO 11976

+
UDO2_WORM 

5.25", Write-Once, 3668759 sectors, 8192 bytes/sector, Ultra Density Optical 2, ECMA-380, ISO 11976

+
PlayStationMemoryCard 

Sony PlayStation (PS1) memory card (128 KiB, 8 KB blocks)

+
PlayStationMemoryCard2 

Sony PlayStation 2 memory card (MagicGate, 8 MiB)

+
PS1CD 

Sony PlayStation game CD.

+
PS2CD 

Sony PlayStation 2 game CD.

+
PS2DVD 

Sony PlayStation 2 game DVD.

+
PS3DVD 

Sony PlayStation 3 game DVD.

+
PS3BD 

Sony PlayStation 3 game Blu-ray.

+
PS4BD 

Sony PlayStation 4 game Blu-ray.

+
UMD 

Sony PlayStation Portable Universal Media Disc (ECMA-365)

+
PlayStationVitaGameCard 

PS Vita NV memory card (proprietary flash)

+
XGD 

Microsoft X-box Game Disc.

+
XGD2 

Microsoft X-box 360 Game Disc.

+
XGD3 

Microsoft X-box 360 Game Disc.

+
XGD4 

Microsoft X-box One Game Disc.

+
MEGACD 

Sega MegaCD.

+
SATURNCD 

Sega Saturn disc.

+
GDROM 

Sega/Yamaha Gigabyte Disc.

+
GDR 

Sega/Yamaha recordable Gigabyte Disc.

+
SegaCard 

Sega My Card / Sega Card (SG-1000 / Mark III)

+
MilCD 

Sega Dreamcast MIL-CD enhanced multimedia disc.

+
HuCard 

PC-Engine / TurboGrafx cartridge.

+
SuperCDROM2 

PC-Engine / TurboGrafx CD.

+
JaguarCD 

Atari Jaguar CD.

+
ThreeDO 

3DO CD

+
PCFX 

NEC PC-FX.

+
NeoGeoCD 

NEO-GEO CD.

+
CDTV 

Commodore CDTV.

+
CD32 

Amiga CD32.

+
Nuon 

Nuon (DVD based videogame console)

+
Playdia 

Bandai Playdia.

+
Apple32SS 

5.25", SS, DD, 35 tracks, 13 spt, 256 bytes/sector, GCR

+
Apple32DS 

5.25", DS, DD, 35 tracks, 13 spt, 256 bytes/sector, GCR

+
Apple33SS 

5.25", SS, DD, 35 tracks, 16 spt, 256 bytes/sector, GCR

+
Apple33DS 

5.25", DS, DD, 35 tracks, 16 spt, 256 bytes/sector, GCR

+
AppleSonySS 

3.5", SS, DD, 80 tracks, 8 to 12 spt, 512 bytes/sector, GCR

+
AppleSonyDS 

3.5", DS, DD, 80 tracks, 8 to 12 spt, 512 bytes/sector, GCR

+
AppleFileWare 

5.25", DS, ?D, ?? tracks, ?? spt, 512 bytes/sector, GCR, opposite side heads, aka Twiggy

+
DOS_525_SS_DD_8 

5.25", SS, DD, 40 tracks, 8 spt, 512 bytes/sector, MFM

+
DOS_525_SS_DD_9 

5.25", SS, DD, 40 tracks, 9 spt, 512 bytes/sector, MFM

+
DOS_525_DS_DD_8 

5.25", DS, DD, 40 tracks, 8 spt, 512 bytes/sector, MFM

+
DOS_525_DS_DD_9 

5.25", DS, DD, 40 tracks, 9 spt, 512 bytes/sector, MFM

+
DOS_525_HD 

5.25", DS, HD, 80 tracks, 15 spt, 512 bytes/sector, MFM

+
DOS_35_SS_DD_8 

3.5", SS, DD, 80 tracks, 8 spt, 512 bytes/sector, MFM

+
DOS_35_SS_DD_9 

3.5", SS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM

+
DOS_35_DS_DD_8 

3.5", DS, DD, 80 tracks, 8 spt, 512 bytes/sector, MFM

+
DOS_35_DS_DD_9 

3.5", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM

+
DOS_35_HD 

3.5", DS, HD, 80 tracks, 18 spt, 512 bytes/sector, MFM

+
DOS_35_ED 

3.5", DS, ED, 80 tracks, 36 spt, 512 bytes/sector, MFM

+
DMF 

3.5", DS, HD, 80 tracks, 21 spt, 512 bytes/sector, MFM

+
DMF_82 

3.5", DS, HD, 82 tracks, 21 spt, 512 bytes/sector, MFM

+
XDF_525 

5.25", DS, HD, 80 tracks, ?

+

spt, ??? + ??? + ??? bytes/sector, MFM track 0 = ??15 sectors, 512 bytes/sector, falsified to DOS as 19 spt, 512 bps

+
XDF_35 

3.5", DS, HD, 80 tracks, 4 spt, 8192 + 2048 + 1024 + 512 bytes/sector, MFM track 0 = 19 sectors, 512 bytes/sector, falsified to DOS as 23 spt, 512 bps

+
IBM23FD 

8", SS, SD, 32 tracks, 8 spt, 319 bytes/sector, FM

+
IBM33FD_128 

8", SS, SD, 73 tracks, 26 spt, 128 bytes/sector, FM

+
IBM33FD_256 

8", SS, SD, 74 tracks, 15 spt, 256 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector

+
IBM33FD_512 

8", SS, SD, 74 tracks, 8 spt, 512 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector

+
IBM43FD_128 

8", DS, SD, 74 tracks, 26 spt, 128 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector

+
IBM43FD_256 

8", DS, SD, 74 tracks, 26 spt, 256 bytes/sector, FM, track 0 = 26 sectors, 128 bytes/sector

+
IBM53FD_256 

8", DS, DD, 74 tracks, 26 spt, 256 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector

+
IBM53FD_512 

8", DS, DD, 74 tracks, 15 spt, 512 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector

+
IBM53FD_1024 

8", DS, DD, 74 tracks, 8 spt, 1024 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector

+
RX01 

8", SS, DD, 77 tracks, 26 spt, 128 bytes/sector, FM

+
RX02 

8", SS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM/MFM

+
RX03 

8", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM/MFM

+
RX50 

5.25", SS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM

+
ACORN_525_SS_SD_40 

5,25", SS, SD, 40 tracks, 10 spt, 256 bytes/sector, FM

+
ACORN_525_SS_SD_80 

5,25", SS, SD, 80 tracks, 10 spt, 256 bytes/sector, FM

+
ACORN_525_SS_DD_40 

5,25", SS, DD, 40 tracks, 16 spt, 256 bytes/sector, MFM

+
ACORN_525_SS_DD_80 

5,25", SS, DD, 80 tracks, 16 spt, 256 bytes/sector, MFM

+
ACORN_525_DS_DD 

5,25", DS, DD, 80 tracks, 16 spt, 256 bytes/sector, MFM

+
ACORN_35_DS_DD 

3,5", DS, DD, 80 tracks, 5 spt, 1024 bytes/sector, MFM

+
ACORN_35_DS_HD 

3,5", DS, HD, 80 tracks, 10 spt, 1024 bytes/sector, MFM

+
ATARI_525_SD 

5,25", SS, SD, 40 tracks, 18 spt, 128 bytes/sector, FM

+
ATARI_525_ED 

5,25", SS, ED, 40 tracks, 26 spt, 128 bytes/sector, MFM

+
ATARI_525_DD 

5,25", SS, DD, 40 tracks, 18 spt, 256 bytes/sector, MFM

+
ATARI_35_SS_DD 

3,5", SS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM

+
ATARI_35_DS_DD 

3,5", DS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM

+
ATARI_35_SS_DD_11 

3,5", SS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM

+
ATARI_35_DS_DD_11 

3,5", DS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM

+
CBM_35_DD 

3,5", DS, DD, 80 tracks, 10 spt, 512 bytes/sector, MFM (1581)

+
CBM_AMIGA_35_DD 

3,5", DS, DD, 80 tracks, 11 spt, 512 bytes/sector, MFM (Amiga)

+
CBM_AMIGA_35_HD 

3,5", DS, HD, 80 tracks, 22 spt, 512 bytes/sector, MFM (Amiga)

+
CBM_1540 

5,25", SS, DD, 35 tracks, GCR

+
CBM_1540_Ext 

5,25", SS, DD, 40 tracks, GCR

+
CBM_1571 

5,25", DS, DD, 35 tracks, GCR

+
NEC_8_SD 

8", DS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM

+
NEC_8_DD 

8", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, MFM

+
NEC_525_SS 

5.25", SS, SD, 80 tracks, 16 spt, 256 bytes/sector, FM

+
NEC_525_DS 

5.25", DS, SD, 80 tracks, 16 spt, 256 bytes/sector, MFM

+
NEC_525_HD 

5,25", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM

+
NEC_35_HD_8 

3,5", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM, aka mode 3

+
NEC_35_HD_15 

3,5", DS, HD, 80 tracks, 15 spt, 512 bytes/sector, MFM

+
NEC_35_TD 

3,5", DS, TD, 240 tracks, 38 spt, 512 bytes/sector, MFM

+
SHARP_525 

5,25", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM

+
SHARP_525_9 

3,5", DS, HD, 80 tracks, 9 spt, 1024 bytes/sector, MFM

+
SHARP_35 

3,5", DS, HD, 77 tracks, 8 spt, 1024 bytes/sector, MFM, aka mode 3

+
SHARP_35_9 

3,5", DS, HD, 80 tracks, 9 spt, 1024 bytes/sector, MFM

+
ECMA_99_8 

5,25", DS, DD, 80 tracks, 8 spt, 1024 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector

+
ECMA_99_15 

5,25", DS, DD, 77 tracks, 15 spt, 512 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector

+
ECMA_99_26 

5,25", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, MFM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector

+
ECMA_100 

3,5", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, MFM

+
ECMA_125 

3,5", DS, HD, 80 tracks, 18 spt, 512 bytes/sector, MFM

+
ECMA_147 

3,5", DS, ED, 80 tracks, 36 spt, 512 bytes/sector, MFM

+
ECMA_54 

8", SS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM

+
ECMA_59 

8", DS, SD, 77 tracks, 26 spt, 128 bytes/sector, FM

+
ECMA_66 

5,25", SS, DD, 35 tracks, 9 spt, 256 bytes/sector, FM, track 0 side 0 = 16 sectors, 128 bytes/sector

+
ECMA_69_8 

8", DS, DD, 77 tracks, 8 spt, 1024 bytes/sector, FM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector

+
ECMA_69_15 

8", DS, DD, 77 tracks, 15 spt, 512 bytes/sector, FM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector

+
ECMA_69_26 

8", DS, DD, 77 tracks, 26 spt, 256 bytes/sector, FM, track 0 side 0 = 26 sectors, 128 bytes/sector, track 0 side 1 = 26 sectors, 256 bytes/sector

+
ECMA_70 

5,25", DS, DD, 40 tracks, 16 spt, 256 bytes/sector, FM, track 0 side 0 = 16 sectors, 128 bytes/sector, track 0 side 1 = 16 sectors, 256 bytes/sector

+
ECMA_78 
ECMA_78_2 

5,25", DS, DD, 80 tracks, 9 spt, 512 bytes/sector, FM

+
FDFORMAT_525_DD 

5,25", DS, DD, 82 tracks, 10 spt, 512 bytes/sector, MFM

+
FDFORMAT_525_HD 

5,25", DS, HD, 82 tracks, 17 spt, 512 bytes/sector, MFM

+
FDFORMAT_35_DD 

3,5", DS, DD, 82 tracks, 10 spt, 512 bytes/sector, MFM

+
FDFORMAT_35_HD 

3,5", DS, HD, 82 tracks, 21 spt, 512 bytes/sector, MFM

+
Apricot_35 

3.5", DS, DD, 70 tracks, 9 spt, 512 bytes/sector, MFM

+
ADR2120 
ADR260 
ADR30 
ADR50 
AIT1 
AIT1Turbo 
AIT2 
AIT2Turbo 
AIT3 
AIT3Ex 
AIT3Turbo 
AIT4 
AIT5 
AITETurbo 
SAIT1 
SAIT2 
Bernoulli 
Bernoulli2 
Ditto 
DittoMax 
Jaz 
Jaz2 
PocketZip 
REV120 
REV35 
REV70 
ZIP100 
ZIP250 
ZIP750 
CompactCassette 
Data8 
MiniDV 
Dcas25 

D/CAS-25: Digital data on Compact Cassette form factor, special magnetic media, 9-track.

+
Dcas85 

D/CAS-85: Digital data on Compact Cassette form factor, special magnetic media, 17-track.

+
Dcas103 

D/CAS-103: Digital data on Compact Cassette form factor, special magnetic media, 21-track.

+
CFast 
CompactFlash 
CompactFlashType2 
DigitalAudioTape 
DAT160 
DAT320 
DAT72 
DDS1 
DDS2 
DDS3 
DDS4 
CompactTapeI 
CompactTapeII 
DECtapeII 
DLTtapeIII 
DLTtapeIIIxt 
DLTtapeIV 
DLTtapeS4 
SDLT1 
SDLT2 
VStapeI 
Exatape15m 
Exatape22m 
Exatape22mAME 
Exatape28m 
Exatape40m 
Exatape45m 
Exatape54m 
Exatape75m 
Exatape76m 
Exatape80m 
Exatape106m 
Exatape160mXL 
Exatape112m 
Exatape125m 
Exatape150m 
Exatape170m 
Exatape225m 
ExpressCard34 
ExpressCard54 
PCCardTypeI 
PCCardTypeII 
PCCardTypeIII 
PCCardTypeIV 
EZ135 
EZ230 
Quest 
SparQ 
SQ100 
SQ200 
SQ300 
SQ310 
SQ327 
SQ400 
SQ800 
SQ1500 
SQ2000 
SyJet 
FamicomGamePak 

Nintendo Famicom cartridge.

+
GameBoyAdvanceGamePak 

Nintendo Game Boy Advance cartridge.

+
GameBoyGamePak 

Nintendo Game Boy / Color cartridge.

+
GOD 

Nintendo GameCube Optical Disc.

+
N64DD 
N64GamePak 

Nintendo 64 cartridge.

+
NESGamePak 

Nintendo NES cartridge.

+
Nintendo3DSGameCard 

Nintendo 3DS ROM card.

+
NintendoDiskCard 

Famicom Disk System disk.

+
NintendoDSGameCard 

Nintendo DS ROM card.

+
NintendoDSiGameCard 

Nintendo DSi enhanced ROM card.

+
SNESGamePak 

Nintendo SNES (PAL/JPN) cartridge.

+
SNESGamePakUS 

Nintendo SNES (US) cartridge (different shell)

+
WOD 

Nintendo Wii Optical Disc.

+
WUOD 

Nintendo Wii U Optical Disc.

+
SwitchGameCard 

Nintendo Switch Game Card (NV flash)

+
IBM3470 
IBM3480 
IBM3490 
IBM3490E 
IBM3592 
LTO 
LTO2 
LTO3 
LTO3WORM 
LTO4 
LTO4WORM 
LTO5 
LTO5WORM 
LTO6 
LTO6WORM 
LTO7 
LTO7WORM 
MemoryStick 
MemoryStickDuo 
MemoryStickMicro 
MemoryStickPro 
MemoryStickProDuo 
microSD 

microSD / microSDHC / microSDXC card

+
miniSD 

miniSD card

+
SecureDigital 

Full-size SD / SDHC / SDXC card.

+
MMC 

MultiMediaCard (legacy)

+
MMCmicro 

MMCmicro (RS-MMC form)

+
RSMMC 

Reduced Size MMC.

+
MMCplus 

MMCplus (high speed)

+
MMCmobile 

MMCmobile (dual voltage)

+
MLR1 
MLR1SL 
MLR3 
SLR1 
SLR2 
SLR3 
SLR32 
SLR32SL 
SLR4 
SLR5 
SLR5SL 
SLR6 
SLRtape7 
SLRtape7SL 
SLRtape24 
SLRtape24SL 
SLRtape40 
SLRtape50 
SLRtape60 
SLRtape75 
SLRtape100 
SLRtape140 
QIC11 
QIC120 
QIC1350 
QIC150 
QIC24 
QIC3010 
QIC3020 
QIC3080 
QIC3095 
QIC320 
QIC40 
QIC525 
QIC80 
STK4480 
STK4490 
STK9490 
T9840A 
T9840B 
T9840C 
T9840D 
T9940A 
T9940B 
T10000A 
T10000B 
T10000C 
T10000D 
Travan 
Travan1Ex 
Travan3 
Travan3Ex 
Travan4 
Travan5 
Travan7 
VXA1 
VXA2 
VXA3 
ECMA_153 

5,25", M.O., ??? sectors, 1024 bytes/sector, ECMA-153, ISO 11560

+
ECMA_153_512 

5,25", M.O., ??? sectors, 512 bytes/sector, ECMA-153, ISO 11560

+
ECMA_154 

3,5", M.O., 249850 sectors, 512 bytes/sector, ECMA-154, ISO 10090

+
ECMA_183_512 

5,25", M.O., 904995 sectors, 512 bytes/sector, ECMA-183, ISO 13481

+
ECMA_183 

5,25", M.O., 498526 sectors, 1024 bytes/sector, ECMA-183, ISO 13481

+
ECMA_184_512 

5,25", M.O., 1128772 or 1163337 sectors, 512 bytes/sector, ECMA-183, ISO 13549

+
ECMA_184 

5,25", M.O., 603466 or 637041 sectors, 1024 bytes/sector, ECMA-183, ISO 13549

+
ECMA_189 

300mm, M.O., ??? sectors, 1024 bytes/sector, ECMA-189, ISO 13614

+
ECMA_190 

300mm, M.O., ??? sectors, 1024 bytes/sector, ECMA-190, ISO 13403

+
ECMA_195 

5,25", M.O., 936921 or 948770 sectors, 1024 bytes/sector, ECMA-195, ISO 13842

+
ECMA_195_512 

5,25", M.O., 1644581 or 1647371 sectors, 512 bytes/sector, ECMA-195, ISO 13842

+
ECMA_201 

3,5", M.O., 446325 sectors, 512 bytes/sector, ECMA-201, ISO 13963

+
ECMA_201_ROM 

3,5", M.O., 429975 sectors, 512 bytes/sector, embossed, ISO 13963

+
ECMA_223 

3,5", M.O., 371371 sectors, 1024 bytes/sector, ECMA-223

+
ECMA_223_512 

3,5", M.O., 694929 sectors, 512 bytes/sector, ECMA-223

+
ECMA_238 

5,25", M.O., 1244621 sectors, 1024 bytes/sector, ECMA-238, ISO 15486

+
ECMA_239 

3,5", M.O., 318988, 320332 or 321100 sectors, 2048 bytes/sector, ECMA-239, ISO 15498

+
ECMA_260 

356mm, M.O., 14476734 sectors, 1024 bytes/sector, ECMA-260, ISO 15898

+
ECMA_260_Double 

356mm, M.O., 24445990 sectors, 1024 bytes/sector, ECMA-260, ISO 15898

+
ECMA_280 

5,25", M.O., 1128134 sectors, 2048 bytes/sector, ECMA-280, ISO 18093

+
ECMA_317 

300mm, M.O., 7355716 sectors, 2048 bytes/sector, ECMA-317, ISO 20162

+
ECMA_322 

5,25", M.O., 1095840 sectors, 4096 bytes/sector, ECMA-322, ISO 22092

+
ECMA_322_2k 

5,25", M.O., 2043664 sectors, 2048 bytes/sector, ECMA-322, ISO 22092

+
GigaMo 

3,5", M.O., 605846 sectors, 2048 bytes/sector, Cherry Book, GigaMo, ECMA-351, ISO 17346

+
GigaMo2 

3,5", M.O., 1063146 sectors, 2048 bytes/sector, Cherry Book 2, GigaMo 2, ECMA-353, ISO 22533

+
CompactFloppy 
DemiDiskette 
Floptical 

3.5", 652 tracks, 2 sides, 512 bytes/sector, Floptical, ECMA-207, ISO 14169

+
HiFD 
QuickDisk 
UHD144 
VideoFloppy 
Wafer 
ZXMicrodrive 
BeeCard 
Borsu 
DataStore 
DIR 
DST 
DTF 
DTF2 
Flextra3020 
Flextra3225 
HiTC1 
HiTC2 
LT1 
MiniCard 
Orb 
Orb5 
SmartMedia 
xD 
XQD 
DataPlay 
AppleProfile 
AppleWidget 
AppleHD20 
PriamDataTower 
Pippin 
RA60 

2382 cylinders, 4 tracks/cylinder, 42 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 204890112 bytes

+
RA80 

546 cylinders, 14 tracks/cylinder, 31 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 121325568 bytes

+
RA81 

1248 cylinders, 14 tracks/cylinder, 51 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 456228864 bytes

+
RC25 

302 cylinders, 4 tracks/cylinder, 42 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 25976832 bytes

+
RD31 

615 cylinders, 4 tracks/cylinder, 17 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 21411840 bytes

+
RD32 

820 cylinders, 6 tracks/cylinder, 17 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 42823680 bytes

+
RD51 

306 cylinders, 4 tracks/cylinder, 17 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 10653696 bytes

+
RD52 

480 cylinders, 7 tracks/cylinder, 18 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 30965760 bytes

+
RD53 

1024 cylinders, 7 tracks/cylinder, 18 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 75497472 bytes

+
RD54 

1225 cylinders, 8 tracks/cylinder, 18 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 159936000 bytes

+
RK06 

411 cylinders, 3 tracks/cylinder, 22 sectors/track, 256 words/sector, 16 bits/word, 512 bytes/sector, 13888512 bytes

+
RK06_18 

411 cylinders, 3 tracks/cylinder, 20 sectors/track, 256 words/sector, 18 bits/word, 576 bytes/sector, 14204160 bytes

+
RK07 

815 cylinders, 3 tracks/cylinder, 22 sectors/track, 256 words/sector, 16 bits/word, 512 bytes/sector, 27540480 bytes

+
RK07_18 

815 cylinders, 3 tracks/cylinder, 20 sectors/track, 256 words/sector, 18 bits/word, 576 bytes/sector, 28166400 bytes

+
RM02 

823 cylinders, 5 tracks/cylinder, 32 sectors/track, 256 words/sector, 16 bits/word, 512 bytes/sector, 67420160 bytes

+
RM03 

823 cylinders, 5 tracks/cylinder, 32 sectors/track, 256 words/sector, 16 bits/word, 512 bytes/sector, 67420160 bytes

+
RM05 

823 cylinders, 19 tracks/cylinder, 32 sectors/track, 256 words/sector, 16 bits/word, 512 bytes/sector, 256196608 bytes

+
RP02 

203 cylinders, 10 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 22865920 bytes

+
RP02_18 

203 cylinders, 10 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word, 576 bytes/sector, 23385600 bytes

+
RP03 

400 cylinders, 10 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 45056000 bytes

+
RP03_18 

400 cylinders, 10 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word, 576 bytes/sector, 46080000 bytes

+
RP04 

411 cylinders, 19 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 87960576 bytes

+
RP04_18 

411 cylinders, 19 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word, 576 bytes/sector, 89959680 bytes

+
RP05 

411 cylinders, 19 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 87960576 bytes

+
RP05_18 

411 cylinders, 19 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word, 576 bytes/sector, 89959680 bytes

+
RP06 

815 cylinders, 19 tracks/cylinder, 22 sectors/track, 128 words/sector, 32 bits/word, 512 bytes/sector, 174423040 bytes

+
RP06_18 

815 cylinders, 19 tracks/cylinder, 20 sectors/track, 128 words/sector, 36 bits/word, 576 bytes/sector, 178387200 bytes

+
LS120 

Imation LS-120 SuperDisk.

+
LS240 

Imation LS-240 SuperDisk.

+
FD32MB 

MF2HD formatted as 32MiB disk in Imation LS-240 drive.

+
RDX 

Tandberg / Imation RDX removable disk cartridge.

+
RDX320 

Imation 320Gb RDX.

+
VideoNow 

Hasbro VideoNow 85 mm proprietary video disc.

+
VideoNowColor 

Hasbro VideoNow Color disc.

+
VideoNowXp 

Hasbro VideoNow XP higher capacity disc.

+
+ +

Definition at line 94 of file aaru.h.

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/group__MediaTypes.js b/docs/html/group__MediaTypes.js new file mode 100644 index 0000000..2d0898b --- /dev/null +++ b/docs/html/group__MediaTypes.js @@ -0,0 +1,500 @@ +var group__MediaTypes = +[ + [ "ImageInfo", "structImageInfo.html", [ + [ "Application", "structImageInfo.html#aaea8b3a14fc03f9a4b045318160b7f54", null ], + [ "ApplicationVersion", "structImageInfo.html#aebf7783c46e640a8e7d0192ba2843e9a", null ], + [ "CreationTime", "structImageInfo.html#acbccd97dbc139ed2f81d9997560725bb", null ], + [ "HasPartitions", "structImageInfo.html#a5f4e71687378856611c72604f63c2835", null ], + [ "HasSessions", "structImageInfo.html#aaeb20c53439a89baaf21944b3c97f676", null ], + [ "ImageSize", "structImageInfo.html#abca8e73a9655d810e6d30d36c3ab54d7", null ], + [ "LastModificationTime", "structImageInfo.html#ada8567fee9fbe636cb10f788b3705e3a", null ], + [ "MediaType", "structImageInfo.html#a76611d5087e0a9fd4d329fac7c9ec3f3", null ], + [ "MetadataMediaType", "structImageInfo.html#a7ed25efcf8cec55d6609b83bcd17b2d0", null ], + [ "Sectors", "structImageInfo.html#ae3e1b9cde1c51152b00eb1b59e199906", null ], + [ "SectorSize", "structImageInfo.html#aac1ac48f57afd415467cd6f13f01644b", null ], + [ "Version", "structImageInfo.html#adce978941d9900c8c05e620df67f8c5c", null ] + ] ], + [ "MediaType", "group__MediaTypes.html#ga1499e9f8a76cb81b43b7a4b0dbe7e44a", [ + [ "Unknown", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4e81c184ac3ad48a389cd4454c4a05bb", null ], + [ "UnknownMO", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa7fe08f73fb4c4f769e22c9fa7aac574", null ], + [ "GENERIC_HDD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aabe5fe31589b006affd9e65af071eb952", null ], + [ "Microdrive", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aabbc00e6dd97647ce34dfb1df8abc90c3", null ], + [ "Zone_HDD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3bdd404bc417081c8b5291bd8a49cbf4", null ], + [ "FlashDrive", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa57ae1fe6db732532ab7ffc732f826a23", null ], + [ "CD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9aea9e501fa935b114b235e8e9754267", null ], + [ "CDDA", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2931a7599dc57bd2db354a9638940193", null ], + [ "CDG", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1614aa017f103a05653a0d97aed82ede", null ], + [ "CDEG", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa24cc59b29fa409cdd7a9eeeb3a93a204", null ], + [ "CDI", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad2567d992fdf3df571ebbfba26f6e36e", null ], + [ "CDROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa359123216b26bd526c3a0b22e4a2e7fb", null ], + [ "CDROMXA", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0446766c082644f79001c24ea2095a5b", null ], + [ "CDPLUS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4f607f12adb6b9b7e46ae74916a3d078", null ], + [ "CDMO", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa230876d2ecbd62981bb9ad705f0862ff", null ], + [ "CDR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1117f14bfc3d2eeb593d7d4eccdb09d9", null ], + [ "CDRW", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa408f2dbd9aa3d80242a95819b8d5554c", null ], + [ "CDMRW", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2bf9f431ddc8a4bffceb3f85623bb96e", null ], + [ "VCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3e4f8fc0b0de2be739bc4e6aca61039a", null ], + [ "SVCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa42a85e55170f4b530f2841fe6d56b388", null ], + [ "PCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1556dd6c1b90666aefa74725b8d47f50", null ], + [ "SACD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6903c0dd79d234b9379daaaa97e2c0fe", null ], + [ "DDCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa23274a7e0b8dd0595a1cc3c34b53cbd2", null ], + [ "DDCDR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa49130f592d16013e73c54973f955ecf2", null ], + [ "DDCDRW", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacba105bad341306b948401a57e614321", null ], + [ "DTSCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac3a40c0ead8d2010547ae2525545c44a", null ], + [ "CDMIDI", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa75fa65ad8c509d1472d5aab9976cb3ed", null ], + [ "CDV", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa15c2e9c62a04ccf3ca8bc4a151ef289d", null ], + [ "PD650", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad78c761d32c5c140d29cf10e5b7c9a13", null ], + [ "PD650_WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6c27710f712f3814021f9797b2260fb0", null ], + [ "CDIREADY", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3299c8db9ba7b48ee7492b2dfbfdfeca", null ], + [ "FMTOWNS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa54a5601323f7c9935ba35beb1da5abcd", null ], + [ "DVDROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf254215c04f84a87eef3702782ba7662", null ], + [ "DVDR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa711ac65a3b3a2d5392d2efee1616bcd7", null ], + [ "DVDRW", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4cfa242859c1a136a740718d0440de9a", null ], + [ "DVDPR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac3c8ca46e314f36e5398a97e85b7a3d1", null ], + [ "DVDPRW", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad5de19f38ea842de6d5edc2baa586160", null ], + [ "DVDPRWDL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa44d41093d0d9a56fa5e9fa317c4d795a", null ], + [ "DVDRDL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadff93972faa98cafc01f4fbb464680a2", null ], + [ "DVDPRDL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6a04ebe8862d4f729e9dad48bfe92b99", null ], + [ "DVDRAM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaff04a947594e116dd0adf854660ff00a", null ], + [ "DVDRWDL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa502cfc3a14e97fdb99a2856c2f230e19", null ], + [ "DVDDownload", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadf89869853533586979db286065899af", null ], + [ "HDDVDROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa38dff83456540de8b0db2e8eacb5285c", null ], + [ "HDDVDRAM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa70672f466c2dfca0b557642b132c1088", null ], + [ "HDDVDR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab01abc4a564ec1ac8e39410ad69b187f", null ], + [ "HDDVDRW", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab8d5793ab3e0bd984e307c7f062183cc", null ], + [ "HDDVDRDL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa53cac04042ea5e943a8101b338749941", null ], + [ "HDDVDRWDL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5f682cb56cf6b64e19a182ea5829e8a1", null ], + [ "BDROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa79ba622fe51ab85f82ac1fef5d91ecf0", null ], + [ "BDR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaac8f48f5db15c7112e6fe4a466582b33", null ], + [ "BDRE", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac38c8f08c0f5b53d87aca57202eaf123", null ], + [ "BDRXL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa47f36801fd65d252e56797ef3d9bf67f", null ], + [ "BDREXL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0125edd84c12e1352cd217e927bcb0c0", null ], + [ "EVD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa67532fa1f785395445fd7cc2500f089a", null ], + [ "FVD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad0c431131a66081e6b394fafdb9828c4", null ], + [ "HVD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1a2d49c9c7b0809a5003a9237c38d139", null ], + [ "CBHD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa90ebc69abd374bc98b2dc66ce9af4e4", null ], + [ "HDVMD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab28ee6d0eec9bde3fe3a27d89356ddfb", null ], + [ "VCDHD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa98d53c50a738e49829883104d8df2727", null ], + [ "SVOD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0e880bad655cd93dfd4321c6a559dd5c", null ], + [ "FDDVD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf608c0182cd563d9da77fdba304e75bb", null ], + [ "LD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa24a5a956f8abcaacbde751c49c7d5001", null ], + [ "LDROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaaeb95cfb92ff05358a9b84a7413566c5", null ], + [ "LDROM2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf4798e7a7578b9ecbdb4f952e807c3e8", null ], + [ "LVROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadcf43ad5c010a9983baca9265c7cc4ae", null ], + [ "MegaLD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3e21b5d6e37cf7a60ca04dc86223a945", null ], + [ "HiMD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaebf4449aff0958611c03d3814ab6d205", null ], + [ "MD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa800ab8d25820e3e9fe503340561b0ca6", null ], + [ "MDData", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa79f28d42c4e7ffa514469ffdc7c59d51", null ], + [ "MDData2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa2fe0d2f1b6a286c5899a57787711b72", null ], + [ "UDO", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab07b439547f22e1c4ae92a400aea569e", null ], + [ "UDO2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aade3918df59411bc34c0583ab909c0e30", null ], + [ "UDO2_WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1db9c2ebd6274e845ca174dc8d6ea425", null ], + [ "PlayStationMemoryCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8292cf4b43ef2f4db9ac31704a6c7c03", null ], + [ "PlayStationMemoryCard2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa159fdac30e1b0d0714be311dd73be7da", null ], + [ "PS1CD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa59c572262681092c6da3188135ae944f", null ], + [ "PS2CD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafa77828f2ea2ff692992611a19307d9f", null ], + [ "PS2DVD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8dccd9aa3702e0112d3c4d6f3388820e", null ], + [ "PS3DVD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa727f071d5dd887fd6645e112cfcab197", null ], + [ "PS3BD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa626b10297c3bc07fbff69cf639208453", null ], + [ "PS4BD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaafd24844aa48e831be04f4a6446c9e48", null ], + [ "UMD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa649acec76a8835e5d968c8bd01e7a279", null ], + [ "PlayStationVitaGameCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa806f0de17c9f3ec6d688af26a51b89d", null ], + [ "XGD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6576c3669ab86877d0f12cfa5845a0e9", null ], + [ "XGD2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaae690ba36140800288e9635e35305575", null ], + [ "XGD3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6165a80d91d5a2e616a7ce034c5c3611", null ], + [ "XGD4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa933052f31f7e81b8c25f959861039774", null ], + [ "MEGACD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2e3fdf35c0b2961d6a0ab00407ce7fcb", null ], + [ "SATURNCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa5050a2f9296ac5f92e12287c00799ec", null ], + [ "GDROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa04566d313f48518f585f1c7b097f5c1", null ], + [ "GDR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2729318ff14e174d2ef9484bccf1dadb", null ], + [ "SegaCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0ff37a24cd37bbded4c4e3176373c46e", null ], + [ "MilCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac24c0127190d9b8bdbdccbb49a9cc8a8", null ], + [ "HuCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa61d6c579f7abab5881d150ad12c459f0", null ], + [ "SuperCDROM2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3e52a110f0759765e20f0c3380ad72a6", null ], + [ "JaguarCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8a082102c8bb98196eaad3fbd8131a86", null ], + [ "ThreeDO", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa13d8116741c1455648e1a69829d62cde", null ], + [ "PCFX", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa765042a646a55f7d00bc7474527ddb4a", null ], + [ "NeoGeoCD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4a70111c4d3c373a1997911bf718dddc", null ], + [ "CDTV", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4fafe8fe3ae70a17431abd03ae6d78e0", null ], + [ "CD32", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadb8c878db849cdc88cecec01a353790c", null ], + [ "Nuon", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad730786bd592903cc42ad7f5a5847171", null ], + [ "Playdia", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad3844a541b5dc4ab194e6cd6d6a98fef", null ], + [ "Apple32SS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa492b19f427f1827e7cb640c775890d94", null ], + [ "Apple32DS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaac9b75c633c48d3805b60ac337f5df81", null ], + [ "Apple33SS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae71e931f1f86b160c80f085be25c4b7d", null ], + [ "Apple33DS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaad8803940389ccbe26e3c2cbb24e8e8d", null ], + [ "AppleSonySS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3d003ea60d3ecb7018a671e1302938a0", null ], + [ "AppleSonyDS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae809315e2cd79c3fd74d1604c38f3ae6", null ], + [ "AppleFileWare", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac08b59f9e8ecf5e380092edddb0340ec", null ], + [ "DOS_525_SS_DD_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa20e8efecfec4a885b1a1eca6d89fdbbc", null ], + [ "DOS_525_SS_DD_9", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf9766bbb312f0c44964d106aa944281d", null ], + [ "DOS_525_DS_DD_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf7746389097c4bc3bf5b5a753a54debc", null ], + [ "DOS_525_DS_DD_9", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8ad87a17fdbd68c7c60d2d555a84a665", null ], + [ "DOS_525_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9f7cb3eb43acf5b7e4bacda719409910", null ], + [ "DOS_35_SS_DD_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa21419d71d1a11499f1129b773c03a78f", null ], + [ "DOS_35_SS_DD_9", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa482920249a7531adc2c877432bace94e", null ], + [ "DOS_35_DS_DD_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa06ae80ac5c49b97bbf3e48a4e4bfec8d", null ], + [ "DOS_35_DS_DD_9", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5c480394d1ecefc1e19d542719561a0d", null ], + [ "DOS_35_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0bfe56a99813299e86156f7ed4ff978d", null ], + [ "DOS_35_ED", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa04b3553989b835c84ea50525aa26adc1", null ], + [ "DMF", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2fbc31a44883370f8033063912b270c1", null ], + [ "DMF_82", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa202ad542a84199a302aa11265da89d68", null ], + [ "XDF_525", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad07c2fe03f45b02968bf2d757428ba6c", null ], + [ "XDF_35", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaaee3301d147bd3f076c8ce520bd275f9", null ], + [ "IBM23FD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa379024f58c222744262a0885b3de1316", null ], + [ "IBM33FD_128", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacdcaed3e1aebde3da722b8a51cc3e4d7", null ], + [ "IBM33FD_256", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac67a562a1e8d91473f11a5db6d9153c5", null ], + [ "IBM33FD_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9e845685cf8808f41debf04d8840da79", null ], + [ "IBM43FD_128", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa322cc6bbd11d81838b76f3b5ed09c0bb", null ], + [ "IBM43FD_256", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9c3ce5c9bdd82c55afcbb28c6e773993", null ], + [ "IBM53FD_256", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1b8a80048f7587ea99d571ce9dcace4f", null ], + [ "IBM53FD_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae5717b8002157516de03fea874afe64e", null ], + [ "IBM53FD_1024", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab1a02c403632e48492a4a679e27f7c9a", null ], + [ "RX01", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad289653e39817d07bb3dd07027a34bec", null ], + [ "RX02", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa90fcc7dc4696ae5f90b7028cb7cb3047", null ], + [ "RX03", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0d4a3714a82174302891870ef7321496", null ], + [ "RX50", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad0f35c56f0953b0640432ab66a276d9e", null ], + [ "ACORN_525_SS_SD_40", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1c9b592577769915d4182b9774abe198", null ], + [ "ACORN_525_SS_SD_80", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac4009edab9ec4a495ef50855b5931871", null ], + [ "ACORN_525_SS_DD_40", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacdc7d883c098eacafcf71fcfa1a01862", null ], + [ "ACORN_525_SS_DD_80", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2eb820540a7214bd978a1e1bfde4d9be", null ], + [ "ACORN_525_DS_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa771851dbeed2874c7508064e6ea5e91a", null ], + [ "ACORN_35_DS_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaeac3bbe0689d57fffd02f7481a612464", null ], + [ "ACORN_35_DS_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7c6fffa53f45dc4a51c7341252599f83", null ], + [ "ATARI_525_SD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa30d4793d280426cf5f04f93f5b5978a6", null ], + [ "ATARI_525_ED", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8717609ce351da02d5aff39baabd934c", null ], + [ "ATARI_525_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae4d54ec0fa82996f4a011da309beeb15", null ], + [ "ATARI_35_SS_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa294a563d16e1f7c5ade840004b5a669a", null ], + [ "ATARI_35_DS_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaedf30f5110cd29833e2d821ae5e5d90d", null ], + [ "ATARI_35_SS_DD_11", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadebc32c0c8421a9b4fe80d08dcdfd5d8", null ], + [ "ATARI_35_DS_DD_11", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad8fe0792a6d7fb0bc84cf6d8bdf9f8c6", null ], + [ "CBM_35_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7f9fe8270ba80b99028f1b5f06c17e58", null ], + [ "CBM_AMIGA_35_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1500ddc6bb87802e887bca2f8e8cd6a1", null ], + [ "CBM_AMIGA_35_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aabd7cf2dd5b3da3ae189bceba61220be1", null ], + [ "CBM_1540", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafa556dc46658c5ef0b0e92d329e4115a", null ], + [ "CBM_1540_Ext", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3ab2271f940524cc21df8295f860e907", null ], + [ "CBM_1571", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf4b1ce88a95302267f31083c38d8f139", null ], + [ "NEC_8_SD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafbc409413b4cc2bb573880f78ec5b707", null ], + [ "NEC_8_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5a79f25c38d19b0719508573302f38f7", null ], + [ "NEC_525_SS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa64629ce0276e0945b44e358eb403b590", null ], + [ "NEC_525_DS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaebb002437c463903e73779aa24e512a4", null ], + [ "NEC_525_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa018f18706ace2392d77dd8312a3d5ce9", null ], + [ "NEC_35_HD_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa13d2bbca1f3dff0af02f428d2b8f8c86", null ], + [ "NEC_35_HD_15", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa16792ebd5fa617354ca314746163053b", null ], + [ "NEC_35_TD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa529b682990d62f58e66b719b00e43b0a", null ], + [ "SHARP_525", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa30d286d8620e7955c3f76748fa7b1a51", null ], + [ "SHARP_525_9", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa669773752d754f6ed452dc3ff0c5cd9b", null ], + [ "SHARP_35", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8e0ff6b32a39706d7a51544e62e61e7e", null ], + [ "SHARP_35_9", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa57a306a0822d74a1512aed5a01b9ae27", null ], + [ "ECMA_99_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa88f675ca4c6c660d50839614106b93b6", null ], + [ "ECMA_99_15", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa459fc3b6ca291275102fa09f42cee8b4", null ], + [ "ECMA_99_26", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaba667a25facc9151591dc24bbf7699a7", null ], + [ "ECMA_100", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa62b42c966a7d3ae08873c9658457be59", null ], + [ "ECMA_125", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa82d0775f274f59fe1577b26f3a724ca", null ], + [ "ECMA_147", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6e85317aeb85d75e385712c47a3a3763", null ], + [ "ECMA_54", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa61a01aac39d7d64a91b83dd3e5162361", null ], + [ "ECMA_59", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad062cf16ecb9e1b1f9b2e1f177236e9a", null ], + [ "ECMA_66", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaae2d7e00e9923054debf7e91421b5cc1", null ], + [ "ECMA_69_8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9c1e0d69d1f273fa2c6beeaa613fcede", null ], + [ "ECMA_69_15", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9336d902f9633fb8269405c030181ea9", null ], + [ "ECMA_69_26", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1d76cfb577917374d3741d43d42cd9b8", null ], + [ "ECMA_70", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0c192706d220b779a8e107a7917f9712", null ], + [ "ECMA_78", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3139c292b7ca6e5712b1515f383b9d75", null ], + [ "ECMA_78_2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaddeda742144fb9104d8facaa4cb72a2d", null ], + [ "FDFORMAT_525_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9fd7230dedb4b9f8eb191bf3f7ed480a", null ], + [ "FDFORMAT_525_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa77c42e046250bf7227cd7e250f8ccf86", null ], + [ "FDFORMAT_35_DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadb0d81fd2b1e80e305b9088bf4728703", null ], + [ "FDFORMAT_35_HD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9c675c3ce576cbdb97c140a7d4c47077", null ], + [ "Apricot_35", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa925b760123c53b79c9bb17fe94401c6d", null ], + [ "ADR2120", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa302a8915fc26f9b21c485bd8c57bfe3c", null ], + [ "ADR260", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa567c5e725a303597da53eb0a68f01db4", null ], + [ "ADR30", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9d85b0d5a53b4457c0c0c3084b26def3", null ], + [ "ADR50", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5db2ebec64af62afde675d62c52001ba", null ], + [ "AIT1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaed524f1642620cf0a210d619aba9be67", null ], + [ "AIT1Turbo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4be75377ec0cf6a7302e7f9ca3fde6f1", null ], + [ "AIT2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9c7b877e9f1f874f159a353799e0dc40", null ], + [ "AIT2Turbo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9006689a2bd2d1bd5b6ed30533b043d5", null ], + [ "AIT3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7efd199428d6ddcdb86d845cdf09ce27", null ], + [ "AIT3Ex", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa30c67e2f83f3f9b9afcdfa95c34f9d3d", null ], + [ "AIT3Turbo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5db70dbfc4f68635f9544a296fcff5e3", null ], + [ "AIT4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5f1c7b0c2797c22c0d9e495712d93986", null ], + [ "AIT5", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf326517432c7507b852ac156f8500d60", null ], + [ "AITETurbo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1dffa337e6e28b886a15fa8143d302bd", null ], + [ "SAIT1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa04351b1d269ddc654507d0c9fa8b0815", null ], + [ "SAIT2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa50a7f4075d444826b863a98c89eca9b2", null ], + [ "Bernoulli", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa9d14952b686e6c9d08e0a2bc133dc19", null ], + [ "Bernoulli2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacf4a719af78f28b3f2af9c9c545275d9", null ], + [ "Ditto", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafaa560db218a872d3488b2c22969ce6d", null ], + [ "DittoMax", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4d435846c8eaf5c3b4cf6367c9c58ac9", null ], + [ "Jaz", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7300afff4afe4b2a2d838bcf007df159", null ], + [ "Jaz2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa666e25da783c836fa375ee4efa53cd19", null ], + [ "PocketZip", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa58ee4dca871ec1f01260f0888621993b", null ], + [ "REV120", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa56cd4a3d2cf2c41ac0799be3c0662cb5", null ], + [ "REV35", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa41baaf53d95ce93addc9510e53232d14", null ], + [ "REV70", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac7451c18dbb78c82f2ea43a4b22c2708", null ], + [ "ZIP100", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab744f08470a9dc22ca2a7624ce006aaa", null ], + [ "ZIP250", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4d81ba20676520904d1ec12af2e9c069", null ], + [ "ZIP750", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa912034b3fd49a6e93d143cf8938bbc4", null ], + [ "CompactCassette", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa269b538ff5238fa39e115dc481b449e5", null ], + [ "Data8", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac5f2bbe0d52cd7cf9362b94466dc088c", null ], + [ "MiniDV", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa026528746ef1f5f410a0977bf24f72ba", null ], + [ "Dcas25", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3cf66f038ccca5f9898ebc59aa7e2974", null ], + [ "Dcas85", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8daa0116220f10c33111c57f672eb952", null ], + [ "Dcas103", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3b2d06548aeb27a577b26fb87f079601", null ], + [ "CFast", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa884240bde73a404a4f5e25076a329191", null ], + [ "CompactFlash", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa68851e22da7d7599d3e24dd54649b7f2", null ], + [ "CompactFlashType2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa56a1c5d20b95f3de34f28e6a7935c3c7", null ], + [ "DigitalAudioTape", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacc94d9a0e002510116470ad9587552ad", null ], + [ "DAT160", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa21e9369acc74f7909a9f80b3b0e7e7ef", null ], + [ "DAT320", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4d4e516d1d9f515a9a974db0f8482b48", null ], + [ "DAT72", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaaf97f4129bb0fa8c44661d7d2ae1847c", null ], + [ "DDS1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa68b451149c8486237e16872c5f427c9b", null ], + [ "DDS2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa225fe83b7d46da4ad66c2571a80fedc", null ], + [ "DDS3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaefe307fd08c8ba7727fc0e187b7c250c", null ], + [ "DDS4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac69f6e13d71e46658f94bb90adfb79ff", null ], + [ "CompactTapeI", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa517f4a953d7706bb2178651eb3ea965f", null ], + [ "CompactTapeII", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac3070ed27508c145f950d49b145f4f14", null ], + [ "DECtapeII", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7c626f8bf16729b5f10b5081b625dd6b", null ], + [ "DLTtapeIII", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafc87821d1ccc83021eeb637d3e0c3efa", null ], + [ "DLTtapeIIIxt", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa44e5b33f31ac0b153906be5fd219cff1", null ], + [ "DLTtapeIV", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4098954065f9e024166feb3e1ff7e5ce", null ], + [ "DLTtapeS4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0a40223840280167a28c725ec82a1f2b", null ], + [ "SDLT1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad45fd74266e3206ecc7efd4d639d0e54", null ], + [ "SDLT2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7fbbf1e7014a9656bd10fcb5a12869fe", null ], + [ "VStapeI", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1da82b907193d0fd3a38e6d7eb7d1d90", null ], + [ "Exatape15m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa9cfd40d9f1d4833e4f379556f58aee0", null ], + [ "Exatape22m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae40038685c5b69b8d749c2aaf131b250", null ], + [ "Exatape22mAME", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4f7b2285310471de9e931adef4eb6ed3", null ], + [ "Exatape28m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4ad2ba9e9df28f8d385ae39ef51924e6", null ], + [ "Exatape40m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa15dbd14ab5c4317ac42b451c46689d0f", null ], + [ "Exatape45m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa15b38bc9a1138fdec063a0314bec55bc", null ], + [ "Exatape54m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8302315c50ccf99cf9a065494d5a9aee", null ], + [ "Exatape75m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae732f3d5f96c199ac229d740923ae2e9", null ], + [ "Exatape76m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa346fac97cf981992b2dc7162344cb3b3", null ], + [ "Exatape80m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0d4825c104727429da72cb3ffeb7f2cc", null ], + [ "Exatape106m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa36db28763c08f22bfae9c556188a7db9", null ], + [ "Exatape160mXL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aabddbb582fe47247fbcc87e41bbc0724a", null ], + [ "Exatape112m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaebc12ca5a5e9e30889648ba084049f73", null ], + [ "Exatape125m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae8ba1484b50d4422fa5e112f025db2ca", null ], + [ "Exatape150m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa215083923492f959f13a9b5179b84a63", null ], + [ "Exatape170m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf0d5f1dc229ffe0d4492f6ac610af28a", null ], + [ "Exatape225m", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3fb466288a38201b3c5c5421bf2f885a", null ], + [ "ExpressCard34", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7d0b878a1fcbb2013c6994f45ec0c039", null ], + [ "ExpressCard54", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1e70978a3b2566bc1504f3a64e55c24f", null ], + [ "PCCardTypeI", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1e769aa2d23d5980075ac83436c4497a", null ], + [ "PCCardTypeII", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0ac5684a2c2b8b5e49dced914fd544ff", null ], + [ "PCCardTypeIII", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa78fd2695498748ca770a333985888180", null ], + [ "PCCardTypeIV", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa30b964439df6d758ea44079ceb27dbda", null ], + [ "EZ135", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad4b64182cff74fb3da822f955e35468f", null ], + [ "EZ230", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa73cc08581063a7bb0353bf4a7919a94", null ], + [ "Quest", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9552944749afff02f38b9689ed94d1e5", null ], + [ "SparQ", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa93b0b84a1ca688e24f0677d91c2b280b", null ], + [ "SQ100", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaacd5aef6f02d071120241ac243b70305", null ], + [ "SQ200", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf13be5636b0b3c52e8e1d054875abb5d", null ], + [ "SQ300", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa29aacb086d88816119281eb4f31c8f6f", null ], + [ "SQ310", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4846544a39263ffd44af1ed291ecbbe5", null ], + [ "SQ327", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4cfcd547d8878bf10cab7df3b54e339e", null ], + [ "SQ400", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa688b931b8a32ba72044a3c5fcd0000a0", null ], + [ "SQ800", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaad275e80346dceb1c35c656c9e704a04", null ], + [ "SQ1500", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4f7ea4403b046aad24696f4689f1f9df", null ], + [ "SQ2000", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1d715ed8c6f0fc7e9923ba2f6414a351", null ], + [ "SyJet", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad1af9b71a52d69b0ef7d870a2fe53fab", null ], + [ "FamicomGamePak", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4f0263eb9fb86d4d6046a4080589eacc", null ], + [ "GameBoyAdvanceGamePak", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8ea876f5601b98cd71000682b70fc9c3", null ], + [ "GameBoyGamePak", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa904387c404e6d4c9ed6165b66d286ca0", null ], + [ "GOD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa34fed1daeb2422887d826d127e6ad488", null ], + [ "N64DD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae04a5d4c84dbdb402b1fb2ca81706dd4", null ], + [ "N64GamePak", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7b1b823420a55f6c243db8be1d09a74c", null ], + [ "NESGamePak", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafb8177a285680259bc8c3b2b53a0d984", null ], + [ "Nintendo3DSGameCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab61f89abbda06c12237c7a4728f6321f", null ], + [ "NintendoDiskCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab7736e1bdc9cb153900086bba46c3e06", null ], + [ "NintendoDSGameCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3d2a7b0cb27faa50e558f5dfcc4c52d5", null ], + [ "NintendoDSiGameCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaab027fb2aa926f3ca765562d1fd09696", null ], + [ "SNESGamePak", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa377c9aea4ef6423748cb104ad8c51bcd", null ], + [ "SNESGamePakUS", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7f25662d4fbe3cf90f1602d73c4e3520", null ], + [ "WOD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa61ed400b8bb5104e7309b3823e85766c", null ], + [ "WUOD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaee394a7c6e389c9b3734850e1666ee04", null ], + [ "SwitchGameCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa64c3f553240acee7926acfae616bbcd4", null ], + [ "IBM3470", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7e4c4cd9066aad99af8d29bc941e46d3", null ], + [ "IBM3480", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa598db1dc36a0c8c5005cbc23f4ba7f66", null ], + [ "IBM3490", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4a3ecf94bb44deb11279413c85886197", null ], + [ "IBM3490E", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf6da87cbe37a63b48ac47126a4a16d15", null ], + [ "IBM3592", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa61a087bad2e8ed96512c67db75668a64", null ], + [ "LTO", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6aabc225213d7e700b757f0276834e59", null ], + [ "LTO2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6f2bfeadc066b63b7a837e221ab170aa", null ], + [ "LTO3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaf3c7d7240021f5a138dff359af5f8bed", null ], + [ "LTO3WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa351aa3972af28aaf9b0d2cab1ce3c9b7", null ], + [ "LTO4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac2f94ffbe0b397608d59dd5196c4424f", null ], + [ "LTO4WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1e20a868404f401a0bb27664a493cacc", null ], + [ "LTO5", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa96d7163098b2f36a824abfc66f0cfc45", null ], + [ "LTO5WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8e9a0113a8ee17cc4edb8152db7fc008", null ], + [ "LTO6", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa42ce3d986ca7507ab314c7824d371206", null ], + [ "LTO6WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5e301457517e12fe8832c90eb9c053fc", null ], + [ "LTO7", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab0a82fc1dd86af5c361d7c549b001f6b", null ], + [ "LTO7WORM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7d3400fe55bbbb17b6ec7612a7092453", null ], + [ "MemoryStick", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaacbe7eefff71c4184dc2cd764de134e0", null ], + [ "MemoryStickDuo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad2df43a8dbc3b8bb2de7caff02098023", null ], + [ "MemoryStickMicro", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2099d3c555475b3f38fd8ed324f3581c", null ], + [ "MemoryStickPro", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0a14ea0cc560c5c585d86962a2b9f4c9", null ], + [ "MemoryStickProDuo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7964bc555b07ff11ccc22d5ac7b2f7c7", null ], + [ "microSD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1ec8c6f16c78efa0b7e78bfd1c7c8106", null ], + [ "miniSD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4dd0716cba005d43e04bd2dd06179ac0", null ], + [ "SecureDigital", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5a91e22b345c870a05d85884e0f69130", null ], + [ "MMC", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa7d8fca3406f36682514f0384d910fac", null ], + [ "MMCmicro", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab50bd38ed9bee0df1aca0fc52f2bb6f1", null ], + [ "RSMMC", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aabe59760d082965a1e54e32e2982b3342", null ], + [ "MMCplus", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa94dd34ef484b14c2c132ce671501944b", null ], + [ "MMCmobile", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aabf159edb905437dc3ec56e021acf6475", null ], + [ "MLR1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa120f420bca58f04fae6da13953fd2aeb", null ], + [ "MLR1SL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9d12da8f4cdee2a5775344ce9ade5bf2", null ], + [ "MLR3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8e0ec327020c38d489dfbf2e244db643", null ], + [ "SLR1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa98ff382e8ff354bc80f80d37f3970fb2", null ], + [ "SLR2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1b39849006bb15720a75226c59d742a2", null ], + [ "SLR3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2cabe2c2f396f5925be2ccb73773bc84", null ], + [ "SLR32", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab33b505b696f800bbbe1d91257d7fda4", null ], + [ "SLR32SL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa02194764bbcb58913472c2916c79aa41", null ], + [ "SLR4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa62b41c3180caa66b2944fc4e53b75723", null ], + [ "SLR5", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae3acf873c76f8b1e43135d8a52a864ed", null ], + [ "SLR5SL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0e9659fb6dd0da87a93028e5ffae5f33", null ], + [ "SLR6", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac47b24ebcaaab9171cf02115f5f1227c", null ], + [ "SLRtape7", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae24f9d1c92a4352e8c8e312655814c3a", null ], + [ "SLRtape7SL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac71b4e558ce9812acd1c32698788b3d5", null ], + [ "SLRtape24", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaae50288f1bc27ecbdd231d4b619bda03", null ], + [ "SLRtape24SL", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa550d3f1120e95e275115fb1ada5d57b2", null ], + [ "SLRtape40", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafa54baa880c94cdddbaefae4074a1b34", null ], + [ "SLRtape50", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4499943c5ef9459fec5c3de548f9f1d8", null ], + [ "SLRtape60", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae4abfd04ae9f10dc26d7b77539c715eb", null ], + [ "SLRtape75", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8512f259791d1a4cbdfc453315de431a", null ], + [ "SLRtape100", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad69ae74d23215fc9bcb7fe4d96782dd2", null ], + [ "SLRtape140", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3af9af50794d3ac7ce09582fe81c6b57", null ], + [ "QIC11", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5cc5213aafae30b6cb8fa683bd876a08", null ], + [ "QIC120", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0c16296ffadfae8862605a452d4997b2", null ], + [ "QIC1350", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafe12a40dbc70411568542f416479cc18", null ], + [ "QIC150", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3a36dabf70b5abb52f88ded5c5dc6794", null ], + [ "QIC24", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1621b26afba7902bc0cd32381f571a94", null ], + [ "QIC3010", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5b5dc92b2fb7629e0fcac28d1e78dfcf", null ], + [ "QIC3020", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5061483c549da83be0ac57c0c7375fa5", null ], + [ "QIC3080", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa95958f9d1b963398ccdd999ed95f3a47", null ], + [ "QIC3095", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8b3ede889a2c476bf558b3b8906c46ed", null ], + [ "QIC320", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa36660d9a9a823609f6aa3aa71e99151c", null ], + [ "QIC40", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa5e5ecadaa1da4cbfb14865a9fe19a0d", null ], + [ "QIC525", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1bdfd3747221a570ecc4e5937cd86448", null ], + [ "QIC80", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaad58b63c87310b4e990c4a3119634c0e", null ], + [ "STK4480", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa80836783afb465434fce8a5d4926608f", null ], + [ "STK4490", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaefd940f05f4db9ed21ed2abb1817697b", null ], + [ "STK9490", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1aee0a945fb952eda9fc59c36ef4bba8", null ], + [ "T9840A", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa8a4c9376bf2bb69077d5c6041830378", null ], + [ "T9840B", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacf27834523e68dec77208663791b97d5", null ], + [ "T9840C", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0d4c387efbbe57faa296e94d09fbfa36", null ], + [ "T9840D", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad3976bf509bc96a9eb48fe3317b8983d", null ], + [ "T9940A", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa87521f0b78dafa236cfc45f7951b04fc", null ], + [ "T9940B", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6c889ce4189a917092a889312ba8cd1e", null ], + [ "T10000A", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae8b7cc03baf3fb313d877ccfdbbb98a1", null ], + [ "T10000B", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaafad79bd3e98b11dcc1e634da4ed555a", null ], + [ "T10000C", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa74c9e610a5c7db0ad8d8ec74246be37f", null ], + [ "T10000D", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae4353df5a39ee6f919b4a0029f4c7957", null ], + [ "Travan", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadc4bc3e46d2619158279110e1e4feae3", null ], + [ "Travan1Ex", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1773f94257858d5cdb89790bffda5d48", null ], + [ "Travan3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8efb27ede835c4aa1fa7639c40f95cf2", null ], + [ "Travan3Ex", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa262b14c1a54d581e2c09bf78f8a2c4aa", null ], + [ "Travan4", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa635d6d35d33db9a95649ab1f9addc20c", null ], + [ "Travan5", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa866fb0281f44c8bc0bcca6ef2032632f", null ], + [ "Travan7", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa051dcd441aad3b51053790d69abd09ba", null ], + [ "VXA1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa55a4f7e253d8b5fc294e5540936b7ec7", null ], + [ "VXA2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa244c30a9b7f3e84cd9bfae375f1a5690", null ], + [ "VXA3", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6f8ed1c2464ec140dd8f3304b3e28e78", null ], + [ "ECMA_153", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa99337ceffff5fe69ce467ad6393d3cfc", null ], + [ "ECMA_153_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad68ca8b18860bda1f809db0d9acd7d2c", null ], + [ "ECMA_154", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1febac19651eaae91c7df1df9836feaa", null ], + [ "ECMA_183_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8ab262e316e693a44cede3fe0580c139", null ], + [ "ECMA_183", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1d6e354725a2de76add2c567be8b5e07", null ], + [ "ECMA_184_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0cee23c32d4450f51469cf75cc6ef4a1", null ], + [ "ECMA_184", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad64e190d144c7eee377ccc76c9333171", null ], + [ "ECMA_189", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa8c77ade87450174b91a273f8896f29b9", null ], + [ "ECMA_190", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aada72c68907744c23734ad247df1f5cc6", null ], + [ "ECMA_195", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa2dbb50c8bfdfb90c403790cc9d87df3", null ], + [ "ECMA_195_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae145d45957d6be5dd4c88a137d198c27", null ], + [ "ECMA_201", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa56e3a761b0ef5ea679460c5f2007d847", null ], + [ "ECMA_201_ROM", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6b66797bd5632463255db2be9e9902a4", null ], + [ "ECMA_223", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa6f0e769c986467a5aefff4f2df91ddc1", null ], + [ "ECMA_223_512", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2c791f737c7486085e3cbd09237275f1", null ], + [ "ECMA_238", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9dcc142c0ec1b4e89bbe14fa091b7c62", null ], + [ "ECMA_239", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3fbd9fef069e8865c86f5abf7ca1200b", null ], + [ "ECMA_260", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa53cc880e322e3dc52c30fb9e477bbdde", null ], + [ "ECMA_260_Double", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaaadcbf5cc426d920448c3e2919c7c80e", null ], + [ "ECMA_280", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafaa23f497d1e74ac566b89461f50d0da", null ], + [ "ECMA_317", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa102a7cecfdfc4f1317355f1df0f2805e", null ], + [ "ECMA_322", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaccbfb5f7540dad197a58f2fe967afe00", null ], + [ "ECMA_322_2k", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa52692eca861ea5488fdada6a9b402b3f", null ], + [ "GigaMo", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa13c75f49713c4f8cc5efbd5081bb9cea", null ], + [ "GigaMo2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aad1b09b8d81bdf543b085d1dd34f35bb0", null ], + [ "CompactFloppy", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa42da310afbad5da41909989ea9cb5570", null ], + [ "DemiDiskette", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa42a9d5c20ebc42267c36e586224ae621", null ], + [ "Floptical", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7167e5fc54a519ec2c5f7997ac8c1180", null ], + [ "HiFD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7641724e47817e4e26f053ee75fc47a0", null ], + [ "QuickDisk", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa24dc9c2ade5fb417845a7df0a22799b4", null ], + [ "UHD144", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9942e74f56903efd79052f5c612a7cc2", null ], + [ "VideoFloppy", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa46854aaca89c8e37ba732a457fc565e8", null ], + [ "Wafer", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aada39e2cfbaaacd700f2f8e6fe011adaa", null ], + [ "ZXMicrodrive", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafef7aa6ae443b430e2ffac2214ec9997", null ], + [ "BeeCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9b1d1e6f2cd08405e6e3edd6a7a38d30", null ], + [ "Borsu", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa39cee35f676a3a5d96a8dba4a032ada2", null ], + [ "DataStore", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0504fd0e8593cdcedfd4031f3791dc52", null ], + [ "DIR", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa68a38057d09a4789d8d25e55adc5b0e6", null ], + [ "DST", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7a1970158a695340fdc76c8424740233", null ], + [ "DTF", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa456c6a125408e92894946f07dbe76a00", null ], + [ "DTF2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa109ed1fbeda1148c6bd5d943da3fc71e", null ], + [ "Flextra3020", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9ed0152cefe8a3e5a9372ec104daeb54", null ], + [ "Flextra3225", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaced988167a2dd863b2a3548c8fb4c67f", null ], + [ "HiTC1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9b3de8c22b9a84ee49915a8403899441", null ], + [ "HiTC2", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae72a3f32d995a51919fe2fb73d542a5a", null ], + [ "LT1", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaec1cb4509dde5be8e137d163ac77f0ec", null ], + [ "MiniCard", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab5217deba208bb2dd48755a7e0e7fb2b", null ], + [ "Orb", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa50682a652359e42ba7cd14ccbff91fc5", null ], + [ "Orb5", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa401ebddb57c769497832259b49907a66", null ], + [ "SmartMedia", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa72a402cd067ee086374a2c41e89d8f7", null ], + [ "xD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaacf39cf18dac209ec45b320f8a210726", null ], + [ "XQD", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa61fd75d164a474174fc6012d7ce86e05", null ], + [ "DataPlay", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aac66b1205176d4e49128f5fccc68cfdcc", null ], + [ "AppleProfile", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0a8ba83da933d4ad284631784a991f19", null ], + [ "AppleWidget", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aacd42dba7780092d737e7d51a3819cb4b", null ], + [ "AppleHD20", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab8fc3997a514404b7d4692a74fb87912", null ], + [ "PriamDataTower", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aab933939a09397f9311004f3dd137226d", null ], + [ "Pippin", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa2b9c5d1501a0eb5198a2f339f4e15d90", null ], + [ "RA60", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4e1cf1850442b5a953df9e05964441a5", null ], + [ "RA80", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa81ee9477ea9220e1f093d394072791ea", null ], + [ "RA81", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa715e4d3d27d9a6967584cfbeb6bf079", null ], + [ "RC25", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadfc004b1209aceeb239af4d51a8d7d95", null ], + [ "RD31", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa85d93d64e980933afd39b40dc783878", null ], + [ "RD32", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3043133bc68a70519b3c03fb1df4e780", null ], + [ "RD51", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa648a3814bc452a2d5ffe7a9a60f64d43", null ], + [ "RD52", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaba6d8523ecbe9c52a5f339cfd9aa2ecb", null ], + [ "RD53", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae64469fd4f91ef4ae5d7503fc03c870a", null ], + [ "RD54", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4d33d7848e526ebb0fd178e643fa3038", null ], + [ "RK06", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5ced7fb4341d51c5198ce4ec8987b2df", null ], + [ "RK06_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9827173c642642dd203f855d6c6d1adc", null ], + [ "RK07", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7f003cb6ed4c1600424bd3a00fc8055e", null ], + [ "RK07_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aadfdac1f5eaf9fbed5661ca3df28876fa", null ], + [ "RM02", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa936d760ac0e916519763d0450806dd5a", null ], + [ "RM03", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa25aebd8c172dd861232a2c489c8785ef", null ], + [ "RM05", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa1d2a8eb500f521f9f1cfc8e0583de1d6", null ], + [ "RP02", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae98f088d98d2faf73eae686e2d25d0b8", null ], + [ "RP02_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa7bf73e7957997bcfb6050aa408d891f7", null ], + [ "RP03", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafe7413a6e07c8d0c37ef9b873c53b98f", null ], + [ "RP03_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aae9ee13649a1f85141e356a4210ab42b0", null ], + [ "RP04", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa5e2955cc0db84f151b7467ed1c3088e8", null ], + [ "RP04_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa4c50ec1a3634ab3af7fb8fe01fe50809", null ], + [ "RP05", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa99305b598cc999d48c336dcbbab4f921", null ], + [ "RP05_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa3174941bc947c0e3a0537e26fea5250d", null ], + [ "RP06", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaea7c773a245ac9e2ceca31b12812571c", null ], + [ "RP06_18", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa83d1cd0765d2af655a54f77bd8130f13", null ], + [ "LS120", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aafd74db0cd680a761348cb49343cada8c", null ], + [ "LS240", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaa63e8439ae8da0a01357f01ab3b55387", null ], + [ "FD32MB", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aaed0c9c46d22555c99d6fbf67ca8dd656", null ], + [ "RDX", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa0358584dab0bc3a6ff014581cf6f4660", null ], + [ "RDX320", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aada9b451a931bf03d4d0f75c0997fa72f", null ], + [ "VideoNow", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa953a27e6a4a41c6d9b9bd0d18feeb12c", null ], + [ "VideoNowColor", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa301beaee119622d402dcfb85a214953b", null ], + [ "VideoNowXp", "group__MediaTypes.html#gga1499e9f8a76cb81b43b7a4b0dbe7e44aa9685c678a93fbc28a9b4dbfee8759405", null ] + ] ] +]; \ No newline at end of file diff --git a/docs/html/group__SectorTags.html b/docs/html/group__SectorTags.html new file mode 100644 index 0000000..f58a6d7 --- /dev/null +++ b/docs/html/group__SectorTags.html @@ -0,0 +1,211 @@ + + + + + + + +libaaruformat: Per-sector metadata tag types + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
Per-sector metadata tag types
+
+
+ +

Optional auxiliary fragments accompanying a raw sector dump. +More...

+ + + +

+Enumerations

enum  SectorTagType {
+  AppleSectorTag = 0 +, CdSectorSync = 1 +, CdSectorHeader = 2 +, CdSectorSubHeader = 3 +,
+  CdSectorEdc = 4 +, CdSectorEccP = 5 +, CdSectorEccQ = 6 +, CdSectorEcc = 7 +,
+  CdSectorSubchannelAaru = 8 +, CdTrackIsrc = 9 +, CdTrackText = 10 +, CdTrackFlags = 11 +,
+  DvdCmi = 12 +, FloppyAddressMark = 13 +, DvdSectorTitleKey = 14 +, DvdTitleKeyDecrypted = 15 +,
+  DvdSectorInformation = 16 +, DvdSectorNumber = 17 +, DvdSectorIedAaru = 18 +, DvdSectorEdcAaru = 19 +,
+  MaxSectorTag = DvdSectorEdcAaru +
+ }
+

Detailed Description

+

Optional auxiliary fragments accompanying a raw sector dump.

+

Sector tags preserve on-disk / on-media structures that are not part of the main user data (sync/header/ECC, etc.). They enable exact reconstruction, verification or advanced analysis (error injection, subchannel decoding, etc.). Retrieval APIs generally expose presence queries and raw byte buffers of fixed size (unless documented as string).

+

Enumeration Type Documentation

+ +

◆ SectorTagType

+ +
+
+ + + + +
enum SectorTagType
+
+ + + + + + + + + + + + + + + + + + + + + + +
Enumerator
AppleSectorTag 

Apple's GCR sector tags, 12 bytes (address prolog + checksum)

+
CdSectorSync 

12-byte CD sync pattern (00 FF*10 00)

+
CdSectorHeader 

4-byte CD header (minute, second, frame, mode)

+
CdSectorSubHeader 

Mode 2 Form subheader (8 bytes: copy, submode, channel)

+
CdSectorEdc 

32-bit CRC (EDC)

+
CdSectorEccP 

172 bytes Reed-Solomon ECC (P)

+
CdSectorEccQ 

104 bytes Reed-Solomon ECC (Q)

+
CdSectorEcc 

Combined P+Q ECC (276 bytes)

+
CdSectorSubchannelAaru 

96 raw subchannel bytes (P-W)

+
CdTrackIsrc 

Track ISRC (12 ASCII chars, no terminator)

+
CdTrackText 

Track text (CD-Text fragment, 13 bytes)

+
CdTrackFlags 

Track flags (audio/data, copy permitted, pre-emphasis)

+
DvdCmi 

DVD Copyright Management Information (CSS)

+
FloppyAddressMark 

Raw address mark & sync preamble (format dependent)

+
DvdSectorTitleKey 

DVD sector title key, 5 bytes.

+
DvdTitleKeyDecrypted 

Decrypted DVD sector title key, 5 bytes.

+
DvdSectorInformation 

DVD sector information, 1 bytes.

+
DvdSectorNumber 

DVD sector number, 3 bytes.

+
DvdSectorIedAaru 

DVD sector ID error detection, 2 bytes.

+
DvdSectorEdcAaru 

DVD sector EDC, 4 bytes.

+
MaxSectorTag 
+ +

Definition at line 894 of file aaru.h.

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/group__SectorTags.js b/docs/html/group__SectorTags.js new file mode 100644 index 0000000..6f1b2b6 --- /dev/null +++ b/docs/html/group__SectorTags.js @@ -0,0 +1,26 @@ +var group__SectorTags = +[ + [ "SectorTagType", "group__SectorTags.html#gaf863e81d172ce7a216d8687a8a23293a", [ + [ "AppleSectorTag", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aacc1f837c03086c6835e55dab021211d1", null ], + [ "CdSectorSync", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aae6cc37af9cad918edf7a402ecac48e9d", null ], + [ "CdSectorHeader", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa1ed658dec0ed38565a2f1420dcdcc2db", null ], + [ "CdSectorSubHeader", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa7807c14140de3beeda2945e17fbf5310", null ], + [ "CdSectorEdc", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa2593a6f3edbbaff37976da9a96363344", null ], + [ "CdSectorEccP", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa3b08c072df1b13b88f0711ea82c8943c", null ], + [ "CdSectorEccQ", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aae96d541a937c6a5c369f6f0bc32f94b3", null ], + [ "CdSectorEcc", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aad5a60e1c8a5550557a2b4a1ae1054c89", null ], + [ "CdSectorSubchannelAaru", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa73586ffdff3f35b8a05b7f8fd37fcee2", null ], + [ "CdTrackIsrc", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa8e35806d5790cb5568b7535073d40179", null ], + [ "CdTrackText", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa560df9ee82c259d8263852474faaf8a8", null ], + [ "CdTrackFlags", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa4922f334e9f6fb030152d093be4bee7c", null ], + [ "DvdCmi", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa7165008ad58fcf7904dc3f6626064828", null ], + [ "FloppyAddressMark", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa440e8a66ac1ffbbae3347b72728da547", null ], + [ "DvdSectorTitleKey", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa667cac95d269113c036dd6ab86530e10", null ], + [ "DvdTitleKeyDecrypted", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aae54bf2b3574266925062218c892c42b2", null ], + [ "DvdSectorInformation", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aaacdc97f5778a26551dae1e003fc5f769", null ], + [ "DvdSectorNumber", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa82265a5d640ce9474f8b357c54cc0440", null ], + [ "DvdSectorIedAaru", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa16bbf88cdbeb1c4bfe44244de7d16c3f", null ], + [ "DvdSectorEdcAaru", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa6d377a28e58b9da5452ab66e90ea4457", null ], + [ "MaxSectorTag", "group__SectorTags.html#ggaf863e81d172ce7a216d8687a8a23293aa81dbcd4677b6377bce5351ad92fc4d64", null ] + ] ] +]; \ No newline at end of file diff --git a/docs/html/hash__map_8c.html b/docs/html/hash__map_8c.html new file mode 100644 index 0000000..84de167 --- /dev/null +++ b/docs/html/hash__map_8c.html @@ -0,0 +1,431 @@ + + + + + + + +libaaruformat: src/ddt/hash_map.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
hash_map.c File Reference
+
+
+
#include <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include "hash_map.h"
+
+

Go to the source code of this file.

+ + + + +

+Macros

#define INITIAL_SIZE   1024
#define LOAD_FACTOR   0.75
+ + + + + + + + + + + +

+Functions

hash_map_tcreate_map (size_t size)
 Creates a new hash map with the specified initial size.
void free_map (hash_map_t *map)
 Frees all memory associated with a hash map.
static void resize_map (hash_map_t *map, size_t new_size)
 Resizes the hash map to a new size and rehashes all entries.
bool insert_map (hash_map_t *map, uint64_t key, uint64_t value)
 Inserts a key-value pair into the hash map.
bool lookup_map (const hash_map_t *map, uint64_t key, uint64_t *out_value)
 Looks up a value by key in the hash map.
+

Macro Definition Documentation

+ +

◆ INITIAL_SIZE

+ +
+
+ + + + +
#define INITIAL_SIZE   1024
+
+ +

Definition at line 25 of file hash_map.c.

+ +
+
+ +

◆ LOAD_FACTOR

+ +
+
+ + + + +
#define LOAD_FACTOR   0.75
+
+ +

Definition at line 26 of file hash_map.c.

+ +

Referenced by insert_map().

+ +
+
+

Function Documentation

+ +

◆ create_map()

+ +
+
+ + + + + + + +
hash_map_t * create_map (size_t size)
+
+ +

Creates a new hash map with the specified initial size.

+

Allocates and initializes a new hash map structure with the given size. The hash map uses open addressing with linear probing for collision resolution. The table is zero-initialized, making empty slots identifiable by having a key value of 0.

+
Parameters
+ + +
sizeInitial size of the hash table. Must be greater than 0.
+
+
+
Returns
Returns a pointer to the newly created hash map, or NULL if allocation fails.
+
Return values
+ + + +
hash_map_t*Successfully created hash map with:
    +
  • Allocated and zero-initialized table of specified size
  • +
  • Size set to the requested value
  • +
  • Count initialized to 0 (empty map)
  • +
+
NULLMemory allocation failed
+
+
+
Note
The caller is responsible for freeing the returned hash map using free_map().
+
+A key value of 0 is reserved to indicate empty slots and cannot be used as a valid key.
+
See also
free_map()
+ +

Definition at line 49 of file hash_map.c.

+ +

References hash_map_t::count, hash_map_t::size, and hash_map_t::table.

+ +

Referenced by aaruf_create().

+ +
+
+ +

◆ free_map()

+ +
+
+ + + + + + + +
void free_map (hash_map_t * map)
+
+ +

Frees all memory associated with a hash map.

+

Deallocates the hash table and the hash map structure itself. After calling this function, the hash map pointer becomes invalid and should not be used.

+
Parameters
+ + +
mapPointer to the hash map to free. Can be NULL (no operation performed).
+
+
+
Note
This function does not free any memory pointed to by the values stored in the map. If the values are dynamically allocated, they must be freed separately before calling this function.
+
See also
create_map()
+ +

Definition at line 73 of file hash_map.c.

+ +

References hash_map_t::table.

+ +

Referenced by aaruf_close(), and cleanup_failed_create().

+ +
+
+ +

◆ insert_map()

+ +
+
+ + + + + + + + + + + + + + + + +
bool insert_map (hash_map_t * map,
uint64_t key,
uint64_t value )
+
+ +

Inserts a key-value pair into the hash map.

+

Adds a new key-value pair to the hash map using open addressing with linear probing for collision resolution. If the key already exists, the insertion fails and returns false. The function automatically resizes the hash table when the load factor exceeds the threshold (0.75) to maintain optimal performance.

+
Parameters
+ + + + +
mapPointer to the hash map. Must not be NULL.
keyThe key to insert. Must not be 0 as this value is reserved for empty slots.
valueThe value to associate with the key.
+
+
+
Returns
Returns the result of the insertion operation.
+
Return values
+ + + +
trueSuccessfully inserted the key-value pair. The map count is incremented.
falseKey already exists in the map. No changes made to the map.
+
+
+
Note
If insertion would exceed the load factor threshold, the hash table is automatically resized to twice its current size before insertion.
+
+Time complexity: O(1) average case, O(n) worst case with poor hash distribution.
+
+Space complexity: O(1) unless resizing occurs, in which case it's O(n).
+
Warning
Using 0 as a key value will result in undefined behavior as 0 is reserved for marking empty slots.
+
+If memory allocation fails during automatic resizing, the program may terminate.
+
See also
lookup_map()
+
+resize_map()
+ +

Definition at line 153 of file hash_map.c.

+ +

References hash_map_t::count, kv_pair_t::key, LOAD_FACTOR, resize_map(), hash_map_t::size, hash_map_t::table, and kv_pair_t::value.

+ +

Referenced by aaruf_write_sector().

+ +
+
+ +

◆ lookup_map()

+ +
+
+ + + + + + + + + + + + + + + + +
bool lookup_map (const hash_map_t * map,
uint64_t key,
uint64_t * out_value )
+
+ +

Looks up a value by key in the hash map.

+

Searches for the specified key in the hash map and retrieves its associated value. Uses linear probing to handle collisions during the search. The function does not modify the hash map in any way.

+
Parameters
+ + + + +
mapPointer to the hash map to search. Must not be NULL.
keyThe key to search for. Must not be 0.
out_valuePointer to store the found value. Must not be NULL. Only modified if the key is found.
+
+
+
Returns
Returns whether the key was found in the map.
+
Return values
+ + + +
trueKey found. The associated value is written to *out_value.
falseKey not found. *out_value is not modified.
+
+
+
Note
Time complexity: O(1) average case, O(n) worst case with poor hash distribution or high load factor.
+
+The function is read-only and does not modify the hash map structure.
+
+Searching for key value 0 will always return false as 0 indicates empty slots.
+
Warning
The out_value parameter must point to valid memory location. Passing NULL will result in undefined behavior.
+
See also
insert_map()
+ +

Definition at line 196 of file hash_map.c.

+ +

References kv_pair_t::key, hash_map_t::size, hash_map_t::table, and kv_pair_t::value.

+ +

Referenced by aaruf_write_sector().

+ +
+
+ +

◆ resize_map()

+ +
+
+ + + + + +
+ + + + + + + + + + + +
void resize_map (hash_map_t * map,
size_t new_size )
+
+static
+
+ +

Resizes the hash map to a new size and rehashes all entries.

+

This is an internal function that creates a new hash table with the specified size, rehashes all existing key-value pairs from the old table, and replaces the old table with the new one. This operation is automatically triggered when the load factor exceeds the threshold during insertion.

+
Parameters
+ + + +
mapPointer to the hash map to resize. Must not be NULL.
new_sizeNew size for the hash table. Should be larger than the current size for optimal performance.
+
+
+
Note
This is a static (internal) function and should not be called directly.
+
+The function preserves all existing key-value pairs during the resize operation.
+
+After resizing, the physical positions of entries in the table will change, but the logical key-value mappings remain intact.
+
+The old table is automatically freed after successful migration.
+
Warning
If memory allocation for the new table fails, the program may terminate.
+
See also
insert_map()
+ +

Definition at line 101 of file hash_map.c.

+ +

References hash_map_t::count, kv_pair_t::key, hash_map_t::size, and hash_map_t::table.

+ +

Referenced by insert_map().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/hash__map_8c.js b/docs/html/hash__map_8c.js new file mode 100644 index 0000000..a744daf --- /dev/null +++ b/docs/html/hash__map_8c.js @@ -0,0 +1,10 @@ +var hash__map_8c = +[ + [ "INITIAL_SIZE", "hash__map_8c.html#a40958a1382463445e451148e3a93e049", null ], + [ "LOAD_FACTOR", "hash__map_8c.html#a846f78d98a30c431ef3a4d570e657913", null ], + [ "create_map", "hash__map_8c.html#a4698f62d88ee9530fb93bf672455676f", null ], + [ "free_map", "hash__map_8c.html#ab885e8c5bedaf6f3cca1877e378fd04f", null ], + [ "insert_map", "hash__map_8c.html#a56a11edd19b5362f1dd719a11c06f892", null ], + [ "lookup_map", "hash__map_8c.html#a0719b4ee8aaa73765678b6b1db733fcd", null ], + [ "resize_map", "hash__map_8c.html#ad662d4309e791d854bc7a788b1cddf34", null ] +]; \ No newline at end of file diff --git a/docs/html/hash__map_8c_source.html b/docs/html/hash__map_8c_source.html new file mode 100644 index 0000000..92e309d --- /dev/null +++ b/docs/html/hash__map_8c_source.html @@ -0,0 +1,231 @@ + + + + + + + +libaaruformat: src/ddt/hash_map.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
hash_map.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <stdbool.h>
+
20#include <stdint.h>
+
21#include <stdlib.h>
+
22
+
23#include "hash_map.h"
+
24
+
25#define INITIAL_SIZE 1024
+
26#define LOAD_FACTOR 0.75
+
27
+
+ +
50{
+
51 hash_map_t *map = malloc(sizeof(hash_map_t));
+
52 map->table = calloc(size, sizeof(kv_pair_t));
+
53 map->size = size;
+
54 map->count = 0;
+
55
+
56 return map;
+
57}
+
+
58
+
+ +
74{
+
75 free(map->table);
+
76 free(map);
+
77}
+
+
78
+
+
101static void resize_map(hash_map_t *map, size_t new_size)
+
102{
+
103 kv_pair_t *old_table = map->table;
+
104 size_t old_size = map->size;
+
105
+
106 map->table = calloc(new_size, sizeof(kv_pair_t));
+
107 map->size = new_size;
+
108 map->count = 0;
+
109
+
110 for(size_t i = 0; i < old_size; i++)
+
111 if(old_table[i].key != 0)
+
112 {
+
113 // Re-insert
+
114 size_t idx = old_table[i].key % new_size;
+
115
+
116 while(map->table[idx].key != 0) idx = (idx + 1) % new_size;
+
117
+
118 map->table[idx] = old_table[i];
+
119 map->count++;
+
120 }
+
121
+
122 free(old_table);
+
123}
+
+
124
+
+
153bool insert_map(hash_map_t *map, uint64_t key, uint64_t value)
+
154{
+
155 if((double)map->count / map->size > LOAD_FACTOR) resize_map(map, map->size * 2);
+
156
+
157 size_t idx = key % map->size;
+
158
+
159 while(map->table[idx].key != 0 && map->table[idx].key != key) idx = (idx + 1) % map->size;
+
160
+
161 if(map->table[idx].key == key) return false; // Already present
+
162
+
163 map->table[idx].key = key;
+
164 map->table[idx].value = value;
+
165 map->count++;
+
166
+
167 return true;
+
168}
+
+
169
+
+
196bool lookup_map(const hash_map_t *map, uint64_t key, uint64_t *out_value)
+
197{
+
198 size_t idx = key % map->size;
+
199
+
200 while(map->table[idx].key != 0)
+
201 {
+
202 if(map->table[idx].key == key)
+
203 {
+
204 *out_value = map->table[idx].value;
+
205 return true;
+
206 }
+
207
+
208 idx = (idx + 1) % map->size;
+
209 }
+
210
+
211 return false;
+
212}
+
+
bool lookup_map(const hash_map_t *map, uint64_t key, uint64_t *out_value)
Looks up a value by key in the hash map.
Definition hash_map.c:196
+
hash_map_t * create_map(size_t size)
Creates a new hash map with the specified initial size.
Definition hash_map.c:49
+
bool insert_map(hash_map_t *map, uint64_t key, uint64_t value)
Inserts a key-value pair into the hash map.
Definition hash_map.c:153
+
#define LOAD_FACTOR
Definition hash_map.c:26
+
void free_map(hash_map_t *map)
Frees all memory associated with a hash map.
Definition hash_map.c:73
+
static void resize_map(hash_map_t *map, size_t new_size)
Resizes the hash map to a new size and rehashes all entries.
Definition hash_map.c:101
+ +
Minimal open-addressing hash map for 64-bit key/value pairs used in deduplication lookup.
Definition hash_map.h:50
+
size_t count
Number of active (filled) entries.
Definition hash_map.h:53
+
size_t size
Allocated slot capacity of table.
Definition hash_map.h:52
+
kv_pair_t * table
Array of key/value slots of length == size.
Definition hash_map.h:51
+
Single key/value slot used internally by the open-addressing hash map.
Definition hash_map.h:33
+
uint64_t value
Associated value payload (64-bit) stored alongside the key.
Definition hash_map.h:35
+
uint64_t key
Stored key (64-bit). May use a reserved sentinel to denote an empty slot.
Definition hash_map.h:34
+
+
+
+ + + + diff --git a/docs/html/hash__map_8h.html b/docs/html/hash__map_8h.html new file mode 100644 index 0000000..c9485f6 --- /dev/null +++ b/docs/html/hash__map_8h.html @@ -0,0 +1,340 @@ + + + + + + + +libaaruformat: include/aaruformat/hash_map.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
hash_map.h File Reference
+
+
+
#include <stdbool.h>
+#include <stdlib.h>
+
+

Go to the source code of this file.

+ + + + + + +

+Data Structures

struct  kv_pair_t
 Single key/value slot used internally by the open-addressing hash map. More...
struct  hash_map_t
 Minimal open-addressing hash map for 64-bit key/value pairs used in deduplication lookup. More...
+ + + + + + + + + +

+Functions

hash_map_tcreate_map (size_t size)
 Creates a new hash map with the specified initial size.
void free_map (hash_map_t *map)
 Frees all memory associated with a hash map.
bool insert_map (hash_map_t *map, uint64_t key, uint64_t value)
 Inserts a key-value pair into the hash map.
bool lookup_map (const hash_map_t *map, uint64_t key, uint64_t *out_value)
 Looks up a value by key in the hash map.
+

Function Documentation

+ +

◆ create_map()

+ +
+
+ + + + + + + +
hash_map_t * create_map (size_t size)
+
+ +

Creates a new hash map with the specified initial size.

+

Allocates and initializes a new hash map structure with the given size. The hash map uses open addressing with linear probing for collision resolution. The table is zero-initialized, making empty slots identifiable by having a key value of 0.

+
Parameters
+ + +
sizeInitial size of the hash table. Must be greater than 0.
+
+
+
Returns
Returns a pointer to the newly created hash map, or NULL if allocation fails.
+
Return values
+ + + +
hash_map_t*Successfully created hash map with:
    +
  • Allocated and zero-initialized table of specified size
  • +
  • Size set to the requested value
  • +
  • Count initialized to 0 (empty map)
  • +
+
NULLMemory allocation failed
+
+
+
Note
The caller is responsible for freeing the returned hash map using free_map().
+
+A key value of 0 is reserved to indicate empty slots and cannot be used as a valid key.
+
See also
free_map()
+ +

Definition at line 49 of file hash_map.c.

+ +

References hash_map_t::count, hash_map_t::size, and hash_map_t::table.

+ +

Referenced by aaruf_create().

+ +
+
+ +

◆ free_map()

+ +
+
+ + + + + + + +
void free_map (hash_map_t * map)
+
+ +

Frees all memory associated with a hash map.

+

Deallocates the hash table and the hash map structure itself. After calling this function, the hash map pointer becomes invalid and should not be used.

+
Parameters
+ + +
mapPointer to the hash map to free. Can be NULL (no operation performed).
+
+
+
Note
This function does not free any memory pointed to by the values stored in the map. If the values are dynamically allocated, they must be freed separately before calling this function.
+
See also
create_map()
+ +

Definition at line 73 of file hash_map.c.

+ +

References hash_map_t::table.

+ +

Referenced by aaruf_close(), and cleanup_failed_create().

+ +
+
+ +

◆ insert_map()

+ +
+
+ + + + + + + + + + + + + + + + +
bool insert_map (hash_map_t * map,
uint64_t key,
uint64_t value )
+
+ +

Inserts a key-value pair into the hash map.

+

Adds a new key-value pair to the hash map using open addressing with linear probing for collision resolution. If the key already exists, the insertion fails and returns false. The function automatically resizes the hash table when the load factor exceeds the threshold (0.75) to maintain optimal performance.

+
Parameters
+ + + + +
mapPointer to the hash map. Must not be NULL.
keyThe key to insert. Must not be 0 as this value is reserved for empty slots.
valueThe value to associate with the key.
+
+
+
Returns
Returns the result of the insertion operation.
+
Return values
+ + + +
trueSuccessfully inserted the key-value pair. The map count is incremented.
falseKey already exists in the map. No changes made to the map.
+
+
+
Note
If insertion would exceed the load factor threshold, the hash table is automatically resized to twice its current size before insertion.
+
+Time complexity: O(1) average case, O(n) worst case with poor hash distribution.
+
+Space complexity: O(1) unless resizing occurs, in which case it's O(n).
+
Warning
Using 0 as a key value will result in undefined behavior as 0 is reserved for marking empty slots.
+
+If memory allocation fails during automatic resizing, the program may terminate.
+
See also
lookup_map()
+
+resize_map()
+ +

Definition at line 153 of file hash_map.c.

+ +

References hash_map_t::count, kv_pair_t::key, LOAD_FACTOR, resize_map(), hash_map_t::size, hash_map_t::table, and kv_pair_t::value.

+ +

Referenced by aaruf_write_sector().

+ +
+
+ +

◆ lookup_map()

+ +
+
+ + + + + + + + + + + + + + + + +
bool lookup_map (const hash_map_t * map,
uint64_t key,
uint64_t * out_value )
+
+ +

Looks up a value by key in the hash map.

+

Searches for the specified key in the hash map and retrieves its associated value. Uses linear probing to handle collisions during the search. The function does not modify the hash map in any way.

+
Parameters
+ + + + +
mapPointer to the hash map to search. Must not be NULL.
keyThe key to search for. Must not be 0.
out_valuePointer to store the found value. Must not be NULL. Only modified if the key is found.
+
+
+
Returns
Returns whether the key was found in the map.
+
Return values
+ + + +
trueKey found. The associated value is written to *out_value.
falseKey not found. *out_value is not modified.
+
+
+
Note
Time complexity: O(1) average case, O(n) worst case with poor hash distribution or high load factor.
+
+The function is read-only and does not modify the hash map structure.
+
+Searching for key value 0 will always return false as 0 indicates empty slots.
+
Warning
The out_value parameter must point to valid memory location. Passing NULL will result in undefined behavior.
+
See also
insert_map()
+ +

Definition at line 196 of file hash_map.c.

+ +

References kv_pair_t::key, hash_map_t::size, hash_map_t::table, and kv_pair_t::value.

+ +

Referenced by aaruf_write_sector().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/hash__map_8h.js b/docs/html/hash__map_8h.js new file mode 100644 index 0000000..4f02477 --- /dev/null +++ b/docs/html/hash__map_8h.js @@ -0,0 +1,9 @@ +var hash__map_8h = +[ + [ "kv_pair_t", "structkv__pair__t.html", "structkv__pair__t" ], + [ "hash_map_t", "structhash__map__t.html", "structhash__map__t" ], + [ "create_map", "hash__map_8h.html#a4698f62d88ee9530fb93bf672455676f", null ], + [ "free_map", "hash__map_8h.html#ab885e8c5bedaf6f3cca1877e378fd04f", null ], + [ "insert_map", "hash__map_8h.html#a56a11edd19b5362f1dd719a11c06f892", null ], + [ "lookup_map", "hash__map_8h.html#a0719b4ee8aaa73765678b6b1db733fcd", null ] +]; \ No newline at end of file diff --git a/docs/html/hash__map_8h_source.html b/docs/html/hash__map_8h_source.html new file mode 100644 index 0000000..7309205 --- /dev/null +++ b/docs/html/hash__map_8h_source.html @@ -0,0 +1,164 @@ + + + + + + + +libaaruformat: include/aaruformat/hash_map.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
hash_map.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_HASH_MAP_H
+
20#define LIBAARUFORMAT_HASH_MAP_H
+
21
+
22#include <stdbool.h>
+
23#include <stdlib.h>
+
24
+
+
32typedef struct
+
33{
+
34 uint64_t key;
+
35 uint64_t value;
+
36} kv_pair_t;
+
+
37
+
+
49typedef struct
+
50{
+ +
52 size_t size;
+
53 size_t count;
+ +
+
55
+
56hash_map_t *create_map(size_t size);
+
57void free_map(hash_map_t *map);
+
58bool insert_map(hash_map_t *map, uint64_t key, uint64_t value);
+
59bool lookup_map(const hash_map_t *map, uint64_t key, uint64_t *out_value);
+
60
+
61#endif // LIBAARUFORMAT_HASH_MAP_H
+
bool lookup_map(const hash_map_t *map, uint64_t key, uint64_t *out_value)
Looks up a value by key in the hash map.
Definition hash_map.c:196
+
hash_map_t * create_map(size_t size)
Creates a new hash map with the specified initial size.
Definition hash_map.c:49
+
bool insert_map(hash_map_t *map, uint64_t key, uint64_t value)
Inserts a key-value pair into the hash map.
Definition hash_map.c:153
+
void free_map(hash_map_t *map)
Frees all memory associated with a hash map.
Definition hash_map.c:73
+
Minimal open-addressing hash map for 64-bit key/value pairs used in deduplication lookup.
Definition hash_map.h:50
+
size_t count
Number of active (filled) entries.
Definition hash_map.h:53
+
size_t size
Allocated slot capacity of table.
Definition hash_map.h:52
+
kv_pair_t * table
Array of key/value slots of length == size.
Definition hash_map.h:51
+
Single key/value slot used internally by the open-addressing hash map.
Definition hash_map.h:33
+
uint64_t value
Associated value payload (64-bit) stored alongside the key.
Definition hash_map.h:35
+
uint64_t key
Stored key (64-bit). May use a reserved sentinel to denote an empty slot.
Definition hash_map.h:34
+
+
+
+ + + + diff --git a/docs/html/header_8h.html b/docs/html/header_8h.html new file mode 100644 index 0000000..7b0015f --- /dev/null +++ b/docs/html/header_8h.html @@ -0,0 +1,235 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/header.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
header.h File Reference
+
+
+ +

On-disk container header structures (v1 and v2) for Aaru images. +More...

+ +

Go to the source code of this file.

+ + + + + + +

+Data Structures

struct  AaruHeader
 Version 1 container header placed at offset 0 for legacy / initial format. More...
struct  AaruHeaderV2
 Version 2 container header with GUID, alignment shifts, and feature negotiation bitmaps. More...
+ + + + + +

+Macros

#define AARU_HEADER_APP_NAME_LEN   64
 Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).
#define GUID_SIZE   16
 Size in bytes of GUID / UUID-like binary identifier.
+ + + +

+Typedefs

typedef struct AaruHeader AaruHeader
typedef struct AaruHeaderV2 AaruHeaderV2
+

Detailed Description

+

On-disk container header structures (v1 and v2) for Aaru images.

+

These packed headers appear at the very beginning (offset 0) of every Aaru image file and advertise container format version, creator application, indexing offset and optional extended feature capability bitfields (v2+). All multi-byte integers are little-endian. Strings stored in the fixed-size application field are UTF‑16LE and zero padded (not necessarily NUL-terminated if fully filled). The GUID field (v2) allows derivative / child images to reference an origin.

+

Version progression:

    +
  • v1: AaruHeader (no GUID, no alignment or shift metadata, no feature bitfields).
  • +
  • v2: AaruHeaderV2 introduces GUID, block/data/table shift hints (mirroring DDT metadata), and three 64‑bit feature bitmaps to negotiate reader/writer compatibility.
  • +
+

Compatibility handling (recommended logic for consumers):

    +
  1. If any bit set in featureIncompatible is not implemented by the reader: abort (cannot safely read/write).
  2. +
  3. Else if any bit set in featureCompatibleRo is not implemented: allow read‑only operations.
  4. +
  5. Bits only present in featureCompatible but not implemented MAY be ignored for both read/write while still preserving round‑trip capability (writer should not clear unknown bits when re‑saving).
  6. +
+

Alignment & shift semantics (duplicated here for quick reference, see DdtHeader2 for full details):

    +
  • blockAlignmentShift: underlying blocks are aligned to 2^blockAlignmentShift bytes.
  • +
  • dataShift: data pointer / DDT entry low bits encode offsets modulo 2^dataShift sectors/items.
  • +
  • tableShift: primary DDT entries span 2^tableShift logical sectors (0 implies single-level tables).
  • +
+

Invariants:

    +
  • identifier == AARU_MAGIC (external constant; not defined here).
  • +
  • For v1: sizeof(AaruHeader) exact and indexOffset > 0 (indexOffset == 0 => corrupt/unreadable image).
  • +
  • For v2: sizeof(AaruHeaderV2) exact; indexOffset > 0; blockAlignmentShift, dataShift, tableShift within sane bounds (e.g. < 63). Zero is permissible only for the shift fields (not for indexOffset).
  • +
+

Security / robustness considerations:

    +
  • Always bounds-check indexOffset against file size before seeking.
  • +
  • Treat application field as untrusted UTF‑16LE; validate surrogate pairs if necessary.
  • +
  • Unknown feature bits MUST be preserved if a file is rewritten to avoid capability loss.
  • +
+ +

Definition in file header.h.

+

Macro Definition Documentation

+ +

◆ AARU_HEADER_APP_NAME_LEN

+ +
+
+ + + + +
#define AARU_HEADER_APP_NAME_LEN   64
+
+ +

Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).

+ +

Definition at line 59 of file header.h.

+ +

Referenced by aaruf_create(), and aaruf_open().

+ +
+
+ +

◆ GUID_SIZE

+ +
+
+ + + + +
#define GUID_SIZE   16
+
+ +

Size in bytes of GUID / UUID-like binary identifier.

+ +

Definition at line 60 of file header.h.

+ +
+
+

Typedef Documentation

+ +

◆ AaruHeader

+ +
+
+ + + + +
typedef struct AaruHeader AaruHeader
+
+ +
+
+ +

◆ AaruHeaderV2

+ +
+
+ + + + +
typedef struct AaruHeaderV2 AaruHeaderV2
+
+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/header_8h.js b/docs/html/header_8h.js new file mode 100644 index 0000000..348ab5d --- /dev/null +++ b/docs/html/header_8h.js @@ -0,0 +1,9 @@ +var header_8h = +[ + [ "AaruHeader", "structAaruHeader.html", "structAaruHeader" ], + [ "AaruHeaderV2", "structAaruHeaderV2.html", "structAaruHeaderV2" ], + [ "AARU_HEADER_APP_NAME_LEN", "header_8h.html#ab17964dacc36dca03ec5e75aa40a4502", null ], + [ "GUID_SIZE", "header_8h.html#a57c99b24137b82f12950e79ffbd2fb7a", null ], + [ "AaruHeader", "header_8h.html#a92b4759381b275f18e8d66617bcefdfa", null ], + [ "AaruHeaderV2", "header_8h.html#a369effc2c0aea490cf0309c686ce54c6", null ] +]; \ No newline at end of file diff --git a/docs/html/header_8h_source.html b/docs/html/header_8h_source.html new file mode 100644 index 0000000..31b8dcb --- /dev/null +++ b/docs/html/header_8h_source.html @@ -0,0 +1,206 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/header.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
header.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_HEADER_H
+
20#define LIBAARUFORMAT_HEADER_H
+
21
+
58
+
59#define AARU_HEADER_APP_NAME_LEN 64
+
60#define GUID_SIZE 16
+
61
+
62#pragma pack(push, 1)
+
63
+
+
76typedef struct AaruHeader
+
77{
+
78 uint64_t identifier;
+ + + + + +
84 uint32_t mediaType;
+
85 uint64_t indexOffset;
+
86 int64_t creationTime;
+ + +
+
89
+ +
126
+
127#pragma pack(pop)
+
128
+
129#endif // LIBAARUFORMAT_HEADER_H
+
#define GUID_SIZE
Size in bytes of GUID / UUID-like binary identifier.
Definition header.h:60
+
#define AARU_HEADER_APP_NAME_LEN
Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).
Definition header.h:59
+
Version 2 container header with GUID, alignment shifts, and feature negotiation bitmaps.
Definition header.h:107
+
uint8_t application[64]
UTF-16LE creator application name (fixed 64 bytes).
Definition header.h:109
+
uint8_t applicationMajorVersion
Creator application major version.
Definition header.h:112
+
uint64_t identifier
File magic (AARU_MAGIC).
Definition header.h:108
+
uint8_t tableShift
log2 sectors spanned by each primary DDT entry (0 = single-level).
Definition header.h:121
+
uint64_t featureIncompatible
Feature bits: any unimplemented -> abort (cannot open safely).
Definition header.h:124
+
int64_t lastWrittenTime
Last modification FILETIME (100 ns since 1601-01-01 UTC).
Definition header.h:117
+
uint64_t featureCompatible
Feature bits: unimplemented bits are ignorable (still R/W safe).
Definition header.h:122
+
uint64_t indexOffset
Absolute byte offset to primary index block (MUST be > 0; 0 => corrupt/unreadable).
Definition header.h:115
+
uint8_t dataShift
log2 sectors/items per block-index increment in DDT entries (2^dataShift).
Definition header.h:120
+
uint8_t applicationMinorVersion
Creator application minor / patch version.
Definition header.h:113
+
uint8_t guid[16]
128-bit image GUID (binary, not text); stable across children.
Definition header.h:118
+
uint32_t mediaType
Media type enumeration (value from MediaType).
Definition header.h:114
+
uint64_t featureCompatibleRo
Feature bits: unimplemented -> degrade to read-only access.
Definition header.h:123
+
uint8_t blockAlignmentShift
log2 block alignment (block size alignment = 2^blockAlignmentShift bytes).
Definition header.h:119
+
uint8_t imageMinorVersion
Container format minor version.
Definition header.h:111
+
int64_t creationTime
Creation FILETIME (100 ns since 1601-01-01 UTC).
Definition header.h:116
+
uint8_t imageMajorVersion
Container format major version.
Definition header.h:110
+
Version 1 container header placed at offset 0 for legacy / initial format.
Definition header.h:77
+
int64_t lastWrittenTime
Last modification FILETIME (100 ns since 1601-01-01 UTC).
Definition header.h:87
+
uint8_t applicationMinorVersion
Creator application minor / patch version.
Definition header.h:83
+
uint8_t applicationMajorVersion
Creator application major version.
Definition header.h:82
+
uint8_t application[64]
UTF-16LE creator application name (fixed-size buffer).
Definition header.h:79
+
uint8_t imageMajorVersion
Container format major version (incompatible changes when incremented).
Definition header.h:80
+
uint8_t imageMinorVersion
Container format minor version (backward compatible evolutions).
Definition header.h:81
+
uint64_t indexOffset
Absolute byte offset to primary index block (MUST be > 0; 0 => corrupt/unreadable).
Definition header.h:85
+
uint32_t mediaType
Media type enumeration (value from MediaType).
Definition header.h:84
+
uint64_t identifier
File magic (AARU_MAGIC).
Definition header.h:78
+
int64_t creationTime
Creation FILETIME (100 ns since 1601-01-01 UTC).
Definition header.h:86
+
+
+
+ + + + diff --git a/docs/html/helpers_8c.html b/docs/html/helpers_8c.html new file mode 100644 index 0000000..de69958 --- /dev/null +++ b/docs/html/helpers_8c.html @@ -0,0 +1,256 @@ + + + + + + + +libaaruformat: src/helpers.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
helpers.c File Reference
+
+
+
#include <aaru.h>
+#include <aaruformat.h>
+
+

Go to the source code of this file.

+ + + + + + + + + +

+Functions

int32_t aaruf_get_media_tag_type_for_datatype (const int32_t type)
 Converts an image data type to an Aaru media tag type.
int32_t aaruf_get_datatype_for_media_tag_type (const int32_t tag_type)
 Converts an Aaru media tag type to an image data type.
int32_t aaruf_get_xml_mediatype (const int32_t type)
int compare_extents (const void *a, const void *b)
 Comparison function for sorting DumpExtent arrays by start sector.
+

Function Documentation

+ +

◆ aaruf_get_datatype_for_media_tag_type()

+ +
+
+ + + + + + + +
int32_t aaruf_get_datatype_for_media_tag_type (const int32_t tag_type)
+
+ +

Converts an Aaru media tag type to an image data type.

+

Maps the given Aaru media tag type to the corresponding image data type. This is the inverse function of aaruf_get_media_tag_type_for_datatype.

+
Parameters
+ + +
tag_typeAaru media tag type identifier.
+
+
+
Returns
Corresponding image data type, or -1 if not found.
+ +

Definition at line 189 of file helpers.c.

+ +

References AACS_CPRM_MKB, AACS_DataKeys, AACS_LBAExtents, AACS_MediaIdentifier, AACS_MKB, AACS_SerialNumber, AACS_VolumeIdentifier, AacsDataKeys, AacsLbaExtents, AacsMediaIdentifier, AacsMediaKeyBlock, AacsSerialNumber, AacsVolumeIdentifier, ATA_IDENTIFY, AtaIdentify, ATAPI_IDENTIFY, AtapiIdentify, BD_BCA, BD_CartridgeStatus, BD_DDS, BD_DI, BD_SpareArea, BlurayBca, BlurayCartridgeStatus, BlurayDds, BlurayDi, BluraySpareArea, CD_ATIP, CD_FirstTrackPregap, CD_FullTOC, CD_LeadIn, CD_LeadOut, CD_MCN, CD_PMA, CD_SessionInfo, CD_TEXT, CD_TOC, CompactDiscAtip, CompactDiscFirstTrackPregap, CompactDiscLeadIn, CompactDiscLeadInCdText, CompactDiscLeadOut, CompactDiscMediaCatalogueNumber, CompactDiscPartialToc, CompactDiscPma, CompactDiscSessionInfo, CompactDiscToc, CprmMediaKeyBlock, DCB, DVD_ADIP, DVD_BCA, DVD_CMI, DVD_DiscKey, DVD_DiscKey_Decrypted, DVD_DMI, DVD_MediaIdentifier, DVD_MKB, DVD_PFI, DvdAdip, DvdBca, DvdDiscControlBlock, DvdDiscKey, DvdDiscKeyDecrypted, DVDDL_JumpIntervalSize, DVDDL_LayerCapacity, DVDDL_ManualLayerJumpLBA, DVDDL_MiddleZoneAddress, DvdDlJumpIntervalSize, DvdDlLayerCapacity, DvdDlManualLayerJumpLba, DvdDlMiddleZoneAddress, DvdDmi, DvdLeadInCmi, DvdMediaIdentifier, DvdMediaKeyBlock, DvdPfi, DVDR_MediaIdentifier, DVDR_PFI, DVDR_PreRecordedInfo, DVDR_RMD, DVDRAM_DDS, DVDRAM_MediumStatus, DVDRAM_SpareArea, DvdRamDds, DvdRamMediumStatus, DvdRamSpareArea, DvdRMediaIdentifier, DvdRPfi, DvdRPrerecordedInfo, DvdRRmd, Floppy_LeadOut, FloppyLeadOut, HDDVD_CPI, HDDVD_MediumStatus, HdDvdCpi, HdDvdMediumStatus, Hybrid_RecognizedLayers, HybridRecognizedLayers, MMC_CID, MMC_CSD, MMC_DiscInformation, MMC_ExtendedCSD, MMC_OCR, MMC_POWResourcesInformation, MMC_TrackResourcesInformation, MMC_WriteProtection, MultiMediaCardCid, MultiMediaCardCsd, MultiMediaCardExtendedCsd, MultiMediaCardOcr, PCMCIA_CIS, PcmciaCis, SCSI_INQUIRY, SCSI_MODEPAGE_2A, SCSI_MODESENSE_10, SCSI_MODESENSE_6, ScsiInquiry, ScsiMmcDiscInformation, ScsiMmcPowResourcesInformation, ScsiMmcTrackResourcesInformation, ScsiMmcWriteProtection, ScsiModePage2A, ScsiModeSense10, ScsiModeSense6, SD_CID, SD_CSD, SD_OCR, SD_SCR, SecureDigitalCid, SecureDigitalCsd, SecureDigitalOcr, SecureDigitalScr, USB_Descriptors, UsbDescriptors, Xbox_DMI, Xbox_PFI, Xbox_SecuritySector, XboxDmi, XboxPfi, and XboxSecuritySector.

+ +

Referenced by write_media_tags().

+ +
+
+ +

◆ aaruf_get_media_tag_type_for_datatype()

+ +
+
+ + + + + + + +
int32_t aaruf_get_media_tag_type_for_datatype (const int32_t type)
+
+ +

Converts an image data type to an Aaru media tag type.

+

Maps the given image data type to the corresponding Aaru media tag type.

+
Parameters
+ + +
typeImage data type identifier.
+
+
+
Returns
Corresponding Aaru media tag type, or -1 if not found.
+ +

Definition at line 31 of file helpers.c.

+ +

References AACS_CPRM_MKB, AACS_DataKeys, AACS_LBAExtents, AACS_MediaIdentifier, AACS_MKB, AACS_SerialNumber, AACS_VolumeIdentifier, AacsDataKeys, AacsLbaExtents, AacsMediaIdentifier, AacsMediaKeyBlock, AacsSerialNumber, AacsVolumeIdentifier, ATA_IDENTIFY, AtaIdentify, ATAPI_IDENTIFY, AtapiIdentify, BD_BCA, BD_CartridgeStatus, BD_DDS, BD_DI, BD_SpareArea, BlurayBca, BlurayCartridgeStatus, BlurayDds, BlurayDi, BluraySpareArea, CD_ATIP, CD_FirstTrackPregap, CD_FullTOC, CD_LeadIn, CD_LeadOut, CD_MCN, CD_PMA, CD_SessionInfo, CD_TEXT, CD_TOC, CompactDiscAtip, CompactDiscFirstTrackPregap, CompactDiscLeadIn, CompactDiscLeadInCdText, CompactDiscLeadOut, CompactDiscMediaCatalogueNumber, CompactDiscPartialToc, CompactDiscPma, CompactDiscSessionInfo, CompactDiscToc, CprmMediaKeyBlock, DCB, DVD_ADIP, DVD_BCA, DVD_CMI, DVD_DiscKey, DVD_DiscKey_Decrypted, DVD_DMI, DVD_MediaIdentifier, DVD_MKB, DVD_PFI, DvdAdip, DvdBca, DvdDiscControlBlock, DvdDiscKey, DvdDiscKeyDecrypted, DVDDL_JumpIntervalSize, DVDDL_LayerCapacity, DVDDL_ManualLayerJumpLBA, DVDDL_MiddleZoneAddress, DvdDlJumpIntervalSize, DvdDlLayerCapacity, DvdDlManualLayerJumpLba, DvdDlMiddleZoneAddress, DvdDmi, DvdLeadInCmi, DvdMediaIdentifier, DvdMediaKeyBlock, DvdPfi, DVDR_MediaIdentifier, DVDR_PFI, DVDR_PreRecordedInfo, DVDR_RMD, DVDRAM_DDS, DVDRAM_MediumStatus, DVDRAM_SpareArea, DvdRamDds, DvdRamMediumStatus, DvdRamSpareArea, DvdRMediaIdentifier, DvdRPfi, DvdRPrerecordedInfo, DvdRRmd, Floppy_LeadOut, FloppyLeadOut, HDDVD_CPI, HDDVD_MediumStatus, HdDvdCpi, HdDvdMediumStatus, Hybrid_RecognizedLayers, HybridRecognizedLayers, MMC_CID, MMC_CSD, MMC_DiscInformation, MMC_ExtendedCSD, MMC_OCR, MMC_POWResourcesInformation, MMC_TrackResourcesInformation, MMC_WriteProtection, MultiMediaCardCid, MultiMediaCardCsd, MultiMediaCardExtendedCsd, MultiMediaCardOcr, PCMCIA_CIS, PcmciaCis, SCSI_INQUIRY, SCSI_MODEPAGE_2A, SCSI_MODESENSE_10, SCSI_MODESENSE_6, ScsiInquiry, ScsiMmcDiscInformation, ScsiMmcPowResourcesInformation, ScsiMmcTrackResourcesInformation, ScsiMmcWriteProtection, ScsiModePage2A, ScsiModeSense10, ScsiModeSense6, SD_CID, SD_CSD, SD_OCR, SD_SCR, SecureDigitalCid, SecureDigitalCsd, SecureDigitalOcr, SecureDigitalScr, USB_Descriptors, UsbDescriptors, Xbox_DMI, Xbox_PFI, Xbox_SecuritySector, XboxDmi, XboxPfi, and XboxSecuritySector.

+ +

Referenced by process_data_block().

+ +
+
+ +

◆ aaruf_get_xml_mediatype()

+ + + +

◆ compare_extents()

+ +
+
+ + + + + + + + + + + +
int compare_extents (const void * a,
const void * b )
+
+ +

Comparison function for sorting DumpExtent arrays by start sector.

+

This function is used by qsort() to order dump extents in ascending order based on their start sector values. Extents with lower start sectors will appear first in the sorted array. This ordering is important for efficient extent lookup and validation during image operations.

+
Parameters
+ + + +
aPointer to the first DumpExtent to compare.
bPointer to the second DumpExtent to compare.
+
+
+
Returns
Negative value if a->start < b->start, zero if equal, positive if a->start > b->start.
+ +

Definition at line 451 of file helpers.c.

+ +

References DumpExtent::start.

+ +

Referenced by aaruf_set_dumphw(), and process_dumphw_block().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/helpers_8c.js b/docs/html/helpers_8c.js new file mode 100644 index 0000000..4383019 --- /dev/null +++ b/docs/html/helpers_8c.js @@ -0,0 +1,7 @@ +var helpers_8c = +[ + [ "aaruf_get_datatype_for_media_tag_type", "helpers_8c.html#a79bbfb95d80c40c33945bee27d039661", null ], + [ "aaruf_get_media_tag_type_for_datatype", "helpers_8c.html#a8662fc9d3a4258e332b1727f7338941d", null ], + [ "aaruf_get_xml_mediatype", "helpers_8c.html#a9cd4defd02dea61dc984b84ed3204c2c", null ], + [ "compare_extents", "helpers_8c.html#ac93ebc6d918745be56b680e19bf7e8d5", null ] +]; \ No newline at end of file diff --git a/docs/html/helpers_8c_source.html b/docs/html/helpers_8c_source.html new file mode 100644 index 0000000..1b7ed08 --- /dev/null +++ b/docs/html/helpers_8c_source.html @@ -0,0 +1,788 @@ + + + + + + + +libaaruformat: src/helpers.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
helpers.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <aaru.h>
+
20
+
21#include <aaruformat.h>
+
22
+
+
31int32_t aaruf_get_media_tag_type_for_datatype(const int32_t type)
+
32{
+
33 switch(type)
+
34 {
+ +
36 return CD_TOC;
+ +
38 return CD_SessionInfo;
+
39 case CompactDiscToc:
+
40 return CD_FullTOC;
+
41 case CompactDiscPma:
+
42 return CD_PMA;
+
43 case CompactDiscAtip:
+
44 return CD_ATIP;
+ +
46 return CD_TEXT;
+
47 case DvdPfi:
+
48 return DVD_PFI;
+
49 case DvdLeadInCmi:
+
50 return DVD_CMI;
+
51 case DvdDiscKey:
+
52 return DVD_DiscKey;
+
53 case DvdBca:
+
54 return DVD_BCA;
+
55 case DvdDmi:
+
56 return DVD_DMI;
+ + + +
60 return DVD_MKB;
+
61 case DvdRamDds:
+
62 return DVDRAM_DDS;
+ + +
65 case DvdRamSpareArea:
+
66 return DVDRAM_SpareArea;
+
67 case DvdRRmd:
+
68 return DVDR_RMD;
+ + + + +
73 case DvdRPfi:
+
74 return DVDR_PFI;
+
75 case DvdAdip:
+
76 return DVD_ADIP;
+
77 case HdDvdCpi:
+
78 return HDDVD_CPI;
+ +
80 return HDDVD_MediumStatus;
+ + + + + + + + +
89 case BlurayDi:
+
90 return BD_DI;
+
91 case BlurayBca:
+
92 return BD_BCA;
+
93 case BlurayDds:
+
94 return BD_DDS;
+ +
96 return BD_CartridgeStatus;
+
97 case BluraySpareArea:
+
98 return BD_SpareArea;
+ + +
101 case AacsSerialNumber:
+
102 return AACS_SerialNumber;
+ + + +
106 return AACS_MKB;
+
107 case AacsDataKeys:
+
108 return AACS_DataKeys;
+
109 case AacsLbaExtents:
+
110 return AACS_LBAExtents;
+ +
112 return AACS_CPRM_MKB;
+ + + +
116 return MMC_WriteProtection;
+ +
118 return MMC_DiscInformation;
+ + + + +
123 case ScsiInquiry:
+
124 return SCSI_INQUIRY;
+
125 case ScsiModePage2A:
+
126 return SCSI_MODEPAGE_2A;
+
127 case AtaIdentify:
+
128 return ATA_IDENTIFY;
+
129 case AtapiIdentify:
+
130 return ATAPI_IDENTIFY;
+
131 case PcmciaCis:
+
132 return PCMCIA_CIS;
+
133 case SecureDigitalCid:
+
134 return SD_CID;
+
135 case SecureDigitalCsd:
+
136 return SD_CSD;
+
137 case SecureDigitalScr:
+
138 return SD_SCR;
+
139 case SecureDigitalOcr:
+
140 return SD_OCR;
+ +
142 return MMC_CID;
+ +
144 return MMC_CSD;
+ +
146 return MMC_OCR;
+ +
148 return MMC_ExtendedCSD;
+ +
150 return Xbox_SecuritySector;
+
151 case FloppyLeadOut:
+
152 return Floppy_LeadOut;
+ +
154 return DCB;
+ +
156 return CD_FirstTrackPregap;
+ +
158 return CD_LeadOut;
+
159 case ScsiModeSense6:
+
160 return SCSI_MODESENSE_6;
+
161 case ScsiModeSense10:
+
162 return SCSI_MODESENSE_10;
+
163 case UsbDescriptors:
+
164 return USB_Descriptors;
+
165 case XboxDmi:
+
166 return Xbox_DMI;
+
167 case XboxPfi:
+
168 return Xbox_PFI;
+ +
170 return CD_MCN;
+ +
172 return CD_LeadIn;
+ + +
175 default:
+
176 return -1;
+
177 }
+
178}
+
+
179
+
+
189int32_t aaruf_get_datatype_for_media_tag_type(const int32_t tag_type)
+
190{
+
191 switch(tag_type)
+
192 {
+
193 case CD_TOC:
+ +
195 case CD_SessionInfo:
+ +
197 case CD_FullTOC:
+
198 return CompactDiscToc;
+
199 case CD_PMA:
+
200 return CompactDiscPma;
+
201 case CD_ATIP:
+
202 return CompactDiscAtip;
+
203 case CD_TEXT:
+ +
205 case DVD_PFI:
+
206 return DvdPfi;
+
207 case DVD_CMI:
+
208 return DvdLeadInCmi;
+
209 case DVD_DiscKey:
+
210 return DvdDiscKey;
+
211 case DVD_BCA:
+
212 return DvdBca;
+
213 case DVD_DMI:
+
214 return DvdDmi;
+ +
216 return DvdMediaIdentifier;
+
217 case DVD_MKB:
+
218 return DvdMediaKeyBlock;
+
219 case DVDRAM_DDS:
+
220 return DvdRamDds;
+ +
222 return DvdRamMediumStatus;
+
223 case DVDRAM_SpareArea:
+
224 return DvdRamSpareArea;
+
225 case DVDR_RMD:
+
226 return DvdRRmd;
+ +
228 return DvdRPrerecordedInfo;
+ +
230 return DvdRMediaIdentifier;
+
231 case DVDR_PFI:
+
232 return DvdRPfi;
+
233 case DVD_ADIP:
+
234 return DvdAdip;
+
235 case HDDVD_CPI:
+
236 return HdDvdCpi;
+ +
238 return HdDvdMediumStatus;
+ +
240 return DvdDlLayerCapacity;
+ + + + + + +
247 case BD_DI:
+
248 return BlurayDi;
+
249 case BD_BCA:
+
250 return BlurayBca;
+
251 case BD_DDS:
+
252 return BlurayDds;
+ + +
255 case BD_SpareArea:
+
256 return BluraySpareArea;
+ + + +
260 return AacsSerialNumber;
+ +
262 return AacsMediaIdentifier;
+
263 case AACS_MKB:
+
264 return AacsMediaKeyBlock;
+
265 case AACS_DataKeys:
+
266 return AacsDataKeys;
+
267 case AACS_LBAExtents:
+
268 return AacsLbaExtents;
+
269 case AACS_CPRM_MKB:
+
270 return CprmMediaKeyBlock;
+ + + + + + + + + + +
281 case SCSI_INQUIRY:
+
282 return ScsiInquiry;
+
283 case SCSI_MODEPAGE_2A:
+
284 return ScsiModePage2A;
+
285 case ATA_IDENTIFY:
+
286 return AtaIdentify;
+
287 case ATAPI_IDENTIFY:
+
288 return AtapiIdentify;
+
289 case PCMCIA_CIS:
+
290 return PcmciaCis;
+
291 case SD_CID:
+
292 return SecureDigitalCid;
+
293 case SD_CSD:
+
294 return SecureDigitalCsd;
+
295 case SD_SCR:
+
296 return SecureDigitalScr;
+
297 case SD_OCR:
+
298 return SecureDigitalOcr;
+
299 case MMC_CID:
+
300 return MultiMediaCardCid;
+
301 case MMC_CSD:
+
302 return MultiMediaCardCsd;
+
303 case MMC_OCR:
+
304 return MultiMediaCardOcr;
+
305 case MMC_ExtendedCSD:
+ + +
308 return XboxSecuritySector;
+
309 case Floppy_LeadOut:
+
310 return FloppyLeadOut;
+
311 case DCB:
+
312 return DvdDiscControlBlock;
+ + +
315 case CD_LeadOut:
+
316 return CompactDiscLeadOut;
+
317 case SCSI_MODESENSE_6:
+
318 return ScsiModeSense6;
+ +
320 return ScsiModeSense10;
+
321 case USB_Descriptors:
+
322 return UsbDescriptors;
+
323 case Xbox_DMI:
+
324 return XboxDmi;
+
325 case Xbox_PFI:
+
326 return XboxPfi;
+
327 case CD_MCN:
+ +
329 case CD_LeadIn:
+
330 return CompactDiscLeadIn;
+ +
332 return DvdDiscKeyDecrypted;
+
333 default:
+
334 return -1;
+
335 }
+
336}
+
+
337
+
338// Get the CICM XML media type from AARU media type
+
+
339int32_t aaruf_get_xml_mediatype(const int32_t type)
+
340{
+
341 switch(type)
+
342 {
+
343 case CD:
+
344 case CDDA:
+
345 case CDG:
+
346 case CDEG:
+
347 case CDI:
+
348 case CDIREADY:
+
349 case CDROM:
+
350 case CDROMXA:
+
351 case CDPLUS:
+
352 case CDMO:
+
353 case CDR:
+
354 case CDRW:
+
355 case CDMRW:
+
356 case VCD:
+
357 case SVCD:
+
358 case PCD:
+
359 case SACD:
+
360 case DDCD:
+
361 case DDCDR:
+
362 case DDCDRW:
+
363 case DTSCD:
+
364 case CDMIDI:
+
365 case CDV:
+
366 case DVDROM:
+
367 case DVDR:
+
368 case DVDRW:
+
369 case DVDPR:
+
370 case DVDPRW:
+
371 case DVDPRWDL:
+
372 case DVDRDL:
+
373 case DVDPRDL:
+
374 case DVDRAM:
+
375 case DVDRWDL:
+
376 case DVDDownload:
+
377 case HDDVDROM:
+
378 case HDDVDRAM:
+
379 case HDDVDR:
+
380 case HDDVDRW:
+
381 case HDDVDRDL:
+
382 case HDDVDRWDL:
+
383 case BDROM:
+
384 case BDR:
+
385 case BDRE:
+
386 case BDRXL:
+
387 case BDREXL:
+
388 case EVD:
+
389 case FVD:
+
390 case HVD:
+
391 case CBHD:
+
392 case HDVMD:
+
393 case VCDHD:
+
394 case SVOD:
+
395 case FDDVD:
+
396 case LD:
+
397 case LDROM:
+
398 case LDROM2:
+
399 case LVROM:
+
400 case MegaLD:
+
401 case PS1CD:
+
402 case PS2CD:
+
403 case PS2DVD:
+
404 case PS3DVD:
+
405 case PS3BD:
+
406 case PS4BD:
+
407 case UMD:
+
408 case XGD:
+
409 case XGD2:
+
410 case XGD3:
+
411 case XGD4:
+
412 case MEGACD:
+
413 case SATURNCD:
+
414 case GDROM:
+
415 case GDR:
+
416 case SuperCDROM2:
+
417 case JaguarCD:
+
418 case ThreeDO:
+
419 case PCFX:
+
420 case NeoGeoCD:
+
421 case GOD:
+
422 case WOD:
+
423 case WUOD:
+
424 case CDTV:
+
425 case CD32:
+
426 case Nuon:
+
427 case Playdia:
+
428 case Pippin:
+
429 case FMTOWNS:
+
430 case MilCD:
+
431 case VideoNow:
+
432 case VideoNowColor:
+
433 case VideoNowXp:
+
434 return OpticalDisc;
+
435 default:
+
436 return BlockMedia;
+
437 }
+
438}
+
+
439
+
+
451int compare_extents(const void *a, const void *b)
+
452{
+
453 const DumpExtent *extent_a = a;
+
454 const DumpExtent *extent_b = b;
+
455
+
456 if(extent_a->start < extent_b->start)
+
457 return -1;
+
458 if(extent_a->start > extent_b->start)
+
459 return 1;
+
460 return 0;
+
461}
+
+
Public high-level API types: media classifications, per-sector / per-media tag enums and image summar...
+ +
@ OpticalDisc
Purely optical discs.
Definition enums.h:218
+
@ BlockMedia
Media that is physically block-based or abstracted like that.
Definition enums.h:219
+
@ DvdDiscKey
DVD disc key.
Definition enums.h:55
+
@ CompactDiscSessionInfo
Compact Disc session information.
Definition enums.h:48
+
@ DvdRPfi
DVD-R Physical Format Information.
Definition enums.h:66
+
@ ScsiMmcTrackResourcesInformation
MMC track resources information.
Definition enums.h:89
+
@ DvdPfi
DVD Physical Format Information.
Definition enums.h:53
+
@ HdDvdCpi
HD DVD Copy Protection Information (CPI).
Definition enums.h:68
+
@ DvdDlLayerCapacity
DVD dual-layer capacity.
Definition enums.h:70
+
@ CompactDiscAtip
Compact Disc Absolute Time In Pregroove (ATIP).
Definition enums.h:51
+
@ CompactDiscLeadOut
Compact Disc lead‑out.
Definition enums.h:108
+
@ MultiMediaCardOcr
MultiMediaCard OCR register.
Definition enums.h:102
+
@ ScsiMmcDiscInformation
MMC disc information.
Definition enums.h:88
+
@ DvdRamDds
DVD-RAM Disc Definition Structure (DDS).
Definition enums.h:60
+
@ DvdRamMediumStatus
DVD-RAM medium status.
Definition enums.h:61
+
@ AacsMediaIdentifier
AACS media identifier.
Definition enums.h:81
+
@ AacsMediaKeyBlock
AACS Media Key Block (MKB).
Definition enums.h:82
+
@ CompactDiscLeadInCdText
Compact Disc lead-in CD-Text.
Definition enums.h:52
+
@ ScsiModePage2A
SCSI MODE PAGE 2Ah.
Definition enums.h:92
+
@ SecureDigitalOcr
Secure Digital OCR register.
Definition enums.h:99
+
@ MultiMediaCardCsd
MultiMediaCard CSD register.
Definition enums.h:101
+
@ CompactDiscPartialToc
Compact Disc partial Table of Contents.
Definition enums.h:47
+
@ CprmMediaKeyBlock
CPRM Media Key Block (MKB).
Definition enums.h:85
+
@ ScsiMmcPowResourcesInformation
MMC POW (Persistent Optical Write?) resources information.
Definition enums.h:90
+
@ SecureDigitalCid
Secure Digital CID register.
Definition enums.h:96
+
@ CompactDiscMediaCatalogueNumber
Compact Disc Media Catalogue Number (lead‑in, 13 ASCII bytes).
Definition enums.h:120
+
@ XboxSecuritySector
Xbox Security Sector.
Definition enums.h:104
+
@ AacsVolumeIdentifier
AACS volume identifier.
Definition enums.h:79
+
@ DvdDmi
DVD Disc Manufacturing Information (DMI).
Definition enums.h:57
+
@ ScsiInquiry
SCSI INQUIRY response.
Definition enums.h:91
+
@ CompactDiscToc
Compact Disc full Table of Contents.
Definition enums.h:49
+
@ DvdLeadInCmi
DVD lead-in Copyright Management Information (CMI).
Definition enums.h:54
+
@ HdDvdMediumStatus
HD DVD medium status.
Definition enums.h:69
+
@ DvdAdip
DVD Address In Pregroove (ADIP).
Definition enums.h:67
+
@ AacsLbaExtents
AACS LBA extents.
Definition enums.h:84
+
@ AtaIdentify
ATA IDENTIFY DEVICE data.
Definition enums.h:93
+
@ AacsDataKeys
AACS data keys.
Definition enums.h:83
+
@ BlurayDi
Blu-ray Disc Information (DI).
Definition enums.h:74
+
@ SecureDigitalCsd
Secure Digital CSD register.
Definition enums.h:97
+
@ BluraySpareArea
Blu-ray spare area information.
Definition enums.h:78
+
@ DvdDiscKeyDecrypted
Decrypted DVD Disc Key.
Definition enums.h:125
+
@ AtapiIdentify
ATAPI IDENTIFY PACKET DEVICE data.
Definition enums.h:94
+
@ SecureDigitalScr
Secure Digital SCR register.
Definition enums.h:98
+
@ DvdRPrerecordedInfo
DVD-R pre‑recorded information.
Definition enums.h:64
+
@ CompactDiscLeadIn
Compact Disc lead‑in.
Definition enums.h:124
+
@ PcmciaCis
PCMCIA Card Information Structure (CIS).
Definition enums.h:95
+
@ DvdBca
DVD Burst Cutting Area (BCA).
Definition enums.h:56
+
@ DvdRamSpareArea
DVD-RAM spare area information.
Definition enums.h:62
+
@ MultiMediaCardCid
MultiMediaCard CID register.
Definition enums.h:100
+
@ XboxDmi
Xbox DMI.
Definition enums.h:112
+
@ DvdRMediaIdentifier
DVD-R media identifier.
Definition enums.h:65
+
@ HybridRecognizedLayers
Recognized layers (hybrid media).
Definition enums.h:86
+
@ ScsiMmcWriteProtection
MMC write-protection data.
Definition enums.h:87
+
@ DvdDlMiddleZoneAddress
DVD dual-layer middle zone address.
Definition enums.h:71
+
@ BlurayCartridgeStatus
Blu-ray cartridge status.
Definition enums.h:77
+
@ BlurayBca
Blu-ray Burst Cutting Area (BCA).
Definition enums.h:75
+
@ CompactDiscFirstTrackPregap
Compact Disc first track pre-gap.
Definition enums.h:107
+
@ DvdMediaIdentifier
DVD media identifier.
Definition enums.h:58
+
@ ScsiModeSense6
SCSI MODE SENSE (6) response.
Definition enums.h:109
+
@ UsbDescriptors
USB descriptors set.
Definition enums.h:111
+
@ AacsSerialNumber
AACS serial number.
Definition enums.h:80
+
@ DvdDiscControlBlock
DVD Disc Control Block.
Definition enums.h:106
+
@ FloppyLeadOut
Floppy lead‑out data.
Definition enums.h:105
+
@ ScsiModeSense10
SCSI MODE SENSE (10) response.
Definition enums.h:110
+
@ CompactDiscPma
Compact Disc Power Management Area (PMA).
Definition enums.h:50
+
@ XboxPfi
Xbox Physical Format Information (PFI).
Definition enums.h:113
+
@ MultiMediaCardExtendedCsd
MultiMediaCard Extended CSD register.
Definition enums.h:103
+
@ DvdDlManualLayerJumpLba
DVD dual-layer manual layer jump LBA.
Definition enums.h:73
+
@ DvdMediaKeyBlock
DVD Media Key Block (MKB).
Definition enums.h:59
+
@ DvdDlJumpIntervalSize
DVD dual-layer jump interval size.
Definition enums.h:72
+
@ BlurayDds
Blu-ray Disc Definition Structure (DDS).
Definition enums.h:76
+
@ DvdRRmd
DVD-R RMD (Recording Management Data).
Definition enums.h:63
+
@ SCSI_MODEPAGE_2A
SCSI Mode Page 2Ah (CD/DVD capabilities)
Definition aaru.h:981
+
@ BD_DDS
Disc Definition Structure (recordable)
Definition aaru.h:965
+
@ MMC_CID
MMC Card ID.
Definition aaru.h:989
+
@ DVDDL_JumpIntervalSize
Jump interval size (opposite track path)
Definition aaru.h:961
+
@ MMC_CSD
MMC Card Specific Data.
Definition aaru.h:990
+
@ DVD_DiscKey_Decrypted
Decrypted DVD disc key.
Definition aaru.h:1008
+
@ BD_SpareArea
BD spare area allocation map.
Definition aaru.h:967
+
@ CD_TOC
Standard CD Table Of Contents (lead-in, first session)
Definition aaru.h:935
+
@ DVDDL_ManualLayerJumpLBA
Manual layer jump LBA (OTP)
Definition aaru.h:962
+
@ DVDRAM_SpareArea
Spare area descriptors.
Definition aaru.h:951
+
@ DVD_CMI
Copyright Management Information (CSS/CPRM flags)
Definition aaru.h:943
+
@ DVDR_MediaIdentifier
DVD-R/-RW writable media identifier.
Definition aaru.h:954
+
@ SCSI_MODESENSE_10
Raw MODE SENSE (10) data.
Definition aaru.h:999
+
@ USB_Descriptors
Concatenated USB descriptors (device/config/interface)
Definition aaru.h:1000
+
@ SCSI_MODESENSE_6
Raw MODE SENSE (6) data.
Definition aaru.h:998
+
@ ATAPI_IDENTIFY
ATA PACKET IDENTIFY DEVICE.
Definition aaru.h:983
+
@ CD_SessionInfo
Per-session summary (start/end addresses, track count)
Definition aaru.h:936
+
@ DVD_PFI
Physical Format Information (layer geometry & book type)
Definition aaru.h:942
+
@ CD_LeadIn
Raw lead-in (TOC frames)
Definition aaru.h:1003
+
@ BD_CartridgeStatus
Cartridge presence / write protect (BD-RE/BD-R in caddy)
Definition aaru.h:966
+
@ Xbox_DMI
Xbox Disc Manufacturing Info (DMI)
Definition aaru.h:1001
+
@ AACS_SerialNumber
Pre-recorded media serial number (AACS)
Definition aaru.h:969
+
@ DVDR_PreRecordedInfo
Pre-recorded info area (lead-in)
Definition aaru.h:953
+
@ SD_SCR
SecureDigital Configuration Register.
Definition aaru.h:987
+
@ DVDRAM_DDS
Defect Data Structure (DVD-RAM mapping)
Definition aaru.h:949
+
@ AACS_DataKeys
Extracted AACS title/volume keys (when decrypted)
Definition aaru.h:972
+
@ CD_ATIP
Absolute Time In Pregroove (writable media timing & power metadata)
Definition aaru.h:939
+
@ AACS_MKB
AACS Media Key Block.
Definition aaru.h:971
+
@ DVD_DiscKey
Encrypted disc key block (CSS)
Definition aaru.h:944
+
@ MMC_DiscInformation
Disc Information (recordable status, erasable, last session)
Definition aaru.h:977
+
@ ATA_IDENTIFY
ATA IDENTIFY DEVICE (512 bytes)
Definition aaru.h:982
+
@ DVDR_PFI
DVD-R physical format (layer data)
Definition aaru.h:955
+
@ DVD_MediaIdentifier
Writable media dye / manufacturer ID.
Definition aaru.h:947
+
@ CD_LeadOut
Lead-out area contents.
Definition aaru.h:997
+
@ MMC_ExtendedCSD
MMC Extended CSD (512 bytes)
Definition aaru.h:992
+
@ CD_TEXT
CD-Text blocks (titles, performers, etc.)
Definition aaru.h:940
+
@ CD_MCN
Media Catalogue Number (EAN/UPC style identifier)
Definition aaru.h:941
+
@ MMC_TrackResourcesInformation
Track Resources (allocated/open track data)
Definition aaru.h:978
+
@ Xbox_SecuritySector
Xbox/Xbox 360 Security Sector (SS.bin)
Definition aaru.h:993
+
@ HDDVD_MediumStatus
HD DVD Medium status (spares/defects)
Definition aaru.h:958
+
@ DCB
DVD Disc Control Blocks.
Definition aaru.h:995
+
@ DVDDL_MiddleZoneAddress
Middle zone start LBA.
Definition aaru.h:960
+
@ Floppy_LeadOut
Manufacturer / duplication cylinder (floppy special data)
Definition aaru.h:994
+
@ MMC_POWResourcesInformation
Pseudo OverWrite resources (BD-R POW)
Definition aaru.h:979
+
@ AACS_MediaIdentifier
AACS Media Identifier (unique per disc)
Definition aaru.h:970
+
@ DVDDL_LayerCapacity
Dual layer capacity & break info.
Definition aaru.h:959
+
@ AACS_VolumeIdentifier
AACS Volume Identifier.
Definition aaru.h:968
+
@ BD_BCA
Blu-ray Burst Cutting Area.
Definition aaru.h:964
+
@ Hybrid_RecognizedLayers
Hybrid disc recognized layer combinations (e.g. CD/DVD/BD)
Definition aaru.h:975
+
@ AACS_CPRM_MKB
CPRM Media Key Block.
Definition aaru.h:974
+
@ DVDR_RMD
Recorded Media Data (RMD) last border-out.
Definition aaru.h:952
+
@ AACS_LBAExtents
LBA extents requiring bus encryption.
Definition aaru.h:973
+
@ DVD_DMI
Disc Manufacturer Information (lead-in descriptor)
Definition aaru.h:946
+
@ DVD_BCA
Burst Cutting Area (etched manufacturer / AACS info)
Definition aaru.h:945
+
@ DVD_MKB
Media Key Block (AACS/DVD)
Definition aaru.h:948
+
@ SD_CSD
SecureDigital Card Specific Data.
Definition aaru.h:986
+
@ SCSI_INQUIRY
SCSI INQUIRY standard data (SPC-*)
Definition aaru.h:980
+
@ CD_FullTOC
Complete multi-session TOC including hidden tracks.
Definition aaru.h:937
+
@ DVD_ADIP
Address In Pregroove (DVD+ / wobble timing)
Definition aaru.h:956
+
@ MMC_OCR
MMC Operation Conditions.
Definition aaru.h:991
+
@ HDDVD_CPI
Content Protection Info (HD DVD)
Definition aaru.h:957
+
@ SD_OCR
SecureDigital Operation Conditions (voltage)
Definition aaru.h:988
+
@ CD_PMA
Program Memory Area (temporary track info before finalization)
Definition aaru.h:938
+
@ DVDRAM_MediumStatus
Medium Status (allocated spare info)
Definition aaru.h:950
+
@ PCMCIA_CIS
PCMCIA/CardBus CIS tuple chain.
Definition aaru.h:984
+
@ Xbox_PFI
Xbox Physical Format Information (PFI)
Definition aaru.h:1002
+
@ SD_CID
SecureDigital Card ID register.
Definition aaru.h:985
+
@ CD_FirstTrackPregap
First track pregap (index 0)
Definition aaru.h:996
+
@ MMC_WriteProtection
Write protection status (MMC GET CONFIG)
Definition aaru.h:976
+
@ BD_DI
Disc Information (BD)
Definition aaru.h:963
+
@ BDREXL
BD-RE XL.
Definition aaru.h:163
+
@ CDROMXA
CD-ROM XA (Yellow Book)
Definition aaru.h:112
+
@ SVOD
Stacked Volumetric Optical Disc.
Definition aaru.h:173
+
@ CDR
CD-Recordable (Orange Book)
Definition aaru.h:115
+
@ ThreeDO
3DO CD
Definition aaru.h:233
+
@ PCD
Photo CD (Beige Book)
Definition aaru.h:120
+
@ CDV
CD-Video (ISO/IEC 61104)
Definition aaru.h:127
+
@ CDG
CD+G (Red Book)
Definition aaru.h:108
+
@ HVD
Holographic Versatile Disc.
Definition aaru.h:169
+
@ CDMO
CD-MO (Orange Book)
Definition aaru.h:114
+
@ DDCD
Double-Density CD-ROM (Purple Book)
Definition aaru.h:122
+
@ LD
Pioneer LaserDisc.
Definition aaru.h:178
+
@ CDEG
CD+EG (Red Book)
Definition aaru.h:109
+
@ GDR
Sega/Yamaha recordable Gigabyte Disc.
Definition aaru.h:224
+
@ CDDA
CD Digital Audio (Red Book)
Definition aaru.h:107
+
@ Pippin
Definition aaru.h:702
+
@ CDMRW
Mount-Rainier CD-RW.
Definition aaru.h:117
+
@ MEGACD
Sega MegaCD.
Definition aaru.h:221
+
@ VideoNowColor
Hasbro VideoNow Color disc.
Definition aaru.h:772
+
@ CDIREADY
CD-i Ready, contains a track before the first TOC track, in mode 2, and all TOC tracks are Audio.
Definition aaru.h:130
+
@ GOD
Nintendo GameCube Optical Disc.
Definition aaru.h:502
+
@ CDROM
CD-ROM (Yellow Book)
Definition aaru.h:111
+
@ HDDVDROM
HD DVD-ROM (applies to HD DVD Video)
Definition aaru.h:150
+
@ MegaLD
Definition aaru.h:182
+
@ VCD
Video CD (White Book)
Definition aaru.h:118
+
@ SuperCDROM2
PC-Engine / TurboGrafx CD.
Definition aaru.h:231
+
@ CDRW
CD-ReWritable (Orange Book)
Definition aaru.h:116
+
@ SVCD
Super Video CD (White Book)
Definition aaru.h:119
+
@ DVDPRWDL
DVD+RW DL.
Definition aaru.h:141
+
@ BDRXL
BD-R XL.
Definition aaru.h:162
+
@ DDCDR
DD CD-R (Purple Book)
Definition aaru.h:123
+
@ NeoGeoCD
NEO-GEO CD.
Definition aaru.h:235
+
@ DVDRW
DVD-RW.
Definition aaru.h:138
+
@ CDPLUS
CD+ (Blue Book)
Definition aaru.h:113
+
@ CDTV
Commodore CDTV.
Definition aaru.h:236
+
@ DVDRWDL
DVD-RW DL.
Definition aaru.h:145
+
@ HDDVDRDL
HD DVD-R DL.
Definition aaru.h:154
+
@ FMTOWNS
Fujitsu FM Towns bootable CD (mixed-mode proprietary extensions)
Definition aaru.h:132
+
@ PS1CD
Sony PlayStation game CD.
Definition aaru.h:203
+
@ HDDVDRWDL
HD DVD-RW DL.
Definition aaru.h:155
+
@ XGD3
Microsoft X-box 360 Game Disc.
Definition aaru.h:216
+
@ WOD
Nintendo Wii Optical Disc.
Definition aaru.h:512
+
@ PS3BD
Sony PlayStation 3 game Blu-ray.
Definition aaru.h:207
+
@ UMD
Sony PlayStation Portable Universal Media Disc (ECMA-365)
Definition aaru.h:209
+
@ XGD
Microsoft X-box Game Disc.
Definition aaru.h:214
+
@ EVD
Enhanced Versatile Disc.
Definition aaru.h:167
+
@ SACD
Super Audio CD (Scarlet Book)
Definition aaru.h:121
+
@ DVDPRDL
DVD+R DL.
Definition aaru.h:143
+
@ HDDVDRAM
HD DVD-RAM.
Definition aaru.h:151
+
@ DVDR
DVD-R.
Definition aaru.h:137
+
@ PS3DVD
Sony PlayStation 3 game DVD.
Definition aaru.h:206
+
@ CDMIDI
CD-MIDI (Red Book)
Definition aaru.h:126
+
@ PCFX
NEC PC-FX.
Definition aaru.h:234
+
@ BDROM
BD-ROM (and BD Video)
Definition aaru.h:159
+
@ JaguarCD
Atari Jaguar CD.
Definition aaru.h:232
+
@ PS2DVD
Sony PlayStation 2 game DVD.
Definition aaru.h:205
+
@ XGD4
Microsoft X-box One Game Disc.
Definition aaru.h:217
+
@ VideoNow
Hasbro VideoNow 85 mm proprietary video disc.
Definition aaru.h:771
+
@ VideoNowXp
Hasbro VideoNow XP higher capacity disc.
Definition aaru.h:773
+
@ VCDHD
Versatile Compact Disc High Density.
Definition aaru.h:172
+
@ CD
Any unknown or standard violating CD.
Definition aaru.h:106
+
@ GDROM
Sega/Yamaha Gigabyte Disc.
Definition aaru.h:223
+
@ SATURNCD
Sega Saturn disc.
Definition aaru.h:222
+
@ CBHD
China Blue High Definition.
Definition aaru.h:170
+
@ BDR
BD-R.
Definition aaru.h:160
+
@ XGD2
Microsoft X-box 360 Game Disc.
Definition aaru.h:215
+
@ LDROM
Pioneer LaserDisc data.
Definition aaru.h:179
+
@ PS4BD
Sony PlayStation 4 game Blu-ray.
Definition aaru.h:208
+
@ HDDVDR
HD DVD-R.
Definition aaru.h:152
+
@ HDVMD
High Definition Versatile Multilayer Disc.
Definition aaru.h:171
+
@ HDDVDRW
HD DVD-RW.
Definition aaru.h:153
+
@ MilCD
Sega Dreamcast MIL-CD enhanced multimedia disc.
Definition aaru.h:226
+
@ BDRE
BD-RE.
Definition aaru.h:161
+
@ DTSCD
DTS audio CD (non-standard)
Definition aaru.h:125
+
@ DVDPR
DVD+R.
Definition aaru.h:139
+
@ DDCDRW
DD CD-RW (Purple Book)
Definition aaru.h:124
+
@ FVD
Forward Versatile Disc.
Definition aaru.h:168
+
@ CDI
CD-i (Green Book)
Definition aaru.h:110
+
@ Playdia
Bandai Playdia.
Definition aaru.h:239
+
@ DVDPRW
DVD+RW.
Definition aaru.h:140
+
@ Nuon
Nuon (DVD based videogame console)
Definition aaru.h:238
+
@ CD32
Amiga CD32.
Definition aaru.h:237
+
@ LVROM
Definition aaru.h:181
+
@ DVDDownload
DVD-Download.
Definition aaru.h:146
+
@ DVDRDL
DVD-R DL.
Definition aaru.h:142
+
@ WUOD
Nintendo Wii U Optical Disc.
Definition aaru.h:513
+
@ DVDROM
DVD-ROM (applies to DVD Video and DVD Audio)
Definition aaru.h:136
+
@ LDROM2
Definition aaru.h:180
+
@ FDDVD
Five Dimensional disc.
Definition aaru.h:174
+
@ PS2CD
Sony PlayStation 2 game CD.
Definition aaru.h:204
+
@ DVDRAM
DVD-RAM.
Definition aaru.h:144
+
int32_t aaruf_get_datatype_for_media_tag_type(const int32_t tag_type)
Converts an Aaru media tag type to an image data type.
Definition helpers.c:189
+
int32_t aaruf_get_media_tag_type_for_datatype(const int32_t type)
Converts an image data type to an Aaru media tag type.
Definition helpers.c:31
+
int32_t aaruf_get_xml_mediatype(const int32_t type)
Definition helpers.c:339
+
int compare_extents(const void *a, const void *b)
Comparison function for sorting DumpExtent arrays by start sector.
Definition helpers.c:451
+
Inclusive [start,end] logical sector range contributed by a single hardware environment.
Definition context.h:333
+
uint64_t start
Starting LBA (inclusive).
Definition context.h:334
+
+
+
+ + + + diff --git a/docs/html/identify_8c.html b/docs/html/identify_8c.html new file mode 100644 index 0000000..a39ef9d --- /dev/null +++ b/docs/html/identify_8c.html @@ -0,0 +1,305 @@ + + + + + + + +libaaruformat: src/identify.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
identify.c File Reference
+
+
+
#include <errno.h>
+#include <stdio.h>
+#include <aaruformat.h>
+
+

Go to the source code of this file.

+ + + + + + +

+Functions

int aaruf_identify (const char *filename)
 Identifies a file as an AaruFormat image using a file path.
int aaruf_identify_stream (FILE *image_stream)
 Identifies a file as an AaruFormat image using an open stream.
+

Function Documentation

+ +

◆ aaruf_identify()

+ +
+
+ + + + + + + +
int aaruf_identify (const char * filename)
+
+ +

Identifies a file as an AaruFormat image using a file path.

+

Opens the file at the given path and determines if it is an AaruFormat image by examining the file header for valid AaruFormat signatures and version information. This function provides a simple file-based interface that handles file opening, identification, and cleanup automatically. It delegates the actual identification logic to aaruf_identify_stream().

+
Parameters
+ + +
filenamePath to the file to identify (must be accessible and readable).
+
+
+
Returns
Returns one of the following values:
+
Return values
+ + + + +
100Maximum confidence - Definitive AaruFormat image. This is returned when:
    +
  • The file header contains a valid AaruFormat signature (DIC_MAGIC or AARU_MAGIC)
  • +
  • The image major version is less than or equal to the supported version (AARUF_VERSION)
  • +
  • The file structure passes all header validation checks
  • +
  • This indicates the file is definitely a supported AaruFormat image
  • +
+
0Not recognized - File is not an AaruFormat image. This is returned when:
    +
  • The file header doesn't contain a recognized AaruFormat signature
  • +
  • The image major version exceeds the maximum supported version
  • +
  • The file header cannot be read completely (file too small or corrupted)
  • +
  • The file format doesn't match AaruFormat specifications
  • +
+
Positiveerrno values - File access errors from system calls. Common values include:
    +
  • ENOENT (2) - File not found or path doesn't exist
  • +
  • EACCES (13) - Permission denied, file not readable
  • +
  • EISDIR (21) - Path refers to a directory, not a file
  • +
  • EMFILE (24) - Too many open files (process limit reached)
  • +
  • ENFILE (23) - System limit on open files reached
  • +
  • ENOMEM (12) - Insufficient memory to open file
  • +
  • EIO (5) - I/O error occurred during file access
  • +
  • Other platform-specific errno values from fopen()
  • +
+
+
+
+
Note
Identification Process:
    +
  • Opens the file in binary read mode ("rb")
  • +
  • Delegates identification to aaruf_identify_stream() for actual header analysis
  • +
  • Automatically closes the file stream regardless of identification result
  • +
  • Returns system errno values directly if file opening fails
  • +
+
+
+Confidence Scoring:
    +
  • Uses binary scoring: 100 (definitive match) or 0 (no match)
  • +
  • No intermediate confidence levels are returned
  • +
  • Designed for simple yes/no identification rather than probabilistic matching
  • +
+
+
+Version Compatibility:
    +
  • Only recognizes AaruFormat versions up to AARUF_VERSION
  • +
  • Future versions beyond library support are treated as unrecognized
  • +
  • Backwards compatible with older DIC_MAGIC identifiers
  • +
+
+
Warning
The function opens and closes the file for each identification. For repeated operations on the same file, consider using aaruf_identify_stream() with a pre-opened stream for better performance.
+
+File access permissions and availability are checked at runtime. Network files or files on removable media may cause variable access times.
+
+The function performs minimal file content validation. A positive result indicates the file appears to be AaruFormat but doesn't guarantee the entire file is valid or uncorrupted.
+ +

Definition at line 84 of file identify.c.

+ +

References aaruf_identify_stream().

+ +
+
+ +

◆ aaruf_identify_stream()

+ +
+
+ + + + + + + +
int aaruf_identify_stream (FILE * image_stream)
+
+ +

Identifies a file as an AaruFormat image using an open stream.

+

Determines if the provided stream is an AaruFormat image by reading and validating the file header at the beginning of the stream. This function performs the core identification logic by checking for valid AaruFormat signatures and version compatibility. It's designed to work with any FILE stream, making it suitable for integration with existing file handling code.

+
Parameters
+ + +
image_streamOpen FILE stream positioned at any location (will be repositioned to start).
+
+
+
Returns
Returns one of the following values:
+
Return values
+ + + +
100Maximum confidence - Definitive AaruFormat image. This is returned when:
    +
  • The stream is successfully repositioned to the beginning
  • +
  • The AaruFormat header is successfully read (AaruHeader structure)
  • +
  • The header identifier matches either DIC_MAGIC or AARU_MAGIC (valid signatures)
  • +
  • The image major version is less than or equal to AARUF_VERSION (supported version)
  • +
  • All validation checks pass indicating a compatible AaruFormat image
  • +
+
0Not recognized - Stream is not an AaruFormat image. This is returned when:
    +
  • The stream parameter is NULL
  • +
  • Cannot read a complete AaruHeader structure from the stream (file too small)
  • +
  • The header identifier doesn't match DIC_MAGIC or AARU_MAGIC (wrong format)
  • +
  • The image major version exceeds AARUF_VERSION (unsupported future version)
  • +
  • Any validation check fails indicating the stream is not a valid AaruFormat image
  • +
+
+
+
+
Note
Stream Handling:
    +
  • Always seeks to position 0 at the beginning of the function
  • +
  • Reads exactly one AaruHeader structure (size depends on format version)
  • +
  • Does not restore the original stream position after identification
  • +
  • Stream remains open and positioned after the header on function return
  • +
+
+
+Signature Recognition:
    +
  • DIC_MAGIC: Legacy identifier from original DiscImageChef format
  • +
  • AARU_MAGIC: Current AaruFormat identifier
  • +
  • Both signatures are accepted for backwards compatibility
  • +
  • Signature validation is performed using exact byte matching
  • +
+
+
+Version Validation:
    +
  • Only checks the major version number for compatibility
  • +
  • Minor version differences are ignored (assumed backwards compatible)
  • +
  • Future major versions are rejected to prevent compatibility issues
  • +
  • Version check prevents attempting to read unsupported format variants
  • +
+
+
+Confidence Scoring:
    +
  • Binary result: 100 (definitive) or 0 (not recognized)
  • +
  • No probabilistic or partial matching
  • +
  • Designed for definitive identification rather than format detection
  • +
+
+
Warning
The function modifies the stream position by seeking to the beginning and reading the header. The stream position is not restored.
+
+This function performs only header-level validation. A positive result indicates the file appears to have a valid AaruFormat header but doesn't guarantee the entire image structure is valid or uncorrupted.
+
+The stream must support seeking operations. Non-seekable streams (like pipes or network streams) may cause undefined behavior.
+
+No error codes are returned for I/O failures during header reading. Such failures result in a return value of 0 (not recognized).
+ +

Definition at line 163 of file identify.c.

+ +

References AARU_MAGIC, AARUF_VERSION, DIC_MAGIC, AaruHeader::identifier, and AaruHeader::imageMajorVersion.

+ +

Referenced by aaruf_identify().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/identify_8c.js b/docs/html/identify_8c.js new file mode 100644 index 0000000..f98336f --- /dev/null +++ b/docs/html/identify_8c.js @@ -0,0 +1,5 @@ +var identify_8c = +[ + [ "aaruf_identify", "identify_8c.html#a74c444fbd394f58aefd2fabff221231b", null ], + [ "aaruf_identify_stream", "identify_8c.html#a6f30353aff3ece1e889542c26f7146e2", null ] +]; \ No newline at end of file diff --git a/docs/html/identify_8c_source.html b/docs/html/identify_8c_source.html new file mode 100644 index 0000000..99ebbe7 --- /dev/null +++ b/docs/html/identify_8c_source.html @@ -0,0 +1,176 @@ + + + + + + + +libaaruformat: src/identify.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
identify.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <errno.h>
+
20#include <stdio.h>
+
21
+
22#include <aaruformat.h>
+
23
+
+
84int aaruf_identify(const char *filename)
+
85{
+
86 if(filename == NULL) return EINVAL;
+
87
+
88 FILE *stream = NULL;
+
89
+
90 stream = fopen(filename, "rb");
+
91
+
92 if(stream == NULL) return errno;
+
93
+
94 const int ret = aaruf_identify_stream(stream);
+
95
+
96 fclose(stream);
+
97
+
98 return ret;
+
99}
+
+
100
+
+
163int aaruf_identify_stream(FILE *image_stream)
+
164{
+
165 if(image_stream == NULL) return 0;
+
166
+
167 if(fseek(image_stream, 0, SEEK_SET) != 0) return 0;
+
168
+
169 AaruHeader header;
+
170
+
171 const size_t ret = fread(&header, sizeof(AaruHeader), 1, image_stream);
+
172
+
173 if(ret != 1) return 0;
+
174
+
175 if((header.identifier == DIC_MAGIC || header.identifier == AARU_MAGIC) && header.imageMajorVersion <= AARUF_VERSION)
+
176 return 100;
+
177
+
178 return 0;
+
179}
+
+ +
#define DIC_MAGIC
Magic identifier for legacy DiscImageChef container (ASCII "DICMFRMT").
Definition consts.h:61
+
#define AARU_MAGIC
Magic identifier for AaruFormat container (ASCII "AARUFRMT").
Definition consts.h:64
+
#define AARUF_VERSION
Current image format major version (incompatible changes bump this).
Definition consts.h:68
+
int aaruf_identify_stream(FILE *image_stream)
Identifies a file as an AaruFormat image using an open stream.
Definition identify.c:163
+
int aaruf_identify(const char *filename)
Identifies a file as an AaruFormat image using a file path.
Definition identify.c:84
+
Version 1 container header placed at offset 0 for legacy / initial format.
Definition header.h:77
+
uint8_t imageMajorVersion
Container format major version (incompatible changes when incremented).
Definition header.h:80
+
uint64_t identifier
File magic (AARU_MAGIC).
Definition header.h:78
+
+
+
+ + + + diff --git a/docs/html/index.html b/docs/html/index.html new file mode 100644 index 0000000..74a82f0 --- /dev/null +++ b/docs/html/index.html @@ -0,0 +1,106 @@ + + + + + + + +libaaruformat: Main Page + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
libaaruformat Documentation
+
+
+ +
+
+
+ + + + diff --git a/docs/html/index_8h.html b/docs/html/index_8h.html new file mode 100644 index 0000000..0b97db9 --- /dev/null +++ b/docs/html/index_8h.html @@ -0,0 +1,225 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/index.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
index.h File Reference
+
+
+ +

On‑disk index block header and entry structures (versions 1, 2 and 3). +More...

+ +

Go to the source code of this file.

+ + + + + + + + + + +

+Data Structures

struct  IndexHeader
 Index header (version 1) for legacy images (identifier == IndexBlock). More...
struct  IndexHeader2
 Index header (version 2) with 64‑bit entry counter (identifier == IndexBlock2). More...
struct  IndexHeader3
 Index header (version 3) adding hierarchical chaining (identifier == IndexBlock3). More...
struct  IndexEntry
 Single index entry describing a block's type, (optional) data classification, and file offset. More...
+ + + + + +

+Typedefs

typedef struct IndexHeader IndexHeader
typedef struct IndexHeader2 IndexHeader2
typedef struct IndexHeader3 IndexHeader3
typedef struct IndexEntry IndexEntry
+

Detailed Description

+

On‑disk index block header and entry structures (versions 1, 2 and 3).

+

The index provides a directory of all blocks contained in an Aaru image. Each index block starts with a versioned header (IndexHeader / IndexHeader2 / IndexHeader3) followed by a contiguous array of fixed‑size IndexEntry records. Version 3 adds support for hierarchical (chained / nested) subindexes.

+

Version mapping by block identifier (see BlockType):

    +
  • IndexBlock (v1) -> IndexHeader followed by 16‑bit entry count entries.
  • +
  • IndexBlock2 (v2) -> IndexHeader2 followed by 64‑bit entry count entries.
  • +
  • IndexBlock3 (v3) -> IndexHeader3 with optional hierarchical subindex references.
  • +
+

CRC coverage & endianness:

    +
  • The crc64 field stores a CRC64-ECMA over the entries array ONLY (header bytes are excluded).
  • +
  • For images with imageMajorVersion <= AARUF_VERSION_V1 a legacy writer byte-swapped the CRC; readers compensate (see verify_index_v1/v2/v3). The value in the header remains whatever was originally written.
  • +
+

Hierarchical (v3) behavior:

    +
  • Entries whose blockType == IndexBlock3 refer to subindex blocks; readers recursively load and flatten.
  • +
  • IndexHeader3::previous can point to a preceding index segment (for append / incremental scenarios) or 0.
  • +
  • CRC of the main index does NOT cover subindex contents; each subindex has its own header + CRC.
  • +
+

Invariants / validation recommendations:

    +
  • identifier must equal the expected BlockType variant for that version.
  • +
  • entries > 0 implies the entries array byte size == entries * sizeof(IndexEntry).
  • +
  • crc64 must match recomputed CRC64( entries array ) (after legacy byte swap handling if required).
  • +
  • For v3, if previous != 0 it should point to another IndexBlock3 header (optional best‑effort check).
  • +
+

Notes:

    +
  • Structures are packed (1‑byte alignment). All multi-byte integers are little‑endian on disk.
  • +
  • The index does not store per-entry CRC; integrity relies on each individual block's own CRC plus the index CRC.
  • +
  • dataType in IndexEntry is meaningful only for block types that carry typed data (e.g. DataBlock, DumpHardwareBlock, etc.).
  • +
+

See also: verify_index_v1(), verify_index_v2(), verify_index_v3() for integrity procedures.

+ +

Definition in file index.h.

+

Typedef Documentation

+ +

◆ IndexEntry

+ +
+
+ + + + +
typedef struct IndexEntry IndexEntry
+
+ +
+
+ +

◆ IndexHeader

+ +
+
+ + + + +
typedef struct IndexHeader IndexHeader
+
+ +
+
+ +

◆ IndexHeader2

+ +
+
+ + + + +
typedef struct IndexHeader2 IndexHeader2
+
+ +
+
+ +

◆ IndexHeader3

+ +
+
+ + + + +
typedef struct IndexHeader3 IndexHeader3
+
+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/index_8h.js b/docs/html/index_8h.js new file mode 100644 index 0000000..52a6490 --- /dev/null +++ b/docs/html/index_8h.js @@ -0,0 +1,11 @@ +var index_8h = +[ + [ "IndexHeader", "structIndexHeader.html", "structIndexHeader" ], + [ "IndexHeader2", "structIndexHeader2.html", "structIndexHeader2" ], + [ "IndexHeader3", "structIndexHeader3.html", "structIndexHeader3" ], + [ "IndexEntry", "structIndexEntry.html", "structIndexEntry" ], + [ "IndexEntry", "index_8h.html#a12d666b4c91b2de9ba60887f0783e98d", null ], + [ "IndexHeader", "index_8h.html#af68e20e1f9ee3ea029ed4f69ea82c32f", null ], + [ "IndexHeader2", "index_8h.html#a5f7e5a06dff1100016015c4809277d2a", null ], + [ "IndexHeader3", "index_8h.html#acae06d4f1500d591e6d86b9d52d29a84", null ] +]; \ No newline at end of file diff --git a/docs/html/index_8h_source.html b/docs/html/index_8h_source.html new file mode 100644 index 0000000..a2762bc --- /dev/null +++ b/docs/html/index_8h_source.html @@ -0,0 +1,187 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/index.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
index.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_INDEX_H
+
20#define LIBAARUFORMAT_INDEX_H
+
21
+
22#pragma pack(push, 1)
+
23
+
60
+
+
66typedef struct IndexHeader
+
67{
+
68 uint32_t identifier;
+
69 uint16_t entries;
+
70 uint64_t crc64;
+ +
+
72
+
+
78typedef struct IndexHeader2
+
79{
+
80 uint32_t identifier;
+
81 uint64_t entries;
+
82 uint64_t crc64;
+ +
+
84
+
+
92typedef struct IndexHeader3
+
93{
+
94 uint32_t identifier;
+
95 uint64_t entries;
+
96 uint64_t crc64;
+
97 uint64_t previous;
+ +
+
99
+
+
108typedef struct IndexEntry
+
109{
+
110 uint32_t blockType;
+
111 uint16_t dataType;
+
112 uint64_t offset;
+ +
+
114
+
115#pragma pack(pop)
+
116
+
117#endif // LIBAARUFORMAT_INDEX_H
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
uint32_t blockType
Block identifier of the referenced block (value from BlockType).
Definition index.h:110
+
uint64_t offset
Absolute byte offset in the image where the referenced block header begins.
Definition index.h:112
+
uint16_t dataType
Data classification (value from DataType) or unused for untyped blocks.
Definition index.h:111
+
Index header (version 2) with 64‑bit entry counter (identifier == IndexBlock2).
Definition index.h:79
+
uint64_t entries
Number of IndexEntry records that follow immediately.
Definition index.h:81
+
uint32_t identifier
Block identifier (must be BlockType::IndexBlock2).
Definition index.h:80
+
uint64_t crc64
CRC64-ECMA of the entries array (legacy byte-swapped rule still applies for old versions).
Definition index.h:82
+
Index header (version 3) adding hierarchical chaining (identifier == IndexBlock3).
Definition index.h:93
+
uint64_t previous
File offset of a previous IndexBlock3 header (0 if none / root segment).
Definition index.h:97
+
uint32_t identifier
Block identifier (must be BlockType::IndexBlock3).
Definition index.h:94
+
uint64_t crc64
CRC64-ECMA of the local entries array (does NOT cover subindexes or previous chains).
Definition index.h:96
+
uint64_t entries
Number of IndexEntry records that follow in this (sub)index block.
Definition index.h:95
+
Index header (version 1) for legacy images (identifier == IndexBlock).
Definition index.h:67
+
uint64_t crc64
CRC64-ECMA of the entries array (legacy byte-swapped for early images).
Definition index.h:70
+
uint32_t identifier
Block identifier (must be BlockType::IndexBlock).
Definition index.h:68
+
uint16_t entries
Number of IndexEntry records that follow immediately.
Definition index.h:69
+
+
+
+ + + + diff --git a/docs/html/index__v1_8c.html b/docs/html/index__v1_8c.html new file mode 100644 index 0000000..fda17fe --- /dev/null +++ b/docs/html/index__v1_8c.html @@ -0,0 +1,324 @@ + + + + + + + +libaaruformat: src/index/index_v1.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
index_v1.c File Reference
+
+
+
#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "aaruformat.h"
+#include "log.h"
+#include "utarray.h"
+
+

Go to the source code of this file.

+ + + + + + +

+Functions

UT_array * process_index_v1 (aaruformat_context *ctx)
 Processes an index block (version 1) from the image stream.
int32_t verify_index_v1 (aaruformat_context *ctx)
 Verifies the integrity of an index block (version 1) in the image stream.
+

Function Documentation

+ +

◆ process_index_v1()

+ +
+
+ + + + + + + +
UT_array * process_index_v1 (aaruformat_context * ctx)
+
+ +

Processes an index block (version 1) from the image stream.

+

Reads and parses an index block (version 1) from the image, returning an array of index entries. This function handles the legacy index format used in early AaruFormat versions, providing compatibility with older image files. It reads the IndexHeader structure followed by a sequential list of IndexEntry structures, validating the index identifier for format correctness.

+
Parameters
+ + +
ctxPointer to the aaruformat context containing the image stream and header information.
+
+
+
Returns
Returns one of the following values:
+
Return values
+ + + +
UT_array*Successfully processed the index block. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The index header is successfully read from the position specified in ctx->header.indexOffset
  • +
  • The index identifier matches IndexBlock (legacy format identifier)
  • +
  • All index entries are successfully read and stored in the UT_array
  • +
  • Memory allocation for the index entries array succeeds
  • +
  • The returned array contains all index entries from the version 1 index block
  • +
+
NULLIndex processing failed. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
  • Cannot read the IndexHeader structure from the image stream
  • +
  • The index identifier doesn't match IndexBlock (incorrect format or corruption)
  • +
  • Memory allocation fails for the UT_array structure
  • +
  • File I/O errors occur while reading index entries
  • +
+
+
+
+
Note
Index Structure (Version 1):
    +
  • IndexHeader: Contains identifier (IndexBlock), entry count, and metadata
  • +
  • IndexEntry array: Sequential list of entries describing block locations and types
  • +
  • No CRC validation is performed during processing (use verify_index_v1 for validation)
  • +
  • No compression support in version 1 index format
  • +
+
+
+Memory Management:
    +
  • Returns a newly allocated UT_array that must be freed by the caller using utarray_free()
  • +
  • On error, any partially allocated memory is cleaned up before returning NULL
  • +
  • Each IndexEntry is copied into the array (no reference to original stream data)
  • +
+
+
+Version Compatibility:
    +
  • Supports only legacy IndexBlock format (not IndexBlock2 or IndexBlock3)
  • +
  • Compatible with early AaruFormat and DiscImageChef image files
  • +
  • Does not handle subindex or hierarchical index structures
  • +
+
+
Warning
The caller is responsible for freeing the returned UT_array using utarray_free(). Failure to free the array will result in memory leaks.
+
+This function does not validate the CRC integrity of the index data. Use verify_index_v1() to ensure index integrity before processing.
+
+The function assumes ctx->header.indexOffset points to a valid index block. Invalid offsets may cause file access errors or reading incorrect data.
+ +

Definition at line 79 of file index_v1.c.

+ +

References IndexHeader::entries, FATAL, aaruformat_context::header, IndexHeader::identifier, aaruformat_context::imageStream, IndexBlock, AaruHeaderV2::indexOffset, and TRACE.

+ +

Referenced by aaruf_open(), and aaruf_verify_image().

+ +
+
+ +

◆ verify_index_v1()

+ +
+
+ + + + + + + +
int32_t verify_index_v1 (aaruformat_context * ctx)
+
+ +

Verifies the integrity of an index block (version 1) in the image stream.

+

Checks the CRC64 of the index block without decompressing it. This function performs comprehensive validation of the index structure including header validation, data integrity verification, and version-specific CRC calculation. It ensures the index block is valid and uncorrupted before the image can be safely used for data access.

+
Parameters
+ + +
ctxPointer to the aaruformat context containing image stream and header information.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + +
AARUF_STATUS_OK(0) Successfully verified index integrity. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The index header is successfully read from ctx->header.indexOffset
  • +
  • The index identifier matches IndexBlock (version 1 format)
  • +
  • Memory allocation for index entries succeeds
  • +
  • All index entries are successfully read from the image stream
  • +
  • CRC64 calculation completes successfully with version-specific endianness handling
  • +
  • The calculated CRC64 matches the expected CRC64 in the index header
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) Invalid context or stream. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
+
AARUF_ERROR_CANNOT_READ_HEADER(-6) Index header reading failed. This occurs when:
    +
  • Cannot read the complete IndexHeader structure from the image stream
  • +
  • File I/O errors prevent accessing the header at ctx->header.indexOffset
  • +
  • Insufficient data available at the specified index offset
  • +
+
AARUF_ERROR_CANNOT_READ_INDEX(-19) Index format or data access errors. This occurs when:
    +
  • The index identifier doesn't match IndexBlock (wrong format or corruption)
  • +
  • Cannot read all index entries from the image stream
  • +
  • File I/O errors during index entry reading
  • +
  • Index structure is corrupted or truncated
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Cannot allocate memory for the index entries array
  • +
  • System memory exhaustion prevents loading index data for verification
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-18) CRC64 validation failed. This occurs when:
    +
  • The calculated CRC64 doesn't match the expected CRC64 in the index header
  • +
  • Index data corruption is detected
  • +
  • Data integrity verification fails indicating potential file damage
  • +
+
+
+
+
Note
CRC64 Validation Process:
    +
  • Reads all index entries into memory for CRC calculation
  • +
  • Calculates CRC64 over the complete index entries array
  • +
  • Applies version-specific endianness conversion for compatibility
  • +
  • For imageMajorVersion <= AARUF_VERSION_V1: Uses bswap_64() for byte order correction
  • +
  • Compares calculated CRC64 with the value stored in the index header
  • +
+
+
+Version Compatibility:
    +
  • Handles legacy byte order differences from original C# implementation
  • +
  • Supports IndexBlock format (version 1 only)
  • +
  • Does not support IndexBlock2 or IndexBlock3 formats
  • +
+
+
+Memory Management:
    +
  • Allocates temporary memory for index entries during verification
  • +
  • Automatically frees allocated memory on both success and error conditions
  • +
  • Memory usage is proportional to the number of index entries
  • +
+
+
+Verification Scope:
    +
  • Validates index header structure and identifier
  • +
  • Verifies data integrity through CRC64 calculation
  • +
  • Does not validate individual index entry contents or block references
  • +
  • Does not check for logical consistency of referenced blocks
  • +
+
+
Warning
This function reads the entire index into memory for CRC calculation. Large indexes may require significant memory allocation.
+
+The function assumes ctx->header.indexOffset points to a valid index location. Invalid offsets will cause file access errors or incorrect validation.
+
+CRC validation failure indicates potential data corruption and may suggest the image file is damaged or has been modified outside of library control.
+ +

Definition at line 225 of file index_v1.c.

+ +

References aaruf_crc64_data(), AARUF_ERROR_CANNOT_READ_HEADER, AARUF_ERROR_CANNOT_READ_INDEX, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_STATUS_OK, AARUF_VERSION_V1, bswap_64, IndexHeader::crc64, IndexHeader::entries, FATAL, aaruformat_context::header, IndexHeader::identifier, AaruHeaderV2::imageMajorVersion, aaruformat_context::imageStream, IndexBlock, AaruHeaderV2::indexOffset, and TRACE.

+ +

Referenced by aaruf_verify_image().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/index__v1_8c.js b/docs/html/index__v1_8c.js new file mode 100644 index 0000000..317c419 --- /dev/null +++ b/docs/html/index__v1_8c.js @@ -0,0 +1,5 @@ +var index__v1_8c = +[ + [ "process_index_v1", "index__v1_8c.html#a5d3b1092abc36a27a441a01a8a0b3b48", null ], + [ "verify_index_v1", "index__v1_8c.html#a89ed93d216c4dce0ae5e2acccf8cc2b4", null ] +]; \ No newline at end of file diff --git a/docs/html/index__v1_8c_source.html b/docs/html/index__v1_8c_source.html new file mode 100644 index 0000000..44c2645 --- /dev/null +++ b/docs/html/index__v1_8c_source.html @@ -0,0 +1,320 @@ + + + + + + + +libaaruformat: src/index/index_v1.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
index_v1.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <stdint.h>
+
20#include <stdio.h>
+
21#include <stdlib.h>
+
22
+
23#include "aaruformat.h"
+
24#include "log.h"
+
25#include "utarray.h"
+
26
+
+ +
80{
+
81 TRACE("Entering process_index_v1(%p)", ctx);
+
82
+
83 UT_array *index_entries = NULL;
+
84 IndexEntry entry;
+
85
+
86 if(ctx == NULL || ctx->imageStream == NULL) return NULL;
+
87
+
88 // Initialize the index entries array
+
89 const UT_icd index_entry_icd = {sizeof(IndexEntry), NULL, NULL, NULL};
+
90
+
91 utarray_new(index_entries, &index_entry_icd);
+
92
+
93 if(index_entries == NULL)
+
94 {
+
95 FATAL("Could not allocate memory for index entries array.");
+
96 TRACE("Exiting process_index_v1() = NULL");
+
97 return NULL;
+
98 }
+
99
+
100 // Read the index header
+
101 TRACE("Reading index header at position %llu", ctx->header.indexOffset);
+
102 if(fseek(ctx->imageStream, ctx->header.indexOffset, SEEK_SET) != 0)
+
103 {
+
104 FATAL("Could not seek to index header at %llu.", ctx->header.indexOffset);
+
105 utarray_free(index_entries);
+
106
+
107 TRACE("Exiting process_index_v1() = NULL");
+
108 return NULL;
+
109 }
+
110
+
111 IndexHeader idx_header;
+
112 if(fread(&idx_header, sizeof(IndexHeader), 1, ctx->imageStream) != 1)
+
113 {
+
114 FATAL("Could not read index header at %llu.", ctx->header.indexOffset);
+
115 utarray_free(index_entries);
+
116
+
117 TRACE("Exiting process_index_v1() = NULL");
+
118 return NULL;
+
119 }
+
120
+
121 // Check if the index header is valid
+
122 if(idx_header.identifier != IndexBlock)
+
123 {
+
124 FATAL("Incorrect index identifier.");
+
125 utarray_free(index_entries);
+
126
+
127 TRACE("Exiting process_index_v1() = NULL");
+
128 return NULL;
+
129 }
+
130
+
131 for(int i = 0; i < idx_header.entries; i++)
+
132 {
+
133 if(fread(&entry, sizeof(IndexEntry), 1, ctx->imageStream) != 1)
+
134 {
+
135 FATAL("Could not read index entry %d at %llu.", i, ctx->header.indexOffset);
+
136 utarray_free(index_entries);
+
137
+
138 TRACE("Exiting process_index_v1() = NULL");
+
139 return NULL;
+
140 }
+
141
+
142 utarray_push_back(index_entries, &entry);
+
143 }
+
144
+
145 TRACE("Read %d index entries from index block at position %llu", idx_header.entries, ctx->header.indexOffset);
+
146 return index_entries;
+
147}
+
+
148
+
+ +
226{
+
227 TRACE("Entering verify_index_v1(%p)", ctx);
+
228
+
229 size_t read_bytes = 0;
+
230 IndexHeader index_header;
+
231 uint64_t crc64 = 0;
+
232 IndexEntry *index_entries = NULL;
+
233
+
234 if(ctx == NULL || ctx->imageStream == NULL)
+
235 {
+
236 FATAL("Invalid context or image stream.");
+
237
+
238 TRACE("Exiting verify_index_v1() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
240 }
+
241
+
242 // This will traverse all blocks and check their CRC64 without uncompressing them
+
243 TRACE("Checking index integrity at %llu.", ctx->header.indexOffset);
+
244 if(fseek(ctx->imageStream, ctx->header.indexOffset, SEEK_SET) != 0)
+
245 {
+
246 FATAL("Could not seek to index header at %llu.", ctx->header.indexOffset);
+
247
+
248 TRACE("Exiting verify_index_v1() = AARUF_ERROR_CANNOT_READ_HEADER");
+ +
250 }
+
251
+
252 // Read the index header
+
253 TRACE("Reading index header at position %llu", ctx->header.indexOffset);
+
254 read_bytes = fread(&index_header, 1, sizeof(IndexHeader), ctx->imageStream);
+
255
+
256 if(read_bytes != sizeof(IndexHeader))
+
257 {
+
258 FATAL("Could not read index header.");
+
259
+
260 TRACE("Exiting verify_index_v1() = AARUF_ERROR_CANNOT_READ_HEADER");
+ +
262 }
+
263
+
264 if(index_header.identifier != IndexBlock)
+
265 {
+
266 FATAL("Incorrect index identifier.");
+
267
+
268 TRACE("Exiting verify_index_v1() = AARUF_ERROR_CANNOT_READ_INDEX");
+ +
270 }
+
271
+
272 TRACE("Index at %llu contains %d entries.", ctx->header.indexOffset, index_header.entries);
+
273 fprintf(stderr, "Index at %llu contains %d entries.", ctx->header.indexOffset, index_header.entries);
+
274
+
275 index_entries = malloc(sizeof(IndexEntry) * index_header.entries);
+
276
+
277 if(index_entries == NULL)
+
278 {
+
279 FATAL("Cannot allocate memory for index entries.");
+ +
281 }
+
282
+
283 read_bytes = fread(index_entries, 1, sizeof(IndexEntry) * index_header.entries, ctx->imageStream);
+
284
+
285 if(read_bytes != sizeof(IndexEntry) * index_header.entries)
+
286 {
+
287 FATAL("Could not read index entries.");
+
288 free(index_entries);
+
289
+
290 TRACE("Exiting verify_index_v1() = AARUF_ERROR_CANNOT_READ_INDEX");
+ +
292 }
+
293
+
294 crc64 = aaruf_crc64_data((const uint8_t *)index_entries, sizeof(IndexEntry) * index_header.entries);
+
295
+
296 // Due to how C# wrote it, it is effectively reversed
+
297 if(ctx->header.imageMajorVersion <= AARUF_VERSION_V1) crc64 = bswap_64(crc64);
+
298
+
299 if(crc64 != index_header.crc64)
+
300 {
+
301 FATAL("Expected index CRC 0x%16llX but got 0x%16llX.", index_header.crc64, crc64);
+
302 free(index_entries);
+
303
+
304 TRACE("Exiting verify_index_v1() = AARUF_ERROR_INVALID_BLOCK_CRC");
+ +
306 }
+
307
+
308 free(index_entries);
+
309
+
310 TRACE("Exiting verify_index_v1() = AARUF_OK");
+
311 return AARUF_STATUS_OK;
+
312}
+
+ +
#define AARUF_VERSION_V1
First on‑disk version (C# implementation).
Definition consts.h:71
+
uint64_t aaruf_crc64_data(const uint8_t *data, uint32_t len)
Definition crc64.c:160
+
#define bswap_64(x)
Definition endian.h:81
+
@ IndexBlock
Block containing the index (v1).
Definition enums.h:145
+
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
Definition errors.h:75
+
#define AARUF_ERROR_CANNOT_READ_HEADER
Failed to read container header.
Definition errors.h:45
+
#define AARUF_ERROR_NOT_ENOUGH_MEMORY
Memory allocation failure (critical).
Definition errors.h:48
+
#define AARUF_ERROR_INVALID_BLOCK_CRC
CRC64 mismatch indicating corruption.
Definition errors.h:57
+
#define AARUF_ERROR_CANNOT_READ_INDEX
Index block unreadable / truncated / bad identifier.
Definition errors.h:43
+
#define AARUF_ERROR_NOT_AARUFORMAT
Input file/stream failed magic or structural validation.
Definition errors.h:40
+
UT_array * process_index_v1(aaruformat_context *ctx)
Processes an index block (version 1) from the image stream.
Definition index_v1.c:79
+
int32_t verify_index_v1(aaruformat_context *ctx)
Verifies the integrity of an index block (version 1) in the image stream.
Definition index_v1.c:225
+ +
#define FATAL(fmt,...)
Definition log.h:40
+
#define TRACE(fmt,...)
Definition log.h:25
+
uint64_t indexOffset
Absolute byte offset to primary index block (MUST be > 0; 0 => corrupt/unreadable).
Definition header.h:115
+
uint8_t imageMajorVersion
Container format major version.
Definition header.h:110
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
Index header (version 1) for legacy images (identifier == IndexBlock).
Definition index.h:67
+
uint64_t crc64
CRC64-ECMA of the entries array (legacy byte-swapped for early images).
Definition index.h:70
+
uint32_t identifier
Block identifier (must be BlockType::IndexBlock).
Definition index.h:68
+
uint16_t entries
Number of IndexEntry records that follow immediately.
Definition index.h:69
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
AaruHeaderV2 header
Parsed container header (v2).
Definition context.h:175
+
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
+
+
+
+ + + + diff --git a/docs/html/index__v2_8c.html b/docs/html/index__v2_8c.html new file mode 100644 index 0000000..325547e --- /dev/null +++ b/docs/html/index__v2_8c.html @@ -0,0 +1,326 @@ + + + + + + + +libaaruformat: src/index/index_v2.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
index_v2.c File Reference
+
+
+
#include <limits.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "aaruformat.h"
+#include "log.h"
+#include "utarray.h"
+
+

Go to the source code of this file.

+ + + + + + +

+Functions

UT_array * process_index_v2 (aaruformat_context *ctx)
 Processes an index block (version 2) from the image stream.
int32_t verify_index_v2 (aaruformat_context *ctx)
 Verifies the integrity of an index block (version 2) in the image stream.
+

Function Documentation

+ +

◆ process_index_v2()

+ +
+
+ + + + + + + +
UT_array * process_index_v2 (aaruformat_context * ctx)
+
+ +

Processes an index block (version 2) from the image stream.

+

Reads and parses an index block (version 2) from the image, returning an array of index entries. This function handles the intermediate index format used in mid-generation AaruFormat versions, providing compatibility with version 2 image files. It reads the IndexHeader2 structure followed by a sequential list of IndexEntry structures, validating the index identifier for format correctness.

+
Parameters
+ + +
ctxPointer to the aaruformat context containing the image stream and header information.
+
+
+
Returns
Returns one of the following values:
+
Return values
+ + + +
UT_array*Successfully processed the index block. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The index header is successfully read from the position specified in ctx->header.indexOffset
  • +
  • The index identifier matches IndexBlock2 (version 2 format identifier)
  • +
  • All index entries are successfully read and stored in the UT_array
  • +
  • Memory allocation for the index entries array succeeds
  • +
  • The returned array contains all index entries from the version 2 index block
  • +
+
NULLIndex processing failed. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
  • Cannot read the IndexHeader2 structure from the image stream
  • +
  • The index identifier doesn't match IndexBlock2 (incorrect format or corruption)
  • +
  • Memory allocation fails for the UT_array structure
  • +
  • File I/O errors occur while reading index entries
  • +
+
+
+
+
Note
Index Structure (Version 2):
    +
  • IndexHeader2: Contains identifier (IndexBlock2), entry count, and enhanced metadata
  • +
  • IndexEntry array: Sequential list of entries describing block locations and types
  • +
  • No CRC validation is performed during processing (use verify_index_v2 for validation)
  • +
  • No compression support in version 2 index format
  • +
  • Compatible with mid-generation AaruFormat improvements
  • +
+
+
+Memory Management:
    +
  • Returns a newly allocated UT_array that must be freed by the caller using utarray_free()
  • +
  • On error, any partially allocated memory is cleaned up before returning NULL
  • +
  • Each IndexEntry is copied into the array (no reference to original stream data)
  • +
+
+
+Version Compatibility:
    +
  • Supports only IndexBlock2 format (not IndexBlock or IndexBlock3)
  • +
  • Compatible with intermediate AaruFormat image files
  • +
  • Does not handle subindex or hierarchical index structures (introduced in v3)
  • +
+
+
Warning
The caller is responsible for freeing the returned UT_array using utarray_free(). Failure to free the array will result in memory leaks.
+
+This function does not validate the CRC integrity of the index data. Use verify_index_v2() to ensure index integrity before processing.
+
+The function assumes ctx->header.indexOffset points to a valid index block. Invalid offsets may cause file access errors or reading incorrect data.
+ +

Definition at line 81 of file index_v2.c.

+ +

References IndexHeader2::entries, FATAL, aaruformat_context::header, IndexHeader2::identifier, aaruformat_context::imageStream, IndexBlock2, AaruHeaderV2::indexOffset, and TRACE.

+ +

Referenced by aaruf_open(), and aaruf_verify_image().

+ +
+
+ +

◆ verify_index_v2()

+ +
+
+ + + + + + + +
int32_t verify_index_v2 (aaruformat_context * ctx)
+
+ +

Verifies the integrity of an index block (version 2) in the image stream.

+

Checks the CRC64 of the index block without decompressing it. This function performs comprehensive validation of the version 2 index structure including header validation, data integrity verification, and version-specific CRC calculation. It ensures the index block is valid and uncorrupted before the image can be safely used for data access.

+
Parameters
+ + +
ctxPointer to the aaruformat context containing image stream and header information.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + +
AARUF_STATUS_OK(0) Successfully verified index integrity. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The index header is successfully read from ctx->header.indexOffset
  • +
  • The index identifier matches IndexBlock2 (version 2 format)
  • +
  • Memory allocation for index entries succeeds
  • +
  • All index entries are successfully read from the image stream
  • +
  • CRC64 calculation completes successfully with version-specific endianness handling
  • +
  • The calculated CRC64 matches the expected CRC64 in the index header
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) Invalid context or stream. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
+
AARUF_ERROR_CANNOT_READ_HEADER(-6) Index header reading failed. This occurs when:
    +
  • Cannot read the complete IndexHeader2 structure from the image stream
  • +
  • File I/O errors prevent accessing the header at ctx->header.indexOffset
  • +
  • Insufficient data available at the specified index offset
  • +
+
AARUF_ERROR_CANNOT_READ_INDEX(-19) Index format or data access errors. This occurs when:
    +
  • The index identifier doesn't match IndexBlock2 (wrong format or corruption)
  • +
  • Cannot read all index entries from the image stream
  • +
  • File I/O errors during index entry reading
  • +
  • Index structure is corrupted or truncated
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Cannot allocate memory for the index entries array
  • +
  • System memory exhaustion prevents loading index data for verification
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-18) CRC64 validation failed. This occurs when:
    +
  • The calculated CRC64 doesn't match the expected CRC64 in the index header
  • +
  • Index data corruption is detected
  • +
  • Data integrity verification fails indicating potential file damage
  • +
+
+
+
+
Note
CRC64 Validation Process:
    +
  • Reads all index entries into memory for CRC calculation
  • +
  • Calculates CRC64 over the complete index entries array
  • +
  • Applies version-specific endianness conversion for compatibility
  • +
  • For imageMajorVersion <= AARUF_VERSION_V1: Uses bswap_64() for byte order correction
  • +
  • Compares calculated CRC64 with the value stored in the IndexHeader2
  • +
+
+
+Version 2 Enhancements:
    +
  • Uses IndexHeader2 structure with enhanced metadata support
  • +
  • Maintains compatibility with legacy endianness handling
  • +
  • Supports improved index entry organization compared to version 1
  • +
+
+
+Memory Management:
    +
  • Allocates temporary memory for index entries during verification
  • +
  • Automatically frees allocated memory on both success and error conditions
  • +
  • Memory usage is proportional to the number of index entries
  • +
+
+
+Verification Scope:
    +
  • Validates index header structure and identifier
  • +
  • Verifies data integrity through CRC64 calculation
  • +
  • Does not validate individual index entry contents or block references
  • +
  • Does not check for logical consistency of referenced blocks
  • +
+
+
Warning
This function reads the entire index into memory for CRC calculation. Large indexes may require significant memory allocation.
+
+The function assumes ctx->header.indexOffset points to a valid index location. Invalid offsets will cause file access errors or incorrect validation.
+
+CRC validation failure indicates potential data corruption and may suggest the image file is damaged or has been modified outside of library control.
+ +

Definition at line 227 of file index_v2.c.

+ +

References aaruf_crc64_final(), aaruf_crc64_free(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_READ_HEADER, AARUF_ERROR_CANNOT_READ_INDEX, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_STATUS_OK, AARUF_VERSION_V1, bswap_64, IndexHeader2::crc64, IndexHeader2::entries, FATAL, aaruformat_context::header, IndexHeader2::identifier, AaruHeaderV2::imageMajorVersion, aaruformat_context::imageStream, IndexBlock2, AaruHeaderV2::indexOffset, and TRACE.

+ +

Referenced by aaruf_verify_image().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/index__v2_8c.js b/docs/html/index__v2_8c.js new file mode 100644 index 0000000..644f286 --- /dev/null +++ b/docs/html/index__v2_8c.js @@ -0,0 +1,5 @@ +var index__v2_8c = +[ + [ "process_index_v2", "index__v2_8c.html#a1baad6508d1cde5a712794e956fb3d3c", null ], + [ "verify_index_v2", "index__v2_8c.html#ae234e22b16b085d18614110630034db5", null ] +]; \ No newline at end of file diff --git a/docs/html/index__v2_8c_source.html b/docs/html/index__v2_8c_source.html new file mode 100644 index 0000000..625c4ee --- /dev/null +++ b/docs/html/index__v2_8c_source.html @@ -0,0 +1,384 @@ + + + + + + + +libaaruformat: src/index/index_v2.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
index_v2.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <limits.h>
+
20#include <stdint.h>
+
21#include <stdio.h>
+
22#include <stdlib.h>
+
23
+
24#include "aaruformat.h"
+
25#include "log.h"
+
26#include "utarray.h"
+
27
+
+ +
82{
+
83 TRACE("Entering process_index_v2(%p)", ctx);
+
84
+
85 UT_array *index_entries = NULL;
+
86 IndexEntry entry;
+
87
+
88 if(ctx == NULL || ctx->imageStream == NULL) { return NULL; }
+
89
+
90 // Initialize the index entries array
+
91 const UT_icd index_entry_icd = {sizeof(IndexEntry), NULL, NULL, NULL};
+
92
+
93 utarray_new(index_entries, &index_entry_icd);
+
94
+
95 if(index_entries == NULL)
+
96 {
+
97 FATAL("Could not allocate memory for index entries array.");
+
98 TRACE("Exiting process_index_v2() = NULL");
+
99 return NULL;
+
100 }
+
101
+
102 // Read the index header
+
103 TRACE("Reading index header at position %llu", ctx->header.indexOffset);
+
104 if(fseek(ctx->imageStream, ctx->header.indexOffset, SEEK_SET) != 0)
+
105 {
+
106 FATAL("Could not seek to index header at %llu.", ctx->header.indexOffset);
+
107 utarray_free(index_entries);
+
108
+
109 TRACE("Exiting process_index_v2() = NULL");
+
110 return NULL;
+
111 }
+
112 IndexHeader2 idx_header;
+
113 if(fread(&idx_header, sizeof(IndexHeader2), 1, ctx->imageStream) != 1)
+
114 {
+
115 FATAL("Could not read index header at %llu.", ctx->header.indexOffset);
+
116 utarray_free(index_entries);
+
117
+
118 TRACE("Exiting process_index_v2() = NULL");
+
119 return NULL;
+
120 }
+
121
+
122 // Check if the index header is valid
+
123 if(idx_header.identifier != IndexBlock2)
+
124 {
+
125 FATAL("Incorrect index identifier.");
+
126 utarray_free(index_entries);
+
127
+
128 TRACE("Exiting process_index_v2() = NULL");
+
129 return NULL;
+
130 }
+
131
+
132 for(uint64_t i = 0; i < idx_header.entries; i++)
+
133 {
+
134 if(fread(&entry, sizeof(IndexEntry), 1, ctx->imageStream) != 1)
+
135 {
+
136 FATAL("Could not read index entry %llu at %llu.", (unsigned long long)i, ctx->header.indexOffset);
+
137 utarray_free(index_entries);
+
138
+
139 TRACE("Exiting process_index_v2() = NULL");
+
140 return NULL;
+
141 }
+
142
+
143 utarray_push_back(index_entries, &entry);
+
144 }
+
145
+
146 TRACE("Read %llu index entries from index block at position %llu", (unsigned long long)idx_header.entries,
+
147 ctx->header.indexOffset);
+
148 return index_entries;
+
149}
+
+
150
+
+ +
228{
+
229 TRACE("Entering verify_index_v2(%p)", ctx);
+
230
+
231 size_t read_bytes = 0;
+
232 IndexHeader2 index_header;
+
233 uint64_t crc64 = 0;
+
234 IndexEntry *index_entries = NULL;
+
235
+
236 if(ctx == NULL || ctx->imageStream == NULL)
+
237 {
+
238 FATAL("Invalid context or image stream.");
+
239
+
240 TRACE("Exiting verify_index_v2() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
242 }
+
243
+
244 // This will traverse all blocks and check their CRC64 without uncompressing them
+
245 TRACE("Checking index integrity at %llu.", ctx->header.indexOffset);
+
246 if(fseek(ctx->imageStream, ctx->header.indexOffset, SEEK_SET) != 0)
+
247 {
+
248 FATAL("Could not seek to index header at %llu.", ctx->header.indexOffset);
+
249
+
250 TRACE("Exiting verify_index_v2() = AARUF_ERROR_CANNOT_READ_HEADER");
+ +
252 }
+
253
+
254 // Read the index header
+
255 TRACE("Reading index header at position %llu", ctx->header.indexOffset);
+
256 read_bytes = fread(&index_header, 1, sizeof(IndexHeader2), ctx->imageStream);
+
257
+
258 if(read_bytes != sizeof(IndexHeader2))
+
259 {
+
260 FATAL("Could not read index header.");
+
261
+
262 TRACE("Exiting verify_index_v2() = AARUF_ERROR_CANNOT_READ_HEADER");
+ +
264 }
+
265
+
266 if(index_header.identifier != IndexBlock2)
+
267 {
+
268 FATAL("Incorrect index identifier.");
+
269
+
270 TRACE("Exiting verify_index_v2() = AARUF_ERROR_CANNOT_READ_INDEX");
+ +
272 }
+
273
+
274 TRACE("Index at %llu contains %llu entries.", ctx->header.indexOffset, (unsigned long long)index_header.entries);
+
275
+
276 if(index_header.entries != 0 && index_header.entries > SIZE_MAX / sizeof(IndexEntry))
+
277 {
+
278 FATAL("Index entry count %llu is too large to process.", (unsigned long long)index_header.entries);
+
279
+
280 TRACE("Exiting verify_index_v2() = AARUF_ERROR_NOT_ENOUGH_MEMORY");
+ +
282 }
+
283
+
284 const size_t entries_size = (size_t)index_header.entries * sizeof(IndexEntry);
+
285
+
286 if(entries_size > 0)
+
287 {
+
288 index_entries = malloc(entries_size);
+
289
+
290 if(index_entries == NULL)
+
291 {
+
292 FATAL("Cannot allocate memory for index entries.");
+
293
+
294 TRACE("Exiting verify_index_v2() = AARUF_ERROR_NOT_ENOUGH_MEMORY");
+ +
296 }
+
297
+
298 read_bytes = fread(index_entries, 1, entries_size, ctx->imageStream);
+
299
+
300 if(read_bytes != entries_size)
+
301 {
+
302 FATAL("Could not read index entries.");
+
303 free(index_entries);
+
304
+
305 TRACE("Exiting verify_index_v2() = AARUF_ERROR_CANNOT_READ_INDEX");
+ +
307 }
+
308 }
+
309
+
310 crc64_ctx *crc_ctx = aaruf_crc64_init();
+
311
+
312 if(crc_ctx == NULL)
+
313 {
+
314 FATAL("Cannot initialize CRC64 context.");
+
315 free(index_entries);
+
316
+
317 TRACE("Exiting verify_index_v2() = AARUF_ERROR_NOT_ENOUGH_MEMORY");
+ +
319 }
+
320
+
321 if(entries_size > 0)
+
322 {
+
323 const uint8_t *cursor = (const uint8_t *)index_entries;
+
324 size_t remaining = entries_size;
+
325
+
326 while(remaining > 0)
+
327 {
+
328 const uint32_t chunk = remaining > UINT32_MAX ? UINT32_MAX : (uint32_t)remaining;
+
329
+
330 if(aaruf_crc64_update(crc_ctx, cursor, chunk) != 0)
+
331 {
+
332 FATAL("Failed to update index CRC.");
+
333 aaruf_crc64_free(crc_ctx);
+
334 free(index_entries);
+
335
+
336 TRACE("Exiting verify_index_v2() = AARUF_ERROR_CANNOT_READ_INDEX");
+ +
338 }
+
339
+
340 cursor += chunk;
+
341 remaining -= chunk;
+
342 }
+
343 }
+
344
+
345 if(aaruf_crc64_final(crc_ctx, &crc64) != 0)
+
346 {
+
347 FATAL("Failed to finalize index CRC.");
+
348 aaruf_crc64_free(crc_ctx);
+
349 free(index_entries);
+
350
+
351 TRACE("Exiting verify_index_v2() = AARUF_ERROR_CANNOT_READ_INDEX");
+ +
353 }
+
354
+
355 aaruf_crc64_free(crc_ctx);
+
356
+
357 // Due to how C# wrote it, it is effectively reversed
+
358 if(ctx->header.imageMajorVersion <= AARUF_VERSION_V1) crc64 = bswap_64(crc64);
+
359
+
360 if(crc64 != index_header.crc64)
+
361 {
+
362 FATAL("Expected index CRC 0x%16llX but got 0x%16llX.", index_header.crc64, crc64);
+
363 free(index_entries);
+
364
+
365 TRACE("Exiting verify_index_v2() = AARUF_ERROR_INVALID_BLOCK_CRC");
+ +
367 }
+
368
+
369 free(index_entries);
+
370
+
371 TRACE("Exiting verify_index_v2() = AARUF_OK");
+
372 return AARUF_STATUS_OK;
+
373}
+
+ +
#define AARUF_VERSION_V1
First on‑disk version (C# implementation).
Definition consts.h:71
+
int aaruf_crc64_update(crc64_ctx *ctx, const uint8_t *data, uint32_t len)
Updates the CRC64 context with new data.
Definition crc64.c:55
+
void aaruf_crc64_free(crc64_ctx *ctx)
Frees a CRC64 context.
Definition crc64.c:155
+
crc64_ctx * aaruf_crc64_init()
Initializes a CRC64 context.
Definition crc64.c:32
+
int aaruf_crc64_final(crc64_ctx *ctx, uint64_t *crc)
Computes the final CRC64 value from the context.
Definition crc64.c:141
+
#define bswap_64(x)
Definition endian.h:81
+
@ IndexBlock2
Block containing the index v2.
Definition enums.h:146
+
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
Definition errors.h:75
+
#define AARUF_ERROR_CANNOT_READ_HEADER
Failed to read container header.
Definition errors.h:45
+
#define AARUF_ERROR_NOT_ENOUGH_MEMORY
Memory allocation failure (critical).
Definition errors.h:48
+
#define AARUF_ERROR_INVALID_BLOCK_CRC
CRC64 mismatch indicating corruption.
Definition errors.h:57
+
#define AARUF_ERROR_CANNOT_READ_INDEX
Index block unreadable / truncated / bad identifier.
Definition errors.h:43
+
#define AARUF_ERROR_NOT_AARUFORMAT
Input file/stream failed magic or structural validation.
Definition errors.h:40
+
UT_array * process_index_v2(aaruformat_context *ctx)
Processes an index block (version 2) from the image stream.
Definition index_v2.c:81
+
int32_t verify_index_v2(aaruformat_context *ctx)
Verifies the integrity of an index block (version 2) in the image stream.
Definition index_v2.c:227
+ +
#define FATAL(fmt,...)
Definition log.h:40
+
#define TRACE(fmt,...)
Definition log.h:25
+
uint64_t indexOffset
Absolute byte offset to primary index block (MUST be > 0; 0 => corrupt/unreadable).
Definition header.h:115
+
uint8_t imageMajorVersion
Container format major version.
Definition header.h:110
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
Index header (version 2) with 64‑bit entry counter (identifier == IndexBlock2).
Definition index.h:79
+
uint64_t entries
Number of IndexEntry records that follow immediately.
Definition index.h:81
+
uint32_t identifier
Block identifier (must be BlockType::IndexBlock2).
Definition index.h:80
+
uint64_t crc64
CRC64-ECMA of the entries array (legacy byte-swapped rule still applies for old versions).
Definition index.h:82
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
AaruHeaderV2 header
Parsed container header (v2).
Definition context.h:175
+
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
+
Minimal ECMA-182 CRC64 incremental state container (running value only).
Definition crc64.h:56
+
+
+
+ + + + diff --git a/docs/html/index__v3_8c.html b/docs/html/index__v3_8c.html new file mode 100644 index 0000000..6558629 --- /dev/null +++ b/docs/html/index__v3_8c.html @@ -0,0 +1,465 @@ + + + + + + + +libaaruformat: src/index/index_v3.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
index_v3.c File Reference
+
+
+
#include <limits.h>
+#include <stdbool.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "aaruformat.h"
+#include "internal.h"
+#include "log.h"
+#include "utarray.h"
+
+

Go to the source code of this file.

+ + + + + + + + +

+Functions

static bool add_subindex_entries (aaruformat_context *ctx, UT_array *index_entries, const IndexEntry *subindex_entry)
 Adds entries from a subindex block (version 3) to the main index entries array.
UT_array * process_index_v3 (aaruformat_context *ctx)
 Processes an index block (version 3) from the image stream.
int32_t verify_index_v3 (aaruformat_context *ctx)
 Verifies the integrity of an index block (version 3) in the image stream.
+

Function Documentation

+ +

◆ add_subindex_entries()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + +
bool add_subindex_entries (aaruformat_context * ctx,
UT_array * index_entries,
const IndexEntry * subindex_entry )
+
+static
+
+ +

Adds entries from a subindex block (version 3) to the main index entries array.

+

Recursively reads subindex blocks and appends their entries to the main index entries array. This function is a critical component of the hierarchical index system in AaruFormat version 3, enabling scalable index organization for large image files. It performs recursive traversal of subindex structures, flattening the hierarchy into a single array while maintaining entry order and handling nested subindex references.

+
Parameters
+ + + + +
ctxPointer to the aaruformat context containing the image stream.
index_entriesPointer to the UT_array of main index entries to append to.
subindex_entryPointer to the IndexEntry describing the subindex location and metadata.
+
+
+
Returns
Returns true when entries are appended successfully, false when an error occurs.
+
Note
Function Behavior:
    +
  • Successfully appends subindex entries when all parameters are valid and file I/O succeeds
  • +
  • Recursively processes nested subindexes when entries have blockType == IndexBlock3
  • +
  • Returns false without modifying the array when validation fails or errors occur
  • +
  • Does not perform error reporting beyond logging (errors are handled gracefully)
  • +
+
+
+Success Conditions - Entries are added when:
    +
  • All input parameters (ctx, index_entries, subindex_entry) are non-NULL
  • +
  • The image stream is valid and accessible
  • +
  • File positioning succeeds to subindex_entry->offset
  • +
  • The subindex header is successfully read from the image stream
  • +
  • The subindex identifier matches IndexBlock3 (correct format)
  • +
  • All entries in the subindex are successfully read and processed
  • +
  • Recursive calls for nested subindexes complete successfully
  • +
+
+
+Failure Conditions - Function returns false when:
    +
  • Any input parameter is NULL (ctx, index_entries, or subindex_entry)
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
  • File I/O errors prevent reading the subindex header or entries
  • +
  • The subindex identifier doesn't match IndexBlock3 (format mismatch or corruption)
  • +
  • Memory operations fail during UT_array manipulation
  • +
+
+
+Recursive Processing:
    +
  • When an entry has blockType == IndexBlock3, it indicates another subindex
  • +
  • The function recursively calls itself to process nested subindexes
  • +
  • Supports arbitrary nesting depth limited only by stack space and file structure
  • +
  • All entries are flattened into the main index_entries array regardless of nesting level
  • +
+
+
+Memory and Performance:
    +
  • Memory usage scales with the total number of entries across all processed subindexes
  • +
  • File I/O is performed for each subindex block accessed
  • +
  • Processing time increases with the depth and breadth of subindex hierarchies
  • +
  • No internal memory allocation - uses existing UT_array structure
  • +
+
+
+Error Handling:
    +
  • Designed for graceful degradation - errors don't propagate to callers
  • +
  • Invalid subindexes are skipped without affecting other processing
  • +
  • Partial success is possible when some subindexes fail but others succeed
  • +
  • Logging provides visibility into processing failures for debugging
  • +
+
+
Warning
This function modifies the index_entries array by appending new entries. Ensure the array has sufficient capacity and is properly initialized.
+
+Recursive processing can cause significant stack usage for deeply nested subindex structures. Very deep hierarchies may cause stack overflow.
+
+The function assumes subindex_entry->offset points to a valid subindex block. Invalid offsets will cause file access errors but are handled gracefully.
+
+No validation is performed on individual IndexEntry contents - only structural validation of subindex headers is done.
+ +

Definition at line 247 of file index_v3.c.

+ +

References add_subindex_entries(), IndexEntry::blockType, IndexHeader3::entries, FATAL, IndexHeader3::identifier, aaruformat_context::imageStream, IndexBlock3, IndexEntry::offset, and TRACE.

+ +

Referenced by add_subindex_entries(), and process_index_v3().

+ +
+
+ +

◆ process_index_v3()

+ +
+
+ + + + + + + +
UT_array * process_index_v3 (aaruformat_context * ctx)
+
+ +

Processes an index block (version 3) from the image stream.

+

Reads and parses an index block (version 3) from the image, returning an array of index entries. This function handles the advanced index format used in current AaruFormat versions, supporting hierarchical subindex structures for improved scalability. It reads the IndexHeader3 structure followed by index entries, recursively processing any subindex blocks encountered to create a flattened array of all index entries.

+
Parameters
+ + +
ctxPointer to the aaruformat context containing the image stream and header information.
+
+
+
Returns
Returns one of the following values:
+
Return values
+ + + +
UT_array*Successfully processed the index block and all subindexes. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The index header is successfully read from the position specified in ctx->header.indexOffset
  • +
  • The index identifier matches IndexBlock3 (version 3 format identifier)
  • +
  • All index entries are successfully read and stored in the UT_array
  • +
  • Any subindex blocks (IndexBlock3 entries) are recursively processed via add_subindex_entries()
  • +
  • Memory allocation for the index entries array succeeds
  • +
  • The returned array contains all index entries from the main index and all subindexes
  • +
+
NULLIndex processing failed. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
  • Cannot read the IndexHeader3 structure from the image stream
  • +
  • The index identifier doesn't match IndexBlock3 (incorrect format or corruption)
  • +
  • Memory allocation fails for the UT_array structure
  • +
  • File I/O errors occur while reading index entries
  • +
  • Recursive subindex processing fails (errors in add_subindex_entries())
  • +
+
+
+
+
Note
Index Structure (Version 3):
    +
  • IndexHeader3: Contains identifier (IndexBlock3), entry count, and advanced metadata
  • +
  • IndexEntry array: May contain regular entries and subindex references (IndexBlock3 type)
  • +
  • Hierarchical support: Subindex entries are recursively processed to flatten the structure
  • +
  • No CRC validation is performed during processing (use verify_index_v3 for validation)
  • +
  • Supports scalable index organization for large image files
  • +
+
+
+Subindex Processing:
    +
  • When an IndexEntry has blockType == IndexBlock3, it references a subindex
  • +
  • Subindexes are recursively processed using add_subindex_entries()
  • +
  • All entries from subindexes are flattened into the main index entries array
  • +
  • Supports arbitrary nesting depth of subindexes
  • +
+
+
+Memory Management:
    +
  • Returns a newly allocated UT_array that must be freed by the caller using utarray_free()
  • +
  • On error, any partially allocated memory is cleaned up before returning NULL
  • +
  • Each IndexEntry is copied into the array (no reference to original stream data)
  • +
  • Memory usage scales with total entries across all subindexes
  • +
+
+
+Version Compatibility:
    +
  • Supports only IndexBlock3 format (not IndexBlock or IndexBlock2)
  • +
  • Compatible with current generation AaruFormat image files
  • +
  • Backward compatible with images that don't use subindexes
  • +
+
+
Warning
The caller is responsible for freeing the returned UT_array using utarray_free(). Failure to free the array will result in memory leaks.
+
+This function does not validate the CRC integrity of the index data. Use verify_index_v3() to ensure index integrity before processing.
+
+Recursive subindex processing may cause significant memory usage and processing time for images with deeply nested or numerous subindexes.
+
+The function assumes ctx->header.indexOffset points to a valid index block. Invalid offsets may cause file access errors or reading incorrect data.
+ +

Definition at line 98 of file index_v3.c.

+ +

References add_subindex_entries(), IndexEntry::blockType, IndexHeader3::entries, FATAL, aaruformat_context::header, IndexHeader3::identifier, aaruformat_context::imageStream, IndexBlock3, AaruHeaderV2::indexOffset, and TRACE.

+ +

Referenced by aaruf_open(), and aaruf_verify_image().

+ +
+
+ +

◆ verify_index_v3()

+ +
+
+ + + + + + + +
int32_t verify_index_v3 (aaruformat_context * ctx)
+
+ +

Verifies the integrity of an index block (version 3) in the image stream.

+

Checks the CRC64 of the index block and all subindexes without decompressing them. This function performs comprehensive validation of the advanced version 3 index structure including header validation, data integrity verification, and version-specific CRC calculation. Note that this function validates only the main index block's CRC and does not recursively validate subindex CRCs, focusing on the primary index structure integrity.

+
Parameters
+ + +
ctxPointer to the aaruformat context containing image stream and header information.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + +
AARUF_STATUS_OK(0) Successfully verified index integrity. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The index header is successfully read from ctx->header.indexOffset
  • +
  • The index identifier matches IndexBlock3 (version 3 format)
  • +
  • Memory allocation for index entries succeeds
  • +
  • All index entries are successfully read from the image stream
  • +
  • CRC64 calculation completes successfully with version-specific endianness handling
  • +
  • The calculated CRC64 matches the expected CRC64 in the index header
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) Invalid context or stream. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
+
AARUF_ERROR_CANNOT_READ_HEADER(-6) Index header reading failed. This occurs when:
    +
  • Cannot read the complete IndexHeader3 structure from the image stream
  • +
  • File I/O errors prevent accessing the header at ctx->header.indexOffset
  • +
  • Insufficient data available at the specified index offset
  • +
+
AARUF_ERROR_CANNOT_READ_INDEX(-19) Index format or data access errors. This occurs when:
    +
  • The index identifier doesn't match IndexBlock3 (wrong format or corruption)
  • +
  • Cannot read all index entries from the image stream
  • +
  • File I/O errors during index entry reading
  • +
  • Index structure is corrupted or truncated
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Cannot allocate memory for the index entries array
  • +
  • System memory exhaustion prevents loading index data for verification
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-18) CRC64 validation failed. This occurs when:
    +
  • The calculated CRC64 doesn't match the expected CRC64 in the index header
  • +
  • Index data corruption is detected
  • +
  • Data integrity verification fails indicating potential file damage
  • +
+
+
+
+
Note
CRC64 Validation Process:
    +
  • Reads all main index entries into memory for CRC calculation
  • +
  • Calculates CRC64 over the complete main index entries array
  • +
  • Applies version-specific endianness conversion for compatibility
  • +
  • For imageMajorVersion <= AARUF_VERSION_V1: Uses bswap_64() for byte order correction
  • +
  • Compares calculated CRC64 with the value stored in the IndexHeader3
  • +
+
+
+Version 3 Specific Features:
    +
  • Uses IndexHeader3 structure with hierarchical subindex support
  • +
  • Maintains compatibility with legacy endianness handling
  • +
  • Supports advanced index entry organization with subindex references
  • +
  • Only validates the main index block CRC - subindex CRCs are not recursively checked
  • +
+
+
+Validation Scope:
    +
  • Validates main index header structure and identifier
  • +
  • Verifies data integrity of the primary index entries through CRC64 calculation
  • +
  • Does not validate individual IndexEntry contents or block references
  • +
  • Does not check for logical consistency of referenced blocks
  • +
  • Does not recursively validate subindex blocks (unlike hierarchical processing)
  • +
+
+
+Memory Management:
    +
  • Allocates temporary memory for index entries during verification
  • +
  • Automatically frees allocated memory on both success and error conditions
  • +
  • Memory usage is proportional to the number of entries in the main index only
  • +
+
+
+Subindex Validation Limitation:
    +
  • This function does not recursively validate subindex CRCs
  • +
  • Each subindex block contains its own CRC that would need separate validation
  • +
  • For complete integrity verification, subindex blocks should be validated individually
  • +
  • The main index CRC only covers the primary index entries, not the subindex content
  • +
+
+
Warning
This function reads only the main index into memory for CRC calculation. Subindex blocks are not loaded or validated by this function.
+
+The function assumes ctx->header.indexOffset points to a valid index location. Invalid offsets will cause file access errors or incorrect validation.
+
+CRC validation failure indicates potential data corruption in the main index and may suggest the image file is damaged or has been modified outside of library control.
+
+For complete integrity verification of hierarchical indexes, additional validation of subindex blocks may be required beyond this function's scope.
+ +

Definition at line 408 of file index_v3.c.

+ +

References aaruf_crc64_final(), aaruf_crc64_free(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_READ_HEADER, AARUF_ERROR_CANNOT_READ_INDEX, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_STATUS_OK, AARUF_VERSION_V1, bswap_64, IndexHeader3::crc64, IndexHeader3::entries, FATAL, aaruformat_context::header, IndexHeader3::identifier, AaruHeaderV2::imageMajorVersion, aaruformat_context::imageStream, IndexBlock3, AaruHeaderV2::indexOffset, and TRACE.

+ +

Referenced by aaruf_verify_image().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/index__v3_8c.js b/docs/html/index__v3_8c.js new file mode 100644 index 0000000..d419728 --- /dev/null +++ b/docs/html/index__v3_8c.js @@ -0,0 +1,6 @@ +var index__v3_8c = +[ + [ "add_subindex_entries", "index__v3_8c.html#ac85ad03ba0f06b8799d7fe056b87a18e", null ], + [ "process_index_v3", "index__v3_8c.html#aff88fae9938d5f56318bfd7a455d5e94", null ], + [ "verify_index_v3", "index__v3_8c.html#ad7ed9250463c320c7bc8d83689bcfefb", null ] +]; \ No newline at end of file diff --git a/docs/html/index__v3_8c_source.html b/docs/html/index__v3_8c_source.html new file mode 100644 index 0000000..da5cc73 --- /dev/null +++ b/docs/html/index__v3_8c_source.html @@ -0,0 +1,479 @@ + + + + + + + +libaaruformat: src/index/index_v3.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
index_v3.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <limits.h>
+
20#include <stdbool.h>
+
21#include <stdint.h>
+
22#include <stdio.h>
+
23#include <stdlib.h>
+
24
+
25#include "aaruformat.h"
+
26#include "internal.h"
+
27#include "log.h"
+
28#include "utarray.h"
+
29
+
30static bool add_subindex_entries(aaruformat_context *ctx, UT_array *index_entries, const IndexEntry *subindex_entry);
+
31
+
+ +
99{
+
100 TRACE("Entering process_index_v3(%p)", ctx);
+
101
+
102 UT_array *index_entries = NULL;
+
103 IndexEntry entry;
+
104
+
105 if(ctx == NULL || ctx->imageStream == NULL) return NULL;
+
106
+
107 // Initialize the index entries array
+
108 const UT_icd index_entry_icd = {sizeof(IndexEntry), NULL, NULL, NULL};
+
109
+
110 utarray_new(index_entries, &index_entry_icd);
+
111
+
112 if(index_entries == NULL)
+
113 {
+
114 FATAL("Could not allocate memory for index entries array.");
+
115 TRACE("Exiting process_index_v3() = NULL");
+
116 return NULL;
+
117 }
+
118
+
119 // Read the index header
+
120 TRACE("Reading index header at position %llu", ctx->header.indexOffset);
+
121 if(fseek(ctx->imageStream, ctx->header.indexOffset, SEEK_SET) != 0)
+
122 {
+
123 FATAL("Could not seek to index header at %llu.", ctx->header.indexOffset);
+
124 utarray_free(index_entries);
+
125
+
126 TRACE("Exiting process_index_v3() = NULL");
+
127 return NULL;
+
128 }
+
129 IndexHeader3 idx_header;
+
130 if(fread(&idx_header, sizeof(IndexHeader3), 1, ctx->imageStream) != 1)
+
131 {
+
132 FATAL("Could not read index header at %llu.", ctx->header.indexOffset);
+
133 utarray_free(index_entries);
+
134
+
135 TRACE("Exiting process_index_v3() = NULL");
+
136 return NULL;
+
137 }
+
138
+
139 // Check if the index header is valid
+
140 if(idx_header.identifier != IndexBlock3)
+
141 {
+
142 FATAL("Incorrect index identifier.");
+
143 utarray_free(index_entries);
+
144
+
145 TRACE("Exiting process_index_v3() = NULL");
+
146 return NULL;
+
147 }
+
148
+
149 for(uint64_t i = 0; i < idx_header.entries; i++)
+
150 {
+
151 if(fread(&entry, sizeof(IndexEntry), 1, ctx->imageStream) != 1)
+
152 {
+
153 FATAL("Could not read index entry %llu at %llu.", (unsigned long long)i, ctx->header.indexOffset);
+
154 utarray_free(index_entries);
+
155
+
156 TRACE("Exiting process_index_v3() = NULL");
+
157 return NULL;
+
158 }
+
159
+
160 if(entry.blockType == IndexBlock3)
+
161 {
+
162 // If the entry is a subindex, we need to read its entries
+
163 if(!add_subindex_entries(ctx, index_entries, &entry))
+
164 {
+
165 utarray_free(index_entries);
+
166
+
167 TRACE("Exiting process_index_v3() = NULL");
+
168 return NULL;
+
169 }
+
170 continue;
+
171 }
+
172 utarray_push_back(index_entries, &entry);
+
173 }
+
174
+
175 TRACE("Read %llu index entries from index block at position %llu", (unsigned long long)idx_header.entries,
+
176 ctx->header.indexOffset);
+
177 return index_entries;
+
178}
+
+
179
+
+
247static bool add_subindex_entries(aaruformat_context *ctx, UT_array *index_entries, const IndexEntry *subindex_entry)
+
248{
+
249 TRACE("Entering add_subindex_entries(%p, %p, %p)", ctx, index_entries, subindex_entry);
+
250
+
251 IndexHeader3 subindex_header;
+
252 IndexEntry entry;
+
253
+
254 if(ctx == NULL || ctx->imageStream == NULL || index_entries == NULL || subindex_entry == NULL)
+
255 {
+
256 TRACE("Exiting add_subindex_entries() = false (invalid parameters)");
+
257 return false;
+
258 }
+
259
+
260 // Seek to the subindex
+
261 if(fseek(ctx->imageStream, subindex_entry->offset, SEEK_SET) != 0)
+
262 {
+
263 FATAL("Could not seek to subindex header at %llu.", (unsigned long long)subindex_entry->offset);
+
264 TRACE("Exiting add_subindex_entries() = false (seek failed)");
+
265 return false;
+
266 }
+
267
+
268 // Read the subindex header
+
269 if(fread(&subindex_header, sizeof(IndexHeader3), 1, ctx->imageStream) != 1)
+
270 {
+
271 FATAL("Could not read subindex header at %llu.", (unsigned long long)subindex_entry->offset);
+
272 TRACE("Exiting add_subindex_entries() = false (header read failed)");
+
273 return false;
+
274 }
+
275
+
276 // Check if the subindex header is valid
+
277 if(subindex_header.identifier != IndexBlock3)
+
278 {
+
279 FATAL("Incorrect subindex identifier.");
+
280
+
281 TRACE("Exiting add_subindex_entries() = false (invalid identifier)");
+
282 return false;
+
283 }
+
284
+
285 if(subindex_header.entries != 0 && subindex_header.entries > SIZE_MAX / sizeof(IndexEntry))
+
286 {
+
287 FATAL("Subindex entry count %llu is too large to process.", (unsigned long long)subindex_header.entries);
+
288 TRACE("Exiting add_subindex_entries() = false (entry count overflow)");
+
289 return false;
+
290 }
+
291
+
292 // Read each entry in the subindex and add it to the main index entries array
+
293 for(uint64_t i = 0; i < subindex_header.entries; i++)
+
294 {
+
295 if(fread(&entry, sizeof(IndexEntry), 1, ctx->imageStream) != 1)
+
296 {
+
297 FATAL("Could not read subindex entry %llu at %llu.", (unsigned long long)i,
+
298 (unsigned long long)subindex_entry->offset);
+
299 TRACE("Exiting add_subindex_entries() = false (entry read failed)");
+
300 return false;
+
301 }
+
302 if(entry.blockType == IndexBlock3)
+
303 {
+
304 // If the entry is a subindex, we need to read its entries
+
305 if(!add_subindex_entries(ctx, index_entries, &entry))
+
306 {
+
307 TRACE("Exiting add_subindex_entries() = false (nested subindex failed)");
+
308 return false;
+
309 }
+
310 continue;
+
311 }
+
312 utarray_push_back(index_entries, &entry);
+
313 }
+
314
+
315 TRACE("Exiting add_subindex_entries() = true after appending %llu entries",
+
316 (unsigned long long)subindex_header.entries);
+
317 return true;
+
318}
+
+
319
+
+ +
409{
+
410 TRACE("Entering verify_index_v3(%p)", ctx);
+
411
+
412 size_t read_bytes = 0;
+
413 IndexHeader3 index_header;
+
414 uint64_t crc64 = 0;
+
415 IndexEntry *index_entries = NULL;
+
416
+
417 if(ctx == NULL || ctx->imageStream == NULL)
+
418 {
+
419 FATAL("Invalid context or image stream.");
+
420
+
421 TRACE("Exiting verify_index_v3() = AARUF_ERROR_NOT_AARUFORMAT");
+ +
423 }
+
424
+
425 // This will traverse all blocks and check their CRC64 without uncompressing them
+
426 TRACE("Checking index integrity at %llu.", ctx->header.indexOffset);
+
427 if(fseek(ctx->imageStream, ctx->header.indexOffset, SEEK_SET) != 0)
+
428 {
+
429 FATAL("Could not seek to index header at %llu.", ctx->header.indexOffset);
+
430
+
431 TRACE("Exiting verify_index_v3() = AARUF_ERROR_CANNOT_READ_HEADER");
+ +
433 }
+
434
+
435 // Read the index header
+
436 TRACE("Reading index header at position %llu", ctx->header.indexOffset);
+
437 read_bytes = fread(&index_header, 1, sizeof(IndexHeader3), ctx->imageStream);
+
438
+
439 if(read_bytes != sizeof(IndexHeader3))
+
440 {
+
441 FATAL("Could not read index header.");
+
442
+
443 TRACE("Exiting verify_index_v3() = AARUF_ERROR_CANNOT_READ_HEADER");
+ +
445 }
+
446
+
447 if(index_header.identifier != IndexBlock3)
+
448 {
+
449 FATAL("Incorrect index identifier.");
+
450
+
451 TRACE("Exiting verify_index_v3() = AARUF_ERROR_CANNOT_READ_INDEX");
+ +
453 }
+
454
+
455 TRACE("Index at %llu contains %llu entries.", ctx->header.indexOffset, (unsigned long long)index_header.entries);
+
456
+
457 if(index_header.entries != 0 && index_header.entries > SIZE_MAX / sizeof(IndexEntry))
+
458 {
+
459 FATAL("Index entry count %llu is too large to process.", (unsigned long long)index_header.entries);
+
460
+
461 TRACE("Exiting verify_index_v3() = AARUF_ERROR_NOT_ENOUGH_MEMORY");
+ +
463 }
+
464
+
465 const size_t entries_size = (size_t)index_header.entries * sizeof(IndexEntry);
+
466
+
467 if(entries_size > 0)
+
468 {
+
469 index_entries = malloc(entries_size);
+
470
+
471 if(index_entries == NULL)
+
472 {
+
473 FATAL("Cannot allocate memory for index entries.");
+
474
+
475 TRACE("Exiting verify_index_v3() = AARUF_ERROR_NOT_ENOUGH_MEMORY");
+ +
477 }
+
478
+
479 read_bytes = fread(index_entries, 1, entries_size, ctx->imageStream);
+
480
+
481 if(read_bytes != entries_size)
+
482 {
+
483 FATAL("Could not read index entries.");
+
484 free(index_entries);
+
485
+
486 TRACE("Exiting verify_index_v3() = AARUF_ERROR_CANNOT_READ_INDEX");
+ +
488 }
+
489 }
+
490
+
491 crc64_ctx *crc_ctx = aaruf_crc64_init();
+
492
+
493 if(crc_ctx == NULL)
+
494 {
+
495 FATAL("Cannot initialize CRC64 context.");
+
496 free(index_entries);
+
497
+
498 TRACE("Exiting verify_index_v3() = AARUF_ERROR_NOT_ENOUGH_MEMORY");
+ +
500 }
+
501
+
502 if(entries_size > 0)
+
503 {
+
504 const uint8_t *cursor = (const uint8_t *)index_entries;
+
505 size_t remaining = entries_size;
+
506
+
507 while(remaining > 0)
+
508 {
+
509 const uint32_t chunk = remaining > UINT32_MAX ? UINT32_MAX : (uint32_t)remaining;
+
510
+
511 if(aaruf_crc64_update(crc_ctx, cursor, chunk) != 0)
+
512 {
+
513 FATAL("Failed to update index CRC.");
+
514 aaruf_crc64_free(crc_ctx);
+
515 free(index_entries);
+
516
+
517 TRACE("Exiting verify_index_v3() = AARUF_ERROR_CANNOT_READ_INDEX");
+ +
519 }
+
520
+
521 cursor += chunk;
+
522 remaining -= chunk;
+
523 }
+
524 }
+
525
+
526 if(aaruf_crc64_final(crc_ctx, &crc64) != 0)
+
527 {
+
528 FATAL("Failed to finalize index CRC.");
+
529 aaruf_crc64_free(crc_ctx);
+
530 free(index_entries);
+
531
+
532 TRACE("Exiting verify_index_v3() = AARUF_ERROR_CANNOT_READ_INDEX");
+ +
534 }
+
535
+
536 aaruf_crc64_free(crc_ctx);
+
537
+
538 // Due to how C# wrote it, it is effectively reversed
+
539 if(ctx->header.imageMajorVersion <= AARUF_VERSION_V1) crc64 = bswap_64(crc64);
+
540
+
541 if(crc64 != index_header.crc64)
+
542 {
+
543 FATAL("Expected index CRC 0x%16llX but got 0x%16llX.", index_header.crc64, crc64);
+
544 free(index_entries);
+
545
+
546 TRACE("Exiting verify_index_v3() = AARUF_ERROR_INVALID_BLOCK_CRC");
+ +
548 }
+
549
+
550 free(index_entries);
+
551
+
552 TRACE("Exiting verify_index_v3() = AARUF_OK");
+
553 return AARUF_STATUS_OK;
+
554}
+
+ +
#define AARUF_VERSION_V1
First on‑disk version (C# implementation).
Definition consts.h:71
+
int aaruf_crc64_update(crc64_ctx *ctx, const uint8_t *data, uint32_t len)
Updates the CRC64 context with new data.
Definition crc64.c:55
+
void aaruf_crc64_free(crc64_ctx *ctx)
Frees a CRC64 context.
Definition crc64.c:155
+
crc64_ctx * aaruf_crc64_init()
Initializes a CRC64 context.
Definition crc64.c:32
+
int aaruf_crc64_final(crc64_ctx *ctx, uint64_t *crc)
Computes the final CRC64 value from the context.
Definition crc64.c:141
+
#define bswap_64(x)
Definition endian.h:81
+
@ IndexBlock3
Block containing the index v3.
Definition enums.h:147
+
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
Definition errors.h:75
+
#define AARUF_ERROR_CANNOT_READ_HEADER
Failed to read container header.
Definition errors.h:45
+
#define AARUF_ERROR_NOT_ENOUGH_MEMORY
Memory allocation failure (critical).
Definition errors.h:48
+
#define AARUF_ERROR_INVALID_BLOCK_CRC
CRC64 mismatch indicating corruption.
Definition errors.h:57
+
#define AARUF_ERROR_CANNOT_READ_INDEX
Index block unreadable / truncated / bad identifier.
Definition errors.h:43
+
#define AARUF_ERROR_NOT_AARUFORMAT
Input file/stream failed magic or structural validation.
Definition errors.h:40
+
static bool add_subindex_entries(aaruformat_context *ctx, UT_array *index_entries, const IndexEntry *subindex_entry)
Adds entries from a subindex block (version 3) to the main index entries array.
Definition index_v3.c:247
+
int32_t verify_index_v3(aaruformat_context *ctx)
Verifies the integrity of an index block (version 3) in the image stream.
Definition index_v3.c:408
+
UT_array * process_index_v3(aaruformat_context *ctx)
Processes an index block (version 3) from the image stream.
Definition index_v3.c:98
+ + +
#define FATAL(fmt,...)
Definition log.h:40
+
#define TRACE(fmt,...)
Definition log.h:25
+
uint64_t indexOffset
Absolute byte offset to primary index block (MUST be > 0; 0 => corrupt/unreadable).
Definition header.h:115
+
uint8_t imageMajorVersion
Container format major version.
Definition header.h:110
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
uint32_t blockType
Block identifier of the referenced block (value from BlockType).
Definition index.h:110
+
uint64_t offset
Absolute byte offset in the image where the referenced block header begins.
Definition index.h:112
+
Index header (version 3) adding hierarchical chaining (identifier == IndexBlock3).
Definition index.h:93
+
uint32_t identifier
Block identifier (must be BlockType::IndexBlock3).
Definition index.h:94
+
uint64_t crc64
CRC64-ECMA of the local entries array (does NOT cover subindexes or previous chains).
Definition index.h:96
+
uint64_t entries
Number of IndexEntry records that follow in this (sub)index block.
Definition index.h:95
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
AaruHeaderV2 header
Parsed container header (v2).
Definition context.h:175
+
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
+
Minimal ECMA-182 CRC64 incremental state container (running value only).
Definition crc64.h:56
+
+
+
+ + + + diff --git a/docs/html/internal_8h.html b/docs/html/internal_8h.html new file mode 100644 index 0000000..59817d6 --- /dev/null +++ b/docs/html/internal_8h.html @@ -0,0 +1,2761 @@ + + + + + + + +libaaruformat: include/internal.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
internal.h File Reference
+
+
+
#include "utarray.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

UT_array * process_index_v1 (aaruformat_context *ctx)
 Processes an index block (version 1) from the image stream.
int32_t verify_index_v1 (aaruformat_context *ctx)
 Verifies the integrity of an index block (version 1) in the image stream.
UT_array * process_index_v2 (aaruformat_context *ctx)
 Processes an index block (version 2) from the image stream.
int32_t verify_index_v2 (aaruformat_context *ctx)
 Verifies the integrity of an index block (version 2) in the image stream.
UT_array * process_index_v3 (aaruformat_context *ctx)
 Processes an index block (version 3) from the image stream.
int32_t verify_index_v3 (aaruformat_context *ctx)
 Verifies the integrity of an index block (version 3) in the image stream.
int32_t process_data_block (aaruformat_context *ctx, IndexEntry *entry)
 Processes a data block from the image stream.
int32_t process_ddt_v1 (aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt)
 Processes a DDT v1 block from the image stream.
int32_t process_ddt_v2 (aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt)
 Processes a DDT v2 block from the image stream.
void process_metadata_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes a metadata block from the image stream.
void process_geometry_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes a logical geometry block from the image stream.
void process_tracks_block (aaruformat_context *ctx, const IndexEntry *entry)
 Parse and integrate a Tracks block from the image stream into the context.
void process_cicm_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes a CICM XML metadata block from the image stream.
void process_aaru_metadata_json_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes an Aaru metadata JSON block from the image stream during image opening.
void process_dumphw_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes a dump hardware block from the image stream.
void process_checksum_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes a checksum block from the image stream.
void process_tape_files_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes a tape file metadata block from the image stream.
void process_tape_partitions_block (aaruformat_context *ctx, const IndexEntry *entry)
 Processes a tape partition metadata block from the image stream.
int32_t decode_ddt_entry_v1 (aaruformat_context *ctx, uint64_t sector_address, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
 Decodes a DDT v1 entry for a given sector address.
int32_t decode_ddt_entry_v2 (aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
 Decodes a DDT v2 entry for a given sector address.
int32_t decode_ddt_single_level_v2 (aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
 Decodes a single-level DDT v2 entry for a given sector address.
int32_t decode_ddt_multi_level_v2 (aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
 Decodes a multi-level DDT v2 entry for a given sector address.
bool set_ddt_entry_v2 (aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
 Sets a DDT v2 entry for a given sector address.
bool set_ddt_single_level_v2 (aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
 Sets a single-level DDT v2 entry for a given sector address.
bool set_ddt_multi_level_v2 (aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
 Sets a multi-level DDT v2 entry for a given sector address.
bool set_ddt_tape (aaruformat_context *ctx, uint64_t sector_address, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
 Sets a DDT entry for tape media using a hash-based lookup table.
aaru_options parse_options (const char *options)
 Parses the options string for AaruFormat image creation/opening.
uint64_t get_filetime_uint64 ()
 Gets the current time as a 64-bit FILETIME value.
int32_t aaruf_close_current_block (aaruformat_context *ctx)
 Finalizes and writes the current data block to the AaruFormat image file.
int compare_extents (const void *a, const void *b)
 Comparison function for sorting DumpExtent arrays by start sector.
+

Function Documentation

+ +

◆ aaruf_close_current_block()

+ +
+
+ + + + + + + +
int32_t aaruf_close_current_block (aaruformat_context * ctx)
+
+ +

Finalizes and writes the current data block to the AaruFormat image file.

+

This function completes the current writing block by computing checksums, optionally compressing the buffered sector data, writing the block header and data to the image file, updating the index, and cleaning up resources. It is called automatically when a block is full (reaches maximum size determined by dataShift), when sector size changes, or when image finalization begins. The function supports multiple compression algorithms (FLAC for audio, LZMA for data) with automatic fallback to uncompressed storage if compression is ineffective.

+

Block Finalization Sequence:

+
    +
  1. Context Validation: Verify context is valid and opened for writing
  2. +
  3. Length Calculation: Set block length = currentBlockOffset × sectorSize
  4. +
  5. CRC64 Computation: Calculate checksum of uncompressed block data
  6. +
  7. Compression Processing (if enabled):
      +
    • FLAC: For audio tracks, compress using Red Book audio encoding with configurable block size
    • +
    • LZMA: For data tracks, compress using LZMA algorithm with dictionary size optimization
    • +
    • Fallback: If compressed size ≥ uncompressed size, use uncompressed storage
    • +
    +
  8. +
  9. Compressed CRC64: Calculate checksum of compressed data (if compression was applied)
  10. +
  11. Index Registration: Add IndexEntry to ctx->indexEntries for block lookup
  12. +
  13. File Writing: Write BlockHeader, optional LZMA properties, and block data to image stream
  14. +
  15. Position Update: Calculate next block position with alignment boundary adjustment
  16. +
  17. Resource Cleanup: Free buffers, reset counters, clear block header
  18. +
+

Compression Handling:

+
    +
  • None (CompressionType = 0): No compression applied
      +
    • cmpLength = length (uncompressed size)
    • +
    • cmpCrc64 = crc64 (same checksum)
    • +
    • Direct write of ctx->writingBuffer to file
    • +
    +
  • +
  • FLAC (CompressionType = 2): For CD audio tracks (Red Book format)
      +
    • Allocates 2× length buffer for compressed data
    • +
    • Calculates optimal FLAC block size (MIN_FLAKE_BLOCK to MAX_FLAKE_BLOCK range)
    • +
    • Pads incomplete blocks with zeros to meet FLAC block size requirements
    • +
    • Encoding parameters: mid-side stereo, Hamming apodization, 12 max LPC order
    • +
    • Falls back to None if compression ineffective (compressed ≥ uncompressed)
    • +
    +
  • +
  • LZMA (CompressionType = 1): For data tracks and non-audio content
      +
    • Allocates 2× length buffer for compressed data
    • +
    • LZMA properties: level 9, dictionary size from ctx->lzma_dict_size
    • +
    • Properties stored as 5-byte header: lc=4, lp=0, pb=2, fb=273, threads=8
    • +
    • Falls back to None if compression ineffective (compressed ≥ uncompressed)
    • +
    • Compressed length includes LZMA_PROPERTIES_LENGTH (5 bytes) overhead
    • +
    +
  • +
+

Index Entry Creation:

+

Each closed block is registered in the index with:

    +
  • blockType = DataBlock (0x4B4C4244)
  • +
  • dataType = UserData (1)
  • +
  • offset = ctx->nextBlockPosition (file position where block was written)
  • +
+

This enables efficient block lookup during image reading via binary search on index entries.

+

File Layout:

+

Written to ctx->imageStream at ctx->nextBlockPosition:

    +
  1. BlockHeader (sizeof(BlockHeader) bytes)
  2. +
  3. LZMA properties (5 bytes, only if compression = Lzma)
  4. +
  5. Block data (cmpLength bytes - compressed or uncompressed depending on compression type)
  6. +
+

Next Block Position Calculation:

+

After writing, nextBlockPosition is updated to the next aligned boundary:

    +
  • block_total_size = sizeof(BlockHeader) + cmpLength
  • +
  • alignment_mask = (1 << blockAlignmentShift) - 1
  • +
  • nextBlockPosition = (currentPosition + block_total_size + alignment_mask) & ~alignment_mask
  • +
+

This ensures all blocks begin on properly aligned file offsets for efficient I/O.

+

Resource Cleanup:

+

Before returning, the function:

    +
  • Frees ctx->writingBuffer and sets pointer to NULL
  • +
  • Resets ctx->currentBlockOffset to 0
  • +
  • Clears ctx->currentBlockHeader (memset to 0)
  • +
  • Frees ctx->crc64Context
  • +
  • Resets ctx->writingBufferPosition to 0
  • +
+

This prepares the context for the next block or signals that no block is currently open.

+
Parameters
+ + +
ctxPointer to an initialized aaruformatContext in write mode.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + +
AARUF_STATUS_OK(0) Successfully finalized and wrote the block. This is returned when:
    +
  • The context is valid and properly initialized
  • +
  • CRC64 computation completed successfully
  • +
  • Compression (if applicable) succeeded or fell back appropriately
  • +
  • Block header was successfully written to the image file
  • +
  • Block data (compressed or uncompressed) was successfully written
  • +
  • LZMA properties (if applicable) were successfully written
  • +
  • Index entry was added to ctx->indexEntries
  • +
  • Next block position was calculated and updated
  • +
  • All resources were freed and context reset for next block
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The context magic number doesn't match AARU_MAGIC (invalid context type)
  • +
+
AARUF_READ_ONLY(-22) Attempting to finalize block on read-only image. This occurs when:
    +
  • The context's isWriting flag is false
  • +
  • The image was opened in read-only mode with aaruf_open()
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Cannot allocate compression buffer (2× block length) for FLAC compression
  • +
  • Cannot allocate compression buffer (2× block length) for LZMA compression
  • +
  • System is out of memory or memory is severely fragmented
  • +
+
AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER(-23) Failed to write block header. This occurs when:
    +
  • fwrite() for BlockHeader returns != 1 (incomplete write or I/O error)
  • +
  • Disk space is insufficient for header
  • +
  • File system errors or permissions prevent writing
  • +
  • Media errors on the destination storage device
  • +
+
AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA(-24) Failed to write block data. This occurs when:
    +
  • fwrite() for LZMA properties returns != 1 (when compression = Lzma)
  • +
  • fwrite() for uncompressed data returns != 1 (when compression = None)
  • +
  • fwrite() for compressed data returns != 1 (when compression = Flac/Lzma)
  • +
  • Disk space is insufficient for block data
  • +
  • File system errors or permissions prevent writing
  • +
  • Invalid compression type (not None, Flac, or Lzma)
  • +
+
+
+
+
Note
Compression Algorithm Selection:
    +
  • Compression type is determined when block is created in aaruf_write_sector()
  • +
  • Audio tracks (TrackType = Audio) use FLAC compression if enabled
  • +
  • Data tracks use LZMA compression if enabled
  • +
  • Special cases (JaguarCD data in audio, VideoNow) force LZMA even for audio tracks
  • +
  • Compression can be disabled entirely via ctx->compression_enabled flag
  • +
+
+
+Compression Fallback Logic:
    +
  • If compressed size ≥ uncompressed size, compression is abandoned
  • +
  • Compression buffer is freed and compression type set to None
  • +
  • This prevents storage expansion from ineffective compression
  • +
  • Fallback is transparent to caller; function still returns success
  • +
+
+
+FLAC Encoding Parameters:
    +
  • Encoding for Red Book audio (44.1kHz, 16-bit stereo)
  • +
  • Block size: auto-selected between MIN_FLAKE_BLOCK and MAX_FLAKE_BLOCK samples
  • +
  • Mid-side stereo enabled for better compression on correlated channels
  • +
  • Hamming window apodization for LPC analysis
  • +
  • Max LPC order: 12, QLP coefficient precision: 15 bits
  • +
  • Application ID: "Aaru" with 4-byte signature
  • +
+
+
+LZMA Encoding Parameters:
    +
  • Compression level: 9 (maximum compression)
  • +
  • Dictionary size: from ctx->lzma_dict_size (configurable per context)
  • +
  • Literal context bits (lc): 4
  • +
  • Literal position bits (lp): 0
  • +
  • Position bits (pb): 2
  • +
  • Fast bytes (fb): 273
  • +
  • Threads: 8 (for multi-threaded compression)
  • +
+
+
+Index Management:
    +
  • Every closed block gets an index entry for efficient lookup
  • +
  • Index entries are stored in ctx->indexEntries (dynamic array)
  • +
  • Final index is serialized during aaruf_close() for image finalization
  • +
  • Index enables O(log n) block lookup during image reading
  • +
+
+
+Alignment Requirements:
    +
  • Blocks must start on aligned boundaries per blockAlignmentShift
  • +
  • Typical alignment: 512 bytes (shift=9) or 4096 bytes (shift=12)
  • +
  • Alignment ensures efficient sector-aligned I/O on modern storage
  • +
  • Gap between blocks is implicit; no padding data is written
  • +
+
+
Warning
This function assumes ctx->writingBuffer contains valid data for ctx->currentBlockOffset sectors of ctx->currentBlockHeader.sectorSize bytes each.
+
+Do not call this function when no block is open (ctx->writingBuffer == NULL). This will result in undefined behavior or segmentation fault.
+
+The function modifies ctx->nextBlockPosition, which affects where subsequent blocks are written. Ensure file positioning is properly managed.
+
+Memory allocated for compression buffers is freed before returning. Do not retain pointers to compressed data after function completion.
+
+CRC64 context (ctx->crc64Context) is freed during cleanup. Do not access this pointer after calling this function.
+ +

Definition at line 1383 of file write.c.

+ +

References AARU_MAGIC, aaruf_crc64_data(), aaruf_crc64_final(), aaruf_crc64_free(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA, AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, aaruf_flac_encode_redbook_buffer(), aaruf_lzma_encode_buffer(), AARUF_READ_ONLY, AARUF_STATUS_OK, DdtHeader2::blockAlignmentShift, IndexEntry::blockType, BlockHeader::cmpCrc64, BlockHeader::cmpLength, BlockHeader::compression, BlockHeader::crc64, aaruformat_context::crc64_context, aaruformat_context::current_block_header, aaruformat_context::current_block_offset, DataBlock, IndexEntry::dataType, FATAL, Flac, aaruformat_context::imageStream, aaruformat_context::index_entries, aaruformat_context::is_writing, BlockHeader::length, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, aaruformat_context::magic, MAX_FLAKE_BLOCK, MIN_FLAKE_BLOCK, aaruformat_context::next_block_position, None, IndexEntry::offset, SAMPLES_PER_SECTOR, BlockHeader::sectorSize, TRACE, aaruformat_context::user_data_ddt_header, UserData, aaruformat_context::writing_buffer, and aaruformat_context::writing_buffer_position.

+ +

Referenced by aaruf_close(), aaruf_write_sector(), and set_ddt_multi_level_v2().

+ +
+
+ +

◆ compare_extents()

+ +
+
+ + + + + + + + + + + +
int compare_extents (const void * a,
const void * b )
+
+ +

Comparison function for sorting DumpExtent arrays by start sector.

+

This function is used by qsort() to order dump extents in ascending order based on their start sector values. Extents with lower start sectors will appear first in the sorted array. This ordering is important for efficient extent lookup and validation during image operations.

+
Parameters
+ + + +
aPointer to the first DumpExtent to compare.
bPointer to the second DumpExtent to compare.
+
+
+
Returns
Negative value if a->start < b->start, zero if equal, positive if a->start > b->start.
+ +

Definition at line 451 of file helpers.c.

+ +

References DumpExtent::start.

+ +

Referenced by aaruf_set_dumphw(), and process_dumphw_block().

+ +
+
+ +

◆ decode_ddt_entry_v1()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t decode_ddt_entry_v1 (aaruformat_context * ctx,
const uint64_t sector_address,
uint64_t * offset,
uint64_t * block_offset,
uint8_t * sector_status )
+
+ +

Decodes a DDT v1 entry for a given sector address.

+

Determines the offset and block offset for a sector using the DDT v1 table. This function performs bit manipulation on the DDT entry to extract the sector offset within a block and the block offset, and determines whether the sector was dumped or not based on the DDT entry value.

+
Parameters
+ + + + + + +
ctxPointer to the aaruformat context containing the loaded DDT table.
sector_addressLogical sector address to decode (must be within valid range).
offsetPointer to store the resulting sector offset within the block.
block_offsetPointer to store the resulting block offset in the image.
sector_statusPointer to store the sector status (dumped or not dumped).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + +
AARUF_STATUS_OK(0) Successfully decoded the DDT entry. This is always returned when:
    +
  • The context and image stream are valid
  • +
  • The DDT entry is successfully extracted and decoded
  • +
  • The offset, block_offset, and sector_status are successfully populated
  • +
  • A zero DDT entry is encountered (indicates sector not dumped)
  • +
  • A non-zero DDT entry is encountered (indicates sector was dumped)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers). This is the only error condition that can occur in this function.
+
+
+
Note
This is a lightweight function that performs only basic validation and bit manipulation. It does not perform bounds checking on the sector_address parameter.
+
+DDT Entry Decoding:
    +
  • Uses a bit mask derived from ctx->shift to extract the offset within block
  • +
  • Right-shifts the DDT entry by ctx->shift bits to get the block offset
  • +
  • A zero DDT entry indicates the sector was not dumped (SectorStatusNotDumped)
  • +
  • A non-zero DDT entry indicates the sector was dumped (SectorStatusDumped)
  • +
+
+
Warning
The function assumes:
    +
  • The DDT table (ctx->userDataDdt) has been properly loaded by process_ddt_v1()
  • +
  • The sector_address is within the valid range of the DDT table
  • +
  • The shift value (ctx->shift) has been properly initialized
  • +
  • All output parameters (offset, block_offset, sector_status) are valid pointers
  • +
+
+
+No bounds checking is performed on sector_address. Accessing beyond the DDT table boundaries will result in undefined behavior.
+ +

Definition at line 405 of file ddt_v1.c.

+ +

References AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, aaruformat_context::imageStream, SectorStatusDumped, SectorStatusNotDumped, aaruformat_context::shift, TRACE, and aaruformat_context::user_data_ddt.

+ +

Referenced by aaruf_read_sector().

+ +
+
+ +

◆ decode_ddt_entry_v2()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t decode_ddt_entry_v2 (aaruformat_context * ctx,
const uint64_t sector_address,
bool negative,
uint64_t * offset,
uint64_t * block_offset,
uint8_t * sector_status )
+
+ +

Decodes a DDT v2 entry for a given sector address.

+

Determines the offset and block offset for a sector using the DDT v2 table(s). This function acts as a dispatcher that automatically selects between single-level and multi-level DDT decoding based on the tableShift parameter in the DDT header. It provides a unified interface for DDT v2 entry decoding regardless of the underlying table structure complexity.

+
Parameters
+ + + + + + + +
ctxPointer to the aaruformat context containing the loaded DDT structures.
sector_addressLogical sector address to decode (will be adjusted for negative sectors).
negativeIndicates if the sector address is negative.
offsetPointer to store the resulting sector offset within the block.
block_offsetPointer to store the resulting block offset in the image.
sector_statusPointer to store the sector status (dumped, not dumped, etc.).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + +
AARUF_STATUS_OK(0) Successfully decoded the DDT entry. This is always returned when:
    +
  • The context and image stream are valid
  • +
  • The appropriate decoding function (single-level or multi-level) completes successfully
  • +
  • All output parameters are properly populated with decoded values
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers). This is the only error condition that can occur at this dispatcher level.
Othererror codes may be returned by the underlying decoding functions: +
+
+
+
Note
Function Selection:
    +
  • If tableShift > 0: Uses multi-level DDT decoding (decode_ddt_multi_level_v2)
  • +
  • If tableShift = 0: Uses single-level DDT decoding (decode_ddt_single_level_v2)
  • +
  • The tableShift parameter is read from ctx->userDataDdtHeader.tableShift
  • +
+
+
+This function performs minimal validation and primarily acts as a dispatcher. Most error conditions and complex logic are handled by the underlying functions.
+
Warning
The function assumes the DDT has been properly loaded by process_ddt_v2(). Calling this function with an uninitialized or corrupted DDT will result in undefined behavior from the underlying decoding functions.
+
+All output parameters must be valid pointers. No bounds checking is performed on the sector_address parameter at this level.
+ +

Definition at line 507 of file ddt_v2.c.

+ +

References AARUF_ERROR_NOT_AARUFORMAT, decode_ddt_multi_level_v2(), decode_ddt_single_level_v2(), FATAL, aaruformat_context::imageStream, DdtHeader2::tableShift, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_read_sector().

+ +
+
+ +

◆ decode_ddt_multi_level_v2()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t decode_ddt_multi_level_v2 (aaruformat_context * ctx,
uint64_t sector_address,
bool negative,
uint64_t * offset,
uint64_t * block_offset,
uint8_t * sector_status )
+
+ +

Decodes a multi-level DDT v2 entry for a given sector address.

+

Used when the DDT table uses multi-level indirection (tableShift > 0). This function handles the complex process of navigating a hierarchical DDT structure where the primary table points to secondary tables that contain the actual sector mappings. It includes caching mechanisms for secondary tables, supports both compressed and uncompressed secondary tables, and performs comprehensive validation including CRC verification.

+
Parameters
+ + + + + + + +
ctxPointer to the aaruformat context containing the loaded primary DDT table.
sector_addressLogical sector address to decode (adjusted for negative sectors).
negativeIndicates if the sector address is negative.
offsetPointer to store the resulting sector offset within the block.
block_offsetPointer to store the resulting block offset in the image.
sector_statusPointer to store the sector status (dumped, not dumped, etc.).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + +
AARUF_STATUS_OK(0) Successfully decoded the DDT entry. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The tableShift validation passes (must be > 0)
  • +
  • The DDT size type is recognized (SmallDdtSizeType or BigDdtSizeType)
  • +
  • Secondary DDT table is successfully loaded (from cache or file)
  • +
  • Secondary DDT decompression succeeds (if needed)
  • +
  • Secondary DDT CRC validation passes
  • +
  • The DDT entry is successfully extracted and decoded
  • +
  • All output parameters are properly populated with decoded values
  • +
  • Zero DDT entries are handled (indicates sector not dumped)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers).
AARUF_ERROR_CANNOT_READ_BLOCK(-7) Configuration, validation, or file access errors. This occurs when:
    +
  • The tableShift is zero (should use single-level decoding instead)
  • +
  • The DDT size type is unknown/unsupported (not SmallDdtSizeType or BigDdtSizeType)
  • +
  • Cannot read the secondary DDT header from the image stream
  • +
  • Secondary DDT header validation fails (wrong identifier or type)
  • +
  • Cannot read uncompressed secondary DDT data from the image stream
  • +
  • CRC64 context initialization fails (internal error)
  • +
  • Memory allocation fails for secondary DDT data (critical failure)
  • +
  • Unknown compression type encountered in secondary DDT
  • +
+
AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK(-17) LZMA decompression failed for secondary DDT. This occurs when:
    +
  • Memory allocation fails for compressed data or decompression buffer
  • +
  • Cannot read LZMA properties from the image stream
  • +
  • Cannot read compressed secondary DDT data from the image stream
  • +
  • The LZMA decoder returns a non-zero error code during decompression
  • +
  • The decompressed data size doesn't match the expected secondary DDT length
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-18) CRC64 validation failed for secondary DDT. This occurs when:
    +
  • Calculated CRC64 doesn't match the expected CRC64 in the secondary DDT header
  • +
  • Data corruption is detected in the secondary DDT data
  • +
  • This applies to both compressed and uncompressed secondary DDT blocks
  • +
+
+
+
+
Note
Multi-level DDT Navigation:
    +
  • Uses tableShift to calculate items per DDT entry (2^tableShift)
  • +
  • Calculates DDT position by dividing sector address by items per entry
  • +
  • Retrieves secondary DDT offset from primary table at calculated position
  • +
  • Converts block offset to file offset using blockAlignmentShift
  • +
+
+
+Secondary DDT Caching:
    +
  • Maintains a single cached secondary DDT in memory (ctx->cachedSecondaryDdtSmall/Big)
  • +
  • Compares requested offset with cached offset (ctx->cachedDdtOffset)
  • +
  • Only loads from disk if the requested secondary DDT is not currently cached
  • +
  • Caching improves performance for sequential sector access patterns
  • +
+
+
+Secondary DDT Processing:
    +
  • Supports both LZMA compression and uncompressed formats
  • +
  • Performs full CRC64 validation of secondary DDT data
  • +
  • Same bit manipulation as single-level DDT for final entry decoding
  • +
+
+
+Error Handling Strategy:
    +
  • Memory allocation failures for secondary DDT loading are treated as critical errors
  • +
  • File I/O errors and validation failures cause immediate function termination
  • +
  • Unknown compression types are treated as errors (unlike the processing functions)
  • +
  • All allocated memory is cleaned up on error conditions
  • +
+
+
Warning
This function should only be called when tableShift > 0. Calling it with tableShift = 0 will result in AARUF_ERROR_CANNOT_READ_BLOCK.
+
+The function assumes the primary DDT table has been properly loaded and is accessible via ctx->userDataDdtMini or ctx->userDataDdtBig depending on size type.
+
+Secondary DDT caching means that memory usage can increase during operation. The cached secondary DDT is replaced when a different secondary table is needed.
+
+No bounds checking is performed on sector_address or calculated DDT positions. Accessing beyond table boundaries will result in undefined behavior.
+ +

Definition at line 724 of file ddt_v2.c.

+ +

References aaruf_crc64_final(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, aaruf_lzma_decode_buffer(), AARUF_STATUS_OK, DdtHeader2::blockAlignmentShift, aaruformat_context::cached_ddt_offset, aaruformat_context::cached_secondary_ddt2, DdtHeader2::cmpLength, DdtHeader2::compression, DdtHeader2::crc64, DdtHeader2::dataShift, DeDuplicationTableSecondary, FATAL, DdtHeader2::identifier, aaruformat_context::imageStream, DdtHeader2::length, Lzma, LZMA_PROPERTIES_LENGTH, DdtHeader2::negative, None, SectorStatusNotDumped, DdtHeader2::tableShift, TRACE, DdtHeader2::type, aaruformat_context::user_data_ddt2, aaruformat_context::user_data_ddt_header, and UserData.

+ +

Referenced by decode_ddt_entry_v2().

+ +
+
+ +

◆ decode_ddt_single_level_v2()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t decode_ddt_single_level_v2 (aaruformat_context * ctx,
uint64_t sector_address,
bool negative,
uint64_t * offset,
uint64_t * block_offset,
uint8_t * sector_status )
+
+ +

Decodes a single-level DDT v2 entry for a given sector address.

+

Used when the DDT table does not use multi-level indirection (tableShift = 0). This function performs direct lookup in the primary DDT table to extract sector offset, block offset, and sector status information. It performs bit manipulation to decode the packed DDT entry values.

+
Parameters
+ + + + + + + +
ctxPointer to the aaruformat context containing the loaded DDT table.
sector_addressLogical sector address to decode (adjusted for negative sectors).
negativeIndicates if the sector address is negative.
offsetPointer to store the resulting sector offset within the block.
block_offsetPointer to store the resulting block offset in the image.
sector_statusPointer to store the sector status (dumped, not dumped, etc.).
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + +
AARUF_STATUS_OK(0) Successfully decoded the DDT entry. This is always returned when:
    +
  • The context and image stream are valid
  • +
  • The tableShift validation passes (must be 0)
  • +
  • The DDT size type is recognized (SmallDdtSizeType or BigDdtSizeType)
  • +
  • The DDT entry is successfully extracted and decoded
  • +
  • All output parameters are properly populated with decoded values
  • +
  • Zero DDT entries are handled (indicates sector not dumped)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers).
AARUF_ERROR_CANNOT_READ_BLOCK(-7) Configuration or validation errors. This occurs when:
    +
  • The tableShift is not zero (should use multi-level decoding instead)
  • +
  • The DDT size type is unknown/unsupported (not SmallDdtSizeType or BigDdtSizeType)
  • +
  • Internal consistency checks fail
  • +
+
+
+
+
Note
DDT Entry Decoding
    +
  • Bits 63-61: Sector status (4 bits)
  • +
  • Bits 60-0: Combined offset and block index (60 bits)
  • +
  • Offset mask: Derived from dataShift parameter
  • +
  • Block offset: Calculated using blockAlignmentShift parameter
  • +
+
+
+Negative Sector Handling:
    +
  • Sector address is automatically adjusted by adding ctx->userDataDdtHeader.negative
  • +
  • This allows proper indexing into the DDT table for negative sector addresses
  • +
+
+
+Zero Entry Handling:
    +
  • A zero DDT entry indicates the sector was not dumped
  • +
  • Sets sector_status to SectorStatusNotDumped and zeros offset/block_offset
  • +
  • This is a normal condition and not an error
  • +
+
+
Warning
The function assumes the DDT table has been properly loaded and is accessible via ctx->userDataDdtMini or ctx->userDataDdtBig depending on size type.
+
+No bounds checking is performed on sector_address. Accessing beyond the DDT table boundaries will result in undefined behavior.
+
+This function should only be called when tableShift is 0. Calling it with tableShift > 0 will result in AARUF_ERROR_CANNOT_READ_BLOCK.
+ +

Definition at line 581 of file ddt_v2.c.

+ +

References AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, DdtHeader2::blockAlignmentShift, DdtHeader2::dataShift, FATAL, aaruformat_context::imageStream, DdtHeader2::negative, SectorStatusNotDumped, DdtHeader2::tableShift, TRACE, aaruformat_context::user_data_ddt2, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by decode_ddt_entry_v2().

+ +
+
+ +

◆ get_filetime_uint64()

+ +
+
+ + + + + + + +
uint64_t get_filetime_uint64 ()
+
+ +

Gets the current time as a 64-bit FILETIME value.

+

Returns the current system time as a 64-bit value compatible with Windows FILETIME (number of 100-nanosecond intervals since January 1, 1601 UTC).

+
Returns
The current time as a 64-bit FILETIME value.
+ +

Definition at line 45 of file time.c.

+ +

Referenced by aaruf_create().

+ +
+
+ +

◆ parse_options()

+ +
+
+ + + + + + + +
aaru_options parse_options (const char * options)
+
+ +

Parses the options string for AaruFormat image creation/opening.

+

Parses the options string and returns a struct with the parsed options for image creation or opening.

+
Parameters
+ + +
optionsString with options to parse (may be NULL).
+
+
+
Returns
Parsed options as an aaru_options struct.
+ +

Definition at line 38 of file options.c.

+ +

References aaru_options::blake3, aaru_options::block_alignment, aaru_options::compress, aaru_options::data_shift, aaru_options::deduplicate, aaru_options::dictionary, aaru_options::md5, aaru_options::sha1, aaru_options::sha256, aaru_options::spamsum, aaru_options::table_shift, and TRACE.

+ +

Referenced by aaruf_create().

+ +
+
+ +

◆ process_aaru_metadata_json_block()

+ +
+
+ + + + + + + + + + + +
void process_aaru_metadata_json_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes an Aaru metadata JSON block from the image stream during image opening.

+

Reads an Aaru metadata JSON block from the image file and loads its contents into the context for subsequent retrieval. The Aaru metadata JSON format is a structured representation of comprehensive image metadata including media information, imaging session details, hardware configuration, optical disc tracks and sessions, checksums, and preservation metadata. The JSON payload is stored in its original form without parsing or interpretation by this function, allowing higher-level code to process the structured data as needed.

+

This function is called during the image opening process (aaruf_open) when an index entry indicates the presence of an AaruMetadataJsonBlock. The function is non-critical; if reading fails or memory allocation fails, the error is logged but the image opening continues. This allows images without JSON metadata or with corrupted JSON blocks to still be opened for data access.

+

Processing sequence:

    +
  1. Validate context and image stream
  2. +
  3. Seek to the block offset specified by the index entry
  4. +
  5. Read the AaruMetadataJsonBlockHeader (8 bytes: identifier + length)
  6. +
  7. Validate the block identifier matches AaruMetadataJsonBlock
  8. +
  9. Allocate memory for the JSON payload
  10. +
  11. Read the JSON data from the file stream
  12. +
  13. Store header and data pointer in the context for later retrieval
  14. +
+

Memory allocation: The function allocates memory (via malloc) sized to hold the entire JSON payload as specified by ctx->jsonBlockHeader.length. This memory remains allocated for the lifetime of the context and is freed during aaruf_close(). If allocation fails, the function returns gracefully without the JSON metadata, allowing the image to still be opened.

+

Image size tracking: The function increments ctx->imageInfo.ImageSize by the length of the JSON payload to track the total size of metadata and structural blocks in the image.

+

Error handling: All errors are non-fatal and handled gracefully:

    +
  • Seek failures: logged and function returns early
  • +
  • Header read failures: header zeroed, function returns
  • +
  • Identifier mismatches: header zeroed, processing continues but data is not loaded
  • +
  • Memory allocation failures: header zeroed, function returns
  • +
  • Data read failures: header zeroed, allocated memory freed, function returns
  • +
+

In all error cases, the ctx->jsonBlockHeader is zeroed (memset to 0) to indicate that no valid JSON metadata is available, and any allocated memory is properly freed.

+
Parameters
+ + + +
ctxPointer to an initialized aaruformatContext being populated during image opening. Must not be NULL. ctx->imageStream must be open and readable. On success, ctx->jsonBlockHeader will contain the block header and ctx->jsonBlock will point to the allocated JSON data.
entryPointer to the IndexEntry that specifies the file offset where the AaruMetadataJsonBlock begins. Must not be NULL. entry->offset indicates the position of the block header in the file.
+
+
+
Note
JSON Format and Encoding:
    +
  • The JSON payload is stored in UTF-8 encoding
  • +
  • The payload may or may not be null-terminated
  • +
  • This function treats the JSON as opaque binary data
  • +
  • No JSON parsing, interpretation, or validation is performed during loading
  • +
  • JSON schema validation is the responsibility of code that retrieves the metadata
  • +
+
+
+Aaru Metadata JSON Purpose:
    +
  • Provides machine-readable structured metadata about the image
  • +
  • Includes comprehensive information about media, sessions, tracks, and checksums
  • +
  • Enables programmatic access to metadata without XML parsing overhead
  • +
  • Complements CICM XML with a more modern, structured format
  • +
  • Used by Aaru and compatible tools for metadata exchange
  • +
+
+
+Non-Critical Nature:
    +
  • JSON metadata is optional and supplementary to core image data
  • +
  • Failures reading this block do not prevent image opening
  • +
  • The image remains fully functional for sector data access without JSON metadata
  • +
  • Higher-level code should check if ctx->jsonBlock is non-NULL before use
  • +
+
+
+Distinction from CICM XML:
    +
  • Both CICM and Aaru JSON blocks can coexist in the same image
  • +
  • CICM XML follows the Canary Islands Computer Museum schema
  • +
  • Aaru JSON follows the Aaru-specific metadata schema
  • +
  • Different tools may prefer one format over the other
  • +
+
+
Warning
Memory allocated for ctx->jsonBlock persists for the context lifetime and must be freed during context cleanup (aaruf_close).
+
+This function does not validate JSON syntax or schema. Corrupted JSON data will be loaded successfully and errors will only be detected when attempting to parse.
+
See also
AaruMetadataJsonBlockHeader for the on-disk structure definition.
+
+process_cicm_block() for processing CICM XML metadata blocks.
+
+aaruf_open() for the overall image opening sequence.
+ +

Definition at line 470 of file metadata.c.

+ +

References AaruMetadataJsonBlock, FATAL, AaruMetadataJsonBlockHeader::identifier, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, aaruformat_context::json_block, aaruformat_context::json_block_header, AaruMetadataJsonBlockHeader::length, IndexEntry::offset, and TRACE.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_checksum_block()

+ +
+
+ + + + + + + + + + + +
void process_checksum_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes a checksum block from the image stream.

+

Reads a checksum block, parses its entries, and stores the checksums (MD5, SHA1, SHA256, SpamSum) in the context.

+
Parameters
+ + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the checksum block.
+
+
+ +

Definition at line 39 of file checksum.c.

+ +

References ChecksumBlock, aaruformat_context::checksums, ChecksumHeader::entries, FATAL, Checksums::hasMd5, Checksums::hasSha1, Checksums::hasSha256, Checksums::hasSpamSum, ChecksumHeader::identifier, aaruformat_context::imageStream, ChecksumEntry::length, ChecksumHeader::length, Md5, Checksums::md5, MD5_DIGEST_LENGTH, IndexEntry::offset, Sha1, Checksums::sha1, SHA1_DIGEST_LENGTH, Sha256, Checksums::sha256, SHA256_DIGEST_LENGTH, SpamSum, Checksums::spamsum, TRACE, and ChecksumEntry::type.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_cicm_block()

+ +
+
+ + + + + + + + + + + +
void process_cicm_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes a CICM XML metadata block from the image stream.

+

Reads a CICM XML metadata block from the image and updates the context with its contents.

+
Parameters
+ + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the CICM block.
+
+
+ +

Definition at line 306 of file metadata.c.

+ +

References aaruformat_context::cicm_block, aaruformat_context::cicm_block_header, CicmBlock, FATAL, CicmMetadataBlock::identifier, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, CicmMetadataBlock::length, IndexEntry::offset, and TRACE.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_data_block()

+ +
+
+ + + + + + + + + + + +
int32_t process_data_block (aaruformat_context * ctx,
IndexEntry * entry )
+
+ +

Processes a data block from the image stream.

+

Reads a data block from the image, decompresses if needed, and updates the context with its contents. This function handles various types of data blocks including compressed (LZMA) and uncompressed data, performs CRC validation, and stores the processed data in the appropriate context fields.

+
Parameters
+ + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the data block.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully processed the data block. This is returned when:
    +
  • The block is processed successfully and all validations pass
  • +
  • A NoData block type is encountered (these are skipped)
  • +
  • A UserData block type is encountered (these update sector size but are otherwise skipped)
  • +
  • Block validation fails but processing continues (non-fatal errors like CRC mismatches)
  • +
  • Memory allocation failures occur (processing continues with other blocks)
  • +
  • Block reading failures occur (processing continues with other blocks)
  • +
  • Unknown compression types are encountered (block is skipped)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers).
AARUF_ERROR_CANNOT_READ_BLOCK(-7) Failed to seek to the block position in the image stream. This occurs when fseek() fails or the file position doesn't match the expected offset.
AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK(-17) LZMA decompression failed. This can happen when:
    +
  • The LZMA decoder returns an error code
  • +
  • The decompressed data size doesn't match the expected block length
  • +
+
+
+
+
Note
Most validation and reading errors are treated as non-fatal and result in AARUF_STATUS_OK being returned while the problematic block is skipped. This allows processing to continue with other blocks in the image.
+
+The function performs the following validations:
    +
  • Block identifier matches the expected block type
  • +
  • Block data type matches the expected data type
  • +
  • CRC64 checksum validation (with version-specific byte order handling)
  • +
  • Proper decompression for LZMA-compressed blocks
  • +
+
+
Warning
Memory allocated for block data is stored in the context and should be freed when the context is destroyed. The function may replace existing data in the context.
+ +

Definition at line 71 of file data.c.

+ +

References aaruf_crc64_data(), aaruf_cst_untransform(), AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, aaruf_get_media_tag_type_for_datatype(), aaruf_lzma_decode_buffer(), AARUF_STATUS_OK, AARUF_VERSION_V1, AppleProfileTag, AppleSectorTag, AppleSonyTag, IndexEntry::blockType, bswap_64, CdSectorEcc, CdSectorEccP, CdSectorEccQ, CdSectorEdc, CdSectorHeader, CdSectorPrefix, CdSectorPrefixCorrected, CdSectorSubchannel, CdSectorSubHeader, CdSectorSuffix, CdSectorSuffixCorrected, CdSectorSync, BlockHeader::cmpLength, CompactDiscMode2Subheader, BlockHeader::compression, BlockHeader::crc64, mediaTagEntry::data, IndexEntry::dataType, DvdCmi, DvdSectorCprMai, DvdSectorEdc, DvdSectorEdcAaru, DvdSectorId, DvdSectorIed, DvdSectorIedAaru, DvdSectorInformation, DvdSectorNumber, DvdSectorTitleKeyDecrypted, DvdTitleKeyDecrypted, FATAL, aaruformat_context::header, BlockHeader::identifier, aaruformat_context::image_info, AaruHeaderV2::imageMajorVersion, ImageInfo::ImageSize, aaruformat_context::imageStream, BlockHeader::length, mediaTagEntry::length, Lzma, LZMA_PROPERTIES_LENGTH, LzmaClauniaSubchannelTransform, aaruformat_context::mediaTags, aaruformat_context::mode2_subheaders, NoData, None, IndexEntry::offset, PriamDataTowerTag, aaruformat_context::readableSectorTags, aaruformat_context::sector_cpr_mai, aaruformat_context::sector_decrypted_title_key, aaruformat_context::sector_edc, aaruformat_context::sector_id, aaruformat_context::sector_ied, aaruformat_context::sector_prefix, aaruformat_context::sector_prefix_corrected, aaruformat_context::sector_subchannel, aaruformat_context::sector_suffix, aaruformat_context::sector_suffix_corrected, ImageInfo::SectorSize, BlockHeader::sectorSize, TRACE, BlockHeader::type, mediaTagEntry::type, and UserData.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_ddt_v1()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t process_ddt_v1 (aaruformat_context * ctx,
IndexEntry * entry,
bool * found_user_data_ddt )
+
+ +

Processes a DDT v1 block from the image stream.

+

Reads and decompresses (if needed) a DDT v1 block, verifies its integrity, and loads it into memory or maps it. This function handles both user data DDT blocks and CD sector prefix/suffix corrected DDT blocks, supporting both LZMA compression and uncompressed formats. On Linux, uncompressed blocks can be memory-mapped for improved performance.

+
Parameters
+ + + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the DDT block.
found_user_data_ddtPointer to a boolean that will be set to true if a user data DDT was found and loaded.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + +
AARUF_STATUS_OK(0) Successfully processed the DDT block. This is returned when:
    +
  • The DDT block is successfully read, decompressed (if needed), and loaded into memory
  • +
  • Memory mapping of uncompressed DDT succeeds on Linux systems
  • +
  • CD sector prefix/suffix corrected DDT blocks are processed successfully
  • +
  • Memory allocation failures occur for non-critical operations (processing continues)
  • +
  • File reading errors occur for compressed data or LZMA properties (processing continues)
  • +
  • Unknown compression types are encountered (block is skipped)
  • +
  • Memory mapping fails on Linux (sets found_user_data_ddt to false but continues)
  • +
  • Uncompressed DDT is encountered on non-Linux systems (not yet implemented, continues)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers).
AARUF_ERROR_CANNOT_READ_BLOCK(-7) Failed to access the DDT block in the image stream. This occurs when:
    +
  • fseek() fails to position at the DDT block offset
  • +
  • The file position doesn't match the expected offset after seeking
  • +
  • Failed to read the DDT header from the image stream
  • +
  • The number of bytes read for the DDT header is insufficient
  • +
+
AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK(-17) LZMA decompression failed. This can happen when:
    +
  • The LZMA decoder returns a non-zero error code during decompression
  • +
  • The decompressed data size doesn't match the expected DDT block length
  • +
  • This error causes immediate function termination and memory cleanup
  • +
+
+
+
+
Note
The function exhibits different error handling strategies depending on the operation:
    +
  • Critical errors (seek failures, header read failures, decompression failures) cause immediate return
  • +
  • Non-critical errors (memory allocation failures, unknown compression types) allow processing to continue
  • +
  • The found_user_data_ddt flag is updated to reflect the success of user data DDT loading
  • +
+
+
+Memory Management:
    +
  • Allocated DDT data is stored in the context (ctx->userDataDdt, ctx->sectorPrefixDdt, ctx->sectorSuffixDdt)
  • +
  • On Linux, uncompressed DDTs may be memory-mapped instead of allocated
  • +
  • Memory is automatically cleaned up on decompression errors
  • +
+
+
+Platform-specific behavior:
    +
  • Linux: Supports memory mapping of uncompressed DDT blocks for better performance
  • +
  • Non-Linux: Uncompressed DDT processing is not yet implemented
  • +
+
+
Warning
The function modifies context state including sector count, shift value, and DDT version. Ensure proper context cleanup when the function completes.
+ +

Definition at line 85 of file ddt_v1.c.

+ +

References AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, aaruf_lzma_decode_buffer(), AARUF_STATUS_OK, CdSectorPrefixCorrected, CdSectorSuffixCorrected, DdtHeader::cmpLength, DdtHeader::compression, IndexEntry::dataType, aaruformat_context::ddt_version, DdtHeader::entries, FATAL, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, aaruformat_context::in_memory_ddt, DdtHeader::length, Lzma, LZMA_PROPERTIES_LENGTH, aaruformat_context::mapped_memory_ddt_size, None, IndexEntry::offset, aaruformat_context::sector_prefix_ddt, aaruformat_context::sector_suffix_ddt, ImageInfo::Sectors, aaruformat_context::shift, DdtHeader::shift, TRACE, aaruformat_context::user_data_ddt, and UserData.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_ddt_v2()

+ +
+
+ + + + + + + + + + + + + + + + +
int32_t process_ddt_v2 (aaruformat_context * ctx,
IndexEntry * entry,
bool * found_user_data_ddt )
+
+ +

Processes a DDT v2 block from the image stream.

+

Reads and decompresses (if needed) a DDT v2 block, verifies its CRC, and loads it into memory. This function handles both user data DDT blocks and CD sector prefix/suffix corrected DDT blocks, supporting both LZMA compression and uncompressed formats. It performs CRC64 validation and stores the processed DDT data in the appropriate context fields based on size type (small/big).

+
Parameters
+ + + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the DDT block.
found_user_data_ddtPointer to a boolean that will be set to true if a user data DDT was found and loaded.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + +
AARUF_STATUS_OK(0) Successfully processed the DDT block. This is returned when:
    +
  • The DDT block is successfully read, decompressed (if needed), and loaded into memory
  • +
  • CRC64 validation passes for the DDT data
  • +
  • User data DDT blocks are processed and context is properly updated
  • +
  • CD sector prefix/suffix corrected DDT blocks are processed successfully
  • +
  • Memory allocation failures occur for non-critical operations (processing continues)
  • +
  • File reading errors occur for compressed data or LZMA properties (processing continues)
  • +
  • Unknown compression types are encountered (block is skipped)
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) The context or image stream is invalid (NULL pointers).
AARUF_ERROR_CANNOT_READ_BLOCK(-7) Failed to access the DDT block in the image stream. This occurs when:
    +
  • fseek() fails to position at the DDT block offset
  • +
  • The file position doesn't match the expected offset after seeking
  • +
  • Failed to read the DDT header from the image stream
  • +
  • The number of bytes read for the DDT header is insufficient
  • +
  • CRC64 context initialization fails (internal error)
  • +
+
AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK(-17) LZMA decompression failed. This can happen when:
    +
  • The LZMA decoder returns a non-zero error code during decompression
  • +
  • The decompressed data size doesn't match the expected DDT block length
  • +
  • This error causes immediate function termination and memory cleanup
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-18) CRC64 validation failed. This occurs when:
    +
  • Calculated CRC64 doesn't match the expected CRC64 in the DDT header
  • +
  • Data corruption is detected in the DDT block
  • +
  • This applies to both compressed and uncompressed DDT blocks
  • +
+
+
+
+
Note
Error Handling Strategy:
    +
  • Critical errors (seek failures, header read failures, decompression failures, CRC failures) cause immediate return
  • +
  • Non-critical errors (memory allocation failures, unknown compression types) allow processing to continue
  • +
  • The found_user_data_ddt flag is updated to reflect the success of user data DDT loading
  • +
+
+
+DDT v2 Features:
    +
  • Handles multi-level DDT hierarchies with tableShift parameter
  • +
  • Updates context with sector counts, DDT version, and primary DDT offset
  • +
  • Stores DDT data in size-appropriate context fields (userDataDdtMini/Big, sectorPrefixDdt, etc.)
  • +
+
+
+Memory Management:
    +
  • Allocated DDT data is stored in the context and becomes part of the context lifecycle
  • +
  • Memory is automatically cleaned up on decompression or CRC validation errors
  • +
  • Buffer memory is reused for the final DDT data storage (no double allocation)
  • +
+
+
+CRC Validation:
    +
  • All DDT blocks undergo CRC64 validation regardless of compression type
  • +
  • CRC is calculated on the final decompressed data
  • +
  • Uses standard CRC64 calculation (no version-specific endianness conversion like v1)
  • +
+
+
Warning
The function modifies context state including sector count, DDT version, and primary DDT offset. Ensure proper context cleanup when the function completes.
+
+Memory allocated for DDT data becomes part of the context and should not be freed separately. The context cleanup functions will handle DDT memory deallocation.
+ +

Definition at line 96 of file ddt_v2.c.

+ +

References aaruf_crc64_final(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, aaruf_lzma_decode_buffer(), AARUF_STATUS_OK, DdtHeader2::blocks, CdSectorPrefix, CdSectorSuffix, DdtHeader2::cmpLength, DdtHeader2::compression, DdtHeader2::crc64, IndexEntry::dataType, aaruformat_context::ddt_version, FATAL, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, aaruformat_context::in_memory_ddt, DdtHeader2::length, Lzma, LZMA_PROPERTIES_LENGTH, DdtHeader2::negative, None, IndexEntry::offset, DdtHeader2::overflow, aaruformat_context::primary_ddt_offset, aaruformat_context::sector_prefix_ddt2, aaruformat_context::sector_suffix_ddt2, ImageInfo::Sectors, TRACE, aaruformat_context::user_data_ddt2, aaruformat_context::user_data_ddt_header, and UserData.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_dumphw_block()

+ +
+
+ + + + + + + + + + + +
void process_dumphw_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes a dump hardware block from the image stream.

+

Reads a dump hardware block from the image and updates the context with its contents.

+
Parameters
+ + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the dump hardware block.
+
+
+ +

Definition at line 108 of file dump.c.

+ +

References aaruf_crc64_data(), AARUF_VERSION_V1, IndexEntry::blockType, bswap_64, compare_extents(), DumpHardwareHeader::crc64, aaruformat_context::dump_hardware_entries_with_data, aaruformat_context::dump_hardware_header, DumpHardwareBlock, DumpHardwareHeader::entries, DumpHardwareEntriesWithData::entry, DumpHardwareEntriesWithData::extents, DumpHardwareEntry::extents, FATAL, DumpHardwareEntriesWithData::firmware, DumpHardwareEntry::firmwareLength, free_dump_hardware_entries_array(), aaruformat_context::header, DumpHardwareHeader::identifier, AaruHeaderV2::imageMajorVersion, aaruformat_context::imageStream, DumpHardwareHeader::length, DumpHardwareEntriesWithData::manufacturer, DumpHardwareEntry::manufacturerLength, DumpHardwareEntriesWithData::model, DumpHardwareEntry::modelLength, IndexEntry::offset, read_dump_string(), reset_dump_hardware_context(), DumpHardwareEntriesWithData::revision, DumpHardwareEntry::revisionLength, DumpHardwareEntriesWithData::serial, DumpHardwareEntry::serialLength, DumpHardwareEntriesWithData::softwareName, DumpHardwareEntry::softwareNameLength, DumpHardwareEntriesWithData::softwareOperatingSystem, DumpHardwareEntry::softwareOperatingSystemLength, DumpHardwareEntriesWithData::softwareVersion, DumpHardwareEntry::softwareVersionLength, and TRACE.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_geometry_block()

+ +
+
+ + + + + + + + + + + +
void process_geometry_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes a logical geometry block from the image stream.

+

Reads a logical geometry block from the image and updates the context with its contents.

+
Parameters
+ + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the geometry block.
+
+
+ +

Definition at line 246 of file metadata.c.

+ +

References aaruformat_context::cylinders, GeometryBlockHeader::cylinders, FATAL, aaruformat_context::geometry_block, GeometryBlock, aaruformat_context::heads, GeometryBlockHeader::heads, GeometryBlockHeader::identifier, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, IndexEntry::offset, aaruformat_context::sectors_per_track, GeometryBlockHeader::sectorsPerTrack, and TRACE.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_index_v1()

+ +
+
+ + + + + + + +
UT_array * process_index_v1 (aaruformat_context * ctx)
+
+ +

Processes an index block (version 1) from the image stream.

+

Reads and parses an index block (version 1) from the image, returning an array of index entries. This function handles the legacy index format used in early AaruFormat versions, providing compatibility with older image files. It reads the IndexHeader structure followed by a sequential list of IndexEntry structures, validating the index identifier for format correctness.

+
Parameters
+ + +
ctxPointer to the aaruformat context containing the image stream and header information.
+
+
+
Returns
Returns one of the following values:
+
Return values
+ + + +
UT_array*Successfully processed the index block. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The index header is successfully read from the position specified in ctx->header.indexOffset
  • +
  • The index identifier matches IndexBlock (legacy format identifier)
  • +
  • All index entries are successfully read and stored in the UT_array
  • +
  • Memory allocation for the index entries array succeeds
  • +
  • The returned array contains all index entries from the version 1 index block
  • +
+
NULLIndex processing failed. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
  • Cannot read the IndexHeader structure from the image stream
  • +
  • The index identifier doesn't match IndexBlock (incorrect format or corruption)
  • +
  • Memory allocation fails for the UT_array structure
  • +
  • File I/O errors occur while reading index entries
  • +
+
+
+
+
Note
Index Structure (Version 1):
    +
  • IndexHeader: Contains identifier (IndexBlock), entry count, and metadata
  • +
  • IndexEntry array: Sequential list of entries describing block locations and types
  • +
  • No CRC validation is performed during processing (use verify_index_v1 for validation)
  • +
  • No compression support in version 1 index format
  • +
+
+
+Memory Management:
    +
  • Returns a newly allocated UT_array that must be freed by the caller using utarray_free()
  • +
  • On error, any partially allocated memory is cleaned up before returning NULL
  • +
  • Each IndexEntry is copied into the array (no reference to original stream data)
  • +
+
+
+Version Compatibility:
    +
  • Supports only legacy IndexBlock format (not IndexBlock2 or IndexBlock3)
  • +
  • Compatible with early AaruFormat and DiscImageChef image files
  • +
  • Does not handle subindex or hierarchical index structures
  • +
+
+
Warning
The caller is responsible for freeing the returned UT_array using utarray_free(). Failure to free the array will result in memory leaks.
+
+This function does not validate the CRC integrity of the index data. Use verify_index_v1() to ensure index integrity before processing.
+
+The function assumes ctx->header.indexOffset points to a valid index block. Invalid offsets may cause file access errors or reading incorrect data.
+ +

Definition at line 79 of file index_v1.c.

+ +

References IndexHeader::entries, FATAL, aaruformat_context::header, IndexHeader::identifier, aaruformat_context::imageStream, IndexBlock, AaruHeaderV2::indexOffset, and TRACE.

+ +

Referenced by aaruf_open(), and aaruf_verify_image().

+ +
+
+ +

◆ process_index_v2()

+ +
+
+ + + + + + + +
UT_array * process_index_v2 (aaruformat_context * ctx)
+
+ +

Processes an index block (version 2) from the image stream.

+

Reads and parses an index block (version 2) from the image, returning an array of index entries. This function handles the intermediate index format used in mid-generation AaruFormat versions, providing compatibility with version 2 image files. It reads the IndexHeader2 structure followed by a sequential list of IndexEntry structures, validating the index identifier for format correctness.

+
Parameters
+ + +
ctxPointer to the aaruformat context containing the image stream and header information.
+
+
+
Returns
Returns one of the following values:
+
Return values
+ + + +
UT_array*Successfully processed the index block. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The index header is successfully read from the position specified in ctx->header.indexOffset
  • +
  • The index identifier matches IndexBlock2 (version 2 format identifier)
  • +
  • All index entries are successfully read and stored in the UT_array
  • +
  • Memory allocation for the index entries array succeeds
  • +
  • The returned array contains all index entries from the version 2 index block
  • +
+
NULLIndex processing failed. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
  • Cannot read the IndexHeader2 structure from the image stream
  • +
  • The index identifier doesn't match IndexBlock2 (incorrect format or corruption)
  • +
  • Memory allocation fails for the UT_array structure
  • +
  • File I/O errors occur while reading index entries
  • +
+
+
+
+
Note
Index Structure (Version 2):
    +
  • IndexHeader2: Contains identifier (IndexBlock2), entry count, and enhanced metadata
  • +
  • IndexEntry array: Sequential list of entries describing block locations and types
  • +
  • No CRC validation is performed during processing (use verify_index_v2 for validation)
  • +
  • No compression support in version 2 index format
  • +
  • Compatible with mid-generation AaruFormat improvements
  • +
+
+
+Memory Management:
    +
  • Returns a newly allocated UT_array that must be freed by the caller using utarray_free()
  • +
  • On error, any partially allocated memory is cleaned up before returning NULL
  • +
  • Each IndexEntry is copied into the array (no reference to original stream data)
  • +
+
+
+Version Compatibility:
    +
  • Supports only IndexBlock2 format (not IndexBlock or IndexBlock3)
  • +
  • Compatible with intermediate AaruFormat image files
  • +
  • Does not handle subindex or hierarchical index structures (introduced in v3)
  • +
+
+
Warning
The caller is responsible for freeing the returned UT_array using utarray_free(). Failure to free the array will result in memory leaks.
+
+This function does not validate the CRC integrity of the index data. Use verify_index_v2() to ensure index integrity before processing.
+
+The function assumes ctx->header.indexOffset points to a valid index block. Invalid offsets may cause file access errors or reading incorrect data.
+ +

Definition at line 81 of file index_v2.c.

+ +

References IndexHeader2::entries, FATAL, aaruformat_context::header, IndexHeader2::identifier, aaruformat_context::imageStream, IndexBlock2, AaruHeaderV2::indexOffset, and TRACE.

+ +

Referenced by aaruf_open(), and aaruf_verify_image().

+ +
+
+ +

◆ process_index_v3()

+ +
+
+ + + + + + + +
UT_array * process_index_v3 (aaruformat_context * ctx)
+
+ +

Processes an index block (version 3) from the image stream.

+

Reads and parses an index block (version 3) from the image, returning an array of index entries. This function handles the advanced index format used in current AaruFormat versions, supporting hierarchical subindex structures for improved scalability. It reads the IndexHeader3 structure followed by index entries, recursively processing any subindex blocks encountered to create a flattened array of all index entries.

+
Parameters
+ + +
ctxPointer to the aaruformat context containing the image stream and header information.
+
+
+
Returns
Returns one of the following values:
+
Return values
+ + + +
UT_array*Successfully processed the index block and all subindexes. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The index header is successfully read from the position specified in ctx->header.indexOffset
  • +
  • The index identifier matches IndexBlock3 (version 3 format identifier)
  • +
  • All index entries are successfully read and stored in the UT_array
  • +
  • Any subindex blocks (IndexBlock3 entries) are recursively processed via add_subindex_entries()
  • +
  • Memory allocation for the index entries array succeeds
  • +
  • The returned array contains all index entries from the main index and all subindexes
  • +
+
NULLIndex processing failed. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
  • Cannot read the IndexHeader3 structure from the image stream
  • +
  • The index identifier doesn't match IndexBlock3 (incorrect format or corruption)
  • +
  • Memory allocation fails for the UT_array structure
  • +
  • File I/O errors occur while reading index entries
  • +
  • Recursive subindex processing fails (errors in add_subindex_entries())
  • +
+
+
+
+
Note
Index Structure (Version 3):
    +
  • IndexHeader3: Contains identifier (IndexBlock3), entry count, and advanced metadata
  • +
  • IndexEntry array: May contain regular entries and subindex references (IndexBlock3 type)
  • +
  • Hierarchical support: Subindex entries are recursively processed to flatten the structure
  • +
  • No CRC validation is performed during processing (use verify_index_v3 for validation)
  • +
  • Supports scalable index organization for large image files
  • +
+
+
+Subindex Processing:
    +
  • When an IndexEntry has blockType == IndexBlock3, it references a subindex
  • +
  • Subindexes are recursively processed using add_subindex_entries()
  • +
  • All entries from subindexes are flattened into the main index entries array
  • +
  • Supports arbitrary nesting depth of subindexes
  • +
+
+
+Memory Management:
    +
  • Returns a newly allocated UT_array that must be freed by the caller using utarray_free()
  • +
  • On error, any partially allocated memory is cleaned up before returning NULL
  • +
  • Each IndexEntry is copied into the array (no reference to original stream data)
  • +
  • Memory usage scales with total entries across all subindexes
  • +
+
+
+Version Compatibility:
    +
  • Supports only IndexBlock3 format (not IndexBlock or IndexBlock2)
  • +
  • Compatible with current generation AaruFormat image files
  • +
  • Backward compatible with images that don't use subindexes
  • +
+
+
Warning
The caller is responsible for freeing the returned UT_array using utarray_free(). Failure to free the array will result in memory leaks.
+
+This function does not validate the CRC integrity of the index data. Use verify_index_v3() to ensure index integrity before processing.
+
+Recursive subindex processing may cause significant memory usage and processing time for images with deeply nested or numerous subindexes.
+
+The function assumes ctx->header.indexOffset points to a valid index block. Invalid offsets may cause file access errors or reading incorrect data.
+ +

Definition at line 98 of file index_v3.c.

+ +

References add_subindex_entries(), IndexEntry::blockType, IndexHeader3::entries, FATAL, aaruformat_context::header, IndexHeader3::identifier, aaruformat_context::imageStream, IndexBlock3, AaruHeaderV2::indexOffset, and TRACE.

+ +

Referenced by aaruf_open(), and aaruf_verify_image().

+ +
+
+ +

◆ process_metadata_block()

+ +
+
+ + + + + + + + + + + +
void process_metadata_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes a metadata block from the image stream.

+

Reads a metadata block from the image and updates the context with its contents.

+
Parameters
+ + + +
ctxPointer to the aaruformat context.
entryPointer to the index entry describing the metadata block.
+
+
+ +

Definition at line 35 of file metadata.c.

+ +

References MetadataBlockHeader::blockSize, IndexEntry::blockType, aaruformat_context::comments, MetadataBlockHeader::commentsLength, MetadataBlockHeader::commentsOffset, aaruformat_context::creator, MetadataBlockHeader::creatorLength, MetadataBlockHeader::creatorOffset, aaruformat_context::drive_firmware_revision, aaruformat_context::drive_manufacturer, aaruformat_context::drive_model, aaruformat_context::drive_serial_number, MetadataBlockHeader::driveFirmwareRevisionLength, MetadataBlockHeader::driveFirmwareRevisionOffset, MetadataBlockHeader::driveManufacturerLength, MetadataBlockHeader::driveManufacturerOffset, MetadataBlockHeader::driveModelLength, MetadataBlockHeader::driveModelOffset, MetadataBlockHeader::driveSerialNumberLength, MetadataBlockHeader::driveSerialNumberOffset, FATAL, MetadataBlockHeader::identifier, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, aaruformat_context::last_media_sequence, MetadataBlockHeader::lastMediaSequence, aaruformat_context::media_barcode, aaruformat_context::media_manufacturer, aaruformat_context::media_model, aaruformat_context::media_part_number, aaruformat_context::media_sequence, aaruformat_context::media_serial_number, aaruformat_context::media_title, MetadataBlockHeader::mediaBarcodeLength, MetadataBlockHeader::mediaBarcodeOffset, MetadataBlockHeader::mediaManufacturerLength, MetadataBlockHeader::mediaManufacturerOffset, MetadataBlockHeader::mediaModelLength, MetadataBlockHeader::mediaModelOffset, MetadataBlockHeader::mediaPartNumberLength, MetadataBlockHeader::mediaPartNumberOffset, MetadataBlockHeader::mediaSequence, MetadataBlockHeader::mediaSerialNumberLength, MetadataBlockHeader::mediaSerialNumberOffset, MetadataBlockHeader::mediaTitleLength, MetadataBlockHeader::mediaTitleOffset, aaruformat_context::metadata_block, aaruformat_context::metadata_block_header, IndexEntry::offset, and TRACE.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_tape_files_block()

+ +
+
+ + + + + + + + + + + +
void process_tape_files_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes a tape file metadata block from the image stream.

+

Reads and parses a TapeFileBlock from the Aaru image, validates its integrity, and populates the context's tape file hash table with file layout information. Each tape file entry defines a logical file on the tape medium by specifying its partition, file number, and block range (FirstBlock to LastBlock inclusive).

+

The function performs the following operations:

    +
  1. Seeks to the block position indicated by the index entry
  2. +
  3. Reads and validates the TapeFileHeader structure
  4. +
  5. Allocates and reads the array of TapeFileEntry structures
  6. +
  7. Validates data integrity using CRC64-ECMA checksum
  8. +
  9. Inserts each file entry into the context's UTHASH table with a composite key
  10. +
  11. Updates image size statistics
  12. +
+

Composite Key Construction: Each tape file is uniquely identified by a 64-bit composite key: key = (partition << 32) | file_number This allows files with the same file number in different partitions to coexist in the hash table without conflicts.

+

Hash Table Management: The function uses HASH_REPLACE to insert entries, which automatically:

    +
  • Adds new entries if the key doesn't exist
  • +
  • Replaces existing entries if the key is found (freeing the old entry) This ensures that duplicate entries (same partition/file combination) are properly handled by keeping only the most recent definition.
  • +
+

Error Handling: The function treats most errors as non-fatal and continues processing:

    +
  • Invalid context or stream: Returns immediately (FATAL log)
  • +
  • Seek failures: Returns immediately (FATAL log)
  • +
  • Header read failures: Returns early (TRACE log)
  • +
  • Incorrect block identifier: Logs warning but continues
  • +
  • Memory allocation failures: Logs error and returns
  • +
  • Entry read failures: Frees buffer and returns
  • +
  • CRC64 mismatch: Logs warning, frees buffer, and returns
  • +
  • Per-entry allocation failures: Logs error and skips that entry
  • +
+

Block Structure: The tape file block consists of:

+-------------------------+
+
| TapeFileHeader (24 B) | <- identifier, entries, length, crc64
+
+-------------------------+
+
| TapeFileEntry 0 (21 B) | <- File, Partition, FirstBlock, LastBlock
+
| TapeFileEntry 1 (21 B) |
+
| ... |
+
| TapeFileEntry (n-1) |
+
+-------------------------+
+
Describes a single logical file on a tape medium.
Definition tape.h:134
+
struct TapeFileHeader TapeFileHeader
+
struct TapeFileEntry TapeFileEntry
+

CRC64 Validation: The CRC64 checksum in the header is computed over the entire array of TapeFileEntry structures (excluding the header itself). This provides integrity verification to detect corruption in the file table.

+

Memory Management:

    +
  • Allocates a temporary buffer to read all file entries
  • +
  • Allocates individual hash table entries for each file
  • +
  • Frees the temporary buffer before returning
  • +
  • Frees replaced hash entries automatically
  • +
  • Hash table entries remain in context until cleanup
  • +
+
Parameters
+ + + +
ctxPointer to the aaruformat context. Must not be NULL. The context must have a valid imageStream open for reading. The ctx->tapeFiles hash table will be populated with file entries. The ctx->imageInfo.ImageSize will be updated with the block size.
entryPointer to the index entry describing the tape file block. Must not be NULL. The entry->offset field indicates the file position where the TapeFileHeader begins.
+
+
+
Note
This function does not return a status code. All errors are handled internally with appropriate logging and the function returns early on fatal errors.
+
+The tape file hash table (ctx->tapeFiles) must be initialized to NULL before the first call to this function. UTHASH will manage the table automatically as entries are added.
+
+Files are ordered in the hash table by their composite key value, not by insertion order. To iterate files in partition/file number order, use HASH_SORT with an appropriate comparison function.
+
+The function updates ctx->imageInfo.ImageSize by adding the size of all file entries (entries × sizeof(TapeFileEntry)). This contributes to the total reported image size but does not include the header size.
+
Warning
The context and imageStream must be valid. Passing NULL pointers will result in immediate return with a FATAL log message.
+
+If the CRC64 checksum validation fails, all entries in the block are discarded. The function does not attempt partial recovery.
+
+If memory allocation fails for a hash entry, that specific file entry is skipped but processing continues with remaining entries.
+
See also
TapeFileHeader for the block header structure
+
+TapeFileEntry for individual file entry structure
+
+tapeFileHashEntry for the hash table entry structure
+
+process_tape_partition_block() for partition metadata processing
+ +

Definition at line 126 of file tape.c.

+ +

References aaruf_crc64_data(), TapeFileHeader::crc64, TapeFileHeader::entries, FATAL, TapeFileHashEntry::fileEntry, TapeFileHeader::identifier, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, TapeFileHashEntry::key, IndexEntry::offset, aaruformat_context::tape_files, TapeFileBlock, and TRACE.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_tape_partitions_block()

+ +
+
+ + + + + + + + + + + +
void process_tape_partitions_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Processes a tape partition metadata block from the image stream.

+

Reads and parses a TapePartitionBlock from the Aaru image, validates its integrity, and populates the context's tape partition hash table with partition layout information. Each tape partition entry defines a physical division of the tape medium by specifying its partition number and block range (FirstBlock to LastBlock inclusive).

+

The function performs the following operations:

    +
  1. Seeks to the block position indicated by the index entry
  2. +
  3. Reads and validates the TapePartitionHeader structure
  4. +
  5. Allocates and reads the array of TapePartitionEntry structures
  6. +
  7. Validates data integrity using CRC64-ECMA checksum
  8. +
  9. Inserts each partition entry into the context's UTHASH table with partition number as key
  10. +
  11. Updates image size statistics
  12. +
+

Partition Identification: Each tape partition is uniquely identified by its partition number (0-255). This number serves as the hash table key for fast lookup operations. Most tapes have a single partition (partition 0), but multi-partition formats like LTO, DLT, and AIT support multiple partitions with independent block address spaces.

+

Hash Table Management: The function uses HASH_REPLACE to insert entries, which automatically:

    +
  • Adds new entries if the partition number doesn't exist
  • +
  • Replaces existing entries if the partition number is found (freeing the old entry) This ensures that duplicate partition definitions are properly handled by keeping only the most recent definition.
  • +
+

Error Handling: The function treats most errors as non-fatal and continues processing:

    +
  • Invalid context or stream: Returns immediately (FATAL log)
  • +
  • Seek failures: Returns immediately (FATAL log)
  • +
  • Header read failures: Returns early (TRACE log)
  • +
  • Incorrect block identifier: Logs warning but continues
  • +
  • Memory allocation failures: Logs error and returns
  • +
  • Entry read failures: Frees buffer and returns
  • +
  • CRC64 mismatch: Logs warning, frees buffer, and returns
  • +
  • Per-entry allocation failures: Logs error and skips that entry
  • +
+

Block Structure: The tape partition block consists of:

+-----------------------------+
+
| TapePartitionHeader (24 B) | <- identifier, entries, length, crc64
+
+-----------------------------+
+
| TapePartitionEntry 0 (17 B) | <- Number, FirstBlock, LastBlock
+
| TapePartitionEntry 1 (17 B) |
+
| ... |
+ +
+-----------------------------+
+
Describes a single physical partition on a tape medium.
Definition tape.h:320
+
struct TapePartitionHeader TapePartitionHeader
+
struct TapePartitionEntry TapePartitionEntry
+

CRC64 Validation: The CRC64 checksum in the header is computed over the entire array of TapePartitionEntry structures (excluding the header itself). This provides integrity verification to detect corruption in the partition table.

+

Partition Block Ranges: Each partition defines a block address space:

    +
  • FirstBlock: Starting block address (often 0, but format-dependent)
  • +
  • LastBlock: Ending block address (inclusive)
  • +
  • Block count: (LastBlock - FirstBlock + 1)
  • +
+

Block addresses are local to each partition. Different partitions may have overlapping logical block numbers (e.g., both partition 0 and partition 1 can have blocks numbered 0-1000).

+

Memory Management:

    +
  • Allocates a temporary buffer to read all partition entries
  • +
  • Allocates individual hash table entries for each partition
  • +
  • Frees the temporary buffer before returning
  • +
  • Frees replaced hash entries automatically
  • +
  • Hash table entries remain in context until cleanup
  • +
+
Parameters
+ + + +
ctxPointer to the aaruformat context. Must not be NULL. The context must have a valid imageStream open for reading. The ctx->tapePartitions hash table will be populated with partition entries. The ctx->imageInfo.ImageSize will be updated with the block size.
entryPointer to the index entry describing the tape partition block. Must not be NULL. The entry->offset field indicates the file position where the TapePartitionHeader begins.
+
+
+
Note
This function does not return a status code. All errors are handled internally with appropriate logging and the function returns early on fatal errors.
+
+The tape partition hash table (ctx->tapePartitions) must be initialized to NULL before the first call to this function. UTHASH will manage the table automatically as entries are added.
+
+Partitions are ordered in the hash table by their partition number, not by insertion order. To iterate partitions in numerical order, use HASH_SORT with an appropriate comparison function.
+
+The function updates ctx->imageInfo.ImageSize by adding the size of all partition entries (entries × sizeof(TapePartitionEntry)). This contributes to the total reported image size but does not include the header size.
+
+The partition metadata is essential for correctly interpreting tape file locations, as files reference partition numbers in their definitions. Without partition metadata, tape file block ranges may be ambiguous.
+
Warning
The context and imageStream must be valid. Passing NULL pointers will result in immediate return with a FATAL log message.
+
+If the CRC64 checksum validation fails, all entries in the block are discarded. The function does not attempt partial recovery.
+
+If memory allocation fails for a hash entry, that specific partition entry is skipped but processing continues with remaining entries.
+
+If multiple partition entries have the same Number field, only the last occurrence is retained. This should not occur in valid images.
+
See also
TapePartitionHeader for the block header structure
+
+TapePartitionEntry for individual partition entry structure
+
+TapePartitionHashEntry for the hash table entry structure
+
+process_tape_files_block() for tape file metadata processing
+ +

Definition at line 346 of file tape.c.

+ +

References aaruf_crc64_data(), TapePartitionHeader::crc64, TapePartitionHeader::entries, FATAL, TapePartitionHeader::identifier, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, TapePartitionHashEntry::key, TapePartitionEntry::Number, IndexEntry::offset, TapePartitionHashEntry::partitionEntry, aaruformat_context::tape_partitions, TapePartitionBlock, and TRACE.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ process_tracks_block()

+ +
+
+ + + + + + + + + + + +
void process_tracks_block (aaruformat_context * ctx,
const IndexEntry * entry )
+
+ +

Parse and integrate a Tracks block from the image stream into the context.

+

This function seeks to the byte offset specified by the supplied entry, reads a TracksHeader followed by the declared number of TrackEntry records, validates the block through its CRC64, and populates multiple fields in the provided ctx:

+
    +
  • ctx->tracksHeader (identifier, entries, crc64)
  • +
  • ctx->trackEntries (raw array with ALL tracks in on-disk order)
  • +
  • ctx->dataTracks (array filtered to data track sequences in [1..99])
  • +
  • ctx->numberOfDataTracks
  • +
  • ctx->imageInfo.ImageSize (incremented by sizeof(TrackEntry) * entries)
  • +
  • ctx->imageInfo.HasPartitions / HasSessions (both set true unconditionally on success path before filtering)
  • +
+

It also performs a legacy endian correction of the computed CRC for images whose major version is <= AARUF_VERSION_V1 (historical writer quirk).

+

The function is intended for internal library use during image opening / indexing and is NOT part of the stable public API (no versioning guarantees). Callers outside the library should use the higher-level image open helpers that trigger this parsing implicitly.

+

Error & early-return behavior (no exception mechanism, all via logging + early return):

    +
  • NULL ctx or NULL ctx->imageStream: Logs FATAL and returns immediately; context left untouched.
  • +
  • Seek failure: FATAL + return; context left untouched.
  • +
  • TracksHeader read short: tracksHeader zeroed, TRACE logged, return.
  • +
  • Identifier mismatch: tracksHeader zeroed, TRACE logged, return.
  • +
  • Allocation failure for trackEntries: tracksHeader zeroed, FATAL logged, return.
  • +
  • Short read of TrackEntry array: tracksHeader zeroed, allocated trackEntries freed, FATAL logged, return.
  • +
  • CRC mismatch: TRACE logged and return; (NOTE: at this point trackEntries remain allocated and tracksHeader retains the just-read values, but caller receives no explicit status.)
  • +
+

Memory management:

    +
  • Allocates ctx->trackEntries with malloc() sized to entries * sizeof(TrackEntry).
  • +
  • Allocates ctx->dataTracks only if at least one filtered data track is found; otherwise sets it to NULL.
  • +
  • On certain failure paths (short reads) allocated memory is freed; on CRC mismatch memory is kept.
  • +
  • Pre-existing ctx->trackEntries or ctx->dataTracks are NOT freed before overwriting pointers, so repeated calls without prior cleanup will leak memory. The function is therefore expected to be called exactly once per context lifetime. This constraint should be observed by library code.
  • +
+

Filtering rule for ctx->dataTracks:

    +
  • Any TrackEntry with sequence in inclusive range [1, 99] is considered a data track (historical convention in format) and copied into ctx->dataTracks preserving original order.
  • +
+

Thread safety:

    +
  • Not thread-safe: mutates shared state in ctx without synchronization.
  • +
  • Must not be called concurrently with readers/writers referencing the same context.
  • +
+

Preconditions (

Precondition
):
    +
  • ctx != NULL
  • +
  • ctx->imageStream is a valid FILE* opened for reading at least up to the block region.
  • +
  • entry != NULL and entry->offset points to the start of a well-formed Tracks block.
  • +
+
+

Postconditions (

Postcondition
) on success (CRC valid):
    +
  • ctx->tracksHeader.identifier == TracksBlock
  • +
  • ctx->tracksHeader.entries > 0 implies ctx->trackEntries != NULL
  • +
  • ctx->dataTracks != NULL iff numberOfDataTracks > 0
  • +
  • numberOfDataTracks <= tracksHeader.entries
  • +
  • imageInfo flags (HasPartitions, HasSessions) set true
  • +
+
+

Limitations / Caveats:

    +
  • No explicit status code: callers infer success by inspecting ctx->tracksHeader.entries and presence of ctx->trackEntries after invocation.
  • +
  • In case of CRC mismatch trackEntries are retained though not guaranteed trustworthy; caller may wish to discard them or trigger re-read.
  • +
  • Potential memory leak if invoked multiple times without freeing previous arrays.
  • +
+

Logging strategy:

    +
  • FATAL used for unrecoverable structural or resource errors.
  • +
  • TRACE used for informational / soft failures (e.g., CRC mismatch, identifier mismatch, short read).
  • +
+
Parameters
+ + + +
ctxMutable pointer to an aaruformatContext receiving parsed track metadata.
entryPointer to the index entry describing this Tracks block (offset required; size not strictly used beyond informational logging and sequential reading).
+
+
+
Returns
void This function does not return a status code; errors are reported via logging side effects.
+
Warning
Not idempotent and not leak-safe if called more than once for a context.
+
+Absence of a returned status requires defensive post-call validation by the caller.
+
+CRC mismatch leaves possibly invalid data in ctx->trackEntries.
+
See also
aaruf_get_tracks()
+
+aaruf_set_tracks()
+ +

Definition at line 111 of file optical.c.

+ +

References aaruf_crc64_data(), AARUF_VERSION_V1, bswap_64, TracksHeader::crc64, aaruformat_context::data_tracks, TracksHeader::entries, FATAL, ImageInfo::HasPartitions, ImageInfo::HasSessions, aaruformat_context::header, TracksHeader::identifier, aaruformat_context::image_info, AaruHeaderV2::imageMajorVersion, ImageInfo::ImageSize, aaruformat_context::imageStream, aaruformat_context::number_of_data_tracks, IndexEntry::offset, TrackEntry::sequence, TRACE, aaruformat_context::track_entries, aaruformat_context::tracks_header, and TracksBlock.

+ +

Referenced by aaruf_open().

+ +
+
+ +

◆ set_ddt_entry_v2()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool set_ddt_entry_v2 (aaruformat_context * ctx,
const uint64_t sector_address,
bool negative,
const uint64_t offset,
const uint64_t block_offset,
const uint8_t sector_status,
uint64_t * ddt_entry )
+
+ +

Sets a DDT v2 entry for a given sector address.

+

Updates the DDT v2 table(s) with the specified offset, block offset, and sector status for a sector.

+
Parameters
+ + + + + + + + +
ctxPointer to the aaruformat context.
sector_addressLogical sector address to set.
negativeIndicates if the sector address is negative.
offsetOffset to set for the sector.
block_offsetBlock offset to set for the sector.
sector_statusStatus to set for the sector.
ddt_entryExisting DDT entry or 0 to create a new one. If 0, a new entry is returned.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + +
trueif the entry was set successfully, false otherwise.
+
+
+ +

Definition at line 988 of file ddt_v2.c.

+ +

References FATAL, aaruformat_context::imageStream, set_ddt_multi_level_v2(), set_ddt_single_level_v2(), DdtHeader2::tableShift, TRACE, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by aaruf_write_sector().

+ +
+
+ +

◆ set_ddt_multi_level_v2()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool set_ddt_multi_level_v2 (aaruformat_context * ctx,
uint64_t sector_address,
bool negative,
uint64_t offset,
uint64_t block_offset,
uint8_t sector_status,
uint64_t * ddt_entry )
+
+ +

Sets a multi-level DDT v2 entry for a given sector address.

+

Used when the DDT table uses multi-level indirection (tableShift > 0).

+
Parameters
+ + + + + + + + +
ctxPointer to the aaruformat context.
sector_addressLogical sector address to set.
negativeIndicates if the sector address is negative.
offsetOffset to set for the sector.
block_offsetBlock offset to set for the sector.
sector_statusStatus to set for the sector.
ddt_entryExisting DDT entry or 0 to create a new one. If 0, a new entry is returned.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + +
trueif the entry was set successfully, false otherwise.
+
+
+ +

Definition at line 1092 of file ddt_v2.c.

+ +

References aaruf_close_current_block(), aaruf_crc64_data(), aaruf_crc64_final(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_NOT_ENOUGH_MEMORY, aaruf_lzma_encode_buffer(), DdtHeader2::blockAlignmentShift, DdtHeader2::blocks, IndexEntry::blockType, aaruformat_context::cached_ddt_offset, aaruformat_context::cached_ddt_position, aaruformat_context::cached_secondary_ddt2, DdtHeader2::cmpCrc64, DdtHeader2::cmpLength, DdtHeader2::compression, aaruformat_context::compression_enabled, DdtHeader2::crc64, DdtHeader2::dataShift, IndexEntry::dataType, DeDuplicationTable2, DeDuplicationTableSecondary, DdtHeader2::entries, FATAL, DdtHeader2::identifier, aaruformat_context::imageStream, aaruformat_context::index_entries, DdtHeader2::length, DdtHeader2::levels, Lzma, aaruformat_context::lzma_dict_size, LZMA_PROPERTIES_LENGTH, DdtHeader2::negative, aaruformat_context::next_block_position, None, IndexEntry::offset, DdtHeader2::overflow, DdtHeader2::previousLevelOffset, aaruformat_context::primary_ddt_offset, DdtHeader2::start, DdtHeader2::tableLevel, DdtHeader2::tableShift, TRACE, DdtHeader2::type, aaruformat_context::user_data_ddt2, aaruformat_context::user_data_ddt_header, UserData, and aaruformat_context::writing_buffer.

+ +

Referenced by set_ddt_entry_v2().

+ +
+
+ +

◆ set_ddt_single_level_v2()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool set_ddt_single_level_v2 (aaruformat_context * ctx,
uint64_t sector_address,
const bool negative,
const uint64_t offset,
const uint64_t block_offset,
const uint8_t sector_status,
uint64_t * ddt_entry )
+
+ +

Sets a single-level DDT v2 entry for a given sector address.

+

Used when the DDT table does not use multi-level indirection.

+
Parameters
+ + + + + + + + +
ctxPointer to the aaruformat context.
sector_addressLogical sector address to set.
negativeIndicates if the sector address is negative.
offsetOffset to set for the sector.
block_offsetBlock offset to set for the sector.
sector_statusStatus to set for the sector.
ddt_entryExisting DDT entry or 0 to create a new one. If 0, a new entry is returned.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + +
trueif the entry was set successfully, false otherwise.
+
+
+ +

Definition at line 1023 of file ddt_v2.c.

+ +

References DdtHeader2::blockAlignmentShift, DdtHeader2::dataShift, FATAL, aaruformat_context::imageStream, DdtHeader2::negative, DdtHeader2::tableShift, TRACE, aaruformat_context::user_data_ddt2, and aaruformat_context::user_data_ddt_header.

+ +

Referenced by set_ddt_entry_v2().

+ +
+
+ +

◆ set_ddt_tape()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
bool set_ddt_tape (aaruformat_context * ctx,
uint64_t sector_address,
const uint64_t offset,
const uint64_t block_offset,
const uint8_t sector_status,
uint64_t * ddt_entry )
+
+ +

Sets a DDT entry for tape media using a hash-based lookup table.

+

This function is specifically designed for tape media images where sectors are accessed non-sequentially and the traditional DDT array structure is inefficient. Instead of using a large contiguous array, it uses a hash table (UTHASH) to store only the sectors that have been written, providing sparse storage for tape media.

+

The function performs the following operations:

    +
  1. Validates the context and verifies it's a tape image
  2. +
  3. Constructs a DDT entry encoding offset, block alignment, and sector status
  4. +
  5. Creates a hash table entry with the sector address as the key
  6. +
  7. Inserts or replaces the entry in the tape DDT hash table
  8. +
+

DDT Entry Format: The DDT entry is a 64-bit value with the following bit layout:

Bits 0-(dataShift-1): Sector offset within block (masked by dataShift)
+
Bits dataShift-27: Block index (block_offset >> blockAlignmentShift)
+
Bits 28-31: Sector status (4 bits for status flags)
+
Bits 32-63: Unused (reserved for future use)
+

Hash Table Management: Uses HASH_REPLACE macro from UTHASH library which:

    +
  • Adds new entries if the key (sector_address) doesn't exist
  • +
  • Replaces existing entries if the key is found (automatically frees old entry)
  • +
  • Maintains O(1) average lookup time for sector address resolution
  • +
+

Overflow Detection: The function checks if the constructed DDT entry exceeds 28 bits (0xFFFFFFF). This limit ensures the sector status can fit in the upper 4 bits while leaving room for future extensions in the upper 32 bits.

+
Parameters
+ + + + + + + +
ctxPointer to the aaruformat context. Must not be NULL. The context must have a valid imageStream and is_tape must be true. The ctx->tapeDdt hash table will be updated with the new entry. The ctx->userDataDdtHeader contains alignment and shift parameters.
sector_addressLogical sector address on the tape to set. This serves as the unique key in the hash table. Multiple calls with the same sector_address will replace the previous entry.
offsetByte offset within the aligned block where the sector data begins. This value is masked by (1 << dataShift) - 1 to extract only the lower bits representing the offset within the block.
block_offsetAbsolute byte offset in the image file where the data block starts. This is right-shifted by blockAlignmentShift to get the block index, which is stored in the DDT entry's middle bits.
sector_statusStatus flags for the sector (4 bits). Common values include:
    +
  • 0x0 (SectorStatusNotDumped): Sector not yet acquired during image dumping
  • +
  • 0x1 (SectorStatusDumped): Sector successfully dumped without error
  • +
  • 0x2 (SectorStatusErrored): Error during dumping; data may be incomplete or corrupt
  • +
  • 0x3 (SectorStatusMode1Correct): Valid MODE 1 data with regenerable suffix/prefix
  • +
  • 0x4 (SectorStatusMode2Form1Ok): Suffix verified/regenerable for MODE 2 Form 1
  • +
  • 0x5 (SectorStatusMode2Form2Ok): Suffix matches MODE 2 Form 2 with valid CRC
  • +
  • 0x6 (SectorStatusMode2Form2NoCrc): Suffix matches MODE 2 Form 2 but CRC empty/missing
  • +
  • 0x7 (SectorStatusTwin): Pointer references a twin sector table
  • +
  • 0x8 (SectorStatusUnrecorded): Sector physically unrecorded; repeated reads non-deterministic
  • +
  • 0x9 (SectorStatusEncrypted): Content encrypted and stored encrypted in image
  • +
  • 0xA (SectorStatusUnencrypted): Content originally encrypted but stored decrypted in image See SectorStatus enum for complete list of defined values
  • +
+
ddt_entryPointer to a 64-bit value that will receive the constructed DDT entry.
    +
  • If *ddt_entry is 0: A new entry is constructed from the provided parameters
  • +
  • If *ddt_entry is non-zero: The existing value is used directly The constructed or provided value is stored in the hash table.
  • +
+
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + +
trueSuccessfully created and inserted the DDT entry. This occurs when:
    +
  • The context and image stream are valid
  • +
  • The image is confirmed to be a tape image (is_tape == true)
  • +
  • The DDT entry fits within the 28-bit limit (< 0xFFFFFFF)
  • +
  • Memory allocation for the hash entry succeeds
  • +
  • The entry is successfully inserted or replaced in the hash table
  • +
+
falseFailed to set the DDT entry. This can happen when:
    +
  • ctx is NULL or ctx->imageStream is NULL (invalid context)
  • +
  • ctx->is_tape is false (wrong function called for non-tape media)
  • +
  • The DDT entry exceeds 0xFFFFFFF (media too large for big DDT)
  • +
  • Memory allocation fails for the new hash table entry (out of memory)
  • +
+
+
+
+
Note
This function is only for tape images. For disk images, use set_ddt_single_level_v2() or set_ddt_multi_level_v2() instead, which use array-based DDT structures.
+
+Memory Management:
    +
  • Allocates a new TapeDdtHashEntry for each sector
  • +
  • HASH_REPLACE automatically frees replaced entries
  • +
  • All hash entries remain in context until cleanup
  • +
  • The tapeDdt hash table must be freed during context destruction
  • +
+
+
+Tape Media Characteristics:
    +
  • Tape sectors are typically accessed sequentially during streaming
  • +
  • File marks and partition boundaries create sparse address spaces
  • +
  • Hash table provides efficient storage for sparse sector maps
  • +
  • Supports variable block sizes common in tape formats
  • +
+
+
+Error Handling:
    +
  • All errors are logged with FATAL level messages
  • +
  • Function returns false immediately on any error condition
  • +
  • TRACE logging marks entry/exit points for debugging
  • +
  • No partial state changes occur on failure
  • +
+
+
Warning
The DDT entry overflow check at 0xFFFFFFF (28 bits) is critical. Exceeding this limit indicates the media is too large to fit in the current DDT format, and continuing would cause data corruption.
+
+This function modifies the shared tapeDdt hash table. In multi-threaded environments, external synchronization is required to prevent race conditions.
+
See also
TapeDdtHashEntry for the hash table entry structure
+
+set_ddt_entry_v2() for the main DDT entry point that dispatches to this function
+
+get_ddt_tape() for retrieving tape DDT entries from the hash table
+ +

Definition at line 1768 of file ddt_v2.c.

+ +

References DdtHeader2::blockAlignmentShift, DdtHeader2::dataShift, FATAL, aaruformat_context::imageStream, aaruformat_context::is_tape, TapeDdtHashEntry::key, aaruformat_context::tape_ddt, TRACE, aaruformat_context::user_data_ddt_header, and TapeDdtHashEntry::value.

+ +
+
+ +

◆ verify_index_v1()

+ +
+
+ + + + + + + +
int32_t verify_index_v1 (aaruformat_context * ctx)
+
+ +

Verifies the integrity of an index block (version 1) in the image stream.

+

Checks the CRC64 of the index block without decompressing it. This function performs comprehensive validation of the index structure including header validation, data integrity verification, and version-specific CRC calculation. It ensures the index block is valid and uncorrupted before the image can be safely used for data access.

+
Parameters
+ + +
ctxPointer to the aaruformat context containing image stream and header information.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + +
AARUF_STATUS_OK(0) Successfully verified index integrity. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The index header is successfully read from ctx->header.indexOffset
  • +
  • The index identifier matches IndexBlock (version 1 format)
  • +
  • Memory allocation for index entries succeeds
  • +
  • All index entries are successfully read from the image stream
  • +
  • CRC64 calculation completes successfully with version-specific endianness handling
  • +
  • The calculated CRC64 matches the expected CRC64 in the index header
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) Invalid context or stream. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
+
AARUF_ERROR_CANNOT_READ_HEADER(-6) Index header reading failed. This occurs when:
    +
  • Cannot read the complete IndexHeader structure from the image stream
  • +
  • File I/O errors prevent accessing the header at ctx->header.indexOffset
  • +
  • Insufficient data available at the specified index offset
  • +
+
AARUF_ERROR_CANNOT_READ_INDEX(-19) Index format or data access errors. This occurs when:
    +
  • The index identifier doesn't match IndexBlock (wrong format or corruption)
  • +
  • Cannot read all index entries from the image stream
  • +
  • File I/O errors during index entry reading
  • +
  • Index structure is corrupted or truncated
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Cannot allocate memory for the index entries array
  • +
  • System memory exhaustion prevents loading index data for verification
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-18) CRC64 validation failed. This occurs when:
    +
  • The calculated CRC64 doesn't match the expected CRC64 in the index header
  • +
  • Index data corruption is detected
  • +
  • Data integrity verification fails indicating potential file damage
  • +
+
+
+
+
Note
CRC64 Validation Process:
    +
  • Reads all index entries into memory for CRC calculation
  • +
  • Calculates CRC64 over the complete index entries array
  • +
  • Applies version-specific endianness conversion for compatibility
  • +
  • For imageMajorVersion <= AARUF_VERSION_V1: Uses bswap_64() for byte order correction
  • +
  • Compares calculated CRC64 with the value stored in the index header
  • +
+
+
+Version Compatibility:
    +
  • Handles legacy byte order differences from original C# implementation
  • +
  • Supports IndexBlock format (version 1 only)
  • +
  • Does not support IndexBlock2 or IndexBlock3 formats
  • +
+
+
+Memory Management:
    +
  • Allocates temporary memory for index entries during verification
  • +
  • Automatically frees allocated memory on both success and error conditions
  • +
  • Memory usage is proportional to the number of index entries
  • +
+
+
+Verification Scope:
    +
  • Validates index header structure and identifier
  • +
  • Verifies data integrity through CRC64 calculation
  • +
  • Does not validate individual index entry contents or block references
  • +
  • Does not check for logical consistency of referenced blocks
  • +
+
+
Warning
This function reads the entire index into memory for CRC calculation. Large indexes may require significant memory allocation.
+
+The function assumes ctx->header.indexOffset points to a valid index location. Invalid offsets will cause file access errors or incorrect validation.
+
+CRC validation failure indicates potential data corruption and may suggest the image file is damaged or has been modified outside of library control.
+ +

Definition at line 225 of file index_v1.c.

+ +

References aaruf_crc64_data(), AARUF_ERROR_CANNOT_READ_HEADER, AARUF_ERROR_CANNOT_READ_INDEX, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_STATUS_OK, AARUF_VERSION_V1, bswap_64, IndexHeader::crc64, IndexHeader::entries, FATAL, aaruformat_context::header, IndexHeader::identifier, AaruHeaderV2::imageMajorVersion, aaruformat_context::imageStream, IndexBlock, AaruHeaderV2::indexOffset, and TRACE.

+ +

Referenced by aaruf_verify_image().

+ +
+
+ +

◆ verify_index_v2()

+ +
+
+ + + + + + + +
int32_t verify_index_v2 (aaruformat_context * ctx)
+
+ +

Verifies the integrity of an index block (version 2) in the image stream.

+

Checks the CRC64 of the index block without decompressing it. This function performs comprehensive validation of the version 2 index structure including header validation, data integrity verification, and version-specific CRC calculation. It ensures the index block is valid and uncorrupted before the image can be safely used for data access.

+
Parameters
+ + +
ctxPointer to the aaruformat context containing image stream and header information.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + +
AARUF_STATUS_OK(0) Successfully verified index integrity. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The index header is successfully read from ctx->header.indexOffset
  • +
  • The index identifier matches IndexBlock2 (version 2 format)
  • +
  • Memory allocation for index entries succeeds
  • +
  • All index entries are successfully read from the image stream
  • +
  • CRC64 calculation completes successfully with version-specific endianness handling
  • +
  • The calculated CRC64 matches the expected CRC64 in the index header
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) Invalid context or stream. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
+
AARUF_ERROR_CANNOT_READ_HEADER(-6) Index header reading failed. This occurs when:
    +
  • Cannot read the complete IndexHeader2 structure from the image stream
  • +
  • File I/O errors prevent accessing the header at ctx->header.indexOffset
  • +
  • Insufficient data available at the specified index offset
  • +
+
AARUF_ERROR_CANNOT_READ_INDEX(-19) Index format or data access errors. This occurs when:
    +
  • The index identifier doesn't match IndexBlock2 (wrong format or corruption)
  • +
  • Cannot read all index entries from the image stream
  • +
  • File I/O errors during index entry reading
  • +
  • Index structure is corrupted or truncated
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Cannot allocate memory for the index entries array
  • +
  • System memory exhaustion prevents loading index data for verification
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-18) CRC64 validation failed. This occurs when:
    +
  • The calculated CRC64 doesn't match the expected CRC64 in the index header
  • +
  • Index data corruption is detected
  • +
  • Data integrity verification fails indicating potential file damage
  • +
+
+
+
+
Note
CRC64 Validation Process:
    +
  • Reads all index entries into memory for CRC calculation
  • +
  • Calculates CRC64 over the complete index entries array
  • +
  • Applies version-specific endianness conversion for compatibility
  • +
  • For imageMajorVersion <= AARUF_VERSION_V1: Uses bswap_64() for byte order correction
  • +
  • Compares calculated CRC64 with the value stored in the IndexHeader2
  • +
+
+
+Version 2 Enhancements:
    +
  • Uses IndexHeader2 structure with enhanced metadata support
  • +
  • Maintains compatibility with legacy endianness handling
  • +
  • Supports improved index entry organization compared to version 1
  • +
+
+
+Memory Management:
    +
  • Allocates temporary memory for index entries during verification
  • +
  • Automatically frees allocated memory on both success and error conditions
  • +
  • Memory usage is proportional to the number of index entries
  • +
+
+
+Verification Scope:
    +
  • Validates index header structure and identifier
  • +
  • Verifies data integrity through CRC64 calculation
  • +
  • Does not validate individual index entry contents or block references
  • +
  • Does not check for logical consistency of referenced blocks
  • +
+
+
Warning
This function reads the entire index into memory for CRC calculation. Large indexes may require significant memory allocation.
+
+The function assumes ctx->header.indexOffset points to a valid index location. Invalid offsets will cause file access errors or incorrect validation.
+
+CRC validation failure indicates potential data corruption and may suggest the image file is damaged or has been modified outside of library control.
+ +

Definition at line 227 of file index_v2.c.

+ +

References aaruf_crc64_final(), aaruf_crc64_free(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_READ_HEADER, AARUF_ERROR_CANNOT_READ_INDEX, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_STATUS_OK, AARUF_VERSION_V1, bswap_64, IndexHeader2::crc64, IndexHeader2::entries, FATAL, aaruformat_context::header, IndexHeader2::identifier, AaruHeaderV2::imageMajorVersion, aaruformat_context::imageStream, IndexBlock2, AaruHeaderV2::indexOffset, and TRACE.

+ +

Referenced by aaruf_verify_image().

+ +
+
+ +

◆ verify_index_v3()

+ +
+
+ + + + + + + +
int32_t verify_index_v3 (aaruformat_context * ctx)
+
+ +

Verifies the integrity of an index block (version 3) in the image stream.

+

Checks the CRC64 of the index block and all subindexes without decompressing them. This function performs comprehensive validation of the advanced version 3 index structure including header validation, data integrity verification, and version-specific CRC calculation. Note that this function validates only the main index block's CRC and does not recursively validate subindex CRCs, focusing on the primary index structure integrity.

+
Parameters
+ + +
ctxPointer to the aaruformat context containing image stream and header information.
+
+
+
Returns
Returns one of the following status codes:
+
Return values
+ + + + + + + +
AARUF_STATUS_OK(0) Successfully verified index integrity. This is returned when:
    +
  • The context and image stream are valid
  • +
  • The index header is successfully read from ctx->header.indexOffset
  • +
  • The index identifier matches IndexBlock3 (version 3 format)
  • +
  • Memory allocation for index entries succeeds
  • +
  • All index entries are successfully read from the image stream
  • +
  • CRC64 calculation completes successfully with version-specific endianness handling
  • +
  • The calculated CRC64 matches the expected CRC64 in the index header
  • +
+
AARUF_ERROR_NOT_AARUFORMAT(-1) Invalid context or stream. This occurs when:
    +
  • The context parameter is NULL
  • +
  • The image stream (ctx->imageStream) is NULL or invalid
  • +
+
AARUF_ERROR_CANNOT_READ_HEADER(-6) Index header reading failed. This occurs when:
    +
  • Cannot read the complete IndexHeader3 structure from the image stream
  • +
  • File I/O errors prevent accessing the header at ctx->header.indexOffset
  • +
  • Insufficient data available at the specified index offset
  • +
+
AARUF_ERROR_CANNOT_READ_INDEX(-19) Index format or data access errors. This occurs when:
    +
  • The index identifier doesn't match IndexBlock3 (wrong format or corruption)
  • +
  • Cannot read all index entries from the image stream
  • +
  • File I/O errors during index entry reading
  • +
  • Index structure is corrupted or truncated
  • +
+
AARUF_ERROR_NOT_ENOUGH_MEMORY(-9) Memory allocation failed. This occurs when:
    +
  • Cannot allocate memory for the index entries array
  • +
  • System memory exhaustion prevents loading index data for verification
  • +
+
AARUF_ERROR_INVALID_BLOCK_CRC(-18) CRC64 validation failed. This occurs when:
    +
  • The calculated CRC64 doesn't match the expected CRC64 in the index header
  • +
  • Index data corruption is detected
  • +
  • Data integrity verification fails indicating potential file damage
  • +
+
+
+
+
Note
CRC64 Validation Process:
    +
  • Reads all main index entries into memory for CRC calculation
  • +
  • Calculates CRC64 over the complete main index entries array
  • +
  • Applies version-specific endianness conversion for compatibility
  • +
  • For imageMajorVersion <= AARUF_VERSION_V1: Uses bswap_64() for byte order correction
  • +
  • Compares calculated CRC64 with the value stored in the IndexHeader3
  • +
+
+
+Version 3 Specific Features:
    +
  • Uses IndexHeader3 structure with hierarchical subindex support
  • +
  • Maintains compatibility with legacy endianness handling
  • +
  • Supports advanced index entry organization with subindex references
  • +
  • Only validates the main index block CRC - subindex CRCs are not recursively checked
  • +
+
+
+Validation Scope:
    +
  • Validates main index header structure and identifier
  • +
  • Verifies data integrity of the primary index entries through CRC64 calculation
  • +
  • Does not validate individual IndexEntry contents or block references
  • +
  • Does not check for logical consistency of referenced blocks
  • +
  • Does not recursively validate subindex blocks (unlike hierarchical processing)
  • +
+
+
+Memory Management:
    +
  • Allocates temporary memory for index entries during verification
  • +
  • Automatically frees allocated memory on both success and error conditions
  • +
  • Memory usage is proportional to the number of entries in the main index only
  • +
+
+
+Subindex Validation Limitation:
    +
  • This function does not recursively validate subindex CRCs
  • +
  • Each subindex block contains its own CRC that would need separate validation
  • +
  • For complete integrity verification, subindex blocks should be validated individually
  • +
  • The main index CRC only covers the primary index entries, not the subindex content
  • +
+
+
Warning
This function reads only the main index into memory for CRC calculation. Subindex blocks are not loaded or validated by this function.
+
+The function assumes ctx->header.indexOffset points to a valid index location. Invalid offsets will cause file access errors or incorrect validation.
+
+CRC validation failure indicates potential data corruption in the main index and may suggest the image file is damaged or has been modified outside of library control.
+
+For complete integrity verification of hierarchical indexes, additional validation of subindex blocks may be required beyond this function's scope.
+ +

Definition at line 408 of file index_v3.c.

+ +

References aaruf_crc64_final(), aaruf_crc64_free(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_READ_HEADER, AARUF_ERROR_CANNOT_READ_INDEX, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_STATUS_OK, AARUF_VERSION_V1, bswap_64, IndexHeader3::crc64, IndexHeader3::entries, FATAL, aaruformat_context::header, IndexHeader3::identifier, AaruHeaderV2::imageMajorVersion, aaruformat_context::imageStream, IndexBlock3, AaruHeaderV2::indexOffset, and TRACE.

+ +

Referenced by aaruf_verify_image().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/internal_8h.js b/docs/html/internal_8h.js new file mode 100644 index 0000000..6d5dd32 --- /dev/null +++ b/docs/html/internal_8h.js @@ -0,0 +1,33 @@ +var internal_8h = +[ + [ "aaruf_close_current_block", "internal_8h.html#a2402812f5e04ba16765208c0b70fa6c5", null ], + [ "compare_extents", "internal_8h.html#ac93ebc6d918745be56b680e19bf7e8d5", null ], + [ "decode_ddt_entry_v1", "internal_8h.html#a26e5fd58cdfd39948f1b724fafffcdc2", null ], + [ "decode_ddt_entry_v2", "internal_8h.html#a805d607b45bb8ad8a3e6b0bcfabe3265", null ], + [ "decode_ddt_multi_level_v2", "internal_8h.html#a83aff4d408ab17f8f350cb03b0e12ef6", null ], + [ "decode_ddt_single_level_v2", "internal_8h.html#a40c571bc4778040f22ac211cea670db1", null ], + [ "get_filetime_uint64", "internal_8h.html#a36c1cca0e4cea9c2e0dffb582b836f6f", null ], + [ "parse_options", "internal_8h.html#aaae42bff244df727b6c029f58d4957df", null ], + [ "process_aaru_metadata_json_block", "internal_8h.html#a84003ec881425a7b28ec24cb48d19f02", null ], + [ "process_checksum_block", "internal_8h.html#a565eace88f86c500249be1f2a89a1c60", null ], + [ "process_cicm_block", "internal_8h.html#a5e0397faed8aea27c5a6a3881875de54", null ], + [ "process_data_block", "internal_8h.html#a28d844a06cecbbf436d825a3c99ff0eb", null ], + [ "process_ddt_v1", "internal_8h.html#abaf38090f967423898b99e0455751c07", null ], + [ "process_ddt_v2", "internal_8h.html#a1caeae710ee5e1dd356e43b3b659e9c0", null ], + [ "process_dumphw_block", "internal_8h.html#a0e2cfc858c0551bc9bef11d5bdb85aac", null ], + [ "process_geometry_block", "internal_8h.html#a81d410de6727d95a85b827067e1a8bc6", null ], + [ "process_index_v1", "internal_8h.html#a5d3b1092abc36a27a441a01a8a0b3b48", null ], + [ "process_index_v2", "internal_8h.html#a1baad6508d1cde5a712794e956fb3d3c", null ], + [ "process_index_v3", "internal_8h.html#aff88fae9938d5f56318bfd7a455d5e94", null ], + [ "process_metadata_block", "internal_8h.html#a43974d4c183240be30d49ff09ef7b8c2", null ], + [ "process_tape_files_block", "internal_8h.html#a829bbac3c17b60efd8f93188a8de8278", null ], + [ "process_tape_partitions_block", "internal_8h.html#aa76718b0402b1a28be3d563d5e62028e", null ], + [ "process_tracks_block", "internal_8h.html#a375a516fdf6f81e997365d93b21f6708", null ], + [ "set_ddt_entry_v2", "internal_8h.html#a1906cbcaef9f44b8ac4360beb70a0120", null ], + [ "set_ddt_multi_level_v2", "internal_8h.html#a69ff2e68fe4d92a2d2d469ac69f41d82", null ], + [ "set_ddt_single_level_v2", "internal_8h.html#a7471ae33a70bae7e3aa93a52f8e519ca", null ], + [ "set_ddt_tape", "internal_8h.html#a8241636367dc185ee88d1dc5af9caf59", null ], + [ "verify_index_v1", "internal_8h.html#a89ed93d216c4dce0ae5e2acccf8cc2b4", null ], + [ "verify_index_v2", "internal_8h.html#ae234e22b16b085d18614110630034db5", null ], + [ "verify_index_v3", "internal_8h.html#ad7ed9250463c320c7bc8d83689bcfefb", null ] +]; \ No newline at end of file diff --git a/docs/html/internal_8h_source.html b/docs/html/internal_8h_source.html new file mode 100644 index 0000000..bfcd253 --- /dev/null +++ b/docs/html/internal_8h_source.html @@ -0,0 +1,202 @@ + + + + + + + +libaaruformat: include/internal.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
internal.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#ifndef LIBAARUFORMAT_INTERNAL_H
+
20#define LIBAARUFORMAT_INTERNAL_H
+
21
+
22#include "utarray.h"
+
23
+ + + + + + + +
31int32_t process_ddt_v1(aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt);
+
32int32_t process_ddt_v2(aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt);
+ + + +
36void process_cicm_block(aaruformat_context *ctx, const IndexEntry *entry);
+ + + + + +
42int32_t decode_ddt_entry_v1(aaruformat_context *ctx, uint64_t sector_address, uint64_t *offset, uint64_t *block_offset,
+
43 uint8_t *sector_status);
+
44int32_t decode_ddt_entry_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset,
+
45 uint64_t *block_offset, uint8_t *sector_status);
+
46int32_t decode_ddt_single_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset,
+
47 uint64_t *block_offset, uint8_t *sector_status);
+
48int32_t decode_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset,
+
49 uint64_t *block_offset, uint8_t *sector_status);
+
50bool set_ddt_entry_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset,
+
51 uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry);
+
52bool set_ddt_single_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset,
+
53 uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry);
+
54bool set_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset,
+
55 uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry);
+
56bool set_ddt_tape(aaruformat_context *ctx, uint64_t sector_address, uint64_t offset, uint64_t block_offset,
+
57 uint8_t sector_status, uint64_t *ddt_entry);
+
58aaru_options parse_options(const char *options);
+
59uint64_t get_filetime_uint64();
+ +
61int compare_extents(const void *a, const void *b);
+
62
+
63#endif // LIBAARUFORMAT_INTERNAL_H
+
void process_dumphw_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a dump hardware block from the image stream.
Definition dump.c:108
+
bool set_ddt_entry_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
Sets a DDT v2 entry for a given sector address.
Definition ddt_v2.c:988
+
UT_array * process_index_v2(aaruformat_context *ctx)
Processes an index block (version 2) from the image stream.
Definition index_v2.c:81
+
int32_t process_ddt_v2(aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt)
Processes a DDT v2 block from the image stream.
Definition ddt_v2.c:96
+
int32_t aaruf_close_current_block(aaruformat_context *ctx)
Finalizes and writes the current data block to the AaruFormat image file.
Definition write.c:1383
+
int32_t decode_ddt_entry_v1(aaruformat_context *ctx, uint64_t sector_address, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
Decodes a DDT v1 entry for a given sector address.
Definition ddt_v1.c:405
+
int32_t process_data_block(aaruformat_context *ctx, IndexEntry *entry)
Processes a data block from the image stream.
Definition data.c:71
+
uint64_t get_filetime_uint64()
Gets the current time as a 64-bit FILETIME value.
Definition time.c:45
+
void process_tracks_block(aaruformat_context *ctx, const IndexEntry *entry)
Parse and integrate a Tracks block from the image stream into the context.
Definition optical.c:111
+
int32_t decode_ddt_single_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
Decodes a single-level DDT v2 entry for a given sector address.
Definition ddt_v2.c:581
+
void process_metadata_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a metadata block from the image stream.
Definition metadata.c:35
+
void process_checksum_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a checksum block from the image stream.
Definition checksum.c:39
+
UT_array * process_index_v1(aaruformat_context *ctx)
Processes an index block (version 1) from the image stream.
Definition index_v1.c:79
+
void process_cicm_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a CICM XML metadata block from the image stream.
Definition metadata.c:306
+
bool set_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
Sets a multi-level DDT v2 entry for a given sector address.
Definition ddt_v2.c:1092
+
bool set_ddt_single_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
Sets a single-level DDT v2 entry for a given sector address.
Definition ddt_v2.c:1023
+
int32_t decode_ddt_entry_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
Decodes a DDT v2 entry for a given sector address.
Definition ddt_v2.c:507
+
void process_geometry_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a logical geometry block from the image stream.
Definition metadata.c:246
+
bool set_ddt_tape(aaruformat_context *ctx, uint64_t sector_address, uint64_t offset, uint64_t block_offset, uint8_t sector_status, uint64_t *ddt_entry)
Sets a DDT entry for tape media using a hash-based lookup table.
Definition ddt_v2.c:1768
+
void process_tape_files_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a tape file metadata block from the image stream.
Definition tape.c:126
+
int32_t decode_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bool negative, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status)
Decodes a multi-level DDT v2 entry for a given sector address.
Definition ddt_v2.c:724
+
void process_aaru_metadata_json_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes an Aaru metadata JSON block from the image stream during image opening.
Definition metadata.c:470
+
int32_t verify_index_v1(aaruformat_context *ctx)
Verifies the integrity of an index block (version 1) in the image stream.
Definition index_v1.c:225
+
void process_tape_partitions_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a tape partition metadata block from the image stream.
Definition tape.c:346
+
aaru_options parse_options(const char *options)
Parses the options string for AaruFormat image creation/opening.
Definition options.c:38
+
int32_t process_ddt_v1(aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt)
Processes a DDT v1 block from the image stream.
Definition ddt_v1.c:85
+
int compare_extents(const void *a, const void *b)
Comparison function for sorting DumpExtent arrays by start sector.
Definition helpers.c:451
+
int32_t verify_index_v3(aaruformat_context *ctx)
Verifies the integrity of an index block (version 3) in the image stream.
Definition index_v3.c:408
+
int32_t verify_index_v2(aaruformat_context *ctx)
Verifies the integrity of an index block (version 2) in the image stream.
Definition index_v2.c:227
+
UT_array * process_index_v3(aaruformat_context *ctx)
Processes an index block (version 3) from the image stream.
Definition index_v3.c:98
+
Single index entry describing a block's type, (optional) data classification, and file offset.
Definition index.h:109
+
Parsed user-specified tunables controlling compression, deduplication, hashing and DDT geometry.
Definition options.h:217
+
Master context representing an open or in‑creation Aaru image.
Definition context.h:172
+
+
+
+ + + + diff --git a/docs/html/jquery.js b/docs/html/jquery.js new file mode 100644 index 0000000..875ada7 --- /dev/null +++ b/docs/html/jquery.js @@ -0,0 +1,204 @@ +/*! jQuery v3.6.0 | (c) OpenJS Foundation and other contributors | jquery.org/license */ +!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType&&"function"!=typeof e.item},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e} +var f="3.6.0",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp( +"^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType +}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c +)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){ +return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e&&e.namespaceURI,n=e&&(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll( +":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id") +)&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push( +"\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test( +a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},j=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null, +null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne +).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||D,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,D=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for( +var e=0;e\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="",y.option=!!ce.lastChild;var ge={thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};function ve(e,t){var n; +return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n",""]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d\s*$/g;function je(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function De(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function qe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Le(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0, +r=s[i].length;n").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var _t,zt=[],Ut=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=zt.pop()||S.expando+"_"+wt.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Ut.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Ut.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Ut,"$1"+r):!1!==e.jsonp&&(e.url+=(Tt.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r] +,C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,zt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((_t=E.implementation.createHTMLDocument("").body).innerHTML="
",2===_t.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each( +function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):c.css(f)}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r, +"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=Fe(y.pixelPosition,function(e,t){if(t)return t=We(e,n),Pe.test(t)?S(e).position()[n]+"px":t})} +),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.each( +"blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,n){S.fn[n]=function(e,t){return 0",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=y(e||this.defaultElement||this)[0],this.element=y(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=y(),this.hoverable=y(),this.focusable=y(),this.classesElementLookup={},e!==this&&(y.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t +){t.target===e&&this.destroy()}}),this.document=y(e.style?e.ownerDocument:e.document||e),this.window=y(this.document[0].defaultView||this.document[0].parentWindow)),this.options=y.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:y.noop,_create:y.noop,_init:y.noop,destroy:function(){var i=this;this._destroy(),y.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:y.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return y.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t +]=y.widget.extend({},this.options[t]),n=0;n
"),i=e.children()[0];return y("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i}, +getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.widthx(D(s),D(n))?o.important="horizontal":o.important="vertical",p.using.call(this,t,o)}),h.offset(y.extend(l,{using:t}))})},y.ui.position={fit:{left:function(t,e){var i=e.within, +s=i.isWindow?i.scrollLeft:i.offset.left,n=i.width,o=t.left-e.collisionPosition.marginLeft,h=s-o,a=o+e.collisionWidth-n-s;e.collisionWidth>n?0n?0=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),y.ui.plugin={add:function(t,e,i){var s,n=y.ui[t].prototype;for(s in i)n.plugins[s]=n.plugins[s]||[],n.plugins[s].push([e,i[s]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;n").css({overflow:"hidden",position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})), +this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,t={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(t),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(t),this._proportionallyResize()),this._setupHandles(),e.autoHide&&y(this.element).on("mouseenter",function(){e.disabled||(i._removeClass("ui-resizable-autohide"),i._handles.show())}).on("mouseleave",function(){e.disabled||i.resizing||(i._addClass("ui-resizable-autohide"),i._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy(),this._addedHandles.remove();function t(t){y(t +).removeData("resizable").removeData("ui-resizable").off(".resizable")}var e;return this.elementIsWrapper&&(t(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),t(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;case"aspectRatio":this._aspectRatio=!!e}},_setupHandles:function(){var t,e,i,s,n,o=this.options,h=this;if(this.handles=o.handles||(y(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=y(),this._addedHandles=y(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),i=this.handles.split( +","),this.handles={},e=0;e"),this._addClass(n,"ui-resizable-handle "+s),n.css({zIndex:o.zIndex}),this.handles[t]=".ui-resizable-"+t,this.element.children(this.handles[t]).length||(this.element.append(n),this._addedHandles=this._addedHandles.add(n));this._renderAxis=function(t){var e,i,s;for(e in t=t||this.element,this.handles)this.handles[e].constructor===String?this.handles[e]=this.element.children(this.handles[e]).first().show():(this.handles[e].jquery||this.handles[e].nodeType)&&(this.handles[e]=y(this.handles[e]),this._on(this.handles[e],{mousedown:h._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(i=y(this.handles[e],this.element),s=/sw|ne|nw|se|n|s/.test(e)?i.outerHeight():i.outerWidth(),i=["padding",/ne|nw|n/.test(e)?"Top":/se|sw|s/.test(e)?"Bottom":/^e$/.test(e)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize()),this._handles=this._handles.add( +this.handles[e])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){h.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),h.axis=n&&n[1]?n[1]:"se")}),o.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._addedHandles.remove()},_mouseCapture:function(t){var e,i,s=!1;for(e in this.handles)(i=y(this.handles[e])[0])!==t.target&&!y.contains(i,t.target)||(s=!0);return!this.options.disabled&&s},_mouseStart:function(t){var e,i,s=this.options,n=this.element;return this.resizing=!0,this._renderProxy(),e=this._num(this.helper.css("left")),i=this._num(this.helper.css("top")),s.containment&&(e+=y(s.containment).scrollLeft()||0,i+=y(s.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:e,top:i},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{ +width:n.width(),height:n.height()},this.originalSize=this._helper?{width:n.outerWidth(),height:n.outerHeight()}:{width:n.width(),height:n.height()},this.sizeDiff={width:n.outerWidth()-n.width(),height:n.outerHeight()-n.height()},this.originalPosition={left:e,top:i},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof s.aspectRatio?s.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=y(".ui-resizable-"+this.axis).css("cursor"),y("body").css("cursor","auto"===s?this.axis+"-resize":s),this._addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var e=this.originalMousePosition,i=this.axis,s=t.pageX-e.left||0,e=t.pageY-e.top||0,i=this._change[i];return this._updatePrevProperties(),i&&(e=i.apply(this,[t,s,e]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(e=this._updateRatio(e,t)),e=this._respectSize(e,t),this._updateCache(e),this._propagate("resize",t),e=this._applyChanges(), +!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),y.isEmptyObject(e)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges())),!1},_mouseStop:function(t){this.resizing=!1;var e,i,s,n=this.options,o=this;return this._helper&&(s=(e=(i=this._proportionallyResizeElements).length&&/textarea/i.test(i[0].nodeName))&&this._hasScroll(i[0],"left")?0:o.sizeDiff.height,i=e?0:o.sizeDiff.width,e={width:o.helper.width()-i,height:o.helper.height()-s},i=parseFloat(o.element.css("left"))+(o.position.left-o.originalPosition.left)||null,s=parseFloat(o.element.css("top"))+(o.position.top-o.originalPosition.top)||null,n.animate||this.element.css(y.extend(e,{top:s,left:i})),o.helper.height(o.size.height),o.helper.width(o.size.width),this._helper&&!n.animate&&this._proportionallyResize()),y("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){ +this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s=this.options,n={minWidth:this._isNumber(s.minWidth)?s.minWidth:0,maxWidth:this._isNumber(s.maxWidth)?s.maxWidth:1/0,minHeight:this._isNumber(s.minHeight)?s.minHeight:0,maxHeight:this._isNumber(s.maxHeight)?s.maxHeight:1/0};(this._aspectRatio||t)&&(e=n.minHeight*this.aspectRatio,i=n.minWidth/this.aspectRatio,s=n.maxHeight*this.aspectRatio,t=n.maxWidth/this.aspectRatio,e>n.minWidth&&(n.minWidth=e),i>n.minHeight&&(n.minHeight=i),st.width,h=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,a=this.originalPosition.left+this.originalSize.width,r=this.originalPosition.top+this.originalSize.height +,l=/sw|nw|w/.test(i),i=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),h&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&l&&(t.left=a-e.minWidth),s&&l&&(t.left=a-e.maxWidth),h&&i&&(t.top=r-e.minHeight),n&&i&&(t.top=r-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];e<4;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;e").css({overflow:"hidden"}),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++e.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize;return{left:this.originalPosition.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize;return{top:this.originalPosition.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(t,e,i){return y.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},sw:function(t,e, +i){return y.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,e,i]))},ne:function(t,e,i){return y.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},nw:function(t,e,i){return y.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,e,i]))}},_propagate:function(t,e){y.ui.plugin.call(this,t,[e,this.ui()]),"resize"!==t&&this._trigger(t,e,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),y.ui.plugin.add("resizable","animate",{stop:function(e){var i=y(this).resizable("instance"),t=i.options,s=i._proportionallyResizeElements,n=s.length&&/textarea/i.test(s[0].nodeName),o=n&&i._hasScroll(s[0],"left")?0:i.sizeDiff.height,h=n?0:i.sizeDiff.width,n={width:i.size.width-h,height:i.size.height-o},h=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left +)||null,o=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(y.extend(n,o&&h?{top:o,left:h}:{}),{duration:t.animateDuration,easing:t.animateEasing,step:function(){var t={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};s&&s.length&&y(s[0]).css({width:t.width,height:t.height}),i._updateCache(t),i._propagate("resize",e)}})}}),y.ui.plugin.add("resizable","containment",{start:function(){var i,s,n=y(this).resizable("instance"),t=n.options,e=n.element,o=t.containment,h=o instanceof y?o.get(0):/parent/.test(o)?e.parent().get(0):o;h&&(n.containerElement=y(h),/document/.test(o)||o===document?(n.containerOffset={left:0,top:0},n.containerPosition={left:0,top:0},n.parentData={element:y(document),left:0,top:0,width:y(document).width(),height:y(document).height()||document.body.parentNode.scrollHeight}):(i=y(h),s=[],y(["Top","Right","Left","Bottom"]).each(function(t,e +){s[t]=n._num(i.css("padding"+e))}),n.containerOffset=i.offset(),n.containerPosition=i.position(),n.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},t=n.containerOffset,e=n.containerSize.height,o=n.containerSize.width,o=n._hasScroll(h,"left")?h.scrollWidth:o,e=n._hasScroll(h)?h.scrollHeight:e,n.parentData={element:h,left:t.left,top:t.top,width:o,height:e}))},resize:function(t){var e=y(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.position,o=e._aspectRatio||t.shiftKey,h={top:0,left:0},a=e.containerElement,t=!0;a[0]!==document&&/static/.test(a.css("position"))&&(h=s),n.left<(e._helper?s.left:0)&&(e.size.width=e.size.width+(e._helper?e.position.left-s.left:e.position.left-h.left),o&&(e.size.height=e.size.width/e.aspectRatio,t=!1),e.position.left=i.helper?s.left:0),n.top<(e._helper?s.top:0)&&(e.size.height=e.size.height+(e._helper?e.position.top-s.top:e.position.top),o&&(e.size.width=e.size.height*e.aspectRatio,t=!1),e.position.top=e._helper?s.top:0), +i=e.containerElement.get(0)===e.element.parent().get(0),n=/relative|absolute/.test(e.containerElement.css("position")),i&&n?(e.offset.left=e.parentData.left+e.position.left,e.offset.top=e.parentData.top+e.position.top):(e.offset.left=e.element.offset().left,e.offset.top=e.element.offset().top),n=Math.abs(e.sizeDiff.width+(e._helper?e.offset.left-h.left:e.offset.left-s.left)),s=Math.abs(e.sizeDiff.height+(e._helper?e.offset.top-h.top:e.offset.top-s.top)),n+e.size.width>=e.parentData.width&&(e.size.width=e.parentData.width-n,o&&(e.size.height=e.size.width/e.aspectRatio,t=!1)),s+e.size.height>=e.parentData.height&&(e.size.height=e.parentData.height-s,o&&(e.size.width=e.size.height*e.aspectRatio,t=!1)),t||(e.position.left=e.prevPosition.left,e.position.top=e.prevPosition.top,e.size.width=e.prevSize.width,e.size.height=e.prevSize.height)},stop:function(){var t=y(this).resizable("instance"),e=t.options,i=t.containerOffset,s=t.containerPosition,n=t.containerElement,o=y(t.helper),h=o.offset(),a=o.outerWidth( +)-t.sizeDiff.width,o=o.outerHeight()-t.sizeDiff.height;t._helper&&!e.animate&&/relative/.test(n.css("position"))&&y(this).css({left:h.left-s.left-i.left,width:a,height:o}),t._helper&&!e.animate&&/static/.test(n.css("position"))&&y(this).css({left:h.left-s.left-i.left,width:a,height:o})}}),y.ui.plugin.add("resizable","alsoResize",{start:function(){var t=y(this).resizable("instance").options;y(t.alsoResize).each(function(){var t=y(this);t.data("ui-resizable-alsoresize",{width:parseFloat(t.width()),height:parseFloat(t.height()),left:parseFloat(t.css("left")),top:parseFloat(t.css("top"))})})},resize:function(t,i){var e=y(this).resizable("instance"),s=e.options,n=e.originalSize,o=e.originalPosition,h={height:e.size.height-n.height||0,width:e.size.width-n.width||0,top:e.position.top-o.top||0,left:e.position.left-o.left||0};y(s.alsoResize).each(function(){var t=y(this),s=y(this).data("ui-resizable-alsoresize"),n={},e=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];y.each(e, +function(t,e){var i=(s[e]||0)+(h[e]||0);i&&0<=i&&(n[e]=i||null)}),t.css(n)})},stop:function(){y(this).removeData("ui-resizable-alsoresize")}}),y.ui.plugin.add("resizable","ghost",{start:function(){var t=y(this).resizable("instance"),e=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}),t._addClass(t.ghost,"ui-resizable-ghost"),!1!==y.uiBackCompat&&"string"==typeof t.options.ghost&&t.ghost.addClass(this.options.ghost),t.ghost.appendTo(t.helper)},resize:function(){var t=y(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=y(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),y.ui.plugin.add("resizable","grid",{resize:function(){var t,e=y(this).resizable("instance"),i=e.options,s=e.size,n=e.originalSize,o=e.originalPosition,h=e.axis,a="number"==typeof i.grid?[i.grid,i.grid]:i.grid,r=a[0 +]||1,l=a[1]||1,u=Math.round((s.width-n.width)/r)*r,p=Math.round((s.height-n.height)/l)*l,d=n.width+u,c=n.height+p,f=i.maxWidth&&i.maxWidthd,s=i.minHeight&&i.minHeight>c;i.grid=a,m&&(d+=r),s&&(c+=l),f&&(d-=r),g&&(c-=l),/^(se|s|e)$/.test(h)?(e.size.width=d,e.size.height=c):/^(ne)$/.test(h)?(e.size.width=d,e.size.height=c,e.position.top=o.top-p):/^(sw)$/.test(h)?(e.size.width=d,e.size.height=c,e.position.left=o.left-u):((c-l<=0||d-r<=0)&&(t=e._getPaddingPlusBorderDimensions(this)),0=f[g]?0:Math.min(f[g],n));!a&&1-1){ +targetElements.on(evt+EVENT_NAMESPACE,function elementToggle(event){$.powerTip.toggle(this,event)})}else{targetElements.on(evt+EVENT_NAMESPACE,function elementOpen(event){$.powerTip.show(this,event)})}});$.each(options.closeEvents,function(idx,evt){if($.inArray(evt,options.openEvents)<0){targetElements.on(evt+EVENT_NAMESPACE,function elementClose(event){$.powerTip.hide(this,!isMouseEvent(event))})}});targetElements.on("keydown"+EVENT_NAMESPACE,function elementKeyDown(event){if(event.keyCode===27){$.powerTip.hide(this,true)}})}return targetElements};$.fn.powerTip.defaults={fadeInTime:200,fadeOutTime:100,followMouse:false,popupId:"powerTip",popupClass:null,intentSensitivity:7,intentPollInterval:100,closeDelay:100,placement:"n",smartPlacement:false,offset:10,mouseOnToPopup:false,manual:false,openEvents:["mouseenter","focus"],closeEvents:["mouseleave","blur"]};$.fn.powerTip.smartPlacementLists={n:["n","ne","nw","s"],e:["e","ne","se","w","nw","sw","n","s","e"],s:["s","se","sw","n"],w:["w","nw","sw","e","ne","se", +"n","s","w"],nw:["nw","w","sw","n","s","se","nw"],ne:["ne","e","se","n","s","sw","ne"],sw:["sw","w","nw","s","n","ne","sw"],se:["se","e","ne","s","n","nw","se"],"nw-alt":["nw-alt","n","ne-alt","sw-alt","s","se-alt","w","e"],"ne-alt":["ne-alt","n","nw-alt","se-alt","s","sw-alt","e","w"],"sw-alt":["sw-alt","s","se-alt","nw-alt","n","ne-alt","w","e"],"se-alt":["se-alt","s","sw-alt","ne-alt","n","nw-alt","e","w"]};$.powerTip={show:function apiShowTip(element,event){if(isMouseEvent(event)){trackMouse(event);session.previousX=event.pageX;session.previousY=event.pageY;$(element).data(DATA_DISPLAYCONTROLLER).show()}else{$(element).first().data(DATA_DISPLAYCONTROLLER).show(true,true)}return element},reposition:function apiResetPosition(element){$(element).first().data(DATA_DISPLAYCONTROLLER).resetPosition();return element},hide:function apiCloseTip(element,immediate){var displayController;immediate=element?immediate:true;if(element){displayController=$(element).first().data(DATA_DISPLAYCONTROLLER)}else if( +session.activeHover){displayController=session.activeHover.data(DATA_DISPLAYCONTROLLER)}if(displayController){displayController.hide(immediate)}return element},toggle:function apiToggle(element,event){if(session.activeHover&&session.activeHover.is(element)){$.powerTip.hide(element,!isMouseEvent(event))}else{$.powerTip.show(element,event)}return element}};$.powerTip.showTip=$.powerTip.show;$.powerTip.closeTip=$.powerTip.hide;function CSSCoordinates(){var me=this;me.top="auto";me.left="auto";me.right="auto";me.bottom="auto";me.set=function(property,value){if($.isNumeric(value)){me[property]=Math.round(value)}}}function DisplayController(element,options,tipController){var hoverTimer=null,myCloseDelay=null;function openTooltip(immediate,forceOpen){cancelTimer();if(!element.data(DATA_HASACTIVEHOVER)){if(!immediate){session.tipOpenImminent=true;hoverTimer=setTimeout(function intentDelay(){hoverTimer=null;checkForIntent()},options.intentPollInterval)}else{if(forceOpen){element.data(DATA_FORCEDOPEN,true)} +closeAnyDelayed();tipController.showTip(element)}}else{cancelClose()}}function closeTooltip(disableDelay){if(myCloseDelay){myCloseDelay=session.closeDelayTimeout=clearTimeout(myCloseDelay);session.delayInProgress=false}cancelTimer();session.tipOpenImminent=false;if(element.data(DATA_HASACTIVEHOVER)){element.data(DATA_FORCEDOPEN,false);if(!disableDelay){session.delayInProgress=true;session.closeDelayTimeout=setTimeout(function closeDelay(){session.closeDelayTimeout=null;tipController.hideTip(element);session.delayInProgress=false;myCloseDelay=null},options.closeDelay);myCloseDelay=session.closeDelayTimeout}else{tipController.hideTip(element)}}}function checkForIntent(){var xDifference=Math.abs(session.previousX-session.currentX),yDifference=Math.abs(session.previousY-session.currentY),totalDifference=xDifference+yDifference;if(totalDifference",{id:options.popupId});if($body.length===0){$body=$("body")}$body.append(tipElement);session.tooltips=session.tooltips?session.tooltips.add(tipElement):tipElement}if(options.followMouse){if(!tipElement.data(DATA_HASMOUSEMOVE)){$document.on("mousemove"+EVENT_NAMESPACE,positionTipOnCursor);$window.on("scroll"+EVENT_NAMESPACE,positionTipOnCursor);tipElement.data(DATA_HASMOUSEMOVE,true)}}function beginShowTip(element){element.data(DATA_HASACTIVEHOVER,true);tipElement.queue(function queueTipInit(next){showTip(element);next()})}function showTip(element){var tipContent;if(!element.data(DATA_HASACTIVEHOVER)){return}if( +session.isTipOpen){if(!session.isClosing){hideTip(session.activeHover)}tipElement.delay(100).queue(function queueTipAgain(next){showTip(element);next()});return}element.trigger("powerTipPreRender");tipContent=getTooltipContent(element);if(tipContent){tipElement.empty().append(tipContent)}else{return}element.trigger("powerTipRender");session.activeHover=element;session.isTipOpen=true;tipElement.data(DATA_MOUSEONTOTIP,options.mouseOnToPopup);tipElement.addClass(options.popupClass);if(!options.followMouse||element.data(DATA_FORCEDOPEN)){positionTipOnElement(element);session.isFixedTipOpen=true}else{positionTipOnCursor()}if(!element.data(DATA_FORCEDOPEN)&&!options.followMouse){$document.on("click"+EVENT_NAMESPACE,function documentClick(event){var target=event.target;if(target!==element[0]){if(options.mouseOnToPopup){if(target!==tipElement[0]&&!$.contains(tipElement[0],target)){$.powerTip.hide()}}else{$.powerTip.hide()}}})}if(options.mouseOnToPopup&&!options.manual){tipElement.on("mouseenter"+EVENT_NAMESPACE, +function tipMouseEnter(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).cancel()}});tipElement.on("mouseleave"+EVENT_NAMESPACE,function tipMouseLeave(){if(session.activeHover){session.activeHover.data(DATA_DISPLAYCONTROLLER).hide()}})}tipElement.fadeIn(options.fadeInTime,function fadeInCallback(){if(!session.desyncTimeout){session.desyncTimeout=setInterval(closeDesyncedTip,500)}element.trigger("powerTipOpen")})}function hideTip(element){session.isClosing=true;session.isTipOpen=false;session.desyncTimeout=clearInterval(session.desyncTimeout);element.data(DATA_HASACTIVEHOVER,false);element.data(DATA_FORCEDOPEN,false);$document.off("click"+EVENT_NAMESPACE);tipElement.off(EVENT_NAMESPACE);tipElement.fadeOut(options.fadeOutTime,function fadeOutCallback(){var coords=new CSSCoordinates;session.activeHover=null;session.isClosing=false;session.isFixedTipOpen=false;tipElement.removeClass();coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset); +tipElement.css(coords);element.trigger("powerTipClose")})}function positionTipOnCursor(){var tipWidth,tipHeight,coords,collisions,collisionCount;if(!session.isFixedTipOpen&&(session.isTipOpen||session.tipOpenImminent&&tipElement.data(DATA_HASMOUSEMOVE))){tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=new CSSCoordinates;coords.set("top",session.currentY+options.offset);coords.set("left",session.currentX+options.offset);collisions=getViewportCollisions(coords,tipWidth,tipHeight);if(collisions!==Collision.none){collisionCount=countFlags(collisions);if(collisionCount===1){if(collisions===Collision.right){coords.set("left",session.scrollLeft+session.windowWidth-tipWidth)}else if(collisions===Collision.bottom){coords.set("top",session.scrollTop+session.windowHeight-tipHeight)}}else{coords.set("left",session.currentX-tipWidth-options.offset);coords.set("top",session.currentY-tipHeight-options.offset)}}tipElement.css(coords)}}function positionTipOnElement(element){var priorityList, +finalPlacement;if(options.smartPlacement||options.followMouse&&element.data(DATA_FORCEDOPEN)){priorityList=$.fn.powerTip.smartPlacementLists[options.placement];$.each(priorityList,function(idx,pos){var collisions=getViewportCollisions(placeTooltip(element,pos),tipElement.outerWidth(),tipElement.outerHeight());finalPlacement=pos;return collisions!==Collision.none})}else{placeTooltip(element,options.placement);finalPlacement=options.placement}tipElement.removeClass("w nw sw e ne se n s w se-alt sw-alt ne-alt nw-alt");tipElement.addClass(finalPlacement)}function placeTooltip(element,placement){var iterationCount=0,tipWidth,tipHeight,coords=new CSSCoordinates;coords.set("top",0);coords.set("left",0);tipElement.css(coords);do{tipWidth=tipElement.outerWidth();tipHeight=tipElement.outerHeight();coords=placementCalculator.compute(element,placement,tipWidth,tipHeight,options.offset);tipElement.css(coords)}while(++iterationCount<=5&&(tipWidth!==tipElement.outerWidth()||tipHeight!==tipElement.outerHeight())); +return coords}function closeDesyncedTip(){var isDesynced=false,hasDesyncableCloseEvent=$.grep(["mouseleave","mouseout","blur","focusout"],function(eventType){return $.inArray(eventType,options.closeEvents)!==-1}).length>0;if(session.isTipOpen&&!session.isClosing&&!session.delayInProgress&&hasDesyncableCloseEvent){if(session.activeHover.data(DATA_HASACTIVEHOVER)===false||session.activeHover.is(":disabled")){isDesynced=true}else if(!isMouseOver(session.activeHover)&&!session.activeHover.is(":focus")&&!session.activeHover.data(DATA_FORCEDOPEN)){if(tipElement.data(DATA_MOUSEONTOTIP)){if(!isMouseOver(tipElement)){isDesynced=true}}else{isDesynced=true}}if(isDesynced){hideTip(session.activeHover)}}}this.showTip=beginShowTip;this.hideTip=hideTip;this.resetPosition=positionTipOnElement}function isSvgElement(element){return Boolean(window.SVGElement&&element[0]instanceof SVGElement)}function isMouseEvent(event){return Boolean(event&&$.inArray(event.type,MOUSE_EVENTS)>-1&&typeof event.pageX==="number")} +function initTracking(){if(!session.mouseTrackingActive){session.mouseTrackingActive=true;getViewportDimensions();$(getViewportDimensions);$document.on("mousemove"+EVENT_NAMESPACE,trackMouse);$window.on("resize"+EVENT_NAMESPACE,trackResize);$window.on("scroll"+EVENT_NAMESPACE,trackScroll)}}function getViewportDimensions(){session.scrollLeft=$window.scrollLeft();session.scrollTop=$window.scrollTop();session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackResize(){session.windowWidth=$window.width();session.windowHeight=$window.height()}function trackScroll(){var x=$window.scrollLeft(),y=$window.scrollTop();if(x!==session.scrollLeft){session.currentX+=x-session.scrollLeft;session.scrollLeft=x}if(y!==session.scrollTop){session.currentY+=y-session.scrollTop;session.scrollTop=y}}function trackMouse(event){session.currentX=event.pageX;session.currentY=event.pageY}function isMouseOver(element){var elementPosition=element.offset(),elementBox=element[0].getBoundingClientRect(), +elementWidth=elementBox.right-elementBox.left,elementHeight=elementBox.bottom-elementBox.top;return session.currentX>=elementPosition.left&&session.currentX<=elementPosition.left+elementWidth&&session.currentY>=elementPosition.top&&session.currentY<=elementPosition.top+elementHeight}function getTooltipContent(element){var tipText=element.data(DATA_POWERTIP),tipObject=element.data(DATA_POWERTIPJQ),tipTarget=element.data(DATA_POWERTIPTARGET),targetElement,content;if(tipText){if($.isFunction(tipText)){tipText=tipText.call(element[0])}content=tipText}else if(tipObject){if($.isFunction(tipObject)){tipObject=tipObject.call(element[0])}if(tipObject.length>0){content=tipObject.clone(true,true)}}else if(tipTarget){targetElement=$("#"+tipTarget);if(targetElement.length>0){content=targetElement.html()}}return content}function getViewportCollisions(coords,elementWidth,elementHeight){var viewportTop=session.scrollTop,viewportLeft=session.scrollLeft,viewportBottom=viewportTop+session.windowHeight, +viewportRight=viewportLeft+session.windowWidth,collisions=Collision.none;if(coords.topviewportBottom||Math.abs(coords.bottom-session.windowHeight)>viewportBottom){collisions|=Collision.bottom}if(coords.leftviewportRight){collisions|=Collision.left}if(coords.left+elementWidth>viewportRight||coords.right1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b, +"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery); +/*! SmartMenus jQuery Plugin - v1.1.0 - September 17, 2017 + * http://www.smartmenus.org/ + * Copyright Vasil Dinkov, Vadikom Web Ltd. http://vadikom.com; Licensed MIT */(function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&"object"==typeof module.exports?module.exports=t(require("jquery")):t(jQuery)})(function($){function initMouseDetection(t){var e=".smartmenus_mouse";if(mouseDetectionEnabled||t)mouseDetectionEnabled&&t&&($(document).off(e),mouseDetectionEnabled=!1);else{var i=!0,s=null,o={mousemove:function(t){var e={x:t.pageX,y:t.pageY,timeStamp:(new Date).getTime()};if(s){var o=Math.abs(s.x-e.x),a=Math.abs(s.y-e.y);if((o>0||a>0)&&2>=o&&2>=a&&300>=e.timeStamp-s.timeStamp&&(mouse=!0,i)){var n=$(t.target).closest("a");n.is("a")&&$.each(menuTrees,function(){return $.contains(this.$root[0],n[0])?(this.itemEnter({currentTarget:n[0]}),!1):void 0}),i=!1}}s=e}};o[touchEvents?"touchstart":"pointerover pointermove pointerout MSPointerOver MSPointerMove MSPointerOut"]=function(t){isTouchEvent(t.originalEvent)&&(mouse=!1)},$(document).on(getEventsNS(o,e)), +mouseDetectionEnabled=!0}}function isTouchEvent(t){return!/^(4|mouse)$/.test(t.pointerType)}function getEventsNS(t,e){e||(e="");var i={};for(var s in t)i[s.split(" ").join(e+" ")+e]=t[s];return i}var menuTrees=[],mouse=!1,touchEvents="ontouchstart"in window,mouseDetectionEnabled=!1,requestAnimationFrame=window.requestAnimationFrame||function(t){return setTimeout(t,1e3/60)},cancelAnimationFrame=window.cancelAnimationFrame||function(t){clearTimeout(t)},canAnimate=!!$.fn.animate;return $.SmartMenus=function(t,e){this.$root=$(t),this.opts=e,this.rootId="",this.accessIdPrefix="",this.$subArrow=null,this.activatedItems=[],this.visibleSubMenus=[],this.showTimeout=0,this.hideTimeout=0,this.scrollTimeout=0,this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.idInc=0,this.$firstLink=null,this.$firstSub=null,this.disabled=!1,this.$disableOverlay=null,this.$touchScrollingSub=null,this.cssTransforms3d="perspective"in t.style||"webkitPerspective"in t.style,this.wasCollapsible=!1,this.init()},$.extend( +$.SmartMenus,{hideAll:function(){$.each(menuTrees,function(){this.menuHideAll()})},destroy:function(){for(;menuTrees.length;)menuTrees[0].destroy();initMouseDetection(!0)},prototype:{init:function(t){var e=this;if(!t){menuTrees.push(this),this.rootId=((new Date).getTime()+Math.random()+"").replace(/\D/g,""),this.accessIdPrefix="sm-"+this.rootId+"-",this.$root.hasClass("sm-rtl")&&(this.opts.rightToLeftSubMenus=!0);var i=".smartmenus";this.$root.data("smartmenus",this).attr("data-smartmenus-id",this.rootId).dataSM("level",1).on(getEventsNS({"mouseover focusin":$.proxy(this.rootOver,this),"mouseout focusout":$.proxy(this.rootOut,this),keydown:$.proxy(this.rootKeyDown,this)},i)).on(getEventsNS({mouseenter:$.proxy(this.itemEnter,this),mouseleave:$.proxy(this.itemLeave,this),mousedown:$.proxy(this.itemDown,this),focus:$.proxy(this.itemFocus,this),blur:$.proxy(this.itemBlur,this),click:$.proxy(this.itemClick,this)},i),"a"),i+=this.rootId,this.opts.hideOnClick&&$(document).on(getEventsNS({touchstart:$.proxy( +this.docTouchStart,this),touchmove:$.proxy(this.docTouchMove,this),touchend:$.proxy(this.docTouchEnd,this),click:$.proxy(this.docClick,this)},i)),$(window).on(getEventsNS({"resize orientationchange":$.proxy(this.winResize,this)},i)),this.opts.subIndicators&&(this.$subArrow=$("").addClass("sub-arrow"),this.opts.subIndicatorsText&&this.$subArrow.html(this.opts.subIndicatorsText)),initMouseDetection()}if(this.$firstSub=this.$root.find("ul").each(function(){e.menuInit($(this))}).eq(0),this.$firstLink=this.$root.find("a").eq(0),this.opts.markCurrentItem){var s=/(index|default)\.[^#\?\/]*/i,o=/#.*/,a=window.location.href.replace(s,""),n=a.replace(o,"");this.$root.find("a").each(function(){var t=this.href.replace(s,""),i=$(this);(t==a||t==n)&&(i.addClass("current"),e.opts.markCurrentTree&&i.parentsUntil("[data-smartmenus-id]","ul").each(function(){$(this).dataSM("parent-a").addClass("current")}))})}this.wasCollapsible=this.isCollapsible()},destroy:function(t){if(!t){var e=".smartmenus";this.$root.removeData( +"smartmenus").removeAttr("data-smartmenus-id").removeDataSM("level").off(e),e+=this.rootId,$(document).off(e),$(window).off(e),this.opts.subIndicators&&(this.$subArrow=null)}this.menuHideAll();var i=this;this.$root.find("ul").each(function(){var t=$(this);t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.dataSM("shown-before")&&((i.opts.subMenusMinWidth||i.opts.subMenusMaxWidth)&&t.css({width:"",minWidth:"",maxWidth:""}).removeClass("sm-nowrap"),t.dataSM("scroll-arrows")&&t.dataSM("scroll-arrows").remove(),t.css({zIndex:"",top:"",left:"",marginLeft:"",marginTop:"",display:""})),0==(t.attr("id")||"").indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeDataSM("in-mega").removeDataSM("shown-before").removeDataSM("scroll-arrows").removeDataSM("parent-a").removeDataSM("level").removeDataSM("beforefirstshowfired").removeAttr("role").removeAttr("aria-hidden").removeAttr("aria-labelledby").removeAttr("aria-expanded"),this.$root.find("a.has-submenu").each(function(){var t=$(this);0==t.attr("id" +).indexOf(i.accessIdPrefix)&&t.removeAttr("id")}).removeClass("has-submenu").removeDataSM("sub").removeAttr("aria-haspopup").removeAttr("aria-controls").removeAttr("aria-expanded").closest("li").removeDataSM("sub"),this.opts.subIndicators&&this.$root.find("span.sub-arrow").remove(),this.opts.markCurrentItem&&this.$root.find("a.current").removeClass("current"),t||(this.$root=null,this.$firstLink=null,this.$firstSub=null,this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),menuTrees.splice($.inArray(this,menuTrees),1))},disable:function(t){if(!this.disabled){if(this.menuHideAll(),!t&&!this.opts.isPopup&&this.$root.is(":visible")){var e=this.$root.offset();this.$disableOverlay=$('
').css({position:"absolute",top:e.top,left:e.left,width:this.$root.outerWidth(),height:this.$root.outerHeight(),zIndex:this.getStartZIndex(!0),opacity:0}).appendTo(document.body)}this.disabled=!0}},docClick:function(t){return this.$touchScrollingSub?( +this.$touchScrollingSub=null,void 0):((this.visibleSubMenus.length&&!$.contains(this.$root[0],t.target)||$(t.target).closest("a").length)&&this.menuHideAll(),void 0)},docTouchEnd:function(){if(this.lastTouch){if(!(!this.visibleSubMenus.length||void 0!==this.lastTouch.x2&&this.lastTouch.x1!=this.lastTouch.x2||void 0!==this.lastTouch.y2&&this.lastTouch.y1!=this.lastTouch.y2||this.lastTouch.target&&$.contains(this.$root[0],this.lastTouch.target))){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var t=this;this.hideTimeout=setTimeout(function(){t.menuHideAll()},350)}this.lastTouch=null}},docTouchMove:function(t){if(this.lastTouch){var e=t.originalEvent.touches[0];this.lastTouch.x2=e.pageX,this.lastTouch.y2=e.pageY}},docTouchStart:function(t){var e=t.originalEvent.touches[0];this.lastTouch={x1:e.pageX,y1:e.pageY,target:e.target}},enable:function(){this.disabled&&(this.$disableOverlay&&(this.$disableOverlay.remove(),this.$disableOverlay=null),this.disabled=!1)},getClosestMenu:function(t){for( +var e=$(t).closest("ul");e.dataSM("in-mega");)e=e.parent().closest("ul");return e[0]||null},getHeight:function(t){return this.getOffset(t,!0)},getOffset:function(t,e){var i;"none"==t.css("display")&&(i={position:t[0].style.position,visibility:t[0].style.visibility},t.css({position:"absolute",visibility:"hidden"}).show());var s=t[0].getBoundingClientRect&&t[0].getBoundingClientRect(),o=s&&(e?s.height||s.bottom-s.top:s.width||s.right-s.left);return o||0===o||(o=e?t[0].offsetHeight:t[0].offsetWidth),i&&t.hide().css(i),o},getStartZIndex:function(t){var e=parseInt(this[t?"$root":"$firstSub"].css("z-index"));return!t&&isNaN(e)&&(e=parseInt(this.$root.css("z-index"))),isNaN(e)?1:e},getTouchPoint:function(t){return t.touches&&t.touches[0]||t.changedTouches&&t.changedTouches[0]||t},getViewport:function(t){var e=t?"Height":"Width",i=document.documentElement["client"+e],s=window["inner"+e];return s&&(i=Math.min(i,s)),i},getViewportHeight:function(){return this.getViewport(!0)},getViewportWidth:function(){ +return this.getViewport()},getWidth:function(t){return this.getOffset(t)},handleEvents:function(){return!this.disabled&&this.isCSSOn()},handleItemEvents:function(t){return this.handleEvents()&&!this.isLinkInMegaMenu(t)},isCollapsible:function(){return"static"==this.$firstSub.css("position")},isCSSOn:function(){return"inline"!=this.$firstLink.css("display")},isFixed:function(){var t="fixed"==this.$root.css("position");return t||this.$root.parentsUntil("body").each(function(){return"fixed"==$(this).css("position")?(t=!0,!1):void 0}),t},isLinkInMegaMenu:function(t){return $(this.getClosestMenu(t[0])).hasClass("mega-menu")},isTouchMode:function(){return!mouse||this.opts.noMouseOver||this.isCollapsible()},itemActivate:function(t,e){var i=t.closest("ul"),s=i.dataSM("level");if(s>1&&(!this.activatedItems[s-2]||this.activatedItems[s-2][0]!=i.dataSM("parent-a")[0])){var o=this;$(i.parentsUntil("[data-smartmenus-id]","ul").get().reverse()).add(i).each(function(){o.itemActivate($(this).dataSM("parent-a"))})}if(( +!this.isCollapsible()||e)&&this.menuHideSubMenus(this.activatedItems[s-1]&&this.activatedItems[s-1][0]==t[0]?s:s-1),this.activatedItems[s-1]=t,this.$root.triggerHandler("activate.smapi",t[0])!==!1){var a=t.dataSM("sub");a&&(this.isTouchMode()||!this.opts.showOnClick||this.clickActivated)&&this.menuShow(a)}},itemBlur:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&this.$root.triggerHandler("blur.smapi",e[0])},itemClick:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(this.$touchScrollingSub&&this.$touchScrollingSub[0]==e.closest("ul")[0])return this.$touchScrollingSub=null,t.stopPropagation(),!1;if(this.$root.triggerHandler("click.smapi",e[0])===!1)return!1;var i=$(t.target).is(".sub-arrow"),s=e.dataSM("sub"),o=s?2==s.dataSM("level"):!1,a=this.isCollapsible(),n=/toggle$/.test(this.opts.collapsibleBehavior),r=/link$/.test(this.opts.collapsibleBehavior),h=/^accordion/.test(this.opts.collapsibleBehavior);if(s&&!s.is(":visible")){if((!r||!a||i)&&(this.opts.showOnClick&&o&&( +this.clickActivated=!0),this.itemActivate(e,h),s.is(":visible")))return this.focusActivated=!0,!1}else if(a&&(n||i))return this.itemActivate(e,h),this.menuHide(s),n&&(this.focusActivated=!1),!1;return this.opts.showOnClick&&o||e.hasClass("disabled")||this.$root.triggerHandler("select.smapi",e[0])===!1?!1:void 0}},itemDown:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&e.dataSM("mousedown",!0)},itemEnter:function(t){var e=$(t.currentTarget);if(this.handleItemEvents(e)){if(!this.isTouchMode()){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);var i=this;this.showTimeout=setTimeout(function(){i.itemActivate(e)},this.opts.showOnClick&&1==e.closest("ul").dataSM("level")?1:this.opts.showTimeout)}this.$root.triggerHandler("mouseenter.smapi",e[0])}},itemFocus:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(!this.focusActivated||this.isTouchMode()&&e.dataSM("mousedown")||this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0]==e[0 +]||this.itemActivate(e,!0),this.$root.triggerHandler("focus.smapi",e[0]))},itemLeave:function(t){var e=$(t.currentTarget);this.handleItemEvents(e)&&(this.isTouchMode()||(e[0].blur(),this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0)),e.removeDataSM("mousedown"),this.$root.triggerHandler("mouseleave.smapi",e[0]))},menuHide:function(t){if(this.$root.triggerHandler("beforehide.smapi",t[0])!==!1&&(canAnimate&&t.stop(!0,!0),"none"!=t.css("display"))){var e=function(){t.css("z-index","")};this.isCollapsible()?canAnimate&&this.opts.collapsibleHideFunction?this.opts.collapsibleHideFunction.call(this,t,e):t.hide(this.opts.collapsibleHideDuration,e):canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,t,e):t.hide(this.opts.hideDuration,e),t.dataSM("scroll")&&(this.menuScrollStop(t),t.css({"touch-action":"","-ms-touch-action":"","-webkit-transform":"",transform:""}).off(".smartmenus_scroll").removeDataSM("scroll").dataSM("scroll-arrows").hide()),t.dataSM("parent-a").removeClass( +"highlighted").attr("aria-expanded","false"),t.attr({"aria-expanded":"false","aria-hidden":"true"});var i=t.dataSM("level");this.activatedItems.splice(i-1,1),this.visibleSubMenus.splice($.inArray(t,this.visibleSubMenus),1),this.$root.triggerHandler("hide.smapi",t[0])}},menuHideAll:function(){this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=0);for(var t=this.opts.isPopup?1:0,e=this.visibleSubMenus.length-1;e>=t;e--)this.menuHide(this.visibleSubMenus[e]);this.opts.isPopup&&(canAnimate&&this.$root.stop(!0,!0),this.$root.is(":visible")&&(canAnimate&&this.opts.hideFunction?this.opts.hideFunction.call(this,this.$root):this.$root.hide(this.opts.hideDuration))),this.activatedItems=[],this.visibleSubMenus=[],this.clickActivated=!1,this.focusActivated=!1,this.zIndexInc=0,this.$root.triggerHandler("hideAll.smapi")},menuHideSubMenus:function(t){for(var e=this.activatedItems.length-1;e>=t;e--){var i=this.activatedItems[e].dataSM("sub");i&&this.menuHide(i)}},menuInit:function(t){if(!t.dataSM("in-mega")){ +t.hasClass("mega-menu")&&t.find("ul").dataSM("in-mega",!0);for(var e=2,i=t[0];(i=i.parentNode.parentNode)!=this.$root[0];)e++;var s=t.prevAll("a").eq(-1);s.length||(s=t.prevAll().find("a").eq(-1)),s.addClass("has-submenu").dataSM("sub",t),t.dataSM("parent-a",s).dataSM("level",e).parent().dataSM("sub",t);var o=s.attr("id")||this.accessIdPrefix+ ++this.idInc,a=t.attr("id")||this.accessIdPrefix+ ++this.idInc;s.attr({id:o,"aria-haspopup":"true","aria-controls":a,"aria-expanded":"false"}),t.attr({id:a,role:"group","aria-hidden":"true","aria-labelledby":o,"aria-expanded":"false"}),this.opts.subIndicators&&s[this.opts.subIndicatorsPos](this.$subArrow.clone())}},menuPosition:function(t){var e,i,s=t.dataSM("parent-a"),o=s.closest("li"),a=o.parent(),n=t.dataSM("level"),r=this.getWidth(t),h=this.getHeight(t),u=s.offset(),l=u.left,c=u.top,d=this.getWidth(s),m=this.getHeight(s),p=$(window),f=p.scrollLeft(),v=p.scrollTop(),b=this.getViewportWidth(),S=this.getViewportHeight(),g=a.parent().is("[data-sm-horizontal-sub]" +)||2==n&&!a.hasClass("sm-vertical"),M=this.opts.rightToLeftSubMenus&&!o.is("[data-sm-reverse]")||!this.opts.rightToLeftSubMenus&&o.is("[data-sm-reverse]"),w=2==n?this.opts.mainMenuSubOffsetX:this.opts.subMenusSubOffsetX,T=2==n?this.opts.mainMenuSubOffsetY:this.opts.subMenusSubOffsetY;if(g?(e=M?d-r-w:w,i=this.opts.bottomToTopSubMenus?-h-T:m+T):(e=M?w-r:d-w,i=this.opts.bottomToTopSubMenus?m-T-h:T),this.opts.keepInViewport){var y=l+e,I=c+i;if(M&&f>y?e=g?f-y+e:d-w:!M&&y+r>f+b&&(e=g?f+b-r-y+e:w-r),g||(S>h&&I+h>v+S?i+=v+S-h-I:(h>=S||v>I)&&(i+=v-I)),g&&(I+h>v+S+.49||v>I)||!g&&h>S+.49){var x=this;t.dataSM("scroll-arrows")||t.dataSM("scroll-arrows",$([$('')[0],$('')[0]]).on({mouseenter:function(){t.dataSM("scroll").up=$(this).hasClass("scroll-up"),x.menuScroll(t)},mouseleave:function(e){x.menuScrollStop(t),x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(t){ +t.preventDefault()}}).insertAfter(t));var A=".smartmenus_scroll";if(t.dataSM("scroll",{y:this.cssTransforms3d?0:i-m,step:1,itemH:m,subH:h,arrowDownH:this.getHeight(t.dataSM("scroll-arrows").eq(1))}).on(getEventsNS({mouseover:function(e){x.menuScrollOver(t,e)},mouseout:function(e){x.menuScrollOut(t,e)},"mousewheel DOMMouseScroll":function(e){x.menuScrollMousewheel(t,e)}},A)).dataSM("scroll-arrows").css({top:"auto",left:"0",marginLeft:e+(parseInt(t.css("border-left-width"))||0),width:r-(parseInt(t.css("border-left-width"))||0)-(parseInt(t.css("border-right-width"))||0),zIndex:t.css("z-index")}).eq(g&&this.opts.bottomToTopSubMenus?0:1).show(),this.isFixed()){var C={};C[touchEvents?"touchstart touchmove touchend":"pointerdown pointermove pointerup MSPointerDown MSPointerMove MSPointerUp"]=function(e){x.menuScrollTouch(t,e)},t.css({"touch-action":"none","-ms-touch-action":"none"}).on(getEventsNS(C,A))}}}t.css({top:"auto",left:"0",marginLeft:e,marginTop:i-m})},menuScroll:function(t,e,i){var s,o=t.dataSM("scroll"), +a=t.dataSM("scroll-arrows"),n=o.up?o.upEnd:o.downEnd;if(!e&&o.momentum){if(o.momentum*=.92,s=o.momentum,.5>s)return this.menuScrollStop(t),void 0}else s=i||(e||!this.opts.scrollAccelerate?this.opts.scrollStep:Math.floor(o.step));var r=t.dataSM("level");if(this.activatedItems[r-1]&&this.activatedItems[r-1].dataSM("sub")&&this.activatedItems[r-1].dataSM("sub").is(":visible")&&this.menuHideSubMenus(r-1),o.y=o.up&&o.y>=n||!o.up&&n>=o.y?o.y:Math.abs(n-o.y)>s?o.y+(o.up?s:-s):n,t.css(this.cssTransforms3d?{"-webkit-transform":"translate3d(0, "+o.y+"px, 0)",transform:"translate3d(0, "+o.y+"px, 0)"}:{marginTop:o.y}),mouse&&(o.up&&o.y>o.downEnd||!o.up&&o.y0;t.dataSM("scroll-arrows").eq(i?0:1).is(":visible")&&(t.dataSM("scroll").up=i,this.menuScroll(t,!0))}e.preventDefault()},menuScrollOut:function(t,e){mouse&&(/^scroll-(up|down)/.test((e.relatedTarget||"").className)||(t[0]==e.relatedTarget||$.contains(t[0],e.relatedTarget))&&this.getClosestMenu(e.relatedTarget)==t[0]||t.dataSM("scroll-arrows").css("visibility","hidden"))},menuScrollOver:function(t,e){if(mouse&&!/^scroll-(up|down)/.test(e.target.className)&&this.getClosestMenu(e.target)==t[0]){this.menuScrollRefreshData(t);var i=t.dataSM("scroll"),s=$(window).scrollTop()-t.dataSM("parent-a").offset().top-i.itemH;t.dataSM("scroll-arrows").eq(0).css("margin-top",s).end().eq(1).css("margin-top",s+this.getViewportHeight()-i.arrowDownH).end().css("visibility","visible")}},menuScrollRefreshData:function(t){var e=t.dataSM("scroll"),i=$(window).scrollTop()-t.dataSM("parent-a").offset().top-e.itemH;this.cssTransforms3d&&(i=-(parseFloat(t.css("margin-top"))-i)),$.extend(e,{upEnd:i, +downEnd:i+this.getViewportHeight()-e.subH})},menuScrollStop:function(t){return this.scrollTimeout?(cancelAnimationFrame(this.scrollTimeout),this.scrollTimeout=0,t.dataSM("scroll").step=1,!0):void 0},menuScrollTouch:function(t,e){if(e=e.originalEvent,isTouchEvent(e)){var i=this.getTouchPoint(e);if(this.getClosestMenu(i.target)==t[0]){var s=t.dataSM("scroll");if(/(start|down)$/i.test(e.type))this.menuScrollStop(t)?(e.preventDefault(),this.$touchScrollingSub=t):this.$touchScrollingSub=null,this.menuScrollRefreshData(t),$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp});else if(/move$/i.test(e.type)){var o=void 0!==s.touchY?s.touchY:s.touchStartY;if(void 0!==o&&o!=i.pageY){this.$touchScrollingSub=t;var a=i.pageY>o;void 0!==s.up&&s.up!=a&&$.extend(s,{touchStartY:i.pageY,touchStartTime:e.timeStamp}),$.extend(s,{up:a,touchY:i.pageY}),this.menuScroll(t,!0,Math.abs(i.pageY-o))}e.preventDefault()}else void 0!==s.touchY&&((s.momentum=15*Math.pow(Math.abs(i.pageY-s.touchStartY)/(e.timeStamp-s.touchStartTime),2) +)&&(this.menuScrollStop(t),this.menuScroll(t),e.preventDefault()),delete s.touchY)}}},menuShow:function(t){if((t.dataSM("beforefirstshowfired")||(t.dataSM("beforefirstshowfired",!0),this.$root.triggerHandler("beforefirstshow.smapi",t[0])!==!1))&&this.$root.triggerHandler("beforeshow.smapi",t[0])!==!1&&(t.dataSM("shown-before",!0),canAnimate&&t.stop(!0,!0),!t.is(":visible"))){var e=t.dataSM("parent-a"),i=this.isCollapsible();if((this.opts.keepHighlighted||i)&&e.addClass("highlighted"),i)t.removeClass("sm-nowrap").css({zIndex:"",width:"auto",minWidth:"",maxWidth:"",top:"",left:"",marginLeft:"",marginTop:""});else{if(t.css("z-index",this.zIndexInc=(this.zIndexInc||this.getStartZIndex())+1),(this.opts.subMenusMinWidth||this.opts.subMenusMaxWidth)&&(t.css({width:"auto",minWidth:"",maxWidth:""}).addClass("sm-nowrap"),this.opts.subMenusMinWidth&&t.css("min-width",this.opts.subMenusMinWidth),this.opts.subMenusMaxWidth)){var s=this.getWidth(t);t.css("max-width",this.opts.subMenusMaxWidth),s>this.getWidth(t +)&&t.removeClass("sm-nowrap").css("width",this.opts.subMenusMaxWidth)}this.menuPosition(t)}var o=function(){t.css("overflow","")};i?canAnimate&&this.opts.collapsibleShowFunction?this.opts.collapsibleShowFunction.call(this,t,o):t.show(this.opts.collapsibleShowDuration,o):canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,t,o):t.show(this.opts.showDuration,o),e.attr("aria-expanded","true"),t.attr({"aria-expanded":"true","aria-hidden":"false"}),this.visibleSubMenus.push(t),this.$root.triggerHandler("show.smapi",t[0])}},popupHide:function(t){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0);var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},t?1:this.opts.hideTimeout)},popupShow:function(t,e){if(!this.opts.isPopup)return alert('SmartMenus jQuery Error:\n\nIf you want to show this menu via the "popupShow" method, set the isPopup:true option.'),void 0;if(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),this.$root.dataSM("shown-before",!0), +canAnimate&&this.$root.stop(!0,!0),!this.$root.is(":visible")){this.$root.css({left:t,top:e});var i=this,s=function(){i.$root.css("overflow","")};canAnimate&&this.opts.showFunction?this.opts.showFunction.call(this,this.$root,s):this.$root.show(this.opts.showDuration,s),this.visibleSubMenus[0]=this.$root}},refresh:function(){this.destroy(!0),this.init(!0)},rootKeyDown:function(t){if(this.handleEvents())switch(t.keyCode){case 27:var e=this.activatedItems[0];if(e){this.menuHideAll(),e[0].focus();var i=e.dataSM("sub");i&&this.menuHide(i)}break;case 32:var s=$(t.target);if(s.is("a")&&this.handleItemEvents(s)){var i=s.dataSM("sub");i&&!i.is(":visible")&&(this.itemClick({currentTarget:t.target}),t.preventDefault())}}},rootOut:function(t){if(this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&(this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0),!this.opts.showOnClick||!this.opts.hideOnClick)){var e=this;this.hideTimeout=setTimeout(function(){e.menuHideAll()},this.opts.hideTimeout)}}, +rootOver:function(t){this.handleEvents()&&!this.isTouchMode()&&t.target!=this.$root[0]&&this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=0)},winResize:function(t){if(this.handleEvents()){if(!("onorientationchange"in window)||"orientationchange"==t.type){var e=this.isCollapsible();this.wasCollapsible&&e||(this.activatedItems.length&&this.activatedItems[this.activatedItems.length-1][0].blur(),this.menuHideAll()),this.wasCollapsible=e}}else if(this.$disableOverlay){var i=this.$root.offset();this.$disableOverlay.css({top:i.top,left:i.left,width:this.$root.outerWidth(),height:this.$root.outerHeight()})}}}}),$.fn.dataSM=function(t,e){return e?this.data(t+"_smartmenus",e):this.data(t+"_smartmenus")},$.fn.removeDataSM=function(t){return this.removeData(t+"_smartmenus")},$.fn.smartmenus=function(options){if("string"==typeof options){var args=arguments,method=options;return Array.prototype.shift.call(args),this.each(function(){var t=$(this).data("smartmenus");t&&t[method]&&t[method].apply(t,args)})} +return this.each(function(){var dataOpts=$(this).data("sm-options")||null;if(dataOpts)try{dataOpts=eval("("+dataOpts+")")}catch(e){dataOpts=null,alert('ERROR\n\nSmartMenus jQuery init:\nInvalid "data-sm-options" attribute value syntax.')}new $.SmartMenus(this,$.extend({},$.fn.smartmenus.defaults,options,dataOpts))})},$.fn.smartmenus.defaults={isPopup:!1,mainMenuSubOffsetX:0,mainMenuSubOffsetY:0,subMenusSubOffsetX:0,subMenusSubOffsetY:0,subMenusMinWidth:"10em",subMenusMaxWidth:"20em",subIndicators:!0,subIndicatorsPos:"append",subIndicatorsText:"",scrollStep:30,scrollAccelerate:!0,showTimeout:250,hideTimeout:500,showDuration:0,showFunction:null,hideDuration:0,hideFunction:function(t,e){t.fadeOut(200,e)},collapsibleShowDuration:0,collapsibleShowFunction:function(t,e){t.slideDown(200,e)},collapsibleHideDuration:0,collapsibleHideFunction:function(t,e){t.slideUp(200,e)},showOnClick:!1,hideOnClick:!0,noMouseOver:!1,keepInViewport:!0,keepHighlighted:!0,markCurrentItem:!1,markCurrentTree:!0,rightToLeftSubMenus:!1, +bottomToTopSubMenus:!1,collapsibleBehavior:"default"},$}); diff --git a/docs/html/lisa__tag_8c.html b/docs/html/lisa__tag_8c.html new file mode 100644 index 0000000..cb7f58b --- /dev/null +++ b/docs/html/lisa__tag_8c.html @@ -0,0 +1,650 @@ + + + + + + + +libaaruformat: src/lisa_tag.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
lisa_tag.c File Reference
+
+
+ +

Parsing, conversion and serialization helpers for Lisa (Apple Lisa / Profile / Priam / Sony) disk block tags. +More...

+
#include <stdint.h>
+#include "aaruformat/structs/lisa_tag.h"
+#include <stdlib.h>
+
+

Go to the source code of this file.

+ + + + + + +

+Macros

#define SONY_BLOCK_NUMBER_MASK   0x07FFU
#define SONY_BLOCK_VALID_FLAG   0x8000U
#define SONY_BLOCK_ALLOWED_MASK   (SONY_BLOCK_VALID_FLAG | SONY_BLOCK_NUMBER_MASK)
 Preserve valid bit + 11-bit index.
+ + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

sony_tag bytes_to_sony_tag (const uint8_t *bytes)
 Parse a 12-byte Sony tag record into a sony_tag structure.
priam_tag bytes_to_priam_tag (const uint8_t *bytes)
 Parse a 24-byte Priam tag record into a priam_tag structure.
profile_tag bytes_to_profile_tag (const uint8_t *bytes)
 Parse a 20-byte Profile tag record into a profile_tag structure.
profile_tag sony_tag_to_profile (const sony_tag tag)
 Convert a sony_tag to a profile_tag representation.
priam_tag sony_tag_to_priam (const sony_tag tag)
 Convert a sony_tag to a priam_tag representation.
priam_tag profile_tag_to_priam (const profile_tag tag)
 Convert a profile_tag to a priam_tag.
sony_tag profile_tag_to_sony (const profile_tag tag)
 Convert a profile_tag to a sony_tag.
sony_tag priam_tag_to_sony (const priam_tag tag)
 Convert a priam_tag to a sony_tag.
profile_tag priam_tag_to_profile (const priam_tag tag)
 Convert a priam_tag to a profile_tag.
uint8_t * profile_tag_to_bytes (const profile_tag tag)
 Serialize a profile_tag into a newly allocated 20-byte big-endian on-disk representation.
uint8_t * priam_tag_to_bytes (const priam_tag tag)
 Serialize a priam_tag into a newly allocated 24-byte big-endian on-disk representation.
uint8_t * sony_tag_to_bytes (sony_tag tag)
 Serialize a sony_tag into a newly allocated 12-byte big-endian on-disk representation.
+

Detailed Description

+

Parsing, conversion and serialization helpers for Lisa (Apple Lisa / Profile / Priam / Sony) disk block tags.

+

The Lisa operating system and related peripheral disk formats (Sony 3.5" diskettes, ProFile hard disks, +Priam drives) store per-block (or per-page) metadata in compact on-disk "tag" records. These records use mixed-size big-endian integer fields and bit fields to describe allocation chains, relative/absolute page numbering, volume numbers, versions, and (for some variants) checksums and disk sizing.

+

This module provides:

    +
  • Parsing raw big-endian on-disk tag byte sequences into the in-memory structures: sony_tag, profile_tag, priam_tag.
  • +
  • Lossless (within each format's limits) conversion between the different tag structure variants, mapping sentinel values (e.g. 0x7FF <-> 0xFFFFFF for end-of-chain markers) appropriately.
  • +
  • Serialization of the in-memory structures back into their canonical on-disk packed byte layouts.
  • +
+

Endianness: All multi-byte numeric fields in the on-disk tag formats are stored big-endian. The helper routines perform the necessary byte shifting and masking; the resulting structure fields are in host endianness.

+

Memory management: The serialization functions ( *_tag_to_bytes ) allocate new byte buffers using calloc(). The caller owns the returned pointer and must free() it when no longer needed. Parsing functions do not allocate dynamic memory; they return structures by value.

+

Validation: For performance and low-level usage reasons, the parsing routines do not perform NULL pointer checks nor length validation on the input byte arrays. Supplying a NULL pointer or insufficient bytes is undefined behavior. If such safety is required, perform validation before calling these functions.

+

Sentinel mapping: Sony tag next/prev block fields are 11-bit values (masked with 0x7FF) with the value 0x7FF meaning end-of-chain (or no previous). In the wider Profile/Priam formats these become 24-bit fields, with 0xFFFFFF used for the same semantic meaning. Conversion helpers transparently translate between these sentinel values.

+

Bit fields: The structures define C bit fields for compact representation (e.g., kind, reserved, valid_chk, used_bytes). The parsing and serialization routines reconstruct / pack these manually through masking and shifting because on-disk layout may not match compiler bit-field packing. This provides portability irrespective of platform-specific bit-field ordering.

+ +

Definition in file lisa_tag.c.

+

Macro Definition Documentation

+ +

◆ SONY_BLOCK_ALLOWED_MASK

+ +
+
+ + + + +
#define SONY_BLOCK_ALLOWED_MASK   (SONY_BLOCK_VALID_FLAG | SONY_BLOCK_NUMBER_MASK)
+
+ +

Preserve valid bit + 11-bit index.

+ +

Definition at line 68 of file lisa_tag.c.

+ +

Referenced by bytes_to_sony_tag(), and sony_tag_to_bytes().

+ +
+
+ +

◆ SONY_BLOCK_NUMBER_MASK

+ +
+
+ + + + +
#define SONY_BLOCK_NUMBER_MASK   0x07FFU
+
+ +

Definition at line 66 of file lisa_tag.c.

+ +

Referenced by priam_tag_to_sony(), profile_tag_to_sony(), sony_tag_to_priam(), and sony_tag_to_profile().

+ +
+
+ +

◆ SONY_BLOCK_VALID_FLAG

+ +
+
+ + + + +
#define SONY_BLOCK_VALID_FLAG   0x8000U
+
+ +

Definition at line 67 of file lisa_tag.c.

+ +
+
+

Function Documentation

+ +

◆ bytes_to_priam_tag()

+ +
+
+ + + + + + + +
priam_tag bytes_to_priam_tag (const uint8_t * bytes)
+
+ +

Parse a 24-byte Priam tag record into a priam_tag structure.

+

Priam tags extend the Profile tag with an additional 4-byte disk_size field. This routine decodes all bit fields, separating the valid checksum flag (bit 7 of byte 6) from the 15-bit used_bytes value.

+
Parameters
+ + +
bytesPointer to at least 24 consecutive bytes containing a raw Priam tag.
+
+
+
Returns
A populated priam_tag structure.
+
Warning
Undefined behavior if bytes is NULL or shorter than 24 bytes.
+
Note
The abs_page, next_block and prev_block 24-bit values are expanded into 32-bit integers in host memory.
+ +

Definition at line 112 of file lisa_tag.c.

+ +

References priam_tag::abs_page, priam_tag::checksum, priam_tag::disk_size, priam_tag::file_id, priam_tag::kind, priam_tag::next_block, priam_tag::prev_block, priam_tag::rel_page, priam_tag::reserved, priam_tag::used_bytes, priam_tag::valid_chk, priam_tag::version, and priam_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ bytes_to_profile_tag()

+ +
+
+ + + + + + + +
profile_tag bytes_to_profile_tag (const uint8_t * bytes)
+
+ +

Parse a 20-byte Profile tag record into a profile_tag structure.

+

A Profile tag is similar to Priam but without the trailing disk_size field. Multi-byte numeric values are big-endian.

+
Parameters
+ + +
bytesPointer to at least 20 consecutive bytes containing a raw Profile tag.
+
+
+
Returns
A populated profile_tag structure.
+
Warning
Undefined behavior if bytes is NULL or shorter than 20 bytes.
+ +

Definition at line 142 of file lisa_tag.c.

+ +

References profile_tag::abs_page, profile_tag::checksum, profile_tag::file_id, profile_tag::kind, profile_tag::next_block, profile_tag::prev_block, profile_tag::rel_page, profile_tag::reserved, profile_tag::used_bytes, profile_tag::valid_chk, profile_tag::version, and profile_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ bytes_to_sony_tag()

+ +
+
+ + + + + + + +
sony_tag bytes_to_sony_tag (const uint8_t * bytes)
+
+ +

Parse a 12-byte Sony tag record into a sony_tag structure.

+

Field extraction follows the documented on-disk layout (big-endian). The next/prev block numbers are masked to 11 bits (0x7FF) since only those bits are defined in the Sony tag format. The reserved bits are preserved in the structure's reserved member for round-tripping if needed.

+
Parameters
+ + +
bytesPointer to at least 12 consecutive bytes containing a raw Sony tag as read from disk.
+
+
+
Returns
A populated sony_tag structure with host-endian integer fields.
+
Warning
Behavior is undefined if bytes is NULL or does not point to at least 12 readable bytes.
+
Note
No validation of version, kind, or chain linkage consistency is performed.
+ +

Definition at line 82 of file lisa_tag.c.

+ +

References sony_tag::file_id, sony_tag::kind, sony_tag::next_block, sony_tag::prev_block, sony_tag::rel_page, sony_tag::reserved, SONY_BLOCK_ALLOWED_MASK, sony_tag::version, and sony_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ priam_tag_to_bytes()

+ +
+
+ + + + + + + +
uint8_t * priam_tag_to_bytes (const priam_tag tag)
+
+ +

Serialize a priam_tag into a newly allocated 24-byte big-endian on-disk representation.

+

Layout matches bytes_to_priam_tag(). Includes the final 4-byte disk_size field. Packing rules for used_bytes and valid_chk mirror those used in profile_tag_to_bytes().

+
Parameters
+ + +
tagPriam tag to serialize.
+
+
+
Returns
Pointer to a 24-byte buffer, or NULL on allocation failure.
+
Return values
+ + +
NULLAllocation failure.
+
+
+
Note
Caller must free() the returned buffer.
+ +

Definition at line 409 of file lisa_tag.c.

+ +

References priam_tag::abs_page, priam_tag::checksum, priam_tag::disk_size, priam_tag::file_id, priam_tag::kind, priam_tag::next_block, priam_tag::prev_block, priam_tag::rel_page, priam_tag::reserved, priam_tag::used_bytes, priam_tag::valid_chk, priam_tag::version, and priam_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ priam_tag_to_profile()

+ +
+
+ + + + + + + +
profile_tag priam_tag_to_profile (const priam_tag tag)
+
+ +

Convert a priam_tag to a profile_tag.

+

Copies overlapping fields, omitting the Priam-specific disk_size. Useful when reusing Priam metadata in a context that expects Profile tag semantics.

+
Parameters
+ + +
tagSource Priam tag.
+
+
+
Returns
Profile tag with copied values.
+ +

Definition at line 325 of file lisa_tag.c.

+ +

References priam_tag::abs_page, profile_tag::abs_page, priam_tag::checksum, profile_tag::checksum, priam_tag::file_id, profile_tag::file_id, priam_tag::kind, profile_tag::kind, priam_tag::next_block, profile_tag::next_block, priam_tag::prev_block, profile_tag::prev_block, priam_tag::rel_page, profile_tag::rel_page, priam_tag::reserved, profile_tag::reserved, priam_tag::used_bytes, profile_tag::used_bytes, priam_tag::valid_chk, profile_tag::valid_chk, priam_tag::version, profile_tag::version, priam_tag::volume, and profile_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ priam_tag_to_sony()

+ +
+
+ + + + + + + +
sony_tag priam_tag_to_sony (const priam_tag tag)
+
+ +

Convert a priam_tag to a sony_tag.

+

See profile_tag_to_sony(); Priam-only fields (abs_page, checksum, used_bytes, valid_chk, disk_size) are discarded. 0xFFFFFF chain terminators become 0x7FF; other values are truncated to 11 bits.

+
Parameters
+ + +
tagSource Priam tag.
+
+
+
Returns
Sony tag with mapped values.
+ +

Definition at line 291 of file lisa_tag.c.

+ +

References priam_tag::file_id, sony_tag::file_id, priam_tag::kind, sony_tag::kind, priam_tag::next_block, sony_tag::next_block, priam_tag::prev_block, sony_tag::prev_block, priam_tag::rel_page, sony_tag::rel_page, priam_tag::reserved, sony_tag::reserved, SONY_BLOCK_NUMBER_MASK, priam_tag::version, sony_tag::version, priam_tag::volume, and sony_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ profile_tag_to_bytes()

+ +
+
+ + + + + + + +
uint8_t * profile_tag_to_bytes (const profile_tag tag)
+
+ +

Serialize a profile_tag into a newly allocated 20-byte big-endian on-disk representation.

+

Bit/byte packing mirrors bytes_to_profile_tag(). The 24-bit next_block, prev_block and abs_page values are written most-significant byte first. The used_bytes high 7 bits and valid_chk flag are packed into the first byte of the 16-bit used_bytes field as per on-disk layout.

+
Parameters
+ + +
tagProfile tag to serialize.
+
+
+
Returns
Pointer to a 20-byte buffer containing the serialized tag, or NULL on allocation failure.
+
Return values
+ + +
NULLAllocation failure (caller should check before use).
+
+
+
Note
Caller must free() the returned buffer.
+ +

Definition at line 357 of file lisa_tag.c.

+ +

References profile_tag::abs_page, profile_tag::checksum, profile_tag::file_id, profile_tag::kind, profile_tag::next_block, profile_tag::prev_block, profile_tag::rel_page, profile_tag::reserved, profile_tag::used_bytes, profile_tag::valid_chk, profile_tag::version, and profile_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ profile_tag_to_priam()

+ +
+
+ + + + + + + +
priam_tag profile_tag_to_priam (const profile_tag tag)
+
+
+ +

◆ profile_tag_to_sony()

+ +
+
+ + + + + + + +
sony_tag profile_tag_to_sony (const profile_tag tag)
+
+ +

Convert a profile_tag to a sony_tag.

+

Narrows 24-bit next/prev block numbers to 11 bits. A value of 0xFFFFFF (end-of-chain sentinel) is mapped back to 0x7FF. Any non-sentinel value is truncated to its lower 11 bits. Fields without Sony equivalents are dropped.

+
Parameters
+ + +
tagSource Profile tag.
+
+
+
Returns
Sony tag with mapped/narrowed values.
+ +

Definition at line 257 of file lisa_tag.c.

+ +

References profile_tag::file_id, sony_tag::file_id, profile_tag::kind, sony_tag::kind, profile_tag::next_block, sony_tag::next_block, profile_tag::prev_block, sony_tag::prev_block, profile_tag::rel_page, sony_tag::rel_page, profile_tag::reserved, sony_tag::reserved, SONY_BLOCK_NUMBER_MASK, profile_tag::version, sony_tag::version, profile_tag::volume, and sony_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ sony_tag_to_bytes()

+ +
+
+ + + + + + + +
uint8_t * sony_tag_to_bytes (sony_tag tag)
+
+ +

Serialize a sony_tag into a newly allocated 12-byte big-endian on-disk representation.

+

The next_block and prev_block fields are masked to 11 bits (0x7FF) during packing. Caller should ensure sentinel semantics are already encoded (i.e., use 0x7FF for end-of-chain) prior to calling.

+
Parameters
+ + +
tagSony tag to serialize.
+
+
+
Returns
Pointer to a 12-byte buffer, or NULL on allocation failure.
+
Return values
+ + +
NULLAllocation failure.
+
+
+
Note
Caller must free() the returned buffer.
+ +

Definition at line 466 of file lisa_tag.c.

+ +

References sony_tag::file_id, sony_tag::kind, sony_tag::next_block, sony_tag::prev_block, sony_tag::rel_page, sony_tag::reserved, SONY_BLOCK_ALLOWED_MASK, sony_tag::version, and sony_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ sony_tag_to_priam()

+ +
+
+ + + + + + + +
priam_tag sony_tag_to_priam (const sony_tag tag)
+
+ +

Convert a sony_tag to a priam_tag representation.

+

Similar to sony_tag_to_profile() but returns a Priam tag. Priam-specific fields (abs_page, checksum, used_bytes, valid_chk, disk_size, reserved) are zero-initialized. 0x7FF next/prev sentinels expand to 0xFFFFFF.

+
Parameters
+ + +
tagSource Sony tag.
+
+
+
Returns
Priam tag with mapped values.
+ +

Definition at line 201 of file lisa_tag.c.

+ +

References priam_tag::file_id, sony_tag::file_id, priam_tag::kind, sony_tag::kind, priam_tag::next_block, sony_tag::next_block, priam_tag::prev_block, sony_tag::prev_block, priam_tag::rel_page, sony_tag::rel_page, priam_tag::reserved, sony_tag::reserved, SONY_BLOCK_NUMBER_MASK, priam_tag::version, sony_tag::version, priam_tag::volume, and sony_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ sony_tag_to_profile()

+ +
+
+ + + + + + + +
profile_tag sony_tag_to_profile (const sony_tag tag)
+
+ +

Convert a sony_tag to a profile_tag representation.

+

Sony tags contain a reduced-width (11-bit) next/prev block. To preserve chain termination semantics, values of 0x7FF are translated to 0xFFFFFF (24-bit "no next/prev" sentinel). Other values are copied verbatim into the wider fields. Only fields common to both formats are populated; Profile-specific fields (abs_page, checksum, used_bytes, valid_chk, reserved) remain zero-initialized.

+
Parameters
+ + +
tagSource Sony tag.
+
+
+
Returns
Profile tag with mapped values.
+ +

Definition at line 173 of file lisa_tag.c.

+ +

References profile_tag::file_id, sony_tag::file_id, profile_tag::kind, sony_tag::kind, profile_tag::next_block, sony_tag::next_block, profile_tag::prev_block, sony_tag::prev_block, profile_tag::rel_page, sony_tag::rel_page, profile_tag::reserved, sony_tag::reserved, SONY_BLOCK_NUMBER_MASK, profile_tag::version, sony_tag::version, profile_tag::volume, and sony_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/lisa__tag_8c.js b/docs/html/lisa__tag_8c.js new file mode 100644 index 0000000..59b7151 --- /dev/null +++ b/docs/html/lisa__tag_8c.js @@ -0,0 +1,18 @@ +var lisa__tag_8c = +[ + [ "SONY_BLOCK_ALLOWED_MASK", "lisa__tag_8c.html#a7d7f8aa46edb235e21bfea8107b5e3c8", null ], + [ "SONY_BLOCK_NUMBER_MASK", "lisa__tag_8c.html#aef334cdecdec7a98b1939051faa8c189", null ], + [ "SONY_BLOCK_VALID_FLAG", "lisa__tag_8c.html#a19aa22f00bd0e0404ae5522ee00faa0e", null ], + [ "bytes_to_priam_tag", "lisa__tag_8c.html#a37de4ed827409b7ffbae995ce49f87ce", null ], + [ "bytes_to_profile_tag", "lisa__tag_8c.html#abb08e5fe62d9c765bc130d6095e20029", null ], + [ "bytes_to_sony_tag", "lisa__tag_8c.html#aaea071654dab25283350e7e49d665f1b", null ], + [ "priam_tag_to_bytes", "lisa__tag_8c.html#ae730dfd7e060f0fba1ef4a655dba707e", null ], + [ "priam_tag_to_profile", "lisa__tag_8c.html#a7b2a33d8b2d42c4d303c0e1266251ff6", null ], + [ "priam_tag_to_sony", "lisa__tag_8c.html#a95c989146aac950cfb3a95ee3768243e", null ], + [ "profile_tag_to_bytes", "lisa__tag_8c.html#a47a06642c8ec3b3a96a6cc8c2ac7897d", null ], + [ "profile_tag_to_priam", "lisa__tag_8c.html#ab58658909d5e1836ab2ac89eee760398", null ], + [ "profile_tag_to_sony", "lisa__tag_8c.html#add5d303422a7fcd2ab2e791edc5b5e2b", null ], + [ "sony_tag_to_bytes", "lisa__tag_8c.html#a5fe6bd8526b1d35a2d3a74e9bebd67f6", null ], + [ "sony_tag_to_priam", "lisa__tag_8c.html#a3bc29e6102826af96f872763538f1bfe", null ], + [ "sony_tag_to_profile", "lisa__tag_8c.html#a91387b5d88d464bc4bb44622bebae995", null ] +]; \ No newline at end of file diff --git a/docs/html/lisa__tag_8c_source.html b/docs/html/lisa__tag_8c_source.html new file mode 100644 index 0000000..1ae7092 --- /dev/null +++ b/docs/html/lisa__tag_8c_source.html @@ -0,0 +1,514 @@ + + + + + + + +libaaruformat: src/lisa_tag.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
lisa_tag.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
59
+
60#include <stdint.h>
+
61
+ +
63
+
64#include <stdlib.h>
+
65
+
66#define SONY_BLOCK_NUMBER_MASK 0x07FFU
+
67#define SONY_BLOCK_VALID_FLAG 0x8000U
+
68#define SONY_BLOCK_ALLOWED_MASK (SONY_BLOCK_VALID_FLAG | SONY_BLOCK_NUMBER_MASK)
+
69
+
+
82sony_tag bytes_to_sony_tag(const uint8_t *bytes)
+
83{
+
84 sony_tag tag = {0};
+
85
+
86 tag.version = (uint16_t)(bytes[0] << 8 | bytes[1]);
+
87 tag.kind = (bytes[2] & 0xC0) >> 6;
+
88 tag.reserved = bytes[2] & 0x3F;
+
89 tag.volume = bytes[3];
+
90 tag.file_id = (int16_t)(bytes[4] << 8 | bytes[5]);
+
91 tag.rel_page = (uint16_t)(bytes[6] << 8 | bytes[7]);
+
92 const uint16_t next_raw = (uint16_t)((uint16_t)bytes[8] << 8 | bytes[9]);
+
93 const uint16_t prev_raw = (uint16_t)((uint16_t)bytes[10] << 8 | bytes[11]);
+
94
+
95 tag.next_block = next_raw & SONY_BLOCK_ALLOWED_MASK;
+
96 tag.prev_block = prev_raw & SONY_BLOCK_ALLOWED_MASK;
+
97
+
98 return tag;
+
99}
+
+
100
+
+
112priam_tag bytes_to_priam_tag(const uint8_t *bytes)
+
113{
+
114 priam_tag tag = {0};
+
115
+
116 tag.version = (uint16_t)(bytes[0] << 8 | bytes[1]);
+
117 tag.kind = (bytes[2] & 0xC0) >> 6;
+
118 tag.reserved = bytes[2] & 0x3F;
+
119 tag.volume = bytes[3];
+
120 tag.file_id = (int16_t)(bytes[4] << 8 | bytes[5]);
+
121 tag.used_bytes = (uint16_t)((bytes[6] & 0x7F) << 8 | bytes[7]);
+
122 tag.valid_chk = (bytes[6] & 0x80) != 0;
+
123 tag.abs_page = (uint32_t)(bytes[8] << 16 | bytes[9] << 8 | bytes[10]);
+
124 tag.checksum = bytes[11];
+
125 tag.rel_page = (uint16_t)(bytes[12] << 8 | bytes[13]);
+
126 tag.next_block = (uint32_t)(bytes[14] << 16 | bytes[15] << 8 | bytes[16]);
+
127 tag.prev_block = (uint32_t)(bytes[17] << 16 | bytes[18] << 8 | bytes[19]);
+
128 tag.disk_size = (uint32_t)(bytes[20] << 24 | bytes[21] << 16 | bytes[22] << 8 | bytes[23]);
+
129
+
130 return tag;
+
131}
+
+
132
+
+ +
143{
+
144 profile_tag tag = {0};
+
145
+
146 tag.version = (uint16_t)(bytes[0] << 8 | bytes[1]);
+
147 tag.kind = (bytes[2] & 0xC0) >> 6;
+
148 tag.reserved = bytes[2] & 0x3F;
+
149 tag.volume = bytes[3];
+
150 tag.file_id = (int16_t)(bytes[4] << 8 | bytes[5]);
+
151 tag.used_bytes = (uint16_t)((bytes[6] & 0x7F) << 8 | bytes[7]);
+
152 tag.valid_chk = (bytes[6] & 0x80) != 0;
+
153 tag.abs_page = (uint32_t)(bytes[8] << 16 | bytes[9] << 8 | bytes[10]);
+
154 tag.checksum = bytes[11];
+
155 tag.rel_page = (uint16_t)(bytes[12] << 8 | bytes[13]);
+
156 tag.next_block = (uint32_t)(bytes[14] << 16 | bytes[15] << 8 | bytes[16]);
+
157 tag.prev_block = (uint32_t)(bytes[17] << 16 | bytes[18] << 8 | bytes[19]);
+
158
+
159 return tag;
+
160}
+
+
161
+
+ +
174{
+
175 profile_tag profile = {0};
+
176
+
177 const uint16_t next_number = tag.next_block & SONY_BLOCK_NUMBER_MASK;
+
178 const uint16_t prev_number = tag.prev_block & SONY_BLOCK_NUMBER_MASK;
+
179
+
180 profile.file_id = tag.file_id;
+
181 profile.kind = tag.kind;
+
182 profile.reserved = tag.reserved;
+
183 profile.next_block = next_number == SONY_BLOCK_NUMBER_MASK ? 0xFFFFFFU : next_number;
+
184 profile.prev_block = prev_number == SONY_BLOCK_NUMBER_MASK ? 0xFFFFFFU : prev_number;
+
185 profile.rel_page = tag.rel_page;
+
186 profile.version = tag.version;
+
187 profile.volume = tag.volume;
+
188
+
189 return profile;
+
190}
+
+
191
+
+ +
202{
+
203 priam_tag priam = {0};
+
204
+
205 const uint16_t next_number = tag.next_block & SONY_BLOCK_NUMBER_MASK;
+
206 const uint16_t prev_number = tag.prev_block & SONY_BLOCK_NUMBER_MASK;
+
207
+
208 priam.file_id = tag.file_id;
+
209 priam.kind = tag.kind;
+
210 priam.reserved = tag.reserved;
+
211 priam.next_block = next_number == SONY_BLOCK_NUMBER_MASK ? 0xFFFFFFU : next_number;
+
212 priam.prev_block = prev_number == SONY_BLOCK_NUMBER_MASK ? 0xFFFFFFU : prev_number;
+
213 priam.rel_page = tag.rel_page;
+
214 priam.version = tag.version;
+
215 priam.volume = tag.volume;
+
216
+
217 return priam;
+
218}
+
+
219
+
+ +
229{
+
230 priam_tag priam = {0};
+
231
+
232 priam.abs_page = tag.abs_page;
+
233 priam.checksum = tag.checksum;
+
234 priam.file_id = tag.file_id;
+
235 priam.kind = tag.kind;
+
236 priam.reserved = tag.reserved;
+
237 priam.next_block = tag.next_block;
+
238 priam.prev_block = tag.prev_block;
+
239 priam.rel_page = tag.rel_page;
+
240 priam.used_bytes = tag.used_bytes;
+
241 priam.valid_chk = tag.valid_chk;
+
242 priam.version = tag.version;
+
243 priam.volume = tag.volume;
+
244
+
245 return priam;
+
246}
+
+
247
+
+ +
258{
+
259 sony_tag sony = {0};
+
260
+
261 const uint32_t next_number = tag.next_block & 0xFFFFFFU;
+
262 const uint32_t prev_number = tag.prev_block & 0xFFFFFFU;
+
263
+
264 uint16_t sony_next = (uint16_t)(next_number & SONY_BLOCK_NUMBER_MASK);
+
265 uint16_t sony_prev = (uint16_t)(prev_number & SONY_BLOCK_NUMBER_MASK);
+
266
+
267 if(next_number == 0xFFFFFFU) sony_next = SONY_BLOCK_NUMBER_MASK;
+
268 if(prev_number == 0xFFFFFFU) sony_prev = SONY_BLOCK_NUMBER_MASK;
+
269
+
270 sony.file_id = tag.file_id;
+
271 sony.kind = tag.kind;
+
272 sony.reserved = tag.reserved;
+
273 sony.next_block = sony_next;
+
274 sony.prev_block = sony_prev;
+
275 sony.rel_page = tag.rel_page;
+
276 sony.version = tag.version;
+
277 sony.volume = tag.volume;
+
278
+
279 return sony;
+
280}
+
+
281
+
+ +
292{
+
293 sony_tag sony = {0};
+
294
+
295 const uint32_t next_number = tag.next_block & 0xFFFFFFU;
+
296 const uint32_t prev_number = tag.prev_block & 0xFFFFFFU;
+
297
+
298 uint16_t sony_next = (uint16_t)(next_number & SONY_BLOCK_NUMBER_MASK);
+
299 uint16_t sony_prev = (uint16_t)(prev_number & SONY_BLOCK_NUMBER_MASK);
+
300
+
301 if(next_number == 0xFFFFFFU) sony_next = SONY_BLOCK_NUMBER_MASK;
+
302 if(prev_number == 0xFFFFFFU) sony_prev = SONY_BLOCK_NUMBER_MASK;
+
303
+
304 sony.file_id = tag.file_id;
+
305 sony.kind = tag.kind;
+
306 sony.reserved = tag.reserved;
+
307 sony.next_block = sony_next;
+
308 sony.prev_block = sony_prev;
+
309 sony.rel_page = tag.rel_page;
+
310 sony.version = tag.version;
+
311 sony.volume = tag.volume;
+
312
+
313 return sony;
+
314}
+
+
315
+
+ +
326{
+
327 profile_tag profile = {0};
+
328
+
329 profile.abs_page = tag.abs_page;
+
330 profile.checksum = tag.checksum;
+
331 profile.file_id = tag.file_id;
+
332 profile.kind = tag.kind;
+
333 profile.reserved = tag.reserved;
+
334 profile.next_block = tag.next_block;
+
335 profile.prev_block = tag.prev_block;
+
336 profile.rel_page = tag.rel_page;
+
337 profile.used_bytes = tag.used_bytes;
+
338 profile.valid_chk = tag.valid_chk;
+
339 profile.version = tag.version;
+
340 profile.volume = tag.volume;
+
341
+
342 return profile;
+
343}
+
+
344
+
+ +
358{
+
359 uint8_t *bytes = calloc(1, 20);
+
360 if(!bytes) return NULL;
+
361
+
362 const uint16_t version = tag.version;
+
363 const uint8_t volume = tag.volume;
+
364 const int16_t file_id = tag.file_id;
+
365 const uint16_t rel_page = tag.rel_page;
+
366 const uint32_t abs_page = tag.abs_page & 0xFFFFFFU;
+
367 const uint32_t next_block = tag.next_block & 0xFFFFFFU;
+
368 const uint32_t prev_block = tag.prev_block & 0xFFFFFFU;
+
369 const uint16_t used_bytes = (uint16_t)(tag.used_bytes & 0x7FFFU);
+
370 const uint8_t kind_bits = (uint8_t)(tag.kind & 0x3U);
+
371 const uint8_t reserved = (uint8_t)(tag.reserved & 0x3FU);
+
372
+
373 bytes[0] = (uint8_t)((version >> 8) & 0xFF);
+
374 bytes[1] = (uint8_t)(version & 0xFF);
+
375 bytes[2] = (uint8_t)((kind_bits << 6) | reserved);
+
376 bytes[3] = volume;
+
377 bytes[4] = (uint8_t)((file_id >> 8) & 0xFF);
+
378 bytes[5] = (uint8_t)(file_id & 0xFF);
+
379 bytes[6] = (uint8_t)((used_bytes >> 8) & 0x7F);
+
380 if(tag.valid_chk) bytes[6] |= 0x80U;
+
381 bytes[7] = (uint8_t)(used_bytes & 0xFF);
+
382 bytes[8] = (uint8_t)((abs_page >> 16) & 0xFF);
+
383 bytes[9] = (uint8_t)((abs_page >> 8) & 0xFF);
+
384 bytes[10] = (uint8_t)(abs_page & 0xFF);
+
385 bytes[11] = tag.checksum;
+
386 bytes[12] = (uint8_t)((rel_page >> 8) & 0xFF);
+
387 bytes[13] = (uint8_t)(rel_page & 0xFF);
+
388 bytes[14] = (uint8_t)((next_block >> 16) & 0xFF);
+
389 bytes[15] = (uint8_t)((next_block >> 8) & 0xFF);
+
390 bytes[16] = (uint8_t)(next_block & 0xFF);
+
391 bytes[17] = (uint8_t)((prev_block >> 16) & 0xFF);
+
392 bytes[18] = (uint8_t)((prev_block >> 8) & 0xFF);
+
393 bytes[19] = (uint8_t)(prev_block & 0xFF);
+
394
+
395 return bytes;
+
396}
+
+
397
+
+
409uint8_t *priam_tag_to_bytes(const priam_tag tag)
+
410{
+
411 uint8_t *bytes = calloc(1, 24);
+
412 if(!bytes) return NULL;
+
413
+
414 const uint16_t version = tag.version;
+
415 const uint8_t volume = tag.volume;
+
416 const int16_t file_id = tag.file_id;
+
417 const uint16_t rel_page = tag.rel_page;
+
418 const uint32_t abs_page = tag.abs_page & 0xFFFFFFU;
+
419 const uint32_t next_block = tag.next_block & 0xFFFFFFU;
+
420 const uint32_t prev_block = tag.prev_block & 0xFFFFFFU;
+
421 const uint32_t disk_size = tag.disk_size;
+
422 const uint16_t used_bytes = (uint16_t)(tag.used_bytes & 0x7FFFU);
+
423 const uint8_t kind_bits = (uint8_t)(tag.kind & 0x3U);
+
424 const uint8_t reserved = (uint8_t)(tag.reserved & 0x3FU);
+
425
+
426 bytes[0] = (uint8_t)((version >> 8) & 0xFF);
+
427 bytes[1] = (uint8_t)(version & 0xFF);
+
428 bytes[2] = (uint8_t)((kind_bits << 6) | reserved);
+
429 bytes[3] = volume;
+
430 bytes[4] = (uint8_t)((file_id >> 8) & 0xFF);
+
431 bytes[5] = (uint8_t)(file_id & 0xFF);
+
432 bytes[6] = (uint8_t)((used_bytes >> 8) & 0x7F);
+
433 if(tag.valid_chk) bytes[6] |= 0x80U;
+
434 bytes[7] = (uint8_t)(used_bytes & 0xFF);
+
435 bytes[8] = (uint8_t)((abs_page >> 16) & 0xFF);
+
436 bytes[9] = (uint8_t)((abs_page >> 8) & 0xFF);
+
437 bytes[10] = (uint8_t)(abs_page & 0xFF);
+
438 bytes[11] = tag.checksum;
+
439 bytes[12] = (uint8_t)((rel_page >> 8) & 0xFF);
+
440 bytes[13] = (uint8_t)(rel_page & 0xFF);
+
441 bytes[14] = (uint8_t)((next_block >> 16) & 0xFF);
+
442 bytes[15] = (uint8_t)((next_block >> 8) & 0xFF);
+
443 bytes[16] = (uint8_t)(next_block & 0xFF);
+
444 bytes[17] = (uint8_t)((prev_block >> 16) & 0xFF);
+
445 bytes[18] = (uint8_t)((prev_block >> 8) & 0xFF);
+
446 bytes[19] = (uint8_t)(prev_block & 0xFF);
+
447 bytes[20] = (uint8_t)((disk_size >> 24) & 0xFF);
+
448 bytes[21] = (uint8_t)((disk_size >> 16) & 0xFF);
+
449 bytes[22] = (uint8_t)((disk_size >> 8) & 0xFF);
+
450 bytes[23] = (uint8_t)(disk_size & 0xFF);
+
451
+
452 return bytes;
+
453}
+
+
454
+
+ +
467{
+
468 uint8_t *bytes = calloc(1, 12);
+
469 if(!bytes) return NULL;
+
470
+
471 const uint16_t version = tag.version;
+
472 const uint8_t volume = tag.volume;
+
473 const int16_t file_id = tag.file_id;
+
474 const uint16_t rel_page = tag.rel_page;
+
475 const uint16_t next_block = tag.next_block & SONY_BLOCK_ALLOWED_MASK;
+
476 const uint16_t prev_block = tag.prev_block & SONY_BLOCK_ALLOWED_MASK;
+
477 const uint8_t kind_bits = (uint8_t)(tag.kind & 0x3U);
+
478 const uint8_t reserved = (uint8_t)(tag.reserved & 0x3FU);
+
479
+
480 bytes[0] = (uint8_t)((version >> 8) & 0xFF);
+
481 bytes[1] = (uint8_t)(version & 0xFF);
+
482 bytes[2] = (uint8_t)((kind_bits << 6) | reserved);
+
483 bytes[3] = volume;
+
484 bytes[4] = (uint8_t)((file_id >> 8) & 0xFF);
+
485 bytes[5] = (uint8_t)(file_id & 0xFF);
+
486 bytes[6] = (uint8_t)((rel_page >> 8) & 0xFF);
+
487 bytes[7] = (uint8_t)(rel_page & 0xFF);
+
488 bytes[8] = (uint8_t)((next_block >> 8) & 0xFF);
+
489 bytes[9] = (uint8_t)(next_block & 0xFF);
+
490 bytes[10] = (uint8_t)((prev_block >> 8) & 0xFF);
+
491 bytes[11] = (uint8_t)(prev_block & 0xFF);
+
492
+
493 return bytes;
+
494}
+
+
priam_tag bytes_to_priam_tag(const uint8_t *bytes)
Parse a 24-byte Priam tag record into a priam_tag structure.
Definition lisa_tag.c:112
+
priam_tag sony_tag_to_priam(const sony_tag tag)
Convert a sony_tag to a priam_tag representation.
Definition lisa_tag.c:201
+
uint8_t * profile_tag_to_bytes(const profile_tag tag)
Serialize a profile_tag into a newly allocated 20-byte big-endian on-disk representation.
Definition lisa_tag.c:357
+
uint8_t * sony_tag_to_bytes(sony_tag tag)
Serialize a sony_tag into a newly allocated 12-byte big-endian on-disk representation.
Definition lisa_tag.c:466
+
profile_tag priam_tag_to_profile(const priam_tag tag)
Convert a priam_tag to a profile_tag.
Definition lisa_tag.c:325
+
#define SONY_BLOCK_ALLOWED_MASK
Preserve valid bit + 11-bit index.
Definition lisa_tag.c:68
+
profile_tag sony_tag_to_profile(const sony_tag tag)
Convert a sony_tag to a profile_tag representation.
Definition lisa_tag.c:173
+
sony_tag priam_tag_to_sony(const priam_tag tag)
Convert a priam_tag to a sony_tag.
Definition lisa_tag.c:291
+
sony_tag bytes_to_sony_tag(const uint8_t *bytes)
Parse a 12-byte Sony tag record into a sony_tag structure.
Definition lisa_tag.c:82
+
priam_tag profile_tag_to_priam(const profile_tag tag)
Convert a profile_tag to a priam_tag.
Definition lisa_tag.c:228
+
profile_tag bytes_to_profile_tag(const uint8_t *bytes)
Parse a 20-byte Profile tag record into a profile_tag structure.
Definition lisa_tag.c:142
+
sony_tag profile_tag_to_sony(const profile_tag tag)
Convert a profile_tag to a sony_tag.
Definition lisa_tag.c:257
+
uint8_t * priam_tag_to_bytes(const priam_tag tag)
Serialize a priam_tag into a newly allocated 24-byte big-endian on-disk representation.
Definition lisa_tag.c:409
+
#define SONY_BLOCK_NUMBER_MASK
Definition lisa_tag.c:66
+
Structure definitions and conversion/serialization function declarations for Lisa family disk tags.
+ +
uint8_t reserved
0x02 bits 5 to 0, reserved
Definition lisa_tag.h:66
+
int16_t file_id
0x04, file ID
Definition lisa_tag.h:68
+
uint32_t next_block
0x0E, 3 bytes, next block, 0xFFFFFF if it's last block
Definition lisa_tag.h:74
+
uint32_t prev_block
0x11, 3 bytes, previous block, 0xFFFFFF if it's first block
Definition lisa_tag.h:75
+
uint32_t disk_size
0x14, disk size
Definition lisa_tag.h:76
+
uint8_t checksum
0x0B, checksum of data
Definition lisa_tag.h:72
+
uint32_t abs_page
0x08, 3 bytes, absolute page number
Definition lisa_tag.h:71
+
uint8_t valid_chk
0x06 bit 7, checksum valid?
Definition lisa_tag.h:69
+
uint8_t kind
0x02 bits 7 to 6, kind of info in this block
Definition lisa_tag.h:65
+
uint16_t used_bytes
0x06 bits 6 to 0, used bytes in block
Definition lisa_tag.h:70
+
uint8_t volume
0x03, disk volume number
Definition lisa_tag.h:67
+
uint16_t version
0x00, Lisa OS version number
Definition lisa_tag.h:64
+
uint16_t rel_page
0x0C, relative page number
Definition lisa_tag.h:73
+ +
uint8_t checksum
0x0B, checksum of data
Definition lisa_tag.h:56
+
uint16_t rel_page
0x0C, relative page number
Definition lisa_tag.h:57
+
uint16_t used_bytes
0x06 bits 6 to 0, used bytes in block
Definition lisa_tag.h:54
+
uint8_t valid_chk
0x06 bit 7, checksum valid?
Definition lisa_tag.h:53
+
uint32_t abs_page
0x08, 3 bytes, absolute page number
Definition lisa_tag.h:55
+
uint8_t reserved
0x02 bits 5 to 0, reserved
Definition lisa_tag.h:50
+
uint32_t next_block
0x0E, 3 bytes, next block, 0xFFFFFF if it's last block
Definition lisa_tag.h:58
+
uint8_t volume
0x03, disk volume number
Definition lisa_tag.h:51
+
uint8_t kind
0x02 bits 7 to 6, kind of info in this block
Definition lisa_tag.h:49
+
int16_t file_id
0x04, file ID
Definition lisa_tag.h:52
+
uint16_t version
0x00, Lisa OS version number
Definition lisa_tag.h:48
+
uint32_t prev_block
0x11, 3 bytes, previous block, 0xFFFFFF if it's first block
Definition lisa_tag.h:59
+ +
uint8_t volume
0x03, disk volume number
Definition lisa_tag.h:39
+
int16_t file_id
0x04, file ID
Definition lisa_tag.h:40
+
uint16_t version
0x00, Lisa OS version number
Definition lisa_tag.h:36
+
uint16_t rel_page
0x06, relative page number
Definition lisa_tag.h:41
+
uint16_t next_block
0x08, next block, 0x7FF if it's last block, 0x8000 set if block is valid
Definition lisa_tag.h:42
+
uint8_t reserved
0x02 bits 5 to 0, reserved
Definition lisa_tag.h:38
+
uint8_t kind
0x02 bits 7 to 6, kind of info in this block
Definition lisa_tag.h:37
+
uint16_t prev_block
0x0A, previous block, 0x7FF if it's first block
Definition lisa_tag.h:43
+
+
+
+ + + + diff --git a/docs/html/lisa__tag_8h.html b/docs/html/lisa__tag_8h.html new file mode 100644 index 0000000..c168f9e --- /dev/null +++ b/docs/html/lisa__tag_8h.html @@ -0,0 +1,630 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/lisa_tag.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
lisa_tag.h File Reference
+
+
+ +

Structure definitions and conversion/serialization function declarations for Lisa family disk tags. +More...

+
#include <stdint.h>
+
+

Go to the source code of this file.

+ + + + + +

+Data Structures

struct  sony_tag
struct  profile_tag
struct  priam_tag
+ + + + +

+Typedefs

typedef struct sony_tag sony_tag
typedef struct profile_tag profile_tag
typedef struct priam_tag priam_tag
+ + + + + + + + + + + + + + + + + + + + + + + + + +

+Functions

sony_tag bytes_to_sony_tag (const uint8_t *bytes)
 Parse a 12-byte Sony tag record into a sony_tag structure.
profile_tag bytes_to_profile_tag (const uint8_t *bytes)
 Parse a 20-byte Profile tag record into a profile_tag structure.
priam_tag bytes_to_priam_tag (const uint8_t *bytes)
 Parse a 24-byte Priam tag record into a priam_tag structure.
uint8_t * sony_tag_to_bytes (sony_tag tag)
 Serialize a sony_tag into a newly allocated 12-byte big-endian on-disk representation.
uint8_t * profile_tag_to_bytes (profile_tag tag)
 Serialize a profile_tag into a newly allocated 20-byte big-endian on-disk representation.
uint8_t * priam_tag_to_bytes (priam_tag tag)
 Serialize a priam_tag into a newly allocated 24-byte big-endian on-disk representation.
profile_tag sony_tag_to_profile (sony_tag tag)
 Convert a sony_tag to a profile_tag representation.
profile_tag priam_tag_to_profile (priam_tag tag)
 Convert a priam_tag to a profile_tag.
priam_tag sony_tag_to_priam (sony_tag tag)
 Convert a sony_tag to a priam_tag representation.
priam_tag profile_tag_to_priam (profile_tag tag)
 Convert a profile_tag to a priam_tag.
sony_tag profile_tag_to_sony (profile_tag tag)
 Convert a profile_tag to a sony_tag.
sony_tag priam_tag_to_sony (priam_tag tag)
 Convert a priam_tag to a sony_tag.
+

Detailed Description

+

Structure definitions and conversion/serialization function declarations for Lisa family disk tags.

+

Provides compact C representations for on-disk tag metadata used by Sony, Profile and Priam storage devices in the Apple Lisa ecosystem. See lisa_tag.c for detailed description of field semantics and conversion rules.

+ +

Definition in file lisa_tag.h.

+

Typedef Documentation

+ +

◆ priam_tag

+ +
+
+ + + + +
typedef struct priam_tag priam_tag
+
+ +
+
+ +

◆ profile_tag

+ +
+
+ + + + +
typedef struct profile_tag profile_tag
+
+ +
+
+ +

◆ sony_tag

+ +
+
+ + + + +
typedef struct sony_tag sony_tag
+
+ +
+
+

Function Documentation

+ +

◆ bytes_to_priam_tag()

+ +
+
+ + + + + + + +
priam_tag bytes_to_priam_tag (const uint8_t * bytes)
+
+ +

Parse a 24-byte Priam tag record into a priam_tag structure.

+

Priam tags extend the Profile tag with an additional 4-byte disk_size field. This routine decodes all bit fields, separating the valid checksum flag (bit 7 of byte 6) from the 15-bit used_bytes value.

+
Parameters
+ + +
bytesPointer to at least 24 consecutive bytes containing a raw Priam tag.
+
+
+
Returns
A populated priam_tag structure.
+
Warning
Undefined behavior if bytes is NULL or shorter than 24 bytes.
+
Note
The abs_page, next_block and prev_block 24-bit values are expanded into 32-bit integers in host memory.
+ +

Definition at line 112 of file lisa_tag.c.

+ +

References priam_tag::abs_page, priam_tag::checksum, priam_tag::disk_size, priam_tag::file_id, priam_tag::kind, priam_tag::next_block, priam_tag::prev_block, priam_tag::rel_page, priam_tag::reserved, priam_tag::used_bytes, priam_tag::valid_chk, priam_tag::version, and priam_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ bytes_to_profile_tag()

+ +
+
+ + + + + + + +
profile_tag bytes_to_profile_tag (const uint8_t * bytes)
+
+ +

Parse a 20-byte Profile tag record into a profile_tag structure.

+

A Profile tag is similar to Priam but without the trailing disk_size field. Multi-byte numeric values are big-endian.

+
Parameters
+ + +
bytesPointer to at least 20 consecutive bytes containing a raw Profile tag.
+
+
+
Returns
A populated profile_tag structure.
+
Warning
Undefined behavior if bytes is NULL or shorter than 20 bytes.
+ +

Definition at line 142 of file lisa_tag.c.

+ +

References profile_tag::abs_page, profile_tag::checksum, profile_tag::file_id, profile_tag::kind, profile_tag::next_block, profile_tag::prev_block, profile_tag::rel_page, profile_tag::reserved, profile_tag::used_bytes, profile_tag::valid_chk, profile_tag::version, and profile_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ bytes_to_sony_tag()

+ +
+
+ + + + + + + +
sony_tag bytes_to_sony_tag (const uint8_t * bytes)
+
+ +

Parse a 12-byte Sony tag record into a sony_tag structure.

+

Field extraction follows the documented on-disk layout (big-endian). The next/prev block numbers are masked to 11 bits (0x7FF) since only those bits are defined in the Sony tag format. The reserved bits are preserved in the structure's reserved member for round-tripping if needed.

+
Parameters
+ + +
bytesPointer to at least 12 consecutive bytes containing a raw Sony tag as read from disk.
+
+
+
Returns
A populated sony_tag structure with host-endian integer fields.
+
Warning
Behavior is undefined if bytes is NULL or does not point to at least 12 readable bytes.
+
Note
No validation of version, kind, or chain linkage consistency is performed.
+ +

Definition at line 82 of file lisa_tag.c.

+ +

References sony_tag::file_id, sony_tag::kind, sony_tag::next_block, sony_tag::prev_block, sony_tag::rel_page, sony_tag::reserved, SONY_BLOCK_ALLOWED_MASK, sony_tag::version, and sony_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ priam_tag_to_bytes()

+ +
+
+ + + + + + + +
uint8_t * priam_tag_to_bytes (const priam_tag tag)
+
+ +

Serialize a priam_tag into a newly allocated 24-byte big-endian on-disk representation.

+

Layout matches bytes_to_priam_tag(). Includes the final 4-byte disk_size field. Packing rules for used_bytes and valid_chk mirror those used in profile_tag_to_bytes().

+
Parameters
+ + +
tagPriam tag to serialize.
+
+
+
Returns
Pointer to a 24-byte buffer, or NULL on allocation failure.
+
Return values
+ + +
NULLAllocation failure.
+
+
+
Note
Caller must free() the returned buffer.
+ +

Definition at line 409 of file lisa_tag.c.

+ +

References priam_tag::abs_page, priam_tag::checksum, priam_tag::disk_size, priam_tag::file_id, priam_tag::kind, priam_tag::next_block, priam_tag::prev_block, priam_tag::rel_page, priam_tag::reserved, priam_tag::used_bytes, priam_tag::valid_chk, priam_tag::version, and priam_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ priam_tag_to_profile()

+ +
+
+ + + + + + + +
profile_tag priam_tag_to_profile (const priam_tag tag)
+
+ +

Convert a priam_tag to a profile_tag.

+

Copies overlapping fields, omitting the Priam-specific disk_size. Useful when reusing Priam metadata in a context that expects Profile tag semantics.

+
Parameters
+ + +
tagSource Priam tag.
+
+
+
Returns
Profile tag with copied values.
+ +

Definition at line 325 of file lisa_tag.c.

+ +

References priam_tag::abs_page, profile_tag::abs_page, priam_tag::checksum, profile_tag::checksum, priam_tag::file_id, profile_tag::file_id, priam_tag::kind, profile_tag::kind, priam_tag::next_block, profile_tag::next_block, priam_tag::prev_block, profile_tag::prev_block, priam_tag::rel_page, profile_tag::rel_page, priam_tag::reserved, profile_tag::reserved, priam_tag::used_bytes, profile_tag::used_bytes, priam_tag::valid_chk, profile_tag::valid_chk, priam_tag::version, profile_tag::version, priam_tag::volume, and profile_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ priam_tag_to_sony()

+ +
+
+ + + + + + + +
sony_tag priam_tag_to_sony (const priam_tag tag)
+
+ +

Convert a priam_tag to a sony_tag.

+

See profile_tag_to_sony(); Priam-only fields (abs_page, checksum, used_bytes, valid_chk, disk_size) are discarded. 0xFFFFFF chain terminators become 0x7FF; other values are truncated to 11 bits.

+
Parameters
+ + +
tagSource Priam tag.
+
+
+
Returns
Sony tag with mapped values.
+ +

Definition at line 291 of file lisa_tag.c.

+ +

References priam_tag::file_id, sony_tag::file_id, priam_tag::kind, sony_tag::kind, priam_tag::next_block, sony_tag::next_block, priam_tag::prev_block, sony_tag::prev_block, priam_tag::rel_page, sony_tag::rel_page, priam_tag::reserved, sony_tag::reserved, SONY_BLOCK_NUMBER_MASK, priam_tag::version, sony_tag::version, priam_tag::volume, and sony_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ profile_tag_to_bytes()

+ +
+
+ + + + + + + +
uint8_t * profile_tag_to_bytes (const profile_tag tag)
+
+ +

Serialize a profile_tag into a newly allocated 20-byte big-endian on-disk representation.

+

Bit/byte packing mirrors bytes_to_profile_tag(). The 24-bit next_block, prev_block and abs_page values are written most-significant byte first. The used_bytes high 7 bits and valid_chk flag are packed into the first byte of the 16-bit used_bytes field as per on-disk layout.

+
Parameters
+ + +
tagProfile tag to serialize.
+
+
+
Returns
Pointer to a 20-byte buffer containing the serialized tag, or NULL on allocation failure.
+
Return values
+ + +
NULLAllocation failure (caller should check before use).
+
+
+
Note
Caller must free() the returned buffer.
+ +

Definition at line 357 of file lisa_tag.c.

+ +

References profile_tag::abs_page, profile_tag::checksum, profile_tag::file_id, profile_tag::kind, profile_tag::next_block, profile_tag::prev_block, profile_tag::rel_page, profile_tag::reserved, profile_tag::used_bytes, profile_tag::valid_chk, profile_tag::version, and profile_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ profile_tag_to_priam()

+ +
+
+ + + + + + + +
priam_tag profile_tag_to_priam (const profile_tag tag)
+
+
+ +

◆ profile_tag_to_sony()

+ +
+
+ + + + + + + +
sony_tag profile_tag_to_sony (const profile_tag tag)
+
+ +

Convert a profile_tag to a sony_tag.

+

Narrows 24-bit next/prev block numbers to 11 bits. A value of 0xFFFFFF (end-of-chain sentinel) is mapped back to 0x7FF. Any non-sentinel value is truncated to its lower 11 bits. Fields without Sony equivalents are dropped.

+
Parameters
+ + +
tagSource Profile tag.
+
+
+
Returns
Sony tag with mapped/narrowed values.
+ +

Definition at line 257 of file lisa_tag.c.

+ +

References profile_tag::file_id, sony_tag::file_id, profile_tag::kind, sony_tag::kind, profile_tag::next_block, sony_tag::next_block, profile_tag::prev_block, sony_tag::prev_block, profile_tag::rel_page, sony_tag::rel_page, profile_tag::reserved, sony_tag::reserved, SONY_BLOCK_NUMBER_MASK, profile_tag::version, sony_tag::version, profile_tag::volume, and sony_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ sony_tag_to_bytes()

+ +
+
+ + + + + + + +
uint8_t * sony_tag_to_bytes (sony_tag tag)
+
+ +

Serialize a sony_tag into a newly allocated 12-byte big-endian on-disk representation.

+

The next_block and prev_block fields are masked to 11 bits (0x7FF) during packing. Caller should ensure sentinel semantics are already encoded (i.e., use 0x7FF for end-of-chain) prior to calling.

+
Parameters
+ + +
tagSony tag to serialize.
+
+
+
Returns
Pointer to a 12-byte buffer, or NULL on allocation failure.
+
Return values
+ + +
NULLAllocation failure.
+
+
+
Note
Caller must free() the returned buffer.
+ +

Definition at line 466 of file lisa_tag.c.

+ +

References sony_tag::file_id, sony_tag::kind, sony_tag::next_block, sony_tag::prev_block, sony_tag::rel_page, sony_tag::reserved, SONY_BLOCK_ALLOWED_MASK, sony_tag::version, and sony_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ sony_tag_to_priam()

+ +
+
+ + + + + + + +
priam_tag sony_tag_to_priam (const sony_tag tag)
+
+ +

Convert a sony_tag to a priam_tag representation.

+

Similar to sony_tag_to_profile() but returns a Priam tag. Priam-specific fields (abs_page, checksum, used_bytes, valid_chk, disk_size, reserved) are zero-initialized. 0x7FF next/prev sentinels expand to 0xFFFFFF.

+
Parameters
+ + +
tagSource Sony tag.
+
+
+
Returns
Priam tag with mapped values.
+ +

Definition at line 201 of file lisa_tag.c.

+ +

References priam_tag::file_id, sony_tag::file_id, priam_tag::kind, sony_tag::kind, priam_tag::next_block, sony_tag::next_block, priam_tag::prev_block, sony_tag::prev_block, priam_tag::rel_page, sony_tag::rel_page, priam_tag::reserved, sony_tag::reserved, SONY_BLOCK_NUMBER_MASK, priam_tag::version, sony_tag::version, priam_tag::volume, and sony_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+ +

◆ sony_tag_to_profile()

+ +
+
+ + + + + + + +
profile_tag sony_tag_to_profile (const sony_tag tag)
+
+ +

Convert a sony_tag to a profile_tag representation.

+

Sony tags contain a reduced-width (11-bit) next/prev block. To preserve chain termination semantics, values of 0x7FF are translated to 0xFFFFFF (24-bit "no next/prev" sentinel). Other values are copied verbatim into the wider fields. Only fields common to both formats are populated; Profile-specific fields (abs_page, checksum, used_bytes, valid_chk, reserved) remain zero-initialized.

+
Parameters
+ + +
tagSource Sony tag.
+
+
+
Returns
Profile tag with mapped values.
+ +

Definition at line 173 of file lisa_tag.c.

+ +

References profile_tag::file_id, sony_tag::file_id, profile_tag::kind, sony_tag::kind, profile_tag::next_block, sony_tag::next_block, profile_tag::prev_block, sony_tag::prev_block, profile_tag::rel_page, sony_tag::rel_page, profile_tag::reserved, sony_tag::reserved, SONY_BLOCK_NUMBER_MASK, profile_tag::version, sony_tag::version, profile_tag::volume, and sony_tag::volume.

+ +

Referenced by aaruf_write_sector_long().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/lisa__tag_8h.js b/docs/html/lisa__tag_8h.js new file mode 100644 index 0000000..bd3227f --- /dev/null +++ b/docs/html/lisa__tag_8h.js @@ -0,0 +1,21 @@ +var lisa__tag_8h = +[ + [ "sony_tag", "structsony__tag.html", "structsony__tag" ], + [ "profile_tag", "structprofile__tag.html", "structprofile__tag" ], + [ "priam_tag", "structpriam__tag.html", "structpriam__tag" ], + [ "priam_tag", "lisa__tag_8h.html#a2f658323338ecdeead1d75a670021a62", null ], + [ "profile_tag", "lisa__tag_8h.html#acb5ce65ba2aeab6612c335ad843f2308", null ], + [ "sony_tag", "lisa__tag_8h.html#a23de28798b1863cd763cb654665c5f57", null ], + [ "bytes_to_priam_tag", "lisa__tag_8h.html#a37de4ed827409b7ffbae995ce49f87ce", null ], + [ "bytes_to_profile_tag", "lisa__tag_8h.html#abb08e5fe62d9c765bc130d6095e20029", null ], + [ "bytes_to_sony_tag", "lisa__tag_8h.html#aaea071654dab25283350e7e49d665f1b", null ], + [ "priam_tag_to_bytes", "lisa__tag_8h.html#a23a5645f30a45615c752f5fc4ac84c79", null ], + [ "priam_tag_to_profile", "lisa__tag_8h.html#a7c7c7b1bb52a9ce59bacb52a22ffc7aa", null ], + [ "priam_tag_to_sony", "lisa__tag_8h.html#afa2fbcaf16b547222adb47e118ee9dcb", null ], + [ "profile_tag_to_bytes", "lisa__tag_8h.html#a8072e3408e9c04743a3ba492d4bdd6fd", null ], + [ "profile_tag_to_priam", "lisa__tag_8h.html#af75fdc8589272b20f3dbd74daa97a6a3", null ], + [ "profile_tag_to_sony", "lisa__tag_8h.html#a4eab641ba44ca25b3c2c660814b10421", null ], + [ "sony_tag_to_bytes", "lisa__tag_8h.html#a5fe6bd8526b1d35a2d3a74e9bebd67f6", null ], + [ "sony_tag_to_priam", "lisa__tag_8h.html#add0ff257dc9f464cc1c9cc91ca7fbb80", null ], + [ "sony_tag_to_profile", "lisa__tag_8h.html#a83055b16bdb8bda39e129bd908eeccee", null ] +]; \ No newline at end of file diff --git a/docs/html/lisa__tag_8h_source.html b/docs/html/lisa__tag_8h_source.html new file mode 100644 index 0000000..5de8239 --- /dev/null +++ b/docs/html/lisa__tag_8h_source.html @@ -0,0 +1,248 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/lisa_tag.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
lisa_tag.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
26
+
27#ifndef LIBAARUFORMAT_LISA_TAG_H
+
28#define LIBAARUFORMAT_LISA_TAG_H
+
29
+
30#include <stdint.h>
+
31
+
32#pragma pack(push, 1)
+
33
+
+
34typedef struct sony_tag
+
35{
+
36 uint16_t version;
+
37 uint8_t kind : 2;
+
38 uint8_t reserved : 6;
+
39 uint8_t volume;
+
40 int16_t file_id;
+
41 uint16_t rel_page;
+
42 uint16_t next_block;
+
43 uint16_t prev_block;
+ +
+
45
+
+
46typedef struct profile_tag
+
47{
+
48 uint16_t version;
+
49 uint8_t kind : 2;
+
50 uint8_t reserved : 6;
+
51 uint8_t volume;
+
52 int16_t file_id;
+
53 uint8_t valid_chk : 1;
+
54 uint16_t used_bytes : 15;
+
55 uint32_t abs_page;
+
56 uint8_t checksum;
+
57 uint16_t rel_page;
+
58 uint32_t next_block;
+
59 uint32_t prev_block;
+ +
+
61
+
+
62typedef struct priam_tag
+
63{
+
64 uint16_t version;
+
65 uint8_t kind : 2;
+
66 uint8_t reserved : 6;
+
67 uint8_t volume;
+
68 int16_t file_id;
+
69 uint8_t valid_chk : 1;
+
70 uint16_t used_bytes : 15;
+
71 uint32_t abs_page;
+
72 uint8_t checksum;
+
73 uint16_t rel_page;
+
74 uint32_t next_block;
+
75 uint32_t prev_block;
+
76 uint32_t disk_size;
+ +
+
78
+
79#pragma pack(pop)
+
80
+
81sony_tag bytes_to_sony_tag(const uint8_t *bytes);
+
82profile_tag bytes_to_profile_tag(const uint8_t *bytes);
+
83priam_tag bytes_to_priam_tag(const uint8_t *bytes);
+
84uint8_t *sony_tag_to_bytes(sony_tag tag);
+ +
86uint8_t *priam_tag_to_bytes(priam_tag tag);
+
87
+ + + + + + +
94
+
95#endif // LIBAARUFORMAT_LISA_TAG_H
+
uint8_t * priam_tag_to_bytes(priam_tag tag)
Serialize a priam_tag into a newly allocated 24-byte big-endian on-disk representation.
Definition lisa_tag.c:409
+
priam_tag bytes_to_priam_tag(const uint8_t *bytes)
Parse a 24-byte Priam tag record into a priam_tag structure.
Definition lisa_tag.c:112
+
sony_tag profile_tag_to_sony(profile_tag tag)
Convert a profile_tag to a sony_tag.
Definition lisa_tag.c:257
+
uint8_t * sony_tag_to_bytes(sony_tag tag)
Serialize a sony_tag into a newly allocated 12-byte big-endian on-disk representation.
Definition lisa_tag.c:466
+
profile_tag priam_tag_to_profile(priam_tag tag)
Convert a priam_tag to a profile_tag.
Definition lisa_tag.c:325
+
uint8_t * profile_tag_to_bytes(profile_tag tag)
Serialize a profile_tag into a newly allocated 20-byte big-endian on-disk representation.
Definition lisa_tag.c:357
+
profile_tag sony_tag_to_profile(sony_tag tag)
Convert a sony_tag to a profile_tag representation.
Definition lisa_tag.c:173
+
sony_tag bytes_to_sony_tag(const uint8_t *bytes)
Parse a 12-byte Sony tag record into a sony_tag structure.
Definition lisa_tag.c:82
+
profile_tag bytes_to_profile_tag(const uint8_t *bytes)
Parse a 20-byte Profile tag record into a profile_tag structure.
Definition lisa_tag.c:142
+
priam_tag sony_tag_to_priam(sony_tag tag)
Convert a sony_tag to a priam_tag representation.
Definition lisa_tag.c:201
+
priam_tag profile_tag_to_priam(profile_tag tag)
Convert a profile_tag to a priam_tag.
Definition lisa_tag.c:228
+
sony_tag priam_tag_to_sony(priam_tag tag)
Convert a priam_tag to a sony_tag.
Definition lisa_tag.c:291
+ +
uint8_t reserved
0x02 bits 5 to 0, reserved
Definition lisa_tag.h:66
+
int16_t file_id
0x04, file ID
Definition lisa_tag.h:68
+
uint32_t next_block
0x0E, 3 bytes, next block, 0xFFFFFF if it's last block
Definition lisa_tag.h:74
+
uint32_t prev_block
0x11, 3 bytes, previous block, 0xFFFFFF if it's first block
Definition lisa_tag.h:75
+
uint32_t disk_size
0x14, disk size
Definition lisa_tag.h:76
+
uint8_t checksum
0x0B, checksum of data
Definition lisa_tag.h:72
+
uint32_t abs_page
0x08, 3 bytes, absolute page number
Definition lisa_tag.h:71
+
uint8_t valid_chk
0x06 bit 7, checksum valid?
Definition lisa_tag.h:69
+
uint8_t kind
0x02 bits 7 to 6, kind of info in this block
Definition lisa_tag.h:65
+
uint16_t used_bytes
0x06 bits 6 to 0, used bytes in block
Definition lisa_tag.h:70
+
uint8_t volume
0x03, disk volume number
Definition lisa_tag.h:67
+
uint16_t version
0x00, Lisa OS version number
Definition lisa_tag.h:64
+
uint16_t rel_page
0x0C, relative page number
Definition lisa_tag.h:73
+ +
uint8_t checksum
0x0B, checksum of data
Definition lisa_tag.h:56
+
uint16_t rel_page
0x0C, relative page number
Definition lisa_tag.h:57
+
uint16_t used_bytes
0x06 bits 6 to 0, used bytes in block
Definition lisa_tag.h:54
+
uint8_t valid_chk
0x06 bit 7, checksum valid?
Definition lisa_tag.h:53
+
uint32_t abs_page
0x08, 3 bytes, absolute page number
Definition lisa_tag.h:55
+
uint8_t reserved
0x02 bits 5 to 0, reserved
Definition lisa_tag.h:50
+
uint32_t next_block
0x0E, 3 bytes, next block, 0xFFFFFF if it's last block
Definition lisa_tag.h:58
+
uint8_t volume
0x03, disk volume number
Definition lisa_tag.h:51
+
uint8_t kind
0x02 bits 7 to 6, kind of info in this block
Definition lisa_tag.h:49
+
int16_t file_id
0x04, file ID
Definition lisa_tag.h:52
+
uint16_t version
0x00, Lisa OS version number
Definition lisa_tag.h:48
+
uint32_t prev_block
0x11, 3 bytes, previous block, 0xFFFFFF if it's first block
Definition lisa_tag.h:59
+ +
uint8_t volume
0x03, disk volume number
Definition lisa_tag.h:39
+
int16_t file_id
0x04, file ID
Definition lisa_tag.h:40
+
uint16_t version
0x00, Lisa OS version number
Definition lisa_tag.h:36
+
uint16_t rel_page
0x06, relative page number
Definition lisa_tag.h:41
+
uint16_t next_block
0x08, next block, 0x7FF if it's last block, 0x8000 set if block is valid
Definition lisa_tag.h:42
+
uint8_t reserved
0x02 bits 5 to 0, reserved
Definition lisa_tag.h:38
+
uint8_t kind
0x02 bits 7 to 6, kind of info in this block
Definition lisa_tag.h:37
+
uint16_t prev_block
0x0A, previous block, 0x7FF if it's first block
Definition lisa_tag.h:43
+
+
+
+ + + + diff --git a/docs/html/log_8h.html b/docs/html/log_8h.html new file mode 100644 index 0000000..5f3854e --- /dev/null +++ b/docs/html/log_8h.html @@ -0,0 +1,174 @@ + + + + + + + +libaaruformat: include/log.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
log.h File Reference
+
+
+
#include <stdarg.h>
+#include <stdio.h>
+
+

Go to the source code of this file.

+ + + + +

+Macros

#define TRACE(fmt, ...)
#define FATAL(fmt, ...)
+

Macro Definition Documentation

+ +

◆ FATAL

+ +
+
+ + + + + + + + + + + +
#define FATAL( fmt,
... )
+
+ +

Definition at line 40 of file log.h.

+ +

Referenced by aaruf_close(), aaruf_close_current_block(), aaruf_create(), aaruf_get_aaru_json_metadata(), aaruf_get_cicm_metadata(), aaruf_get_comments(), aaruf_get_creator(), aaruf_get_drive_firmware_revision(), aaruf_get_drive_manufacturer(), aaruf_get_drive_model(), aaruf_get_drive_serial_number(), aaruf_get_dumphw(), aaruf_get_geometry(), aaruf_get_image_info(), aaruf_get_media_barcode(), aaruf_get_media_manufacturer(), aaruf_get_media_model(), aaruf_get_media_part_number(), aaruf_get_media_sequence(), aaruf_get_media_serial_number(), aaruf_get_media_title(), aaruf_get_negative_sectors(), aaruf_get_overflow_sectors(), aaruf_get_tape_file(), aaruf_get_tape_partition(), aaruf_get_tracks(), aaruf_get_user_sectors(), aaruf_open(), aaruf_read_media_tag(), aaruf_read_sector(), aaruf_read_sector_long(), aaruf_read_sector_tag(), aaruf_read_track_sector(), aaruf_set_aaru_json_metadata(), aaruf_set_comments(), aaruf_set_creator(), aaruf_set_drive_firmware_revision(), aaruf_set_drive_manufacturer(), aaruf_set_drive_model(), aaruf_set_drive_serial_number(), aaruf_set_dumphw(), aaruf_set_geometry(), aaruf_set_media_barcode(), aaruf_set_media_manufacturer(), aaruf_set_media_model(), aaruf_set_media_part_number(), aaruf_set_media_sequence(), aaruf_set_media_serial_number(), aaruf_set_media_title(), aaruf_set_tape_file(), aaruf_set_tape_partition(), aaruf_set_tracks(), aaruf_verify_image(), aaruf_write_media_tag(), aaruf_write_sector(), aaruf_write_sector_long(), aaruf_write_sector_tag(), add_subindex_entries(), decode_ddt_entry_v1(), decode_ddt_entry_v2(), decode_ddt_multi_level_v2(), decode_ddt_single_level_v2(), process_aaru_metadata_json_block(), process_checksum_block(), process_cicm_block(), process_data_block(), process_ddt_v1(), process_ddt_v2(), process_dumphw_block(), process_geometry_block(), process_index_v1(), process_index_v2(), process_index_v3(), process_metadata_block(), process_tape_files_block(), process_tape_partitions_block(), process_tracks_block(), set_ddt_entry_v2(), set_ddt_multi_level_v2(), set_ddt_single_level_v2(), set_ddt_tape(), update_crc64_from_stream(), verify_index_v1(), verify_index_v2(), verify_index_v3(), and write_dumphw_block().

+ +
+
+ +

◆ TRACE

+ +
+
+ + + + + + + + + + + +
#define TRACE( fmt,
... )
+
+ +

Definition at line 25 of file log.h.

+ +

Referenced by aaruf_cd_lba_to_msf(), aaruf_close(), aaruf_close_current_block(), aaruf_crc64_init(), aaruf_crc64_update(), aaruf_create(), aaruf_ecc_cd_check(), aaruf_ecc_cd_init(), aaruf_ecc_cd_is_suffix_correct(), aaruf_ecc_cd_is_suffix_correct_mode2(), aaruf_ecc_cd_reconstruct(), aaruf_ecc_cd_reconstruct_prefix(), aaruf_ecc_cd_write(), aaruf_ecc_cd_write_sector(), aaruf_edc_cd_compute(), aaruf_get_aaru_json_metadata(), aaruf_get_cicm_metadata(), aaruf_get_comments(), aaruf_get_creator(), aaruf_get_drive_firmware_revision(), aaruf_get_drive_manufacturer(), aaruf_get_drive_model(), aaruf_get_drive_serial_number(), aaruf_get_dumphw(), aaruf_get_geometry(), aaruf_get_image_info(), aaruf_get_media_barcode(), aaruf_get_media_manufacturer(), aaruf_get_media_model(), aaruf_get_media_part_number(), aaruf_get_media_sequence(), aaruf_get_media_serial_number(), aaruf_get_media_title(), aaruf_get_negative_sectors(), aaruf_get_overflow_sectors(), aaruf_get_tape_file(), aaruf_get_tape_partition(), aaruf_get_tracks(), aaruf_get_user_sectors(), aaruf_open(), aaruf_read_media_tag(), aaruf_read_sector(), aaruf_read_sector_long(), aaruf_read_sector_tag(), aaruf_read_track_sector(), aaruf_set_aaru_json_metadata(), aaruf_set_comments(), aaruf_set_creator(), aaruf_set_drive_firmware_revision(), aaruf_set_drive_manufacturer(), aaruf_set_drive_model(), aaruf_set_drive_serial_number(), aaruf_set_dumphw(), aaruf_set_geometry(), aaruf_set_media_barcode(), aaruf_set_media_manufacturer(), aaruf_set_media_model(), aaruf_set_media_part_number(), aaruf_set_media_sequence(), aaruf_set_media_serial_number(), aaruf_set_media_title(), aaruf_set_tape_file(), aaruf_set_tape_partition(), aaruf_set_tracks(), aaruf_verify_image(), aaruf_write_media_tag(), aaruf_write_sector(), aaruf_write_sector_long(), aaruf_write_sector_tag(), add_subindex_entries(), decode_ddt_entry_v1(), decode_ddt_entry_v2(), decode_ddt_multi_level_v2(), decode_ddt_single_level_v2(), parse_options(), process_aaru_metadata_json_block(), process_checksum_block(), process_cicm_block(), process_data_block(), process_ddt_v1(), process_ddt_v2(), process_dumphw_block(), process_geometry_block(), process_index_v1(), process_index_v2(), process_index_v3(), process_metadata_block(), process_tape_files_block(), process_tape_partitions_block(), process_tracks_block(), read_dump_string(), set_ddt_entry_v2(), set_ddt_multi_level_v2(), set_ddt_single_level_v2(), set_ddt_tape(), verify_index_v1(), verify_index_v2(), verify_index_v3(), write_aaru_json_block(), write_cached_secondary_ddt(), write_checksum_block(), write_cicm_block(), write_dumphw_block(), write_dvd_long_sector_blocks(), write_dvd_title_key_decrypted_block(), write_geometry_block(), write_index_block(), write_media_tags(), write_metadata_block(), write_mode2_subheaders_block(), write_primary_ddt(), write_sector_prefix(), write_sector_prefix_ddt(), write_sector_subchannel(), write_sector_suffix(), write_sector_suffix_ddt(), write_single_level_ddt(), write_tape_ddt(), write_tape_file_block(), write_tape_partition_block(), and write_tracks_block().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/log_8h.js b/docs/html/log_8h.js new file mode 100644 index 0000000..ba7e975 --- /dev/null +++ b/docs/html/log_8h.js @@ -0,0 +1,5 @@ +var log_8h = +[ + [ "FATAL", "log_8h.html#a053d6037d543b84ce59308ce71d15cd1", null ], + [ "TRACE", "log_8h.html#a21cc0459b78d5f2d7bd737e5aae1278a", null ] +]; \ No newline at end of file diff --git a/docs/html/log_8h_source.html b/docs/html/log_8h_source.html new file mode 100644 index 0000000..fb39429 --- /dev/null +++ b/docs/html/log_8h_source.html @@ -0,0 +1,149 @@ + + + + + + + +libaaruformat: include/log.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
log.h
+
+
+Go to the documentation of this file.
1//
+
2// Created by claunia on 13/8/25.
+
3//
+
4
+
5#ifndef LIBAARUFORMAT_LOG_H
+
6#define LIBAARUFORMAT_LOG_H
+
7
+
8#include <stdarg.h>
+
9#include <stdio.h>
+
10
+
11// Uncomment to enable tracing
+
12// #define ENABLE_TRACE
+
13// Uncomment to use slog instead of stderr
+
14// #define USE_SLOG
+
15
+
16#ifdef ENABLE_TRACE
+
17#ifdef USE_SLOG
+
18#include "slog.h"
+
19
+
20#define TRACE(fmt, ...) slog_trace(fmt, ##__VA_ARGS__)
+
21#else
+
22#define TRACE(fmt, ...) fprintf(stderr, "[TRACE] %s:%d:%s(): " fmt "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__)
+
23#endif
+
24#else
+
25#define TRACE(fmt, ...)
+
26#endif
+
27
+
28#include <stdarg.h>
+
29#include <stdio.h>
+
30
+
31#ifdef ENABLE_FATAL
+
32#ifdef USE_SLOG
+
33#include "slog.h"
+
34
+
35#define FATAL(fmt, ...) slog_fatal(fmt, ##__VA_ARGS__)
+
36#else
+
37#define FATAL(fmt, ...) fprintf(stderr, "[FATAL] %s:%d:%s(): " fmt "\n", __FILE__, __LINE__, __func__, ##__VA_ARGS__)
+
38#endif
+
39#else
+
40#define FATAL(fmt, ...)
+
41#endif
+
42
+
43#endif // LIBAARUFORMAT_LOG_H
+
+
+
+ + + + diff --git a/docs/html/lru_8c.html b/docs/html/lru_8c.html new file mode 100644 index 0000000..26f7c16 --- /dev/null +++ b/docs/html/lru_8c.html @@ -0,0 +1,327 @@ + + + + + + + +libaaruformat: src/lru.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
lru.c File Reference
+
+
+
#include <inttypes.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <uthash.h>
+#include <aaruformat.h>
+
+

Go to the source code of this file.

+ + + + + + + + + + + +

+Functions

void * find_in_cache (struct CacheHeader *cache, const char *key)
 Finds a value in the cache by string key.
void add_to_cache (struct CacheHeader *cache, const char *key, void *value)
 Adds a value to the cache with a string key, pruning if necessary.
static __attribute__ ((always_inline))
void * find_in_cache_uint64 (struct CacheHeader *cache, const uint64_t key)
 Finds a value in the cache by uint64_t key, using string conversion.
void add_to_cache_uint64 (struct CacheHeader *cache, const uint64_t key, void *value)
 Adds a value to the cache with a uint64_t key, using string conversion.
+

Function Documentation

+ +

◆ __attribute__()

+ +
+
+ + + + + +
+ + + + + + + +
__attribute__ ((always_inline) )
+
+inlinestatic
+
+ +

Definition at line 71 of file lru.c.

+ +

References FORCE_INLINE.

+ +
+
+ +

◆ add_to_cache()

+ +
+
+ + + + + + + + + + + + + + + + +
void add_to_cache (struct CacheHeader * cache,
const char * key,
void * value )
+
+ +

Adds a value to the cache with a string key, pruning if necessary.

+

Adds a new entry to the cache. If the cache exceeds its maximum size, prunes the least recently used entry.

+
Parameters
+ + + + +
cachePointer to the cache header.
keyString key to add.
valuePointer to the value to store.
+
+
+ +

Definition at line 47 of file lru.c.

+ +

References CacheHeader::cache, CacheEntry::hh, CacheEntry::key, CacheHeader::max_items, and CacheEntry::value.

+ +

Referenced by add_to_cache_uint64().

+ +
+
+ +

◆ add_to_cache_uint64()

+ +
+
+ + + + + + + + + + + + + + + + +
void add_to_cache_uint64 (struct CacheHeader * cache,
const uint64_t key,
void * value )
+
+ +

Adds a value to the cache with a uint64_t key, using string conversion.

+

Converts the uint64_t key to a string and adds the entry to the cache.

+
Parameters
+ + + + +
cachePointer to the cache header.
key64-bit integer key to add.
valuePointer to the value to store.
+
+
+ +

Definition at line 102 of file lru.c.

+ +

References add_to_cache(), CacheEntry::key, and CacheEntry::value.

+ +

Referenced by aaruf_read_sector().

+ +
+
+ +

◆ find_in_cache()

+ +
+
+ + + + + + + + + + + +
void * find_in_cache (struct CacheHeader * cache,
const char * key )
+
+ +

Finds a value in the cache by string key.

+

Searches for a value in the cache using a string key and moves it to the front if found.

+
Parameters
+ + + +
cachePointer to the cache header.
keyString key to search for.
+
+
+
Returns
Pointer to the value if found, or NULL if not found.
+ +

Definition at line 24 of file lru.c.

+ +

References CacheHeader::cache, CacheEntry::hh, CacheEntry::key, and CacheEntry::value.

+ +

Referenced by find_in_cache_uint64().

+ +
+
+ +

◆ find_in_cache_uint64()

+ +
+
+ + + + + + + + + + + +
void * find_in_cache_uint64 (struct CacheHeader * cache,
const uint64_t key )
+
+ +

Finds a value in the cache by uint64_t key, using string conversion.

+

Converts the uint64_t key to a string and searches for the entry in the cache.

+
Parameters
+ + + +
cachePointer to the cache header.
key64-bit integer key to search for.
+
+
+
Returns
Pointer to the value if found, or NULL if not found.
+ +

Definition at line 88 of file lru.c.

+ +

References find_in_cache(), and CacheEntry::key.

+ +

Referenced by aaruf_read_sector().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/lru_8c.js b/docs/html/lru_8c.js new file mode 100644 index 0000000..1f45f8d --- /dev/null +++ b/docs/html/lru_8c.js @@ -0,0 +1,8 @@ +var lru_8c = +[ + [ "__attribute__", "lru_8c.html#a8c8313d05785802938c6d8a2a7fa3e09", null ], + [ "add_to_cache", "lru_8c.html#a962bb6b97fb208cbd8a5932afb60e680", null ], + [ "add_to_cache_uint64", "lru_8c.html#a06d1782c0ae7cb53efa1b5e0f63c5ccb", null ], + [ "find_in_cache", "lru_8c.html#ac7008173fc7e392fa825c69410920f0a", null ], + [ "find_in_cache_uint64", "lru_8c.html#af628823e6826f0d0e0aa52f96fc74f02", null ] +]; \ No newline at end of file diff --git a/docs/html/lru_8c_source.html b/docs/html/lru_8c_source.html new file mode 100644 index 0000000..c5b5aa9 --- /dev/null +++ b/docs/html/lru_8c_source.html @@ -0,0 +1,198 @@ + + + + + + + +libaaruformat: src/lru.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
lru.c
+
+
+Go to the documentation of this file.
1#include <inttypes.h>
+
2#include <stddef.h>
+
3#include <stdint.h>
+
4#include <stdlib.h>
+
5#include <string.h>
+
6#include <uthash.h>
+
7
+
8#include <aaruformat.h>
+
9
+
10// this is an example of how to do a LRU cache in C using uthash
+
11// http://uthash.sourceforge.net/
+
12// by Jehiah Czebotar 2011 - jehiah@gmail.com
+
13// this code is in the public domain http://unlicense.org/
+
14
+
+
24void *find_in_cache(struct CacheHeader *cache, const char *key)
+
25{
+
26 struct CacheEntry *entry;
+
27 HASH_FIND_STR(cache->cache, key, entry);
+
28 if(entry)
+
29 {
+
30 // remove it (so the subsequent add will throw it on the front of the list)
+
31 HASH_DELETE(hh, cache->cache, entry);
+
32 HASH_ADD_KEYPTR(hh, cache->cache, entry->key, strlen(entry->key), entry);
+
33 return entry->value;
+
34 }
+
35 return NULL;
+
36}
+
+
37
+
+
47void add_to_cache(struct CacheHeader *cache, const char *key, void *value)
+
48{
+
49 struct CacheEntry *entry;
+
50 // TODO: Is this needed or we're just losing cycles? uthash does not free the entry
+
51 entry = malloc(sizeof(struct CacheEntry));
+
52 entry->key = strdup(key);
+
53 entry->value = value;
+
54 HASH_ADD_KEYPTR(hh, cache->cache, entry->key, strlen(entry->key), entry);
+
55
+
56 // prune the cache to MAX_CACHE_SIZE
+
57 if(HASH_COUNT(cache->cache) >= cache->max_items)
+
58 {
+
59 struct CacheEntry *tmp_entry;
+
60 HASH_ITER(hh, cache->cache, entry, tmp_entry)
+
61 {
+
62 // prune the first entry (loop is based on insertion order so this deletes the oldest item)
+
63 HASH_DELETE(hh, cache->cache, entry);
+
64 free(entry->key);
+
65 free(entry);
+
66 break;
+
67 }
+
68 }
+
69}
+
+
70
+
+
71FORCE_INLINE char *uint64_to_string(const uint64_t number)
+
72{
+
73 char *char_key = malloc(17); // 16 hex digits + null terminator
+
74 if(!char_key) return NULL;
+
75 snprintf(char_key, 17, "%016" PRIX64, number);
+
76 return char_key;
+
77}
+
+
78
+
+
88void *find_in_cache_uint64(struct CacheHeader *cache, const uint64_t key)
+
89{
+
90 return find_in_cache(cache, uint64_to_string(key));
+
91}
+
+
92
+
+
102void add_to_cache_uint64(struct CacheHeader *cache, const uint64_t key, void *value)
+
103{
+
104 return add_to_cache(cache, uint64_to_string(key), value);
+
105}
+
+ +
#define FORCE_INLINE
Definition decls.h:63
+
void add_to_cache_uint64(struct CacheHeader *cache, const uint64_t key, void *value)
Adds a value to the cache with a uint64_t key, using string conversion.
Definition lru.c:102
+
void add_to_cache(struct CacheHeader *cache, const char *key, void *value)
Adds a value to the cache with a string key, pruning if necessary.
Definition lru.c:47
+
void * find_in_cache(struct CacheHeader *cache, const char *key)
Finds a value in the cache by string key.
Definition lru.c:24
+
void * find_in_cache_uint64(struct CacheHeader *cache, const uint64_t key)
Finds a value in the cache by uint64_t key, using string conversion.
Definition lru.c:88
+
Single hash entry in the in-memory cache.
Definition lru.h:27
+
void * value
Opaque value pointer associated with key (not freed automatically on eviction/clear).
Definition lru.h:29
+
UT_hash_handle hh
uthash handle linking this entry into the hash table (must remain last or per uthash docs).
Definition lru.h:30
+
char * key
Null-terminated key string (unique within the cache). May encode numeric keys.
Definition lru.h:28
+
Cache top-level descriptor encapsulating the hash table root and capacity limit.
Definition lru.h:46
+
struct CacheEntry * cache
Hash root (uthash). NULL when empty.
Definition lru.h:48
+
uint64_t max_items
Hard limit for number of entries (policy: enforce/ignore depends on implementation).
Definition lru.h:47
+
+
+
+ + + + diff --git a/docs/html/lru_8h.html b/docs/html/lru_8h.html new file mode 100644 index 0000000..55b087f --- /dev/null +++ b/docs/html/lru_8h.html @@ -0,0 +1,299 @@ + + + + + + + +libaaruformat: include/aaruformat/lru.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
lru.h File Reference
+
+
+
#include <stdint.h>
+#include <uthash.h>
+
+

Go to the source code of this file.

+ + + + + + +

+Data Structures

struct  CacheEntry
 Single hash entry in the in-memory cache. More...
struct  CacheHeader
 Cache top-level descriptor encapsulating the hash table root and capacity limit. More...
+ + + + + + + + + +

+Functions

void * find_in_cache (struct CacheHeader *cache, const char *key)
 Finds a value in the cache by string key.
void add_to_cache (struct CacheHeader *cache, const char *key, void *value)
 Adds a value to the cache with a string key, pruning if necessary.
void * find_in_cache_uint64 (struct CacheHeader *cache, uint64_t key)
 Finds a value in the cache by uint64_t key, using string conversion.
void add_to_cache_uint64 (struct CacheHeader *cache, uint64_t key, void *value)
 Adds a value to the cache with a uint64_t key, using string conversion.
+

Function Documentation

+ +

◆ add_to_cache()

+ +
+
+ + + + + + + + + + + + + + + + +
void add_to_cache (struct CacheHeader * cache,
const char * key,
void * value )
+
+ +

Adds a value to the cache with a string key, pruning if necessary.

+

Adds a new entry to the cache. If the cache exceeds its maximum size, prunes the least recently used entry.

+
Parameters
+ + + + +
cachePointer to the cache header.
keyString key to add.
valuePointer to the value to store.
+
+
+ +

Definition at line 47 of file lru.c.

+ +

References CacheHeader::cache, CacheEntry::hh, CacheEntry::key, CacheHeader::max_items, and CacheEntry::value.

+ +

Referenced by add_to_cache_uint64().

+ +
+
+ +

◆ add_to_cache_uint64()

+ +
+
+ + + + + + + + + + + + + + + + +
void add_to_cache_uint64 (struct CacheHeader * cache,
const uint64_t key,
void * value )
+
+ +

Adds a value to the cache with a uint64_t key, using string conversion.

+

Converts the uint64_t key to a string and adds the entry to the cache.

+
Parameters
+ + + + +
cachePointer to the cache header.
key64-bit integer key to add.
valuePointer to the value to store.
+
+
+ +

Definition at line 102 of file lru.c.

+ +

References add_to_cache(), CacheEntry::key, and CacheEntry::value.

+ +

Referenced by aaruf_read_sector().

+ +
+
+ +

◆ find_in_cache()

+ +
+
+ + + + + + + + + + + +
void * find_in_cache (struct CacheHeader * cache,
const char * key )
+
+ +

Finds a value in the cache by string key.

+

Searches for a value in the cache using a string key and moves it to the front if found.

+
Parameters
+ + + +
cachePointer to the cache header.
keyString key to search for.
+
+
+
Returns
Pointer to the value if found, or NULL if not found.
+ +

Definition at line 24 of file lru.c.

+ +

References CacheHeader::cache, CacheEntry::hh, CacheEntry::key, and CacheEntry::value.

+ +

Referenced by find_in_cache_uint64().

+ +
+
+ +

◆ find_in_cache_uint64()

+ +
+
+ + + + + + + + + + + +
void * find_in_cache_uint64 (struct CacheHeader * cache,
const uint64_t key )
+
+ +

Finds a value in the cache by uint64_t key, using string conversion.

+

Converts the uint64_t key to a string and searches for the entry in the cache.

+
Parameters
+ + + +
cachePointer to the cache header.
key64-bit integer key to search for.
+
+
+
Returns
Pointer to the value if found, or NULL if not found.
+ +

Definition at line 88 of file lru.c.

+ +

References find_in_cache(), and CacheEntry::key.

+ +

Referenced by aaruf_read_sector().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/lru_8h.js b/docs/html/lru_8h.js new file mode 100644 index 0000000..79cac55 --- /dev/null +++ b/docs/html/lru_8h.js @@ -0,0 +1,9 @@ +var lru_8h = +[ + [ "CacheEntry", "structCacheEntry.html", "structCacheEntry" ], + [ "CacheHeader", "structCacheHeader.html", "structCacheHeader" ], + [ "add_to_cache", "lru_8h.html#a962bb6b97fb208cbd8a5932afb60e680", null ], + [ "add_to_cache_uint64", "lru_8h.html#a0735969939ca80db3fe439ed92b787bb", null ], + [ "find_in_cache", "lru_8h.html#ac7008173fc7e392fa825c69410920f0a", null ], + [ "find_in_cache_uint64", "lru_8h.html#a8cb7ac8e057627210732ee61d2966e35", null ] +]; \ No newline at end of file diff --git a/docs/html/lru_8h_source.html b/docs/html/lru_8h_source.html new file mode 100644 index 0000000..98f941e --- /dev/null +++ b/docs/html/lru_8h_source.html @@ -0,0 +1,150 @@ + + + + + + + +libaaruformat: include/aaruformat/lru.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
lru.h
+
+
+Go to the documentation of this file.
1//
+
2// Created by claunia on 2/10/22.
+
3//
+
4
+
5#ifndef LIBAARUFORMAT_LRU_H
+
6#define LIBAARUFORMAT_LRU_H
+
7
+
8#include <stdint.h>
+
9#include <uthash.h>
+
10
+
+ +
27{
+
28 char *key;
+
29 void *value;
+
30 UT_hash_handle hh;
+
31};
+
+
32
+
+ +
46{
+
47 uint64_t max_items;
+
48 struct CacheEntry *cache;
+
49};
+
+
50
+
51void *find_in_cache(struct CacheHeader *cache, const char *key);
+
52void add_to_cache(struct CacheHeader *cache, const char *key, void *value);
+
53void *find_in_cache_uint64(struct CacheHeader *cache, uint64_t key);
+
54void add_to_cache_uint64(struct CacheHeader *cache, uint64_t key, void *value);
+
55
+
56#endif // LIBAARUFORMAT_LRU_H
+
void add_to_cache_uint64(struct CacheHeader *cache, uint64_t key, void *value)
Adds a value to the cache with a uint64_t key, using string conversion.
Definition lru.c:102
+
void * find_in_cache_uint64(struct CacheHeader *cache, uint64_t key)
Finds a value in the cache by uint64_t key, using string conversion.
Definition lru.c:88
+
void add_to_cache(struct CacheHeader *cache, const char *key, void *value)
Adds a value to the cache with a string key, pruning if necessary.
Definition lru.c:47
+
void * find_in_cache(struct CacheHeader *cache, const char *key)
Finds a value in the cache by string key.
Definition lru.c:24
+
Single hash entry in the in-memory cache.
Definition lru.h:27
+
void * value
Opaque value pointer associated with key (not freed automatically on eviction/clear).
Definition lru.h:29
+
UT_hash_handle hh
uthash handle linking this entry into the hash table (must remain last or per uthash docs).
Definition lru.h:30
+
char * key
Null-terminated key string (unique within the cache). May encode numeric keys.
Definition lru.h:28
+
Cache top-level descriptor encapsulating the hash table root and capacity limit.
Definition lru.h:46
+
struct CacheEntry * cache
Hash root (uthash). NULL when empty.
Definition lru.h:48
+
uint64_t max_items
Hard limit for number of entries (policy: enforce/ignore depends on implementation).
Definition lru.h:47
+
+
+
+ + + + diff --git a/docs/html/lzma_8c.html b/docs/html/lzma_8c.html new file mode 100644 index 0000000..e6f7883 --- /dev/null +++ b/docs/html/lzma_8c.html @@ -0,0 +1,294 @@ + + + + + + + +libaaruformat: src/compression/lzma.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
lzma.c File Reference
+
+
+
#include <stddef.h>
+#include <stdint.h>
+#include "aaruformat.h"
+#include "../../3rdparty/lzma-21.03beta/C/LzmaLib.h"
+
+

Go to the source code of this file.

+ + + + + + +

+Functions

int32_t aaruf_lzma_decode_buffer (uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, size_t *src_len, const uint8_t *props, const size_t props_size)
 Decodes an LZMA-compressed buffer.
int32_t aaruf_lzma_encode_buffer (uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, const size_t src_len, uint8_t *out_props, size_t *out_props_size, const int32_t level, const uint32_t dict_size, const int32_t lc, const int32_t lp, const int32_t pb, const int32_t fb, const int32_t num_threads)
 Encodes a buffer using LZMA compression.
+

Function Documentation

+ +

◆ aaruf_lzma_decode_buffer()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_lzma_decode_buffer (uint8_t * dst_buffer,
size_t * dst_size,
const uint8_t * src_buffer,
size_t * src_len,
const uint8_t * props,
const size_t props_size )
+
+ +

Decodes an LZMA-compressed buffer.

+

Decompresses data from the source buffer into the destination buffer using LZMA.

+
Parameters
+ + + + + + + +
dst_bufferPointer to the destination buffer.
dst_sizePointer to the size of the destination buffer; updated with the actual size.
src_bufferPointer to the source (compressed) buffer.
src_lenPointer to the size of the source buffer; updated with the actual size read.
propsPointer to the LZMA properties.
props_sizeSize of the LZMA properties.
+
+
+
Returns
0 on success, or an error code on failure.
+ +

Definition at line 39 of file lzma.c.

+ +

References AARU_CALL, and AARU_EXPORT.

+ +

Referenced by aaruf_read_sector(), decode_ddt_multi_level_v2(), process_data_block(), process_ddt_v1(), and process_ddt_v2().

+ +
+
+ +

◆ aaruf_lzma_encode_buffer()

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
int32_t aaruf_lzma_encode_buffer (uint8_t * dst_buffer,
size_t * dst_size,
const uint8_t * src_buffer,
const size_t src_len,
uint8_t * out_props,
size_t * out_props_size,
const int32_t level,
const uint32_t dict_size,
const int32_t lc,
const int32_t lp,
const int32_t pb,
const int32_t fb,
const int32_t num_threads )
+
+ +

Encodes a buffer using LZMA compression.

+

Compresses data from the source buffer into the destination buffer using LZMA.

+
Parameters
+ + + + + + + + + + + + + + +
dst_bufferPointer to the destination buffer.
dst_sizePointer to the size of the destination buffer; updated with the actual size.
src_bufferPointer to the source (uncompressed) buffer.
src_lenSize of the source buffer.
out_propsPointer to the output LZMA properties.
out_props_sizePointer to the size of the output LZMA properties.
levelCompression level.
dict_sizeDictionary size.
lcLZMA literal context bits.
lpLZMA literal position bits.
pbLZMA position bits.
fbNumber of fast bytes.
num_threadsNumber of threads to use.
+
+
+
Returns
0 on success, or an error code on failure.
+ +

Definition at line 65 of file lzma.c.

+ +

References AARU_CALL, and AARU_EXPORT.

+ +

Referenced by aaruf_close_current_block(), set_ddt_multi_level_v2(), write_cached_secondary_ddt(), write_dvd_long_sector_blocks(), write_dvd_title_key_decrypted_block(), write_media_tags(), write_mode2_subheaders_block(), write_sector_prefix(), write_sector_prefix_ddt(), write_sector_subchannel(), write_sector_suffix(), write_sector_suffix_ddt(), and write_single_level_ddt().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/lzma_8c.js b/docs/html/lzma_8c.js new file mode 100644 index 0000000..1c5dbb5 --- /dev/null +++ b/docs/html/lzma_8c.js @@ -0,0 +1,5 @@ +var lzma_8c = +[ + [ "aaruf_lzma_decode_buffer", "lzma_8c.html#acd18071ca55541977bc3cf37a5e6815d", null ], + [ "aaruf_lzma_encode_buffer", "lzma_8c.html#a9378bc542698b1f5f8c90d3b3da167b0", null ] +]; \ No newline at end of file diff --git a/docs/html/lzma_8c_source.html b/docs/html/lzma_8c_source.html new file mode 100644 index 0000000..d76c39a --- /dev/null +++ b/docs/html/lzma_8c_source.html @@ -0,0 +1,155 @@ + + + + + + + +libaaruformat: src/compression/lzma.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
lzma.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This file is part of the Aaru Data Preservation Suite.
+
3 * Copyright (c) 2019-2025 Natalia Portillo.
+
4 *
+
5 * This library is free software; you can redistribute it and/or modify
+
6 * it under the terms of the GNU Lesser General Public License as
+
7 * published by the Free Software Foundation; either version 2.1 of the
+
8 * License, or (at your option) any later version.
+
9 *
+
10 * This library is distributed in the hope that it will be useful, but
+
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
+
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+
13 * Lesser General Public License for more details.
+
14 *
+
15 * You should have received a copy of the GNU Lesser General Public
+
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+
17 */
+
18
+
19#include <stddef.h>
+
20#include <stdint.h>
+
21
+
22#include "aaruformat.h"
+
23
+
24#include "../../3rdparty/lzma-21.03beta/C/LzmaLib.h"
+
25
+
+
39AARU_EXPORT int32_t AARU_CALL aaruf_lzma_decode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer,
+
40 size_t *src_len, const uint8_t *props, const size_t props_size)
+
41{
+
42 return LzmaUncompress(dst_buffer, dst_size, src_buffer, src_len, props, props_size);
+
43}
+
+
44
+
+
65AARU_EXPORT int32_t AARU_CALL aaruf_lzma_encode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer,
+
66 const size_t src_len, uint8_t *out_props, size_t *out_props_size,
+
67 const int32_t level, const uint32_t dict_size, const int32_t lc,
+
68 const int32_t lp, const int32_t pb, const int32_t fb,
+
69 const int32_t num_threads)
+
70{
+
71 return LzmaCompress(dst_buffer, dst_size, src_buffer, src_len, out_props, out_props_size, level, dict_size, lc, lp,
+
72 pb, fb, num_threads);
+
73}
+
+ +
#define AARU_CALL
Definition decls.h:45
+
#define AARU_EXPORT
Definition decls.h:54
+
int32_t aaruf_lzma_encode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, const size_t src_len, uint8_t *out_props, size_t *out_props_size, const int32_t level, const uint32_t dict_size, const int32_t lc, const int32_t lp, const int32_t pb, const int32_t fb, const int32_t num_threads)
Encodes a buffer using LZMA compression.
Definition lzma.c:65
+
int32_t aaruf_lzma_decode_buffer(uint8_t *dst_buffer, size_t *dst_size, const uint8_t *src_buffer, size_t *src_len, const uint8_t *props, const size_t props_size)
Decodes an LZMA-compressed buffer.
Definition lzma.c:39
+
+
+
+ + + + diff --git a/docs/html/md5_8c.html b/docs/html/md5_8c.html new file mode 100644 index 0000000..e2f0aa2 --- /dev/null +++ b/docs/html/md5_8c.html @@ -0,0 +1,853 @@ + + + + + + + +libaaruformat: src/checksum/md5.c File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
md5.c File Reference
+
+
+
#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+#include "decls.h"
+#include "md5.h"
+
+

Go to the source code of this file.

+ + + + + + + + + + + + + + + + + + + + + + +

+Macros

#define AARU_RESTRICT
#define LIKELY(x)
#define UNLIKELY(x)
#define HOT
#define MD5_MAX_UNROLL   4
#define MD5_PREFETCH_DISTANCE_BLOCKS   8
#define MD5_ENABLE_PREFETCH   1
#define MD5_UNROLL8_THRESHOLD   8192UL
#define MD5_UNROLL4_THRESHOLD   2048UL
#define MD5_UNROLL2_THRESHOLD   512UL
#define F(x, y, z)
#define G(x, y, z)
#define H(x, y, z)
#define H2(x, y, z)
#define I(x, y, z)
#define ROTL32(x, s)
#define STEP(f, a, b, c, d, x, t, s)
#define SET(n)
#define GET(n)
#define OUT(dst, src)
+ + + + + + + +

+Functions

static FORCE_INLINE void md5_process_block_loaded (uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, const unsigned char *ptr)
static const void * body (md5_ctx *ctx, const void *data, unsigned long size)
void aaruf_md5_init (md5_ctx *ctx)
void aaruf_md5_update (md5_ctx *ctx, const void *data, unsigned long size)
void aaruf_md5_final (md5_ctx *ctx, unsigned char *result)
void aaruf_md5_buffer (const void *data, unsigned long size, unsigned char *result)
+

Macro Definition Documentation

+ +

◆ AARU_RESTRICT

+ +
+
+ + + + +
#define AARU_RESTRICT
+
+ +

Definition at line 49 of file md5.c.

+ +

Referenced by aaruf_md5_update(), body(), and md5_process_block_loaded().

+ +
+
+ +

◆ F

+ +
+
+ + + + + + + + + + + + + + + + +
#define F( x,
y,
z )
+
+Value:
((z) ^ ((x) & ((y) ^ (z))))
+
+

Definition at line 105 of file md5.c.

+ +

Referenced by body(), and md5_process_block_loaded().

+ +
+
+ +

◆ G

+ +
+
+ + + + + + + + + + + + + + + + +
#define G( x,
y,
z )
+
+Value:
((y) ^ ((z) & ((x) ^ (y))))
+
+

Definition at line 106 of file md5.c.

+ +

Referenced by body(), and md5_process_block_loaded().

+ +
+
+ +

◆ GET

+ +
+
+ + + + + + + +
#define GET( n)
+
+Value:
(ctx->block[(n)])
+
+

Definition at line 155 of file md5.c.

+ +

Referenced by body().

+ +
+
+ +

◆ H

+ +
+
+ + + + + + + + + + + + + + + + +
#define H( x,
y,
z )
+
+Value:
(((x) ^ (y)) ^ (z))
+
+

Definition at line 107 of file md5.c.

+ +

Referenced by body(), and md5_process_block_loaded().

+ +
+
+ +

◆ H2

+ +
+
+ + + + + + + + + + + + + + + + +
#define H2( x,
y,
z )
+
+Value:
((x) ^ ((y) ^ (z)))
+
+

Definition at line 108 of file md5.c.

+ +

Referenced by body(), and md5_process_block_loaded().

+ +
+
+ +

◆ HOT

+ +
+
+ + + + +
#define HOT
+
+ +

Definition at line 65 of file md5.c.

+ +

Referenced by body(), and md5_process_block_loaded().

+ +
+
+ +

◆ I

+ +
+
+ + + + + + + + + + + + + + + + +
#define I( x,
y,
z )
+
+Value:
((y) ^ ((x) | ~(z)))
+
+

Definition at line 109 of file md5.c.

+ +

Referenced by body(), and md5_process_block_loaded().

+ +
+
+ +

◆ LIKELY

+ +
+
+ + + + + + + +
#define LIKELY( x)
+
+Value:
(x)
+
+

Definition at line 57 of file md5.c.

+ +

Referenced by aaruf_md5_update().

+ +
+
+ +

◆ MD5_ENABLE_PREFETCH

+ +
+
+ + + + +
#define MD5_ENABLE_PREFETCH   1
+
+ +

Definition at line 75 of file md5.c.

+ +
+
+ +

◆ MD5_MAX_UNROLL

+ +
+
+ + + + +
#define MD5_MAX_UNROLL   4
+
+ +

Definition at line 69 of file md5.c.

+ +
+
+ +

◆ MD5_PREFETCH_DISTANCE_BLOCKS

+ +
+
+ + + + +
#define MD5_PREFETCH_DISTANCE_BLOCKS   8
+
+ +

Definition at line 72 of file md5.c.

+ +

Referenced by body().

+ +
+
+ +

◆ MD5_UNROLL2_THRESHOLD

+ +
+
+ + + + +
#define MD5_UNROLL2_THRESHOLD   512UL
+
+ +

Definition at line 84 of file md5.c.

+ +

Referenced by body().

+ +
+
+ +

◆ MD5_UNROLL4_THRESHOLD

+ +
+
+ + + + +
#define MD5_UNROLL4_THRESHOLD   2048UL
+
+ +

Definition at line 81 of file md5.c.

+ +

Referenced by body().

+ +
+
+ +

◆ MD5_UNROLL8_THRESHOLD

+ +
+
+ + + + +
#define MD5_UNROLL8_THRESHOLD   8192UL
+
+ +

Definition at line 78 of file md5.c.

+ +

Referenced by body().

+ +
+
+ +

◆ OUT

+ +
+
+ + + + + + + + + + + +
#define OUT( dst,
src )
+
+Value:
(dst)[0] = (unsigned char)(src); \
+
(dst)[1] = (unsigned char)((src) >> 8); \
+
(dst)[2] = (unsigned char)((src) >> 16); \
+
(dst)[3] = (unsigned char)((src) >> 24);
+
+

Definition at line 469 of file md5.c.

+ +

Referenced by aaruf_md5_final().

+ +
+
+ +

◆ ROTL32

+ +
+
+ + + + + + + + + + + +
#define ROTL32( x,
s )
+
+Value:
(((uint32_t)(x) << (s)) | ((uint32_t)(x) >> (32 - (s))))
+
+

Definition at line 122 of file md5.c.

+ +
+
+ +

◆ SET

+ +
+
+ + + + + + + +
#define SET( n)
+
+Value:
(ctx->block[(n)] = (uint32_t)ptr[(n) * 4] | ((uint32_t)ptr[(n) * 4 + 1] << 8) | \
+
((uint32_t)ptr[(n) * 4 + 2] << 16) | ((uint32_t)ptr[(n) * 4 + 3] << 24))
+
+

Definition at line 152 of file md5.c.

+ +

Referenced by body().

+ +
+
+ +

◆ STEP

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#define STEP( f,
a,
b,
c,
d,
x,
t,
s )
+
+Value:
(a) += f((b), (c), (d)) + (x) + (uint32_t)(t); \
+
(a) = ROTL32((a), (s)); \
+
(a) += (b);
+
#define ROTL32(x, s)
Definition md5.c:122
+
+

Definition at line 128 of file md5.c.

+ +

Referenced by body(), and md5_process_block_loaded().

+ +
+
+ +

◆ UNLIKELY

+ +
+
+ + + + + + + +
#define UNLIKELY( x)
+
+Value:
(x)
+
+

Definition at line 58 of file md5.c.

+ +

Referenced by aaruf_md5_update().

+ +
+
+

Function Documentation

+ +

◆ aaruf_md5_buffer()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_md5_buffer (const void * data,
unsigned long size,
unsigned char * result )
+
+ +

Definition at line 508 of file md5.c.

+ +

References AARU_CALL, AARU_EXPORT, aaruf_md5_final(), aaruf_md5_init(), and aaruf_md5_update().

+ +
+
+ +

◆ aaruf_md5_final()

+ +
+
+ + + + + + + + + + + +
void aaruf_md5_final (md5_ctx * ctx,
unsigned char * result )
+
+
+ +

◆ aaruf_md5_init()

+ +
+
+ + + + + + + +
void aaruf_md5_init (md5_ctx * ctx)
+
+ +

Definition at line 425 of file md5.c.

+ +

References md5_ctx::a, AARU_CALL, AARU_EXPORT, md5_ctx::b, md5_ctx::c, md5_ctx::d, md5_ctx::hi, and md5_ctx::lo.

+ +

Referenced by aaruf_create(), and aaruf_md5_buffer().

+ +
+
+ +

◆ aaruf_md5_update()

+ +
+
+ + + + + + + + + + + + + + + + +
void aaruf_md5_update (md5_ctx * ctx,
const void * data,
unsigned long size )
+
+
+ +

◆ body()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + +
const void * body (md5_ctx * ctx,
const void * data,
unsigned long size )
+
+static
+
+
+ +

◆ md5_process_block_loaded()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
FORCE_INLINE void md5_process_block_loaded (uint32_t * a,
uint32_t * b,
uint32_t * c,
uint32_t * d,
const unsigned char * ptr )
+
+static
+
+ +

Definition at line 162 of file md5.c.

+ +

References AARU_RESTRICT, F, FORCE_INLINE, G, H, H2, HOT, I, and STEP.

+ +

Referenced by body().

+ +
+
+
+
+ +
+ + + + diff --git a/docs/html/md5_8c.js b/docs/html/md5_8c.js new file mode 100644 index 0000000..da264fa --- /dev/null +++ b/docs/html/md5_8c.js @@ -0,0 +1,29 @@ +var md5_8c = +[ + [ "AARU_RESTRICT", "md5_8c.html#a72527e2d7597b0307a701a6954a0b19a", null ], + [ "F", "md5_8c.html#a96d73bbd7af15cb1fc38c3f4a3bd82e9", null ], + [ "G", "md5_8c.html#ad96b7cf3182ce2ba85e5a7a93b12c441", null ], + [ "GET", "md5_8c.html#a22c5b6b56a260ea33a06c9fdebed523e", null ], + [ "H", "md5_8c.html#ae42219072d798876e6b08e6b78614ff6", null ], + [ "H2", "md5_8c.html#ae9b91c8030fc9c6e383debe88f0364d7", null ], + [ "HOT", "md5_8c.html#a1eb14cc432874ddacd1934791dbe12a3", null ], + [ "I", "md5_8c.html#ac0eafdc9ee161b71e7af98af736952fd", null ], + [ "LIKELY", "md5_8c.html#affde14445f49f65ff4f5b592e44ee71a", null ], + [ "MD5_ENABLE_PREFETCH", "md5_8c.html#af30ea6c1bbf408d4ea72df2298ab5d7a", null ], + [ "MD5_MAX_UNROLL", "md5_8c.html#ac1b5b4ecd7de52e642ad5b7c0007c679", null ], + [ "MD5_PREFETCH_DISTANCE_BLOCKS", "md5_8c.html#ad0602d683f7809d7e1c3392398ae0f66", null ], + [ "MD5_UNROLL2_THRESHOLD", "md5_8c.html#ae739e733607f2d8435be6f97dda4ddea", null ], + [ "MD5_UNROLL4_THRESHOLD", "md5_8c.html#aec7e41c0dd4544869ea4f5215ef44759", null ], + [ "MD5_UNROLL8_THRESHOLD", "md5_8c.html#ad8d0e524c20add6ffb00048005c6769f", null ], + [ "OUT", "md5_8c.html#a9735ca4832fc46955e51f593d7716cc3", null ], + [ "ROTL32", "md5_8c.html#ab61aff55a4da7ead1de4cca6d2cd55a8", null ], + [ "SET", "md5_8c.html#a8be4bf419fd5ebe5cba399d782188517", null ], + [ "STEP", "md5_8c.html#a642b3a091bb90dabdf2abb865fefab69", null ], + [ "UNLIKELY", "md5_8c.html#ab10d0a221f4d7a706701b806c8135fd7", null ], + [ "aaruf_md5_buffer", "md5_8c.html#abe1156eceb456b48e92389d9f2a20601", null ], + [ "aaruf_md5_final", "md5_8c.html#a6b98055d07ba51f0daef5b03ce2fe725", null ], + [ "aaruf_md5_init", "md5_8c.html#a1e614476485ba9f46e3ac79858210f63", null ], + [ "aaruf_md5_update", "md5_8c.html#a6e19e853bea5db901de83fa2fa29055c", null ], + [ "body", "md5_8c.html#aaab33b0295f6dda99a0de3cf1faf546b", null ], + [ "md5_process_block_loaded", "md5_8c.html#a7c7db5ce587c48e8355d67dc971d5b5e", null ] +]; \ No newline at end of file diff --git a/docs/html/md5_8c_source.html b/docs/html/md5_8c_source.html new file mode 100644 index 0000000..bb40695 --- /dev/null +++ b/docs/html/md5_8c_source.html @@ -0,0 +1,674 @@ + + + + + + + +libaaruformat: src/checksum/md5.c Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
md5.c
+
+
+Go to the documentation of this file.
1/*
+
2 * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
+
3 * MD5 Message-Digest Algorithm (RFC 1321).
+
4 *
+
5 * Homepage:
+
6 * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
+
7 *
+
8 * Author:
+
9 * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
+
10 *
+
11 * This software was written by Alexander Peslyak in 2001. No copyright is
+
12 * claimed, and the software is hereby placed in the public domain.
+
13 * In case this attempt to disclaim copyright and place the software in the
+
14 * public domain is deemed null and void, then the software is
+
15 * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
+
16 * general public under the following terms:
+
17 *
+
18 * Redistribution and use in source and binary forms, with or without
+
19 * modification, are permitted.
+
20 *
+
21 * There's ABSOLUTELY NO WARRANTY, express or implied.
+
22 *
+
23 * (This is a heavily cut-down "BSD license".)
+
24 *
+
25 * This differs from Colin Plumb's older public domain implementation in that
+
26 * no exactly 32-bit integer data type is required (any 32-bit or wider
+
27 * unsigned integer data type will do), there's no compile-time endianness
+
28 * configuration, and the function prototypes match OpenSSL's. No code from
+
29 * Colin Plumb's implementation has been reused; this comment merely compares
+
30 * the properties of the two independent implementations.
+
31 *
+
32 * The primary goals of this implementation are portability and ease of use.
+
33 * It is meant to be fast, but not as fast as possible. Some known
+
34 * optimizations are not included to reduce source code size and avoid
+
35 * compile-time configuration.
+
36 */
+
37
+
38#include <stdbool.h>
+
39#include <stdio.h>
+
40#include <string.h>
+
41
+
42/* Performance helper macros */
+
43#ifndef AARU_RESTRICT
+
44#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+
45#define AARU_RESTRICT restrict
+
46#elif defined(_MSC_VER)
+
47#define AARU_RESTRICT __restrict
+
48#else
+
49#define AARU_RESTRICT
+
50#endif
+
51#endif
+
52#ifndef LIKELY
+
53#if defined(__GNUC__) || defined(__clang__)
+
54#define LIKELY(x) __builtin_expect(!!(x), 1)
+
55#define UNLIKELY(x) __builtin_expect(!!(x), 0)
+
56#else
+
57#define LIKELY(x) (x)
+
58#define UNLIKELY(x) (x)
+
59#endif
+
60#endif
+
61#ifndef HOT
+
62#if defined(__GNUC__) || defined(__clang__)
+
63#define HOT __attribute__((hot))
+
64#else
+
65#define HOT
+
66#endif
+
67#endif
+
68#ifndef MD5_MAX_UNROLL
+
69#define MD5_MAX_UNROLL 4
+
70#endif
+
71#ifndef MD5_PREFETCH_DISTANCE_BLOCKS
+
72#define MD5_PREFETCH_DISTANCE_BLOCKS 8
+
73#endif
+
74#ifndef MD5_ENABLE_PREFETCH
+
75#define MD5_ENABLE_PREFETCH 1
+
76#endif
+
77#ifndef MD5_UNROLL8_THRESHOLD
+
78#define MD5_UNROLL8_THRESHOLD 8192UL
+
79#endif
+
80#ifndef MD5_UNROLL4_THRESHOLD
+
81#define MD5_UNROLL4_THRESHOLD 2048UL
+
82#endif
+
83#ifndef MD5_UNROLL2_THRESHOLD
+
84#define MD5_UNROLL2_THRESHOLD 512UL
+
85#endif
+
86
+
87#include "decls.h"
+
88#include "md5.h"
+
89
+
90#if defined(__ARM_NEON) || defined(__ARM_NEON__)
+
91#include <arm_neon.h>
+
92#endif
+
93#if defined(__SSE2__) || defined(__AVX2__) || defined(__SSSE3__) || defined(__SSE4_1__) || defined(__x86_64__) || \
+
94 defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
+
95#include <immintrin.h>
+
96#endif
+
97
+
98/*
+
99 * The basic MD5 functions.
+
100 *
+
101 * F and G are optimized compared to their RFC 1321 definitions for
+
102 * architectures that lack an AND-NOT instruction, just like in Colin Plumb's
+
103 * implementation.
+
104 */
+
105#define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
+
106#define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y))))
+
107#define H(x, y, z) (((x) ^ (y)) ^ (z))
+
108#define H2(x, y, z) ((x) ^ ((y) ^ (z)))
+
109#define I(x, y, z) ((y) ^ ((x) | ~(z)))
+
110
+
111/* Rotate-left helper using compiler intrinsics when available */
+
112#if defined(_MSC_VER)
+
113#define ROTL32(x, s) _rotl((x), (s))
+
114#else
+
115#if defined(__has_builtin)
+
116#if __has_builtin(__builtin_rotateleft32)
+
117#define ROTL32(x, s) __builtin_rotateleft32((x), (s))
+
118#endif
+
119#endif
+
120#endif
+
121#ifndef ROTL32
+
122#define ROTL32(x, s) (((uint32_t)(x) << (s)) | ((uint32_t)(x) >> (32 - (s))))
+
123#endif
+
124
+
125/*
+
126 * The MD5 transformation for all four rounds.
+
127 */
+
+
128#define STEP(f, a, b, c, d, x, t, s) \
+
129 (a) += f((b), (c), (d)) + (x) + (uint32_t)(t); \
+
130 (a) = ROTL32((a), (s)); \
+
131 (a) += (b);
+
+
132
+
133/*
+
134 * SET reads 4 input bytes in little-endian byte order and stores them in a
+
135 * properly aligned word in host byte order.
+
136 *
+
137 * The check for little-endian architectures that tolerate unaligned memory
+
138 * accesses is just an optimization. Nothing will break if it fails to detect
+
139 * a suitable architecture.
+
140 *
+
141 * Unfortunately, this optimization may be a C strict aliasing rules violation
+
142 * if the caller's data buffer has effective type that cannot be aliased by
+
143 * uint32_t. In practice, this problem may occur if these MD5 routines are
+
144 * inlined into a calling function, or with future and dangerously advanced
+
145 * link-time optimizations. For the time being, keeping these MD5 routines in
+
146 * their own translation unit avoids the problem.
+
147 */
+
148#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
+
149#define SET(n) (*(uint32_t *)&ptr[(n) * 4])
+
150#define GET(n) SET(n)
+
151#else
+
+
152#define SET(n) \
+
153 (ctx->block[(n)] = (uint32_t)ptr[(n) * 4] | ((uint32_t)ptr[(n) * 4 + 1] << 8) | \
+
154 ((uint32_t)ptr[(n) * 4 + 2] << 16) | ((uint32_t)ptr[(n) * 4 + 3] << 24))
+
+
155#define GET(n) (ctx->block[(n)])
+
156#endif
+
157
+
158/*
+
159 * This processes one or more 64-byte data blocks, but does NOT update the bit
+
160 * counters. There are no alignment requirements.
+
161 */
+
+
162static FORCE_INLINE HOT void md5_process_block_loaded(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d,
+
163 const unsigned char * AARU_RESTRICT ptr)
+
164{
+
165 const uint32_t *wp = (const uint32_t *)ptr; // unaligned ok on supported arch (we gate optimized path)
+
166 uint32_t A = *a, B = *b, C = *c, D = *d;
+
167 uint32_t w0 = wp[0];
+
168 uint32_t w1 = wp[1];
+
169 uint32_t w2 = wp[2];
+
170 uint32_t w3 = wp[3];
+
171 uint32_t w4 = wp[4];
+
172 uint32_t w5 = wp[5];
+
173 uint32_t w6 = wp[6];
+
174 uint32_t w7 = wp[7];
+
175 uint32_t w8 = wp[8];
+
176 uint32_t w9 = wp[9];
+
177 uint32_t w10 = wp[10];
+
178 uint32_t w11 = wp[11];
+
179 uint32_t w12 = wp[12];
+
180 uint32_t w13 = wp[13];
+
181 uint32_t w14 = wp[14];
+
182 uint32_t w15 = wp[15];
+
183
+
184 uint32_t sA = A, sB = B, sC = C, sD = D;
+
185
+
186 /* Round 1 */
+
187 STEP(F, A, B, C, D, w0, 0xd76aa478, 7)
+
188 STEP(F, D, A, B, C, w1, 0xe8c7b756, 12)
+
189 STEP(F, C, D, A, B, w2, 0x242070db, 17)
+
190 STEP(F, B, C, D, A, w3, 0xc1bdceee, 22)
+
191 STEP(F, A, B, C, D, w4, 0xf57c0faf, 7)
+
192 STEP(F, D, A, B, C, w5, 0x4787c62a, 12)
+
193 STEP(F, C, D, A, B, w6, 0xa8304613, 17)
+
194 STEP(F, B, C, D, A, w7, 0xfd469501, 22)
+
195 STEP(F, A, B, C, D, w8, 0x698098d8, 7)
+
196 STEP(F, D, A, B, C, w9, 0x8b44f7af, 12)
+
197 STEP(F, C, D, A, B, w10, 0xffff5bb1, 17)
+
198 STEP(F, B, C, D, A, w11, 0x895cd7be, 22)
+
199 STEP(F, A, B, C, D, w12, 0x6b901122, 7)
+
200 STEP(F, D, A, B, C, w13, 0xfd987193, 12)
+
201 STEP(F, C, D, A, B, w14, 0xa679438e, 17)
+
202 STEP(F, B, C, D, A, w15, 0x49b40821, 22)
+
203
+
204 /* Round 2 */
+
205 STEP(G, A, B, C, D, w1, 0xf61e2562, 5)
+
206 STEP(G, D, A, B, C, w6, 0xc040b340, 9)
+
207 STEP(G, C, D, A, B, w11, 0x265e5a51, 14)
+
208 STEP(G, B, C, D, A, w0, 0xe9b6c7aa, 20)
+
209 STEP(G, A, B, C, D, w5, 0xd62f105d, 5)
+
210 STEP(G, D, A, B, C, w10, 0x02441453, 9)
+
211 STEP(G, C, D, A, B, w15, 0xd8a1e681, 14)
+
212 STEP(G, B, C, D, A, w4, 0xe7d3fbc8, 20)
+
213 STEP(G, A, B, C, D, w9, 0x21e1cde6, 5)
+
214 STEP(G, D, A, B, C, w14, 0xc33707d6, 9)
+
215 STEP(G, C, D, A, B, w3, 0xf4d50d87, 14)
+
216 STEP(G, B, C, D, A, w8, 0x455a14ed, 20)
+
217 STEP(G, A, B, C, D, w13, 0xa9e3e905, 5)
+
218 STEP(G, D, A, B, C, w2, 0xfcefa3f8, 9)
+
219 STEP(G, C, D, A, B, w7, 0x676f02d9, 14)
+
220 STEP(G, B, C, D, A, w12, 0x8d2a4c8a, 20)
+
221
+
222 /* Round 3 */
+
223 STEP(H, A, B, C, D, w5, 0xfffa3942, 4)
+
224 STEP(H2, D, A, B, C, w8, 0x8771f681, 11)
+
225 STEP(H, C, D, A, B, w11, 0x6d9d6122, 16)
+
226 STEP(H2, B, C, D, A, w14, 0xfde5380c, 23)
+
227 STEP(H, A, B, C, D, w1, 0xa4beea44, 4)
+
228 STEP(H2, D, A, B, C, w4, 0x4bdecfa9, 11)
+
229 STEP(H, C, D, A, B, w7, 0xf6bb4b60, 16)
+
230 STEP(H2, B, C, D, A, w10, 0xbebfbc70, 23)
+
231 STEP(H, A, B, C, D, w13, 0x289b7ec6, 4)
+
232 STEP(H2, D, A, B, C, w0, 0xeaa127fa, 11)
+
233 STEP(H, C, D, A, B, w3, 0xd4ef3085, 16)
+
234 STEP(H2, B, C, D, A, w6, 0x04881d05, 23)
+
235 STEP(H, A, B, C, D, w9, 0xd9d4d039, 4)
+
236 STEP(H2, D, A, B, C, w12, 0xe6db99e5, 11)
+
237 STEP(H, C, D, A, B, w15, 0x1fa27cf8, 16)
+
238 STEP(H2, B, C, D, A, w2, 0xc4ac5665, 23)
+
239
+
240 /* Round 4 */
+
241 STEP(I, A, B, C, D, w0, 0xf4292244, 6)
+
242 STEP(I, D, A, B, C, w7, 0x432aff97, 10)
+
243 STEP(I, C, D, A, B, w14, 0xab9423a7, 15)
+
244 STEP(I, B, C, D, A, w5, 0xfc93a039, 21)
+
245 STEP(I, A, B, C, D, w12, 0x655b59c3, 6)
+
246 STEP(I, D, A, B, C, w3, 0x8f0ccc92, 10)
+
247 STEP(I, C, D, A, B, w10, 0xffeff47d, 15)
+
248 STEP(I, B, C, D, A, w1, 0x85845dd1, 21)
+
249 STEP(I, A, B, C, D, w8, 0x6fa87e4f, 6)
+
250 STEP(I, D, A, B, C, w15, 0xfe2ce6e0, 10)
+
251 STEP(I, C, D, A, B, w6, 0xa3014314, 15)
+
252 STEP(I, B, C, D, A, w13, 0x4e0811a1, 21)
+
253 STEP(I, A, B, C, D, w4, 0xf7537e82, 6)
+
254 STEP(I, D, A, B, C, w11, 0xbd3af235, 10)
+
255 STEP(I, C, D, A, B, w2, 0x2ad7d2bb, 15)
+
256 STEP(I, B, C, D, A, w9, 0xeb86d391, 21)
+
257
+
258 *a = A + sA;
+
259 *b = B + sB;
+
260 *c = C + sC;
+
261 *d = D + sD;
+
262}
+
+
263
+
264/*
+
265 * This processes one or more 64-byte data blocks, but does NOT update the bit
+
266 * counters. There are no alignment requirements.
+
267 */
+
+
268static HOT const void *body(md5_ctx *ctx, const void *data, unsigned long size)
+
269{
+
270 const unsigned char * AARU_RESTRICT ptr = (const unsigned char *)data;
+
271 uint32_t a = ctx->a, b = ctx->b, c = ctx->c, d = ctx->d;
+
272
+
273#if (defined(__x86_64__) || defined(__i386__) || defined(__aarch64__)) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
+
274#if MD5_MAX_UNROLL >= 8
+
275 // 8-block unroll only if total remaining size large enough
+
276 while(size >= 512 && size >= MD5_UNROLL8_THRESHOLD)
+
277 {
+
278#if MD5_ENABLE_PREFETCH
+
279 __builtin_prefetch(ptr + 64 * (MD5_PREFETCH_DISTANCE_BLOCKS + 8), 0, 3);
+
280 __builtin_prefetch(ptr + 64 * (MD5_PREFETCH_DISTANCE_BLOCKS + 10), 0, 3);
+
281#endif
+
282 md5_process_block_loaded(&a, &b, &c, &d, ptr + 64 * 0);
+
283 md5_process_block_loaded(&a, &b, &c, &d, ptr + 64 * 1);
+
284 md5_process_block_loaded(&a, &b, &c, &d, ptr + 64 * 2);
+
285 md5_process_block_loaded(&a, &b, &c, &d, ptr + 64 * 3);
+
286 md5_process_block_loaded(&a, &b, &c, &d, ptr + 64 * 4);
+
287 md5_process_block_loaded(&a, &b, &c, &d, ptr + 64 * 5);
+
288 md5_process_block_loaded(&a, &b, &c, &d, ptr + 64 * 6);
+
289 md5_process_block_loaded(&a, &b, &c, &d, ptr + 64 * 7);
+
290 ptr += 512;
+
291 size -= 512;
+
292 }
+
293#endif
+
294 // 4-block unroll
+
295 while(size >= 256 && size >= MD5_UNROLL4_THRESHOLD)
+
296 {
+
297#if MD5_ENABLE_PREFETCH
+
298 __builtin_prefetch(ptr + 64 * (MD5_PREFETCH_DISTANCE_BLOCKS), 0, 3);
+
299 __builtin_prefetch(ptr + 64 * (MD5_PREFETCH_DISTANCE_BLOCKS + 2), 0, 3);
+
300#endif
+
301 md5_process_block_loaded(&a, &b, &c, &d, ptr);
+
302 md5_process_block_loaded(&a, &b, &c, &d, ptr + 64);
+
303 md5_process_block_loaded(&a, &b, &c, &d, ptr + 128);
+
304 md5_process_block_loaded(&a, &b, &c, &d, ptr + 192);
+
305 ptr += 256;
+
306 size -= 256;
+
307 }
+
308 // 2-block unroll
+
309 while(size >= 128 && size >= MD5_UNROLL2_THRESHOLD)
+
310 {
+
311#if MD5_ENABLE_PREFETCH
+
312 __builtin_prefetch(ptr + 64 * (MD5_PREFETCH_DISTANCE_BLOCKS - 2), 0, 3);
+
313#endif
+
314 md5_process_block_loaded(&a, &b, &c, &d, ptr);
+
315 md5_process_block_loaded(&a, &b, &c, &d, ptr + 64);
+
316 ptr += 128;
+
317 size -= 128;
+
318 }
+
319 // Single block
+
320 while(size >= 64)
+
321 {
+
322#if MD5_ENABLE_PREFETCH
+
323 if(size >= 64 * (MD5_PREFETCH_DISTANCE_BLOCKS))
+
324 {
+
325 __builtin_prefetch(ptr + 64 * (MD5_PREFETCH_DISTANCE_BLOCKS/2), 0, 3);
+
326 __builtin_prefetch(ptr + 64 * (MD5_PREFETCH_DISTANCE_BLOCKS/2 + 2), 0, 3);
+
327 }
+
328#endif
+
329 md5_process_block_loaded(&a, &b, &c, &d, ptr);
+
330 ptr += 64;
+
331 size -= 64;
+
332 }
+
333#else
+
334 // Fallback original loop
+
335 uint32_t saved_a, saved_b, saved_c, saved_d;
+
336 const unsigned char *p2 = ptr;
+
337 unsigned long sz = size;
+
338 while(sz >= 64)
+
339 {
+
340 if(sz >= 64 * 8)
+
341 {
+
342#if defined(__SSE2__) || defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || defined(_M_IX86)
+
343 __builtin_prefetch(p2 + 64 * 4, 0, 3);
+
344 __builtin_prefetch(p2 + 64 * 6, 0, 3);
+
345#elif defined(__ARM_NEON) || defined(__aarch64__) || defined(_M_ARM64) || defined(__arm__) || defined(_M_ARM)
+
346 __builtin_prefetch((const void *)(p2 + 64 * 4));
+
347 __builtin_prefetch((const void *)(p2 + 64 * 6));
+
348#endif
+
349 }
+
350 saved_a = a; saved_b = b; saved_c = c; saved_d = d;
+
351 STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
+
352 STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
+
353 STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
+
354 STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
+
355 STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
+
356 STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12)
+
357 STEP(F, c, d, a, b, SET(6), 0xa8304613, 17)
+
358 STEP(F, b, c, d, a, SET(7), 0xfd469501, 22)
+
359 STEP(F, a, b, c, d, SET(8), 0x698098d8, 7)
+
360 STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12)
+
361 STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17)
+
362 STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22)
+
363 STEP(F, a, b, c, d, SET(12), 0x6b901122, 7)
+
364 STEP(F, d, a, b, c, SET(13), 0xfd987193, 12)
+
365 STEP(F, c, d, a, b, SET(14), 0xa679438e, 17)
+
366 STEP(F, b, c, d, a, SET(15), 0x49b40821, 22)
+
367 STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5)
+
368 STEP(G, d, a, b, c, GET(6), 0xc040b340, 9)
+
369 STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14)
+
370 STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20)
+
371 STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5)
+
372 STEP(G, d, a, b, c, GET(10), 0x02441453, 9)
+
373 STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14)
+
374 STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20)
+
375 STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5)
+
376 STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9)
+
377 STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14)
+
378 STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20)
+
379 STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5)
+
380 STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9)
+
381 STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14)
+
382 STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20)
+
383 STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4)
+
384 STEP(H2, d, a, b, c, GET(8), 0x8771f681, 11)
+
385 STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16)
+
386 STEP(H2, b, c, d, a, GET(14), 0xfde5380c, 23)
+
387 STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4)
+
388 STEP(H2, d, a, b, c, GET(4), 0x4bdecfa9, 11)
+
389 STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16)
+
390 STEP(H2, b, c, d, a, GET(10), 0xbebfbc70, 23)
+
391 STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4)
+
392 STEP(H2, d, a, b, c, GET(0), 0xeaa127fa, 11)
+
393 STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16)
+
394 STEP(H2, b, c, d, a, GET(6), 0x04881d05, 23)
+
395 STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4)
+
396 STEP(H2, d, a, b, c, GET(12), 0xe6db99e5, 11)
+
397 STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16)
+
398 STEP(H2, b, c, d, a, GET(2), 0xc4ac5665, 23)
+
399 STEP(I, a, b, c, d, GET(0), 0xf4292244, 6)
+
400 STEP(I, d, a, b, c, GET(7), 0x432aff97, 10)
+
401 STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15)
+
402 STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21)
+
403 STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6)
+
404 STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10)
+
405 STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15)
+
406 STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21)
+
407 STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6)
+
408 STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10)
+
409 STEP(I, c, d, a, b, GET(6), 0xa3014314, 15)
+
410 STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21)
+
411 STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6)
+
412 STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10)
+
413 STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15)
+
414 STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21)
+
415 a += saved_a; b += saved_b; c += saved_c; d += saved_d;
+
416 p2 += 64; sz -= 64;
+
417 }
+
418 ptr = p2; size = sz;
+
419#endif
+
420
+
421 ctx->a = a; ctx->b = b; ctx->c = c; ctx->d = d;
+
422 return ptr;
+
423}
+
+
424
+
+ +
426{
+
427 ctx->a = 0x67452301;
+
428 ctx->b = 0xefcdab89;
+
429 ctx->c = 0x98badcfe;
+
430 ctx->d = 0x10325476;
+
431
+
432 ctx->lo = 0;
+
433 ctx->hi = 0;
+
434}
+
+
435
+
+
436AARU_EXPORT void AARU_CALL aaruf_md5_update(md5_ctx *ctx, const void * AARU_RESTRICT data, unsigned long size)
+
437{
+
438
+
439 const uint32_t saved_lo = ctx->lo;
+
440 if((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo) ctx->hi++;
+
441 ctx->hi += size >> 29;
+
442
+
443 const unsigned long used = saved_lo & 0x3f;
+
444
+
445 if(UNLIKELY(used))
+
446 {
+
447 unsigned long available = 64 - used;
+
448 if(size < available)
+
449 {
+
450 memcpy(&ctx->buffer[used], data, size);
+
451 return;
+
452 }
+
453 memcpy(&ctx->buffer[used], data, available);
+
454 data = (const unsigned char *)data + available;
+
455 size -= available;
+
456 body(ctx, ctx->buffer, 64);
+
457 }
+
458
+
459 if(LIKELY(size >= 64))
+
460 {
+
461 data = body(ctx, data, size & ~(unsigned long)0x3f);
+
462 size &= 0x3f;
+
463 }
+
464
+
465 if(size)
+
466 memcpy(ctx->buffer, data, size);
+
467}
+
+
468
+
+
469#define OUT(dst, src) \
+
470 (dst)[0] = (unsigned char)(src); \
+
471 (dst)[1] = (unsigned char)((src) >> 8); \
+
472 (dst)[2] = (unsigned char)((src) >> 16); \
+
473 (dst)[3] = (unsigned char)((src) >> 24);
+
+
474
+
+
475AARU_EXPORT void AARU_CALL aaruf_md5_final(md5_ctx *ctx, unsigned char *result)
+
476{
+
477
+
478 unsigned long used = ctx->lo & 0x3f;
+
479
+
480 ctx->buffer[used++] = 0x80;
+
481
+
482 unsigned long available = 64 - used;
+
483
+
484 if(available < 8)
+
485 {
+
486 memset(&ctx->buffer[used], 0, available);
+
487 body(ctx, ctx->buffer, 64);
+
488 used = 0;
+
489 available = 64;
+
490 }
+
491
+
492 memset(&ctx->buffer[used], 0, available - 8);
+
493
+
494 ctx->lo <<= 3;
+
495 OUT(&ctx->buffer[56], ctx->lo)
+
496 OUT(&ctx->buffer[60], ctx->hi)
+
497
+
498 body(ctx, ctx->buffer, 64);
+
499
+
500 OUT(&result[0], ctx->a)
+
501 OUT(&result[4], ctx->b)
+
502 OUT(&result[8], ctx->c)
+
503 OUT(&result[12], ctx->d)
+
504
+
505 memset(ctx, 0, sizeof(*ctx));
+
506}
+
+
507
+
+
508AARU_EXPORT void AARU_CALL aaruf_md5_buffer(const void *data, unsigned long size, unsigned char *result)
+
509{
+
510 md5_ctx ctx;
+
511 aaruf_md5_init(&ctx);
+
512 aaruf_md5_update(&ctx, data, size);
+
513 aaruf_md5_final(&ctx, result);
+
514}
+
+ +
#define AARU_CALL
Definition decls.h:45
+
#define AARU_EXPORT
Definition decls.h:54
+
#define FORCE_INLINE
Definition decls.h:63
+
void aaruf_md5_init(md5_ctx *ctx)
Definition md5.c:425
+
#define HOT
Definition md5.c:65
+
#define GET(n)
Definition md5.c:155
+
#define STEP(f, a, b, c, d, x, t, s)
Definition md5.c:128
+
void aaruf_md5_final(md5_ctx *ctx, unsigned char *result)
Definition md5.c:475
+
void aaruf_md5_update(md5_ctx *ctx, const void *data, unsigned long size)
Definition md5.c:436
+
#define AARU_RESTRICT
Definition md5.c:49
+
static FORCE_INLINE void md5_process_block_loaded(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, const unsigned char *ptr)
Definition md5.c:162
+
#define SET(n)
Definition md5.c:152
+
#define F(x, y, z)
Definition md5.c:105
+
#define OUT(dst, src)
Definition md5.c:469
+
static const void * body(md5_ctx *ctx, const void *data, unsigned long size)
Definition md5.c:268
+
#define UNLIKELY(x)
Definition md5.c:58
+
void aaruf_md5_buffer(const void *data, unsigned long size, unsigned char *result)
Definition md5.c:508
+
#define I(x, y, z)
Definition md5.c:109
+
#define MD5_PREFETCH_DISTANCE_BLOCKS
Definition md5.c:72
+
#define MD5_UNROLL8_THRESHOLD
Definition md5.c:78
+
#define G(x, y, z)
Definition md5.c:106
+
#define H(x, y, z)
Definition md5.c:107
+
#define MD5_UNROLL2_THRESHOLD
Definition md5.c:84
+
#define H2(x, y, z)
Definition md5.c:108
+
#define MD5_UNROLL4_THRESHOLD
Definition md5.c:81
+
#define LIKELY(x)
Definition md5.c:57
+ +
Definition md5.h:32
+
uint32_t a
Definition md5.h:34
+
uint32_t b
Definition md5.h:34
+
unsigned char buffer[64]
Definition md5.h:35
+
uint32_t d
Definition md5.h:34
+
uint32_t hi
Definition md5.h:33
+
uint32_t c
Definition md5.h:34
+
uint32_t lo
Definition md5.h:33
+
+
+
+ + + + diff --git a/docs/html/md5_8h.html b/docs/html/md5_8h.html new file mode 100644 index 0000000..54aa91e --- /dev/null +++ b/docs/html/md5_8h.html @@ -0,0 +1,121 @@ + + + + + + + +libaaruformat: include/md5.h File Reference + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
md5.h File Reference
+
+
+
#include <stdint.h>
+
+

Go to the source code of this file.

+ + + +

+Data Structures

struct  md5_ctx
+
+
+ +
+ + + + diff --git a/docs/html/md5_8h.js b/docs/html/md5_8h.js new file mode 100644 index 0000000..a6aa1c6 --- /dev/null +++ b/docs/html/md5_8h.js @@ -0,0 +1,4 @@ +var md5_8h = +[ + [ "md5_ctx", "structmd5__ctx.html", "structmd5__ctx" ] +]; \ No newline at end of file diff --git a/docs/html/md5_8h_source.html b/docs/html/md5_8h_source.html new file mode 100644 index 0000000..fe6ddef --- /dev/null +++ b/docs/html/md5_8h_source.html @@ -0,0 +1,156 @@ + + + + + + + +libaaruformat: include/md5.h Source File + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
md5.h
+
+
+Go to the documentation of this file.
1/*
+
2 * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
+
3 * MD5 Message-Digest Algorithm (RFC 1321).
+
4 *
+
5 * Homepage:
+
6 * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
+
7 *
+
8 * Author:
+
9 * Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
+
10 *
+
11 * This software was written by Alexander Peslyak in 2001. No copyright is
+
12 * claimed, and the software is hereby placed in the public domain.
+
13 * In case this attempt to disclaim copyright and place the software in the
+
14 * public domain is deemed null and void, then the software is
+
15 * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
+
16 * general public under the following terms:
+
17 *
+
18 * Redistribution and use in source and binary forms, with or without
+
19 * modification, are permitted.
+
20 *
+
21 * There's ABSOLUTELY NO WARRANTY, express or implied.
+
22 *
+
23 * See md5.c for more information.
+
24 */
+
25
+
26#ifndef LIBAARUFORMAT_MD5_H
+
27#define LIBAARUFORMAT_MD5_H
+
28
+
29#include <stdint.h>
+
30
+
+
31typedef struct
+
32{
+
33 uint32_t lo, hi;
+
34 uint32_t a, b, c, d;
+
35 unsigned char buffer[64];
+
36 uint32_t block[16];
+
37} md5_ctx;
+
+
38
+
39#endif /* LIBAARUFORMAT_MD5_H */
+
Definition md5.h:32
+
uint32_t a
Definition md5.h:34
+
uint32_t b
Definition md5.h:34
+
unsigned char buffer[64]
Definition md5.h:35
+
uint32_t block[16]
Definition md5.h:36
+
uint32_t d
Definition md5.h:34
+
uint32_t hi
Definition md5.h:33
+
uint32_t c
Definition md5.h:34
+
uint32_t lo
Definition md5.h:33
+
+
+
+ + + + diff --git a/docs/html/md_README.html b/docs/html/md_README.html new file mode 100644 index 0000000..12a7df0 --- /dev/null +++ b/docs/html/md_README.html @@ -0,0 +1,147 @@ + + + + + + + +libaaruformat: libaaruformat + + + + + + + + + + + + + + +
+
+ + + + + + +
+
libaaruformat 1.0 +
+
Aaru Data Preservation Suite - Format Library
+
+
+ + + + + + + + +
+
+ +
+
+
+ +
+
+ +
+
+ + +
+
+
+
+
+
Loading...
+
Searching...
+
No Matches
+
+
+
+
+ +
+
libaaruformat
+
+
+

+

C implementation of Aaru file format.

+

The target is to be able to compile it with a normal C (C89 compliant) compiler.

+

There are no external dependencies.

+

cmake is not a hard dependency, it's merely for the ease of using IDEs (specifically CLion).

+

Currently supported features:

    +
  • AaruFormat V1 images reading (writing will never be implemented)
  • +
  • AaruFormat V2 images reading and writing
  • +
  • LZMA compression
  • +
  • Claunia Subchannel Transform
  • +
  • Optical disc tracks
  • +
  • XML metadata retrieval (writing will never be implemented)
  • +
  • JSON metadata retrieval and writing
  • +
  • Hashing while writing (MD5, SHA1, SHA256, SpamSum and BLAKE3)
  • +
  • Deduplication
  • +
  • Tape file and partitions
  • +
  • Dump hardware lists
  • +
  • Currently on sync (as of October 2025) with Aaru's media type list
  • +
  • CHS geometry retrieval and setting
  • +
  • Metadata
  • +
  • Unit testing
  • +
  • Automatic generation of API documentation
  • +
  • It is to all effects feature parity with C#
  • +
+

Things still to be implemented that are already in the C# version:

+
    +
  • Automatic media type generation from C# enumeration
  • +
  • Nuget package for linking with Aaru
  • +
+

Things to be implemented not in the C# version (maybe):

+
    +
  • Compile for Dreamcast (KallistiOS preferibly)
  • +
  • Compile for PlayStation Portable
  • +
  • Compile for Wii
  • +
  • Compile for Wii U
  • +
  • Compile for PlayStation 2
  • +
  • Compile for PlayStation 3
  • +
  • Snapshots
  • +
  • Parent images
  • +
  • Data positioning measurements
  • +
+
+
+
+
+ + + + diff --git a/docs/html/menu.js b/docs/html/menu.js new file mode 100644 index 0000000..15f9c52 --- /dev/null +++ b/docs/html/menu.js @@ -0,0 +1,131 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ +function initMenu(relPath,searchEnabled,serverSide,searchPage,search,treeview) { + function makeTree(data,relPath) { + let result=''; + if ('children' in data) { + result+='
    '; + for (let i in data.children) { + let url; + const link = data.children[i].url; + if (link.substring(0,1)=='^') { + url = link.substring(1); + } else { + url = relPath+link; + } + result+='
  • '+ + data.children[i].text+''+ + makeTree(data.children[i],relPath)+'
  • '; + } + result+='
'; + } + return result; + } + let searchBoxHtml; + if (searchEnabled) { + if (serverSide) { + searchBoxHtml='
'+ + '
'+ + '
'+ + ''+ + '
'+ + '
'+ + '
'+ + '
'; + } else { + searchBoxHtml='
'+ + ''+ + ''+ + ''+ + ''+ + ''+ + '
'+ + '
'+ + '
'; + } + } + + $('#main-nav').before('
'+ + ''+ + ''+ + '
'); + $('#main-nav').append(makeTree(menudata,relPath)); + $('#main-nav').children(':first').addClass('sm sm-dox').attr('id','main-menu'); + $('#main-menu').append('
  • '); + const $mainMenuState = $('#main-menu-state'); + let prevWidth = 0; + if ($mainMenuState.length) { + const initResizableIfExists = function() { + if (typeof initResizable==='function') initResizable(treeview); + } + // animate mobile menu + $mainMenuState.change(function() { + const $menu = $('#main-menu'); + let options = { duration: 250, step: initResizableIfExists }; + if (this.checked) { + options['complete'] = () => $menu.css('display', 'block'); + $menu.hide().slideDown(options); + } else { + options['complete'] = () => $menu.css('display', 'none'); + $menu.show().slideUp(options); + } + }); + // set default menu visibility + const resetState = function() { + const $menu = $('#main-menu'); + const newWidth = $(window).outerWidth(); + if (newWidth!=prevWidth) { + if ($(window).outerWidth()<768) { + $mainMenuState.prop('checked',false); $menu.hide(); + $('#searchBoxPos1').html(searchBoxHtml); + $('#searchBoxPos2').hide(); + } else { + $menu.show(); + $('#searchBoxPos1').empty(); + $('#searchBoxPos2').html(searchBoxHtml); + $('#searchBoxPos2').show(); + } + if (typeof searchBox!=='undefined') { + searchBox.CloseResultsWindow(); + } + prevWidth = newWidth; + } + } + $(window).ready(function() { resetState(); initResizableIfExists(); }); + $(window).resize(resetState); + } + $('#main-menu').smartmenus(); +} +/* @license-end */ diff --git a/docs/html/menudata.js b/docs/html/menudata.js new file mode 100644 index 0000000..010e763 --- /dev/null +++ b/docs/html/menudata.js @@ -0,0 +1,183 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file +*/ +var menudata={children:[ +{text:"Main Page",url:"index.html"}, +{text:"Related Pages",url:"pages.html"}, +{text:"Topics",url:"topics.html"}, +{text:"Data Structures",url:"annotated.html",children:[ +{text:"Data Structures",url:"annotated.html"}, +{text:"Data Structure Index",url:"classes.html"}, +{text:"Data Fields",url:"functions.html",children:[ +{text:"All",url:"functions.html",children:[ +{text:"a",url:"functions.html#index_a"}, +{text:"b",url:"functions_b.html#index_b"}, +{text:"c",url:"functions_c.html#index_c"}, +{text:"d",url:"functions_d.html#index_d"}, +{text:"e",url:"functions_e.html#index_e"}, +{text:"f",url:"functions_f.html#index_f"}, +{text:"g",url:"functions_g.html#index_g"}, +{text:"h",url:"functions_h.html#index_h"}, +{text:"i",url:"functions_i.html#index_i"}, +{text:"j",url:"functions_j.html#index_j"}, +{text:"k",url:"functions_k.html#index_k"}, +{text:"l",url:"functions_l.html#index_l"}, +{text:"m",url:"functions_m.html#index_m"}, +{text:"n",url:"functions_n.html#index_n"}, +{text:"o",url:"functions_o.html#index_o"}, +{text:"p",url:"functions_p.html#index_p"}, +{text:"r",url:"functions_r.html#index_r"}, +{text:"s",url:"functions_s.html#index_s"}, +{text:"t",url:"functions_t.html#index_t"}, +{text:"u",url:"functions_u.html#index_u"}, +{text:"v",url:"functions_v.html#index_v"}, +{text:"w",url:"functions_w.html#index_w"}]}, +{text:"Variables",url:"functions_vars.html",children:[ +{text:"a",url:"functions_vars.html#index_a"}, +{text:"b",url:"functions_vars_b.html#index_b"}, +{text:"c",url:"functions_vars_c.html#index_c"}, +{text:"d",url:"functions_vars_d.html#index_d"}, +{text:"e",url:"functions_vars_e.html#index_e"}, +{text:"f",url:"functions_vars_f.html#index_f"}, +{text:"g",url:"functions_vars_g.html#index_g"}, +{text:"h",url:"functions_vars_h.html#index_h"}, +{text:"i",url:"functions_vars_i.html#index_i"}, +{text:"j",url:"functions_vars_j.html#index_j"}, +{text:"k",url:"functions_vars_k.html#index_k"}, +{text:"l",url:"functions_vars_l.html#index_l"}, +{text:"m",url:"functions_vars_m.html#index_m"}, +{text:"n",url:"functions_vars_n.html#index_n"}, +{text:"o",url:"functions_vars_o.html#index_o"}, +{text:"p",url:"functions_vars_p.html#index_p"}, +{text:"r",url:"functions_vars_r.html#index_r"}, +{text:"s",url:"functions_vars_s.html#index_s"}, +{text:"t",url:"functions_vars_t.html#index_t"}, +{text:"u",url:"functions_vars_u.html#index_u"}, +{text:"v",url:"functions_vars_v.html#index_v"}, +{text:"w",url:"functions_vars_w.html#index_w"}]}]}]}, +{text:"Files",url:"files.html",children:[ +{text:"File List",url:"files.html"}, +{text:"Globals",url:"globals.html",children:[ +{text:"All",url:"globals.html",children:[ +{text:"_",url:"globals.html#index__5F"}, +{text:"a",url:"globals_a.html#index_a"}, +{text:"b",url:"globals_b.html#index_b"}, +{text:"c",url:"globals_c.html#index_c"}, +{text:"d",url:"globals_d.html#index_d"}, +{text:"e",url:"globals_e.html#index_e"}, +{text:"f",url:"globals_f.html#index_f"}, +{text:"g",url:"globals_g.html#index_g"}, +{text:"h",url:"globals_h.html#index_h"}, +{text:"i",url:"globals_i.html#index_i"}, +{text:"j",url:"globals_j.html#index_j"}, +{text:"k",url:"globals_k.html#index_k"}, +{text:"l",url:"globals_l.html#index_l"}, +{text:"m",url:"globals_m.html#index_m"}, +{text:"n",url:"globals_n.html#index_n"}, +{text:"o",url:"globals_o.html#index_o"}, +{text:"p",url:"globals_p.html#index_p"}, +{text:"q",url:"globals_q.html#index_q"}, +{text:"r",url:"globals_r.html#index_r"}, +{text:"s",url:"globals_s.html#index_s"}, +{text:"t",url:"globals_t.html#index_t"}, +{text:"u",url:"globals_u.html#index_u"}, +{text:"v",url:"globals_v.html#index_v"}, +{text:"w",url:"globals_w.html#index_w"}, +{text:"x",url:"globals_x.html#index_x"}, +{text:"z",url:"globals_z.html#index_z"}]}, +{text:"Functions",url:"globals_func.html",children:[ +{text:"_",url:"globals_func.html#index__5F"}, +{text:"a",url:"globals_func_a.html#index_a"}, +{text:"b",url:"globals_func_b.html#index_b"}, +{text:"c",url:"globals_func_c.html#index_c"}, +{text:"d",url:"globals_func_d.html#index_d"}, +{text:"e",url:"globals_func_e.html#index_e"}, +{text:"f",url:"globals_func_f.html#index_f"}, +{text:"g",url:"globals_func_g.html#index_g"}, +{text:"i",url:"globals_func_i.html#index_i"}, +{text:"l",url:"globals_func_l.html#index_l"}, +{text:"m",url:"globals_func_m.html#index_m"}, +{text:"p",url:"globals_func_p.html#index_p"}, +{text:"r",url:"globals_func_r.html#index_r"}, +{text:"s",url:"globals_func_s.html#index_s"}, +{text:"u",url:"globals_func_u.html#index_u"}, +{text:"v",url:"globals_func_v.html#index_v"}, +{text:"w",url:"globals_func_w.html#index_w"}]}, +{text:"Variables",url:"globals_vars.html"}, +{text:"Typedefs",url:"globals_type.html",children:[ +{text:"a",url:"globals_type.html#index_a"}, +{text:"b",url:"globals_type.html#index_b"}, +{text:"c",url:"globals_type.html#index_c"}, +{text:"d",url:"globals_type.html#index_d"}, +{text:"g",url:"globals_type.html#index_g"}, +{text:"i",url:"globals_type.html#index_i"}, +{text:"m",url:"globals_type.html#index_m"}, +{text:"p",url:"globals_type.html#index_p"}, +{text:"s",url:"globals_type.html#index_s"}, +{text:"t",url:"globals_type.html#index_t"}]}, +{text:"Enumerations",url:"globals_enum.html"}, +{text:"Enumerator",url:"globals_eval.html",children:[ +{text:"a",url:"globals_eval.html#index_a"}, +{text:"b",url:"globals_eval_b.html#index_b"}, +{text:"c",url:"globals_eval_c.html#index_c"}, +{text:"d",url:"globals_eval_d.html#index_d"}, +{text:"e",url:"globals_eval_e.html#index_e"}, +{text:"f",url:"globals_eval_f.html#index_f"}, +{text:"g",url:"globals_eval_g.html#index_g"}, +{text:"h",url:"globals_eval_h.html#index_h"}, +{text:"i",url:"globals_eval_i.html#index_i"}, +{text:"j",url:"globals_eval_j.html#index_j"}, +{text:"l",url:"globals_eval_l.html#index_l"}, +{text:"m",url:"globals_eval_m.html#index_m"}, +{text:"n",url:"globals_eval_n.html#index_n"}, +{text:"o",url:"globals_eval_o.html#index_o"}, +{text:"p",url:"globals_eval_p.html#index_p"}, +{text:"q",url:"globals_eval_q.html#index_q"}, +{text:"r",url:"globals_eval_r.html#index_r"}, +{text:"s",url:"globals_eval_s.html#index_s"}, +{text:"t",url:"globals_eval_t.html#index_t"}, +{text:"u",url:"globals_eval_u.html#index_u"}, +{text:"v",url:"globals_eval_v.html#index_v"}, +{text:"w",url:"globals_eval_w.html#index_w"}, +{text:"x",url:"globals_eval_x.html#index_x"}, +{text:"z",url:"globals_eval_z.html#index_z"}]}, +{text:"Macros",url:"globals_defs.html",children:[ +{text:"a",url:"globals_defs.html#index_a"}, +{text:"b",url:"globals_defs.html#index_b"}, +{text:"c",url:"globals_defs.html#index_c"}, +{text:"d",url:"globals_defs.html#index_d"}, +{text:"e",url:"globals_defs.html#index_e"}, +{text:"f",url:"globals_defs.html#index_f"}, +{text:"g",url:"globals_defs.html#index_g"}, +{text:"h",url:"globals_defs.html#index_h"}, +{text:"i",url:"globals_defs.html#index_i"}, +{text:"l",url:"globals_defs.html#index_l"}, +{text:"m",url:"globals_defs.html#index_m"}, +{text:"n",url:"globals_defs.html#index_n"}, +{text:"o",url:"globals_defs.html#index_o"}, +{text:"r",url:"globals_defs.html#index_r"}, +{text:"s",url:"globals_defs.html#index_s"}, +{text:"t",url:"globals_defs.html#index_t"}, +{text:"u",url:"globals_defs.html#index_u"}, +{text:"v",url:"globals_defs.html#index_v"}]}]}]}]} diff --git a/docs/html/metadata_8c.html b/docs/html/metadata_8c.html new file mode 100644 index 0000000..c69235e --- /dev/null +++ b/docs/html/metadata_8c.html @@ -0,0 +1,3405 @@ + + + + + + + +libaaruformat: src/metadata.c File Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    libaaruformat 1.0 +
    +
    Aaru Data Preservation Suite - Format Library
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    metadata.c File Reference
    +
    +
    +
    #include <stddef.h>
    +#include <stdint.h>
    +#include "aaruformat.h"
    +#include "log.h"
    +
    +

    Go to the source code of this file.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    +Functions

    int32_t aaruf_get_geometry (const void *context, uint32_t *cylinders, uint32_t *heads, uint32_t *sectors_per_track)
     Retrieves the logical CHS geometry from the AaruFormat image.
    int32_t aaruf_set_geometry (void *context, const uint32_t cylinders, const uint32_t heads, const uint32_t sectors_per_track)
     Sets the logical CHS geometry for the AaruFormat image.
    int32_t aaruf_set_media_sequence (void *context, const int32_t sequence, const int32_t last_sequence)
     Sets the media sequence information for multi-volume media sets.
    int32_t aaruf_set_creator (void *context, const uint8_t *data, const int32_t length)
     Sets the creator (person/operator) information for the image.
    int32_t aaruf_set_comments (void *context, const uint8_t *data, const int32_t length)
     Sets user comments or notes for the image.
    int32_t aaruf_set_media_title (void *context, const uint8_t *data, const int32_t length)
     Sets the media title or label for the image.
    int32_t aaruf_set_media_manufacturer (void *context, const uint8_t *data, const int32_t length)
     Sets the media manufacturer information for the image.
    int32_t aaruf_set_media_model (void *context, const uint8_t *data, const int32_t length)
     Sets the media model or product designation for the image.
    int32_t aaruf_set_media_serial_number (void *context, const uint8_t *data, const int32_t length)
     Sets the media serial number for the image.
    int32_t aaruf_set_media_barcode (void *context, const uint8_t *data, const int32_t length)
     Sets the media barcode information for the image.
    int32_t aaruf_set_media_part_number (void *context, const uint8_t *data, const int32_t length)
     Sets the media part number or model designation for the image.
    int32_t aaruf_set_drive_manufacturer (void *context, const uint8_t *data, const int32_t length)
     Sets the drive manufacturer information for the image.
    int32_t aaruf_set_drive_model (void *context, const uint8_t *data, const int32_t length)
     Sets the drive model information for the image.
    int32_t aaruf_set_drive_serial_number (void *context, const uint8_t *data, const int32_t length)
     Sets the drive serial number for the image.
    int32_t aaruf_set_drive_firmware_revision (void *context, const uint8_t *data, const int32_t length)
     Sets the drive firmware revision for the image.
    int32_t aaruf_get_cicm_metadata (const void *context, uint8_t *buffer, size_t *length)
     Retrieves the embedded CICM XML metadata sidecar from the image.
    int32_t aaruf_get_aaru_json_metadata (const void *context, uint8_t *buffer, size_t *length)
     Retrieves the embedded Aaru metadata JSON from the image.
    int32_t aaruf_set_aaru_json_metadata (void *context, uint8_t *data, size_t length)
     Sets the Aaru metadata JSON for the image during creation.
    int32_t aaruf_get_media_sequence (const void *context, int32_t *sequence, int32_t *last_sequence)
     Retrieves the media sequence metadata for multi-volume image sets.
    int32_t aaruf_get_creator (const void *context, uint8_t *buffer, int32_t *length)
     Retrieves the recorded creator (operator) name from the MetadataBlock.
    int32_t aaruf_get_comments (const void *context, uint8_t *buffer, int32_t *length)
     Retrieves the user comments or notes stored in the MetadataBlock.
    int32_t aaruf_get_media_title (const void *context, uint8_t *buffer, int32_t *length)
     Retrieves the media title or label captured during image creation.
    int32_t aaruf_get_media_manufacturer (const void *context, uint8_t *buffer, int32_t *length)
     Retrieves the recorded media manufacturer name.
    int32_t aaruf_get_media_model (const void *context, uint8_t *buffer, int32_t *length)
     Retrieves the media model or product designation metadata.
    int32_t aaruf_get_media_serial_number (const void *context, uint8_t *buffer, int32_t *length)
     Retrieves the media serial number recorded in the image metadata.
    int32_t aaruf_get_media_barcode (const void *context, uint8_t *buffer, int32_t *length)
     Retrieves the barcode assigned to the physical media or its packaging.
    int32_t aaruf_get_media_part_number (const void *context, uint8_t *buffer, int32_t *length)
     Retrieves the media part number recorded in the MetadataBlock.
    int32_t aaruf_get_drive_manufacturer (const void *context, uint8_t *buffer, int32_t *length)
     Retrieves the drive manufacturer metadata captured during imaging.
    int32_t aaruf_get_drive_model (const void *context, uint8_t *buffer, int32_t *length)
     Retrieves the device model information for the imaging drive.
    int32_t aaruf_get_drive_serial_number (const void *context, uint8_t *buffer, int32_t *length)
     Retrieves the imaging drive's serial number metadata.
    int32_t aaruf_get_drive_firmware_revision (const void *context, uint8_t *buffer, int32_t *length)
     Retrieves the firmware revision metadata for the imaging drive.
    int32_t aaruf_get_user_sectors (const void *context, uint64_t *sectors)
     Retrieves the total number of user-accessible sectors in the AaruFormat image.
    int32_t aaruf_get_negative_sectors (const void *context, uint16_t *sectors)
     Retrieves the number of negative (pre-gap) sectors in the AaruFormat image.
    int32_t aaruf_get_overflow_sectors (const void *context, uint16_t *sectors)
     Retrieves the number of overflow (post-gap) sectors in the AaruFormat image.
    int32_t aaruf_get_image_info (const void *context, ImageInfo *image_info)
     Retrieves a deep copy of the ImageInfo structure from the AaruFormat image.
    +

    Function Documentation

    + +

    ◆ aaruf_get_aaru_json_metadata()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_aaru_json_metadata (const void * context,
    uint8_t * buffer,
    size_t * length )
    +
    + +

    Retrieves the embedded Aaru metadata JSON from the image.

    +

    Aaru metadata JSON is a structured metadata format that provides machine-readable, comprehensive information about the image, media, imaging session details, hardware configuration, optical disc tracks and sessions, checksums, and preservation metadata. This function extracts the raw JSON payload that was embedded in the AaruFormat image during creation. The JSON data is preserved in its original form without parsing or interpretation by the library, allowing callers to process the structured metadata using standard JSON parsing libraries.

    +

    This function supports a two-call pattern for buffer size determination:

      +
    1. First call with a buffer that may be too small returns AARUF_ERROR_BUFFER_TOO_SMALL and sets *length to the required size
    2. +
    3. Second call with a properly sized buffer retrieves the actual data
    4. +
    +

    Alternatively, if the caller already knows the buffer is large enough, a single call will succeed and populate the buffer with the Aaru JSON data.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, opened image context).
    bufferPointer to a buffer that will receive the Aaru metadata JSON. Must be large enough to hold the entire JSON payload (at least *length bytes on input). The buffer will contain raw UTF-8 encoded JSON data on success.
    lengthPointer to a size_t that serves dual purpose:
      +
    • On input: size of the provided buffer in bytes
    • +
    • On output: actual size of the Aaru metadata JSON in bytes If the function returns AARUF_ERROR_BUFFER_TOO_SMALL, this will be updated to contain the required buffer size for a subsequent successful call.
    • +
    +
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully retrieved Aaru metadata JSON. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The Aaru JSON block is present in the image (identifier == AaruMetadataJsonBlock)
    • +
    • The provided buffer is large enough (>= required length)
    • +
    • The Aaru JSON data is successfully copied to the buffer
    • +
    • The *length parameter is set to the actual size of the JSON data
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_open() or aaruf_create()
    • +
    +
    AARUF_ERROR_CANNOT_READ_BLOCK(-6) The Aaru JSON block is not present. This occurs when:
      +
    • The image was created without Aaru metadata JSON
    • +
    • ctx->jsonBlock is NULL (no data loaded)
    • +
    • ctx->jsonBlockHeader.length is 0 (empty metadata)
    • +
    • ctx->jsonBlockHeader.identifier doesn't equal AaruMetadataJsonBlock
    • +
    • The Aaru JSON block was not found during image opening
    • +
    • The *length output parameter is set to 0 to indicate no data available
    • +
    +
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer is insufficient. This occurs when:
      +
    • The input *length is less than ctx->jsonBlockHeader.length
    • +
    • The *length parameter is updated to contain the required buffer size
    • +
    • No data is copied to the buffer
    • +
    • The caller should allocate a larger buffer and call again
    • +
    +
    +
    +
    +
    Note
    Aaru JSON Format and Encoding:
      +
    • The JSON payload is stored in UTF-8 encoding
    • +
    • The payload may or may not be null-terminated
    • +
    • The library treats the JSON as opaque binary data
    • +
    • No JSON parsing, interpretation, or validation is performed by libaaruformat
    • +
    • JSON schema validation and parsing are the caller's responsibility
    • +
    +
    +
    +Aaru Metadata JSON Purpose:
      +
    • Provides machine-readable structured metadata using modern JSON format
    • +
    • Includes comprehensive information about media, sessions, tracks, and checksums
    • +
    • Enables programmatic access to metadata without XML parsing overhead
    • +
    • Documents imaging session details, hardware configuration, and preservation data
    • +
    • Used by Aaru and compatible tools for metadata exchange and analysis
    • +
    • Complements or serves as alternative to CICM XML metadata
    • +
    +
    +
    +Buffer Size Handling:
      +
    • First call with insufficient buffer returns required size in *length
    • +
    • Caller allocates properly sized buffer based on returned length
    • +
    • Second call with adequate buffer retrieves the actual JSON data
    • +
    • Single call succeeds if buffer is already large enough
    • +
    +
    +
    +Data Availability:
      +
    • Aaru JSON blocks are optional in AaruFormat images
    • +
    • Not all images will contain Aaru metadata JSON
    • +
    • The presence of JSON data depends on how the image was created
    • +
    • Check return value to handle missing metadata gracefully
    • +
    • Images may contain CICM XML, Aaru JSON, both, or neither
    • +
    +
    +
    +Distinction from CICM XML:
      +
    • CICM XML follows the Canary Islands Computer Museum schema (older format)
    • +
    • Aaru JSON follows the Aaru-specific metadata schema (newer format)
    • +
    • Both can coexist in the same image file
    • +
    • Aaru JSON may provide more detailed or different metadata than CICM XML
    • +
    • Different tools and workflows may prefer one format over the other
    • +
    +
    +
    Warning
    This function reads from the in-memory Aaru JSON block loaded during aaruf_open(). It does not perform file I/O operations. The entire JSON is kept in memory for the lifetime of the context.
    +
    +The buffer parameter must be valid and large enough to hold the JSON data. Passing a buffer smaller than the required size will result in AARUF_ERROR_BUFFER_TOO_SMALL with no partial data copied.
    +
    +This function does not validate JSON syntax or schema. Corrupted JSON data will be retrieved successfully and errors will only be detected when attempting to parse.
    +
    See also
    AaruMetadataJsonBlockHeader for the on-disk structure definition.
    +
    +aaruf_get_cicm_metadata() for retrieving CICM XML metadata.
    +
    +process_aaru_metadata_json_block() for the loading process during image opening.
    + +

    Definition at line 2099 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, AaruMetadataJsonBlock, FATAL, AaruMetadataJsonBlockHeader::identifier, aaruformat_context::json_block, aaruformat_context::json_block_header, AaruMetadataJsonBlockHeader::length, aaruformat_context::magic, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_cicm_metadata()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_cicm_metadata (const void * context,
    uint8_t * buffer,
    size_t * length )
    +
    + +

    Retrieves the embedded CICM XML metadata sidecar from the image.

    +

    CICM (Canary Islands Computer Museum) XML is a standardized metadata format used for documenting preservation and archival information about media and disk images. This function extracts the raw CICM XML payload that was embedded in the AaruFormat image during creation. The XML data is preserved in its original form without parsing, interpretation, or validation by the library. The metadata typically includes detailed information about the physical media, imaging process, checksums, device information, and preservation metadata following the CICM schema.

    +

    This function supports a two-call pattern for buffer size determination:

      +
    1. First call with a buffer that may be too small returns AARUF_ERROR_BUFFER_TOO_SMALL and sets *length to the required size
    2. +
    3. Second call with a properly sized buffer retrieves the actual data
    4. +
    +

    Alternatively, if the caller already knows the buffer is large enough, a single call will succeed and populate the buffer with the CICM XML data.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, opened image context).
    bufferPointer to a buffer that will receive the CICM XML metadata. Must be large enough to hold the entire XML payload (at least *length bytes on input). The buffer will contain raw UTF-8 encoded XML data on success.
    lengthPointer to a size_t that serves dual purpose:
      +
    • On input: size of the provided buffer in bytes
    • +
    • On output: actual size of the CICM XML metadata in bytes If the function returns AARUF_ERROR_BUFFER_TOO_SMALL, this will be updated to contain the required buffer size for a subsequent successful call.
    • +
    +
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully retrieved CICM XML metadata. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The CICM block is present in the image (identifier == CicmBlock)
    • +
    • The provided buffer is large enough (>= required length)
    • +
    • The CICM XML data is successfully copied to the buffer
    • +
    • The *length parameter is set to the actual size of the XML data
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_open() or aaruf_create()
    • +
    +
    AARUF_ERROR_CANNOT_READ_BLOCK(-6) The CICM block is not present. This occurs when:
      +
    • The image was created without CICM XML metadata
    • +
    • ctx->cicmBlock is NULL (no data loaded)
    • +
    • ctx->cicmBlockHeader.length is 0 (empty metadata)
    • +
    • ctx->cicmBlockHeader.identifier doesn't equal CicmBlock
    • +
    • The CICM block was not found during image opening
    • +
    • The *length output parameter is set to 0 to indicate no data available
    • +
    +
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer is insufficient. This occurs when:
      +
    • The input *length is less than ctx->cicmBlockHeader.length
    • +
    • The *length parameter is updated to contain the required buffer size
    • +
    • No data is copied to the buffer
    • +
    • The caller should allocate a larger buffer and call again
    • +
    +
    +
    +
    +
    Note
    CICM XML Format:
      +
    • The XML is stored in UTF-8 encoding
    • +
    • The payload may or may not be null-terminated
    • +
    • The library treats the XML as opaque binary data
    • +
    • No XML parsing, interpretation, or validation is performed by libaaruformat
    • +
    • Schema validation and XML processing are the caller's responsibility
    • +
    +
    +
    +CICM Metadata Purpose:
      +
    • Developed by the Canary Islands Computer Museum for digital preservation
    • +
    • Documents comprehensive preservation metadata
    • +
    • Includes checksums for data integrity verification
    • +
    • Records detailed device and media information
    • +
    • Supports archival and long-term preservation requirements
    • +
    • Provides standardized metadata for digital preservation workflows
    • +
    • Used by cultural heritage institutions and archives
    • +
    +
    +
    +Buffer Size Handling:
      +
    • First call with insufficient buffer returns required size in *length
    • +
    • Caller allocates properly sized buffer based on returned length
    • +
    • Second call with adequate buffer retrieves the actual XML data
    • +
    • Single call succeeds if buffer is already large enough
    • +
    +
    +
    +Data Availability:
      +
    • CICM blocks are optional in AaruFormat images
    • +
    • Not all images will contain CICM metadata
    • +
    • The presence of CICM data depends on how the image was created
    • +
    • Check return value to handle missing metadata gracefully
    • +
    +
    +
    Warning
    The XML data may contain sensitive information about the imaging environment, personnel, locations, or media content. Handle appropriately for your use case.
    +
    +This function reads from the in-memory CICM block loaded during aaruf_open(). It does not perform file I/O operations. The entire CICM XML is kept in memory for the lifetime of the context.
    +
    +The buffer parameter must be valid and large enough to hold the XML data. Passing a buffer smaller than the required size will result in AARUF_ERROR_BUFFER_TOO_SMALL with no partial data copied.
    +
    See also
    CicmMetadataBlock for the on-disk structure definition.
    +
    +aaruf_set_cicm_metadata() for embedding CICM XML during image creation.
    + +

    Definition at line 1944 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::cicm_block, aaruformat_context::cicm_block_header, CicmBlock, FATAL, CicmMetadataBlock::identifier, CicmMetadataBlock::length, aaruformat_context::magic, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_comments()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_comments (const void * context,
    uint8_t * buffer,
    int32_t * length )
    +
    + +

    Retrieves the user comments or notes stored in the MetadataBlock.

    +

    Provides access to the UTF-16LE encoded comments associated with the image. Comments are often used for provenance notes, imaging details, or curator remarks. The function follows the same two-call buffer sizing pattern used by other metadata retrieval APIs: the caller may probe the required size before allocating memory.

    +
    Parameters
    + + + + +
    contextPointer to a valid aaruformat context opened with aaruf_open() or aaruf_create().
    bufferDestination buffer that receives the comments data. May be NULL when probing size.
    lengthPointer to an int32_t. On input it contains the size of buffer in bytes; on output it is updated with the actual comments length.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Comments were available and copied successfully.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid or not a libaaruformat context.
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) No comments metadata exists in the image.
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The supplied buffer was too small. *length is updated with the required size and no data is copied.
    +
    +
    +
    Note
    Comments are stored exactly as provided during image creation and may include multi-line text or other control characters. No validation or normalization is applied by the library.
    + +

    Definition at line 2476 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::comments, MetadataBlockHeader::commentsLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_creator()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_creator (const void * context,
    uint8_t * buffer,
    int32_t * length )
    +
    + +

    Retrieves the recorded creator (operator) name from the MetadataBlock.

    +

    Copies the UTF-16LE encoded creator string that identifies the person or operator who created the image. The function supports the common two-call pattern: the caller first determines the required buffer size by passing a buffer that may be NULL or too small, then allocates sufficient memory and calls again to obtain the actual data. On success the buffer contains an opaque UTF-16LE string of length *length bytes (not null-terminated).

    +
    Parameters
    + + + + +
    contextPointer to a valid aaruformat context opened for reading or writing.
    bufferPointer to the destination buffer that will receive the creator string. May be NULL to query the required size.
    lengthPointer to an int32_t that on input specifies the size of buffer in bytes and on output receives the actual length of the creator metadata.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) The creator string was copied successfully.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is NULL or not an aaruformat context.
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) Creator metadata has not been recorded in the image.
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer was insufficient; *length contains the required size and no data was copied.
    +
    +
    +
    Note
    The returned data is UTF-16LE encoded and may contain embedded null characters. Callers should treat it as an opaque byte array unless they explicitly handle UTF-16LE strings.
    +
    +The function does not allocate memory. Callers are responsible for ensuring buffer is large enough before requesting the data.
    + +

    Definition at line 2404 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::creator, MetadataBlockHeader::creatorLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_drive_firmware_revision()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_drive_firmware_revision (const void * context,
    uint8_t * buffer,
    int32_t * length )
    +
    + +

    Retrieves the firmware revision metadata for the imaging drive.

    +

    Returns the UTF-16LE encoded firmware revision string that was captured when the image was created. Firmware information is critical for reproducing imaging environments and diagnosing drive-specific behavior or bugs.

    +
    Parameters
    + + + + +
    contextPointer to a valid aaruformat context.
    bufferDestination buffer for the firmware revision string. May be NULL when probing size.
    lengthPointer to an int32_t that specifies the buffer capacity in bytes on input and is updated with the actual metadata length on output.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Firmware revision metadata was present and copied successfully.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) No firmware metadata exists in the image.
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The supplied buffer was too small; *length is updated.
    +
    +
    +
    Note
    Firmware revision formats vary between manufacturers (e.g., numeric, alphanumeric, dot-separated). The library stores the data verbatim without attempting normalization.
    + +

    Definition at line 3178 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::drive_firmware_revision, MetadataBlockHeader::driveFirmwareRevisionLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_drive_manufacturer()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_drive_manufacturer (const void * context,
    uint8_t * buffer,
    int32_t * length )
    +
    + +

    Retrieves the drive manufacturer metadata captured during imaging.

    +

    Copies the UTF-16LE encoded manufacturer name of the device used to read or write the medium. This information documents the hardware involved in the imaging process, which is crucial for forensic reporting and reproducibility studies.

    +
    Parameters
    + + + + +
    contextPointer to a valid aaruformat context.
    bufferDestination buffer for the manufacturer string. May be NULL when querying required length.
    lengthPointer to an int32_t specifying the buffer size on input and receiving the actual metadata length on output.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Drive manufacturer metadata was copied successfully.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) The image lacks drive manufacturer metadata.
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer is too small; *length holds the required size for a subsequent call.
    +
    +
    +
    Note
    The returned manufacturer string corresponds to the value recorded by aaruf_set_drive_manufacturer() and may include branding or OEM designations.
    + +

    Definition at line 2968 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::drive_manufacturer, MetadataBlockHeader::driveManufacturerLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_drive_model()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_drive_model (const void * context,
    uint8_t * buffer,
    int32_t * length )
    +
    + +

    Retrieves the device model information for the imaging drive.

    +

    Returns the UTF-16LE encoded model identifier for the drive used during acquisition. The model metadata provides finer granularity than the manufacturer name, enabling detailed documentation of imaging hardware capabilities and behavior.

    +
    Parameters
    + + + + +
    contextPointer to a valid aaruformat context.
    bufferBuffer that receives the model string; may be NULL while probing required capacity.
    lengthPointer to an int32_t indicating buffer size on input and receiving the metadata length on output.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Drive model metadata was available and copied.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) No drive model metadata exists in the image.
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The supplied buffer was insufficient; *length is updated.
    +
    +
    +
    Note
    Model strings can include firmware suffixes, interface hints, or OEM variations. Consume the data verbatim to maintain accurate provenance records.
    + +

    Definition at line 3038 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::drive_model, MetadataBlockHeader::driveModelLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_drive_serial_number()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_drive_serial_number (const void * context,
    uint8_t * buffer,
    int32_t * length )
    +
    + +

    Retrieves the imaging drive's serial number metadata.

    +

    Copies the UTF-16LE encoded serial number reported for the drive used during the imaging session. This metadata enables correlation between images and specific hardware units for forensic chain of custody or quality assurance workflows.

    +
    Parameters
    + + + + +
    contextPointer to a valid aaruformat context.
    bufferDestination buffer for the serial number; may be NULL when querying size.
    lengthPointer to an int32_t carrying the buffer size on input and receiving the actual serial number length on output.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Drive serial number metadata was copied to buffer.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) No drive serial number metadata is available.
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer was insufficient.
    +
    +
    +
    Note
    Serial numbers are stored exactly as returned by the imaging hardware and may include leading zeros or spacing that should be preserved.
    + +

    Definition at line 3108 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, aaruformat_context::drive_serial_number, MetadataBlockHeader::driveSerialNumberLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_geometry()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_geometry (const void * context,
    uint32_t * cylinders,
    uint32_t * heads,
    uint32_t * sectors_per_track )
    +
    + +

    Retrieves the logical CHS geometry from the AaruFormat image.

    +

    Reads the Cylinder-Head-Sector (CHS) geometry information from the image's geometry block and returns the values through output parameters. The geometry block contains legacy-style logical addressing parameters that describe how the storage medium was originally organized in terms of cylinders, heads (tracks per cylinder), and sectors per track. This information is essential for software that requires CHS addressing or for accurately representing the original medium's logical structure.

    +
    Parameters
    + + + + + +
    contextPointer to the aaruformat context (must be a valid, opened image context).
    cylindersPointer to store the number of cylinders. Updated on success.
    headsPointer to store the number of heads (tracks per cylinder). Updated on success.
    sectors_per_trackPointer to store the number of sectors per track. Updated on success.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + +
    AARUF_STATUS_OK(0) Successfully retrieved geometry information. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The geometry block is present in the image (identifier == GeometryBlock)
    • +
    • All three output parameters are successfully populated with geometry values
    • +
    • The cylinders parameter contains the total number of cylinders
    • +
    • The heads parameter contains the number of heads per cylinder
    • +
    • The sectors_per_track parameter contains the number of sectors per track
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_open() or aaruf_create()
    • +
    +
    AARUF_ERROR_CANNOT_READ_BLOCK(-6) The geometry block is not present. This occurs when:
      +
    • The image was created without geometry information
    • +
    • The geometryBlock.identifier field doesn't equal GeometryBlock
    • +
    • The geometry block was not found during image opening
    • +
    • The image format doesn't support or require CHS geometry
    • +
    +
    +
    +
    +
    Note
    Geometry Interpretation:
      +
    • Total logical sectors = cylinders × heads × sectors_per_track
    • +
    • Sector size is not included in the geometry block and must be obtained separately (typically 512 bytes for most block devices, but can vary)
    • +
    • The geometry represents logical addressing, not necessarily physical medium geometry
    • +
    • Modern storage devices often report translated or synthetic geometry values
    • +
    +
    +
    +CHS Addressing Context:
      +
    • CHS addressing was historically used for hard disk drives and floppy disks
    • +
    • Legacy BIOS and older operating systems relied on CHS parameters
    • +
    • LBA (Logical Block Addressing) has largely replaced CHS for modern devices
    • +
    • Some disk image formats and emulators still require CHS information
    • +
    +
    +
    +Geometry Block Availability:
      +
    • Not all image types contain geometry blocks
    • +
    • Optical media (CDs, DVDs) typically don't have CHS geometry
    • +
    • Modern large-capacity drives may not have meaningful CHS values
    • +
    • Check the return value to determine if geometry is available
    • +
    +
    +
    +Parameter Validation:
      +
    • All output parameters must be non-NULL valid pointers
    • +
    • The function does not validate the geometry values themselves
    • +
    • Geometry values of zero or unusually large values may indicate issues
    • +
    +
    +
    Warning
    The output parameters are only modified on success (AARUF_STATUS_OK). On error, their values remain unchanged. Initialize them before calling if default values are needed on failure.
    +
    +This function reads from the in-memory geometry block loaded during aaruf_open(). It does not perform file I/O operations.
    +
    +Geometry values may not accurately represent physical device geometry, especially for modern drives with zone-based recording or flash storage.
    + +

    Definition at line 94 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, GeometryBlockHeader::cylinders, FATAL, aaruformat_context::geometry_block, GeometryBlock, GeometryBlockHeader::heads, GeometryBlockHeader::identifier, aaruformat_context::magic, GeometryBlockHeader::sectorsPerTrack, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_image_info()

    + +
    +
    + + + + + + + + + + + +
    int32_t aaruf_get_image_info (const void * context,
    ImageInfo * image_info )
    +
    + +

    Retrieves a deep copy of the ImageInfo structure from the AaruFormat image.

    +

    Returns a complete copy of the high-level image information summary containing metadata such as image size, sector count, sector size, version information, creation timestamps, and media type. This function performs a deep copy of all fields including string buffers, ensuring the caller receives a complete, independent copy of the image information.

    +
    Parameters
    + + + +
    contextPointer to the aaruformat context (must be a valid, opened image context).
    image_infoPointer to an ImageInfo structure to receive the copied data. Must be a valid pointer to allocated memory.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + +
    AARUF_STATUS_OK(0) Successfully copied image info. The image_info parameter contains a complete copy of all fields including:
      +
    • HasPartitions: Whether image contains partitions/tracks
    • +
    • HasSessions: Whether image contains multiple sessions
    • +
    • ImageSize: Size of image payload in bytes
    • +
    • Sectors: Total count of addressable sectors/blocks
    • +
    • SectorSize: Size of each logical sector in bytes
    • +
    • Version: Image format version string (NUL-terminated)
    • +
    • Application: Creating application name (NUL-terminated)
    • +
    • ApplicationVersion: Application version string (NUL-terminated)
    • +
    • CreationTime: Image creation timestamp (Windows FILETIME)
    • +
    • LastModificationTime: Last modification timestamp (Windows FILETIME)
    • +
    • MediaType: Media type identifier
    • +
    • MetadataMediaType: Media type for sidecar generation
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC
    • +
    • The context was not properly initialized
    • +
    +
    +
    +
    +
    Note
    The ImageInfo structure contains fixed-size character arrays that are properly NUL-terminated, making it safe to use as C strings.
    +
    +This function performs a complete deep copy using memcpy, copying all fields including strings, integers, and timestamps.
    +
    +The caller is responsible for allocating the ImageInfo structure before calling this function. The structure is not dynamically allocated by this function.
    +
    Warning
    The image_info parameter must point to valid, allocated memory of at least sizeof(ImageInfo) bytes. Passing NULL or invalid pointers will result in undefined behavior.
    +
    +This function reads from the in-memory image_info loaded during aaruf_open() or populated during aaruf_create(). It does not perform file I/O operations.
    + +

    Definition at line 3634 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, aaruformat_context::image_info, aaruformat_context::magic, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_media_barcode()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_media_barcode (const void * context,
    uint8_t * buffer,
    int32_t * length )
    +
    + +

    Retrieves the barcode assigned to the physical media or its packaging.

    +

    Returns the UTF-16LE encoded barcode string that was captured when the image was created. Barcodes are commonly used in institutional workflows for inventory tracking and automated retrieval.

    +
    Parameters
    + + + + +
    contextPointer to a valid aaruformat context.
    bufferBuffer that receives the barcode string; may be NULL when probing size requirements.
    lengthPointer to an int32_t specifying the buffer size on input and receiving the actual barcode length on output.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Barcode metadata was present and copied successfully.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) No barcode metadata exists in the image.
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The supplied buffer was too small.
    +
    +
    +
    Note
    Barcode values can be strict alphanumeric codes (e.g., LTO cartridge IDs) or full strings from custom labeling systems. Preserve the returned string exactly for catalog interoperability.
    + +

    Definition at line 2825 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::media_barcode, MetadataBlockHeader::mediaBarcodeLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_media_manufacturer()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_media_manufacturer (const void * context,
    uint8_t * buffer,
    int32_t * length )
    +
    + +

    Retrieves the recorded media manufacturer name.

    +

    Provides access to the UTF-16LE encoded manufacturer metadata that identifies the company which produced the physical medium. This information is taken from the MetadataBlock and mirrors the value previously stored via aaruf_set_media_manufacturer().

    +
    Parameters
    + + + + +
    contextPointer to a valid aaruformat context.
    bufferBuffer that receives the manufacturer string. May be NULL when probing size.
    lengthPointer to an int32_t specifying the buffer size on input and receiving the actual manufacturer string length on output.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Manufacturer metadata was available and copied.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) The image lacks manufacturer metadata.
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer was too small; *length indicates size.
    +
    +
    +
    Note
    Values may include trailing spaces or vendor-specific capitalization. Treat the returned data as authoritative and avoid trimming unless required by the consuming application.
    + +

    Definition at line 2616 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::media_manufacturer, MetadataBlockHeader::mediaManufacturerLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_media_model()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_media_model (const void * context,
    uint8_t * buffer,
    int32_t * length )
    +
    + +

    Retrieves the media model or product designation metadata.

    +

    Returns the UTF-16LE encoded model name that specifies the exact product variant of the physical medium. The function mirrors the set counterpart and is useful for accurately documenting media specifications during preservation workflows.

    +
    Parameters
    + + + + +
    contextPointer to a valid aaruformat context.
    bufferDestination buffer for the model string; may be NULL when querying required size.
    lengthPointer to an int32_t that on input contains the buffer capacity in bytes and on output is updated with the actual metadata length.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Model metadata was successfully copied.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) No media model metadata is present in the image.
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The caller-provided buffer is too small.
    +
    +
    +
    Note
    Model strings often contain performance ratings (e.g., "16x", "LTO-7"). The data is opaque and should be handled without modification unless necessary.
    + +

    Definition at line 2686 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::media_model, MetadataBlockHeader::mediaModelLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_media_part_number()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_media_part_number (const void * context,
    uint8_t * buffer,
    int32_t * length )
    +
    + +

    Retrieves the media part number recorded in the MetadataBlock.

    +

    Provides access to the UTF-16LE encoded part number identifying the precise catalog or ordering code for the physical medium. Part numbers help archivists procure exact replacements and document specific media variants used during acquisition.

    +
    Parameters
    + + + + +
    contextPointer to a valid aaruformat context.
    bufferDestination buffer for the part number string. May be NULL while querying size.
    lengthPointer to an int32_t that supplies the buffer size on input and is updated with the actual part number length on output.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Part number metadata was returned successfully.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) No part number metadata exists.
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer was insufficient; *length contains the required size.
    +
    +
    +
    Note
    Part numbers may include manufacturer-specific formatting such as hyphens or suffix letters. The library stores and returns the data verbatim.
    + +

    Definition at line 2896 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::media_part_number, MetadataBlockHeader::mediaPartNumberLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_media_sequence()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_media_sequence (const void * context,
    int32_t * sequence,
    int32_t * last_sequence )
    +
    + +

    Retrieves the media sequence metadata for multi-volume image sets.

    +

    Reads the media sequence fields stored in the MetadataBlock header and returns the current media number together with the final media number for the complete set. This information indicates the position of the imaged medium within a multi-volume collection (for example, "disc 2 of 5"). The function operates entirely on in-memory structures populated during aaruf_open(); no additional disk I/O is performed.

    +
    Parameters
    + + + + +
    contextPointer to an initialized aaruformat context opened for reading or writing.
    sequencePointer that receives the current media sequence number (typically 1-based).
    last_sequencePointer that receives the total number of media in the set.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + +
    AARUF_STATUS_OK(0) Metadata was present and the output parameters were populated.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The provided context pointer is NULL or not an aaruformat context (magic mismatch).
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) The MetadataBlock was not present in the image, making sequence data unavailable.
    +
    +
    +
    Note
    For standalone media, both sequence and last_sequence are commonly set to 1. Some creators may also set them to 0 to indicate the absence of sequence semantics; callers should handle either pattern gracefully.
    +
    +The function does not validate logical consistency (e.g., whether sequence <= last_sequence); it simply returns the values stored in the image header.
    + +

    Definition at line 2337 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, MetadataBlockHeader::lastMediaSequence, aaruformat_context::magic, MetadataBlockHeader::mediaSequence, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_media_serial_number()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_media_serial_number (const void * context,
    uint8_t * buffer,
    int32_t * length )
    +
    + +

    Retrieves the media serial number recorded in the image metadata.

    +

    Copies the UTF-16LE encoded serial number identifying the specific physical medium. Serial numbers are particularly important for forensic tracking and archival provenance, enabling correlation between the physical item and its digital representation.

    +
    Parameters
    + + + + +
    contextPointer to a valid aaruformat context.
    bufferDestination buffer for the serial number. May be NULL to determine required size.
    lengthPointer to an int32_t that on input holds the buffer size and on output receives the actual serial number length.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Serial number metadata was copied into buffer.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) No serial number metadata was stored in the image.
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The provided buffer was too small.
    +
    +
    +
    Note
    Serial numbers may contain spaces, hyphens, or alphanumeric characters. The library does not normalize or validate these strings.
    + +

    Definition at line 2756 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::media_serial_number, MetadataBlockHeader::mediaSerialNumberLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_media_title()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_get_media_title (const void * context,
    uint8_t * buffer,
    int32_t * length )
    +
    + +

    Retrieves the media title or label captured during image creation.

    +

    Returns the UTF-16LE encoded media title string, representing markings or labels present on the original physical media. This function allows applications to present or archive the media title alongside the image, preserving contextual information from the physical artifact.

    +
    Parameters
    + + + + +
    contextPointer to a valid aaruformat context.
    bufferDestination buffer for the UTF-16LE title string. May be NULL when querying size.
    lengthPointer to an int32_t that on input holds the buffer capacity in bytes and on output receives the actual title length.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) The media title was available and copied to buffer.
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context pointer is invalid.
    AARUF_ERROR_METADATA_NOT_PRESENT(-30) No media title metadata exists.
    AARUF_ERROR_BUFFER_TOO_SMALL(-10) The supplied buffer was insufficient.
    +
    +
    +
    Note
    Titles may contain international characters, control codes, or mixed casing. The library does not attempt to sanitize or interpret the string.
    + +

    Definition at line 2546 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_BUFFER_TOO_SMALL, AARUF_ERROR_METADATA_NOT_PRESENT, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::magic, aaruformat_context::media_title, MetadataBlockHeader::mediaTitleLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_get_negative_sectors()

    + +
    +
    + + + + + + + + + + + +
    int32_t aaruf_get_negative_sectors (const void * context,
    uint16_t * sectors )
    +
    + +

    Retrieves the number of negative (pre-gap) sectors in the AaruFormat image.

    +

    Returns the count of negative sectors that precede the standard user data area. Negative sectors are used to capture pre-gap data, lead-in areas, and other metadata that exists before the main user-accessible storage region. This is particularly important for optical media (CD, DVD, BD) where the lead-in contains the Table of Contents (TOC) and other essential disc structures, and for audio CDs where pre-gap sectors contain silence or hidden tracks. For most hard disk and floppy disk images, this value is typically zero.

    +
    Parameters
    + + + +
    contextPointer to a valid aaruformat context (must be properly initialized).
    sectorsPointer to a uint16_t that receives the negative sector count on success.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + +
    AARUF_STATUS_OK(0) Successfully retrieved the negative sector count. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context magic number matches AARU_MAGIC
    • +
    • The sectors parameter is successfully populated with the negative sector count
    • +
    • The value is taken from ctx->user_data_ddt_header.negative
    • +
    • For optical media with lead-in data: sectors may be non-zero
    • +
    • For standard hard disk/floppy images: sectors is typically 0
    • +
    • Maximum value is 65,535 (uint16_t limit)
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_open() or aaruf_create()
    • +
    +
    +
    +
    +
    Note
    Negative Sector Addressing:
      +
    • Negative sectors are addressed with the 'negative' flag set to true
    • +
    • Sector addresses range from 0 to (negative_sectors - 1)
    • +
    • When calling aaruf_read_sector() or aaruf_write_sector():
        +
      • Use negative=true
      • +
      • Use sector_address in range [0, negative_sectors - 1]
      • +
      • The actual logical position is before the user data area
      • +
      +
    • +
    +
    +
    +Optical Media Context:
      +
    • CD-ROM/CD-DA: Negative sectors contain lead-in area with TOC (Table of Contents). The lead-in typically spans LBA -450000 to -1, though only a portion may be captured. Pre-gap sectors (usually 150 sectors/2 seconds before each track) may also be stored as negative sectors for the first track.
    • +
    • DVD: May contain lead-in with disc structure information, copyright data, and region codes. The lead-in area varies by format (DVD-ROM, DVD-R, DVD+R, etc.).
    • +
    • Blu-ray: Lead-in contains disc information, burst cutting area (BCA), and other metadata. The structure differs between BD-ROM, BD-R, and BD-RE.
    • +
    +
    +
    +Hard Disk and Floppy Context:
      +
    • Hard disk drives: Negative sectors are typically zero unless capturing special manufacturer reserved areas (HPA, DCO) that precede the standard user area.
    • +
    • Floppy disks: Negative sectors are typically zero as floppies have a simple linear sector layout without lead-in areas.
    • +
    +
    +
    +Audio CD Hidden Tracks:
      +
    • Some audio CDs contain hidden tracks in the pre-gap of the first track
    • +
    • These pre-gap sectors can extend up to several minutes before track 1
    • +
    • Negative sectors can capture this "hidden" audio data
    • +
    • The pre-gap for track 1 typically starts at LBA -150 (2 seconds)
    • +
    +
    +
    +DDT Header Source:
      +
    • The value is retrieved from ctx->user_data_ddt_header.negative
    • +
    • The DDT (Deduplication and Data Table) header tracks all sector allocation
    • +
    • This field is populated during image creation with aaruf_create()
    • +
    • The value is fixed for read-only images opened with aaruf_open()
    • +
    • Maximum representable value is 65,535 (uint16_t)
    • +
    +
    +
    +Total Addressable Space:
      +
    • Total sectors = negative_sectors + user_sectors + overflow_sectors
    • +
    • The negative region comes first in logical order
    • +
    • Followed by the user region [0, user_sectors - 1]
    • +
    • Followed by the overflow region if present
    • +
    +
    +
    +Relationship to Image Creation:
      +
    • The negative_sectors value is specified when calling aaruf_create()
    • +
    • It should be set based on the medium type and imaging requirements:
        +
      • Optical discs: Set to the number of lead-in sectors captured
      • +
      • Hard disks: Typically 0, unless capturing HPA/DCO areas
      • +
      • Floppy disks: Typically 0
      • +
      • Audio CDs: May be non-zero to capture pre-gap hidden tracks
      • +
      +
    • +
    +
    +
    Warning
    The sectors parameter is only modified on success (AARUF_STATUS_OK). On error, its value remains unchanged. Initialize it before calling if a default value is needed on failure.
    +
    +This function reads from the in-memory DDT header loaded during aaruf_open() or set during aaruf_create(). It does not perform file I/O operations and executes quickly.
    +
    +The maximum negative sector count is 65,535 due to the uint16_t storage type. If imaging optical media with larger lead-in areas, some data may not be representable. This limit is generally sufficient for most practical cases.
    +
    +Negative sector data may contain copy-protected or encrypted content (e.g., CSS on DVDs, AACS on Blu-rays). Handle this data according to applicable laws and licensing agreements.
    + +

    Definition at line 3417 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, aaruformat_context::magic, DdtHeader2::negative, TRACE, and aaruformat_context::user_data_ddt_header.

    + +
    +
    + +

    ◆ aaruf_get_overflow_sectors()

    + +
    +
    + + + + + + + + + + + +
    int32_t aaruf_get_overflow_sectors (const void * context,
    uint16_t * sectors )
    +
    + +

    Retrieves the number of overflow (post-gap) sectors in the AaruFormat image.

    +

    Returns the count of overflow sectors that follow the standard user data area. Overflow sectors are used to capture post-gap data, lead-out areas, and other metadata that exists after the main user-accessible storage region. This is particularly important for optical media (CD, DVD, BD) where the lead-out marks the physical end of the recorded data and contains disc finalization information, and for multi-session discs where gaps between sessions need to be preserved. For most hard disk and floppy disk images, this value is typically zero.

    +
    Parameters
    + + + +
    contextPointer to a valid aaruformat context (must be properly initialized).
    sectorsPointer to a uint16_t that receives the overflow sector count on success.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + +
    AARUF_STATUS_OK(0) Successfully retrieved the overflow sector count. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context magic number matches AARU_MAGIC
    • +
    • The sectors parameter is successfully populated with the overflow sector count
    • +
    • The value is taken from ctx->user_data_ddt_header.overflow
    • +
    • For optical media with lead-out data: sectors may be non-zero
    • +
    • For standard hard disk/floppy images: sectors is typically 0
    • +
    • Maximum value is 65,535 (uint16_t limit)
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_open() or aaruf_create()
    • +
    +
    +
    +
    +
    Note
    Overflow Sector Addressing:
      +
    • Overflow sectors are addressed with the 'negative' flag set to false
    • +
    • Sector addresses range from user_sectors to (user_sectors + overflow_sectors - 1)
    • +
    • When calling aaruf_read_sector() or aaruf_write_sector():
        +
      • Use negative=false
      • +
      • Use sector_address in range [user_sectors, user_sectors + overflow_sectors - 1]
      • +
      • The actual logical position is after the user data area
      • +
      +
    • +
    +
    +
    +Optical Media Context:
      +
    • CD-ROM/CD-DA: Overflow sectors contain the lead-out area, which marks the physical end of the disc's recorded data. The lead-out consists of unreadable sectors filled with specific patterns.
    • +
    • DVD: May contain lead-out with disc finalization data, middle area (for dual-layer), and outer zone. DVD+R/RW discs may have substantial lead-out areas.
    • +
    • Blu-ray: Lead-out contains disc finalization markers and padding. For multi-layer discs, may include middle zones and outer areas.
    • +
    +
    +
    +Multi-Session and Track Context:
      +
    • Multi-session optical discs have gaps between sessions
    • +
    • Audio CDs with post-gap after the last track may use overflow sectors
    • +
    • Track post-gaps (silence after audio tracks) typically 2 seconds/150 sectors
    • +
    +
    +
    +Hard Disk and Floppy Context:
      +
    • Hard disk drives: Overflow sectors are typically zero unless capturing special manufacturer reserved areas (like DCO or HPA) that follow the standard user area.
    • +
    • Floppy disks: Overflow sectors are typically zero as floppies have a simple linear sector layout without lead-out areas. They may contain mastering information.
    • +
    • Some proprietary copy protection schemes may place data beyond the normal capacity, which could be captured as overflow sectors.
    • +
    +
    +
    +DDT Header Source:
      +
    • The value is retrieved from ctx->user_data_ddt_header.overflow
    • +
    • The DDT (Deduplication and Data Table) header tracks all sector allocation
    • +
    • This field is populated during image creation with aaruf_create()
    • +
    • The value is fixed for read-only images opened with aaruf_open()
    • +
    • Maximum representable value is 65,535 (uint16_t)
    • +
    +
    +
    +Total Addressable Space:
      +
    • Total sectors = negative_sectors + user_sectors + overflow_sectors
    • +
    • The negative region comes first in logical order
    • +
    • Followed by the user region [0, user_sectors - 1]
    • +
    • Followed by the overflow region at the end
    • +
    • Overflow represents the final addressable range in the image
    • +
    +
    +
    +Relationship to Image Creation:
      +
    • The overflow_sectors value is specified when calling aaruf_create()
    • +
    • It should be set based on the medium type and imaging requirements:
        +
      • Optical discs: Set to the number of lead-out sectors captured
      • +
      • Multi-session discs: May include inter-session gaps
      • +
      • Hard disks: Typically 0, unless capturing post-user reserved areas
      • +
      • Floppy disks: Typically 0
      • +
      • Copy-protected media: May be non-zero to capture protection schemes
      • +
      +
    • +
    +
    +
    +Forensic Imaging Considerations:
      +
    • Some copy protection schemes intentionally place data in overflow regions
    • +
    • These "overburn" areas extend beyond the disc's rated capacity
    • +
    • Overflow sectors ensure complete forensic capture of all readable data
    • +
    • Important for authenticity verification and copy protection analysis
    • +
    +
    +
    Warning
    The sectors parameter is only modified on success (AARUF_STATUS_OK). On error, its value remains unchanged. Initialize it before calling if a default value is needed on failure.
    +
    +This function reads from the in-memory DDT header loaded during aaruf_open() or set during aaruf_create(). It does not perform file I/O operations and executes quickly.
    +
    +The maximum overflow sector count is 65,535 due to the uint16_t storage type. If imaging optical media with larger lead-out areas or extensive overburn regions, some data may not be representable. This limit is generally sufficient for most practical cases.
    +
    +Overflow sector data may be difficult or impossible to read on some drives, as it often resides in lead-out areas or beyond rated capacity. The presence of overflow sectors in an image indicates the imaging drive was capable of reading these extended areas, but other drives may not be able to access them.
    + +

    Definition at line 3552 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, aaruformat_context::magic, DdtHeader2::overflow, TRACE, and aaruformat_context::user_data_ddt_header.

    + +
    +
    + +

    ◆ aaruf_get_user_sectors()

    + +
    +
    + + + + + + + + + + + +
    int32_t aaruf_get_user_sectors (const void * context,
    uint64_t * sectors )
    +
    + +

    Retrieves the total number of user-accessible sectors in the AaruFormat image.

    +

    Returns the count of standard user data sectors in the image, excluding any negative (pre-gap) or overflow (post-gap) sectors. This represents the primary addressable sector range that contains the main user data, typically corresponding to the logical capacity of the storage medium as it would be seen by an operating system or file system. For optical media, this excludes lead-in and lead-out areas. For hard disks, this represents the standard LBA-addressable range.

    +
    Parameters
    + + + +
    contextPointer to a valid aaruformat context (must be properly initialized).
    sectorsPointer to a uint64_t that receives the total user sector count on success.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + +
    AARUF_STATUS_OK(0) Successfully retrieved the user sector count. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context magic number matches AARU_MAGIC
    • +
    • The sectors parameter is successfully populated with the user sector count
    • +
    • The value is taken from ctx->user_data_ddt_header.blocks
    • +
    • For block devices: sectors typically equals the total capacity in sectors
    • +
    • For optical media: sectors represents the user data area excluding lead-in/lead-out
    • +
    • For tape media: sectors may represent the total block count across all files
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_open() or aaruf_create()
    • +
    +
    +
    +
    +
    Note
    Sector Range Context:
      +
    • User sectors represent the standard addressable range: 0 to (user_sectors - 1)
    • +
    • Total addressable sectors = negative_sectors + user_sectors + overflow_sectors
    • +
    • Negative sectors precede user sectors (pre-gap, lead-in)
    • +
    • Overflow sectors follow user sectors (post-gap, lead-out)
    • +
    • Use aaruf_get_negative_sectors() to get the negative sector count
    • +
    • Use aaruf_get_overflow_sectors() to get the overflow sector count
    • +
    +
    +
    +Media Type Considerations:
      +
    • Optical Media (CD/DVD/BD): User sectors exclude lead-in and lead-out areas. Negative sectors may contain TOC and pre-gap data. Overflow sectors may contain post-gap and lead-out data.
    • +
    • Hard Disk Drives: User sectors represent the full LBA range. Negative and overflow sectors are typically zero unless capturing special areas.
    • +
    • Floppy Disks: User sectors represent the standard formatted capacity.
    • +
    • Tape Media: User sectors may represent the total block count. Negative and overflow sectors are typically not used for tape.
    • +
    +
    +
    +DDT Header Source:
      +
    • The value is retrieved from ctx->user_data_ddt_header.blocks
    • +
    • The DDT (Deduplication and Data Table) header tracks sector allocation
    • +
    • This field is populated during image creation with aaruf_create()
    • +
    • The value is fixed for read-only images opened with aaruf_open()
    • +
    • For write-enabled images, this represents the allocated capacity
    • +
    +
    +
    +Addressing and I/O Operations:
      +
    • When reading/writing sectors with aaruf_read_sector() or aaruf_write_sector():
        +
      • Set negative=false and use sector_address in range [0, user_sectors - 1]
      • +
      • For negative sectors: set negative=true, sector_address in [0, negative_sectors - 1]
      • +
      • For overflow sectors: set negative=false, sector_address in [user_sectors, user_sectors + overflow_sectors
      • +
      +
    • +
    +
    +
      +
    • 1]
    • +
    +
    Note
    Relationship to Image Creation:
      +
    • The user_sectors value is specified when calling aaruf_create()
    • +
    • It should match the logical capacity of the medium being imaged
    • +
    • For forensic images, ensure it matches the source medium exactly
    • +
    • For virtual disks, set it to the desired capacity
    • +
    +
    + +

    Definition at line 3292 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, DdtHeader2::blocks, FATAL, aaruformat_context::magic, TRACE, and aaruformat_context::user_data_ddt_header.

    + +
    +
    + +

    ◆ aaruf_set_aaru_json_metadata()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_aaru_json_metadata (void * context,
    uint8_t * data,
    size_t length )
    +
    + +

    Sets the Aaru metadata JSON for the image during creation.

    +

    Embeds Aaru metadata JSON into the image being created. The Aaru metadata JSON format is a structured, machine-readable representation of comprehensive image metadata including media information, imaging session details, hardware configuration, optical disc tracks and sessions, checksums, and preservation metadata. This function stores the JSON payload in its original form without parsing or validation, allowing callers to provide pre-generated JSON conforming to the Aaru metadata schema. The JSON data will be written to the image file during aaruf_close() as an AaruMetadataJsonBlock.

    +

    The function accepts raw UTF-8 encoded JSON data as an opaque byte array and creates an internal copy that persists for the lifetime of the context. If Aaru JSON metadata was previously set on this context, the old data is freed and replaced with the new JSON. The JSON is treated as opaque binary data by the library; no parsing, interpretation, or schema validation is performed during the set operation.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the Aaru metadata JSON data in UTF-8 encoding (opaque byte array). The JSON should conform to the Aaru metadata schema, though this is not validated. Must not be NULL.
    lengthLength of the JSON data in bytes. The payload may or may not be null-terminated; the length should reflect the actual JSON data size.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set Aaru metadata JSON. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the JSON data succeeded
    • +
    • The JSON data is copied to ctx->jsonBlock
    • +
    • The jsonBlockHeader is initialized with identifier AaruMetadataJsonBlock
    • +
    • The jsonBlockHeader.length field is set to the provided length
    • +
    • Any previous Aaru JSON data is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the JSON data
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    Aaru JSON Format and Encoding:
      +
    • The JSON payload must be valid UTF-8 encoded data
    • +
    • The payload may or may not be null-terminated
    • +
    • The library treats the JSON as opaque binary data
    • +
    • No JSON parsing, interpretation, or validation is performed during set
    • +
    • Schema compliance is the caller's responsibility
    • +
    • Ensure the JSON conforms to the Aaru metadata schema for compatibility
    • +
    +
    +
    +Aaru Metadata JSON Purpose:
      +
    • Provides machine-readable structured metadata using modern JSON format
    • +
    • Includes comprehensive information about media, sessions, tracks, and checksums
    • +
    • Enables programmatic access to metadata without XML parsing overhead
    • +
    • Documents imaging session details, hardware configuration, and preservation data
    • +
    • Used by Aaru and compatible tools for metadata exchange and analysis
    • +
    • Complements or serves as alternative to CICM XML metadata
    • +
    +
    +
    +JSON Content Examples:
      +
    • Media type and physical characteristics
    • +
    • Track and session information for optical media
    • +
    • Partition and filesystem metadata
    • +
    • Checksums (MD5, SHA-1, SHA-256, etc.) for integrity verification
    • +
    • Hardware information (drive manufacturer, model, firmware)
    • +
    • Imaging software version and configuration
    • +
    • Timestamps for image creation and modification
    • +
    +
    +
    +Memory Management:
      +
    • The function creates an internal copy of the JSON data
    • +
    • The caller retains ownership of the input data buffer
    • +
    • The caller may free the input data immediately after this function returns
    • +
    • The internal copy is freed automatically during aaruf_close()
    • +
    • Calling this function multiple times replaces previous JSON data
    • +
    +
    +
    +Relationship to CICM XML:
      +
    • Both CICM XML and Aaru JSON can be set on the same image
    • +
    • CICM XML follows the Canary Islands Computer Museum schema (older format)
    • +
    • Aaru JSON follows the Aaru-specific metadata schema (newer format)
    • +
    • Setting one does not affect the other
    • +
    • Different tools may prefer one format over the other
    • +
    • Consider including both for maximum compatibility
    • +
    +
    +
    Warning
    The Aaru JSON block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted to disk.
    +
    +No validation is performed on the JSON data:
      +
    • Invalid JSON syntax will be stored and only detected during parsing
    • +
    • Schema violations will not be caught by this function
    • +
    • Ensure JSON is valid and schema-compliant before calling
    • +
    • Use a JSON validation library before embedding if correctness is critical
    • +
    +
    +
    +The function accepts any length value:
      +
    • Ensure the length accurately reflects the JSON data size
    • +
    • Incorrect length values may cause truncation or include garbage data
    • +
    • For null-terminated JSON, length should not include the null terminator unless it is intended to be part of the stored data
    • +
    +
    +
    See also
    AaruMetadataJsonBlockHeader for the on-disk structure definition.
    +
    +aaruf_get_aaru_json_metadata() for retrieving Aaru JSON from opened images.
    +
    +write_aaru_json_block() for the serialization process during image closing.
    + +

    Definition at line 2258 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, AaruMetadataJsonBlock, FATAL, AaruMetadataJsonBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::json_block, aaruformat_context::json_block_header, AaruMetadataJsonBlockHeader::length, aaruformat_context::magic, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_comments()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_comments (void * context,
    const uint8_t * data,
    const int32_t length )
    +
    + +

    Sets user comments or notes for the image.

    +

    Records arbitrary user-provided comments, notes, or annotations associated with the AaruFormat image. This metadata field allows users to document the image's purpose, provenance, condition, or any other relevant information. Comments are stored in UTF-16LE encoding and can contain multi-line text, special characters, and detailed descriptions.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the comments string data in UTF-16LE encoding (opaque byte array).
    lengthLength of the comments data in bytes (must include full UTF-16LE character sequences).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set comments. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the comments string succeeded
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The comments data is copied to ctx->imageInfo.Comments
    • +
    • The commentsLength field is set in the metadata block header
    • +
    • Any previous comments string is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the comments string
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    UTF-16LE Encoding:
      +
    • The data parameter must contain a valid UTF-16LE encoded string
    • +
    • Length must be in bytes, not character count
    • +
    • The library treats the data as opaque and does not validate encoding
    • +
    • Null termination is not required; length specifies the exact byte count
    • +
    +
    +
    +Common Uses for Comments:
      +
    • Documentation of image source and creation date
    • +
    • Notes about media condition or read errors encountered
    • +
    • Preservation metadata and archival notes
    • +
    • User annotations for organizing image collections
    • +
    • Workflow status or processing history
    • +
    +
    +
    +Memory Management:
      +
    • The function allocates a new buffer and copies the data
    • +
    • If previous comments exist, they are freed before replacement
    • +
    • The caller retains ownership of the input data buffer
    • +
    • The allocated memory is freed when the context is closed or destroyed
    • +
    +
    +
    Warning
    The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    + +

    Definition at line 607 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::comments, MetadataBlockHeader::commentsLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_creator()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_creator (void * context,
    const uint8_t * data,
    const int32_t length )
    +
    + +

    Sets the creator (person/operator) information for the image.

    +

    Records the name of the person or operator who created the AaruFormat image. This metadata identifies the individual responsible for the imaging process, which is valuable for provenance tracking, accountability, and understanding the human context in which the image was created. The creator name is stored in UTF-16LE encoding and preserved exactly as provided by the caller.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the creator name string data in UTF-16LE encoding (opaque byte array).
    lengthLength of the creator data in bytes (must include full UTF-16LE character sequences).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set creator information. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the creator string succeeded
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The creator data is copied to ctx->imageInfo.Creator
    • +
    • The creatorLength field is set in the metadata block header
    • +
    • Any previous creator string is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the creator string
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    UTF-16LE Encoding:
      +
    • The data parameter must contain a valid UTF-16LE encoded string
    • +
    • Length must be in bytes, not character count (UTF-16LE uses 2 or 4 bytes per character)
    • +
    • The library treats the data as opaque and does not validate UTF-16LE encoding
    • +
    • Null termination is not required; length specifies the exact byte count
    • +
    • Ensure even byte lengths to maintain UTF-16LE character alignment
    • +
    +
    +
    +Creator Name Format:
      +
    • Typically contains the full name of the person who created the image
    • +
    • May include titles, credentials, or institutional affiliations
    • +
    • Common formats: "John Smith", "Dr. Jane Doe", "Smith, John (Archivist)"
    • +
    • Should identify the individual operator, not the software used
    • +
    • May include contact information or employee/operator ID in institutional settings
    • +
    +
    +
    +Provenance and Accountability:
      +
    • Identifies who performed the imaging operation
    • +
    • Important for establishing chain of custody in forensic contexts
    • +
    • Provides contact point for questions about the imaging process
    • +
    • Supports institutional recordkeeping and quality assurance
    • +
    • May be required for compliance with archival standards
    • +
    +
    +
    +Privacy Considerations:
      +
    • Consider privacy implications when recording personal names
    • +
    • Some organizations may use operator IDs instead of full names
    • +
    • Institutional policies may govern what personal information is recorded
    • +
    • GDPR and similar regulations may apply in some jurisdictions
    • +
    +
    +
    +Memory Management:
      +
    • The function allocates a new buffer and copies the data
    • +
    • If a previous creator string exists, it is freed before replacement
    • +
    • The caller retains ownership of the input data buffer
    • +
    • The allocated memory is freed when the context is closed or destroyed
    • +
    +
    +
    +Metadata Block Initialization:
      +
    • If the metadata block header is not yet initialized, this function initializes it
    • +
    • The metadataBlockHeader.identifier is set to MetadataBlock automatically
    • +
    • Multiple metadata setter functions can be called to build complete metadata
    • +
    +
    +
    Warning
    The data buffer must remain valid for the duration of this function call. After the function returns, the caller may free or reuse the data buffer.
    +
    +Invalid UTF-16LE encoding may cause issues when reading the metadata:
      +
    • The library does not validate UTF-16LE correctness
    • +
    • Malformed strings may display incorrectly or cause decoding errors
    • +
    • Ensure the data is properly encoded before calling this function
    • +
    +
    +
    +The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    + +

    Definition at line 493 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::creator, MetadataBlockHeader::creatorLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_drive_firmware_revision()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_drive_firmware_revision (void * context,
    const uint8_t * data,
    const int32_t length )
    +
    + +

    Sets the drive firmware revision for the image.

    +

    Records the firmware version or revision of the drive or device used to read or write the physical storage media. Firmware revisions can significantly affect drive behavior, error handling, performance, and compatibility. This metadata is crucial for understanding the imaging environment, troubleshooting issues, and ensuring reproducibility. Different firmware versions of the same drive model can behave quite differently, making this information essential for comprehensive documentation. The firmware revision is stored in UTF-16LE encoding.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the drive firmware revision string data in UTF-16LE encoding (opaque byte array).
    lengthLength of the drive firmware revision data in bytes (must include full UTF-16LE character sequences).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set drive firmware revision. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the drive firmware revision string succeeded
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The drive firmware revision data is copied to ctx->imageInfo.DriveFirmwareRevision
    • +
    • The driveFirmwareRevisionLength field is set in the metadata block header
    • +
    • Any previous drive firmware revision string is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the drive firmware revision string
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    Firmware Revision Examples:
      +
    • Optical drives: "1.07", "1.00a", "VER A302"
    • +
    • Tape drives: "B8S1", "7760", "V4.0"
    • +
    • Hard drives: "CC45", "80.00A80", "HPG9"
    • +
    • Format varies by manufacturer and device type
    • +
    +
    +
    +Firmware Impact on Imaging:
      +
    • Different firmware versions may have different error recovery strategies
    • +
    • Bug fixes in newer firmware can improve read reliability
    • +
    • Some firmware versions have known issues with specific media types
    • +
    • Performance characteristics may vary between firmware revisions
    • +
    • Firmware can affect features like C2 error reporting on optical drives
    • +
    +
    +
    +Troubleshooting and Support:
      +
    • Essential for diagnosing drive-specific problems
    • +
    • Manufacturer support often requires firmware version information
    • +
    • Helps identify if issues are resolved in newer firmware
    • +
    • Enables correlation of problems with known firmware bugs
    • +
    • Supports decision-making about firmware updates
    • +
    +
    +
    +Reproducibility and Documentation:
      +
    • Complete environment documentation for scientific reproducibility
    • +
    • Important for forensic work requiring detailed equipment records
    • +
    • Helps explain variations in imaging results over time
    • +
    • Supports compliance with archival and preservation standards
    • +
    • Enables future researchers to understand imaging conditions
    • +
    +
    +
    +Historical Tracking:
      +
    • Documents firmware changes over the life of imaging equipment
    • +
    • Helps assess impact of firmware updates on imaging quality
    • +
    • Useful for long-term archival projects spanning years
    • +
    • Aids in understanding evolution of drive technology
    • +
    +
    +
    Warning
    The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    +
    +Firmware revisions are device-specific and format varies widely:
      +
    • No standard format exists across manufacturers
    • +
    • May include letters, numbers, dots, or other characters
    • +
    • Should be recorded exactly as reported by the device
    • +
    +
    + +

    Definition at line 1793 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::drive_firmware_revision, MetadataBlockHeader::driveFirmwareRevisionLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_drive_manufacturer()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_drive_manufacturer (void * context,
    const uint8_t * data,
    const int32_t length )
    +
    + +

    Sets the drive manufacturer information for the image.

    +

    Records the name of the company that manufactured the drive or device used to read or write the physical storage media. This metadata provides valuable context about the imaging process, as different drives may have different capabilities, error handling characteristics, and compatibility with specific media types. The manufacturer name is stored in UTF-16LE encoding.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the drive manufacturer string data in UTF-16LE encoding (opaque byte array).
    lengthLength of the drive manufacturer data in bytes (must include full UTF-16LE character sequences).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set drive manufacturer. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the drive manufacturer string succeeded
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The drive manufacturer data is copied to ctx->imageInfo.DriveManufacturer
    • +
    • The driveManufacturerLength field is set in the metadata block header
    • +
    • Any previous drive manufacturer string is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the drive manufacturer string
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    Common Drive Manufacturers:
      +
    • Optical drives: Pioneer, Plextor, LG, ASUS, Sony, Samsung
    • +
    • Tape drives: HP, IBM, Quantum, Tandberg, Exabyte
    • +
    • Hard drives: Seagate, Western Digital, Hitachi, Toshiba
    • +
    • Floppy drives: Teac, Panasonic, Mitsumi, Sony
    • +
    +
    +
    +Imaging Context and Quality:
      +
    • Different manufacturers have varying error recovery capabilities
    • +
    • Some drives are better suited for archival-quality imaging
    • +
    • Plextor drives were historically preferred for optical disc preservation
    • +
    • Professional-grade drives often have better read accuracy
    • +
    • Important for understanding potential limitations in the imaging process
    • +
    +
    +
    +Forensic and Provenance Value:
      +
    • Documents the complete imaging environment
    • +
    • Helps assess reliability and trustworthiness of the image
    • +
    • Useful for troubleshooting or reproducing imaging results
    • +
    • May be required for forensic chain of custody
    • +
    • Supports quality assurance and validation processes
    • +
    +
    +
    Warning
    The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    + +

    Definition at line 1412 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::drive_manufacturer, MetadataBlockHeader::driveManufacturerLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_drive_model()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_drive_model (void * context,
    const uint8_t * data,
    const int32_t length )
    +
    + +

    Sets the drive model information for the image.

    +

    Records the specific model or product designation of the drive or device used to read or write the physical storage media. This metadata provides detailed information about the imaging equipment, which can be important for understanding the capabilities, limitations, and characteristics of the imaging process. Different drive models within the same manufacturer's product line may have significantly different features and performance characteristics. The model information is stored in UTF-16LE encoding.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the drive model string data in UTF-16LE encoding (opaque byte array).
    lengthLength of the drive model data in bytes (must include full UTF-16LE character sequences).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set drive model. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the drive model string succeeded
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The drive model data is copied to ctx->imageInfo.DriveModel
    • +
    • The driveModelLength field is set in the metadata block header
    • +
    • Any previous drive model string is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the drive model string
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    Drive Model Examples:
      +
    • Optical drives: "DVR-111D" (Pioneer), "PX-716A" (Plextor), "GH24NSB0" (LG)
    • +
    • Tape drives: "Ultrium 7-SCSI" (HP), "TS1140" (IBM), "SDLT600" (Quantum)
    • +
    • Hard drives: "ST2000DM008" (Seagate), "WD40EZRZ" (Western Digital)
    • +
    • Floppy drives: "FD-235HF" (Teac), "JU-257A633P" (Panasonic)
    • +
    +
    +
    +Model-Specific Characteristics:
      +
    • Different models may have different error correction algorithms
    • +
    • Some models are known for superior read quality (e.g., Plextor Premium)
    • +
    • Certain models may have bugs or quirks in specific firmware versions
    • +
    • Professional models often have features not available in consumer versions
    • +
    • Important for reproducing imaging conditions or troubleshooting issues
    • +
    +
    +
    +Forensic Documentation:
      +
    • Complete drive identification aids in forensic reporting
    • +
    • Helps establish the reliability of the imaging process
    • +
    • May be required for compliance with forensic standards
    • +
    • Supports validation and verification procedures
    • +
    • Enables assessment of tool suitability for the imaging task
    • +
    +
    +
    +Historical and Research Value:
      +
    • Documents evolution of imaging technology over time
    • +
    • Helps identify best practices for specific media types
    • +
    • Useful for academic research on digital preservation
    • +
    • Aids in understanding drive availability and obsolescence
    • +
    +
    +
    Warning
    The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    + +

    Definition at line 1534 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::drive_model, MetadataBlockHeader::driveModelLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_drive_serial_number()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_drive_serial_number (void * context,
    const uint8_t * data,
    const int32_t length )
    +
    + +

    Sets the drive serial number for the image.

    +

    Records the unique serial number of the drive or device used to read or write the physical storage media. This metadata provides a unique identifier for the specific piece of hardware used in the imaging process, which is particularly important for forensic work, equipment tracking, and quality assurance. The serial number enables correlation between multiple images created with the same drive and can help identify drive-specific issues or characteristics. The serial number is stored in UTF-16LE encoding.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the drive serial number string data in UTF-16LE encoding (opaque byte array).
    lengthLength of the drive serial number data in bytes (must include full UTF-16LE character sequences).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set drive serial number. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the drive serial number string succeeded
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The drive serial number data is copied to ctx->imageInfo.DriveSerialNumber
    • +
    • The driveSerialNumberLength field is set in the metadata block header
    • +
    • Any previous drive serial number string is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the drive serial number string
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    Serial Number Sources:
      +
    • Hard drives and SSDs: Retrieved via ATA/SCSI IDENTIFY commands
    • +
    • Optical drives: Available through SCSI inquiry or ATA identify
    • +
    • Tape drives: Typically reported via SCSI inquiry data
    • +
    • USB devices: May have USB serial numbers or internal device serials
    • +
    • Some older or consumer devices may not report serial numbers
    • +
    +
    +
    +Forensic Applications:
      +
    • Critical for forensic chain of custody documentation
    • +
    • Uniquely identifies the specific hardware used for imaging
    • +
    • Enables tracking of drive calibration and maintenance history
    • +
    • Supports correlation of images created with the same equipment
    • +
    • May be required by forensic standards and best practices
    • +
    +
    +
    +Equipment Management:
      +
    • Helps track drive usage and workload for maintenance planning
    • +
    • Enables identification of drives requiring replacement or service
    • +
    • Supports equipment inventory and asset management systems
    • +
    • Useful for identifying drives with known issues or recalls
    • +
    • Facilitates warranty and support claim processing
    • +
    +
    +
    +Quality Assurance:
      +
    • Enables analysis of drive-specific error patterns
    • +
    • Helps identify if multiple imaging issues stem from the same drive
    • +
    • Supports statistical quality control processes
    • +
    • Aids in evaluating drive reliability over time
    • +
    • Can reveal degradation or calibration drift in aging hardware
    • +
    +
    +
    Warning
    The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    + +

    Definition at line 1658 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::drive_serial_number, MetadataBlockHeader::driveSerialNumberLength, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_geometry()

    + +
    +
    + + + + + + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_geometry (void * context,
    const uint32_t cylinders,
    const uint32_t heads,
    const uint32_t sectors_per_track )
    +
    + +

    Sets the logical CHS geometry for the AaruFormat image.

    +

    Configures the Cylinder-Head-Sector (CHS) geometry information for the image being created or modified. This function populates both the geometry block (used for storage in the image file) and the image information structure (used for runtime calculations). The geometry block contains legacy-style logical addressing parameters that describe how the storage medium should be logically organized in terms of cylinders, heads (tracks per cylinder), and sectors per track. This information is crucial for creating images that will be used with software requiring CHS addressing or for accurately preserving the original medium's logical structure.

    +
    Parameters
    + + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    cylindersThe number of cylinders to set for the geometry.
    headsThe number of heads (tracks per cylinder) to set for the geometry.
    sectors_per_trackThe number of sectors per track to set for the geometry.
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + +
    AARUF_STATUS_OK(0) Successfully set geometry information. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • The geometry block identifier is set to GeometryBlock
    • +
    • The geometry block fields (cylinders, heads, sectorsPerTrack) are updated
    • +
    • The image info fields (Cylinders, Heads, SectorsPerTrack) are synchronized
    • +
    • All parameters are stored for subsequent write operations
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    +
    +
    +
    Note
    Dual Storage:
      +
    • Geometry is stored in two locations within the context:
        +
      1. ctx->geometryBlock: Written to the image file as a GeometryBlock during close
      2. +
      3. ctx->imageInfo: Used for runtime calculations and metadata queries
      4. +
      +
    • +
    • Both locations are kept synchronized by this function
    • +
    +
    +
    +Geometry Calculation:
      +
    • Total logical sectors = cylinders × heads × sectors_per_track
    • +
    • Ensure the product matches the actual sector count in the image
    • +
    • Mismatched geometry may cause issues with legacy software or emulators
    • +
    • Sector size is separate and should be set via other API calls
    • +
    +
    +
    +CHS Addressing Requirements:
      +
    • Required for images intended for legacy BIOS or MBR partition schemes
    • +
    • Essential for floppy disk images and older hard disk images
    • +
    • May be optional or synthetic for modern large-capacity drives
    • +
    • Some virtualization platforms require valid CHS geometry
    • +
    +
    +
    +Parameter Constraints:
      +
    • No validation is performed on the geometry values
    • +
    • Zero values are technically accepted but may cause issues
    • +
    • Extremely large values may overflow in calculations (cylinders × heads × sectors_per_track)
    • +
    • Common constraints for legacy systems:
        +
      • Cylinders: typically 1-1024 for BIOS, up to 65535 for modern systems
      • +
      • Heads: typically 1-255 for most systems
      • +
      • Sectors per track: typically 1-63 for BIOS, up to 255 for modern systems
      • +
      +
    • +
    +
    +
    +Write Mode Requirement:
      +
    • This function is intended for use during image creation
    • +
    • Should be called after aaruf_create() and before writing sector data
    • +
    • The geometry block is serialized during aaruf_close()
    • +
    • Must be used with a write-enabled context
    • +
    +
    +
    +Historical Context:
      +
    • CHS geometry was the original addressing scheme for disk drives
    • +
    • Physical CHS reflected actual disk platters, heads, and sector layout
    • +
    • Logical CHS often differs from physical due to zone-bit recording and translation
    • +
    • Modern drives use LBA (Logical Block Addressing) internally
    • +
    +
    +
    Warning
    This function does not validate geometry consistency:
      +
    • Does not check if cylinders × heads × sectors_per_track equals image sector count
    • +
    • Does not prevent overflow in the multiplication
    • +
    • Caller must ensure geometry values are appropriate for the medium type
    • +
    • Invalid geometry may cause boot failures or data access issues
    • +
    +
    +
    +The geometry block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    +
    +Changing geometry after writing sector data may create inconsistencies. Set geometry before beginning sector write operations for best results.
    +
    +Some image formats and use cases don't require CHS geometry:
      +
    • Optical media (CD/DVD/BD) use different addressing schemes
    • +
    • Modern GPT-partitioned disks don't rely on CHS
    • +
    • Flash-based storage typically doesn't have meaningful CHS geometry
    • +
    • Setting geometry for such media types is harmless but unnecessary
    • +
    +
    + +

    Definition at line 229 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_READ_ONLY, AARUF_STATUS_OK, aaruformat_context::cylinders, GeometryBlockHeader::cylinders, FATAL, aaruformat_context::geometry_block, GeometryBlock, aaruformat_context::heads, GeometryBlockHeader::heads, GeometryBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::sectors_per_track, GeometryBlockHeader::sectorsPerTrack, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_media_barcode()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_media_barcode (void * context,
    const uint8_t * data,
    const int32_t length )
    +
    + +

    Sets the media barcode information for the image.

    +

    Records the barcode affixed to the physical storage media or its packaging. Barcodes are commonly used in professional archival and library environments for automated inventory management, tracking, and retrieval systems. This metadata enables correlation between physical media location systems and digital image files. The barcode is stored in UTF-16LE encoding.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the media barcode string data in UTF-16LE encoding (opaque byte array).
    lengthLength of the media barcode data in bytes (must include full UTF-16LE character sequences).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set media barcode. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the media barcode string succeeded
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The media barcode data is copied to ctx->imageInfo.MediaBarcode
    • +
    • The mediaBarcodeLength field is set in the metadata block header
    • +
    • Any previous media barcode string is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the media barcode string
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    Common Barcode Uses:
      +
    • Library and archival tape management systems
    • +
    • Automated tape library robotics (e.g., LTO tape cartridges)
    • +
    • Inventory tracking in large media collections
    • +
    • Asset management in corporate or institutional settings
    • +
    • Chain of custody tracking in forensic environments
    • +
    +
    +
    +Barcode Types and Formats:
      +
    • Code 39 and Code 128 are common for media labeling
    • +
    • LTO tapes use specific 6 or 8-character barcode formats
    • +
    • May include library-specific prefixes or location codes
    • +
    • Some systems use 2D barcodes (QR codes, Data Matrix)
    • +
    • Barcode should be recorded exactly as it appears
    • +
    +
    +
    +Integration with Physical Systems:
      +
    • Enables automated correlation between physical and digital catalogs
    • +
    • Supports robotic tape library operations
    • +
    • Facilitates retrieval from off-site storage facilities
    • +
    • Links to broader asset management databases
    • +
    • Critical for large-scale archival operations
    • +
    +
    +
    +Preservation Context:
      +
    • Important for long-term archival planning
    • +
    • Helps maintain inventory accuracy over time
    • +
    • Supports audit and compliance requirements
    • +
    • Enables efficient physical media location and retrieval
    • +
    +
    +
    Warning
    The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    + +

    Definition at line 1176 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::media_barcode, MetadataBlockHeader::mediaBarcodeLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_media_manufacturer()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_media_manufacturer (void * context,
    const uint8_t * data,
    const int32_t length )
    +
    + +

    Sets the media manufacturer information for the image.

    +

    Records the name of the company that manufactured the physical storage media. This metadata is valuable for preservation and forensic purposes, as it can help identify the media type, quality characteristics, and manufacturing period. The manufacturer name is stored in UTF-16LE encoding.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the media manufacturer string data in UTF-16LE encoding (opaque byte array).
    lengthLength of the media manufacturer data in bytes (must include full UTF-16LE character sequences).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set media manufacturer. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the media manufacturer string succeeded
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The media manufacturer data is copied to ctx->imageInfo.MediaManufacturer
    • +
    • The mediaManufacturerLength field is set in the metadata block header
    • +
    • Any previous media manufacturer string is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the media manufacturer string
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    Common Media Manufacturers:
      +
    • Optical discs: Verbatim, Sony, Maxell, TDK, Taiyo Yuden
    • +
    • Magnetic tapes: Fujifilm, Maxell, Sony, IBM
    • +
    • Floppy disks: 3M, Maxell, Sony, Verbatim
    • +
    • Flash media: SanDisk, Kingston, Samsung
    • +
    +
    +
    +Identification Methods:
      +
    • May be printed on the media surface or packaging
    • +
    • Can sometimes be detected from media ID codes (e.g., ATIP for CD-R)
    • +
    • Historical records or catalogs may provide this information
    • +
    • Important for understanding media quality and longevity characteristics
    • +
    +
    +
    +Preservation Value:
      +
    • Helps assess expected media lifespan and degradation patterns
    • +
    • Useful for identifying counterfeit or remarked media
    • +
    • Aids in research about media quality and failure modes
    • +
    • Provides context for archival planning and migration strategies
    • +
    +
    +
    Warning
    The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    + +

    Definition at line 832 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::media_manufacturer, MetadataBlockHeader::mediaManufacturerLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_media_model()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_media_model (void * context,
    const uint8_t * data,
    const int32_t length )
    +
    + +

    Sets the media model or product designation for the image.

    +

    Records the specific model, product line, or type designation of the physical storage media. This is more specific than the manufacturer and identifies the exact product variant. This metadata helps in identifying specific media characteristics, performance specifications, and compatibility information. The model information is stored in UTF-16LE encoding.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the media model string data in UTF-16LE encoding (opaque byte array).
    lengthLength of the media model data in bytes (must include full UTF-16LE character sequences).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set media model. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the media model string succeeded
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The media model data is copied to ctx->imageInfo.MediaModel
    • +
    • The mediaModelLength field is set in the metadata block header
    • +
    • Any previous media model string is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the media model string
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    Model Designation Examples:
      +
    • Optical discs: "DVD+R 16x", "CD-R 80min", "BD-R DL 50GB"
    • +
    • Tapes: "LTO-7", "DLT-IV", "AIT-3"
    • +
    • Floppy disks: "HD 1.44MB", "DD 720KB"
    • +
    • Flash cards: "SDHC Class 10", "CompactFlash 1000x"
    • +
    +
    +
    +Model Information Usage:
      +
    • Identifies specific capacity and speed ratings
    • +
    • Indicates format compatibility (e.g., DVD-R vs DVD+R)
    • +
    • Helps determine recording characteristics and quality tier
    • +
    • Useful for matching replacement media or troubleshooting issues
    • +
    +
    +
    Warning
    The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    + +

    Definition at line 939 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::media_model, MetadataBlockHeader::mediaModelLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_media_part_number()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_media_part_number (void * context,
    const uint8_t * data,
    const int32_t length )
    +
    + +

    Sets the media part number or model designation for the image.

    +

    Records the manufacturer's part number or catalog designation for the specific type of physical storage media. This is distinct from the media model in that it represents the exact ordering or catalog number used for procurement and inventory purposes. Part numbers are particularly important for sourcing compatible replacement media and for precise identification in technical documentation. The part number is stored in UTF-16LE encoding.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the media part number string data in UTF-16LE encoding (opaque byte array).
    lengthLength of the media part number data in bytes (must include full UTF-16LE character sequences).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set media part number. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the media part number string succeeded
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The media part number data is copied to ctx->imageInfo.MediaPartNumber
    • +
    • The mediaPartNumberLength field is set in the metadata block header
    • +
    • Any previous media part number string is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the media part number string
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    Part Number Examples:
      +
    • Optical media: "MR-25332" (Verbatim DVD+R), "CDR80JC" (Sony CD-R)
    • +
    • Tape media: "C7973A" (HP LTO-3), "TK88" (Maxell DLT-IV)
    • +
    • Floppy disks: "MF2HD" (3.5" high-density), "2D" (5.25" double-density)
    • +
    • May include regional variations or packaging size indicators
    • +
    +
    +
    +Practical Applications:
      +
    • Procurement and ordering of compatible replacement media
    • +
    • Cross-referencing with manufacturer specifications and datasheets
    • +
    • Identifying specific product revisions or manufacturing batches
    • +
    • Ensuring compatibility for archival media migration projects
    • +
    • Tracking costs and suppliers in institutional settings
    • +
    +
    +
    +Relationship to Model:
      +
    • Part number is more specific than model designation
    • +
    • Model might be "DVD+R 16x", part number "MR-25332"
    • +
    • Part numbers may vary by region, packaging quantity, or color
    • +
    • Critical for exact product identification in catalogs and databases
    • +
    +
    +
    +Documentation and Compliance:
      +
    • Useful for creating detailed preservation documentation
    • +
    • Supports compliance with archival standards and best practices
    • +
    • Enables precise replication of archival environments
    • +
    • Facilitates research on media types and failure modes
    • +
    +
    +
    Warning
    The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    + +

    Definition at line 1297 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::media_part_number, MetadataBlockHeader::mediaPartNumberLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_media_sequence()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_media_sequence (void * context,
    const int32_t sequence,
    const int32_t last_sequence )
    +
    + +

    Sets the media sequence information for multi-volume media sets.

    +

    Configures the sequence numbering for media that is part of a larger set, such as multi-disk software distributions, backup sets spanning multiple tapes, or optical disc sets. This function records both the current media's position in the sequence and the total number of media in the complete set. This metadata is essential for proper ordering and completeness verification when working with multi-volume archives.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    sequenceThe sequence number of this media (1-based index indicating position in the set).
    last_sequenceThe total number of media in the complete set (indicates the final sequence number).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + +
    AARUF_STATUS_OK(0) Successfully set media sequence information. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The mediaSequence field is set to the provided sequence value
    • +
    • The lastMediaSequence field is set to the provided last_sequence value
    • +
    • Both values are stored for serialization during image close
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    +
    +
    +
    Note
    Sequence Numbering:
      +
    • Sequence numbers are typically 1-based (first disc is 1, not 0)
    • +
    • The sequence parameter should be in the range [1, last_sequence]
    • +
    • last_sequence indicates the total count of media in the set
    • +
    • Example: For a 3-disc set, disc 2 would have sequence=2, last_sequence=3
    • +
    +
    +
    +Common Use Cases:
      +
    • Multi-CD/DVD software installations (e.g., "Disc 2 of 4")
    • +
    • Backup tape sets spanning multiple volumes
    • +
    • Split archive formats requiring sequential processing
    • +
    • Multi-floppy disk software distributions
    • +
    • Large data sets divided across multiple optical discs
    • +
    +
    +
    +Metadata Block Initialization:
      +
    • If the metadata block header is not yet initialized, this function initializes it
    • +
    • The metadataBlockHeader.identifier is set to MetadataBlock automatically
    • +
    • Multiple metadata setter functions can be called to build complete metadata
    • +
    • All metadata is written to the image file during aaruf_close()
    • +
    +
    +
    +Single Media Images:
      +
    • For standalone media not part of a set, use sequence=1, last_sequence=1
    • +
    • Setting both values to 0 may be used to indicate "not part of a sequence"
    • +
    • The function does not validate that sequence <= last_sequence
    • +
    +
    +
    +Parameter Validation:
      +
    • No validation is performed on sequence numbers
    • +
    • Negative values are accepted but may be semantically incorrect
    • +
    • sequence > last_sequence is not prevented but indicates an error condition
    • +
    • Callers should ensure sequence and last_sequence are logically consistent
    • +
    +
    +
    +Archive Integrity:
      +
    • Proper sequence metadata is crucial for multi-volume restoration
    • +
    • Archival software may refuse to extract if sequence information is incorrect
    • +
    • Missing volumes can be detected by checking sequence completeness
    • +
    • Helps prevent data loss from incomplete multi-volume sets
    • +
    +
    +
    +Historical Context:
      +
    • Multi-volume sets were common in the floppy disk era due to size constraints
    • +
    • CD/DVD sets were used for large software distributions (operating systems, games)
    • +
    • Tape backup systems still use multi-volume sets for large archives
    • +
    • Modern optical media (BD-R DL) reduced the need for multi-disc sets
    • +
    +
    +
    Warning
    This function does not validate the logical consistency of sequence numbers:
      +
    • Does not check if sequence <= last_sequence
    • +
    • Does not prevent negative or zero values if semantically inappropriate
    • +
    • Caller must ensure values represent a valid sequence relationship
    • +
    +
    +
    +The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    +
    +Incorrect sequence information may prevent proper reconstruction:
      +
    • Software relying on sequence numbers may fail to recognize media order
    • +
    • Archival systems may incorrectly report missing volumes
    • +
    • Restoration processes may fail if sequence is inconsistent
    • +
    +
    + +

    Definition at line 363 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, MetadataBlockHeader::lastMediaSequence, aaruformat_context::magic, MetadataBlockHeader::mediaSequence, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_media_serial_number()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_media_serial_number (void * context,
    const uint8_t * data,
    const int32_t length )
    +
    + +

    Sets the media serial number for the image.

    +

    Records the unique serial number assigned to the physical storage media by the manufacturer. This metadata provides a unique identifier for the specific piece of media, which is invaluable for tracking, authentication, and forensic analysis. Not all media types have serial numbers; this is most common with professional-grade media and some consumer optical discs. The serial number is stored in UTF-16LE encoding.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the media serial number string data in UTF-16LE encoding (opaque byte array).
    lengthLength of the media serial number data in bytes (must include full UTF-16LE character sequences).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set media serial number. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the media serial number string succeeded
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The media serial number data is copied to ctx->imageInfo.MediaSerialNumber
    • +
    • The mediaSerialNumberLength field is set in the metadata block header
    • +
    • Any previous media serial number string is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the media serial number string
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    Serial Number Availability:
      +
    • Professional tape media (LTO, DLT, etc.) typically have printed serial numbers
    • +
    • Some optical discs have embedded media IDs that can serve as serial numbers
    • +
    • Hard drives and SSDs have electronically-readable serial numbers
    • +
    • Consumer recordable media (CD-R, DVD-R) rarely have unique serial numbers
    • +
    • May be printed on labels, hubs, or cartridge shells
    • +
    +
    +
    +Forensic and Archival Importance:
      +
    • Uniquely identifies the specific physical media instance
    • +
    • Critical for chain of custody in forensic investigations
    • +
    • Enables tracking of media throughout its lifecycle
    • +
    • Helps prevent mix-ups in large media collections
    • +
    • Can verify authenticity and detect counterfeits
    • +
    +
    +
    +Format Considerations:
      +
    • Serial numbers may be alphanumeric, numeric, or contain special characters
    • +
    • Format varies widely between manufacturers and media types
    • +
    • May include check digits or formatting separators
    • +
    • Should be recorded exactly as it appears on the media
    • +
    +
    +
    Warning
    The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    + +

    Definition at line 1054 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::media_serial_number, MetadataBlockHeader::mediaSerialNumberLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    + +

    ◆ aaruf_set_media_title()

    + +
    +
    + + + + + + + + + + + + + + + + +
    int32_t aaruf_set_media_title (void * context,
    const uint8_t * data,
    const int32_t length )
    +
    + +

    Sets the media title or label for the image.

    +

    Records the title, label, or name printed or written on the physical storage media. This metadata is particularly useful for identifying discs, tapes, or other media that have user-applied labels or manufacturer-printed titles. The title is stored in UTF-16LE encoding to support international characters and special symbols.

    +
    Parameters
    + + + + +
    contextPointer to the aaruformat context (must be a valid, write-enabled image context).
    dataPointer to the media title string data in UTF-16LE encoding (opaque byte array).
    lengthLength of the media title data in bytes (must include full UTF-16LE character sequences).
    +
    +
    +
    Returns
    Returns one of the following status codes:
    +
    Return values
    + + + + + +
    AARUF_STATUS_OK(0) Successfully set media title. This is returned when:
      +
    • The context is valid and properly initialized
    • +
    • The context is opened in write mode (ctx->isWriting is true)
    • +
    • Memory allocation for the media title string succeeded
    • +
    • The metadata block header is initialized (identifier set to MetadataBlock)
    • +
    • The media title data is copied to ctx->imageInfo.MediaTitle
    • +
    • The mediaTitleLength field is set in the metadata block header
    • +
    • Any previous media title string is properly freed before replacement
    • +
    +
    AARUF_ERROR_NOT_AARUFORMAT(-1) The context is invalid. This occurs when:
      +
    • The context parameter is NULL
    • +
    • The context magic number doesn't match AARU_MAGIC (invalid context type)
    • +
    • The context was not properly initialized by aaruf_create()
    • +
    +
    AARUF_READ_ONLY(-13) The context is not opened for writing. This occurs when:
      +
    • The image was opened with aaruf_open() instead of aaruf_create()
    • +
    • The context's isWriting flag is false
    • +
    • Attempting to modify a read-only image
    • +
    +
    AARUF_ERROR_NOT_ENOUGH_MEMORY(-8) Memory allocation failed. This occurs when:
      +
    • malloc() failed to allocate the required memory for the media title string
    • +
    • System is out of memory or memory is severely fragmented
    • +
    • The requested allocation size is too large
    • +
    +
    +
    +
    +
    Note
    Common Media Title Examples:
      +
    • Handwritten labels on optical discs or tapes
    • +
    • Pre-printed software names on distribution media (e.g., "Windows 95 Setup Disk 1")
    • +
    • Volume labels or disc names (e.g., "BACKUP_2024", "INSTALL_CD")
    • +
    • Game titles printed on cartridges or discs
    • +
    • Album or movie titles on multimedia discs
    • +
    +
    +
    +Preservation Context:
      +
    • Important for archival purposes to record exactly what appears on the media
    • +
    • Helps identify media in large collections
    • +
    • May differ from filesystem volume labels
    • +
    • Useful for matching physical media to digital images
    • +
    +
    +
    +UTF-16LE Encoding:
      +
    • The data parameter must contain a valid UTF-16LE encoded string
    • +
    • Length must be in bytes, not character count
    • +
    • Supports international characters, emoji, and special symbols
    • +
    • Null termination is not required; length specifies the exact byte count
    • +
    +
    +
    Warning
    The metadata block is only written to the image file during aaruf_close(). Changes made by this function are not immediately persisted.
    + +

    Definition at line 720 of file metadata.c.

    + +

    References AARU_MAGIC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_READ_ONLY, AARUF_STATUS_OK, FATAL, MetadataBlockHeader::identifier, aaruformat_context::is_writing, aaruformat_context::magic, aaruformat_context::media_title, MetadataBlockHeader::mediaTitleLength, aaruformat_context::metadata_block_header, MetadataBlock, and TRACE.

    + +
    +
    +
    +
    + +
    + + + + diff --git a/docs/html/metadata_8c.js b/docs/html/metadata_8c.js new file mode 100644 index 0000000..17ac292 --- /dev/null +++ b/docs/html/metadata_8c.js @@ -0,0 +1,38 @@ +var metadata_8c = +[ + [ "aaruf_get_aaru_json_metadata", "metadata_8c.html#a01cf0abe0b137236d4be0b91a29d4818", null ], + [ "aaruf_get_cicm_metadata", "metadata_8c.html#a42f191c2ea4c70c9d7b373c19b59c812", null ], + [ "aaruf_get_comments", "metadata_8c.html#a9628bcfd2642649a6bcbf1f46d6b6705", null ], + [ "aaruf_get_creator", "metadata_8c.html#a38d72be7e7854d6cb0bba89172e27b03", null ], + [ "aaruf_get_drive_firmware_revision", "metadata_8c.html#a3db92f6bebf60195d6ab327e17988cee", null ], + [ "aaruf_get_drive_manufacturer", "metadata_8c.html#a5d487a858c48838bcc9f3bba4b5944a1", null ], + [ "aaruf_get_drive_model", "metadata_8c.html#a54d724659818ea4486f9981672f6d01e", null ], + [ "aaruf_get_drive_serial_number", "metadata_8c.html#a1892cc8395305d7e85d04544ded62131", null ], + [ "aaruf_get_geometry", "metadata_8c.html#abbcf276c3518b3e666885ab250fd374e", null ], + [ "aaruf_get_image_info", "metadata_8c.html#a65c73217edb9661accbbe3de4f555b62", null ], + [ "aaruf_get_media_barcode", "metadata_8c.html#a580c8bf133cf3481deca14779b8b5419", null ], + [ "aaruf_get_media_manufacturer", "metadata_8c.html#a515c264f726f8b0a5104778b383ad1d4", null ], + [ "aaruf_get_media_model", "metadata_8c.html#a509892f76c9a03a030693740d043adfc", null ], + [ "aaruf_get_media_part_number", "metadata_8c.html#a4cdfb46f5630fcf1fe6447b37ad18ae2", null ], + [ "aaruf_get_media_sequence", "metadata_8c.html#aa683ff7387ba3f505b1756da1b408f7e", null ], + [ "aaruf_get_media_serial_number", "metadata_8c.html#a4cb7b7200e36efb4983cf2c5c5543313", null ], + [ "aaruf_get_media_title", "metadata_8c.html#af1ca27c052c6cde38a8d6d71e10936db", null ], + [ "aaruf_get_negative_sectors", "metadata_8c.html#a8e00d26a8e751fbd412868ac4f92a3c0", null ], + [ "aaruf_get_overflow_sectors", "metadata_8c.html#aeeae64b120a10bac5e3d757a07a9691a", null ], + [ "aaruf_get_user_sectors", "metadata_8c.html#a7e63f10ff3ea353c8c3944cd836a85ee", null ], + [ "aaruf_set_aaru_json_metadata", "metadata_8c.html#a8090a039e00ee003569939332d21094e", null ], + [ "aaruf_set_comments", "metadata_8c.html#ad24b15e067720825c47610e9477bfc2a", null ], + [ "aaruf_set_creator", "metadata_8c.html#af28837461d12252d8258032e370585ae", null ], + [ "aaruf_set_drive_firmware_revision", "metadata_8c.html#adaa13a82dfc90987efd6c9a366904dc4", null ], + [ "aaruf_set_drive_manufacturer", "metadata_8c.html#a223856fa226b26c466997800183c97c4", null ], + [ "aaruf_set_drive_model", "metadata_8c.html#a29b6c38ce4b3420368ecb84007d8738d", null ], + [ "aaruf_set_drive_serial_number", "metadata_8c.html#ae6b0a57476896bb90ee7bb8472e1078f", null ], + [ "aaruf_set_geometry", "metadata_8c.html#ad0b5b12288f159780d065b12ba12bdcc", null ], + [ "aaruf_set_media_barcode", "metadata_8c.html#a0e5be9ff6d87218a8f5b451a27e1b39b", null ], + [ "aaruf_set_media_manufacturer", "metadata_8c.html#add92b8c91ede6a62dfda5f8980c3ce6d", null ], + [ "aaruf_set_media_model", "metadata_8c.html#a0ed36b14e49f1e924906d9c4b26d6214", null ], + [ "aaruf_set_media_part_number", "metadata_8c.html#ac7c87ae51a242428ceb6d2b0a75e0b70", null ], + [ "aaruf_set_media_sequence", "metadata_8c.html#a10d528163caf65134a7cec4a0c0a33b8", null ], + [ "aaruf_set_media_serial_number", "metadata_8c.html#ad06ae4d49d6de002ef565108c73451e1", null ], + [ "aaruf_set_media_title", "metadata_8c.html#a2f344544e412db0bfb46d3dfb509dd91", null ] +]; \ No newline at end of file diff --git a/docs/html/metadata_8c_source.html b/docs/html/metadata_8c_source.html new file mode 100644 index 0000000..614d142 --- /dev/null +++ b/docs/html/metadata_8c_source.html @@ -0,0 +1,1993 @@ + + + + + + + +libaaruformat: src/metadata.c Source File + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    libaaruformat 1.0 +
    +
    Aaru Data Preservation Suite - Format Library
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    metadata.c
    +
    +
    +Go to the documentation of this file.
    1/*
    +
    2 * This file is part of the Aaru Data Preservation Suite.
    +
    3 * Copyright (c) 2019-2025 Natalia Portillo.
    +
    4 *
    +
    5 * This library is free software; you can redistribute it and/or modify
    +
    6 * it under the terms of the GNU Lesser General Public License as
    +
    7 * published by the Free Software Foundation; either version 2.1 of the
    +
    8 * License, or (at your option) any later version.
    +
    9 *
    +
    10 * This library is distributed in the hope that it will be useful, but
    +
    11 * WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    13 * Lesser General Public License for more details.
    +
    14 *
    +
    15 * You should have received a copy of the GNU Lesser General Public
    +
    16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
    +
    17 */
    +
    18
    +
    19#include <stddef.h>
    +
    20#include <stdint.h>
    +
    21
    +
    22#include "aaruformat.h"
    +
    23#include "log.h"
    +
    24
    +
    +
    94int32_t aaruf_get_geometry(const void *context, uint32_t *cylinders, uint32_t *heads, uint32_t *sectors_per_track)
    +
    95{
    +
    96 TRACE("Entering aaruf_get_geometry(%p, %p, %p, %p)", context, cylinders, heads, sectors_per_track);
    +
    97
    +
    98 const aaruformat_context *ctx = NULL;
    +
    99
    +
    100 if(context == NULL)
    +
    101 {
    +
    102 FATAL("Invalid context");
    +
    103
    +
    104 TRACE("Exiting aaruf_get_geometry() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    106 }
    +
    107
    +
    108 ctx = context;
    +
    109
    +
    110 // Not a libaaruformat context
    +
    111 if(ctx->magic != AARU_MAGIC)
    +
    112 {
    +
    113 FATAL("Invalid context");
    +
    114
    +
    115 TRACE("Exiting aaruf_get_geometry() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    117 }
    +
    118
    + +
    120 {
    +
    121 FATAL("No geometry block present");
    +
    122
    +
    123 TRACE("Exiting aaruf_get_geometry() = AARUF_ERROR_CANNOT_READ_BLOCK");
    + +
    125 }
    +
    126
    +
    127 *cylinders = ctx->geometry_block.cylinders;
    +
    128 *heads = ctx->geometry_block.heads;
    +
    129 *sectors_per_track = ctx->geometry_block.sectorsPerTrack;
    +
    130
    +
    131 TRACE("Exiting aaruf_get_geometry(%p, %u, %u, %u) = AARUF_STATUS_OK", context, *cylinders, *heads,
    +
    132 *sectors_per_track);
    +
    133 return AARUF_STATUS_OK;
    +
    134}
    +
    +
    135
    +
    +
    229int32_t aaruf_set_geometry(void *context, const uint32_t cylinders, const uint32_t heads,
    +
    230 const uint32_t sectors_per_track)
    +
    231{
    +
    232 TRACE("Entering aaruf_set_geometry(%p, %u, %u, %u)", context, cylinders, heads, sectors_per_track);
    +
    233
    +
    234 aaruformat_context *ctx = NULL;
    +
    235
    +
    236 if(context == NULL)
    +
    237 {
    +
    238 FATAL("Invalid context");
    +
    239
    +
    240 TRACE("Exiting aaruf_set_geometry() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    242 }
    +
    243
    +
    244 ctx = context;
    +
    245
    +
    246 // Not a libaaruformat context
    +
    247 if(ctx->magic != AARU_MAGIC)
    +
    248 {
    +
    249 FATAL("Invalid context");
    +
    250
    +
    251 TRACE("Exiting aaruf_set_geometry() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    253 }
    +
    254
    +
    255 // Check we are writing
    +
    256 if(!ctx->is_writing)
    +
    257 {
    +
    258 FATAL("Trying to write a read-only image");
    +
    259
    +
    260 TRACE("Exiting aaruf_write_sector() = AARUF_READ_ONLY");
    +
    261 return AARUF_READ_ONLY;
    +
    262 }
    +
    263
    + +
    265 ctx->geometry_block.cylinders = cylinders;
    +
    266 ctx->geometry_block.heads = heads;
    +
    267 ctx->geometry_block.sectorsPerTrack = sectors_per_track;
    +
    268 ctx->cylinders = cylinders;
    +
    269 ctx->heads = heads;
    +
    270 ctx->sectors_per_track = sectors_per_track;
    +
    271
    +
    272 TRACE("Exiting aaruf_set_geometry(%p, %u, %u, %u) = AARUF_STATUS_OK", context, cylinders, heads, sectors_per_track);
    +
    273 return AARUF_STATUS_OK;
    +
    274}
    +
    +
    275
    +
    +
    363int32_t aaruf_set_media_sequence(void *context, const int32_t sequence, const int32_t last_sequence)
    +
    364{
    +
    365 TRACE("Entering aaruf_set_media_sequence(%p, %d, %d)", context, sequence, last_sequence);
    +
    366
    +
    367 // Check context is correct AaruFormat context
    +
    368 if(context == NULL)
    +
    369 {
    +
    370 FATAL("Invalid context");
    +
    371
    +
    372 TRACE("Exiting aaruf_set_media_sequence() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    374 }
    +
    375
    +
    376 aaruformat_context *ctx = context;
    +
    377
    +
    378 // Not a libaaruformat context
    +
    379 if(ctx->magic != AARU_MAGIC)
    +
    380 {
    +
    381 FATAL("Invalid context");
    +
    382
    +
    383 TRACE("Exiting aaruf_set_media_sequence() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    385 }
    +
    386
    +
    387 // Check we are writing
    +
    388 if(!ctx->is_writing)
    +
    389 {
    +
    390 FATAL("Trying to write a read-only image");
    +
    391
    +
    392 TRACE("Exiting aaruf_set_media_sequence() = AARUF_READ_ONLY");
    +
    393 return AARUF_READ_ONLY;
    +
    394 }
    +
    395
    +
    396 // Initialize
    + +
    398
    +
    399 ctx->metadata_block_header.mediaSequence = sequence;
    +
    400 ctx->metadata_block_header.lastMediaSequence = last_sequence;
    +
    401
    +
    402 TRACE("Exiting aaruf_set_media_sequence(%p, %d, %d) = AARUF_STATUS_OK", context, sequence, last_sequence);
    +
    403 return AARUF_STATUS_OK;
    +
    404}
    +
    +
    405
    +
    +
    493int32_t aaruf_set_creator(void *context, const uint8_t *data, const int32_t length)
    +
    494{
    +
    495 TRACE("Entering aaruf_set_creator(%p, %p, %d)", context, data, length);
    +
    496
    +
    497 // Check context is correct AaruFormat context
    +
    498 if(context == NULL)
    +
    499 {
    +
    500 FATAL("Invalid context");
    +
    501
    +
    502 TRACE("Exiting aaruf_set_creator() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    504 }
    +
    505
    +
    506 aaruformat_context *ctx = context;
    +
    507
    +
    508 // Not a libaaruformat context
    +
    509 if(ctx->magic != AARU_MAGIC)
    +
    510 {
    +
    511 FATAL("Invalid context");
    +
    512
    +
    513 TRACE("Exiting aaruf_set_creator() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    515 }
    +
    516
    +
    517 // Check we are writing
    +
    518 if(!ctx->is_writing)
    +
    519 {
    +
    520 FATAL("Trying to write a read-only image");
    +
    521
    +
    522 TRACE("Exiting aaruf_set_creator() = AARUF_READ_ONLY");
    +
    523 return AARUF_READ_ONLY;
    +
    524 }
    +
    525
    +
    526 // Initialize
    + +
    528
    +
    529 // Reserve memory
    +
    530 uint8_t *copy = malloc(length);
    +
    531 if(copy == NULL)
    +
    532 {
    +
    533 FATAL("Could not allocate memory for creator");
    + +
    535 }
    +
    536
    +
    537 // Copy opaque UTF-16LE string
    +
    538 memcpy(copy, data, length);
    +
    539 if(ctx->creator != NULL) free(ctx->creator);
    +
    540 ctx->creator = copy;
    + +
    542
    +
    543 TRACE("Exiting aaruf_set_creator(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    544 return AARUF_STATUS_OK;
    +
    545}
    +
    +
    546
    +
    +
    607int32_t aaruf_set_comments(void *context, const uint8_t *data, const int32_t length)
    +
    608{
    +
    609 TRACE("Entering aaruf_set_comments(%p, %p, %d)", context, data, length);
    +
    610
    +
    611 // Check context is correct AaruFormat context
    +
    612 if(context == NULL)
    +
    613 {
    +
    614 FATAL("Invalid context");
    +
    615
    +
    616 TRACE("Exiting aaruf_set_comments() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    618 }
    +
    619
    +
    620 aaruformat_context *ctx = context;
    +
    621
    +
    622 // Not a libaaruformat context
    +
    623 if(ctx->magic != AARU_MAGIC)
    +
    624 {
    +
    625 FATAL("Invalid context");
    +
    626
    +
    627 TRACE("Exiting aaruf_set_comments() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    629 }
    +
    630
    +
    631 // Check we are writing
    +
    632 if(!ctx->is_writing)
    +
    633 {
    +
    634 FATAL("Trying to write a read-only image");
    +
    635
    +
    636 TRACE("Exiting aaruf_set_comments() = AARUF_READ_ONLY");
    +
    637 return AARUF_READ_ONLY;
    +
    638 }
    +
    639
    +
    640 // Initialize
    + +
    642
    +
    643 // Reserve memory
    +
    644 uint8_t *copy = malloc(length);
    +
    645 if(copy == NULL)
    +
    646 {
    +
    647 FATAL("Could not allocate memory for comments");
    + +
    649 }
    +
    650
    +
    651 // Copy opaque UTF-16LE string
    +
    652 memcpy(copy, data, length);
    +
    653 if(ctx->comments != NULL) free(ctx->comments);
    +
    654 ctx->comments = copy;
    + +
    656
    +
    657 TRACE("Exiting aaruf_set_comments(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    658 return AARUF_STATUS_OK;
    +
    659}
    +
    +
    660
    +
    +
    720int32_t aaruf_set_media_title(void *context, const uint8_t *data, const int32_t length)
    +
    721{
    +
    722 TRACE("Entering aaruf_set_media_title(%p, %p, %d)", context, data, length);
    +
    723
    +
    724 // Check context is correct AaruFormat context
    +
    725 if(context == NULL)
    +
    726 {
    +
    727 FATAL("Invalid context");
    +
    728
    +
    729 TRACE("Exiting aaruf_set_media_title() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    731 }
    +
    732
    +
    733 aaruformat_context *ctx = context;
    +
    734
    +
    735 // Not a libaaruformat context
    +
    736 if(ctx->magic != AARU_MAGIC)
    +
    737 {
    +
    738 FATAL("Invalid context");
    +
    739
    +
    740 TRACE("Exiting aaruf_set_media_title() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    742 }
    +
    743
    +
    744 // Check we are writing
    +
    745 if(!ctx->is_writing)
    +
    746 {
    +
    747 FATAL("Trying to write a read-only image");
    +
    748
    +
    749 TRACE("Exiting aaruf_set_media_title() = AARUF_READ_ONLY");
    +
    750 return AARUF_READ_ONLY;
    +
    751 }
    +
    752
    +
    753 // Initialize
    + +
    755
    +
    756 // Reserve memory
    +
    757 uint8_t *copy = malloc(length);
    +
    758 if(copy == NULL)
    +
    759 {
    +
    760 FATAL("Could not allocate memory for media title");
    + +
    762 }
    +
    763
    +
    764 // Copy opaque UTF-16LE string
    +
    765 memcpy(copy, data, length);
    +
    766 if(ctx->media_title != NULL) free(ctx->media_title);
    +
    767 ctx->media_title = copy;
    + +
    769
    +
    770 TRACE("Exiting aaruf_set_media_title(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    771 return AARUF_STATUS_OK;
    +
    772}
    +
    +
    773
    +
    +
    832int32_t aaruf_set_media_manufacturer(void *context, const uint8_t *data, const int32_t length)
    +
    833{
    +
    834 TRACE("Entering aaruf_set_media_manufacturer(%p, %p, %d)", context, data, length);
    +
    835
    +
    836 // Check context is correct AaruFormat context
    +
    837 if(context == NULL)
    +
    838 {
    +
    839 FATAL("Invalid context");
    +
    840
    +
    841 TRACE("Exiting aaruf_set_media_manufacturer() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    843 }
    +
    844
    +
    845 aaruformat_context *ctx = context;
    +
    846
    +
    847 // Not a libaaruformat context
    +
    848 if(ctx->magic != AARU_MAGIC)
    +
    849 {
    +
    850 FATAL("Invalid context");
    +
    851
    +
    852 TRACE("Exiting aaruf_set_media_manufacturer() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    854 }
    +
    855
    +
    856 // Check we are writing
    +
    857 if(!ctx->is_writing)
    +
    858 {
    +
    859 FATAL("Trying to write a read-only image");
    +
    860
    +
    861 TRACE("Exiting aaruf_set_media_manufacturer() = AARUF_READ_ONLY");
    +
    862 return AARUF_READ_ONLY;
    +
    863 }
    +
    864
    +
    865 // Initialize
    + +
    867
    +
    868 // Reserve memory
    +
    869 uint8_t *copy = malloc(length);
    +
    870 if(copy == NULL)
    +
    871 {
    +
    872 FATAL("Could not allocate memory for media manufacturer");
    + +
    874 }
    +
    875
    +
    876 // Copy opaque UTF-16LE string
    +
    877 memcpy(copy, data, length);
    +
    878 if(ctx->media_manufacturer != NULL) free(ctx->media_manufacturer);
    +
    879 ctx->media_manufacturer = copy;
    + +
    881
    +
    882 TRACE("Exiting aaruf_set_media_manufacturer(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    883 return AARUF_STATUS_OK;
    +
    884}
    +
    +
    885
    +
    +
    939int32_t aaruf_set_media_model(void *context, const uint8_t *data, const int32_t length)
    +
    940{
    +
    941 TRACE("Entering aaruf_set_media_model(%p, %p, %d)", context, data, length);
    +
    942
    +
    943 // Check context is correct AaruFormat context
    +
    944 if(context == NULL)
    +
    945 {
    +
    946 FATAL("Invalid context");
    +
    947
    +
    948 TRACE("Exiting aaruf_set_media_model() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    950 }
    +
    951
    +
    952 aaruformat_context *ctx = context;
    +
    953
    +
    954 // Not a libaaruformat context
    +
    955 if(ctx->magic != AARU_MAGIC)
    +
    956 {
    +
    957 FATAL("Invalid context");
    +
    958
    +
    959 TRACE("Exiting aaruf_set_media_model() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    961 }
    +
    962
    +
    963 // Check we are writing
    +
    964 if(!ctx->is_writing)
    +
    965 {
    +
    966 FATAL("Trying to write a read-only image");
    +
    967
    +
    968 TRACE("Exiting aaruf_set_media_model() = AARUF_READ_ONLY");
    +
    969 return AARUF_READ_ONLY;
    +
    970 }
    +
    971
    +
    972 // Initialize
    + +
    974
    +
    975 // Reserve memory
    +
    976 uint8_t *copy = malloc(length);
    +
    977 if(copy == NULL)
    +
    978 {
    +
    979 FATAL("Could not allocate memory for media model");
    + +
    981 }
    +
    982
    +
    983 // Copy opaque UTF-16LE string
    +
    984 memcpy(copy, data, length);
    +
    985 if(ctx->media_model != NULL) free(ctx->media_model);
    +
    986 ctx->media_model = copy;
    + +
    988
    +
    989 TRACE("Exiting aaruf_set_media_model(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    990 return AARUF_STATUS_OK;
    +
    991}
    +
    +
    992
    +
    +
    1054int32_t aaruf_set_media_serial_number(void *context, const uint8_t *data, const int32_t length)
    +
    1055{
    +
    1056 TRACE("Entering aaruf_set_media_serial_number(%p, %p, %d)", context, data, length);
    +
    1057
    +
    1058 // Check context is correct AaruFormat context
    +
    1059 if(context == NULL)
    +
    1060 {
    +
    1061 FATAL("Invalid context");
    +
    1062
    +
    1063 TRACE("Exiting aaruf_set_media_serial_number() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1065 }
    +
    1066
    +
    1067 aaruformat_context *ctx = context;
    +
    1068
    +
    1069 // Not a libaaruformat context
    +
    1070 if(ctx->magic != AARU_MAGIC)
    +
    1071 {
    +
    1072 FATAL("Invalid context");
    +
    1073
    +
    1074 TRACE("Exiting aaruf_set_media_serial_number() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1076 }
    +
    1077
    +
    1078 // Check we are writing
    +
    1079 if(!ctx->is_writing)
    +
    1080 {
    +
    1081 FATAL("Trying to write a read-only image");
    +
    1082
    +
    1083 TRACE("Exiting aaruf_set_media_serial_number() = AARUF_READ_ONLY");
    +
    1084 return AARUF_READ_ONLY;
    +
    1085 }
    +
    1086
    +
    1087 // Initialize
    + +
    1089
    +
    1090 // Reserve memory
    +
    1091 uint8_t *copy = malloc(length);
    +
    1092 if(copy == NULL)
    +
    1093 {
    +
    1094 FATAL("Could not allocate memory for media serial number");
    + +
    1096 }
    +
    1097
    +
    1098 // Copy opaque UTF-16LE string
    +
    1099 memcpy(copy, data, length);
    +
    1100 if(ctx->media_serial_number != NULL) free(ctx->media_serial_number);
    +
    1101 ctx->media_serial_number = copy;
    + +
    1103
    +
    1104 TRACE("Exiting aaruf_set_media_serial_number(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    1105 return AARUF_STATUS_OK;
    +
    1106}
    +
    +
    1107
    +
    +
    1176int32_t aaruf_set_media_barcode(void *context, const uint8_t *data, const int32_t length)
    +
    1177{
    +
    1178 TRACE("Entering aaruf_set_media_barcode(%p, %p, %d)", context, data, length);
    +
    1179
    +
    1180 // Check context is correct AaruFormat context
    +
    1181 if(context == NULL)
    +
    1182 {
    +
    1183 FATAL("Invalid context");
    +
    1184
    +
    1185 TRACE("Exiting aaruf_set_media_barcode() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1187 }
    +
    1188
    +
    1189 aaruformat_context *ctx = context;
    +
    1190
    +
    1191 // Not a libaaruformat context
    +
    1192 if(ctx->magic != AARU_MAGIC)
    +
    1193 {
    +
    1194 FATAL("Invalid context");
    +
    1195
    +
    1196 TRACE("Exiting aaruf_set_media_barcode() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1198 }
    +
    1199
    +
    1200 // Check we are writing
    +
    1201 if(!ctx->is_writing)
    +
    1202 {
    +
    1203 FATAL("Trying to write a read-only image");
    +
    1204
    +
    1205 TRACE("Exiting aaruf_set_media_barcode() = AARUF_READ_ONLY");
    +
    1206 return AARUF_READ_ONLY;
    +
    1207 }
    +
    1208
    +
    1209 // Initialize
    + +
    1211
    +
    1212 // Reserve memory
    +
    1213 uint8_t *copy = malloc(length);
    +
    1214 if(copy == NULL)
    +
    1215 {
    +
    1216 FATAL("Could not allocate memory for media barcode");
    + +
    1218 }
    +
    1219
    +
    1220 // Copy opaque UTF-16LE string
    +
    1221 memcpy(copy, data, length);
    +
    1222 if(ctx->media_barcode != NULL) free(ctx->media_barcode);
    +
    1223 ctx->media_barcode = copy;
    + +
    1225
    +
    1226 TRACE("Exiting aaruf_set_media_barcode(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    1227 return AARUF_STATUS_OK;
    +
    1228}
    +
    +
    1229
    +
    +
    1297int32_t aaruf_set_media_part_number(void *context, const uint8_t *data, const int32_t length)
    +
    1298{
    +
    1299 TRACE("Entering aaruf_set_media_part_number(%p, %p, %d)", context, data, length);
    +
    1300
    +
    1301 // Check context is correct AaruFormat context
    +
    1302 if(context == NULL)
    +
    1303 {
    +
    1304 FATAL("Invalid context");
    +
    1305
    +
    1306 TRACE("Exiting aaruf_set_media_part_number() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1308 }
    +
    1309
    +
    1310 aaruformat_context *ctx = context;
    +
    1311
    +
    1312 // Not a libaaruformat context
    +
    1313 if(ctx->magic != AARU_MAGIC)
    +
    1314 {
    +
    1315 FATAL("Invalid context");
    +
    1316
    +
    1317 TRACE("Exiting aaruf_set_media_part_number() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1319 }
    +
    1320
    +
    1321 // Check we are writing
    +
    1322 if(!ctx->is_writing)
    +
    1323 {
    +
    1324 FATAL("Trying to write a read-only image");
    +
    1325
    +
    1326 TRACE("Exiting aaruf_set_media_part_number() = AARUF_READ_ONLY");
    +
    1327 return AARUF_READ_ONLY;
    +
    1328 }
    +
    1329
    +
    1330 // Initialize
    + +
    1332
    +
    1333 // Reserve memory
    +
    1334 uint8_t *copy = malloc(length);
    +
    1335 if(copy == NULL)
    +
    1336 {
    +
    1337 FATAL("Could not allocate memory for creator");
    + +
    1339 }
    +
    1340
    +
    1341 // Copy opaque UTF-16LE string
    +
    1342 memcpy(copy, data, length);
    +
    1343 if(ctx->media_part_number != NULL) free(ctx->media_part_number);
    +
    1344 ctx->media_part_number = copy;
    + +
    1346
    +
    1347 TRACE("Exiting aaruf_set_media_part_number(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    1348 return AARUF_STATUS_OK;
    +
    1349}
    +
    +
    1350
    +
    +
    1412int32_t aaruf_set_drive_manufacturer(void *context, const uint8_t *data, const int32_t length)
    +
    1413{
    +
    1414 TRACE("Entering aaruf_set_drive_manufacturer(%p, %p, %d)", context, data, length);
    +
    1415
    +
    1416 // Check context is correct AaruFormat context
    +
    1417 if(context == NULL)
    +
    1418 {
    +
    1419 FATAL("Invalid context");
    +
    1420
    +
    1421 TRACE("Exiting aaruf_set_drive_manufacturer() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1423 }
    +
    1424
    +
    1425 aaruformat_context *ctx = context;
    +
    1426
    +
    1427 // Not a libaaruformat context
    +
    1428 if(ctx->magic != AARU_MAGIC)
    +
    1429 {
    +
    1430 FATAL("Invalid context");
    +
    1431
    +
    1432 TRACE("Exiting aaruf_set_drive_manufacturer() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1434 }
    +
    1435
    +
    1436 // Check we are writing
    +
    1437 if(!ctx->is_writing)
    +
    1438 {
    +
    1439 FATAL("Trying to write a read-only image");
    +
    1440
    +
    1441 TRACE("Exiting aaruf_set_drive_manufacturer() = AARUF_READ_ONLY");
    +
    1442 return AARUF_READ_ONLY;
    +
    1443 }
    +
    1444
    +
    1445 // Initialize
    + +
    1447
    +
    1448 // Reserve memory
    +
    1449 uint8_t *copy = malloc(length);
    +
    1450 if(copy == NULL)
    +
    1451 {
    +
    1452 FATAL("Could not allocate memory for drive manufacturer");
    + +
    1454 }
    +
    1455
    +
    1456 // Copy opaque UTF-16LE string
    +
    1457 memcpy(copy, data, length);
    +
    1458 if(ctx->drive_manufacturer != NULL) free(ctx->drive_manufacturer);
    +
    1459 ctx->drive_manufacturer = copy;
    + +
    1461
    +
    1462 TRACE("Exiting aaruf_set_drive_manufacturer(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    1463 return AARUF_STATUS_OK;
    +
    1464}
    +
    +
    1465
    +
    +
    1534int32_t aaruf_set_drive_model(void *context, const uint8_t *data, const int32_t length)
    +
    1535{
    +
    1536 TRACE("Entering aaruf_set_drive_model(%p, %p, %d)", context, data, length);
    +
    1537
    +
    1538 // Check context is correct AaruFormat context
    +
    1539 if(context == NULL)
    +
    1540 {
    +
    1541 FATAL("Invalid context");
    +
    1542
    +
    1543 TRACE("Exiting aaruf_set_drive_model() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1545 }
    +
    1546
    +
    1547 aaruformat_context *ctx = context;
    +
    1548
    +
    1549 // Not a libaaruformat context
    +
    1550 if(ctx->magic != AARU_MAGIC)
    +
    1551 {
    +
    1552 FATAL("Invalid context");
    +
    1553
    +
    1554 TRACE("Exiting aaruf_set_drive_model() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1556 }
    +
    1557
    +
    1558 // Check we are writing
    +
    1559 if(!ctx->is_writing)
    +
    1560 {
    +
    1561 FATAL("Trying to write a read-only image");
    +
    1562
    +
    1563 TRACE("Exiting aaruf_set_drive_model() = AARUF_READ_ONLY");
    +
    1564 return AARUF_READ_ONLY;
    +
    1565 }
    +
    1566
    +
    1567 // Initialize
    + +
    1569
    +
    1570 // Reserve memory
    +
    1571 uint8_t *copy = malloc(length);
    +
    1572 if(copy == NULL)
    +
    1573 {
    +
    1574 FATAL("Could not allocate memory for media model");
    + +
    1576 }
    +
    1577
    +
    1578 // Copy opaque UTF-16LE string
    +
    1579 memcpy(copy, data, length);
    +
    1580 if(ctx->drive_model != NULL) free(ctx->drive_model);
    +
    1581 ctx->drive_model = copy;
    + +
    1583
    +
    1584 TRACE("Exiting aaruf_set_drive_model(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    1585 return AARUF_STATUS_OK;
    +
    1586}
    +
    +
    1587
    +
    +
    1658int32_t aaruf_set_drive_serial_number(void *context, const uint8_t *data, const int32_t length)
    +
    1659{
    +
    1660 TRACE("Entering aaruf_set_drive_serial_number(%p, %p, %d)", context, data, length);
    +
    1661
    +
    1662 // Check context is correct AaruFormat context
    +
    1663 if(context == NULL)
    +
    1664 {
    +
    1665 FATAL("Invalid context");
    +
    1666
    +
    1667 TRACE("Exiting aaruf_set_drive_serial_number() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1669 }
    +
    1670
    +
    1671 aaruformat_context *ctx = context;
    +
    1672
    +
    1673 // Not a libaaruformat context
    +
    1674 if(ctx->magic != AARU_MAGIC)
    +
    1675 {
    +
    1676 FATAL("Invalid context");
    +
    1677
    +
    1678 TRACE("Exiting aaruf_set_drive_serial_number() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1680 }
    +
    1681
    +
    1682 // Check we are writing
    +
    1683 if(!ctx->is_writing)
    +
    1684 {
    +
    1685 FATAL("Trying to write a read-only image");
    +
    1686
    +
    1687 TRACE("Exiting aaruf_set_drive_serial_number() = AARUF_READ_ONLY");
    +
    1688 return AARUF_READ_ONLY;
    +
    1689 }
    +
    1690
    +
    1691 // Initialize
    + +
    1693
    +
    1694 // Reserve memory
    +
    1695 uint8_t *copy = malloc(length);
    +
    1696 if(copy == NULL)
    +
    1697 {
    +
    1698 FATAL("Could not allocate memory for drive serial number");
    + +
    1700 }
    +
    1701
    +
    1702 // Copy opaque UTF-16LE string
    +
    1703 memcpy(copy, data, length);
    +
    1704 if(ctx->drive_serial_number != NULL) free(ctx->drive_serial_number);
    +
    1705 ctx->drive_serial_number = copy;
    + +
    1707
    +
    1708 TRACE("Exiting aaruf_set_drive_serial_number(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    1709 return AARUF_STATUS_OK;
    +
    1710}
    +
    +
    1711
    +
    +
    1793int32_t aaruf_set_drive_firmware_revision(void *context, const uint8_t *data, const int32_t length)
    +
    1794{
    +
    1795 TRACE("Entering aaruf_set_drive_firmware_revision(%p, %p, %d)", context, data, length);
    +
    1796
    +
    1797 // Check context is correct AaruFormat context
    +
    1798 if(context == NULL)
    +
    1799 {
    +
    1800 FATAL("Invalid context");
    +
    1801
    +
    1802 TRACE("Exiting aaruf_set_drive_firmware_revision() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1804 }
    +
    1805
    +
    1806 aaruformat_context *ctx = context;
    +
    1807
    +
    1808 // Not a libaaruformat context
    +
    1809 if(ctx->magic != AARU_MAGIC)
    +
    1810 {
    +
    1811 FATAL("Invalid context");
    +
    1812
    +
    1813 TRACE("Exiting aaruf_set_drive_firmware_revision() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1815 }
    +
    1816
    +
    1817 // Check we are writing
    +
    1818 if(!ctx->is_writing)
    +
    1819 {
    +
    1820 FATAL("Trying to write a read-only image");
    +
    1821
    +
    1822 TRACE("Exiting aaruf_set_drive_firmware_revision() = AARUF_READ_ONLY");
    +
    1823 return AARUF_READ_ONLY;
    +
    1824 }
    +
    1825
    +
    1826 // Initialize
    + +
    1828
    +
    1829 // Reserve memory
    +
    1830 uint8_t *copy = malloc(length);
    +
    1831 if(copy == NULL)
    +
    1832 {
    +
    1833 FATAL("Could not allocate memory for creator");
    + +
    1835 }
    +
    1836
    +
    1837 // Copy opaque UTF-16LE string
    +
    1838 memcpy(copy, data, length);
    +
    1839 if(ctx->drive_firmware_revision != NULL) free(ctx->drive_firmware_revision);
    +
    1840 ctx->drive_firmware_revision = copy;
    + +
    1842
    +
    1843 TRACE("Exiting aaruf_set_drive_firmware_revision(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    1844 return AARUF_STATUS_OK;
    +
    1845}
    +
    +
    1846
    +
    +
    1944int32_t aaruf_get_cicm_metadata(const void *context, uint8_t *buffer, size_t *length)
    +
    1945{
    +
    1946 TRACE("Entering aaruf_get_cicm_metadata(%p, %p, %p)", context, buffer, length);
    +
    1947
    +
    1948 // Check context is correct AaruFormat context
    +
    1949 if(context == NULL)
    +
    1950 {
    +
    1951 FATAL("Invalid context");
    +
    1952
    +
    1953 TRACE("Exiting aaruf_get_cicm_metadata() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1955 }
    +
    1956
    +
    1957 const aaruformat_context *ctx = context;
    +
    1958
    +
    1959 // Not a libaaruformat context
    +
    1960 if(ctx->magic != AARU_MAGIC)
    +
    1961 {
    +
    1962 FATAL("Invalid context");
    +
    1963
    +
    1964 TRACE("Exiting aaruf_get_cicm_metadata() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    1966 }
    +
    1967
    +
    1968 if(ctx->cicm_block == NULL || ctx->cicm_block_header.length == 0 || ctx->cicm_block_header.identifier != CicmBlock)
    +
    1969 {
    +
    1970 TRACE("No CICM XML metadata present");
    +
    1971 *length = 0;
    +
    1972
    +
    1973 TRACE("Exiting aaruf_get_cicm_metadata() = AARUF_ERROR_CANNOT_READ_BLOCK");
    + +
    1975 }
    +
    1976
    +
    1977 if(*length < ctx->cicm_block_header.length)
    +
    1978 {
    +
    1979 TRACE("Buffer too small for CICM XML metadata, required %u bytes", ctx->cicm_block_header.length);
    +
    1980 *length = ctx->cicm_block_header.length;
    +
    1981
    +
    1982 TRACE("Exiting aaruf_get_cicm_metadata() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    1984 }
    +
    1985
    +
    1986 *length = ctx->cicm_block_header.length;
    +
    1987 memcpy(buffer, ctx->cicm_block, ctx->cicm_block_header.length);
    +
    1988
    +
    1989 TRACE("CICM XML metadata read successfully, length %u", *length);
    +
    1990 TRACE("Exiting aaruf_get_cicm_metadata(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    1991 return AARUF_STATUS_OK;
    +
    1992}
    +
    +
    1993
    +
    +
    2099int32_t aaruf_get_aaru_json_metadata(const void *context, uint8_t *buffer, size_t *length)
    +
    2100{
    +
    2101 TRACE("Entering aaruf_get_aaru_json_metadata(%p, %p, %p)", context, buffer, length);
    +
    2102
    +
    2103 // Check context is correct AaruFormat context
    +
    2104 if(context == NULL)
    +
    2105 {
    +
    2106 FATAL("Invalid context");
    +
    2107
    +
    2108 TRACE("Exiting aaruf_get_aaru_json_metadata() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2110 }
    +
    2111
    +
    2112 const aaruformat_context *ctx = context;
    +
    2113
    +
    2114 // Not a libaaruformat context
    +
    2115 if(ctx->magic != AARU_MAGIC)
    +
    2116 {
    +
    2117 FATAL("Invalid context");
    +
    2118
    +
    2119 TRACE("Exiting aaruf_get_aaru_json_metadata() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2121 }
    +
    2122
    +
    2123 if(ctx->json_block == NULL || ctx->json_block_header.length == 0 ||
    + +
    2125 {
    +
    2126 TRACE("No Aaru metadata JSON present");
    +
    2127 *length = 0;
    +
    2128
    +
    2129 TRACE("Exiting aaruf_get_aaru_json_metadata() = AARUF_ERROR_CANNOT_READ_BLOCK");
    + +
    2131 }
    +
    2132
    +
    2133 if(*length < ctx->json_block_header.length)
    +
    2134 {
    +
    2135 TRACE("Buffer too small for Aaru metadata JSON, required %u bytes", ctx->json_block_header.length);
    +
    2136 *length = ctx->json_block_header.length;
    +
    2137
    +
    2138 TRACE("Exiting aaruf_get_aaru_json_metadata() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    2140 }
    +
    2141
    +
    2142 *length = ctx->json_block_header.length;
    +
    2143 memcpy(buffer, ctx->json_block, ctx->json_block_header.length);
    +
    2144
    +
    2145 TRACE("Aaru metadata JSON read successfully, length %u", *length);
    +
    2146 TRACE("Exiting aaruf_get_aaru_json_metadata(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    2147 return AARUF_STATUS_OK;
    +
    2148}
    +
    +
    2149
    +
    +
    2258int32_t aaruf_set_aaru_json_metadata(void *context, uint8_t *data, size_t length)
    +
    2259{
    +
    2260 TRACE("Entering aaruf_set_aaru_json_metadata(%p, %p, %d)", context, data, length);
    +
    2261
    +
    2262 // Check context is correct AaruFormat context
    +
    2263 if(context == NULL)
    +
    2264 {
    +
    2265 FATAL("Invalid context");
    +
    2266
    +
    2267 TRACE("Exiting aaruf_set_aaru_json_metadata() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2269 }
    +
    2270
    +
    2271 aaruformat_context *ctx = context;
    +
    2272
    +
    2273 // Not a libaaruformat context
    +
    2274 if(ctx->magic != AARU_MAGIC)
    +
    2275 {
    +
    2276 FATAL("Invalid context");
    +
    2277
    +
    2278 TRACE("Exiting aaruf_set_aaru_json_metadata() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2280 }
    +
    2281
    +
    2282 // Check we are writing
    +
    2283 if(!ctx->is_writing)
    +
    2284 {
    +
    2285 FATAL("Trying to write a read-only image");
    +
    2286
    +
    2287 TRACE("Exiting aaruf_set_aaru_json_metadata() = AARUF_READ_ONLY");
    +
    2288 return AARUF_READ_ONLY;
    +
    2289 }
    +
    2290
    +
    2291 // Reserve memory
    +
    2292 uint8_t *copy = malloc(length);
    +
    2293 if(copy == NULL)
    +
    2294 {
    +
    2295 FATAL("Could not allocate memory for Aaru metadata JSON");
    + +
    2297 }
    +
    2298
    +
    2299 // Copy opaque UTF-8 string
    +
    2300 memcpy(copy, data, length);
    +
    2301 if(ctx->json_block != NULL) free(ctx->json_block);
    +
    2302 ctx->json_block = copy;
    + +
    2304 ctx->json_block_header.length = (uint32_t)length;
    +
    2305
    +
    2306 TRACE("Exiting aaruf_set_aaru_json_metadata(%p, %p, %d) = AARUF_STATUS_OK", context, data, length);
    +
    2307 return AARUF_STATUS_OK;
    +
    2308}
    +
    +
    2309
    +
    +
    2337int32_t aaruf_get_media_sequence(const void *context, int32_t *sequence, int32_t *last_sequence)
    +
    2338{
    +
    2339 TRACE("Entering aaruf_get_media_sequence(%p, %p, %p)", context, sequence, last_sequence);
    +
    2340
    +
    2341 // Check context is correct AaruFormat context
    +
    2342 if(context == NULL)
    +
    2343 {
    +
    2344 FATAL("Invalid context");
    +
    2345
    +
    2346 TRACE("Exiting aaruf_set_media_sequence() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2348 }
    +
    2349
    +
    2350 const aaruformat_context *ctx = context;
    +
    2351
    +
    2352 // Not a libaaruformat context
    +
    2353 if(ctx->magic != AARU_MAGIC)
    +
    2354 {
    +
    2355 FATAL("Invalid context");
    +
    2356
    +
    2357 TRACE("Exiting aaruf_set_media_sequence() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2359 }
    +
    2360
    + +
    2362 {
    +
    2363 FATAL("No metadata block present");
    +
    2364
    +
    2365 TRACE("Exiting aaruf_set_media_sequence() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    2367 }
    +
    2368
    +
    2369 *sequence = ctx->metadata_block_header.mediaSequence;
    +
    2370 *last_sequence = ctx->metadata_block_header.lastMediaSequence;
    +
    2371
    +
    2372 TRACE("Exiting aaruf_set_media_sequence(%p, %d, %d) = AARUF_STATUS_OK", context, *sequence, *last_sequence);
    +
    2373 return AARUF_STATUS_OK;
    +
    2374}
    +
    +
    2375
    +
    +
    2404int32_t aaruf_get_creator(const void *context, uint8_t *buffer, int32_t *length)
    +
    2405{
    +
    2406 TRACE("Entering aaruf_get_creator(%p, %p, %p)", context, buffer, length);
    +
    2407
    +
    2408 // Check context is correct AaruFormat context
    +
    2409 if(context == NULL)
    +
    2410 {
    +
    2411 FATAL("Invalid context");
    +
    2412
    +
    2413 TRACE("Exiting aaruf_get_creator() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2415 }
    +
    2416
    +
    2417 const aaruformat_context *ctx = context;
    +
    2418
    +
    2419 // Not a libaaruformat context
    +
    2420 if(ctx->magic != AARU_MAGIC)
    +
    2421 {
    +
    2422 FATAL("Invalid context");
    +
    2423
    +
    2424 TRACE("Exiting aaruf_get_creator() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2426 }
    +
    2427
    +
    2428 if(ctx->metadata_block_header.identifier != MetadataBlock || ctx->creator == NULL ||
    + +
    2430 {
    +
    2431 FATAL("No metadata block present");
    +
    2432
    +
    2433 TRACE("Exiting aaruf_get_creator() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    2435 }
    +
    2436
    +
    2437 if(buffer == NULL || *length < ctx->metadata_block_header.creatorLength)
    +
    2438 {
    +
    2439 *length = ctx->metadata_block_header.creatorLength;
    +
    2440
    +
    2441 TRACE("Exiting aaruf_get_creator() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    2443 }
    +
    2444
    +
    2445 // Copy opaque UTF-16LE string
    +
    2446 memcpy(buffer, ctx->creator, ctx->metadata_block_header.creatorLength);
    +
    2447 *length = ctx->metadata_block_header.creatorLength;
    +
    2448
    +
    2449 TRACE("Exiting aaruf_get_creator(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    2450 return AARUF_STATUS_OK;
    +
    2451}
    +
    +
    2452
    +
    +
    2476int32_t aaruf_get_comments(const void *context, uint8_t *buffer, int32_t *length)
    +
    2477{
    +
    2478 TRACE("Entering aaruf_get_comments(%p, %p, %p)", context, buffer, length);
    +
    2479
    +
    2480 // Check context is correct AaruFormat context
    +
    2481 if(context == NULL)
    +
    2482 {
    +
    2483 FATAL("Invalid context");
    +
    2484
    +
    2485 TRACE("Exiting aaruf_get_comments() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2487 }
    +
    2488
    +
    2489 const aaruformat_context *ctx = context;
    +
    2490
    +
    2491 // Not a libaaruformat context
    +
    2492 if(ctx->magic != AARU_MAGIC)
    +
    2493 {
    +
    2494 FATAL("Invalid context");
    +
    2495
    +
    2496 TRACE("Exiting aaruf_get_comments() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2498 }
    +
    2499
    +
    2500 if(ctx->metadata_block_header.identifier != MetadataBlock || ctx->comments == NULL ||
    + +
    2502 {
    +
    2503 FATAL("No metadata block present");
    +
    2504
    +
    2505 TRACE("Exiting aaruf_get_comments() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    2507 }
    +
    2508
    +
    2509 if(buffer == NULL || *length < ctx->metadata_block_header.commentsLength)
    +
    2510 {
    + +
    2512
    +
    2513 TRACE("Exiting aaruf_get_comments() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    2515 }
    +
    2516
    +
    2517 // Copy opaque UTF-16LE string
    +
    2518 memcpy(buffer, ctx->comments, ctx->metadata_block_header.commentsLength);
    + +
    2520
    +
    2521 TRACE("Exiting aaruf_get_comments(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    2522 return AARUF_STATUS_OK;
    +
    2523}
    +
    +
    2524
    +
    +
    2546int32_t aaruf_get_media_title(const void *context, uint8_t *buffer, int32_t *length)
    +
    2547{
    +
    2548 TRACE("Entering aaruf_get_media_title(%p, %p, %p)", context, buffer, length);
    +
    2549
    +
    2550 // Check context is correct AaruFormat context
    +
    2551 if(context == NULL)
    +
    2552 {
    +
    2553 FATAL("Invalid context");
    +
    2554
    +
    2555 TRACE("Exiting aaruf_get_media_title() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2557 }
    +
    2558
    +
    2559 const aaruformat_context *ctx = context;
    +
    2560
    +
    2561 // Not a libaaruformat context
    +
    2562 if(ctx->magic != AARU_MAGIC)
    +
    2563 {
    +
    2564 FATAL("Invalid context");
    +
    2565
    +
    2566 TRACE("Exiting aaruf_get_media_title() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2568 }
    +
    2569
    +
    2570 if(ctx->metadata_block_header.identifier != MetadataBlock || ctx->media_title == NULL ||
    + +
    2572 {
    +
    2573 FATAL("No metadata block present");
    +
    2574
    +
    2575 TRACE("Exiting aaruf_get_media_title() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    2577 }
    +
    2578
    +
    2579 if(buffer == NULL || *length < ctx->metadata_block_header.mediaTitleLength)
    +
    2580 {
    + +
    2582
    +
    2583 TRACE("Exiting aaruf_get_media_title() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    2585 }
    +
    2586
    +
    2587 // Copy opaque UTF-16LE string
    +
    2588 memcpy(buffer, ctx->media_title, ctx->metadata_block_header.mediaTitleLength);
    + +
    2590
    +
    2591 TRACE("Exiting aaruf_get_media_title(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    2592 return AARUF_STATUS_OK;
    +
    2593}
    +
    +
    2594
    +
    +
    2616int32_t aaruf_get_media_manufacturer(const void *context, uint8_t *buffer, int32_t *length)
    +
    2617{
    +
    2618 TRACE("Entering aaruf_get_media_manufacturer(%p, %p, %p)", context, buffer, length);
    +
    2619
    +
    2620 // Check context is correct AaruFormat context
    +
    2621 if(context == NULL)
    +
    2622 {
    +
    2623 FATAL("Invalid context");
    +
    2624
    +
    2625 TRACE("Exiting aaruf_get_media_manufacturer() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2627 }
    +
    2628
    +
    2629 const aaruformat_context *ctx = context;
    +
    2630
    +
    2631 // Not a libaaruformat context
    +
    2632 if(ctx->magic != AARU_MAGIC)
    +
    2633 {
    +
    2634 FATAL("Invalid context");
    +
    2635
    +
    2636 TRACE("Exiting aaruf_get_media_manufacturer() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2638 }
    +
    2639
    + + +
    2642 {
    +
    2643 FATAL("No metadata block present");
    +
    2644
    +
    2645 TRACE("Exiting aaruf_get_media_manufacturer() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    2647 }
    +
    2648
    +
    2649 if(buffer == NULL || *length < ctx->metadata_block_header.mediaManufacturerLength)
    +
    2650 {
    + +
    2652
    +
    2653 TRACE("Exiting aaruf_get_media_manufacturer() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    2655 }
    +
    2656
    +
    2657 // Copy opaque UTF-16LE string
    + + +
    2660
    +
    2661 TRACE("Exiting aaruf_get_media_manufacturer(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    2662 return AARUF_STATUS_OK;
    +
    2663}
    +
    +
    2664
    +
    +
    2686int32_t aaruf_get_media_model(const void *context, uint8_t *buffer, int32_t *length)
    +
    2687{
    +
    2688 TRACE("Entering aaruf_get_media_model(%p, %p, %p)", context, buffer, length);
    +
    2689
    +
    2690 // Check context is correct AaruFormat context
    +
    2691 if(context == NULL)
    +
    2692 {
    +
    2693 FATAL("Invalid context");
    +
    2694
    +
    2695 TRACE("Exiting aaruf_get_media_model() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2697 }
    +
    2698
    +
    2699 const aaruformat_context *ctx = context;
    +
    2700
    +
    2701 // Not a libaaruformat context
    +
    2702 if(ctx->magic != AARU_MAGIC)
    +
    2703 {
    +
    2704 FATAL("Invalid context");
    +
    2705
    +
    2706 TRACE("Exiting aaruf_get_media_model() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2708 }
    +
    2709
    +
    2710 if(ctx->metadata_block_header.identifier != MetadataBlock || ctx->media_model == NULL ||
    + +
    2712 {
    +
    2713 FATAL("No metadata block present");
    +
    2714
    +
    2715 TRACE("Exiting aaruf_get_media_model() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    2717 }
    +
    2718
    +
    2719 if(buffer == NULL || *length < ctx->metadata_block_header.mediaModelLength)
    +
    2720 {
    + +
    2722
    +
    2723 TRACE("Exiting aaruf_get_media_model() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    2725 }
    +
    2726
    +
    2727 // Copy opaque UTF-16LE string
    +
    2728 memcpy(buffer, ctx->media_model, ctx->metadata_block_header.mediaModelLength);
    + +
    2730
    +
    2731 TRACE("Exiting aaruf_get_media_model(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    2732 return AARUF_STATUS_OK;
    +
    2733}
    +
    +
    2734
    +
    +
    2756int32_t aaruf_get_media_serial_number(const void *context, uint8_t *buffer, int32_t *length)
    +
    2757{
    +
    2758 TRACE("Entering aaruf_get_media_serial_number(%p, %p, %p)", context, buffer, length);
    +
    2759
    +
    2760 // Check context is correct AaruFormat context
    +
    2761 if(context == NULL)
    +
    2762 {
    +
    2763 FATAL("Invalid context");
    +
    2764
    +
    2765 TRACE("Exiting aaruf_get_media_serial_number() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2767 }
    +
    2768
    +
    2769 const aaruformat_context *ctx = context;
    +
    2770
    +
    2771 // Not a libaaruformat context
    +
    2772 if(ctx->magic != AARU_MAGIC)
    +
    2773 {
    +
    2774 FATAL("Invalid context");
    +
    2775
    +
    2776 TRACE("Exiting aaruf_get_media_serial_number() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2778 }
    +
    2779
    + + +
    2782 {
    +
    2783 FATAL("No metadata block present");
    +
    2784
    +
    2785 TRACE("Exiting aaruf_get_media_serial_number() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    2787 }
    +
    2788
    +
    2789 if(buffer == NULL || *length < ctx->metadata_block_header.mediaSerialNumberLength)
    +
    2790 {
    + +
    2792
    +
    2793 TRACE("Exiting aaruf_get_media_serial_number() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    2795 }
    +
    2796
    +
    2797 // Copy opaque UTF-16LE string
    + + +
    2800
    +
    2801 TRACE("Exiting aaruf_get_media_serial_number(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    2802 return AARUF_STATUS_OK;
    +
    2803}
    +
    +
    2804
    +
    +
    2825int32_t aaruf_get_media_barcode(const void *context, uint8_t *buffer, int32_t *length)
    +
    2826{
    +
    2827 TRACE("Entering aaruf_get_media_barcode(%p, %p, %p)", context, buffer, length);
    +
    2828
    +
    2829 // Check context is correct AaruFormat context
    +
    2830 if(context == NULL)
    +
    2831 {
    +
    2832 FATAL("Invalid context");
    +
    2833
    +
    2834 TRACE("Exiting aaruf_get_media_barcode() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2836 }
    +
    2837
    +
    2838 const aaruformat_context *ctx = context;
    +
    2839
    +
    2840 // Not a libaaruformat context
    +
    2841 if(ctx->magic != AARU_MAGIC)
    +
    2842 {
    +
    2843 FATAL("Invalid context");
    +
    2844
    +
    2845 TRACE("Exiting aaruf_get_media_barcode() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2847 }
    +
    2848
    +
    2849 if(ctx->metadata_block_header.identifier != MetadataBlock || ctx->media_barcode == NULL ||
    + +
    2851 {
    +
    2852 FATAL("No metadata block present");
    +
    2853
    +
    2854 TRACE("Exiting aaruf_get_media_barcode() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    2856 }
    +
    2857
    +
    2858 if(buffer == NULL || *length < ctx->metadata_block_header.mediaBarcodeLength)
    +
    2859 {
    + +
    2861
    +
    2862 TRACE("Exiting aaruf_get_media_barcode() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    2864 }
    +
    2865
    +
    2866 // Copy opaque UTF-16LE string
    +
    2867 memcpy(buffer, ctx->media_barcode, ctx->metadata_block_header.mediaBarcodeLength);
    + +
    2869
    +
    2870 TRACE("Exiting aaruf_get_media_barcode(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    2871 return AARUF_STATUS_OK;
    +
    2872}
    +
    +
    2873
    +
    +
    2896int32_t aaruf_get_media_part_number(const void *context, uint8_t *buffer, int32_t *length)
    +
    2897{
    +
    2898 TRACE("Entering aaruf_get_media_part_number(%p, %p, %p)", context, buffer, length);
    +
    2899
    +
    2900 // Check context is correct AaruFormat context
    +
    2901 if(context == NULL)
    +
    2902 {
    +
    2903 FATAL("Invalid context");
    +
    2904
    +
    2905 TRACE("Exiting aaruf_get_media_part_number() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2907 }
    +
    2908
    +
    2909 const aaruformat_context *ctx = context;
    +
    2910
    +
    2911 // Not a libaaruformat context
    +
    2912 if(ctx->magic != AARU_MAGIC)
    +
    2913 {
    +
    2914 FATAL("Invalid context");
    +
    2915
    +
    2916 TRACE("Exiting aaruf_get_media_part_number() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2918 }
    +
    2919
    + + +
    2922 {
    +
    2923 FATAL("No metadata block present");
    +
    2924
    +
    2925 TRACE("Exiting aaruf_get_media_part_number() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    2927 }
    +
    2928
    +
    2929 if(buffer == NULL || *length < ctx->metadata_block_header.mediaPartNumberLength)
    +
    2930 {
    + +
    2932
    +
    2933 TRACE("Exiting aaruf_get_media_part_number() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    2935 }
    +
    2936
    +
    2937 // Copy opaque UTF-16LE string
    + + +
    2940
    +
    2941 TRACE("Exiting aaruf_get_media_part_number(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    2942 return AARUF_STATUS_OK;
    +
    2943}
    +
    +
    2944
    +
    +
    2968int32_t aaruf_get_drive_manufacturer(const void *context, uint8_t *buffer, int32_t *length)
    +
    2969{
    +
    2970 TRACE("Entering aaruf_get_drive_manufacturer(%p, %p, %p)", context, buffer, length);
    +
    2971
    +
    2972 // Check context is correct AaruFormat context
    +
    2973 if(context == NULL)
    +
    2974 {
    +
    2975 FATAL("Invalid context");
    +
    2976
    +
    2977 TRACE("Exiting aaruf_get_drive_manufacturer() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2979 }
    +
    2980
    +
    2981 const aaruformat_context *ctx = context;
    +
    2982
    +
    2983 // Not a libaaruformat context
    +
    2984 if(ctx->magic != AARU_MAGIC)
    +
    2985 {
    +
    2986 FATAL("Invalid context");
    +
    2987
    +
    2988 TRACE("Exiting aaruf_get_drive_manufacturer() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    2990 }
    +
    2991
    + + +
    2994 {
    +
    2995 FATAL("No metadata block present");
    +
    2996
    +
    2997 TRACE("Exiting aaruf_get_drive_manufacturer() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    2999 }
    +
    3000
    +
    3001 if(buffer == NULL || *length < ctx->metadata_block_header.driveManufacturerLength)
    +
    3002 {
    + +
    3004
    +
    3005 TRACE("Exiting aaruf_get_drive_manufacturer() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    3007 }
    +
    3008
    +
    3009 // Copy opaque UTF-16LE string
    + + +
    3012
    +
    3013 TRACE("Exiting aaruf_get_drive_manufacturer(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    3014 return AARUF_STATUS_OK;
    +
    3015}
    +
    +
    3016
    +
    +
    3038int32_t aaruf_get_drive_model(const void *context, uint8_t *buffer, int32_t *length)
    +
    3039{
    +
    3040 TRACE("Entering aaruf_get_drive_model(%p, %p, %p)", context, buffer, length);
    +
    3041
    +
    3042 // Check context is correct AaruFormat context
    +
    3043 if(context == NULL)
    +
    3044 {
    +
    3045 FATAL("Invalid context");
    +
    3046
    +
    3047 TRACE("Exiting aaruf_get_drive_model() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3049 }
    +
    3050
    +
    3051 const aaruformat_context *ctx = context;
    +
    3052
    +
    3053 // Not a libaaruformat context
    +
    3054 if(ctx->magic != AARU_MAGIC)
    +
    3055 {
    +
    3056 FATAL("Invalid context");
    +
    3057
    +
    3058 TRACE("Exiting aaruf_get_drive_model() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3060 }
    +
    3061
    +
    3062 if(ctx->metadata_block_header.identifier != MetadataBlock || ctx->drive_model == NULL ||
    + +
    3064 {
    +
    3065 FATAL("No metadata block present");
    +
    3066
    +
    3067 TRACE("Exiting aaruf_get_drive_model() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    3069 }
    +
    3070
    +
    3071 if(buffer == NULL || *length < ctx->metadata_block_header.driveModelLength)
    +
    3072 {
    + +
    3074
    +
    3075 TRACE("Exiting aaruf_get_drive_model() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    3077 }
    +
    3078
    +
    3079 // Copy opaque UTF-16LE string
    +
    3080 memcpy(buffer, ctx->drive_model, ctx->metadata_block_header.driveModelLength);
    + +
    3082
    +
    3083 TRACE("Exiting aaruf_get_drive_model(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    3084 return AARUF_STATUS_OK;
    +
    3085}
    +
    +
    3086
    +
    +
    3108int32_t aaruf_get_drive_serial_number(const void *context, uint8_t *buffer, int32_t *length)
    +
    3109{
    +
    3110 TRACE("Entering aaruf_get_drive_serial_number(%p, %p, %p)", context, buffer, length);
    +
    3111
    +
    3112 // Check context is correct AaruFormat context
    +
    3113 if(context == NULL)
    +
    3114 {
    +
    3115 FATAL("Invalid context");
    +
    3116
    +
    3117 TRACE("Exiting aaruf_get_drive_serial_number() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3119 }
    +
    3120
    +
    3121 const aaruformat_context *ctx = context;
    +
    3122
    +
    3123 // Not a libaaruformat context
    +
    3124 if(ctx->magic != AARU_MAGIC)
    +
    3125 {
    +
    3126 FATAL("Invalid context");
    +
    3127
    +
    3128 TRACE("Exiting aaruf_get_drive_serial_number() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3130 }
    +
    3131
    + + +
    3134 {
    +
    3135 FATAL("No metadata block present");
    +
    3136
    +
    3137 TRACE("Exiting aaruf_get_drive_serial_number() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    3139 }
    +
    3140
    +
    3141 if(buffer == NULL || *length < ctx->metadata_block_header.driveSerialNumberLength)
    +
    3142 {
    + +
    3144
    +
    3145 TRACE("Exiting aaruf_get_drive_serial_number() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    3147 }
    +
    3148
    +
    3149 // Copy opaque UTF-16LE string
    + + +
    3152
    +
    3153 TRACE("Exiting aaruf_get_drive_serial_number(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    3154 return AARUF_STATUS_OK;
    +
    3155}
    +
    +
    3156
    +
    +
    3178int32_t aaruf_get_drive_firmware_revision(const void *context, uint8_t *buffer, int32_t *length)
    +
    3179{
    +
    3180 TRACE("Entering aaruf_get_drive_firmware_revision(%p, %p, %p)", context, buffer, length);
    +
    3181
    +
    3182 // Check context is correct AaruFormat context
    +
    3183 if(context == NULL)
    +
    3184 {
    +
    3185 FATAL("Invalid context");
    +
    3186
    +
    3187 TRACE("Exiting aaruf_get_drive_firmware_revision() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3189 }
    +
    3190
    +
    3191 const aaruformat_context *ctx = context;
    +
    3192
    +
    3193 // Not a libaaruformat context
    +
    3194 if(ctx->magic != AARU_MAGIC)
    +
    3195 {
    +
    3196 FATAL("Invalid context");
    +
    3197
    +
    3198 TRACE("Exiting aaruf_get_drive_firmware_revision() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3200 }
    +
    3201
    + + +
    3204 {
    +
    3205 FATAL("No metadata block present");
    +
    3206
    +
    3207 TRACE("Exiting aaruf_get_drive_firmware_revision() = AARUF_ERROR_METADATA_NOT_PRESENT");
    + +
    3209 }
    +
    3210
    +
    3211 if(buffer == NULL || *length < ctx->metadata_block_header.driveFirmwareRevisionLength)
    +
    3212 {
    + +
    3214
    +
    3215 TRACE("Exiting aaruf_get_drive_firmware_revision() = AARUF_ERROR_BUFFER_TOO_SMALL");
    + +
    3217 }
    +
    3218
    +
    3219 // Copy opaque UTF-16LE string
    + + +
    3222
    +
    3223 TRACE("Exiting aaruf_get_drive_firmware_revision(%p, %p, %d) = AARUF_STATUS_OK", context, buffer, *length);
    +
    3224 return AARUF_STATUS_OK;
    +
    3225}
    +
    +
    3226
    +
    +
    3292int32_t aaruf_get_user_sectors(const void *context, uint64_t *sectors)
    +
    3293{
    +
    3294 TRACE("Entering aaruf_get_user_sectors(%p, %p)", context, sectors);
    +
    3295
    +
    3296 // Check context is correct AaruFormat context
    +
    3297 if(context == NULL)
    +
    3298 {
    +
    3299 FATAL("Invalid context");
    +
    3300
    +
    3301 TRACE("Exiting aaruf_get_user_sectors() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3303 }
    +
    3304
    +
    3305 const aaruformat_context *ctx = context;
    +
    3306
    +
    3307 // Not a libaaruformat context
    +
    3308 if(ctx->magic != AARU_MAGIC)
    +
    3309 {
    +
    3310 FATAL("Invalid context");
    +
    3311
    +
    3312 TRACE("Exiting aaruf_get_user_sectors() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3314 }
    +
    3315
    +
    3316 *sectors = ctx->user_data_ddt_header.blocks;
    +
    3317
    +
    3318 TRACE("Exiting aaruf_get_user_sectors(%p, %llu) = AARUF_STATUS_OK", context, *sectors);
    +
    3319 return AARUF_STATUS_OK;
    +
    3320}
    +
    +
    3321
    +
    +
    3417int32_t aaruf_get_negative_sectors(const void *context, uint16_t *sectors)
    +
    3418{
    +
    3419 TRACE("Entering aaruf_get_negative_sectors(%p, %p)", context, sectors);
    +
    3420
    +
    3421 // Check context is correct AaruFormat context
    +
    3422 if(context == NULL)
    +
    3423 {
    +
    3424 FATAL("Invalid context");
    +
    3425
    +
    3426 TRACE("Exiting aaruf_get_negative_sectors() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3428 }
    +
    3429
    +
    3430 const aaruformat_context *ctx = context;
    +
    3431
    +
    3432 // Not a libaaruformat context
    +
    3433 if(ctx->magic != AARU_MAGIC)
    +
    3434 {
    +
    3435 FATAL("Invalid context");
    +
    3436
    +
    3437 TRACE("Exiting aaruf_get_negative_sectors() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3439 }
    +
    3440
    +
    3441 *sectors = ctx->user_data_ddt_header.negative;
    +
    3442
    +
    3443 TRACE("Exiting aaruf_get_negative_sectors(%p, %u) = AARUF_STATUS_OK", context, *sectors);
    +
    3444 return AARUF_STATUS_OK;
    +
    3445}
    +
    +
    3446
    +
    +
    3552int32_t aaruf_get_overflow_sectors(const void *context, uint16_t *sectors)
    +
    3553{
    +
    3554 TRACE("Entering aaruf_get_overflow_sectors(%p, %p)", context, sectors);
    +
    3555
    +
    3556 // Check context is correct AaruFormat context
    +
    3557 if(context == NULL)
    +
    3558 {
    +
    3559 FATAL("Invalid context");
    +
    3560
    +
    3561 TRACE("Exiting aaruf_get_overflow_sectors() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3563 }
    +
    3564
    +
    3565 const aaruformat_context *ctx = context;
    +
    3566
    +
    3567 // Not a libaaruformat context
    +
    3568 if(ctx->magic != AARU_MAGIC)
    +
    3569 {
    +
    3570 FATAL("Invalid context");
    +
    3571
    +
    3572 TRACE("Exiting aaruf_get_overflow_sectors() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3574 }
    +
    3575
    +
    3576 *sectors = ctx->user_data_ddt_header.overflow;
    +
    3577
    +
    3578 TRACE("Exiting aaruf_get_overflow_sectors(%p, %u) = AARUF_STATUS_OK", context, *sectors);
    +
    3579 return AARUF_STATUS_OK;
    +
    3580}
    +
    +
    3581
    +
    +
    3634int32_t aaruf_get_image_info(const void *context, ImageInfo *image_info)
    +
    3635{
    +
    3636 TRACE("Entering aaruf_get_image_info(%p, %p)", context, image_info);
    +
    3637
    +
    3638 // Check context is correct AaruFormat context
    +
    3639 if(context == NULL)
    +
    3640 {
    +
    3641 FATAL("Invalid context");
    +
    3642
    +
    3643 TRACE("Exiting aaruf_get_image_info() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3645 }
    +
    3646
    +
    3647 const aaruformat_context *ctx = context;
    +
    3648
    +
    3649 // Not a libaaruformat context
    +
    3650 if(ctx->magic != AARU_MAGIC)
    +
    3651 {
    +
    3652 FATAL("Invalid context");
    +
    3653
    +
    3654 TRACE("Exiting aaruf_get_image_info() = AARUF_ERROR_NOT_AARUFORMAT");
    + +
    3656 }
    +
    3657
    +
    3658 if(image_info == NULL)
    +
    3659 {
    +
    3660 FATAL("image_info parameter is NULL");
    +
    3661
    +
    3662 TRACE("Exiting aaruf_get_image_info() = AARUF_ERROR_INCORRECT_DATA_SIZE");
    + +
    3664 }
    +
    3665
    +
    3666 // Perform deep copy of the image_info structure
    +
    3667 memcpy(image_info, &ctx->image_info, sizeof(ImageInfo));
    +
    3668
    +
    3669 TRACE("Exiting aaruf_get_image_info() = AARUF_STATUS_OK");
    +
    3670 return AARUF_STATUS_OK;
    +
    3671}
    +
    + +
    #define AARU_MAGIC
    Magic identifier for AaruFormat container (ASCII "AARUFRMT").
    Definition consts.h:64
    +
    @ GeometryBlock
    Block containing logical geometry.
    Definition enums.h:148
    +
    @ AaruMetadataJsonBlock
    Block containing JSON version of Aaru Metadata.
    Definition enums.h:159
    +
    @ CicmBlock
    Block containing CICM XML metadata.
    Definition enums.h:151
    +
    @ MetadataBlock
    Block containing metadata.
    Definition enums.h:149
    +
    #define AARUF_STATUS_OK
    Sector present and read without uncorrectable errors.
    Definition errors.h:75
    +
    #define AARUF_READ_ONLY
    Operation requires write mode but context is read-only.
    Definition errors.h:61
    +
    #define AARUF_ERROR_NOT_ENOUGH_MEMORY
    Memory allocation failure (critical).
    Definition errors.h:48
    +
    #define AARUF_ERROR_CANNOT_READ_BLOCK
    Generic block read failure (seek/read error).
    Definition errors.h:46
    +
    #define AARUF_ERROR_INCORRECT_DATA_SIZE
    Data size does not match expected size.
    Definition errors.h:65
    +
    #define AARUF_ERROR_METADATA_NOT_PRESENT
    Requested metadata not present in image.
    Definition errors.h:69
    +
    #define AARUF_ERROR_NOT_AARUFORMAT
    Input file/stream failed magic or structural validation.
    Definition errors.h:40
    +
    #define AARUF_ERROR_BUFFER_TOO_SMALL
    Caller-supplied buffer insufficient for data.
    Definition errors.h:49
    + +
    #define FATAL(fmt,...)
    Definition log.h:40
    +
    #define TRACE(fmt,...)
    Definition log.h:25
    +
    int32_t aaruf_get_aaru_json_metadata(const void *context, uint8_t *buffer, size_t *length)
    Retrieves the embedded Aaru metadata JSON from the image.
    Definition metadata.c:2099
    +
    int32_t aaruf_set_media_barcode(void *context, const uint8_t *data, const int32_t length)
    Sets the media barcode information for the image.
    Definition metadata.c:1176
    +
    int32_t aaruf_set_media_model(void *context, const uint8_t *data, const int32_t length)
    Sets the media model or product designation for the image.
    Definition metadata.c:939
    +
    int32_t aaruf_set_media_sequence(void *context, const int32_t sequence, const int32_t last_sequence)
    Sets the media sequence information for multi-volume media sets.
    Definition metadata.c:363
    +
    int32_t aaruf_get_drive_serial_number(const void *context, uint8_t *buffer, int32_t *length)
    Retrieves the imaging drive's serial number metadata.
    Definition metadata.c:3108
    +
    int32_t aaruf_set_drive_manufacturer(void *context, const uint8_t *data, const int32_t length)
    Sets the drive manufacturer information for the image.
    Definition metadata.c:1412
    +
    int32_t aaruf_set_drive_model(void *context, const uint8_t *data, const int32_t length)
    Sets the drive model information for the image.
    Definition metadata.c:1534
    +
    int32_t aaruf_set_media_title(void *context, const uint8_t *data, const int32_t length)
    Sets the media title or label for the image.
    Definition metadata.c:720
    +
    int32_t aaruf_get_creator(const void *context, uint8_t *buffer, int32_t *length)
    Retrieves the recorded creator (operator) name from the MetadataBlock.
    Definition metadata.c:2404
    +
    int32_t aaruf_get_drive_firmware_revision(const void *context, uint8_t *buffer, int32_t *length)
    Retrieves the firmware revision metadata for the imaging drive.
    Definition metadata.c:3178
    +
    int32_t aaruf_get_cicm_metadata(const void *context, uint8_t *buffer, size_t *length)
    Retrieves the embedded CICM XML metadata sidecar from the image.
    Definition metadata.c:1944
    +
    int32_t aaruf_get_media_serial_number(const void *context, uint8_t *buffer, int32_t *length)
    Retrieves the media serial number recorded in the image metadata.
    Definition metadata.c:2756
    +
    int32_t aaruf_get_media_part_number(const void *context, uint8_t *buffer, int32_t *length)
    Retrieves the media part number recorded in the MetadataBlock.
    Definition metadata.c:2896
    +
    int32_t aaruf_get_media_model(const void *context, uint8_t *buffer, int32_t *length)
    Retrieves the media model or product designation metadata.
    Definition metadata.c:2686
    +
    int32_t aaruf_get_media_manufacturer(const void *context, uint8_t *buffer, int32_t *length)
    Retrieves the recorded media manufacturer name.
    Definition metadata.c:2616
    +
    int32_t aaruf_get_drive_model(const void *context, uint8_t *buffer, int32_t *length)
    Retrieves the device model information for the imaging drive.
    Definition metadata.c:3038
    +
    int32_t aaruf_get_media_barcode(const void *context, uint8_t *buffer, int32_t *length)
    Retrieves the barcode assigned to the physical media or its packaging.
    Definition metadata.c:2825
    +
    int32_t aaruf_get_drive_manufacturer(const void *context, uint8_t *buffer, int32_t *length)
    Retrieves the drive manufacturer metadata captured during imaging.
    Definition metadata.c:2968
    +
    int32_t aaruf_get_image_info(const void *context, ImageInfo *image_info)
    Retrieves a deep copy of the ImageInfo structure from the AaruFormat image.
    Definition metadata.c:3634
    +
    int32_t aaruf_get_user_sectors(const void *context, uint64_t *sectors)
    Retrieves the total number of user-accessible sectors in the AaruFormat image.
    Definition metadata.c:3292
    +
    int32_t aaruf_set_aaru_json_metadata(void *context, uint8_t *data, size_t length)
    Sets the Aaru metadata JSON for the image during creation.
    Definition metadata.c:2258
    +
    int32_t aaruf_get_negative_sectors(const void *context, uint16_t *sectors)
    Retrieves the number of negative (pre-gap) sectors in the AaruFormat image.
    Definition metadata.c:3417
    +
    int32_t aaruf_get_comments(const void *context, uint8_t *buffer, int32_t *length)
    Retrieves the user comments or notes stored in the MetadataBlock.
    Definition metadata.c:2476
    +
    int32_t aaruf_get_media_sequence(const void *context, int32_t *sequence, int32_t *last_sequence)
    Retrieves the media sequence metadata for multi-volume image sets.
    Definition metadata.c:2337
    +
    int32_t aaruf_get_geometry(const void *context, uint32_t *cylinders, uint32_t *heads, uint32_t *sectors_per_track)
    Retrieves the logical CHS geometry from the AaruFormat image.
    Definition metadata.c:94
    +
    int32_t aaruf_set_media_part_number(void *context, const uint8_t *data, const int32_t length)
    Sets the media part number or model designation for the image.
    Definition metadata.c:1297
    +
    int32_t aaruf_set_media_serial_number(void *context, const uint8_t *data, const int32_t length)
    Sets the media serial number for the image.
    Definition metadata.c:1054
    +
    int32_t aaruf_set_geometry(void *context, const uint32_t cylinders, const uint32_t heads, const uint32_t sectors_per_track)
    Sets the logical CHS geometry for the AaruFormat image.
    Definition metadata.c:229
    +
    int32_t aaruf_set_comments(void *context, const uint8_t *data, const int32_t length)
    Sets user comments or notes for the image.
    Definition metadata.c:607
    +
    int32_t aaruf_set_drive_firmware_revision(void *context, const uint8_t *data, const int32_t length)
    Sets the drive firmware revision for the image.
    Definition metadata.c:1793
    +
    int32_t aaruf_set_media_manufacturer(void *context, const uint8_t *data, const int32_t length)
    Sets the media manufacturer information for the image.
    Definition metadata.c:832
    +
    int32_t aaruf_set_drive_serial_number(void *context, const uint8_t *data, const int32_t length)
    Sets the drive serial number for the image.
    Definition metadata.c:1658
    +
    int32_t aaruf_get_overflow_sectors(const void *context, uint16_t *sectors)
    Retrieves the number of overflow (post-gap) sectors in the AaruFormat image.
    Definition metadata.c:3552
    +
    int32_t aaruf_get_media_title(const void *context, uint8_t *buffer, int32_t *length)
    Retrieves the media title or label captured during image creation.
    Definition metadata.c:2546
    +
    int32_t aaruf_set_creator(void *context, const uint8_t *data, const int32_t length)
    Sets the creator (person/operator) information for the image.
    Definition metadata.c:493
    +
    uint32_t identifier
    Block identifier, must be BlockType::AaruMetadataJsonBlock.
    Definition metadata.h:121
    +
    uint32_t length
    Length in bytes of the Aaru metadata JSON payload that follows.
    Definition metadata.h:122
    +
    uint32_t length
    Length in bytes of the CICM metadata payload that follows.
    Definition metadata.h:110
    +
    uint32_t identifier
    Block identifier, must be BlockType::CicmBlock.
    Definition metadata.h:109
    +
    uint16_t overflow
    Trailing dumped sectors beyond user area (overflow range), still mapped with entries.
    Definition ddt.h:151
    +
    uint64_t blocks
    Total internal span (negative + usable + overflow) in logical sectors.
    Definition ddt.h:150
    +
    uint16_t negative
    Leading negative LBA count; added to external L to build internal index.
    Definition ddt.h:149
    +
    uint32_t identifier
    Block identifier, must be BlockType::GeometryBlock.
    Definition data.h:92
    +
    uint32_t cylinders
    Number of cylinders.
    Definition data.h:93
    +
    uint32_t heads
    Number of heads (tracks per cylinder).
    Definition data.h:94
    +
    uint32_t sectorsPerTrack
    Number of sectors per track.
    Definition data.h:95
    +
    High-level summary of an opened Aaru image containing metadata and media characteristics.
    Definition aaru.h:870
    +
    uint32_t commentsLength
    Length in bytes (including null) of comments string.
    Definition metadata.h:78
    +
    int32_t mediaSequence
    Sequence number within a multi-disc / multi-volume set (0-based or 1-based as producer defines).
    Definition metadata.h:72
    +
    uint32_t identifier
    Block identifier, must be BlockType::MetadataBlock.
    Definition metadata.h:70
    +
    uint32_t driveModelLength
    Length in bytes (including null) of drive model string.
    Definition metadata.h:94
    +
    uint32_t driveManufacturerLength
    Length in bytes (including null) of drive manufacturer string.
    Definition metadata.h:92
    +
    uint32_t mediaTitleLength
    Length in bytes (including null) of media title string.
    Definition metadata.h:80
    +
    uint32_t driveSerialNumberLength
    Length in bytes (including null) of drive serial number string.
    Definition metadata.h:96
    +
    uint32_t mediaManufacturerLength
    Length in bytes (including null) of media manufacturer string.
    Definition metadata.h:82
    +
    uint32_t mediaModelLength
    Length in bytes (including null) of media model string.
    Definition metadata.h:84
    +
    int32_t lastMediaSequence
    Total number of media in the set; 0 or 1 if single item.
    Definition metadata.h:74
    +
    uint32_t mediaSerialNumberLength
    Length in bytes (including null) of media serial number string.
    Definition metadata.h:86
    +
    uint32_t mediaPartNumberLength
    Length in bytes (including null) of media part number string.
    Definition metadata.h:90
    +
    uint32_t mediaBarcodeLength
    Length in bytes (including null) of media barcode string.
    Definition metadata.h:88
    +
    uint32_t creatorLength
    Length in bytes (including null) of creator string (0 if absent).
    Definition metadata.h:76
    +
    uint32_t driveFirmwareRevisionLength
    Length in bytes (including null) of drive firmware revision string.
    Definition metadata.h:98
    +
    Master context representing an open or in‑creation Aaru image.
    Definition context.h:172
    +
    uint8_t * media_barcode
    Barcode of the media represented by the image.
    Definition context.h:222
    +
    DdtHeader2 user_data_ddt_header
    Active user data DDT v2 header (primary table meta).
    Definition context.h:189
    +
    uint8_t * creator
    Who (person) created the image?
    Definition context.h:216
    +
    uint8_t * cicm_block
    CICM XML payload.
    Definition context.h:214
    +
    uint32_t cylinders
    Cylinders of the media represented by the image.
    Definition context.h:234
    +
    uint8_t * drive_firmware_revision
    Firmware revision of the drive used to read the media represented by the image.
    Definition context.h:228
    +
    uint8_t * media_serial_number
    Serial number of the media represented by the image.
    Definition context.h:221
    +
    MetadataBlockHeader metadata_block_header
    Metadata block header.
    Definition context.h:230
    +
    uint8_t * media_model
    Model of the media represented by the image.
    Definition context.h:220
    +
    uint8_t * drive_serial_number
    Serial number of the drive used to read the media represented by the image.
    Definition context.h:226
    +
    uint8_t * drive_manufacturer
    Manufacturer of the drive used to read the media represented by the image.
    Definition context.h:224
    +
    bool is_writing
    True if context opened/created for writing.
    Definition context.h:292
    +
    CicmMetadataBlock cicm_block_header
    CICM metadata header (if present).
    Definition context.h:231
    +
    uint8_t * drive_model
    Model of the drive used to read the media represented by the image.
    Definition context.h:225
    +
    uint64_t magic
    File magic (AARU_MAGIC) post-open.
    Definition context.h:174
    +
    GeometryBlockHeader geometry_block
    Logical geometry block (if present).
    Definition context.h:229
    +
    uint8_t * json_block
    JSON metadata block payload (UTF-8).
    Definition context.h:215
    +
    uint8_t * media_part_number
    Part number of the media represented by the image.
    Definition context.h:223
    +
    AaruMetadataJsonBlockHeader json_block_header
    JSON metadata block header (if present).
    Definition context.h:233
    +
    uint32_t sectors_per_track
    Sectors per track of the media represented by the image (for variable image, the smallest)
    Definition context.h:236
    +
    uint8_t * comments
    Image comments.
    Definition context.h:218
    +
    uint32_t heads
    Heads of the media represented by the image.
    Definition context.h:235
    +
    ImageInfo image_info
    Exposed high-level image info summary.
    Definition context.h:260
    +
    uint8_t * media_title
    Title of the media represented by the image.
    Definition context.h:217
    +
    uint8_t * media_manufacturer
    Manufacturer of the media represented by the image.
    Definition context.h:219
    +
    +
    +
    + + + + diff --git a/docs/html/metadata_8h.html b/docs/html/metadata_8h.html new file mode 100644 index 0000000..9e282ba --- /dev/null +++ b/docs/html/metadata_8h.html @@ -0,0 +1,201 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/metadata.h File Reference + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    libaaruformat 1.0 +
    +
    Aaru Data Preservation Suite - Format Library
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    metadata.h File Reference
    +
    +
    + +

    Packed on-disk metadata block headers for descriptive strings and CICM XML (if present). +More...

    + +

    Go to the source code of this file.

    + + + + + + + + +

    +Data Structures

    struct  MetadataBlockHeader
     Header for a metadata block containing offsets and lengths to UTF-16LE descriptive strings. More...
    struct  CicmMetadataBlock
     Header for a CICM XML metadata block (identifier == BlockType::CicmBlock). More...
    struct  AaruMetadataJsonBlockHeader
     Header for an Aaru metadata JSON block (identifier == BlockType::AaruMetadataJsonBlock). More...
    + + + + +

    +Typedefs

    typedef struct MetadataBlockHeader MetadataBlockHeader
    typedef struct CicmMetadataBlock CicmMetadataBlock
    typedef struct AaruMetadataJsonBlockHeader AaruMetadataJsonBlockHeader
    +

    Detailed Description

    +

    Packed on-disk metadata block headers for descriptive strings and CICM XML (if present).

    +

    Two metadata-related block header layouts are defined:

      +
    • MetadataBlockHeader (BlockType::MetadataBlock): offsets + lengths for several UTF-16LE strings.
    • +
    • CicmMetadataBlock (BlockType::CicmBlock): length of embedded CICM XML metadata payload.
    • +
    +

    All multi-byte integers are little-endian. Structures are packed (1-byte alignment). All textual fields referenced by offsets are UTF-16LE, null-terminated (0x0000). Length fields include the terminating null (i.e. length >= 2 and an even number). Offsets are relative to the start of the corresponding block header (byte 0 = first byte of the header). No padding is implicitly added between strings; producers may pack them tightly or align them manually (alignment not required by the specification).

    +

    Metadata block layout (conceptual): MetadataBlockHeader (fixed size) <variable region holding each present UTF-16LE string in any order chosen by the writer>

    +

    Invariants / validation recommendations for MetadataBlockHeader:

      +
    • identifier == BlockType::MetadataBlock
    • +
    • blockSize >= sizeof(MetadataBlockHeader)
    • +
    • For every (offset,length) pair where length > 0:
        +
      • offset >= sizeof(MetadataBlockHeader)
      • +
      • offset + length <= blockSize
      • +
      • length % 2 == 0
      • +
      • The 16-bit code unit at (offset + length - 2) == 0x0000 (null terminator)
      • +
      +
    • +
    • mediaSequence >= 0 and lastMediaSequence >= 0; if lastMediaSequence > 0 then 0 <= mediaSequence < lastMediaSequence
    • +
    +

    CICM metadata block layout: CicmMetadataBlock (header) <length bytes of UTF-8 or XML text payload (implementation-defined, not null-terminated)>

    +

    NOTE: The library code reading these blocks must not assume strings are present; a zero length means the corresponding field is omitted. Offsets for omitted fields MAY be zero or arbitrary; readers should skip them whenever length == 0.

    + +

    Definition in file metadata.h.

    +

    Typedef Documentation

    + +

    ◆ AaruMetadataJsonBlockHeader

    + +
    +
    + + + + +
    typedef struct AaruMetadataJsonBlockHeader AaruMetadataJsonBlockHeader
    +
    + +
    +
    + +

    ◆ CicmMetadataBlock

    + +
    +
    + + + + +
    typedef struct CicmMetadataBlock CicmMetadataBlock
    +
    + +
    +
    + +

    ◆ MetadataBlockHeader

    + +
    +
    + + + + +
    typedef struct MetadataBlockHeader MetadataBlockHeader
    +
    + +
    +
    +
    +
    + +
    + + + + diff --git a/docs/html/metadata_8h.js b/docs/html/metadata_8h.js new file mode 100644 index 0000000..03b07b6 --- /dev/null +++ b/docs/html/metadata_8h.js @@ -0,0 +1,9 @@ +var metadata_8h = +[ + [ "MetadataBlockHeader", "structMetadataBlockHeader.html", "structMetadataBlockHeader" ], + [ "CicmMetadataBlock", "structCicmMetadataBlock.html", "structCicmMetadataBlock" ], + [ "AaruMetadataJsonBlockHeader", "structAaruMetadataJsonBlockHeader.html", "structAaruMetadataJsonBlockHeader" ], + [ "AaruMetadataJsonBlockHeader", "metadata_8h.html#ab19461574aefdc3ef041175b624ec7be", null ], + [ "CicmMetadataBlock", "metadata_8h.html#a3c0742e18c9397cba678e3d73dd5ea3d", null ], + [ "MetadataBlockHeader", "metadata_8h.html#ad50b5e5d5745ccd2ef7ce17a023c2582", null ] +]; \ No newline at end of file diff --git a/docs/html/metadata_8h_source.html b/docs/html/metadata_8h_source.html new file mode 100644 index 0000000..69d815b --- /dev/null +++ b/docs/html/metadata_8h_source.html @@ -0,0 +1,218 @@ + + + + + + + +libaaruformat: include/aaruformat/structs/metadata.h Source File + + + + + + + + + + + + + + +
    +
    + + + + + + +
    +
    libaaruformat 1.0 +
    +
    Aaru Data Preservation Suite - Format Library
    +
    +
    + + + + + + + + +
    +
    + +
    +
    +
    + +
    +
    + +
    +
    + + +
    +
    +
    +
    +
    +
    Loading...
    +
    Searching...
    +
    No Matches
    +
    +
    +
    +
    + +
    +
    metadata.h
    +
    +
    +Go to the documentation of this file.
    1/*
    +
    2 * This file is part of the Aaru Data Preservation Suite.
    +
    3 * Copyright (c) 2019-2025 Natalia Portillo.
    +
    4 *
    +
    5 * This library is free software; you can redistribute it and/or modify
    +
    6 * it under the terms of the GNU Lesser General Public License as
    +
    7 * published by the Free Software Foundation; either version 2.1 of the
    +
    8 * License, or (at your option) any later version.
    +
    9 *
    +
    10 * This library is distributed in the hope that it will be useful, but
    +
    11 * WITHOUT ANY WARRANTY; without even the implied warranty of
    +
    12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    +
    13 * Lesser General Public License for more details.
    +
    14 *
    +
    15 * You should have received a copy of the GNU Lesser General Public
    +
    16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
    +
    17 */
    +
    18
    +
    19#ifndef LIBAARUFORMAT_METADATA_H
    +
    20#define LIBAARUFORMAT_METADATA_H
    +
    21
    +
    22#pragma pack(push, 1)
    +
    23
    +
    60
    + +
    100
    +
    +
    107typedef struct CicmMetadataBlock
    +
    108{
    +
    109 uint32_t identifier;
    +
    110 uint32_t length;
    + +
    +
    112
    + +
    124
    +
    125#pragma pack(pop)
    +
    126
    +
    127#endif // LIBAARUFORMAT_METADATA_H
    +
    Header for an Aaru metadata JSON block (identifier == BlockType::AaruMetadataJsonBlock).
    Definition metadata.h:120
    +
    uint32_t identifier
    Block identifier, must be BlockType::AaruMetadataJsonBlock.
    Definition metadata.h:121
    +
    uint32_t length
    Length in bytes of the Aaru metadata JSON payload that follows.
    Definition metadata.h:122
    +
    Header for a CICM XML metadata block (identifier == BlockType::CicmBlock).
    Definition metadata.h:108
    +
    uint32_t length
    Length in bytes of the CICM metadata payload that follows.
    Definition metadata.h:110
    +
    uint32_t identifier
    Block identifier, must be BlockType::CicmBlock.
    Definition metadata.h:109
    +
    Header for a metadata block containing offsets and lengths to UTF-16LE descriptive strings.
    Definition metadata.h:69
    +
    uint32_t commentsLength
    Length in bytes (including null) of comments string.
    Definition metadata.h:78
    +
    int32_t mediaSequence
    Sequence number within a multi-disc / multi-volume set (0-based or 1-based as producer defines).
    Definition metadata.h:72
    +
    uint32_t identifier
    Block identifier, must be BlockType::MetadataBlock.
    Definition metadata.h:70
    +
    uint32_t mediaTitleOffset
    Offset to UTF-16LE media title string.
    Definition metadata.h:79
    +
    uint32_t driveModelLength
    Length in bytes (including null) of drive model string.
    Definition metadata.h:94
    +
    uint32_t driveManufacturerLength
    Length in bytes (including null) of drive manufacturer string.
    Definition metadata.h:92
    +
    uint32_t blockSize
    Total size in bytes of the entire metadata block (header + strings).
    Definition metadata.h:71
    +
    uint32_t driveModelOffset
    Offset to UTF-16LE drive model string.
    Definition metadata.h:93
    +
    uint32_t mediaModelOffset
    Offset to UTF-16LE media model string.
    Definition metadata.h:83
    +
    uint32_t creatorOffset
    Offset to UTF-16LE creator string (or undefined if creatorLength==0).
    Definition metadata.h:75
    +
    uint32_t mediaTitleLength
    Length in bytes (including null) of media title string.
    Definition metadata.h:80
    +
    uint32_t mediaManufacturerOffset
    Offset to UTF-16LE media manufacturer string.
    Definition metadata.h:81
    +
    uint32_t driveSerialNumberLength
    Length in bytes (including null) of drive serial number string.
    Definition metadata.h:96
    +
    uint32_t driveSerialNumberOffset
    Offset to UTF-16LE drive serial number string.
    Definition metadata.h:95
    +
    uint32_t mediaManufacturerLength
    Length in bytes (including null) of media manufacturer string.
    Definition metadata.h:82
    +
    uint32_t mediaModelLength
    Length in bytes (including null) of media model string.
    Definition metadata.h:84
    +
    uint32_t driveFirmwareRevisionOffset
    Offset to UTF-16LE drive firmware revision string.
    Definition metadata.h:97
    +
    int32_t lastMediaSequence
    Total number of media in the set; 0 or 1 if single item.
    Definition metadata.h:74
    +
    uint32_t commentsOffset
    Offset to UTF-16LE comments string.
    Definition metadata.h:77
    +
    uint32_t driveManufacturerOffset
    Offset to UTF-16LE drive manufacturer string.
    Definition metadata.h:91
    +
    uint32_t mediaSerialNumberOffset
    Offset to UTF-16LE media serial number string.
    Definition metadata.h:85
    +
    uint32_t mediaSerialNumberLength
    Length in bytes (including null) of media serial number string.
    Definition metadata.h:86
    +
    uint32_t mediaPartNumberOffset
    Offset to UTF-16LE media part number string.
    Definition metadata.h:89
    +
    uint32_t mediaPartNumberLength
    Length in bytes (including null) of media part number string.
    Definition metadata.h:90
    +
    uint32_t mediaBarcodeLength
    Length in bytes (including null) of media barcode string.
    Definition metadata.h:88
    +
    uint32_t creatorLength
    Length in bytes (including null) of creator string (0 if absent).
    Definition metadata.h:76
    +
    uint32_t driveFirmwareRevisionLength
    Length in bytes (including null) of drive firmware revision string.
    Definition metadata.h:98
    +
    uint32_t mediaBarcodeOffset
    Offset to UTF-16LE media barcode string.
    Definition metadata.h:87
    +
    +
    +
    + + + + diff --git a/docs/html/navtree.css b/docs/html/navtree.css new file mode 100644 index 0000000..0ea3a07 --- /dev/null +++ b/docs/html/navtree.css @@ -0,0 +1,327 @@ +#nav-tree .children_ul { + margin:0; + padding:4px; +} + +#nav-tree ul { + list-style:none outside none; + margin:0px; + padding:0px; +} + +#nav-tree li { + white-space:nowrap; + margin:0; + padding:0; +} + +#nav-tree .plus { + margin:0px; +} + +#nav-tree .selected { + position: relative; + background-color: var(--nav-menu-active-bg); + border-radius: 0 6px 6px 0; + /*margin-right: 5px;*/ +} + +#nav-tree img { + margin:0px; + padding:0px; + border:0px; + vertical-align: middle; +} + +#nav-tree a { + text-decoration:none; + padding:0px; + margin:0px; +} + +#nav-tree .label { + margin:0px; + padding:0px; + font: 12px var(--font-family-nav); + line-height: 22px; +} + +#nav-tree .label a { + padding:2px; +} + +#nav-tree .selected a { + text-decoration:none; + color:var(--page-link-color); +} + +#nav-tree .children_ul { + margin:0px; + padding:0px; +} + +#nav-tree .item { + margin: 0 6px 0 -5px; + padding: 0 0 0 5px; + height: 22px; +} + +#nav-tree { + padding: 0px 0px; + font-size:14px; + overflow:auto; +} + +#doc-content { + overflow:auto; + display:block; + padding:0px; + margin:0px; + -webkit-overflow-scrolling : touch; /* iOS 5+ */ +} + +#side-nav { + padding:0 6px 0 0; + margin: 0px; + display:block; + position: absolute; + left: 0px; + overflow : hidden; +} + +.ui-resizable .ui-resizable-handle { + display:block; +} + +.ui-resizable-e { + transition: opacity 0.5s ease; + background-color: var(--nav-splitbar-bg-color); + opacity:0; + cursor:col-resize; + height:100%; + right:0; + top:0; + width:6px; + position: relative; +} + +.ui-resizable-e:after { + content: ''; + display: block; + top: 50%; + left: 1px; + width: 2px; + height: 15px; + border-left: 1px solid var(--nav-splitbar-handle-color); + border-right: 1px solid var(--nav-splitbar-handle-color); + position: absolute; +} + +.ui-resizable-e:hover { + opacity: 1; +} + +.ui-resizable-handle { + display:none; + font-size:0.1px; + position:absolute; + z-index:1; +} + +#nav-tree-contents { + margin: 6px 0px 0px 0px; +} + +#nav-tree { + background-color: var(--nav-background-color); + -webkit-overflow-scrolling : touch; /* iOS 5+ */ + scrollbar-width: thin; + border-right: 1px solid var(--nav-border-color); + padding-left: 5px; +} + +#nav-sync { + position:absolute; + top:0px; + right:0px; + z-index:1; +} + +#nav-sync img { + opacity:0.3; +} + +div.nav-sync-icon { + position: relative; + width: 24px; + height: 17px; + left: -6px; + top: -1px; + opacity: 0.7; + display: inline-block; + background-color: var(--sync-icon-background-color); + border: 1px solid var(--sync-icon-border-color); + box-sizing: content-box; +} + +div.nav-sync-icon:hover { + background-color: var(--sync-icon-selected-background-color); + opacity: 1.0; +} + +div.nav-sync-icon.active:after { + content: ''; + background-color: var(--sync-icon-background-color); + border-top: 2px solid var(--sync-icon-color); + position: absolute; + width: 16px; + height: 0px; + top: 7px; + left: 4px; +} + +div.nav-sync-icon.active:hover:after { + border-top: 2px solid var(--sync-icon-selected-color); +} + +span.sync-icon-left { + position: absolute; + padding: 0; + margin: 0; + top: 3px; + left: 4px; + display: inline-block; + width: 8px; + height: 8px; + border-left: 2px solid var(--sync-icon-color); + border-top: 2px solid var(--sync-icon-color); + transform: rotate(-45deg); +} + +span.sync-icon-right { + position: absolute; + padding: 0; + margin: 0; + top: 3px; + left: 10px; + display: inline-block; + width: 8px; + height: 8px; + border-right: 2px solid var(--sync-icon-color); + border-bottom: 2px solid var(--sync-icon-color); + transform: rotate(-45deg); +} + +div.nav-sync-icon:hover span.sync-icon-left { + border-left: 2px solid var(--sync-icon-selected-color); + border-top: 2px solid var(--sync-icon-selected-color); +} + +div.nav-sync-icon:hover span.sync-icon-right { + border-right: 2px solid var(--sync-icon-selected-color); + border-bottom: 2px solid var(--sync-icon-selected-color); +} + +#nav-path ul { + border-top: 1px solid var(--nav-breadcrumb-separator-color); +} + +@media print +{ + #nav-tree { display: none; } + div.ui-resizable-handle { display: none; position: relative; } +} + +/*---------------------------*/ +#container { + display: grid; + grid-template-columns: auto auto; + overflow: hidden; +} + +#page-nav { + background: var(--nav-background-color); + display: block; + width: 250px; + box-sizing: content-box; + position: relative; + border-left: 1px solid var(--nav-border-color); +} + +#page-nav-tree { + display: inline-block; +} + +#page-nav-resize-handle { + transition: opacity 0.5s ease; + background-color: var(--nav-splitbar-bg-color); + opacity:0; + cursor:col-resize; + height:100%; + right:0; + top:0; + width:6px; + position: relative; + z-index: 1; + user-select: none; +} + +#page-nav-resize-handle:after { + content: ''; + display: block; + top: 50%; + left: 1px; + width: 2px; + height: 15px; + border-left: 1px solid var(--nav-splitbar-handle-color); + border-right: 1px solid var(--nav-splitbar-handle-color); + position: absolute; +} + +#page-nav-resize-handle.dragging, +#page-nav-resize-handle:hover { + opacity: 1; +} + +#page-nav-contents { + padding: 0; + margin: 0; + display: block; + top: 0; + left: 0; + height: 100%; + width: 100%; + position: absolute; + overflow: auto; + scrollbar-width: thin; + -webkit-overflow-scrolling : touch; /* iOS 5+ */ +} + +ul.page-outline, +ul.page-outline ul { + text-indent: 0; + list-style: none outside none; + padding: 0 0 0 4px; +} + +ul.page-outline { + margin: 0 4px 4px 6px; +} + +ul.page-outline div.item { + font: 12px var(--font-family-nav); + line-height: 22px; +} + +ul.page-outline li { + white-space: nowrap; +} + +ul.page-outline li.vis { + background-color: var(--nav-breadcrumb-active-bg); +} + +#container.resizing { + cursor: col-resize; + user-select: none; +} diff --git a/docs/html/navtree.js b/docs/html/navtree.js new file mode 100644 index 0000000..4fcf6e3 --- /dev/null +++ b/docs/html/navtree.js @@ -0,0 +1,899 @@ +/* + @licstart The following is the entire license notice for the JavaScript code in this file. + + The MIT License (MIT) + + Copyright (C) 1997-2020 by Dimitri van Heesch + + Permission is hereby granted, free of charge, to any person obtaining a copy of this software + and associated documentation files (the "Software"), to deal in the Software without restriction, + including without limitation the rights to use, copy, modify, merge, publish, distribute, + sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all copies or + substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING + BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, + DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + @licend The above is the entire license notice for the JavaScript code in this file + */ + +function initNavTree(toroot,relpath,allMembersFile) { + let navTreeSubIndices = []; + const ARROW_DOWN = ''; + const ARROW_RIGHT = ''; + const NAVPATH_COOKIE_NAME = ''+'navpath'; + const fullSidebar = typeof page_layout!=='undefined' && page_layout==1; + + function getScrollBarWidth () { + let outer = $('
    ').css({visibility: 'hidden', width: 100, overflow: 'scroll', scrollbarWidth: 'thin'}).appendTo('body'); + let widthWithScroll = $('
    ').css({width: '100%'}).appendTo(outer).outerWidth(); + outer.remove(); + return 100 - widthWithScroll; + } + const scrollbarWidth = getScrollBarWidth(); + + function adjustSyncIconPosition() { + if (!fullSidebar) { + const nt = document.getElementById("nav-tree"); + const hasVerticalScrollbar = nt.scrollHeight > nt.clientHeight; + $("#nav-sync").css({right:parseInt(hasVerticalScrollbar?scrollbarWidth:0)}); + } + } + + const getData = function(varName) { + const i = varName.lastIndexOf('/'); + const n = i>=0 ? varName.substring(i+1) : varName; + const e = n.replace(/-/g,'_'); + return window[e]; + } + + const stripPath = function(uri) { + return uri.substring(uri.lastIndexOf('/')+1); + } + + const stripPath2 = function(uri) { + const i = uri.lastIndexOf('/'); + const s = uri.substring(i+1); + const m = uri.substring(0,i+1).match(/\/d\w\/d\w\w\/$/); + return m ? uri.substring(i-6) : s; + } + + const hashValue = function() { + return $(location).attr('hash').substring(1).replace(/[^\w-]/g,''); + } + + const hashUrl = function() { + return '#'+hashValue(); + } + + const pathName = function() { + return $(location).attr('pathname').replace(/[^-A-Za-z0-9+&@#/%?=~_|!:,.;()]/g, ''); + } + + const storeLink = function(link) { + if (!$("#nav-sync").hasClass('sync')) { + Cookie.writeSetting(NAVPATH_COOKIE_NAME,link,0); + } + } + + const deleteLink = function() { + Cookie.eraseSetting(NAVPATH_COOKIE_NAME); + } + + const cachedLink = function() { + return Cookie.readSetting(NAVPATH_COOKIE_NAME,''); + } + + const getScript = function(scriptName,func) { + const head = document.getElementsByTagName("head")[0]; + const script = document.createElement('script'); + script.id = scriptName; + script.type = 'text/javascript'; + script.onload = function() { func(); adjustSyncIconPosition(); } + script.src = scriptName+'.js'; + head.appendChild(script); + } + + const createIndent = function(o,domNode,node) { + let level=-1; + let n = node; + while (n.parentNode) { level++; n=n.parentNode; } + if (node.childrenData) { + const imgNode = document.createElement("span"); + imgNode.className = 'arrow'; + imgNode.style.paddingLeft=(16*level).toString()+'px'; + imgNode.innerHTML=ARROW_RIGHT; + node.plus_img = imgNode; + node.expandToggle = document.createElement("a"); + node.expandToggle.href = "javascript:void(0)"; + node.expandToggle.onclick = function() { + if (node.expanded) { + $(node.getChildrenUL()).slideUp("fast",adjustSyncIconPosition); + $(node.plus_img.childNodes[0]).removeClass('opened').addClass('closed'); + node.expanded = false; + } else { + expandNode(o, node, false, true); + } + } + node.expandToggle.appendChild(imgNode); + domNode.appendChild(node.expandToggle); + } else { + let span = document.createElement("span"); + span.className = 'arrow'; + span.style.width = 16*(level+1)+'px'; + span.innerHTML = ' '; + domNode.appendChild(span); + } + } + + let animationInProgress = false; + + const gotoAnchor = function(anchor,aname) { + let pos, docContent = $('#doc-content'); + let ancParent = $(anchor.parent()); + if (ancParent.hasClass('memItemLeft') || ancParent.hasClass('memtitle') || + ancParent.hasClass('fieldname') || ancParent.hasClass('fieldtype') || + ancParent.is(':header')) { + pos = ancParent.offset().top; + } else if (anchor.position()) { + pos = anchor.offset().top; + } + if (pos) { + const dcOffset = docContent.offset().top; + const dcHeight = docContent.height(); + const dcScrHeight = docContent[0].scrollHeight + const dcScrTop = docContent.scrollTop(); + let dist = Math.abs(Math.min(pos-dcOffset,dcScrHeight-dcHeight-dcScrTop)); + animationInProgress = true; + docContent.animate({ + scrollTop: pos + dcScrTop - dcOffset + },Math.max(50,Math.min(500,dist)),function() { + animationInProgress=false; + if (anchor.parent().attr('class')=='memItemLeft') { + let rows = $('.memberdecls tr[class$="'+hashValue()+'"]'); + glowEffect(rows.children(),300); // member without details + } else if (anchor.parent().attr('class')=='fieldname') { + glowEffect(anchor.parent().parent(),1000); // enum value + } else if (anchor.parent().attr('class')=='fieldtype') { + glowEffect(anchor.parent().parent(),1000); // struct field + } else if (anchor.parent().is(":header")) { + glowEffect(anchor.parent(),1000); // section header + } else { + glowEffect(anchor.next(),1000); // normal member + } + }); + } + } + + function htmlToNode(html) { + const template = document.createElement('template'); + template.innerHTML = html; + const nNodes = template.content.childNodes.length; + if (nNodes !== 1) { + throw new Error(`html parameter must represent a single node; got ${nNodes}. `); + } + return template.content.firstChild; + } + + const newNode = function(o, po, text, link, childrenData, lastNode) { + const node = { + children : [], + childrenData : childrenData, + depth : po.depth + 1, + relpath : po.relpath, + isLast : lastNode, + li : document.createElement("li"), + parentNode : po, + itemDiv : document.createElement("div"), + labelSpan : document.createElement("span"), + expanded : false, + childrenUL : null, + getChildrenUL : function() { + if (!this.childrenUL) { + this.childrenUL = document.createElement("ul"); + this.childrenUL.className = "children_ul"; + this.childrenUL.style.display = "none"; + this.li.appendChild(node.childrenUL); + } + return node.childrenUL; + }, + }; + + node.itemDiv.className = "item"; + node.labelSpan.className = "label"; + createIndent(o,node.itemDiv,node); + node.itemDiv.appendChild(node.labelSpan); + node.li.appendChild(node.itemDiv); + + const a = document.createElement("a"); + node.labelSpan.appendChild(a); + po.getChildrenUL().appendChild(node.li); + a.appendChild(htmlToNode(''+text+'')); + if (link) { + let url; + if (link.substring(0,1)=='^') { + url = link.substring(1); + link = url; + } else { + url = node.relpath+link; + } + a.className = stripPath(link.replace('#',':')); + if (link.indexOf('#')!=-1) { + const aname = '#'+link.split('#')[1]; + const srcPage = stripPath(pathName()); + const targetPage = stripPath(link.split('#')[0]); + a.href = srcPage!=targetPage ? url : aname; + a.onclick = function() { + storeLink(link); + aPPar = $(a).parent().parent(); + if (!aPPar.hasClass('selected')) { + $('.item').removeClass('selected'); + $('.item').removeAttr('id'); + aPPar.addClass('selected'); + aPPar.attr('id','selected'); + } + const anchor = $(aname); + gotoAnchor(anchor,aname); + }; + } else { + a.href = url; + a.onclick = () => storeLink(link); + } + } else if (childrenData != null) { + a.className = "nolink"; + a.href = "javascript:void(0)"; + a.onclick = node.expandToggle.onclick; + } + return node; + } + + const showRoot = function() { + const headerHeight = $("#top").height(); + const footerHeight = $("#nav-path").height(); + const windowHeight = $(window).height() - headerHeight - footerHeight; + (function() { // retry until we can scroll to the selected item + try { + const navtree=$('#nav-tree'); + navtree.scrollTo('#selected',100,{offset:-windowHeight/2}); + } catch (err) { + setTimeout(arguments.callee, 0); + } + })(); + } + + const expandNode = function(o, node, imm, setFocus) { + if (node.childrenData && !node.expanded) { + if (typeof(node.childrenData)==='string') { + const varName = node.childrenData; + getScript(node.relpath+varName,function() { + node.childrenData = getData(varName); + expandNode(o, node, imm, setFocus); + }); + } else { + if (!node.childrenVisited) { + getNode(o, node); + } + $(node.getChildrenUL()).slideDown("fast",adjustSyncIconPosition); + $(node.plus_img.childNodes[0]).addClass('opened').removeClass('closed'); + node.expanded = true; + if (setFocus) { + $(node.expandToggle).focus(); + } + } + } + } + + const glowEffect = function(n,duration) { + n.addClass('glow').delay(duration).queue(function(next) { + $(this).removeClass('glow');next(); + }); + } + + const highlightAnchor = function() { + const aname = hashUrl(); + const anchor = $(aname); + gotoAnchor(anchor,aname); + } + + const selectAndHighlight = function(hash,n) { + let a; + if (hash) { + const link=stripPath(pathName())+':'+hash.substring(1); + a=$('.item a[class$="'+link+'"]'); + } + if (a && a.length) { + a.parent().parent().addClass('selected'); + a.parent().parent().attr('id','selected'); + highlightAnchor(); + } else if (n) { + $(n.itemDiv).addClass('selected'); + $(n.itemDiv).attr('id','selected'); + } + let topOffset=5; + if ($('#nav-tree-contents .item:first').hasClass('selected')) { + topOffset+=25; + } + showRoot(); + } + + const showNode = function(o, node, index, hash) { + if (node && node.childrenData) { + if (typeof(node.childrenData)==='string') { + const varName = node.childrenData; + getScript(node.relpath+varName,function() { + node.childrenData = getData(varName); + showNode(o,node,index,hash); + }); + } else { + if (!node.childrenVisited) { + getNode(o, node); + } + $(node.getChildrenUL()).css({'display':'block'}); + $(node.plus_img.childNodes[0]).removeClass('closed').addClass('opened'); + node.expanded = true; + const n = node.children[o.breadcrumbs[index]]; + if (index+10) { // try root page without hash as fallback + gotoUrl(o,root,'',relpath); + } else { + o.breadcrumbs = $.extend(true, [], nti); + if (!o.breadcrumbs && root!=NAVTREE[0][1]) { // fallback: show index + navTo(o,NAVTREE[0][1],"",relpath); + $('.item').removeClass('selected'); + $('.item').removeAttr('id'); + } + if (o.breadcrumbs) { + o.breadcrumbs.unshift(0); // add 0 for root node + showNode(o, o.node, 0, hash); + } + } + } + + const gotoUrl = function(o,root,hash,relpath) { + const url=root+hash; + let i=-1; + while (NAVTREEINDEX[i+1]<=url) i++; + if (i==-1) { i=0; root=NAVTREE[0][1]; } // fallback: show index + if (navTreeSubIndices[i]) { + gotoNode(o,i,root,hash,relpath) + } else { + getScript(relpath+'navtreeindex'+i,function() { + navTreeSubIndices[i] = window['NAVTREEINDEX'+i]; + if (navTreeSubIndices[i]) { + gotoNode(o,i,root,hash,relpath); + } + }); + } + } + + const navTo = function(o,root,hash,relpath) { + const link = cachedLink(); + if (link) { + const parts = link.split('#'); + root = parts[0]; + hash = parts.length>1 ? '#'+parts[1].replace(/[^\w-]/g,'') : ''; + } + if (hash.match(/^#l\d+$/)) { + const anchor=$('a[name='+hash.substring(1)+']'); + glowEffect(anchor.parent(),1000); // line number + hash=''; // strip line number anchors + } + gotoUrl(o,root,hash,relpath); + } + + const showSyncOff = function(n,relpath) { + n.html(''); + } + + const showSyncOn = function(n,relpath) { + n.html(''); + } + + const o = { + toroot : toroot, + node : { + childrenData : NAVTREE, + children : [], + childrenUL : document.createElement("ul"), + getChildrenUL : function() { return this.childrenUL }, + li : document.getElementById("nav-tree-contents"), + depth : 0, + relpath : relpath, + expanded : false, + isLast : true, + plus_img : document.createElement("span"), + }, + }; + o.node.li.appendChild(o.node.childrenUL); + o.node.plus_img.className = 'arrow'; + o.node.plus_img.innerHTML = ARROW_RIGHT; + + const navSync = $('#nav-sync'); + if (cachedLink()) { + showSyncOff(navSync,relpath); + navSync.removeClass('sync'); + } else { + showSyncOn(navSync,relpath); + } + + navSync.click(() => { + const navSync = $('#nav-sync'); + if (navSync.hasClass('sync')) { + navSync.removeClass('sync'); + showSyncOff(navSync,relpath); + storeLink(stripPath2(pathName())+hashUrl()); + } else { + navSync.addClass('sync'); + showSyncOn(navSync,relpath); + deleteLink(); + } + }); + + navTo(o,toroot,hashUrl(),relpath); + showRoot(); + + $(window).bind('hashchange', () => { + if (!animationInProgress) { + if (window.location.hash && window.location.hash.length>1) { + let a; + if ($(location).attr('hash')) { + const clslink=stripPath(pathName())+':'+hashValue(); + a=$('.item a[class$="'+clslink.replace(/ try to keep right panel width + const shrinkLeft = Math.min(deficit, leftPanelWidth-minPanelWidth); + leftPanelWidth -= shrinkLeft; + const remainingDeficit = deficit - shrinkLeft; + const shrinkRight = Math.min(remainingDeficit, rightPanelWidth-minPanelWidth); + rightPanelWidth -= shrinkRight; + } else { // dragging right handle -> try to keep left panel width + const shrinkRight = Math.min(deficit, rightPanelWidth-minPanelWidth); + rightPanelWidth -= shrinkRight; + const remainingDeficit = deficit - shrinkRight; + const shrinkLeft = Math.min(remainingDeficit, leftPanelWidth-minPanelWidth); + leftPanelWidth -= shrinkLeft; + } + } else { + rightPanelWidth = pagenav.length ? Math.max(minPanelWidth,rightPanelWidth) : 0; + leftPanelWidth = Math.max(minPanelWidth,leftPanelWidth); + } + return { leftPanelWidth, rightPanelWidth } + } + + function updateWidths(sidenavWidth,pagenavWidth,dragLeft) + { + const widths = constrainPanelWidths(sidenavWidth,pagenavWidth,dragLeft); + const widthStr = parseInt(widths.leftPanelWidth)+"px"; + content.css({marginLeft:widthStr}); + if (fullSidebar) { + footer.css({marginLeft:widthStr}); + if (mainnav) { + mainnav.css({marginLeft:widthStr}); + } + } + sidenav.css({width:widthStr}); + if (pagenav.length) { + container.css({gridTemplateColumns:'auto '+parseInt(widths.rightPanelWidth)+'px'}); + pagenav.css({width:parseInt(widths.rightPanelWidth-1)+'px'}); + } + return widths; + } + + function resizeWidth(dragLeft) { + const sidenavWidth = $(sidenav).outerWidth()-barWidth; + const pagenavWidth = pagenav.length ? $(pagenav).outerWidth() : 0; + const widths = updateWidths(sidenavWidth,pagenavWidth,dragLeft); + Cookie.writeSetting(RESIZE_COOKIE_NAME,widths.leftPanelWidth-barWidth); + if (pagenav.length) { + Cookie.writeSetting(PAGENAV_COOKIE_NAME,widths.rightPanelWidth); + } + } + + function restoreWidth(sidenavWidth,pagenavWidth) { + updateWidths(sidenavWidth,pagenavWidth,false); + showHideNavBar(); + } + + function resizeHeight() { + const headerHeight = header.outerHeight(); + const windowHeight = $(window).height(); + let contentHeight; + const footerHeight = footer.outerHeight(); + let navtreeHeight,sideNavHeight; + if (!fullSidebar) { + contentHeight = windowHeight - headerHeight - footerHeight - 1; + navtreeHeight = contentHeight; + sideNavHeight = contentHeight; + } else if (fullSidebar) { + contentHeight = windowHeight - footerHeight - 1; + navtreeHeight = windowHeight - headerHeight - 1; + sideNavHeight = windowHeight - 1; + if (mainnav) { + contentHeight -= mainnav.outerHeight(); + } + } + navtree.css({height:navtreeHeight + "px"}); + sidenav.css({height:sideNavHeight + "px"}); + content.css({height:contentHeight + "px"}); + resizeWidth(false); + showHideNavBar(); + if (location.hash.slice(1)) { + (document.getElementById(location.hash.slice(1))||document.body).scrollIntoView(); + } + } + + header = $("#top"); + content = $("#doc-content"); + footer = $("#nav-path"); + sidenav = $("#side-nav"); + if (document.getElementById('main-nav')) { + mainnav = $("#main-nav"); + } + navtree = $("#nav-tree"); + pagenav = $("#page-nav"); + container = $("#container"); + $(".side-nav-resizable").resizable({resize: function(e, ui) { resizeWidth(true); } }); + $(sidenav).resizable({ minWidth: 0 }); + if (pagenav.length) { + pagehandle = $("#page-nav-resize-handle"); + pagehandle.on('mousedown touchstart',function(e) { + $('body').addClass('resizing'); + pagehandle.addClass('dragging'); + $(document).on('mousemove touchmove',function(e) { + const clientX = e.clientX || e.originalEvent.touches[0].clientX; + let pagenavWidth = container[0].offsetWidth-clientX+barWidth/2; + const sidenavWidth = sidenav.width(); + const widths = constrainPanelWidths(sidenavWidth,pagenavWidth,false); + container.css({gridTemplateColumns:'auto '+parseInt(widths.rightPanelWidth)+'px'}); + pagenav.css({width:parseInt(widths.rightPanelWidth-1)+'px'}); + content.css({marginLeft:parseInt(widths.leftPanelWidth)+'px'}); + Cookie.writeSetting(PAGENAV_COOKIE_NAME,pagenavWidth); + }); + $(document).on('mouseup touchend', function(e) { + $('body').removeClass('resizing'); + pagehandle.removeClass('dragging'); + $(document).off('mousemove mouseup touchmove touchend'); + }); + }); + } else { + container.css({gridTemplateColumns:'auto'}); + } + const width = parseInt(Cookie.readSetting(RESIZE_COOKIE_NAME,250)); + const pagenavWidth = parseInt(Cookie.readSetting(PAGENAV_COOKIE_NAME,250)); + if (width) { restoreWidth(width+barWidth,pagenavWidth); } else { resizeWidth(); } + const url = location.href; + const i=url.indexOf("#"); + if (i>=0) window.location.hash=url.substr(i); + const _preventDefault = function(evt) { evt.preventDefault(); }; + $("#splitbar").bind("dragstart", _preventDefault).bind("selectstart", _preventDefault); + $(window).ready(function() { + let lastWidth = -1; + let lastHeight = -1; + $(window).resize(function() { + const newWidth = $(this).width(), newHeight = $(this).height(); + if (newWidth!=lastWidth || newHeight!=lastHeight) { + resizeHeight(); + navtree_trampoline.updateContentTop(); + lastWidth = newWidth; + lastHeight = newHeight; + } + }); + resizeHeight(); + lastWidth = $(window).width(); + lastHeight = $(window).height(); + content.scroll(function() { + navtree_trampoline.updateContentTop(); + }); + }); + } + + + function initPageToc() { + const topMapping = []; + const toc_contents = $('#page-nav-contents'); + const content=$('