Files
libaaruformat/docs/spec/blocks/tape_partition.adoc

91 lines
2.8 KiB
Plaintext
Raw Normal View History

=== Tape Partition Block (`TPBT`)
This block lists all tape partitions.
Tape partitions are separations written to media.
They are used to distinguish two sets of related data that are distant enough to warrant separation but still belong on the same tape.
A well-known example is the LTFS filesystem.
==== Structure Definition
[source,c]
#define TAPE_PARTITION_MAGIC 0x54504254
2025-10-11 13:17:26 +01:00
typedef struct TapePartitionHeader
{
uint32_t identifier; ///< Block type identifier. Must be set to BlockType::TapePartitionBlock. This magic value
///< allows parsers to identify the block type.
uint8_t 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.
uint64_t length; ///< Size of entry data in bytes (excluding this header). Calculated as: entries ×
///< sizeof(TapePartitionEntry). This is the number of bytes following the header.
uint64_t 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.
} TapePartitionHeader;
==== Field Descriptions
[cols="2,2,2,6",options="header"]
|===
|Type
|Size
|Name
|Description
|uint32_t
|4 bytes
|identifier
|The tape partition block identifier, always `TPBT`
|uint16_t
|2 bytes
|entries
|The number of entries following this header
|uint32_t
|4 bytes
|length
|The length in bytes of the data following this header.
|uint64_t
|8 bytes
|crc64
|The CRC64-ECMA checksum of the data following this header
|===
==== Tape partition entries
[source,c]
2025-10-11 13:17:26 +01:00
typedef struct TapePartitionEntry
{
uint8_t Number; ///< Partition number (unique identifier for this partition). Identifies this partition among all
///< partitions on the tape. Valid range: 0-255, though most tapes use 0-3.
uint64_t FirstBlock; ///< First block in the partition (inclusive). Starting block address for this partition's
///< address space. Often 0, but format-dependent.
uint64_t LastBlock; ///< Last block in the partition (inclusive). Ending block address for this partition's address
///< space. Must be ≥ FirstBlock. The partition contains all blocks from FirstBlock through
///< LastBlock inclusive.
} TapePartitionEntry;
==== Field Descriptions
[cols="2,2,2,6",options="header"]
|===
|Type
|Size
|Name
|Description
|uint8_t
|1 byte
|number
|Partition number.
|uint64_t
|8 bytes
|firstBlock
|First block number, inclusive, of the partition.
|uint64_t
|8 bytes
|lastBlock
|Last block number, inclusive, of the partition.
|===