|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
#include <inttypes.h>#include <stdint.h>#include <stdio.h>#include <stdlib.h>#include "errors.h"#include "aaruformat.h"#include "log.h"Go to the source code of this file.
Functions | |
| int32_t | process_ddt_v1 (aaruformat_context *ctx, IndexEntry *entry, bool *found_user_data_ddt) |
| Processes a DDT v1 block from the image stream. | |
| int32_t | decode_ddt_entry_v1 (aaruformat_context *ctx, const uint64_t sector_address, uint64_t *offset, uint64_t *block_offset, uint8_t *sector_status) |
| Decodes a DDT v1 entry for a given sector address. | |
| int32_t decode_ddt_entry_v1 | ( | aaruformat_context * | ctx, |
| const uint64_t | sector_address, | ||
| uint64_t * | offset, | ||
| uint64_t * | block_offset, | ||
| uint8_t * | sector_status ) |
Decodes a DDT v1 entry for a given sector address.
Determines the offset and block offset for a sector using the DDT v1 table. This function performs bit manipulation on the DDT entry to extract the sector offset within a block and the block offset, and determines whether the sector was dumped or not based on the DDT entry value.
| ctx | Pointer to the aaruformat context containing the loaded DDT table. |
| sector_address | Logical sector address to decode (must be within valid range). |
| offset | Pointer to store the resulting sector offset within the block. |
| block_offset | Pointer to store the resulting block offset in the image. |
| sector_status | Pointer to store the sector status (dumped or not dumped). |
| AARUF_STATUS_OK | (0) Successfully decoded the DDT entry. This is always returned when:
|
| AARUF_ERROR_NOT_AARUFORMAT | (-1) The context or image stream is invalid (NULL pointers). This is the only error condition that can occur in this function. |
Definition at line 405 of file ddt_v1.c.
References AARUF_ERROR_INCORRECT_DATA_SIZE, AARUF_ERROR_NOT_AARUFORMAT, AARUF_STATUS_OK, FATAL, aaruformat_context::imageStream, SectorStatusDumped, SectorStatusNotDumped, aaruformat_context::shift, TRACE, and aaruformat_context::user_data_ddt.
Referenced by aaruf_read_sector().
| int32_t process_ddt_v1 | ( | aaruformat_context * | ctx, |
| IndexEntry * | entry, | ||
| bool * | found_user_data_ddt ) |
Processes a DDT v1 block from the image stream.
Reads and decompresses (if needed) a DDT v1 block, verifies its integrity, and loads it into memory or maps it. This function handles both user data DDT blocks and CD sector prefix/suffix corrected DDT blocks, supporting both LZMA compression and uncompressed formats. On Linux, uncompressed blocks can be memory-mapped for improved performance.
| ctx | Pointer to the aaruformat context. |
| entry | Pointer to the index entry describing the DDT block. |
| found_user_data_ddt | Pointer to a boolean that will be set to true if a user data DDT was found and loaded. |
| AARUF_STATUS_OK | (0) Successfully processed the DDT block. This is returned when:
|
| AARUF_ERROR_NOT_AARUFORMAT | (-1) The context or image stream is invalid (NULL pointers). |
| AARUF_ERROR_CANNOT_READ_BLOCK | (-7) Failed to access the DDT block in the image stream. This occurs when:
|
| AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK | (-17) LZMA decompression failed. This can happen when:
|
Definition at line 85 of file ddt_v1.c.
References AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK, AARUF_ERROR_CANNOT_READ_BLOCK, AARUF_ERROR_NOT_AARUFORMAT, aaruf_lzma_decode_buffer(), AARUF_STATUS_OK, CdSectorPrefixCorrected, CdSectorSuffixCorrected, DdtHeader::cmpLength, DdtHeader::compression, IndexEntry::dataType, aaruformat_context::ddt_version, DdtHeader::entries, FATAL, aaruformat_context::image_info, ImageInfo::ImageSize, aaruformat_context::imageStream, aaruformat_context::in_memory_ddt, DdtHeader::length, Lzma, LZMA_PROPERTIES_LENGTH, aaruformat_context::mapped_memory_ddt_size, None, IndexEntry::offset, aaruformat_context::sector_prefix_ddt, aaruformat_context::sector_suffix_ddt, ImageInfo::Sectors, aaruformat_context::shift, DdtHeader::shift, TRACE, aaruformat_context::user_data_ddt, and UserData.
Referenced by aaruf_open().