libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
Loading...
Searching...
No Matches
erasure_internal.h
Go to the documentation of this file.
1/*
2 * This file is part of the Aaru Data Preservation Suite.
3 * Copyright (c) 2019-2026 Natalia Portillo.
4 *
5 * This library is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2.1 of the
8 * License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef LIBAARUFORMAT_ERASURE_INTERNAL_H
20#define LIBAARUFORMAT_ERASURE_INTERNAL_H
21
22#include "aaruformat/context.h"
24
25/* ---- Write path ---- */
26
27void ec_accumulate_data_block(aaruformat_context *ctx, const BlockHeader *block_header, const uint8_t *lzma_props,
28 const uint8_t *payload, uint32_t payload_size, uint64_t file_offset);
29
30void ec_flush_data_stripe(aaruformat_context *ctx, uint32_t slot);
31
33
34/* ---- Read path ---- */
35
44
59int32_t ec_recover_data_block(aaruformat_context *ctx, uint64_t block_offset, uint64_t offset,
60 uint8_t *data, uint32_t *length, uint8_t sector_status);
61
80int32_t ec_recover_raw_block(aaruformat_context *ctx, uint64_t block_offset,
81 uint8_t **recovered_data, uint32_t *recovered_size,
82 void *stripes, uint32_t stripe_count, void *lookup,
83 uint16_t group_K, uint16_t group_M, uint32_t group_shard_size);
84
90int32_t ec_recover_meta_block(aaruformat_context *ctx, uint64_t block_offset,
91 uint8_t **recovered_data, uint32_t *recovered_size);
92
96int32_t ec_recover_ddt_block(aaruformat_context *ctx, uint64_t block_offset,
97 uint8_t **recovered_data, uint32_t *recovered_size);
98
99/* ---- Cleanup ---- */
100
101void ec_free(aaruformat_context *ctx);
102
103#endif /* LIBAARUFORMAT_ERASURE_INTERNAL_H */
Central runtime context structures for libaaruformat (image state, caches, checksum buffers).
On-disk layout structures for data-bearing and geometry blocks.
void ec_load_ecmb(aaruformat_context *ctx)
Try to load the ECMB from the recovery footer at EOF.
Definition erasure.c:1046
void ec_finalize(aaruformat_context *ctx)
Flush all partial data stripes and write parity for all groups + ECMB + recovery footer.
Definition erasure.c:585
int32_t ec_recover_ddt_block(aaruformat_context *ctx, uint64_t block_offset, uint8_t **recovered_data, uint32_t *recovered_size)
Attempt to recover a DDT secondary block at a given file offset.
Definition erasure.c:918
void ec_accumulate_data_block(aaruformat_context *ctx, const BlockHeader *block_header, const uint8_t *lzma_props, const uint8_t *payload, uint32_t payload_size, uint64_t file_offset)
Accumulate parity for a data block that was just written to disk.
Definition erasure.c:209
int32_t ec_recover_data_block(aaruformat_context *ctx, uint64_t block_offset, uint64_t offset, uint8_t *data, uint32_t *length, uint8_t sector_status)
Attempt to recover a data block that failed decompression or CRC verification.
Definition erasure.c:1303
int32_t ec_recover_meta_block(aaruformat_context *ctx, uint64_t block_offset, uint8_t **recovered_data, uint32_t *recovered_size)
Attempt to recover a metadata/media-tag block at a given file offset.
Definition erasure.c:909
void ec_flush_data_stripe(aaruformat_context *ctx, uint32_t slot)
Write M parity blocks for a completed data stripe slot and record the stripe descriptor.
Definition erasure.c:323
void ec_free(aaruformat_context *ctx)
Free all erasure coding state from the context.
Definition erasure.c:934
int32_t ec_recover_raw_block(aaruformat_context *ctx, uint64_t block_offset, uint8_t **recovered_data, uint32_t *recovered_size, void *stripes, uint32_t stripe_count, void *lookup, uint16_t group_K, uint16_t group_M, uint32_t group_shard_size)
Attempt to recover a raw block at a given file offset using a specified stripe group.
Definition erasure.c:827
Header preceding the compressed data payload of a data block (BlockType::DataBlock).
Definition data.h:71
Master context representing an open or in‑creation Aaru image.
Definition context.h:178