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-2026 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 "structs/flux.h"
32#include "utarray.h"
33
35
73
74#ifndef MD5_DIGEST_LENGTH
75#define MD5_DIGEST_LENGTH 16
76#endif
77
78#ifndef SHA1_DIGEST_LENGTH
79#define SHA1_DIGEST_LENGTH 20
80#endif
81
82#ifndef SHA256_DIGEST_LENGTH
83#define SHA256_DIGEST_LENGTH 32
84#endif
85
91typedef struct CdEccContext
92{
94 uint8_t *ecc_b_table;
95 uint8_t *ecc_f_table;
96 uint32_t *edc_table;
98
105typedef struct Checksums
106{
107 bool hasMd5;
108 bool hasSha1;
115 uint8_t blake3[BLAKE3_OUT_LEN];
116 uint8_t *spamsum;
118
124typedef struct mediaTagEntry
125{
126 uint8_t *data;
127 int32_t type;
128 uint32_t length;
129 UT_hash_handle hh;
131
132typedef struct TapeFileHashEntry
133{
134 uint64_t key;
136 UT_hash_handle hh;
138
145
146typedef struct TapeDdtHashEntry
147{
148 uint64_t key;
149 uint64_t value;
150 UT_hash_handle hh;
152
177typedef struct aaruformat_context
178{
179 /* Core & header */
180 uint64_t magic;
185
186 /* Deduplication tables (DDT) */
187 uint64_t *user_data_ddt;
193 uint64_t *user_data_ddt2;
201 uint8_t shift;
204
205 /* Optical auxiliary buffers (NULL if not present) */
206 uint8_t *sector_prefix;
208 uint8_t *sector_suffix;
212 uint8_t *sector_id;
213 uint8_t *sector_ied;
214 uint8_t *sector_cpr_mai;
215 uint8_t *sector_edc;
217
218 /* Metadata & geometry */
220 uint8_t *metadata_block;
221 uint8_t *cicm_block;
222 uint8_t *json_block;
223 uint8_t *dpm_block;
226 uint8_t *creator;
227 uint8_t *media_title;
228 uint8_t *comments;
230 uint8_t *media_model;
232 uint8_t *media_barcode;
235 uint8_t *drive_model;
237 uint8_t
244 uint32_t cylinders;
245 uint32_t heads;
250
251 /* Optical information */
256
257 /* Integrity & ECC */
260
261 /* Index & deduplication lookup */
262 UT_array *index_entries;
264
265 /* Caches */
268
269 /* High-level summary */
271
272 /* Tags */
275
276 /* Checksums */
278 blake3_hasher *blake3_context;
288
289 /* Write path */
290 uint8_t *writing_buffer;
303 bool rewinded;
306 int32_t (*finalize_write)(struct aaruformat_context *ctx);
307
308 /* Options */
309 uint32_t lzma_dict_size;
312 bool use_zstd;
316
317 /* Tape-specific structures */
320 bool is_tape;
321
322 /* Flux data structures */
325 UT_array *flux_captures;
327
328 /* Dirty flags (controls write behavior in close.c) */
355
356 // PS3 encryption support (lazy-initialized on first use)
357 uint8_t *ps3_disc_key;
361
362 // Wii U encryption support (lazy-initialized on first use)
363 uint8_t *wiiu_disc_key;
371
372 // Nintendo GC/Wii junk map support (lazy-initialized on first use)
377
378 // Nintendo Wii encryption support (lazy-initialized on first use)
386
387 /* Erasure coding (write path) */
388 uint8_t ec_algorithm;
389 uint16_t ec_K;
390 uint16_t ec_M;
392 void *ec_rs_ctx;
393 uint8_t **ec_data_parity;
399 UT_array *ec_data_stripes;
401
402 /* Erasure coding (read path) */
408 uint16_t ec_meta_K;
409 uint16_t ec_meta_M;
414 uint16_t ec_ddt_K;
415 uint16_t ec_ddt_M;
421
422#ifndef AARUFORMAT_CONTEXT_DECLARED
423#define AARUFORMAT_CONTEXT_DECLARED
424#endif
425
445
446#pragma pack(push, 1)
447
451typedef struct DumpExtent
452{
453 uint64_t start;
454 uint64_t end;
456
457#pragma pack(pop)
458
459#endif // LIBAARUFORMAT_CONTEXT_H
#define MD5_DIGEST_LENGTH
Definition context.h:75
struct FluxCaptureMapEntry FluxCaptureMapEntry
Definition context.h:34
struct TapeFileHashEntry tapeFileHashEntry
CRC64 (ECMA-182) core context and precomputed slicing-by-4 tables.
Data structures for flux transition capture support in Aaru disk images.
#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:51
Lookup tables and state for Compact Disc EDC/ECC (P/Q) regeneration / verification.
Definition context.h:92
uint8_t * ecc_f_table
Forward (F) ECC table.
Definition context.h:95
bool inited_edc
True once EDC/ECC tables have been initialized.
Definition context.h:93
uint32_t * edc_table
EDC (CRC) lookup table.
Definition context.h:96
uint8_t * ecc_b_table
Backward (B) ECC table (allocated, size implementation-defined).
Definition context.h:94
Collected whole‑image checksums / hashes present in a checksum block.
Definition context.h:106
uint8_t * spamsum
SpamSum fuzzy hash (ASCII), allocated length+1 with trailing 0.
Definition context.h:116
bool hasSha256
True if sha256[] buffer populated.
Definition context.h:109
uint8_t sha1[20]
SHA-1 digest (20 bytes).
Definition context.h:113
uint8_t sha256[32]
SHA-256 digest (32 bytes).
Definition context.h:114
uint8_t md5[16]
MD5 digest (16 bytes).
Definition context.h:112
bool hasSpamSum
True if spamsum pointer allocated and signature read.
Definition context.h:111
bool hasSha1
True if sha1[] buffer populated.
Definition context.h:108
uint8_t blake3[BLAKE3_OUT_LEN]
BLAKE3 digest (32 bytes).
Definition context.h:115
bool hasMd5
True if md5[] buffer populated.
Definition context.h:107
bool hasBlake3
True if blake3[] buffer populated.
Definition context.h:110
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:452
uint64_t end
Ending LBA (inclusive); >= start.
Definition context.h:454
uint64_t start
Starting LBA (inclusive).
Definition context.h:453
In-memory representation of a dump hardware entry plus decoded variable-length fields & extents.
Definition context.h:433
uint8_t * firmware
Firmware version string or NULL.
Definition context.h:439
uint8_t * revision
Hardware revision string or NULL.
Definition context.h:438
uint8_t * model
Model string or NULL.
Definition context.h:437
uint8_t * softwareName
Dump software name or NULL.
Definition context.h:441
struct DumpExtent * extents
Array of extents (entry.extents elements) or NULL.
Definition context.h:435
uint8_t * manufacturer
Manufacturer string (UTF-8) or NULL.
Definition context.h:436
uint8_t * softwareVersion
Dump software version or NULL.
Definition context.h:442
uint8_t * serial
Serial number string or NULL.
Definition context.h:440
DumpHardwareEntry entry
Fixed-size header with lengths & counts.
Definition context.h:434
uint8_t * softwareOperatingSystem
Host operating system string or NULL.
Definition context.h:443
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
Internal hash table entry for flux capture lookup.
Definition flux.c:35
Metadata entry describing a single flux capture in the FluxDataBlock.
Definition flux.h:156
Header structure for a FluxDataBlock containing flux capture metadata.
Definition flux.h:117
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:934
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:150
uint64_t key
Key: sector address.
Definition context.h:148
uint64_t value
Value: DDT entry.
Definition context.h:149
Describes a single logical file on a tape medium.
Definition tape.h:134
UT_hash_handle hh
UTHASH handle.
Definition context.h:136
uint64_t key
Composite key: partition << 32 | file.
Definition context.h:134
TapeFileEntry fileEntry
The actual tape file data.
Definition context.h:135
Describes a single physical partition on a tape medium.
Definition tape.h:320
UT_hash_handle hh
UTHASH handle.
Definition context.h:143
uint8_t key
Key: partition.
Definition context.h:141
TapePartitionEntry partitionEntry
The actual tape partition data.
Definition context.h:142
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:178
uint8_t * ps3_disc_key
Cached disc key (16 bytes), NULL if not loaded.
Definition context.h:357
bool wiiu_building_crypto_block
True while gathering sectors for re-encryption (suppresses recursion).
Definition context.h:370
uint64_t * ec_data_shard_crcs
Array of K * K CRC64 values for blocks in active stripes.
Definition context.h:396
uint8_t * media_barcode
Barcode of the media represented by the image.
Definition context.h:232
DdtHeader2 user_data_ddt_header
Active user data DDT v2 header (primary table meta).
Definition context.h:195
uint32_t * ec_data_block_sizes
Array of K * K actual on-disk sizes for blocks in active stripes.
Definition context.h:395
Checksums checksums
Whole-image checksums discovered.
Definition context.h:279
uint8_t library_major_version
Linked library major version.
Definition context.h:183
uint8_t * creator
Who (person) created the image?
Definition context.h:226
bool dirty_checksum_block
True if checksum block should be written during close.
Definition context.h:332
bool deduplicate
Storage deduplication active (duplicates coalesce).
Definition context.h:310
size_t dpm_block_length
Length of dpm_block in bytes, 0 if not present.
Definition context.h:224
void * wiiu_partition_regions
Parsed WiiuPartitionRegion array, NULL if not loaded.
Definition context.h:364
size_t sector_suffix_length
Length of sector_suffix.
Definition context.h:295
bool compression_enabled
True if block compression enabled (writing path).
Definition context.h:311
uint64_t last_written_block
Last written block number (write path).
Definition context.h:293
uint8_t * cicm_block
CICM XML payload.
Definition context.h:221
uint8_t * sector_cpr_mai
DVD sector CPR_MAI (6 bytes) if present.
Definition context.h:214
bool dirty_media_tags
True if media tags should be written during close.
Definition context.h:343
hash_map_t * sector_hash_map
Deduplication hash map (fingerprint->entry mapping).
Definition context.h:263
FluxHeader flux_data_header
Flux data header (if present).
Definition context.h:323
uint32_t ps3_plaintext_region_count
Number of plaintext regions.
Definition context.h:359
uint8_t * sector_prefix_corrected
Corrected variant (post error correction) if stored.
Definition context.h:207
uint64_t * user_data_ddt
Legacy flat DDT pointer (NULL when using v2 mini/big arrays).
Definition context.h:187
uint32_t wiiu_partition_region_count
Number of partition regions.
Definition context.h:365
UT_array * flux_captures
Pending flux capture payloads (write path).
Definition context.h:325
bool dirty_dpm_block
True if DPM block should be written or removed during close.
Definition context.h:352
uint16_t ngcw_junk_seed_size
LFG seed size in uint32 words (expected: 17).
Definition context.h:375
sha256_ctx sha256_context
Opaque SHA-256 context for streaming updates.
Definition context.h:282
void * ec_rs_ctx
rs_context* (opaque RS codec), NULL if EC disabled.
Definition context.h:392
uint32_t ec_meta_stripe_count
Number of metadata stripes.
Definition context.h:407
uint8_t ec_algorithm
ErasureCodingAlgorithm (0=XOR, 1=RS-Vandermonde).
Definition context.h:388
TrackEntry * data_tracks
Filtered list of data tracks (subset of trackEntries).
Definition context.h:253
uint32_t cylinders
Cylinders of the media represented by the image.
Definition context.h:244
bool calculating_sha256
True if whole-image SHA-256 being calculated on-the-fly.
Definition context.h:285
bool dirty_primary_ddt
True if primary DDT table should be written during close.
Definition context.h:330
uint8_t * drive_firmware_revision
Firmware revision of the drive used to read the media represented by the image.
Definition context.h:238
uint8_t * media_serial_number
Serial number of the media represented by the image.
Definition context.h:231
uint8_t * wiiu_encrypted_block_cache
Cached re-encrypted 0x8000-byte physical sector.
Definition context.h:367
bool ec_recovery_in_progress
Recursion guard for recovery (prevents infinite loops).
Definition context.h:419
void * ngcw_junk_entries
Parsed NgcwJunkEntry array, NULL if not loaded.
Definition context.h:373
struct CacheHeader block_header_cache
LRU/Cache header for block headers.
Definition context.h:266
uint8_t * sector_ied
DVD sector IED (2 bytes) if present.
Definition context.h:213
md5_ctx md5_context
Opaque MD5 context for streaming updates.
Definition context.h:280
bool dirty_sector_suffix_block
True if sector suffix block should be written during close.
Definition context.h:337
uint64_t * user_data_ddt2
DDT entries (big variant) primary/secondary current.
Definition context.h:193
uint32_t ec_data_shard_size
Max on-disk block size for data blocks (fixed at creation).
Definition context.h:391
uint32_t ec_read_stripe_count
Number of data stripes parsed from ECMB.
Definition context.h:404
MetadataBlockHeader metadata_block_header
Metadata block header.
Definition context.h:240
int32_t media_sequence
Number in sequence for the media represented by the image.
Definition context.h:248
uint8_t shift
Legacy overall shift (deprecated by data_shift/table_shift).
Definition context.h:201
uint8_t * sector_prefix
Raw per-sector prefix (e.g., sync+header) uncorrected.
Definition context.h:206
uint64_t wii_cached_physical_group
Physical group number of cached block.
Definition context.h:383
bool dirty_dvd_title_key_decrypted_block
True if decrypted title key block should be written during close.
Definition context.h:342
uint32_t ec_ddt_stripe_count
Number of DDT-secondary stripes.
Definition context.h:413
FluxCaptureMapEntry * flux_map
Hash map for flux capture lookup by head/track/subtrack/capture index.
Definition context.h:326
uint64_t * sector_suffix_ddt2
CD sector suffix DDT V2.
Definition context.h:192
tapeFileHashEntry * tape_files
Hash table root for tape files.
Definition context.h:318
bool dirty_mode2_subheaders_block
True if MODE2 subheader block should be written during close.
Definition context.h:334
bool dirty_tape_partition_block
True if tape partition block should be written during close.
Definition context.h:346
uint64_t cached_ddt_offset
File offset of currently cached secondary DDT (0=none).
Definition context.h:196
bool dirty_cicm_block
True if CICM metadata block should be written during close.
Definition context.h:350
bool is_tape
True if the image is a tape image.
Definition context.h:320
uint8_t * sector_edc
DVD or Blu-ray sector EDC (4 bytes) if present (see DvdSectorEdc / BdSectorEdc data types).
Definition context.h:215
bool calculating_sha1
True if whole-image SHA-1 being calculated on-the-fly.
Definition context.h:284
uint8_t * media_model
Model of the media represented by the image.
Definition context.h:230
bool dirty_tracks_block
True if tracks block should be written during close.
Definition context.h:333
uint8_t * drive_serial_number
Serial number of the drive used to read the media represented by the image.
Definition context.h:236
CdEccContext * ecc_cd_context
CD ECC/EDC helper tables (allocated on demand).
Definition context.h:258
bool rewinded
True if stream has been rewound after open (write path).
Definition context.h:303
struct CacheHeader block_cache
LRU/Cache header for block payloads.
Definition context.h:267
bool ps3_encryption_initialized
Whether lazy init has occurred.
Definition context.h:360
uint64_t wiiu_cached_physical_sector
Physical sector number of cached block.
Definition context.h:368
uint32_t ec_meta_shard_size
Shard size for metadata group.
Definition context.h:410
void * ec_ddt_block_lookup
uthash: block file offset → stripe index + position (DDT group).
Definition context.h:417
uint32_t * sector_suffix_ddt
Legacy CD sector suffix DDT.
Definition context.h:190
bool dirty_sector_prefix_block
True if sector prefix block should be written during close.
Definition context.h:335
uint8_t * drive_manufacturer
Manufacturer of the drive used to read the media represented by the image.
Definition context.h:234
bool in_memory_ddt
True if primary (and possibly secondary) DDT loaded.
Definition context.h:202
bool dirty_index_block
True if index block should be written during close.
Definition context.h:354
uint8_t * sector_suffix
Raw per-sector suffix (EDC/ECC) uncorrected.
Definition context.h:208
uint64_t dpm_damaged_offset
Offset of a DPM block that failed to load, to recover it with erasure coding, or 0.
Definition context.h:225
AaruHeaderV2 header
Parsed container header (v2).
Definition context.h:181
int current_block_offset
Logical offset inside block (units: bytes or sectors depending on path).
Definition context.h:298
UT_array * ec_data_stripes
Completed data stripe descriptors (serialized to ECMB).
Definition context.h:399
FluxEntry * flux_entries
Array of flux entries (flux_data_header.entries elements).
Definition context.h:324
bool dirty_json_block
True if JSON metadata block should be written during close.
Definition context.h:351
bool is_writing
True if context opened/created for writing.
Definition context.h:302
TapeDdtHashEntry * tape_ddt
Hash table root for tape DDT entries.
Definition context.h:188
uint16_t ec_ddt_M
M for DDT-secondary group.
Definition context.h:415
spamsum_ctx * spamsum_context
Opaque SpamSum context for streaming updates.
Definition context.h:277
CicmMetadataBlock cicm_block_header
CICM metadata header (if present).
Definition context.h:241
size_t sector_prefix_offset
Current position in sector_prefix.
Definition context.h:296
uint8_t * drive_model
Model of the drive used to read the media represented by the image.
Definition context.h:235
BlockHeader current_block_header
Header for block currently being assembled (write path).
Definition context.h:291
bool dirty_single_level_ddt
True if single-level DDT should be written during close.
Definition context.h:331
int ddt_version
DDT version in use (1=legacy, 2=v2 hierarchical).
Definition context.h:200
uint64_t magic
File magic (AARU_MAGIC) post-open.
Definition context.h:180
uint8_t * writing_buffer
Accumulation buffer for current block data.
Definition context.h:290
uint64_t * sector_prefix_ddt2
CD sector prefix DDT V2.
Definition context.h:191
uint16_t ec_meta_M
M for metadata group.
Definition context.h:409
bool calculating_spamsum
True if whole-image SpamSum being calculated on-the-fly.
Definition context.h:286
int32_t(*) finalize_write(struct aaruformat_context *ctx)
Writer finalization hook (NULL for reader).
Definition context.h:306
uint64_t primary_ddt_offset
File offset of the primary DDT v2 table.
Definition context.h:198
bool wii_building_crypto_block
True while gathering sectors for re-encryption (suppresses recursion).
Definition context.h:385
size_t sector_prefix_length
Length of sector_prefix.
Definition context.h:294
mediaTagEntry * mediaTags
Hash table of extra media tags (uthash root).
Definition context.h:274
blake3_hasher * blake3_context
Opaque BLAKE3 context for streaming updates.
Definition context.h:278
bool calculating_blake3
True if whole-image BLAKE3 being calculated on-the-fly.
Definition context.h:287
uint8_t * wiiu_disc_key
Cached disc key (16 bytes), NULL if not loaded.
Definition context.h:363
uint8_t library_minor_version
Linked library minor version;.
Definition context.h:184
struct DumpHardwareEntriesWithData * dump_hardware_entries_with_data
Array of dump hardware entries + strings.
Definition context.h:219
uint32_t ngcw_junk_entry_count
Number of junk entries.
Definition context.h:374
uint64_t next_block_position
Absolute file offset where next block will be written.
Definition context.h:292
bool calculating_md5
True if whole-image MD5 being calculated on-the-fly.
Definition context.h:283
bool dirty_sector_suffix_ddt
True if sector suffix DDT should be written during close.
Definition context.h:338
uint64_t * ec_data_block_offsets
Array of K * K file offsets for blocks in active stripes.
Definition context.h:394
GeometryBlockHeader geometry_block
Logical geometry block (if present).
Definition context.h:239
uint32_t ec_total_data_blocks
Total data blocks written (counter for round-robin assignment).
Definition context.h:398
size_t sector_suffix_offset
Current position in sector_suffix.
Definition context.h:297
uint16_t ec_M
Parity blocks per stripe.
Definition context.h:390
bool has_zstd_blocks
True if any block was actually written with Zstandard compression.
Definition context.h:313
uint64_t * cached_secondary_ddt2
Cached secondary table (big entries) or NULL.
Definition context.h:194
uint8_t * json_block
JSON metadata block payload (UTF-8).
Definition context.h:222
int zstd_level
Zstandard compression level (writing path, default 19).
Definition context.h:314
uint8_t * media_part_number
Part number of the media represented by the image.
Definition context.h:233
uint32_t wii_partition_region_count
Number of partition regions.
Definition context.h:380
bool wiiu_encryption_initialized
Whether lazy init has occurred.
Definition context.h:366
uint16_t * ec_data_stripe_counts
Array of K: blocks accumulated per stripe slot.
Definition context.h:397
uint8_t * sector_decrypted_title_key
DVD decrypted title key (5 bytes) if present.
Definition context.h:216
bool wii_encryption_initialized
Whether lazy init has occurred.
Definition context.h:381
bool dirty_dumphw_block
True if dump hardware block should be written during close.
Definition context.h:349
AaruMetadataJsonBlockHeader json_block_header
JSON metadata block header (if present).
Definition context.h:243
int writing_buffer_position
Current size / position within writingBuffer.
Definition context.h:299
bool dirty_metadata_block
True if metadata block should be written during close.
Definition context.h:348
bool block_zero_written
True if block zero has been written (writing path).
Definition context.h:305
void * ec_read_stripes
Parsed EcReadStripe array for data group, NULL if no ECMB.
Definition context.h:403
crc64_ctx * crc64_context
Opaque CRC64 context for streaming updates.
Definition context.h:259
uint32_t sectors_per_track
Sectors per track of the media represented by the image (for variable image, the smallest).
Definition context.h:246
uint8_t * sector_subchannel
Raw 96-byte subchannel (if captured).
Definition context.h:210
void * wii_partition_regions
Parsed WiiPartitionRegion array, NULL if not loaded.
Definition context.h:379
void * ec_block_lookup
uthash: block file offset → stripe index + position (data group).
Definition context.h:405
uint8_t * comments
Image comments.
Definition context.h:228
uint32_t heads
Heads of the media represented by the image.
Definition context.h:245
bool dirty_sector_subchannel_block
True if subchannel block should be written during close.
Definition context.h:339
void * ec_ddt_stripes
Parsed EcReadStripe array for DDT-secondary group.
Definition context.h:412
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:182
void * ec_meta_block_lookup
uthash: block file offset → stripe index + position (metadata group).
Definition context.h:411
bool dirty_dvd_long_sector_blocks
True if DVD long sector blocks should be written during close.
Definition context.h:340
bool no_user_data_ddt
True if image intentionally has no user-data DDT (e.g. flux-only image). When set,...
Definition context.h:203
bool dirty_sector_prefix_ddt
True if sector prefix DDT should be written during close.
Definition context.h:336
UT_array * index_entries
Flattened index entries (UT_array of IndexEntry).
Definition context.h:262
int num_threads
Compression worker threads (1 = single-threaded, default).
Definition context.h:315
bool dirty_tape_file_block
True if tape file block should be written during close.
Definition context.h:345
uint32_t ec_ddt_shard_size
Shard size for DDT-secondary group.
Definition context.h:416
bool ec_enabled
True if erasure coding is active.
Definition context.h:400
uint8_t ** ec_data_parity
Array of K * M parity buffers (interleaved stripe slots).
Definition context.h:393
uint16_t ec_ddt_K
K for DDT-secondary group.
Definition context.h:414
uint8_t * mode2_subheaders
MODE2 Form1/Form2 8-byte subheaders (concatenated).
Definition context.h:211
bool dirty_bd_sector_edc_block
True if Blu-ray sector EDC data block should be written during close.
Definition context.h:341
ImageInfo image_info
Exposed high-level image info summary.
Definition context.h:270
bool wii_cache_valid
Whether the encrypted group cache is valid.
Definition context.h:384
bool dirty_flux_block
True if flux block should be written during close.
Definition context.h:353
uint8_t * sector_id
DVD sector ID (4 bytes) if present.
Definition context.h:212
DumpHardwareHeader dump_hardware_header
Dump hardware header.
Definition context.h:242
void * ec_meta_stripes
Parsed EcReadStripe array for metadata group.
Definition context.h:406
void * ps3_plaintext_regions
Parsed Ps3PlaintextRegion array (max 32), NULL if not loaded.
Definition context.h:358
bool use_zstd
Use Zstandard instead of LZMA for data blocks.
Definition context.h:312
sha1_ctx sha1_context
Opaque SHA-1 context for streaming updates.
Definition context.h:281
bool dirty_secondary_ddt
True if secondary DDT tables should be written during close.
Definition context.h:329
bool * readableSectorTags
Per-sector boolean array (optical tags read successfully?).
Definition context.h:273
bool dirty_tape_ddt
True if tape DDT should be written during close.
Definition context.h:344
TapePartitionHashEntry * tape_partitions
Hash table root for tape partitions.
Definition context.h:319
uint32_t * sector_prefix_ddt
Legacy CD sector prefix DDT (deprecated by *2).
Definition context.h:189
uint8_t * dpm_block
Data Position Measurement block, header included.
Definition context.h:223
uint32_t lzma_dict_size
LZMA dictionary size (writing path).
Definition context.h:309
bool wiiu_cache_valid
Whether the encrypted block cache is valid.
Definition context.h:369
TrackEntry * track_entries
Full track list (tracksHeader.entries elements).
Definition context.h:252
uint8_t number_of_data_tracks
Count of tracks considered "data" (sequence 1..99 heuristics).
Definition context.h:255
uint8_t * sector_suffix_corrected
Corrected suffix if stored separately.
Definition context.h:209
uint8_t * metadata_block
Raw metadata UTF-16LE concatenated strings.
Definition context.h:220
uint8_t * wii_encrypted_group_cache
Cached re-encrypted 0x8000-byte group.
Definition context.h:382
uint64_t cached_ddt_position
Position index of cached secondary DDT.
Definition context.h:197
uint16_t ec_meta_K
K for metadata group.
Definition context.h:408
uint8_t current_track_type
Current track type (when writing optical images with tracks, needed for block compression type).
Definition context.h:300
bool writing_long
True if writing long sectors.
Definition context.h:304
bool ngcw_junk_initialized
Whether junk map has been loaded.
Definition context.h:376
uint8_t * media_title
Title of the media represented by the image.
Definition context.h:227
bool dirty_geometry_block
True if geometry block should be written during close.
Definition context.h:347
uint16_t ec_K
Data blocks per stripe.
Definition context.h:389
int32_t last_media_sequence
Last media of the sequence the media represented by the image corresponds to.
Definition context.h:249
bool ec_recovery_available
True if ECMB loaded and recovery is possible.
Definition context.h:418
size_t mapped_memory_ddt_size
Length of mmapped DDT if userDataDdt is mmapped.
Definition context.h:199
uint8_t * media_manufacturer
Manufacturer of the media represented by the image.
Definition context.h:229
TracksHeader tracks_header
Tracks header (optical) if present.
Definition context.h:254
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:125
uint8_t * data
Tag data blob (opaque to library core); length bytes long.
Definition context.h:126
int32_t type
Numeric type identifier.
Definition context.h:127
uint32_t length
Length in bytes of data.
Definition context.h:128
UT_hash_handle hh
uthash linkage.
Definition context.h:129