libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
Loading...
Searching...
No Matches
errors.h File Reference

Public error and status code definitions for libaaruformat. More...

Go to the source code of this file.

Macros

Fatal / library-level error codes (negative)
#define AARUF_ERROR_NOT_AARUFORMAT   (-1)
 Input file/stream failed magic or structural validation.
#define AARUF_ERROR_FILE_TOO_SMALL   (-2)
 File size insufficient for mandatory header / structures.
#define AARUF_ERROR_INCOMPATIBLE_VERSION   (-3)
 Image uses a newer incompatible on-disk version.
#define AARUF_ERROR_CANNOT_READ_INDEX   (-4)
 Index block unreadable / truncated / bad identifier.
#define AARUF_ERROR_SECTOR_OUT_OF_BOUNDS   (-5)
 Requested logical sector outside media bounds.
#define AARUF_ERROR_CANNOT_READ_HEADER   (-6)
 Failed to read container header.
#define AARUF_ERROR_CANNOT_READ_BLOCK   (-7)
 Generic block read failure (seek/read error).
#define AARUF_ERROR_UNSUPPORTED_COMPRESSION   (-8)
 Block marked with unsupported compression algorithm.
#define AARUF_ERROR_NOT_ENOUGH_MEMORY   (-9)
 Memory allocation failure (critical).
#define AARUF_ERROR_BUFFER_TOO_SMALL   (-10)
 Caller-supplied buffer insufficient for data.
#define AARUF_ERROR_MEDIA_TAG_NOT_PRESENT   (-11)
 Requested media tag absent.
#define AARUF_ERROR_INCORRECT_MEDIA_TYPE   (-12)
 Operation incompatible with image media type.
#define AARUF_ERROR_TRACK_NOT_FOUND   (-13)
 Referenced track number not present.
#define AARUF_ERROR_REACHED_UNREACHABLE_CODE   (-14)
 Internal logic assertion hit unexpected path.
#define AARUF_ERROR_INVALID_TRACK_FORMAT   (-15)
 Track metadata internally inconsistent or malformed.
#define AARUF_ERROR_SECTOR_TAG_NOT_PRESENT   (-16)
 Requested sector tag (e.g. subchannel/prefix) not stored.
#define AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK   (-17)
 Decompression routine failed or size mismatch.
#define AARUF_ERROR_INVALID_BLOCK_CRC   (-18)
 CRC64 mismatch indicating corruption.
#define AARUF_ERROR_CANNOT_CREATE_FILE   (-19)
 Output file could not be created / opened for write.
#define AARUF_ERROR_INVALID_APP_NAME_LENGTH   (-20)
 Application name field length invalid (sanity limit).
#define AARUF_ERROR_CANNOT_WRITE_HEADER   (-21)
 Failure writing container header.
#define AARUF_READ_ONLY   (-22)
 Operation requires write mode but context is read-only.
#define AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER   (-23)
 Failure writing block header.
#define AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA   (-24)
 Failure writing block payload.
#define AARUF_ERROR_CANNOT_SET_DDT_ENTRY   (-25)
 Failed to encode/store a DDT entry (overflow or IO).
#define AARUF_ERROR_INCORRECT_DATA_SIZE   (-26)
 Data size does not match expected size.
#define AARUF_ERROR_INVALID_TAG   (-27)
 Invalid or unsupported media or sector tag format.
#define AARUF_ERROR_TAPE_FILE_NOT_FOUND   (-28)
 Requested tape file number not present in image.
#define AARUF_ERROR_TAPE_PARTITION_NOT_FOUND   (-29)
 Requested tape partition not present in image.
#define AARUF_ERROR_METADATA_NOT_PRESENT   (-30)
 Requested metadata not present in image.
Non-fatal sector status codes (non-negative)

Returned through output parameters to describe individual sector state.

#define AARUF_STATUS_OK   0
 Sector present and read without uncorrectable errors.
