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-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#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
37{
38 TRACE("Entering process_metadata_block(%p, %p)", ctx, entry);
39 int pos = 0;
40 size_t read_bytes = 0;
41
42 // Check if the context and image stream are valid
43 if(ctx == NULL || ctx->imageStream == NULL)
44 {
45 FATAL("Invalid context or image stream.");
46 TRACE("Exiting process_metadata_block()");
47 return;
48 }
49
50 // Seek to block
51 TRACE("Seeking to metadata block at position %" PRIu64, entry->offset);
52 pos = aaruf_fseek(ctx->imageStream, (aaru_off_t)entry->offset, SEEK_SET);
53 if(pos < 0 || aaruf_ftell(ctx->imageStream) != (aaru_off_t)entry->offset)
54 {
55 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
56
57 TRACE("Exiting process_metadata_block()");
58 return;
59 }
60
61 // Even if those two checks shall have been done before
62 TRACE("Reading metadata block header at position %" PRIu64, entry->offset);
63 read_bytes = fread(&ctx->metadata_block_header, 1, sizeof(MetadataBlockHeader), ctx->imageStream);
64
65 if(read_bytes != sizeof(MetadataBlockHeader))
66 {
67 memset(&ctx->metadata_block_header, 0, sizeof(MetadataBlockHeader));
68 FATAL("Could not read metadata block header, continuing...");
69
70 TRACE("Exiting process_metadata_block()");
71 return;
72 }
73
75 {
76 memset(&ctx->metadata_block_header, 0, sizeof(MetadataBlockHeader));
77 TRACE("Incorrect identifier for data block at position %" PRIu64 "", entry->offset);
78
79 TRACE("Exiting process_metadata_block()");
80 return;
81 }
82
84
85 ctx->metadata_block = (uint8_t *)malloc(ctx->metadata_block_header.blockSize + sizeof(MetadataBlockHeader));
86
87 if(ctx->metadata_block == NULL)
88 {
89 memset(&ctx->metadata_block_header, 0, sizeof(MetadataBlockHeader));
90 FATAL("Could not allocate memory for metadata block, continuing...");
91
92 TRACE("Exiting process_metadata_block()");
93 return;
94 }
95
96 TRACE("Reading metadata block of size %u at position %" PRIu64,
98
99 aaruf_fseek(ctx->imageStream, (aaru_off_t)entry->offset, SEEK_SET);
100 read_bytes = fread(ctx->metadata_block, 1, ctx->metadata_block_header.blockSize + sizeof(MetadataBlockHeader),
101 ctx->imageStream);
102
103 if(read_bytes != ctx->metadata_block_header.blockSize + sizeof(MetadataBlockHeader))
104 {
105 memset(&ctx->metadata_block_header, 0, sizeof(MetadataBlockHeader));
106 free(ctx->metadata_block);
107 FATAL("Could not read metadata block, continuing...");
108
109 return;
110 }
111
113 {
116 TRACE("Setting media sequence as %d of %d", ctx->media_sequence, ctx->last_media_sequence);
117 }
118
122 {
123 ctx->creator = (uint8_t *)malloc(ctx->metadata_block_header.creatorLength);
124 if(ctx->creator != NULL)
127 }
128
132 {
133 ctx->comments = (uint8_t *)malloc(ctx->metadata_block_header.commentsLength);
134 if(ctx->comments != NULL)
137 }
138
142 {
143 ctx->media_title = (uint8_t *)malloc(ctx->metadata_block_header.mediaTitleLength);
144 if(ctx->media_title != NULL)
147 }
148
152 {
154 if(ctx->media_manufacturer != NULL)
157 }
158
162 {
163 ctx->media_model = (uint8_t *)malloc(ctx->metadata_block_header.mediaModelLength);
164 if(ctx->media_model != NULL)
167 }
168
172 {
174 if(ctx->media_serial_number != NULL)
177 }
178
182 {
183 ctx->media_barcode = (uint8_t *)malloc(ctx->metadata_block_header.mediaBarcodeLength);
184 if(ctx->media_barcode != NULL)
187 }
188
192 {
194 if(ctx->media_part_number != NULL)
197 }
198
202 {
204 if(ctx->drive_manufacturer != NULL)
207 }
208
212 {
213 ctx->drive_model = (uint8_t *)malloc(ctx->metadata_block_header.driveModelLength);
214 if(ctx->drive_model != NULL)
217 }
218
222 {
224 if(ctx->drive_serial_number != NULL)
227 }
228
233 {
235 if(ctx->drive_firmware_revision != NULL)
236 memcpy(ctx->drive_firmware_revision,
239 }
240
241 TRACE("Exiting process_metadata_block()");
242}
243
253{
254 TRACE("Entering process_geometry_block(%p, %p)", ctx, entry);
255 size_t read_bytes = 0;
256
257 // Check if the context and image stream are valid
258 if(ctx == NULL || ctx->imageStream == NULL)
259 {
260 FATAL("Invalid context or image stream.");
261
262 TRACE("Exiting process_geometry_block()");
263 return;
264 }
265
266 // Seek to block
267 if(aaruf_fseek(ctx->imageStream, (aaru_off_t)entry->offset, SEEK_SET) != 0)
268 {
269 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
270
271 TRACE("Exiting process_geometry_block()");
272 return;
273 }
274
275 TRACE("Reading geometry block header at position %" PRIu64, entry->offset);
276 read_bytes = fread(&ctx->geometry_block, 1, sizeof(GeometryBlockHeader), ctx->imageStream);
277
278 if(read_bytes != sizeof(GeometryBlockHeader))
279 {
280 memset(&ctx->geometry_block, 0, sizeof(GeometryBlockHeader));
281 TRACE("Could not read geometry block header, continuing...");
282 return;
283 }
284
286 {
287 memset(&ctx->geometry_block, 0, sizeof(GeometryBlockHeader));
288 TRACE("Incorrect identifier for geometry block at position %" PRIu64 "", entry->offset);
289 return;
290 }
291
293
294 TRACE("Geometry set to %d cylinders %d heads %d sectors per track", ctx->geometry_block.cylinders,
296
298 ctx->heads = ctx->geometry_block.heads;
300
301 TRACE("Exiting process_geometry_block()");
302}
303
313{
314 TRACE("Entering process_cicm_block(%p, %p)", ctx, entry);
315 int pos = 0;
316 size_t read_bytes = 0;
317
318 // Check if the context and image stream are valid
319 if(ctx == NULL || ctx->imageStream == NULL)
320 {
321 FATAL("Invalid context or image stream.");
322
323 TRACE("Exiting process_cicm_block()");
324 return;
325 }
326
327 // Seek to block
328 TRACE("Seeking to CICM XML metadata block at position %" PRIu64, entry->offset);
329 pos = aaruf_fseek(ctx->imageStream, (aaru_off_t)entry->offset, SEEK_SET);
330 if(pos < 0 || aaruf_ftell(ctx->imageStream) != (aaru_off_t)entry->offset)
331 {
332 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
333
334 TRACE("Exiting process_cicm_block()");
335 return;
336 }
337
338 // Even if those two checks shall have been done before
339 TRACE("Reading CICM XML metadata block header at position %" PRIu64, entry->offset);
340 read_bytes = fread(&ctx->cicm_block_header, 1, sizeof(CicmMetadataBlock), ctx->imageStream);
341
342 if(read_bytes != sizeof(CicmMetadataBlock))
343 {
344 memset(&ctx->cicm_block_header, 0, sizeof(CicmMetadataBlock));
345 TRACE("Could not read CICM XML metadata header, continuing...");
346 return;
347 }
348
350 {
351 memset(&ctx->cicm_block_header, 0, sizeof(CicmMetadataBlock));
352 TRACE("Incorrect identifier for data block at position %" PRIu64 "", entry->offset);
353 }
354
356
357 ctx->cicm_block = (uint8_t *)malloc(ctx->cicm_block_header.length);
358
359 if(ctx->cicm_block == NULL)
360 {
361 memset(&ctx->cicm_block_header, 0, sizeof(CicmMetadataBlock));
362 TRACE("Could not allocate memory for CICM XML metadata block, continuing...");
363
364 TRACE("Exiting process_cicm_block()");
365 return;
366 }
367
368 TRACE("Reading CICM XML metadata block of size %u at position %" PRIu64, ctx->cicm_block_header.length,
369 entry->offset + sizeof(CicmMetadataBlock));
370 read_bytes = fread(ctx->cicm_block, 1, ctx->cicm_block_header.length, ctx->imageStream);
371
372 if(read_bytes != ctx->cicm_block_header.length)
373 {
374 memset(&ctx->cicm_block_header, 0, sizeof(CicmMetadataBlock));
375 free(ctx->cicm_block);
376 TRACE("Could not read CICM XML metadata block, continuing...");
377 }
378
379 TRACE("Found CICM XML metadata block %" PRIu64 ".", entry->offset);
380
381 TRACE("Exiting process_cicm_block()");
382}
383
477{
478 TRACE("Entering process_aaru_metadata_json_block(%p, %p)", ctx, entry);
479 int pos = 0;
480 size_t read_bytes = 0;
481
482 // Check if the context and image stream are valid
483 if(ctx == NULL || ctx->imageStream == NULL)
484 {
485 FATAL("Invalid context or image stream.");
486
487 TRACE("Exiting process_aaru_metadata_json_block()");
488 return;
489 }
490
491 // Seek to block
492 TRACE("Seeking to Aaru metadata JSON block at position %" PRIu64, entry->offset);
493 pos = aaruf_fseek(ctx->imageStream, (aaru_off_t)entry->offset, SEEK_SET);
494 if(pos < 0 || aaruf_ftell(ctx->imageStream) != (aaru_off_t)entry->offset)
495 {
496 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
497
498 TRACE("Exiting process_aaru_metadata_json_block()");
499 return;
500 }
501
502 // Even if those two checks shall have been done before
503 TRACE("Reading Aaru metadata JSON block header at position %" PRIu64, entry->offset);
504 read_bytes = fread(&ctx->json_block_header, 1, sizeof(AaruMetadataJsonBlockHeader), ctx->imageStream);
505
506 if(read_bytes != sizeof(AaruMetadataJsonBlockHeader))
507 {
508 memset(&ctx->json_block_header, 0, sizeof(AaruMetadataJsonBlockHeader));
509 TRACE("Could not read Aaru metadata JSON header, continuing...");
510 return;
511 }
512
514 {
515 memset(&ctx->json_block_header, 0, sizeof(AaruMetadataJsonBlockHeader));
516 TRACE("Incorrect identifier for data block at position %" PRIu64 "", entry->offset);
517 }
518
520
521 ctx->json_block = (uint8_t *)malloc(ctx->json_block_header.length);
522
523 if(ctx->json_block == NULL)
524 {
525 memset(&ctx->json_block_header, 0, sizeof(AaruMetadataJsonBlockHeader));
526 TRACE("Could not allocate memory for Aaru metadata JSON block, continuing...");
527
528 TRACE("Exiting process_aaru_metadata_json_block()");
529 return;
530 }
531
532 TRACE("Reading Aaru metadata JSON block of size %u at position %" PRIu64, ctx->json_block_header.length,
533 entry->offset + sizeof(AaruMetadataJsonBlockHeader));
534 read_bytes = fread(ctx->json_block, 1, ctx->json_block_header.length, ctx->imageStream);
535
536 if(read_bytes != ctx->json_block_header.length)
537 {
538 memset(&ctx->json_block_header, 0, sizeof(AaruMetadataJsonBlockHeader));
539 free(ctx->json_block);
540 TRACE("Could not read Aaru metadata JSON block, continuing...");
541 }
542
543 TRACE("Found Aaru metadata JSON block %" PRIu64 ".", entry->offset);
544
545 TRACE("Exiting process_aaru_metadata_json_block()");
546}
547
624AARU_EXPORT int32_t AARU_CALL aaruf_get_readable_sector_tags(const void *context, uint8_t *buffer, size_t *length)
625{
626 TRACE("Entering aaruf_get_readable_sector_tags(%p, %p, %zu)", context, buffer, (length ? *length : 0));
627
628 // Check context is correct AaruFormat context
629 if(context == NULL)
630 {
631 FATAL("Invalid context");
632
633 TRACE("Exiting aaruf_get_readable_sector_tags() = AARUF_ERROR_NOT_AARUFORMAT");
635 }
636
637 const aaruformat_context *ctx = context;
638
639 // Not a libaaruformat context
640 if(ctx->magic != AARU_MAGIC)
641 {
642 FATAL("Invalid context");
643
644 TRACE("Exiting aaruf_get_readable_sector_tags() = AARUF_ERROR_NOT_AARUFORMAT");
646 }
647
648 if(ctx->readableSectorTags == NULL)
649 {
650 FATAL("Image contains no readable sector tags");
651
652 TRACE("Exiting aaruf_get_readable_sector_tags() = AARUF_ERROR_METADATA_NOT_PRESENT");
654 }
655
656 size_t required_length = sizeof(bool) * (MaxSectorTag + 1);
657
658 if(buffer == NULL || length == NULL || *length < required_length)
659 {
660 if(length) *length = required_length;
661 TRACE("Buffer too small for readable sector tags, required %zu bytes", required_length);
662
663 TRACE("Exiting aaruf_get_readable_sector_tags() = AARUF_ERROR_BUFFER_TOO_SMALL");
665 }
666
667 memcpy(buffer, ctx->readableSectorTags, required_length);
668 *length = required_length;
669
670 TRACE("Exiting aaruf_get_readable_sector_tags(%p, %p, %zu) = AARUF_STATUS_OK", context, buffer, *length);
671 return AARUF_STATUS_OK;
672}
673
712AARU_EXPORT int32_t AARU_CALL aaruf_get_readable_media_tags(const void *context, uint8_t *buffer, size_t *length)
713{
714 TRACE("Entering aaruf_get_readable_media_tags(%p, %p, %zu)", context, buffer, (length ? *length : 0));
715
716 // Check context is correct AaruFormat context
717 if(context == NULL)
718 {
719 FATAL("Invalid context");
720
721 TRACE("Exiting aaruf_get_readable_media_tags() = AARUF_ERROR_NOT_AARUFORMAT");
723 }
724
725 const aaruformat_context *ctx = context;
726
727 // Not a libaaruformat context
728 if(ctx->magic != AARU_MAGIC)
729 {
730 FATAL("Invalid context");
731
732 TRACE("Exiting aaruf_get_readable_media_tags() = AARUF_ERROR_NOT_AARUFORMAT");
734 }
735
736 // Required size: one byte for each MediaTagType (0 to MaxMediaTag)
737 size_t required_length = MaxMediaTag + 1;
738
739 if(buffer == NULL || length == NULL || *length < required_length)
740 {
741 if(length) *length = required_length;
742 TRACE("Buffer too small for readable media tags, required %zu bytes", required_length);
743
744 TRACE("Exiting aaruf_get_readable_media_tags() = AARUF_ERROR_BUFFER_TOO_SMALL");
746 }
747
748 // Initialize all bytes to false (0)
749 memset(buffer, 0, required_length);
750
751 // Iterate through all media tag types and mark present ones as true
752 for(int32_t tag_type = 0; tag_type <= MaxMediaTag; tag_type++)
753 {
754 mediaTagEntry *item = NULL;
755 HASH_FIND_INT(ctx->mediaTags, &tag_type, item);
756
757 if(item != NULL)
758 {
759 buffer[tag_type] = 1;
760 TRACE("Media tag type %d is present", tag_type);
761 }
762 }
763
764 *length = required_length;
765
766 TRACE("Exiting aaruf_get_readable_media_tags(%p, %p, %zu) = AARUF_STATUS_OK", context, buffer, *length);
767 return AARUF_STATUS_OK;
768}
void process_metadata_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a metadata block from the image stream.
Definition metadata.c:36
void process_cicm_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a CICM XML metadata block from the image stream.
Definition metadata.c:312
void process_geometry_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a logical geometry block from the image stream.
Definition metadata.c:252
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:476
int32_t aaruf_get_readable_media_tags(const void *context, uint8_t *buffer, size_t *length)
Retrieves which media tags are present in the AaruFormat image.
Definition metadata.c:712
int32_t aaruf_get_readable_sector_tags(const void *context, uint8_t *buffer, size_t *length)
Retrieves which sector tags are readable in the AaruFormat image.
Definition metadata.c:624
#define AARU_MAGIC
Magic identifier for AaruFormat container (ASCII "AARUFRMT").
Definition consts.h:64
#define AARU_CALL
Definition decls.h:46
#define AARU_EXPORT
Definition decls.h:55
@ GeometryBlock
Block containing logical geometry.
Definition enums.h:172
@ AaruMetadataJsonBlock
Block containing JSON version of Aaru Metadata.
Definition enums.h:183
@ CicmBlock
Block containing CICM XML metadata.
Definition enums.h:175
#define AARUF_STATUS_OK
Sector present and read without uncorrectable errors.
Definition errors.h:81
#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
@ MaxMediaTag
Definition aaru.h:1090
@ MaxSectorTag
Definition aaru.h:983
static int aaruf_fseek(FILE *stream, aaru_off_t offset, int origin)
Definition internal.h:46
static aaru_off_t aaruf_ftell(FILE *stream)
Definition internal.h:52
int64_t aaru_off_t
Definition internal.h:42
#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:937
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:175
uint8_t * media_barcode
Barcode of the media represented by the image.
Definition context.h:225
uint8_t * creator
Who (person) created the image?
Definition context.h:219
uint8_t * cicm_block
CICM XML payload.
Definition context.h:217
uint32_t cylinders
Cylinders of the media represented by the image.
Definition context.h:237
uint8_t * drive_firmware_revision
Firmware revision of the drive used to read the media represented by the image.
Definition context.h:231
uint8_t * media_serial_number
Serial number of the media represented by the image.
Definition context.h:224
MetadataBlockHeader metadata_block_header
Metadata block header.
Definition context.h:233
int32_t media_sequence
Number in sequence for the media represented by the image.
Definition context.h:241
uint8_t * media_model
Model of the media represented by the image.
Definition context.h:223
uint8_t * drive_serial_number
Serial number of the drive used to read the media represented by the image.
Definition context.h:229
uint8_t * drive_manufacturer
Manufacturer of the drive used to read the media represented by the image.
Definition context.h:227
CicmMetadataBlock cicm_block_header
CICM metadata header (if present).
Definition context.h:234
uint8_t * drive_model
Model of the drive used to read the media represented by the image.
Definition context.h:228
uint64_t magic
File magic (AARU_MAGIC) post-open.
Definition context.h:177
mediaTagEntry * mediaTags
Hash table of extra media tags (uthash root).
Definition context.h:267
GeometryBlockHeader geometry_block
Logical geometry block (if present).
Definition context.h:232
uint8_t * json_block
JSON metadata block payload (UTF-8).
Definition context.h:218
uint8_t * media_part_number
Part number of the media represented by the image.
Definition context.h:226
AaruMetadataJsonBlockHeader json_block_header
JSON metadata block header (if present).
Definition context.h:236
uint32_t sectors_per_track
Sectors per track of the media represented by the image (for variable image, the smallest).
Definition context.h:239
uint8_t * comments
Image comments.
Definition context.h:221
uint32_t heads
Heads of the media represented by the image.
Definition context.h:238
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:179
ImageInfo image_info
Exposed high-level image info summary.
Definition context.h:263
bool * readableSectorTags
Per-sector boolean array (optical tags read successfully?).
Definition context.h:266
uint8_t * metadata_block
Raw metadata UTF-16LE concatenated strings.
Definition context.h:216
uint8_t * media_title
Title of the media represented by the image.
Definition context.h:220
int32_t last_media_sequence
Last media of the sequence the media represented by the image corresponds to.
Definition context.h:242
uint8_t * media_manufacturer
Manufacturer of the media represented by the image.
Definition context.h:222
Hash table entry for an arbitrary media tag (e.g., proprietary drive/medium descriptor).
Definition context.h:122