<trclass="memdesc:a1caeae710ee5e1dd356e43b3b659e9c0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Processes a DDT v2 block from the image stream. <br/></td></tr>
<trclass="memdesc:ab8d599dac0c84517fa72c757d5d753c0"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decodes a DDT v2 entry for a given sector address. <br/></td></tr>
<trclass="memdesc:a40c571bc4778040f22ac211cea670db1"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decodes a single-level DDT v2 entry for a given sector address. <br/></td></tr>
<trclass="memdesc:a83aff4d408ab17f8f350cb03b0e12ef6"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Decodes a multi-level DDT v2 entry for a given sector address. <br/></td></tr>
<trclass="memdesc:a6d6ee0e6c255449cb9c2528f0f8398ec"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets a DDT v2 entry for a given sector address. <br/></td></tr>
<trclass="memdesc:a9583b5975c5c0b81902681c07d6f737f"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets a single-level DDT v2 entry for a given sector address. <br/></td></tr>
<trclass="memdesc:a69ff2e68fe4d92a2d2d469ac69f41d82"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets a multi-level DDT v2 entry for a given sector address. <br/></td></tr>
<trclass="memdesc:a40a8f87e97248615429d232ca9fb599b"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Sets a DDT entry for tape media using a hash-based lookup table. <br/></td></tr>
<p>Decodes a DDT v2 entry for a given sector address. </p>
<p>Determines the offset and block offset for a sector using the DDT v2 table(s). This function acts as a dispatcher that automatically selects between single-level and multi-level DDT decoding based on the tableShift parameter in the DDT header. It provides a unified interface for DDT v2 entry decoding regardless of the underlying table structure complexity.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">ctx</td><td>Pointer to the aaruformat context containing the loaded DDT structures. </td></tr>
<tr><tdclass="paramname">sector_address</td><td>Logical sector address to decode (will be adjusted for negative sectors). </td></tr>
<tr><tdclass="paramname">negative</td><td>Indicates if the sector address is negative. </td></tr>
<tr><tdclass="paramname">offset</td><td>Pointer to store the resulting sector offset within the block. </td></tr>
<tr><tdclass="paramname">block_offset</td><td>Pointer to store the resulting block offset in the image. </td></tr>
<tr><tdclass="paramname">sector_status</td><td>Pointer to store the sector status (dumped, not dumped, etc.).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully decoded the DDT entry. This is always returned when:<ul>
<li>The context and image stream are valid</li>
<li>The appropriate decoding function (single-level or multi-level) completes successfully</li>
<li>All output parameters are properly populated with decoded values</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context or image stream is invalid (NULL pointers). This is the only error condition that can occur at this dispatcher level.</td></tr>
<tr><tdclass="paramname">Other</td><td>error codes may be returned by the underlying decoding functions:<ul>
<li>From <aclass="el"href="#a40c571bc4778040f22ac211cea670db1"title="Decodes a single-level DDT v2 entry for a given sector address.">decode_ddt_single_level_v2()</a>: AARUF_ERROR_CANNOT_READ_BLOCK (-7)</li>
<li>From <aclass="el"href="#a83aff4d408ab17f8f350cb03b0e12ef6"title="Decodes a multi-level DDT v2 entry for a given sector address.">decode_ddt_multi_level_v2()</a>: AARUF_ERROR_CANNOT_READ_BLOCK (-7), AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK (-17), AARUF_ERROR_INVALID_BLOCK_CRC (-18)</li>
<li>The tableShift parameter is read from ctx->userDataDdtHeader.tableShift</li>
</ul>
</dd>
<dd>
This function performs minimal validation and primarily acts as a dispatcher. Most error conditions and complex logic are handled by the underlying functions.</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The function assumes the DDT has been properly loaded by <aclass="el"href="#a1caeae710ee5e1dd356e43b3b659e9c0"title="Processes a DDT v2 block from the image stream.">process_ddt_v2()</a>. Calling this function with an uninitialized or corrupted DDT will result in undefined behavior from the underlying decoding functions.</dd>
<dd>
All output parameters must be valid pointers. No bounds checking is performed on the sector_address parameter at this level. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="ddt__v2_8c_source.html#l00507">507</a> of file <aclass="el"href="ddt__v2_8c_source.html">ddt_v2.c</a>.</p>
<pclass="reference">References <aclass="el"href="errors_8h_source.html#l00040">AARUF_ERROR_NOT_AARUFORMAT</a>, <aclass="el"href="ddt__v2_8c_source.html#l00724">decode_ddt_multi_level_v2()</a>, <aclass="el"href="ddt__v2_8c_source.html#l00581">decode_ddt_single_level_v2()</a>, <aclass="el"href="log_8h_source.html#l00040">FATAL</a>, <aclass="el"href="context_8h_source.html#l00176">aaruformat_context::imageStream</a>, <aclass="el"href="ddt_8h_source.html#l00156">DdtHeader2::tableShift</a>, <aclass="el"href="log_8h_source.html#l00025">TRACE</a>, and <aclass="el"href="context_8h_source.html#l00189">aaruformat_context::user_data_ddt_header</a>.</p>
<p>Decodes a multi-level DDT v2 entry for a given sector address. </p>
<p>Used when the DDT table uses multi-level indirection (tableShift > 0). This function handles the complex process of navigating a hierarchical DDT structure where the primary table points to secondary tables that contain the actual sector mappings. It includes caching mechanisms for secondary tables, supports both compressed and uncompressed secondary tables, and performs comprehensive validation including CRC verification.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">ctx</td><td>Pointer to the aaruformat context containing the loaded primary DDT table. </td></tr>
<tr><tdclass="paramname">sector_address</td><td>Logical sector address to decode (adjusted for negative sectors). </td></tr>
<tr><tdclass="paramname">negative</td><td>Indicates if the sector address is negative. </td></tr>
<tr><tdclass="paramname">offset</td><td>Pointer to store the resulting sector offset within the block. </td></tr>
<tr><tdclass="paramname">block_offset</td><td>Pointer to store the resulting block offset in the image. </td></tr>
<tr><tdclass="paramname">sector_status</td><td>Pointer to store the sector status (dumped, not dumped, etc.).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully decoded the DDT entry. This is returned when:<ul>
<li>The context and image stream are valid</li>
<li>The tableShift validation passes (must be > 0)</li>
<li>The DDT size type is recognized (SmallDdtSizeType or BigDdtSizeType)</li>
<li>Secondary DDT table is successfully loaded (from cache or file)</li>
<li>Uses tableShift to calculate items per DDT entry (2^tableShift)</li>
<li>Calculates DDT position by dividing sector address by items per entry</li>
<li>Retrieves secondary DDT offset from primary table at calculated position</li>
<li>Converts block offset to file offset using blockAlignmentShift</li>
</ul>
</dd>
<dd>
Secondary DDT Caching:<ul>
<li>Maintains a single cached secondary DDT in memory (ctx->cachedSecondaryDdtSmall/Big)</li>
<li>Compares requested offset with cached offset (ctx->cachedDdtOffset)</li>
<li>Only loads from disk if the requested secondary DDT is not currently cached</li>
<li>Caching improves performance for sequential sector access patterns</li>
</ul>
</dd>
<dd>
Secondary DDT Processing:<ul>
<li>Supports both LZMA compression and uncompressed formats</li>
<li>Performs full CRC64 validation of secondary DDT data</li>
<li>Same bit manipulation as single-level DDT for final entry decoding</li>
</ul>
</dd>
<dd>
Error Handling Strategy:<ul>
<li>Memory allocation failures for secondary DDT loading are treated as critical errors</li>
<li>File I/O errors and validation failures cause immediate function termination</li>
<li>Unknown compression types are treated as errors (unlike the processing functions)</li>
<li>All allocated memory is cleaned up on error conditions</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>This function should only be called when tableShift > 0. Calling it with tableShift = 0 will result in AARUF_ERROR_CANNOT_READ_BLOCK.</dd>
<dd>
The function assumes the primary DDT table has been properly loaded and is accessible via ctx->userDataDdtMini or ctx->userDataDdtBig depending on size type.</dd>
<dd>
Secondary DDT caching means that memory usage can increase during operation. The cached secondary DDT is replaced when a different secondary table is needed.</dd>
<dd>
No bounds checking is performed on sector_address or calculated DDT positions. Accessing beyond table boundaries will result in undefined behavior. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="ddt__v2_8c_source.html#l00724">724</a> of file <aclass="el"href="ddt__v2_8c_source.html">ddt_v2.c</a>.</p>
<p>Decodes a single-level DDT v2 entry for a given sector address. </p>
<p>Used when the DDT table does not use multi-level indirection (tableShift = 0). This function performs direct lookup in the primary DDT table to extract sector offset, block offset, and sector status information. It performs bit manipulation to decode the packed DDT entry values.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">ctx</td><td>Pointer to the aaruformat context containing the loaded DDT table. </td></tr>
<tr><tdclass="paramname">sector_address</td><td>Logical sector address to decode (adjusted for negative sectors). </td></tr>
<tr><tdclass="paramname">negative</td><td>Indicates if the sector address is negative. </td></tr>
<tr><tdclass="paramname">offset</td><td>Pointer to store the resulting sector offset within the block. </td></tr>
<tr><tdclass="paramname">block_offset</td><td>Pointer to store the resulting block offset in the image. </td></tr>
<tr><tdclass="paramname">sector_status</td><td>Pointer to store the sector status (dumped, not dumped, etc.).</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully decoded the DDT entry. This is always returned when:<ul>
<li>The context and image stream are valid</li>
<li>The tableShift validation passes (must be 0)</li>
<li>The DDT size type is recognized (SmallDdtSizeType or BigDdtSizeType)</li>
<li>The DDT entry is successfully extracted and decoded</li>
<li>All output parameters are properly populated with decoded values</li>
<li>Zero DDT entries are handled (indicates sector not dumped)</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context or image stream is invalid (NULL pointers).</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_CANNOT_READ_BLOCK</td><td>(-7) Configuration or validation errors. This occurs when:<ul>
<li>The tableShift is not zero (should use multi-level decoding instead)</li>
<li>The DDT size type is unknown/unsupported (not SmallDdtSizeType or BigDdtSizeType)</li>
<li>Bits 60-0: Combined offset and block index (60 bits)</li>
<li>Offset mask: Derived from dataShift parameter</li>
<li>Block offset: Calculated using blockAlignmentShift parameter</li>
</ul>
</dd>
<dd>
Negative Sector Handling:<ul>
<li>Sector address is automatically adjusted by adding ctx->userDataDdtHeader.negative</li>
<li>This allows proper indexing into the DDT table for negative sector addresses</li>
</ul>
</dd>
<dd>
Zero Entry Handling:<ul>
<li>A zero DDT entry indicates the sector was not dumped</li>
<li>Sets sector_status to SectorStatusNotDumped and zeros offset/block_offset</li>
<li>This is a normal condition and not an error</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The function assumes the DDT table has been properly loaded and is accessible via ctx->userDataDdtMini or ctx->userDataDdtBig depending on size type.</dd>
<dd>
No bounds checking is performed on sector_address. Accessing beyond the DDT table boundaries will result in undefined behavior.</dd>
<dd>
This function should only be called when tableShift is 0. Calling it with tableShift > 0 will result in AARUF_ERROR_CANNOT_READ_BLOCK. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="ddt__v2_8c_source.html#l00581">581</a> of file <aclass="el"href="ddt__v2_8c_source.html">ddt_v2.c</a>.</p>
<p>Processes a DDT v2 block from the image stream. </p>
<p>Reads and decompresses (if needed) a DDT v2 block, verifies its CRC, and loads it into memory. This function handles both user data DDT blocks and CD sector prefix/suffix corrected DDT blocks, supporting both LZMA compression and uncompressed formats. It performs CRC64 validation and stores the processed DDT data in the appropriate context fields based on size type (small/big).</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">ctx</td><td>Pointer to the aaruformat context. </td></tr>
<tr><tdclass="paramname">entry</td><td>Pointer to the index entry describing the DDT block. </td></tr>
<tr><tdclass="paramname">found_user_data_ddt</td><td>Pointer to a boolean that will be set to true if a user data DDT was found and loaded.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">AARUF_STATUS_OK</td><td>(0) Successfully processed the DDT block. This is returned when:<ul>
<li>The DDT block is successfully read, decompressed (if needed), and loaded into memory</li>
<li>CRC64 validation passes for the DDT data</li>
<li>User data DDT blocks are processed and context is properly updated</li>
<li>CD sector prefix/suffix corrected DDT blocks are processed successfully</li>
<li>Memory allocation failures occur for non-critical operations (processing continues)</li>
<li>File reading errors occur for compressed data or LZMA properties (processing continues)</li>
<li>Unknown compression types are encountered (block is skipped)</li>
</ul>
</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>(-1) The context or image stream is invalid (NULL pointers).</td></tr>
<tr><tdclass="paramname">AARUF_ERROR_CANNOT_READ_BLOCK</td><td>(-7) Failed to access the DDT block in the image stream. This occurs when:<ul>
<li>fseek() fails to position at the DDT block offset</li>
<li>The file position doesn't match the expected offset after seeking</li>
<li>Failed to read the DDT header from the image stream</li>
<li>The number of bytes read for the DDT header is insufficient</li>
<li>The found_user_data_ddt flag is updated to reflect the success of user data DDT loading</li>
</ul>
</dd>
<dd>
DDT v2 Features:<ul>
<li>Handles multi-level DDT hierarchies with tableShift parameter</li>
<li>Updates context with sector counts, DDT version, and primary DDT offset</li>
<li>Stores DDT data in size-appropriate context fields (userDataDdtMini/Big, sectorPrefixDdt, etc.)</li>
</ul>
</dd>
<dd>
Memory Management:<ul>
<li>Allocated DDT data is stored in the context and becomes part of the context lifecycle</li>
<li>Memory is automatically cleaned up on decompression or CRC validation errors</li>
<li>Buffer memory is reused for the final DDT data storage (no double allocation)</li>
</ul>
</dd>
<dd>
CRC Validation:<ul>
<li>All DDT blocks undergo CRC64 validation regardless of compression type</li>
<li>CRC is calculated on the final decompressed data</li>
<li>Uses standard CRC64 calculation (no version-specific endianness conversion like v1)</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The function modifies context state including sector count, DDT version, and primary DDT offset. Ensure proper context cleanup when the function completes.</dd>
<dd>
Memory allocated for DDT data becomes part of the context and should not be freed separately. The context cleanup functions will handle DDT memory deallocation. </dd></dl>
<pclass="definition">Definition at line <aclass="el"href="ddt__v2_8c_source.html#l00096">96</a> of file <aclass="el"href="ddt__v2_8c_source.html">ddt_v2.c</a>.</p>
<p>Sets a DDT v2 entry for a given sector address. </p>
<p>Updates the DDT v2 table(s) with the specified offset, block offset, and sector status for a sector.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">ctx</td><td>Pointer to the aaruformat context. </td></tr>
<tr><tdclass="paramname">sector_address</td><td>Logical sector address to set. </td></tr>
<tr><tdclass="paramname">negative</td><td>Indicates if the sector address is negative. </td></tr>
<tr><tdclass="paramname">offset</td><td>Offset to set for the sector. </td></tr>
<tr><tdclass="paramname">block_offset</td><td>Block offset to set for the sector. </td></tr>
<tr><tdclass="paramname">sector_status</td><td>Status to set for the sector. </td></tr>
<tr><tdclass="paramname">ddt_entry</td><td>Existing DDT entry or 0 to create a new one. If 0, a new entry is returned.</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">true</td><td>if the entry was set successfully, false otherwise. </td></tr>
</table>
</dd>
</dl>
<pclass="definition">Definition at line <aclass="el"href="ddt__v2_8c_source.html#l00988">988</a> of file <aclass="el"href="ddt__v2_8c_source.html">ddt_v2.c</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="ddt__v2_8c_source.html#l01096">1096</a> of file <aclass="el"href="ddt__v2_8c_source.html">ddt_v2.c</a>.</p>
<pclass="definition">Definition at line <aclass="el"href="ddt__v2_8c_source.html#l01024">1024</a> of file <aclass="el"href="ddt__v2_8c_source.html">ddt_v2.c</a>.</p>
<p>Sets a DDT entry for tape media using a hash-based lookup table. </p>
<p>This function is specifically designed for tape media images where sectors are accessed non-sequentially and the traditional DDT array structure is inefficient. Instead of using a large contiguous array, it uses a hash table (UTHASH) to store only the sectors that have been written, providing sparse storage for tape media.</p>
<p>The function performs the following operations:</p><oltype="1">
<li>Validates the context and verifies it's a tape image</li>
<li>Constructs a DDT entry encoding offset, block alignment, and sector status</li>
<li>Creates a hash table entry with the sector address as the key</li>
<li>Inserts or replaces the entry in the tape DDT hash table</li>
</ol>
<p><b>DDT Entry Format:</b> The DDT entry is a 64-bit value with the following bit layout: </p><divclass="fragment"><divclass="line">Bits 0-(dataShift-1): Sector offset within block (masked by dataShift)</div>
<divclass="line">Bits dataShift-27: Block index (block_offset >> blockAlignmentShift)</div>
<divclass="line">Bits 28-31: Sector status (4 bits for status flags)</div>
<divclass="line">Bits 32-63: Unused (reserved for future use)</div>
</div><!-- fragment --><p><b>Hash Table Management:</b> Uses HASH_REPLACE macro from UTHASH library which:</p><ul>
<li>Adds new entries if the key (sector_address) doesn't exist</li>
<li>Replaces existing entries if the key is found (automatically frees old entry)</li>
<li>Maintains O(1) average lookup time for sector address resolution</li>
</ul>
<p><b>Overflow Detection:</b> The function checks if the constructed DDT entry exceeds 28 bits (0xFFFFFFF). This limit ensures the sector status can fit in the upper 4 bits while leaving room for future extensions in the upper 32 bits.</p>
<dlclass="params"><dt>Parameters</dt><dd>
<tableclass="params">
<tr><tdclass="paramname">ctx</td><td>Pointer to the aaruformat context. Must not be NULL. The context must have a valid imageStream and is_tape must be true. The ctx->tapeDdt hash table will be updated with the new entry. The ctx->userDataDdtHeader contains alignment and shift parameters.</td></tr>
<tr><tdclass="paramname">sector_address</td><td>Logical sector address on the tape to set. This serves as the unique key in the hash table. Multiple calls with the same sector_address will replace the previous entry.</td></tr>
<tr><tdclass="paramname">offset</td><td>Byte offset within the aligned block where the sector data begins. This value is masked by (1 << dataShift) - 1 to extract only the lower bits representing the offset within the block.</td></tr>
<tr><tdclass="paramname">block_offset</td><td>Absolute byte offset in the image file where the data block starts. This is right-shifted by blockAlignmentShift to get the block index, which is stored in the DDT entry's middle bits.</td></tr>
<tr><tdclass="paramname">sector_status</td><td>Status flags for the sector (4 bits). Common values include:<ul>
<li>0x0 (SectorStatusNotDumped): Sector not yet acquired during image dumping</li>
<li>0x1 (SectorStatusDumped): Sector successfully dumped without error</li>
<li>0x2 (SectorStatusErrored): Error during dumping; data may be incomplete or corrupt</li>
<li>0x3 (SectorStatusMode1Correct): Valid MODE 1 data with regenerable suffix/prefix</li>
<li>0x4 (SectorStatusMode2Form1Ok): Suffix verified/regenerable for MODE 2 Form 1</li>
<li>0x5 (SectorStatusMode2Form2Ok): Suffix matches MODE 2 Form 2 with valid CRC</li>
<li>0x6 (SectorStatusMode2Form2NoCrc): Suffix matches MODE 2 Form 2 but CRC empty/missing</li>
<li>0x7 (SectorStatusTwin): Pointer references a twin sector table</li>
<li>0x9 (SectorStatusEncrypted): Content encrypted and stored encrypted in image</li>
<li>0xA (SectorStatusUnencrypted): Content originally encrypted but stored decrypted in image See <aclass="el"href="enums_8h.html#a74e216af87b18a5fbf0204a52dd1bba0"title="Acquisition / content status for one or more sectors.">SectorStatus</a> enum for complete list of defined values</li>
</ul>
</td></tr>
<tr><tdclass="paramname">ddt_entry</td><td>Pointer to a 64-bit value that will receive the constructed DDT entry.<ul>
<li>If *ddt_entry is 0: A new entry is constructed from the provided parameters</li>
<li>If *ddt_entry is non-zero: The existing value is used directly The constructed or provided value is stored in the hash table.</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section return"><dt>Returns</dt><dd>Returns one of the following status codes: </dd></dl>
<dlclass="retval"><dt>Return values</dt><dd>
<tableclass="retval">
<tr><tdclass="paramname">true</td><td>Successfully created and inserted the DDT entry. This occurs when:<ul>
<li>The context and image stream are valid</li>
<li>The image is confirmed to be a tape image (is_tape == true)</li>
<li>The DDT entry fits within the 28-bit limit (< 0xFFFFFFF)</li>
<li>Memory allocation for the hash entry succeeds</li>
<li>The entry is successfully inserted or replaced in the hash table</li>
</ul>
</td></tr>
<tr><tdclass="paramname">false</td><td>Failed to set the DDT entry. This can happen when:<ul>
<li>ctx is NULL or ctx->imageStream is NULL (invalid context)</li>
<li>ctx->is_tape is false (wrong function called for non-tape media)</li>
<li>The DDT entry exceeds 0xFFFFFFF (media too large for big DDT)</li>
<li>Memory allocation fails for the new hash table entry (out of memory)</li>
</ul>
</td></tr>
</table>
</dd>
</dl>
<dlclass="section note"><dt>Note</dt><dd>This function is only for tape images. For disk images, use <aclass="el"href="#a9583b5975c5c0b81902681c07d6f737f"title="Sets a single-level DDT v2 entry for a given sector address.">set_ddt_single_level_v2()</a> or <aclass="el"href="#a69ff2e68fe4d92a2d2d469ac69f41d82"title="Sets a multi-level DDT v2 entry for a given sector address.">set_ddt_multi_level_v2()</a> instead, which use array-based DDT structures.</dd>
<dd>
Memory Management:<ul>
<li>Allocates a new <aclass="el"href="structTapeDdtHashEntry.html">TapeDdtHashEntry</a> for each sector</li>
<li>All hash entries remain in context until cleanup</li>
<li>The tapeDdt hash table must be freed during context destruction</li>
</ul>
</dd>
<dd>
Tape Media Characteristics:<ul>
<li>Tape sectors are typically accessed sequentially during streaming</li>
<li>File marks and partition boundaries create sparse address spaces</li>
<li>Hash table provides efficient storage for sparse sector maps</li>
<li>Supports variable block sizes common in tape formats</li>
</ul>
</dd>
<dd>
Error Handling:<ul>
<li>All errors are logged with FATAL level messages</li>
<li>Function returns false immediately on any error condition</li>
<li>TRACE logging marks entry/exit points for debugging</li>
<li>No partial state changes occur on failure</li>
</ul>
</dd></dl>
<dlclass="section warning"><dt>Warning</dt><dd>The DDT entry overflow check at 0xFFFFFFF (28 bits) is critical. Exceeding this limit indicates the media is too large to fit in the current DDT format, and continuing would cause data corruption.</dd>
<dd>
This function modifies the shared tapeDdt hash table. In multi-threaded environments, external synchronization is required to prevent race conditions.</dd></dl>
<dlclass="section see"><dt>See also</dt><dd><aclass="el"href="structTapeDdtHashEntry.html">TapeDdtHashEntry</a> for the hash table entry structure </dd>
<aclass="el"href="#a6d6ee0e6c255449cb9c2528f0f8398ec"title="Sets a DDT v2 entry for a given sector address.">set_ddt_entry_v2()</a> for the main DDT entry point that dispatches to this function </dd>
<pclass="definition">Definition at line <aclass="el"href="ddt__v2_8c_source.html#l01782">1782</a> of file <aclass="el"href="ddt__v2_8c_source.html">ddt_v2.c</a>.</p>
<liclass="footer">Generated by <ahref="https://www.doxygen.org/index.html"><imgclass="footer"src="doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.14.0 </li>