Add data types for erasure coding.

This commit is contained in:
2026-04-11 20:13:59 +01:00
parent 2aea0dbb5a
commit acfa2f0d2f
2 changed files with 47 additions and 3 deletions

View File

@@ -103,14 +103,17 @@
* Bit 0 = AARU_FEATURE_INCOMPAT_ZSTD (Zstandard compression). */
#define AARUF_KNOWN_INCOMPAT_FEATURES 0x1ULL
/** Bitmask of all featureCompatibleRo bits understood by this library version.
* Currently no read-only-compatible features are defined. */
#define AARUF_KNOWN_ROCOMPAT_FEATURES 0ULL
* Bit 0 = AARU_FEATURE_ROCOMPAT_ERASURE (erasure coding parity data). */
#define AARUF_KNOWN_ROCOMPAT_FEATURES 0x1ULL
/** Bitmask of all featureCompatible bits understood by this library version.
* Bit 0 = AARU_FEATURE_RW_BLAKE3 (BLAKE3 checksums). */
#define AARUF_KNOWN_COMPAT_FEATURES 0x1ULL
/** Mask for extracting positional index (lower 24 bits) in Compact Disc suffix/prefix deduplicated block entries. */
#define CD_DFIX_MASK 0x00FFFFFFU
/** Magic number at the end of the recovery footer: "AVRECMFR" in ASCII little-endian. */
#define AARU_RECOVERY_FOOTER_MAGIC 0x52464D4345525641ULL
#ifndef _MSC_VER
#pragma clang diagnostic pop
#endif

View File

@@ -148,6 +148,11 @@ typedef enum
kDataTypeAacsMediaKey = 101, ///< AACS Media Key
kDataTypeAacsVolumeUniqueKey = 102, ///< AACS Volume Unique Key
kDataTypeBdSectorEdc = 103, ///< Blu-ray Sector EDC
kDataTypeErasureParity = 104, ///< Erasure coding parity shard for data blocks.
kDataTypeErasureParityDdt = 105, ///< Erasure coding parity shard for DDT secondary blocks.
kDataTypeErasureParityDdtPrimary = 106, ///< Erasure coding parity replica for DDT primary block.
kDataTypeErasureParityMeta = 107, ///< Erasure coding parity shard for metadata blocks.
kDataTypeErasureParityIndex = 108, ///< Erasure coding parity replica for index block.
} DataType;
/**
@@ -178,7 +183,8 @@ typedef enum
AaruMetadataJsonBlock = 0x444D534A, ///< Block containing JSON version of Aaru Metadata
FluxDataBlock = 0x58554C46, ///< Block containing flux data metadata.
DataStreamPayloadBlock =
0x4C505344 ///< Block containing compressed data stream payload (e.g., flux data, bitstreams).
0x4C505344, ///< Block containing compressed data stream payload (e.g., flux data, bitstreams).
ErasureCodingMapBlock = 0x424D4345 ///< Block containing erasure coding stripe map and recovery metadata.
} BlockType;
/**
@@ -301,6 +307,41 @@ typedef enum
AARU_FEATURE_INCOMPAT_ZSTD = 0x1, ///< Image contains Zstandard-compressed blocks.
} FeaturesIncompatible;
/**
* @brief Read-only compatible feature flags for AaruHeader V2.
*
* If any bit in featureCompatibleRo is not understood by a reader, the image
* SHOULD be opened read-only (the reader cannot safely modify the data without
* understanding these features).
*/
typedef enum
{
AARU_FEATURE_ROCOMPAT_ERASURE = 0x1, ///< Image contains erasure coding parity blocks and recovery metadata.
} FeaturesCompatibleRo;
/**
* \enum ErasureCodingAlgorithm
* \brief Erasure coding algorithms supported by the ECMB.
*/
typedef enum
{
kErasureCodingXor = 0, ///< Simple XOR parity (M must be 1).
kErasureCodingRsVandermonde = 1 ///< Reed-Solomon with Vandermonde generator matrix over GF(2^8).
} ErasureCodingAlgorithm;
/**
* \enum ErasureCodingGroupType
* \brief Identifies which protection group a stripe belongs to.
*/
typedef enum
{
kECGroupData = 0, ///< User data blocks (DBLK).
kECGroupDdtSecondary = 1, ///< Secondary DDT subtables.
kECGroupDdtPrimary = 2, ///< Primary DDT (K=1, M replicas).
kECGroupMetadata = 3, ///< Metadata/media tag blocks.
kECGroupIndex = 4 ///< Index block (K=1, M replicas).
} ErasureCodingGroupType;
#ifndef _MSC_VER
#pragma clang diagnostic pop
#endif