#define AARUF_STATUS_SECTOR_NOT_DUMPED   1
 Sector not captured (gap / missing / intentionally skipped).
#define AARUF_STATUS_SECTOR_WITH_ERRORS   2
 Sector present but with unrecoverable or flagged errors.
#define AARUF_STATUS_SECTOR_DELETED   3
 Sector logically marked deleted (e.g. filesystem deleted area).

Functions

static const char * aaruformat_error_string (int code)
 Convert an AaruFormat error or status code to a static human-readable string.

Detailed Description

Public error and status code definitions for libaaruformat.

Negative values represent fatal / non-recoverable error conditions returned by library functions. Non-negative values (>=0) are either success (0) or sector-level status annotations used when decoding per-sector metadata (e.g. a sector not dumped or with corrected/unrecoverable errors).

Usage guidelines:

  • Always test for < 0 to check generic failure without enumerating all codes.
  • Use exact comparisons for caller-specific handling (e.g. retry on AARUF_ERROR_CANNOT_READ_BLOCK).
  • Sector status codes are never returned as fatal function results; they appear in output parameters populated by read/identify routines.

Helper: see aaruformat_error_string() for a human-readable textual description suitable for logs.

Definition in file errors.h.

Macro Definition Documentation

◆ AARUF_ERROR_BUFFER_TOO_SMALL

◆ AARUF_ERROR_CANNOT_CREATE_FILE

#define AARUF_ERROR_CANNOT_CREATE_FILE   (-19)

Output file could not be created / opened for write.

Definition at line 58 of file errors.h.

Referenced by aaruf_create(), and aaruformat_error_string().

◆ AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK

#define AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK   (-17)

Decompression routine failed or size mismatch.

Definition at line 56 of file errors.h.

Referenced by aaruf_read_sector(), aaruformat_error_string(), decode_ddt_multi_level_v2(), process_data_block(), process_ddt_v1(), and process_ddt_v2().

◆ AARUF_ERROR_CANNOT_READ_BLOCK

◆ AARUF_ERROR_CANNOT_READ_HEADER

#define AARUF_ERROR_CANNOT_READ_HEADER   (-6)

Failed to read container header.

Definition at line 45 of file errors.h.

Referenced by aaruf_read_sector(), aaruf_verify_image(), aaruformat_error_string(), verify_index_v1(), verify_index_v2(), and verify_index_v3().

◆ AARUF_ERROR_CANNOT_READ_INDEX

#define AARUF_ERROR_CANNOT_READ_INDEX   (-4)

Index block unreadable / truncated / bad identifier.

Definition at line 43 of file errors.h.

Referenced by aaruf_open(), aaruf_verify_image(), aaruformat_error_string(), verify_index_v1(), verify_index_v2(), and verify_index_v3().

◆ AARUF_ERROR_CANNOT_SET_DDT_ENTRY

#define AARUF_ERROR_CANNOT_SET_DDT_ENTRY   (-25)

Failed to encode/store a DDT entry (overflow or IO).

Definition at line 64 of file errors.h.

Referenced by aaruf_write_sector(), and aaruformat_error_string().

◆ AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA

#define AARUF_ERROR_CANNOT_WRITE_BLOCK_DATA   (-24)

Failure writing block payload.

Definition at line 63 of file errors.h.

Referenced by aaruf_close_current_block(), and aaruformat_error_string().

◆ AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER

#define AARUF_ERROR_CANNOT_WRITE_BLOCK_HEADER   (-23)

Failure writing block header.

Definition at line 62 of file errors.h.

Referenced by aaruf_close_current_block(), and aaruformat_error_string().

◆ AARUF_ERROR_CANNOT_WRITE_HEADER

#define AARUF_ERROR_CANNOT_WRITE_HEADER   (-21)

Failure writing container header.

Definition at line 60 of file errors.h.

Referenced by aaruf_close(), aaruformat_error_string(), write_cached_secondary_ddt(), write_index_block(), write_primary_ddt(), and write_single_level_ddt().

