|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
#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_v1 (aaruformat_context *ctx) |
| Processes an index block (version 1) from the image stream. | |
| int32_t | verify_index_v1 (aaruformat_context *ctx) |
| Verifies the integrity of an index block (version 1) in the image stream. | |
| UT_array * process_index_v1 | ( | aaruformat_context * | ctx | ) |
Processes an index block (version 1) from the image stream.
Reads and parses an index block (version 1) from the image, returning an array of index entries. This function handles the legacy index format used in early AaruFormat versions, providing compatibility with older image files. It reads the IndexHeader 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 79 of file index_v1.c.
References IndexHeader::entries, FATAL, aaruformat_context::header, IndexHeader::identifier, aaruformat_context::imageStream, IndexBlock, AaruHeaderV2::indexOffset, and TRACE.
Referenced by aaruf_open(), and aaruf_verify_image().
| int32_t verify_index_v1 | ( | aaruformat_context * | ctx | ) |
Verifies the integrity of an index block (version 1) in the image stream.
Checks the CRC64 of the index block without decompressing it. This function performs comprehensive validation of the 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 225 of file index_v1.c.
References aaruf_crc64_data(), 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, IndexHeader::crc64, IndexHeader::entries, FATAL, aaruformat_context::header, IndexHeader::identifier, AaruHeaderV2::imageMajorVersion, aaruformat_context::imageStream, IndexBlock, AaruHeaderV2::indexOffset, and TRACE.
Referenced by aaruf_verify_image().