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 ctx->metadata_block = NULL;
108 FATAL("Could not read metadata block, continuing...");
109
110 return;
111 }
112
114 {
117 TRACE("Setting media sequence as %d of %d", ctx->media_sequence, ctx->last_media_sequence);
118 }
119
123 {
124 ctx->creator = (uint8_t *)malloc(ctx->metadata_block_header.creatorLength);
125 if(ctx->creator != NULL)
128 }
129
133 {
134 ctx->comments = (uint8_t *)malloc(ctx->metadata_block_header.commentsLength);
135 if(ctx->comments != NULL)
138 }
139
143 {
144 ctx->media_title = (uint8_t *)malloc(ctx->metadata_block_header.mediaTitleLength);
145 if(ctx->media_title != NULL)
148 }
149
153 {
155 if(ctx->media_manufacturer != NULL)
158 }
159
163 {
164 ctx->media_model = (uint8_t *)malloc(ctx->metadata_block_header.mediaModelLength);
165 if(ctx->media_model != NULL)
168 }
169
173 {
175 if(ctx->media_serial_number != NULL)
178 }
179
183 {
184 ctx->media_barcode = (uint8_t *)malloc(ctx->metadata_block_header.mediaBarcodeLength);
185 if(ctx->media_barcode != NULL)
188 }
189
193 {
195 if(ctx->media_part_number != NULL)
198 }
199
203 {
205 if(ctx->drive_manufacturer != NULL)
208 }
209
213 {
214 ctx->drive_model = (uint8_t *)malloc(ctx->metadata_block_header.driveModelLength);
215 if(ctx->drive_model != NULL)
218 }
219
223 {
225 if(ctx->drive_serial_number != NULL)
228 }
229
234 {
236 if(ctx->drive_firmware_revision != NULL)
237 memcpy(ctx->drive_firmware_revision,
240 }
241
242 TRACE("Exiting process_metadata_block()");
243}
244
254{
255 TRACE("Entering process_geometry_block(%p, %p)", ctx, entry);
256 size_t read_bytes = 0;
257
258 // Check if the context and image stream are valid
259 if(ctx == NULL || ctx->imageStream == NULL)
260 {
261 FATAL("Invalid context or image stream.");
262
263 TRACE("Exiting process_geometry_block()");
264 return;
265 }
266
267 // Seek to block
268 if(aaruf_fseek(ctx->imageStream, (aaru_off_t)entry->offset, SEEK_SET) != 0)
269 {
270 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
271
272 TRACE("Exiting process_geometry_block()");
273 return;
274 }
275
276 TRACE("Reading geometry block header at position %" PRIu64, entry->offset);
277 read_bytes = fread(&ctx->geometry_block, 1, sizeof(GeometryBlockHeader), ctx->imageStream);
278
279 if(read_bytes != sizeof(GeometryBlockHeader))
280 {
281 memset(&ctx->geometry_block, 0, sizeof(GeometryBlockHeader));
282 TRACE("Could not read geometry block header, continuing...");
283 return;
284 }
285
287 {
288 memset(&ctx->geometry_block, 0, sizeof(GeometryBlockHeader));
289 TRACE("Incorrect identifier for geometry block at position %" PRIu64 "", entry->offset);
290 return;
291 }
292
294
295 TRACE("Geometry set to %d cylinders %d heads %d sectors per track", ctx->geometry_block.cylinders,
297
299 ctx->heads = ctx->geometry_block.heads;
301
302 TRACE("Exiting process_geometry_block()");
303}
304
314{
315 TRACE("Entering process_cicm_block(%p, %p)", ctx, entry);
316 int pos = 0;
317 size_t read_bytes = 0;
318
319 // Check if the context and image stream are valid
320 if(ctx == NULL || ctx->imageStream == NULL)
321 {
322 FATAL("Invalid context or image stream.");
323
324 TRACE("Exiting process_cicm_block()");
325 return;
326 }
327
328 // Seek to block
329 TRACE("Seeking to CICM XML metadata block at position %" PRIu64, entry->offset);
330 pos = aaruf_fseek(ctx->imageStream, (aaru_off_t)entry->offset, SEEK_SET);
331 if(pos < 0 || aaruf_ftell(ctx->imageStream) != (aaru_off_t)entry->offset)
332 {
333 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
334
335 TRACE("Exiting process_cicm_block()");
336 return;
337 }
338
339 // Even if those two checks shall have been done before
340 TRACE("Reading CICM XML metadata block header at position %" PRIu64, entry->offset);
341 read_bytes = fread(&ctx->cicm_block_header, 1, sizeof(CicmMetadataBlock), ctx->imageStream);
342
343 if(read_bytes != sizeof(CicmMetadataBlock))
344 {
345 memset(&ctx->cicm_block_header, 0, sizeof(CicmMetadataBlock));
346 TRACE("Could not read CICM XML metadata header, continuing...");
347 return;
348 }
349
351 {
352 memset(&ctx->cicm_block_header, 0, sizeof(CicmMetadataBlock));
353 TRACE("Incorrect identifier for data block at position %" PRIu64 "", entry->offset);
354 }
355
357
358 ctx->cicm_block = (uint8_t *)malloc(ctx->cicm_block_header.length);
359
360 if(ctx->cicm_block == NULL)
361 {
362 memset(&ctx->cicm_block_header, 0, sizeof(CicmMetadataBlock));
363 TRACE("Could not allocate memory for CICM XML metadata block, continuing...");
364
365 TRACE("Exiting process_cicm_block()");
366 return;
367 }
368
369 TRACE("Reading CICM XML metadata block of size %u at position %" PRIu64, ctx->cicm_block_header.length,
370 entry->offset + sizeof(CicmMetadataBlock));
371 read_bytes = fread(ctx->cicm_block, 1, ctx->cicm_block_header.length, ctx->imageStream);
372
373 if(read_bytes != ctx->cicm_block_header.length)
374 {
375 memset(&ctx->cicm_block_header, 0, sizeof(CicmMetadataBlock));
376 free(ctx->cicm_block);
377 ctx->cicm_block = NULL;
378 TRACE("Could not read CICM XML metadata block, continuing...");
379 }
380
381 TRACE("Found CICM XML metadata block %" PRIu64 ".", entry->offset);
382
383 TRACE("Exiting process_cicm_block()");
384}
385
479{
480 TRACE("Entering process_aaru_metadata_json_block(%p, %p)", ctx, entry);
481 int pos = 0;
482 size_t read_bytes = 0;
483
484 // Check if the context and image stream are valid
485 if(ctx == NULL || ctx->imageStream == NULL)
486 {
487 FATAL("Invalid context or image stream.");
488
489 TRACE("Exiting process_aaru_metadata_json_block()");
490 return;
491 }
492
493 // Seek to block
494 TRACE("Seeking to Aaru metadata JSON block at position %" PRIu64, entry->offset);
495 pos = aaruf_fseek(ctx->imageStream, (aaru_off_t)entry->offset, SEEK_SET);
496 if(pos < 0 || aaruf_ftell(ctx->imageStream) != (aaru_off_t)entry->offset)
497 {
498 FATAL("Could not seek to %" PRIu64 " as indicated by index entry...", entry->offset);
499
500 TRACE("Exiting process_aaru_metadata_json_block()");
501 return;
502 }
503
504 // Even if those two checks shall have been done before
505 TRACE("Reading Aaru metadata JSON block header at position %" PRIu64, entry->offset);
506 read_bytes = fread(&ctx->json_block_header, 1, sizeof(AaruMetadataJsonBlockHeader), ctx->imageStream);
507
508 if(read_bytes != sizeof(AaruMetadataJsonBlockHeader))
509 {
510 memset(&ctx->json_block_header, 0, sizeof(AaruMetadataJsonBlockHeader));
511 TRACE("Could not read Aaru metadata JSON header, continuing...");
512 return;
513 }
514
516 {
517 memset(&ctx->json_block_header, 0, sizeof(AaruMetadataJsonBlockHeader));
518 TRACE("Incorrect identifier for data block at position %" PRIu64 "", entry->offset);
519 }
520
522
523 ctx->json_block = (uint8_t *)malloc(ctx->json_block_header.length);
524
525 if(ctx->json_block == NULL)
526 {
527 memset(&ctx->json_block_header, 0, sizeof(AaruMetadataJsonBlockHeader));
528 TRACE("Could not allocate memory for Aaru metadata JSON block, continuing...");
529
530 TRACE("Exiting process_aaru_metadata_json_block()");
531 return;
532 }
533
534 TRACE("Reading Aaru metadata JSON block of size %u at position %" PRIu64, ctx->json_block_header.length,
535 entry->offset + sizeof(AaruMetadataJsonBlockHeader));
536 read_bytes = fread(ctx->json_block, 1, ctx->json_block_header.length, ctx->imageStream);
537
538 if(read_bytes != ctx->json_block_header.length)
539 {
540 memset(&ctx->json_block_header, 0, sizeof(AaruMetadataJsonBlockHeader));
541 free(ctx->json_block);
542 ctx->json_block = NULL;
543 TRACE("Could not read Aaru metadata JSON block, continuing...");
544 }
545
546 TRACE("Found Aaru metadata JSON block %" PRIu64 ".", entry->offset);
547
548 TRACE("Exiting process_aaru_metadata_json_block()");
549}
550
627AARU_EXPORT int32_t AARU_CALL aaruf_get_readable_sector_tags(const void *context, uint8_t *buffer, size_t *length)
628{
629 TRACE("Entering aaruf_get_readable_sector_tags(%p, %p, %zu)", context, buffer, (length ? *length : 0));
630
631 // Check context is correct AaruFormat context
632 if(context == NULL)
633 {
634 FATAL("Invalid context");
635
636 TRACE("Exiting aaruf_get_readable_sector_tags() = AARUF_ERROR_NOT_AARUFORMAT");
638 }
639
640 const aaruformat_context *ctx = context;
641
642 // Not a libaaruformat context
643 if(ctx->magic != AARU_MAGIC)
644 {
645 FATAL("Invalid context");
646
647 TRACE("Exiting aaruf_get_readable_sector_tags() = AARUF_ERROR_NOT_AARUFORMAT");
649 }
650
651 if(ctx->readableSectorTags == NULL)
652 {
653 FATAL("Image contains no readable sector tags");
654
655 TRACE("Exiting aaruf_get_readable_sector_tags() = AARUF_ERROR_METADATA_NOT_PRESENT");
657 }
658
659 size_t required_length = sizeof(bool) * (MaxSectorTag + 1);
660
661 if(buffer == NULL || length == NULL || *length < required_length)
662 {
663 if(length) *length = required_length;
664 TRACE("Buffer too small for readable sector tags, required %zu bytes", required_length);
665
666 TRACE("Exiting aaruf_get_readable_sector_tags() = AARUF_ERROR_BUFFER_TOO_SMALL");
668 }
669
670 memcpy(buffer, ctx->readableSectorTags, required_length);
671 *length = required_length;
672
673 TRACE("Exiting aaruf_get_readable_sector_tags(%p, %p, %zu) = AARUF_STATUS_OK", context, buffer, *length);
674 return AARUF_STATUS_OK;
675}
676
715AARU_EXPORT int32_t AARU_CALL aaruf_get_readable_media_tags(const void *context, uint8_t *buffer, size_t *length)
716{
717 TRACE("Entering aaruf_get_readable_media_tags(%p, %p, %zu)", context, buffer, (length ? *length : 0));
718
719 // Check context is correct AaruFormat context
720 if(context == NULL)
721 {
722 FATAL("Invalid context");
723
724 TRACE("Exiting aaruf_get_readable_media_tags() = AARUF_ERROR_NOT_AARUFORMAT");
726 }
727
728 const aaruformat_context *ctx = context;
729
730 // Not a libaaruformat context
731 if(ctx->magic != AARU_MAGIC)
732 {
733 FATAL("Invalid context");
734
735 TRACE("Exiting aaruf_get_readable_media_tags() = AARUF_ERROR_NOT_AARUFORMAT");
737 }
738
739 // Required size: one byte for each MediaTagType (0 to MaxMediaTag)
740 size_t required_length = MaxMediaTag + 1;
741
742 if(buffer == NULL || length == NULL || *length < required_length)
743 {
744 if(length) *length = required_length;
745 TRACE("Buffer too small for readable media tags, required %zu bytes", required_length);
746
747 TRACE("Exiting aaruf_get_readable_media_tags() = AARUF_ERROR_BUFFER_TOO_SMALL");
749 }
750
751 // Initialize all bytes to false (0)
752 memset(buffer, 0, required_length);
753
754 // Iterate through all media tag types and mark present ones as true
755 for(int32_t tag_type = 0; tag_type <= MaxMediaTag; tag_type++)
756 {
757 mediaTagEntry *item = NULL;
758 HASH_FIND_INT(ctx->mediaTags, &tag_type, item);
759
760 if(item != NULL)
761 {
762 buffer[tag_type] = 1;
763 TRACE("Media tag type %d is present", tag_type);
764 }
765 }
766
767 *length = required_length;
768
769 TRACE("Exiting aaruf_get_readable_media_tags(%p, %p, %zu) = AARUF_STATUS_OK", context, buffer, *length);
770 return AARUF_STATUS_OK;
771}
#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
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:715
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:627
@ 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:82
#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
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:313
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
void process_geometry_block(aaruformat_context *ctx, const IndexEntry *entry)
Processes a logical geometry block from the image stream.
Definition metadata.c:253
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:478
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:178
uint8_t * media_barcode
Barcode of the media represented by the image.
Definition context.h:232
uint8_t * creator
Who (person) created the image?
Definition context.h:226
uint8_t * cicm_block
CICM XML payload.
Definition context.h:221
uint32_t cylinders
Cylinders of the media represented by the image.
Definition context.h:244
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
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 * media_model
Model of the media represented by the image.
Definition context.h:230
uint8_t * drive_serial_number
Serial number of the drive used to read the media represented by the image.
Definition context.h:236
uint8_t * drive_manufacturer
Manufacturer of the drive used to read the media represented by the image.
Definition context.h:234
CicmMetadataBlock cicm_block_header
CICM metadata header (if present).
Definition context.h:241
uint8_t * drive_model
Model of the drive used to read the media represented by the image.
Definition context.h:235
uint64_t magic
File magic (AARU_MAGIC) post-open.
Definition context.h:180
mediaTagEntry * mediaTags
Hash table of extra media tags (uthash root).
Definition context.h:274
GeometryBlockHeader geometry_block
Logical geometry block (if present).
Definition context.h:239
uint8_t * json_block
JSON metadata block payload (UTF-8).
Definition context.h:222
uint8_t * media_part_number
Part number of the media represented by the image.
Definition context.h:233
AaruMetadataJsonBlockHeader json_block_header
JSON metadata block header (if present).
Definition context.h:243
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 * comments
Image comments.
Definition context.h:228
uint32_t heads
Heads of the media represented by the image.
Definition context.h:245
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:182
ImageInfo image_info
Exposed high-level image info summary.
Definition context.h:270
bool * readableSectorTags
Per-sector boolean array (optical tags read successfully?).
Definition context.h:273
uint8_t * metadata_block
Raw metadata UTF-16LE concatenated strings.
Definition context.h:220
uint8_t * media_title
Title of the media represented by the image.
Definition context.h:227
int32_t last_media_sequence
Last media of the sequence the media represented by the image corresponds to.
Definition context.h:249
uint8_t * media_manufacturer
Manufacturer of the media represented by the image.
Definition context.h:229
Hash table entry for an arbitrary media tag (e.g., proprietary drive/medium descriptor).
Definition context.h:125