◆ AARUF_ERROR_FILE_TOO_SMALL

#define AARUF_ERROR_FILE_TOO_SMALL   (-2)

File size insufficient for mandatory header / structures.

Definition at line 41 of file errors.h.

Referenced by aaruf_open(), and aaruformat_error_string().

◆ AARUF_ERROR_INCOMPATIBLE_VERSION

#define AARUF_ERROR_INCOMPATIBLE_VERSION   (-3)

Image uses a newer incompatible on-disk version.

Definition at line 42 of file errors.h.

Referenced by aaruf_open(), and aaruformat_error_string().

◆ AARUF_ERROR_INCORRECT_DATA_SIZE

◆ AARUF_ERROR_INCORRECT_MEDIA_TYPE

#define AARUF_ERROR_INCORRECT_MEDIA_TYPE   (-12)

Operation incompatible with image media type.

Definition at line 51 of file errors.h.

Referenced by aaruf_read_sector_long(), aaruf_read_sector_tag(), aaruf_read_track_sector(), aaruf_write_sector_long(), aaruf_write_sector_tag(), and aaruformat_error_string().

◆ AARUF_ERROR_INVALID_APP_NAME_LENGTH

#define AARUF_ERROR_INVALID_APP_NAME_LENGTH   (-20)

Application name field length invalid (sanity limit).

Definition at line 59 of file errors.h.

Referenced by aaruf_create(), and aaruformat_error_string().

◆ AARUF_ERROR_INVALID_BLOCK_CRC

#define AARUF_ERROR_INVALID_BLOCK_CRC   (-18)

◆ AARUF_ERROR_INVALID_TAG

#define AARUF_ERROR_INVALID_TAG   (-27)

Invalid or unsupported media or sector tag format.

Definition at line 66 of file errors.h.

Referenced by aaruf_read_sector_tag(), and aaruf_write_sector_tag().

◆ AARUF_ERROR_INVALID_TRACK_FORMAT

#define AARUF_ERROR_INVALID_TRACK_FORMAT   (-15)

Track metadata internally inconsistent or malformed.

Definition at line 54 of file errors.h.

Referenced by aaruf_read_sector_long(), aaruf_set_tracks(), and aaruformat_error_string().

◆ AARUF_ERROR_MEDIA_TAG_NOT_PRESENT

#define AARUF_ERROR_MEDIA_TAG_NOT_PRESENT   (-11)

Requested media tag absent.

Definition at line 50 of file errors.h.

Referenced by aaruf_read_media_tag(), and aaruformat_error_string().

◆ AARUF_ERROR_METADATA_NOT_PRESENT

◆ AARUF_ERROR_NOT_AARUFORMAT

#define AARUF_ERROR_NOT_AARUFORMAT   (-1)

Input file/stream failed magic or structural validation.

Definition at line 40 of file errors.h.

