libaaruformat 1.0
Aaru Data Preservation Suite - Format Library
Loading...
Searching...
No Matches
TapePartitionHeader Struct Reference

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.

Detailed Description

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:

+---------------------------+
| TapePartitionHeader | <- Fixed 21-byte header
+---------------------------+
| TapePartitionEntry 0 | <- First partition entry
+---------------------------+
| TapePartitionEntry 1 | <- Second partition entry
+---------------------------+
| ... |
+---------------------------+
| TapePartitionEntry (n-1) | <- Last partition entry
+---------------------------+
Describes a single physical partition on a tape medium.
Definition tape.h:320
Header for a tape partition metadata block containing partition layout information.
Definition tape.h:441
struct TapePartitionEntry TapePartitionEntry

Purpose: The tape partition block enables:

  • Quick identification of partition boundaries
  • Validation of partition organization
  • Understanding of tape physical layout
  • Support for multi-partition tape formats
  • Preservation of original partitioning scheme
  • Correct interpretation of file locations (files reference partition numbers)

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:

  • entries=0: No partitions (unusual, possibly empty tape)
  • entries=1: Single partition (most common)
  • entries>1: Multi-partition tape

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:

  • blockType = TapePartitionBlock
  • dataType = 0 (tape partition blocks have no subtype)
  • offset = file position where this header was written

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.

Note
This block is optional but highly recommended for tape images. Without it, partition information must be inferred from file entries or tape format specifications.
The sum of all partition sizes (in blocks) represents the total tape capacity, assuming partitions are contiguous and non-overlapping.
Some tape formats allow dynamic repartitioning (changing partition boundaries). The Aaru image captures the partition layout at imaging time.
Warning
The entries count must accurately reflect the number of TapePartitionEntry structures in the block. Mismatches will cause parsing errors.
The CRC64 must be recalculated any time the entry data changes. Stale CRC values will cause integrity check failures.
Partition numbers referenced in TapeFileEntry must exist in this partition table. Orphaned file entries (referencing non-existent partitions) indicate a corrupt or incomplete image.
See also
TapePartitionEntry for the structure of individual partition entries
TapeFileHeader for file structure metadata
BlockType for block type identifier constants

Definition at line 440 of file tape.h.

Field Documentation

◆ crc64

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().

◆ entries

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().

◆ identifier

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().

◆ length

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().


The documentation for this struct was generated from the following file:
  • include/aaruformat/structs/tape.h