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
279AARU_EXPORT void AARU_CALL *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,
281 const uint64_t overflow_sectors, const char *options,
282 const uint8_t *application_name, const uint8_t application_name_length,
283 const uint8_t application_major_version,
284 const uint8_t application_minor_version, const bool is_tape)
285{
286 TRACE("Entering aaruf_create(%s, %u, %u, %llu, %llu, %llu, %s, %s, %u, %u, %u, %d)", filepath, media_type,
287 sector_size, user_sectors, negative_sectors, overflow_sectors, options,
288 application_name ? (const char *)application_name : "NULL", application_name_length,
289 application_major_version, application_minor_version, is_tape);
290
291 // Parse the options
292 TRACE("Parsing options");
293 const aaru_options parsed_options = parse_options(options);
294
295 // Allocate context
296 TRACE("Allocating memory for context");
297 aaruformat_context *ctx = malloc(sizeof(aaruformat_context));
298 if(ctx == NULL)
299 {
300 FATAL("Not enough memory to create context");
302
303 TRACE("Exiting aaruf_create() = NULL");
304 return NULL;
305 }
306
307 memset(ctx, 0, sizeof(aaruformat_context));
308
309 // Create the image file
310 TRACE("Creating image file %s", filepath);
311 ctx->imageStream = fopen(filepath, "wb+");
312 if(ctx->imageStream == NULL)
313 {
314 FATAL("Error %d opening file %s for writing", errno, filepath);
316
317 TRACE("Exiting aaruf_create() = NULL");
319 return NULL;
320 }
321
322 if(application_name_length > AARU_HEADER_APP_NAME_LEN)
323 {
324 FATAL("Application name too long (%u bytes, maximum %u bytes)", application_name_length,
327
328 TRACE("Exiting aaruf_create() = NULL");
330 return NULL;
331 }
332
333 // Initialize header
334 TRACE("Initializing header");
336 memcpy(ctx->header.application, application_name, application_name_length);
338 ctx->header.imageMinorVersion = 0;
339 ctx->header.applicationMajorVersion = application_major_version;
340 ctx->header.applicationMinorVersion = application_minor_version;
341 ctx->header.mediaType = media_type;
342 ctx->header.indexOffset = 0;
345
346 // Generate random GUID for the image
347 TRACE("Generating random GUID");
349
350 ctx->readableSectorTags = (bool *)malloc(sizeof(bool) * MaxSectorTag);
351
352 if(ctx->readableSectorTags == NULL)
353 {
355
356 TRACE("Exiting aaruf_create() = NULL");
358 return NULL;
359 }
360
361 memset(ctx->readableSectorTags, 0, sizeof(bool) * MaxSectorTag);
362
363 // Initialize image info
364 TRACE("Initializing image info");
365
366 // Copy application name (UTF-8) to image_info
367 memset(ctx->image_info.Application, 0, 64);
368 size_t copy_len = application_name_length < 63 ? application_name_length : 63;
369 memcpy(ctx->image_info.Application, application_name, copy_len);
370 ctx->image_info.Application[63] = '\0';
371
372 // Set application version string directly in the fixed-size array
373 memset(ctx->image_info.ApplicationVersion, 0, 32);
376
377 // Set image version string directly in the fixed-size array
378 memset(ctx->image_info.Version, 0, 32);
379 sprintf(ctx->image_info.Version, "%d.%d", ctx->header.imageMajorVersion, ctx->header.imageMinorVersion);
380
382 ctx->image_info.ImageSize = 0;
386 ctx->image_info.SectorSize = sector_size;
387 ctx->image_info.Sectors = user_sectors;
388
389 // Initialize caches
390 TRACE("Initializing caches");
391 ctx->block_header_cache.cache = NULL;
392 const uint64_t cache_divisor = (uint64_t)ctx->image_info.SectorSize * (1ULL << ctx->shift);
393 ctx->block_header_cache.max_items = cache_divisor == 0 ? 0 : MAX_CACHE_SIZE / cache_divisor;
394 ctx->block_cache.cache = NULL;
396
397 // TODO: Cache tracks and sessions?
398
399 // Initialize ECC for Compact Disc
400 TRACE("Initializing Compact Disc ECC");
402
403 ctx->magic = AARU_MAGIC;
406
407 if(!is_tape)
408 { // Initialize DDT2
409 TRACE("Initializing DDT2");
410 ctx->in_memory_ddt = true;
416 ctx->user_data_ddt_header.negative = negative_sectors;
417 ctx->user_data_ddt_header.blocks = user_sectors + overflow_sectors + negative_sectors;
418 ctx->user_data_ddt_header.overflow = overflow_sectors;
421 ctx->user_data_ddt_header.dataShift = parsed_options.data_shift;
422
423 if(parsed_options.table_shift == -1)
424 {
425 const uint64_t total_sectors = user_sectors + overflow_sectors + negative_sectors;
426
427 if(total_sectors < 0x8388608ULL)
429 else
431 }
432 else
434 parsed_options.table_shift > 0 ? (uint8_t)parsed_options.table_shift : 0;
435
437
438 uint8_t effective_table_shift = ctx->user_data_ddt_header.tableShift;
439 if(effective_table_shift >= 63)
440 {
441 TRACE("Clamping table shift from %u to 62 to avoid overflow", effective_table_shift);
442 effective_table_shift = 62;
443 ctx->user_data_ddt_header.tableShift = effective_table_shift;
444 }
445
446 const uint64_t sectors_per_entry = 1ULL << effective_table_shift;
447 ctx->user_data_ddt_header.entries = ctx->user_data_ddt_header.blocks / sectors_per_entry;
448 if(ctx->user_data_ddt_header.blocks % sectors_per_entry != 0 || ctx->user_data_ddt_header.entries == 0)
450
451 TRACE("Initializing primary/single DDT");
452 ctx->user_data_ddt2 =
453 (uint64_t *)calloc(ctx->user_data_ddt_header.entries, sizeof(uint64_t)); // All entries to zero
454 if(ctx->user_data_ddt2 == NULL)
455 {
456 FATAL("Not enough memory to allocate primary DDT (big)");
458 TRACE("Exiting aaruf_create() = NULL");
460 return NULL;
461 }
462
463 // Set the primary DDT offset (just after the header, block aligned)
464 ctx->primary_ddt_offset = sizeof(AaruHeaderV2); // Start just after the header
465 const uint64_t alignment_mask = (1ULL << ctx->user_data_ddt_header.blockAlignmentShift) - 1;
466 ctx->primary_ddt_offset = ctx->primary_ddt_offset + alignment_mask & ~alignment_mask;
467
468 TRACE("Primary DDT will be placed at offset %" PRIu64, ctx->primary_ddt_offset);
469
470 // Calculate size of primary DDT table
471 const uint64_t primary_table_size = ctx->user_data_ddt_header.entries * sizeof(uint64_t);
472
473 // Calculate where data blocks can start (after primary DDT + header)
475 {
476 const uint64_t data_start_position = ctx->primary_ddt_offset + sizeof(DdtHeader2) + primary_table_size;
477 ctx->next_block_position = data_start_position + alignment_mask & ~alignment_mask;
478 }
479 else
480 ctx->next_block_position = ctx->primary_ddt_offset; // Single-level DDT can start anywhere
481 }
482 else
483 {
484 // Fill needed values
486 ctx->user_data_ddt_header.dataShift = parsed_options.data_shift;
487
488 // Calculate aligned next block position
489 const uint64_t alignment_mask = (1ULL << parsed_options.block_alignment) - 1;
490 ctx->next_block_position = sizeof(AaruHeaderV2); // Start just after the header
491 ctx->next_block_position = ctx->next_block_position + alignment_mask & ~alignment_mask;
492 ctx->is_tape = 1;
493 ctx->tape_ddt = NULL;
494 }
495
496 TRACE("Data blocks will start at position %" PRIu64, ctx->next_block_position);
497
498 // Position file pointer at the data start position
499 if(fseek(ctx->imageStream, ctx->next_block_position, SEEK_SET) != 0)
500 {
501 FATAL("Could not seek to data start position");
503 TRACE("Exiting aaruf_create() = NULL");
505 return NULL;
506 }
507
508 // Initialize index entries array
509 TRACE("Initializing index entries array");
510 const UT_icd index_entry_icd = {sizeof(IndexEntry), NULL, NULL, NULL};
511 utarray_new(ctx->index_entries, &index_entry_icd);
512
513 if(ctx->index_entries == NULL)
514 {
515 FATAL("Not enough memory to create index entries array");
517
518 TRACE("Exiting aaruf_create() = NULL");
520 return NULL;
521 }
522
523 ctx->compression_enabled = parsed_options.compress;
524 ctx->lzma_dict_size = parsed_options.dictionary;
525 ctx->deduplicate = parsed_options.deduplicate;
526 if(ctx->deduplicate)
527 ctx->sector_hash_map = create_map(ctx->user_data_ddt_header.blocks * 25 / 100); // 25% of total sectors
528
529 ctx->rewinded = false;
530 ctx->last_written_block = 0;
531
532 if(parsed_options.md5)
533 {
534 ctx->calculating_md5 = true;
536 }
537 if(parsed_options.sha1)
538 {
539 ctx->calculating_sha1 = true;
541 }
542 if(parsed_options.sha256)
543 {
544 ctx->calculating_sha256 = true;
546 }
547 if(parsed_options.spamsum)
548 {
549 ctx->calculating_spamsum = true;
551 }
552 if(parsed_options.blake3)
553 {
554 ctx->blake3_context = calloc(1, sizeof(blake3_hasher));
555 if(ctx->blake3_context != NULL)
556 {
557 ctx->calculating_blake3 = true;
558 blake3_hasher_init(ctx->blake3_context);
559 }
560 }
561
562 // Is writing
563 ctx->is_writing = true;
564
565 // Initialize dirty flags - all true by default for new images
566 ctx->dirty_secondary_ddt = true;
567 ctx->dirty_primary_ddt = true;
568 ctx->dirty_single_level_ddt = true;
569 ctx->dirty_checksum_block = true;
570 ctx->dirty_tracks_block = true;
572 ctx->dirty_sector_prefix_block = true;
573 ctx->dirty_sector_prefix_ddt = true;
574 ctx->dirty_sector_suffix_block = true;
575 ctx->dirty_sector_suffix_ddt = true;
579 ctx->dirty_media_tags = true;
580 ctx->dirty_tape_ddt = true;
581 ctx->dirty_tape_file_block = true;
582 ctx->dirty_tape_partition_block = true;
583 ctx->dirty_geometry_block = true;
584 ctx->dirty_metadata_block = true;
585 ctx->dirty_dumphw_block = true;
586 ctx->dirty_cicm_block = true;
587 ctx->dirty_json_block = true;
588 ctx->dirty_index_block = true;
589
590 TRACE("Exiting aaruf_create() = %p", ctx);
591 // Return context
592 return ctx;
593}
#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
#define AARU_CALL
Definition decls.h:45
void aaruf_sha256_init(sha256_ctx *ctx)
Definition sha256.c:76
void aaruf_md5_init(md5_ctx *ctx)
Definition md5.c:436
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
#define AARU_EXPORT
Definition decls.h:54
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:351
@ DeDuplicationTable2
Block containing a deduplication table v2.
Definition enums.h:144
@ 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:970
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 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
uint64_t get_filetime_uint64()
Gets the current time as a 64-bit FILETIME value.
Definition time.c:45
void generate_random_bytes(uint8_t *buffer, size_t length)
Generates cryptographically strong random bytes.
Definition helpers.c:484
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-8 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
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
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:933
uint8_t MetadataMediaType
Media type for sidecar generation (internal archival use)
Definition aaru.h:934
uint32_t SectorSize
Size of each logical sector in bytes (512, 2048, 2352, 4096, etc.)
Definition aaru.h:927
char Application[64]
Name of application that created the image (NUL-terminated)
Definition aaru.h:929
uint64_t ImageSize
Size of the image payload in bytes (excludes headers/metadata)
Definition aaru.h:925
int64_t CreationTime
Image creation timestamp (Windows FILETIME: 100ns since 1601-01-01 UTC)
Definition aaru.h:931
int64_t LastModificationTime
Last modification timestamp (Windows FILETIME format)
Definition aaru.h:932
char Version[32]
Image format version string (NUL-terminated, e.g., "6.0")
Definition aaru.h:928
uint64_t Sectors
Total count of addressable logical sectors/blocks.
Definition aaru.h:926
char ApplicationVersion[32]
Version of the creating application (NUL-terminated)
Definition aaru.h:930
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 dirty_checksum_block
True if checksum block should be written during close.
Definition context.h:311
bool deduplicate
Storage deduplication active (duplicates coalesce).
Definition context.h:299
bool compression_enabled
True if block compression enabled (writing path).
Definition context.h:300
uint64_t last_written_block
Last written block number (write path).
Definition context.h:283
bool dirty_media_tags
True if media tags should be written during close.
Definition context.h:321
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
bool dirty_primary_ddt
True if primary DDT table should be written during close.
Definition context.h:309
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
bool dirty_sector_suffix_block
True if sector suffix block should be written during close.
Definition context.h:316
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 dirty_dvd_title_key_decrypted_block
True if decrypted title key block should be written during close.
Definition context.h:320
bool dirty_mode2_subheaders_block
True if MODE2 subheader block should be written during close.
Definition context.h:313
bool dirty_tape_partition_block
True if tape partition block should be written during close.
Definition context.h:324
bool dirty_cicm_block
True if CICM metadata block should be written during close.
Definition context.h:328
bool is_tape
True if the image is a tape image.
Definition context.h:305
bool calculating_sha1
True if whole-image SHA-1 being calculated on-the-fly.
Definition context.h:274
bool dirty_tracks_block
True if tracks block should be written during close.
Definition context.h:312
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 dirty_sector_prefix_block
True if sector prefix block should be written during close.
Definition context.h:314
bool in_memory_ddt
True if primary (and possibly secondary) DDT loaded.
Definition context.h:196
bool dirty_index_block
True if index block should be written during close.
Definition context.h:330
AaruHeaderV2 header
Parsed container header (v2).
Definition context.h:175
bool dirty_json_block
True if JSON metadata block should be written during close.
Definition context.h:329
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
bool dirty_single_level_ddt
True if single-level DDT should be written during close.
Definition context.h:310
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
bool dirty_sector_suffix_ddt
True if sector suffix DDT should be written during close.
Definition context.h:317
bool dirty_dumphw_block
True if dump hardware block should be written during close.
Definition context.h:327
bool dirty_metadata_block
True if metadata block should be written during close.
Definition context.h:326
bool dirty_sector_subchannel_block
True if subchannel block should be written during close.
Definition context.h:318
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:176
bool dirty_dvd_long_sector_blocks
True if DVD long sector blocks should be written during close.
Definition context.h:319
bool dirty_sector_prefix_ddt
True if sector prefix DDT should be written during close.
Definition context.h:315
UT_array * index_entries
Flattened index entries (UT_array of IndexEntry).
Definition context.h:252
bool dirty_tape_file_block
True if tape file block should be written during close.
Definition context.h:323
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 dirty_secondary_ddt
True if secondary DDT tables should be written during close.
Definition context.h:308
bool * readableSectorTags
Per-sector boolean array (optical tags read successfully?).
Definition context.h:263
bool dirty_tape_ddt
True if tape DDT should be written during close.
Definition context.h:322
uint32_t lzma_dict_size
LZMA dictionary size (writing path).
Definition context.h:298
bool dirty_geometry_block
True if geometry block should be written during close.
Definition context.h:325