Files
libaaruformat/docs/html/structTapeFileHeader.html

270 lines
17 KiB
HTML
Raw Normal View History

2025-10-11 01:35:43 +01:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.14.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libaaruformat: TapeFileHeader Struct Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">libaaruformat<span id="projectnumber">&#160;1.0</span>
</div>
<div id="projectbrief">Aaru Data Preservation Suite - Format Library</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.14.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(function(){initNavTree('structTapeFileHeader.html','',''); });
</script>
<div id="container">
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="headertitle"><div class="title">TapeFileHeader Struct Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Header for a tape file metadata block containing file layout information.
<a href="#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="tape_8h_source.html">aaruformat/structs/tape.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-pub-attribs" class="groupheader"><a id="pub-attribs" name="pub-attribs"></a>
Data Fields</h2></td></tr>
<tr class="memitem:a36fe923f8d67004e0b0ae8eaf6535e1d" id="r_a36fe923f8d67004e0b0ae8eaf6535e1d"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a36fe923f8d67004e0b0ae8eaf6535e1d">identifier</a></td></tr>
<tr class="memdesc:a36fe923f8d67004e0b0ae8eaf6535e1d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Block type identifier. <br /></td></tr>
<tr class="memitem:a319aea86a448c0b969de944f22e551c0" id="r_a319aea86a448c0b969de944f22e551c0"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a319aea86a448c0b969de944f22e551c0">entries</a></td></tr>
<tr class="memdesc:a319aea86a448c0b969de944f22e551c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Number of file entries following this header. <br /></td></tr>
<tr class="memitem:a74b5289640a6c45eece7bd58550e59c0" id="r_a74b5289640a6c45eece7bd58550e59c0"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a74b5289640a6c45eece7bd58550e59c0">length</a></td></tr>
<tr class="memdesc:a74b5289640a6c45eece7bd58550e59c0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Size of entry data in bytes (excluding this header). <br /></td></tr>
<tr class="memitem:a5172ee4bf0b5820a66d04aff1e3809db" id="r_a5172ee4bf0b5820a66d04aff1e3809db"><td class="memItemLeft" align="right" valign="top">uint64_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a5172ee4bf0b5820a66d04aff1e3809db">crc64</a></td></tr>
<tr class="memdesc:a5172ee4bf0b5820a66d04aff1e3809db"><td class="mdescLeft">&#160;</td><td class="mdescRight">CRC64-ECMA checksum of the entry data. <br /></td></tr>
</table>
<a name="details" id="details"></a><h2 id="header-details" class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Header for a tape file metadata block containing file layout information. </p>
<p>This structure serves as the header for a TapeFileBlock, which documents all logical files present on the tape medium. The block consists of this fixed-size header followed by a variable-length array of <a class="el" href="structTapeFileEntry.html" title="Describes a single logical file on a tape medium.">TapeFileEntry</a> structures (one per file).</p>
<p><b>Block Structure:</b> </p><div class="fragment"><div class="line">+-------------------------+</div>
<div class="line">| <a class="code hl_struct" href="structTapeFileHeader.html">TapeFileHeader</a> | &lt;- Fixed 24-<span class="keywordtype">byte</span> header</div>
<div class="line">+-------------------------+</div>
<div class="line">| <a class="code hl_struct" href="structTapeFileEntry.html">TapeFileEntry</a> 0 | &lt;- First file entry</div>
<div class="line">+-------------------------+</div>
<div class="line">| <a class="code hl_struct" href="structTapeFileEntry.html">TapeFileEntry</a> 1 | &lt;- Second file entry</div>
<div class="line">+-------------------------+</div>
<div class="line">| ... |</div>
<div class="line">+-------------------------+</div>
<div class="line">| <a class="code hl_typedef" href="tape_8h.html#ade8125364d763d57d167c0b521beaf64">TapeFileEntry</a> (n-1) | &lt;- Last file entry</div>
<div class="line">+-------------------------+</div>
<div class="ttc" id="astructTapeFileEntry_html"><div class="ttname"><a href="structTapeFileEntry.html">TapeFileEntry</a></div><div class="ttdoc">Describes a single logical file on a tape medium.</div><div class="ttdef"><b>Definition</b> <a href="tape_8h_source.html#l00133">tape.h:134</a></div></div>
<div class="ttc" id="astructTapeFileHeader_html"><div class="ttname"><a href="structTapeFileHeader.html">TapeFileHeader</a></div><div class="ttdoc">Header for a tape file metadata block containing file layout information.</div><div class="ttdef"><b>Definition</b> <a href="tape_8h_source.html#l00237">tape.h:238</a></div></div>
<div class="ttc" id="atape_8h_html_ade8125364d763d57d167c0b521beaf64"><div class="ttname"><a href="tape_8h.html#ade8125364d763d57d167c0b521beaf64">TapeFileEntry</a></div><div class="ttdeci">struct TapeFileEntry TapeFileEntry</div></div>
</div><!-- fragment --><p><b>Purpose:</b> The tape file block enables:</p><ul>
<li>Quick lookup of file locations without scanning the entire tape</li>
<li>Validation of file boundaries and partition assignments</li>
<li>Random access to specific files in the image</li>
<li>Preservation of the original tape's logical organization</li>
<li>Documentation of tape structure for archival purposes</li>
</ul>
<p><b>Identifier Field:</b> The identifier field must be set to BlockType::TapeFileBlock to indicate this block type. This allows the Aaru format parser to recognize and correctly interpret the block during image loading.</p>
<p><b>Entry Count:</b> The entries field specifies the number of <a class="el" href="structTapeFileEntry.html" title="Describes a single logical file on a tape medium.">TapeFileEntry</a> structures that follow the header. A tape with no files would have entries=0, though this is unusual. Maximum value is 2^32-1 (4,294,967,295 files), though practical limits are much lower.</p>
<p><b>Block Length:</b> The length field contains the size in bytes of the data following this header (i.e., the array of <a class="el" href="structTapeFileEntry.html" title="Describes a single logical file on a tape medium.">TapeFileEntry</a> structures). This is calculated as: length = entries × sizeof(TapeFileEntry)</p>
<p>The header itself is NOT included in the length value. Total block size is: total_size = sizeof(TapeFileHeader) + length</p>
<p><b>CRC64 Checksum:</b> The crc64 field contains a CRC64-ECMA checksum computed over the entry data (the array of <a class="el" href="structTapeFileEntry.html" title="Describes a single logical file on a tape medium.">TapeFileEntry</a> structures, excluding this header). This provides integrity verification to detect corruption in the file table. The CRC is calculated using the ECMA polynomial.</p>
<p><b>File Order:</b> Entries should be ordered by partition number (ascending), then by file number (ascending) within each partition. This ordering facilitates efficient lookup and matches the physical organization of most tape formats.</p>
<p><b>Alignment:</b> 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.</p>
<p><b>Index Integration:</b> After writing this block to the image file, an <a class="el" href="structIndexEntry.html" title="Single index entry describing a block&#39;s type, (optional) data classification, and file offset.">IndexEntry</a> is created with:</p><ul>
<li>blockType = TapeFileBlock</li>
<li>dataType = 0 (tape file blocks have no subtype)</li>
<li>offset = file position where this header was written</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>This block is optional. Tape images without file structure metadata can omit it, representing the tape as a simple linear sequence of blocks.</dd>
<dd>
If a tape has multiple partitions, files from all partitions are included in a single TapeFileBlock (distinguished by their Partition field).</dd>
<dd>
Empty tapes (no files) may still have a <a class="el" href="structTapeFileHeader.html" title="Header for a tape file metadata block containing file layout information.">TapeFileHeader</a> with entries=0, length=0, though such blocks are typically omitted.</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>The entries count must accurately reflect the number of <a class="el" href="structTapeFileEntry.html" title="Describes a single logical file on a tape medium.">TapeFileEntry</a> structures in the block. Mismatches will cause parsing errors.</dd>
<dd>
The CRC64 must be recalculated any time the entry data changes. Stale CRC values will cause integrity check failures.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="structTapeFileEntry.html" title="Describes a single logical file on a tape medium.">TapeFileEntry</a> for the structure of individual file <a class="el" href="#a319aea86a448c0b969de944f22e551c0" title="Number of file entries following this header.">entries</a> </dd>
<dd>
<a class="el" href="structTapePartitionHeader.html" title="Header for a tape partition metadata block containing partition layout information.">TapePartitionHeader</a> for partition structure metadata </dd>
<dd>
<a class="el" href="enums_8h.html#a54420623f26ab6bb61042b41cccf37a3" title="List of known block types contained in an Aaru image.">BlockType</a> for block type <a class="el" href="#a36fe923f8d67004e0b0ae8eaf6535e1d" title="Block type identifier.">identifier</a> constants </dd></dl>
<p class="definition">Definition at line <a class="el" href="tape_8h_source.html#l00237">237</a> of file <a class="el" href="tape_8h_source.html">tape.h</a>.</p>
</div><a name="doc-variable-members" id="doc-variable-members"></a><h2 id="header-doc-variable-members" class="groupheader">Field Documentation</h2>
<a id="a5172ee4bf0b5820a66d04aff1e3809db" name="a5172ee4bf0b5820a66d04aff1e3809db"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5172ee4bf0b5820a66d04aff1e3809db">&#9670;&#160;</a></span>crc64</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint64_t TapeFileHeader::crc64</td>
</tr>
</table>
</div><div class="memdoc">
<p>CRC64-ECMA checksum of the entry data. </p>
<p>Computed over the array of <a class="el" href="structTapeFileEntry.html" title="Describes a single logical file on a tape medium.">TapeFileEntry</a> structures only. Does NOT include this header. Used for integrity verification. </p>
<p class="definition">Definition at line <a class="el" href="tape_8h_source.html#l00245">245</a> of file <a class="el" href="tape_8h_source.html">tape.h</a>.</p>
<p class="reference">Referenced by <a class="el" href="tape_8c_source.html#l00126">process_tape_files_block()</a>, and <a class="el" href="close_8c_source.html#l02669">write_tape_file_block()</a>.</p>
</div>
</div>
<a id="a319aea86a448c0b969de944f22e551c0" name="a319aea86a448c0b969de944f22e551c0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a319aea86a448c0b969de944f22e551c0">&#9670;&#160;</a></span>entries</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t TapeFileHeader::entries</td>
</tr>
</table>
</div><div class="memdoc">
<p>Number of file entries following this header. </p>
<p>Specifies how many <a class="el" href="structTapeFileEntry.html" title="Describes a single logical file on a tape medium.">TapeFileEntry</a> structures are in this block. Valid range: 0 to 2^32-1. </p>
<p class="definition">Definition at line <a class="el" href="tape_8h_source.html#l00241">241</a> of file <a class="el" href="tape_8h_source.html">tape.h</a>.</p>
<p class="reference">Referenced by <a class="el" href="tape_8c_source.html#l00126">process_tape_files_block()</a>.</p>
</div>
</div>
<a id="a36fe923f8d67004e0b0ae8eaf6535e1d" name="a36fe923f8d67004e0b0ae8eaf6535e1d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a36fe923f8d67004e0b0ae8eaf6535e1d">&#9670;&#160;</a></span>identifier</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint32_t TapeFileHeader::identifier</td>
</tr>
</table>
</div><div class="memdoc">
<p>Block type identifier. </p>
<p>Must be set to BlockType::TapeFileBlock. This magic value allows parsers to identify the block type. </p>
<p class="definition">Definition at line <a class="el" href="tape_8h_source.html#l00239">239</a> of file <a class="el" href="tape_8h_source.html">tape.h</a>.</p>
<p class="reference">Referenced by <a class="el" href="tape_8c_source.html#l00126">process_tape_files_block()</a>, and <a class="el" href="close_8c_source.html#l02669">write_tape_file_block()</a>.</p>
</div>
</div>
<a id="a74b5289640a6c45eece7bd58550e59c0" name="a74b5289640a6c45eece7bd58550e59c0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a74b5289640a6c45eece7bd58550e59c0">&#9670;&#160;</a></span>length</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">uint64_t TapeFileHeader::length</td>
</tr>
</table>
</div><div class="memdoc">
<p>Size of entry data in bytes (excluding this header). </p>
<p>Calculated as: entries × sizeof(TapeFileEntry). This is the number of bytes following the header. </p>
<p class="definition">Definition at line <a class="el" href="tape_8h_source.html#l00243">243</a> of file <a class="el" href="tape_8h_source.html">tape.h</a>.</p>
<p class="reference">Referenced by <a class="el" href="close_8c_source.html#l02669">write_tape_file_block()</a>.</p>
</div>
</div>
<hr/>The documentation for this struct was generated from the following file:<ul>
<li>include/aaruformat/structs/<a class="el" href="tape_8h_source.html">tape.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="page-nav" class="page-nav-panel">
<div id="page-nav-resize-handle"></div>
<div id="page-nav-tree">
<div id="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a href="structTapeFileHeader.html">TapeFileHeader</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.14.0 </li>
</ul>
</div>
</body>
</html>