|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
#include <errno.h>#include <inttypes.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <aaruformat.h>#include "internal.h"#include "log.h"#include "utarray.h"Go to the source code of this file.
Functions | |
| static void | cleanup_open_failure (aaruformat_context *ctx) |
| void * | aaruf_open (const char *filepath) |
| Opens an existing AaruFormat image file. | |
| void * aaruf_open | ( | const char * | filepath | ) |
Opens an existing AaruFormat image file.
Opens the specified image file and returns a pointer to the initialized aaruformat context. This function performs comprehensive validation of the image file format, reads and processes all index entries, initializes data structures for reading operations, and sets up caches for optimal performance. It supports multiple AaruFormat versions and handles various block types including data blocks, deduplication tables, metadata, and checksums.
| filepath | Path to the image file to open. |
| aaruformatContext* | Successfully opened and initialized context. The returned pointer contains:
|
| NULL | Opening failed. The specific error can be determined by checking errno, which will be set to:
|
< Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).
< Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).
< Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).
Definition at line 125 of file open.c.
References AARU_HEADER_APP_NAME_LEN, AARU_MAGIC, aaruf_close(), aaruf_ecc_cd_init(), AARUF_ERROR_CANNOT_READ_INDEX, AARUF_ERROR_FILE_TOO_SMALL, AARUF_ERROR_INCOMPATIBLE_VERSION, AARUF_ERROR_NOT_AARUFORMAT, AARUF_ERROR_NOT_ENOUGH_MEMORY, aaruf_get_xml_mediatype(), AARUF_STATUS_OK, AARUF_VERSION, AARUF_VERSION_V2, AaruMetadataJsonBlock, ImageInfo::Application, AaruHeaderV2::application, AaruHeaderV2::applicationMajorVersion, AaruHeaderV2::applicationMinorVersion, ImageInfo::ApplicationVersion, aaruformat_context::block_cache, aaruformat_context::block_header_cache, BlockMedia, IndexEntry::blockType, CacheHeader::cache, ChecksumBlock, CicmBlock, cleanup_open_failure(), ImageInfo::CreationTime, AaruHeaderV2::creationTime, aaruformat_context::cylinders, DataBlock, IndexEntry::dataType, DeDuplicationTable, DeDuplicationTable2, DIC_MAGIC, DumpHardwareBlock, aaruformat_context::ecc_cd_context, FATAL, aaruformat_context::geometry_block, GeometryBlock, aaruformat_context::header, aaruformat_context::heads, AaruHeaderV2::identifier, GeometryBlockHeader::identifier, aaruformat_context::image_info, AaruHeaderV2::imageMajorVersion, AaruHeaderV2::imageMinorVersion, ImageInfo::ImageSize, aaruformat_context::imageStream, IndexBlock, IndexBlock2, IndexBlock3, AaruHeaderV2::indexOffset, ImageInfo::LastModificationTime, AaruHeaderV2::lastWrittenTime, LIBAARUFORMAT_MAJOR_VERSION, LIBAARUFORMAT_MINOR_VERSION, aaruformat_context::library_major_version, aaruformat_context::library_minor_version, aaruformat_context::magic, MAX_CACHE_SIZE, CacheHeader::max_items, MaxSectorTag, ImageInfo::MediaType, AaruHeaderV2::mediaType, MetadataBlock, ImageInfo::MetadataMediaType, IndexEntry::offset, process_aaru_metadata_json_block(), process_checksum_block(), process_cicm_block(), process_data_block(), process_ddt_v1(), process_ddt_v2(), process_dumphw_block(), process_geometry_block(), process_index_v1(), process_index_v2(), process_index_v3(), process_metadata_block(), process_tape_files_block(), process_tape_partitions_block(), process_tracks_block(), aaruformat_context::readableSectorTags, ImageInfo::Sectors, aaruformat_context::sectors_per_track, ImageInfo::SectorSize, aaruformat_context::shift, TapeFileBlock, TapePartitionBlock, TRACE, TracksBlock, and ImageInfo::Version.
|
static |
Definition at line 31 of file open.c.
References aaruformat_context::imageStream, and aaruformat_context::readableSectorTags.
Referenced by aaruf_open().