Referenced by aaruf_clear_comments(), aaruf_clear_creator(), aaruf_clear_drive_firmware_revision(), aaruf_clear_drive_manufacturer(), aaruf_clear_drive_model(), aaruf_clear_drive_serial_number(), aaruf_clear_media_barcode(), aaruf_clear_media_manufacturer(), aaruf_clear_media_model(), aaruf_clear_media_part_number(), aaruf_clear_media_sequence(), aaruf_clear_media_serial_number(), aaruf_clear_media_title(), aaruf_close_current_block(), aaruf_get_aaru_json_metadata(), aaruf_get_all_tape_files(), aaruf_get_all_tape_partitions(), aaruf_get_cicm_metadata(), aaruf_get_comments(), aaruf_get_creator(), aaruf_get_drive_firmware_revision(), aaruf_get_drive_manufacturer(), aaruf_get_drive_model(), aaruf_get_drive_serial_number(), aaruf_get_dumphw(), aaruf_get_geometry(), aaruf_get_image_info(), aaruf_get_media_barcode(), aaruf_get_media_manufacturer(), aaruf_get_media_model(), aaruf_get_media_part_number(), aaruf_get_media_sequence(), aaruf_get_media_serial_number(), aaruf_get_media_title(), aaruf_get_negative_sectors(), aaruf_get_overflow_sectors(), aaruf_get_readable_media_tags(), aaruf_get_readable_sector_tags(), aaruf_get_tape_file(), aaruf_get_tape_partition(), aaruf_get_tracks(), aaruf_get_user_sectors(), aaruf_open(), aaruf_read_media_tag(), aaruf_read_sector(), aaruf_read_sector_long(), aaruf_read_sector_tag(), aaruf_read_track_sector(), aaruf_set_aaru_json_metadata(), aaruf_set_comments(), aaruf_set_creator(), aaruf_set_drive_firmware_revision(), aaruf_set_drive_manufacturer(), aaruf_set_drive_model(), aaruf_set_drive_serial_number(), aaruf_set_dumphw(), aaruf_set_geometry(), aaruf_set_media_barcode(), aaruf_set_media_manufacturer(), aaruf_set_media_model(), aaruf_set_media_part_number(), aaruf_set_media_sequence(), aaruf_set_media_serial_number(), aaruf_set_media_title(), aaruf_set_tape_file(), aaruf_set_tape_partition(), aaruf_set_tracks(), aaruf_verify_image(), aaruf_write_media_tag(), aaruf_write_sector(), aaruf_write_sector_long(), aaruf_write_sector_tag(), aaruformat_error_string(), decode_ddt_entry_v1(), decode_ddt_entry_v2(), decode_ddt_multi_level_v2(), decode_ddt_single_level_v2(), process_data_block(), process_ddt_v1(), process_ddt_v2(), verify_index_v1(), verify_index_v2(), and verify_index_v3().

◆ AARUF_ERROR_NOT_ENOUGH_MEMORY

◆ AARUF_ERROR_REACHED_UNREACHABLE_CODE

#define AARUF_ERROR_REACHED_UNREACHABLE_CODE   (-14)

Internal logic assertion hit unexpected path.

Definition at line 53 of file errors.h.

Referenced by aaruf_read_sector_long(), and aaruformat_error_string().

◆ AARUF_ERROR_SECTOR_OUT_OF_BOUNDS

#define AARUF_ERROR_SECTOR_OUT_OF_BOUNDS   (-5)

◆ AARUF_ERROR_SECTOR_TAG_NOT_PRESENT

#define AARUF_ERROR_SECTOR_TAG_NOT_PRESENT   (-16)

Requested sector tag (e.g. subchannel/prefix) not stored.

Definition at line 55 of file errors.h.

Referenced by aaruf_read_sector_tag(), and aaruformat_error_string().

◆ AARUF_ERROR_TAPE_FILE_NOT_FOUND

#define AARUF_ERROR_TAPE_FILE_NOT_FOUND   (-28)

Requested tape file number not present in image.

Definition at line 67 of file errors.h.

Referenced by aaruf_get_all_tape_files(), and aaruf_get_tape_file().

◆ AARUF_ERROR_TAPE_PARTITION_NOT_FOUND

#define AARUF_ERROR_TAPE_PARTITION_NOT_FOUND   (-29)

Requested tape partition not present in image.

Definition at line 68 of file errors.h.

Referenced by aaruf_get_all_tape_partitions(), and aaruf_get_tape_partition().

◆ AARUF_ERROR_TRACK_NOT_FOUND

#define AARUF_ERROR_TRACK_NOT_FOUND   (-13)

◆ AARUF_ERROR_UNSUPPORTED_COMPRESSION

#define AARUF_ERROR_UNSUPPORTED_COMPRESSION   (-8)

Block marked with unsupported compression algorithm.

Definition at line 47 of file errors.h.

Referenced by aaruf_read_sector(), and aaruformat_error_string().

◆ AARUF_READ_ONLY

◆ AARUF_STATUS_OK

#define AARUF_STATUS_OK   0

Sector present and read without uncorrectable errors.

