Add support for processing Aaru metadata JSON blocks

This commit is contained in:
2025-10-05 05:06:30 +01:00
parent 5e8422f59b
commit 4491df8689
6 changed files with 185 additions and 1 deletions

View File

@@ -236,6 +236,9 @@ typedef struct aaruformatContext
size_t sector_suffix_length; ///< Length of sector_suffix
size_t sector_prefix_offset; ///< Current position in sector_prefix
size_t sector_suffix_offset; ///< Current position in sector_suffix
AaruMetadataJsonBlockHeader jsonBlockHeader; ///< JSON metadata block header (if present).
uint8_t *jsonBlock; ///< JSON metadata block payload (UTF-8).
} aaruformatContext;
/** \struct DumpHardwareEntriesWithData

View File

@@ -153,7 +153,8 @@ typedef enum
SnapshotBlock = 0x50414E53, ///< Block containing a snapshot index (reserved / TODO).
ParentBlock = 0x50524E54, ///< Block describing how to locate the parent image (reserved / TODO).
DumpHardwareBlock = 0x2A504D44, ///< Block containing an array of hardware used to create the image.
TapeFileBlock = 0x454C4654 ///< Block containing list of files for a tape image (reserved / TODO).
TapeFileBlock = 0x454C4654, ///< Block containing list of files for a tape image (reserved / TODO).
AaruMetadataJsonBlock = 0x444D534A ///< Block containing JSON version of Aaru Metadata
} BlockType;
/**

View File

@@ -110,6 +110,18 @@ typedef struct CicmMetadataBlock
uint32_t length; ///< Length in bytes of the CICM metadata payload that follows.
} CicmMetadataBlock;
/** \struct AaruMetadataJsonBlockHeader
* \brief Header for an Aaru metadata JSON block (identifier == BlockType::AaruMetadataJsonBlock).
*
* The following 'length' bytes immediately after the header contain the Aaru metadata JSON payload. Encoding is
* typically UTF-8; the payload is not required to be null-terminated.
*/
typedef struct AaruMetadataJsonBlockHeader
{
uint32_t identifier; ///< Block identifier, must be BlockType::AaruMetadataJsonBlock.
uint32_t length; ///< Length in bytes of the Aaru metadata JSON payload that follows.
} AaruMetadataJsonBlockHeader;
#pragma pack(pop)
#endif // LIBAARUFORMAT_METADATA_H