Implement creating AaruFormat image and writing header.

This commit is contained in:
2025-08-07 15:43:35 +01:00
parent 676a87d25b
commit 3b012797cb
11 changed files with 354 additions and 2 deletions

View File

@@ -115,7 +115,7 @@ typedef struct aaruformatContext
uint64_t cachedDdtOffset;
uint16_t *cachedSecondaryDdtSmall;
uint32_t *cachedSecondaryDdtBig;
bool isWriting;
} aaruformatContext;
typedef struct DumpHardwareEntriesWithData

View File

@@ -62,6 +62,11 @@ AARU_EXPORT int AARU_CALL aaruf_identify_stream(FILE *imageStream);
AARU_EXPORT void *AARU_CALL aaruf_open(const char *filepath);
AARU_EXPORT void *AARU_CALL aaruf_create(const char *filepath, uint32_t mediaType, uint32_t sectorSize,
uint64_t userSectors, uint64_t negativeSectors, uint64_t overflowSectors,
const char *options, const uint8_t *applicationName,
uint8_t applicationMajorVersion, uint8_t applicationMinorVersion);
AARU_EXPORT int AARU_CALL aaruf_close(void *context);
AARU_EXPORT int32_t AARU_CALL aaruf_read_media_tag(void *context, uint8_t *data, int32_t tag, uint32_t *length);

View File

@@ -37,6 +37,9 @@
#define AARUF_ERROR_SECTOR_TAG_NOT_PRESENT -16
#define AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK -17
#define AARUF_ERROR_INVALID_BLOCK_CRC -18
#define AARUF_ERROR_CANNOT_CREATE_FILE -19
#define AARUF_ERROR_INVALID_APP_NAME_LENGTH -20
#define AARUF_ERROR_CANNOT_WRITE_HEADER -21
#define AARUF_STATUS_OK 0
#define AARUF_STATUS_SECTOR_NOT_DUMPED 1

View File

@@ -37,6 +37,7 @@
#include "structs/index.h"
#include "structs/metadata.h"
#include "structs/optical.h"
#include "structs/options.h"
#endif // LIBAARUFORMAT_STRUCTS_H

View File

@@ -0,0 +1,37 @@
/*
* This file is part of the Aaru Data Preservation Suite.
* Copyright (c) 2019-2025 Natalia Portillo.
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBAARUFORMAT_OPTIONS_H
#define LIBAARUFORMAT_OPTIONS_H
typedef struct
{
bool compress;
bool deduplicate;
uint32_t dictionary;
uint8_t table_shift;
uint8_t data_shift;
uint8_t block_alignment;
bool md5;
bool sha1;
bool sha256;
bool blake3;
bool spamsum;
} aaru_options;
#endif // LIBAARUFORMAT_OPTIONS_H