|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
#include <limits.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include "aaruformat.h"#include "log.h"#include "utarray.h"Go to the source code of this file.
Functions | |
| UT_array * | process_index_v2 (aaruformat_context *ctx) |
| Processes an index block (version 2) from the image stream. | |
| int32_t | verify_index_v2 (aaruformat_context *ctx) |
| Verifies the integrity of an index block (version 2) in the image stream. | |
| UT_array * process_index_v2 | ( | aaruformat_context * | ctx | ) |
Processes an index block (version 2) from the image stream.
Reads and parses an index block (version 2) from the image, returning an array of index entries. This function handles the intermediate index format used in mid-generation AaruFormat versions, providing compatibility with version 2 image files. It reads the IndexHeader2 structure followed by a sequential list of IndexEntry structures, validating the index identifier for format correctness.
| ctx | Pointer to the aaruformat context containing the image stream and header information. |
| UT_array* | Successfully processed the index block. This is returned when:
|
| NULL | Index processing failed. This occurs when:
|
Definition at line 81 of file index_v2.c.
References IndexHeader2::entries, FATAL, aaruformat_context::header, IndexHeader2::identifier, aaruformat_context::imageStream, IndexBlock2, AaruHeaderV2::indexOffset, and TRACE.
Referenced by aaruf_open(), and aaruf_verify_image().
| int32_t verify_index_v2 | ( | aaruformat_context * | ctx | ) |
Verifies the integrity of an index block (version 2) in the image stream.
Checks the CRC64 of the index block without decompressing it. This function performs comprehensive validation of the version 2 index structure including header validation, data integrity verification, and version-specific CRC calculation. It ensures the index block is valid and uncorrupted before the image can be safely used for data access.
| ctx | Pointer to the aaruformat context containing image stream and header information. |
| AARUF_STATUS_OK | (0) Successfully verified index integrity. This is returned when:
|
| AARUF_ERROR_NOT_AARUFORMAT | (-1) Invalid context or stream. This occurs when:
|
| AARUF_ERROR_CANNOT_READ_HEADER | (-6) Index header reading failed. This occurs when:
|
| AARUF_ERROR_CANNOT_READ_INDEX | (-19) Index format or data access errors. This occurs when:
|
| AARUF_ERROR_NOT_ENOUGH_MEMORY | (-9) Memory allocation failed. This occurs when:
|
| AARUF_ERROR_INVALID_BLOCK_CRC | (-18) CRC64 validation failed. This occurs when:
|
Definition at line 227 of file index_v2.c.
References aaruf_crc64_final(), aaruf_crc64_free(), aaruf_crc64_init(), aaruf_crc64_update(), AARUF_ERROR_CANNOT_READ_HEADER, AARUF_ERROR_CANNOT_READ_INDEX, AARUF_ERROR_INVALID_BLOCK_CRC, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, AARUF_STATUS_OK, AARUF_VERSION_V1, bswap_64, IndexHeader2::crc64, IndexHeader2::entries, FATAL, aaruformat_context::header, IndexHeader2::identifier, AaruHeaderV2::imageMajorVersion, aaruformat_context::imageStream, IndexBlock2, AaruHeaderV2::indexOffset, and TRACE.
Referenced by aaruf_verify_image().