Definition at line 75 of file errors.h.

Referenced by aaruf_clear_comments(), aaruf_clear_creator(), aaruf_clear_drive_firmware_revision(), aaruf_clear_drive_manufacturer(), aaruf_clear_drive_model(), aaruf_clear_drive_serial_number(), aaruf_clear_media_barcode(), aaruf_clear_media_manufacturer(), aaruf_clear_media_model(), aaruf_clear_media_part_number(), aaruf_clear_media_sequence(), aaruf_clear_media_serial_number(), aaruf_clear_media_title(), aaruf_close(), aaruf_close_current_block(), aaruf_cst_transform(), aaruf_cst_untransform(), aaruf_get_aaru_json_metadata(), aaruf_get_all_tape_files(), aaruf_get_all_tape_partitions(), aaruf_get_cicm_metadata(), aaruf_get_comments(), aaruf_get_creator(), aaruf_get_drive_firmware_revision(), aaruf_get_drive_manufacturer(), aaruf_get_drive_model(), aaruf_get_drive_serial_number(), aaruf_get_dumphw(), aaruf_get_geometry(), aaruf_get_image_info(), aaruf_get_media_barcode(), aaruf_get_media_manufacturer(), aaruf_get_media_model(), aaruf_get_media_part_number(), aaruf_get_media_sequence(), aaruf_get_media_serial_number(), aaruf_get_media_title(), aaruf_get_negative_sectors(), aaruf_get_overflow_sectors(), aaruf_get_readable_media_tags(), aaruf_get_readable_sector_tags(), aaruf_get_tape_file(), aaruf_get_tape_partition(), aaruf_get_tracks(), aaruf_get_user_sectors(), aaruf_open(), aaruf_read_media_tag(), aaruf_read_sector(), aaruf_read_sector_long(), aaruf_read_sector_tag(), aaruf_set_aaru_json_metadata(), aaruf_set_comments(), aaruf_set_creator(), aaruf_set_drive_firmware_revision(), aaruf_set_drive_manufacturer(), aaruf_set_drive_model(), aaruf_set_drive_serial_number(), aaruf_set_dumphw(), aaruf_set_geometry(), aaruf_set_media_barcode(), aaruf_set_media_manufacturer(), aaruf_set_media_model(), aaruf_set_media_part_number(), aaruf_set_media_sequence(), aaruf_set_media_serial_number(), aaruf_set_media_title(), aaruf_set_tape_file(), aaruf_set_tape_partition(), aaruf_set_tracks(), aaruf_verify_image(), aaruf_write_media_tag(), aaruf_write_sector(), aaruf_write_sector_tag(), aaruformat_error_string(), decode_ddt_entry_v1(), decode_ddt_multi_level_v2(), decode_ddt_single_level_v2(), process_data_block(), process_ddt_v1(), process_ddt_v2(), update_crc64_from_stream(), verify_index_v1(), verify_index_v2(), verify_index_v3(), write_cached_secondary_ddt(), write_index_block(), write_primary_ddt(), and write_single_level_ddt().

◆ AARUF_STATUS_SECTOR_DELETED

#define AARUF_STATUS_SECTOR_DELETED   3

Sector logically marked deleted (e.g. filesystem deleted area).

Definition at line 78 of file errors.h.

Referenced by aaruformat_error_string().

◆ AARUF_STATUS_SECTOR_NOT_DUMPED

#define AARUF_STATUS_SECTOR_NOT_DUMPED   1

Sector not captured (gap / missing / intentionally skipped).

Definition at line 76 of file errors.h.

Referenced by aaruf_read_sector(), aaruf_read_sector_long(), and aaruformat_error_string().

◆ AARUF_STATUS_SECTOR_WITH_ERRORS

#define AARUF_STATUS_SECTOR_WITH_ERRORS   2

Sector present but with unrecoverable or flagged errors.

Definition at line 77 of file errors.h.

Referenced by aaruformat_error_string().

Function Documentation

◆ aaruformat_error_string()