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

96 lines
2.7 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

=== Tape File Block (`TFLE`)
Lists all tape files.
Tape files are separations written to media, usually digital tapes, and are marked by filemarks.
==== Structure Definition
[source,c]
#define TAPE_FILE_MAGIC 0x454C4654
typedef struct TapeFileHeader
{
uint32_t identifier; ///< Block type identifier. Must be set to BlockType::TapeFileBlock. This magic value allows
///< parsers to identify the block type.
uint32_t entries; ///< Number of file entries following this header. Specifies how many TapeFileEntry structures
///< are in this block. Valid range: 0 to 2^32-1.
uint64_t length; ///< Size of entry data in bytes (excluding this header). Calculated as: entries ×
///< sizeof(TapeFileEntry). This is the number of bytes following the header.
uint64_t crc64; ///< CRC64-ECMA checksum of the entry data. Computed over the array of TapeFileEntry structures
///< only. Does NOT include this header. Used for integrity verification.
} TapeFileHeader;
==== Field Descriptions
[cols="2,2,2,6",options="header"]
|===
|Type
|Size
|Name
|Description
|uint32_t
|4 bytes
|identifier
|The tape file block identifier, always `TFLE`
|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 file entries
[source,c]
typedef struct TapeFileEntry
{
uint32_t File; ///< File number (unique within the partition). Identifies this file among all files in the same
///< partition. Numbering scheme is tape-format-dependent.
uint8_t Partition; ///< Partition number containing this file. References a partition defined in the
///< TapePartitionHeader block. Valid range: 0-255.
uint64_t FirstBlock; ///< First block of the file (inclusive). This is the starting block address of the file data.
///< Block addresses are 0-based within the partition.
uint64_t
LastBlock; ///< Last block of the file (inclusive). This is the ending block address of the file data. Must be
///< ≥ FirstBlock. The file contains all blocks from FirstBlock through LastBlock inclusive.
} TapeFileEntry;
==== Field Descriptions
[cols="2,2,2,6",options="header"]
|===
|Type
|Size
|Name
|Description
|uint32
|4 bytes
|file
|File number.
|uint8
|1 byte
|partition
|Partition number this file belongs to.
|uint64
|8 bytes
|firstBlock
|First block number, inclusive, of the file.
|uint64
|8 bytes
|lastBlock
|Last block number, inclusive, of the file.
|===