|
libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
|
Header for a tape partition metadata block containing partition layout information. More...
#include <aaruformat/structs/tape.h>
Data Fields | |
| uint32_t | identifier |
| Block type identifier. | |
| uint8_t | entries |
| Number of partition entries following this header. | |
| uint64_t | length |
| Size of entry data in bytes (excluding this header). | |
| uint64_t | crc64 |
| CRC64-ECMA checksum of the entry data. | |
Header for a tape partition metadata block containing partition layout information.
This structure serves as the header for a TapePartitionBlock, which documents the physical partitioning of the tape medium. The block consists of this fixed-size header followed by a variable-length array of TapePartitionEntry structures (one per partition).
Block Structure:
Purpose: The tape partition block enables:
Identifier Field: The identifier field must be set to BlockType::TapePartitionBlock to indicate this block type. This allows the Aaru format parser to recognize and correctly interpret the block during image loading.
Entry Count: The entries field specifies the number of TapePartitionEntry structures that follow the header. Valid range is 0-255 (uint8_t), though most tapes have 1-4 partitions:
Block Length: The length field contains the size in bytes of the data following this header (i.e., the array of TapePartitionEntry structures). This is calculated as: length = entries × sizeof(TapePartitionEntry)
The header itself is NOT included in the length value. Total block size is: total_size = sizeof(TapePartitionHeader) + length
CRC64 Checksum: The crc64 field contains a CRC64-ECMA checksum computed over the entry data (the array of TapePartitionEntry structures, excluding this header). This provides integrity verification to detect corruption in the partition table. The CRC is calculated using the ECMA polynomial.
Partition Order: Entries should be ordered by partition number (ascending). This matches the typical physical organization of tape partitions and facilitates efficient lookup operations.
Alignment: When written to the Aaru image, this block is aligned to the image's block alignment boundary (typically 2^blockAlignmentShift bytes). Padding may be inserted before the block to achieve proper alignment.
Index Integration: After writing this block to the image file, an IndexEntry is created with:
Relationship to Files: TapePartitionHeader should be written before TapeFileHeader, as files reference partitions by number. Readers should parse the partition block first to validate partition numbers in file entries.
Single-Partition Tapes: Even for single-partition tapes, this block should be present with entries=1, containing one TapePartitionEntry for partition 0. This provides consistency and avoids special-case handling in readers.
| uint64_t TapePartitionHeader::crc64 |
CRC64-ECMA checksum of the entry data.
Computed over the array of TapePartitionEntry structures only. Does NOT include this header. Used for integrity verification.
Definition at line 448 of file tape.h.
Referenced by process_tape_partitions_block(), and write_tape_partition_block().
| uint8_t TapePartitionHeader::entries |
Number of partition entries following this header.
Specifies how many TapePartitionEntry structures are in this block. Valid range: 0-255. Most tapes have 1-4 partitions.
Definition at line 444 of file tape.h.
Referenced by process_tape_partitions_block().
| uint32_t TapePartitionHeader::identifier |
Block type identifier.
Must be set to BlockType::TapePartitionBlock. This magic value allows parsers to identify the block type.
Definition at line 442 of file tape.h.
Referenced by process_tape_partitions_block(), and write_tape_partition_block().
| uint64_t TapePartitionHeader::length |
Size of entry data in bytes (excluding this header).
Calculated as: entries × sizeof(TapePartitionEntry). This is the number of bytes following the header.
Definition at line 446 of file tape.h.
Referenced by write_tape_partition_block().