Add cachedDdtPosition to track primary DDT position for new tables

This commit is contained in:
2025-09-28 19:44:15 +01:00
parent c2c9d9f7d4
commit ed665ee763
2 changed files with 4 additions and 1 deletions

View File

@@ -115,6 +115,7 @@ typedef struct aaruformatContext
uint16_t *sectorPrefixDdtMini;
uint16_t *sectorSuffixDdtMini;
uint64_t cachedDdtOffset;
uint64_t cachedDdtPosition;
uint64_t primaryDdtOffset;
uint16_t *cachedSecondaryDdtSmall;
uint32_t *cachedSecondaryDdtBig;

View File

@@ -1138,7 +1138,9 @@ void set_ddt_multi_level_v2(aaruformatContext *ctx, uint64_t sectorAddress, bool
else
ctx->cachedSecondaryDdtBig = (uint32_t *)buffer;
ctx->cachedDdtOffset = 0; // Will be set when written to file
ctx->cachedDdtOffset = 0; // Will be set when written to file
ctx->cachedDdtPosition = ddtPosition; // Track which primary DDT position this new table belongs to
TRACE("Created new secondary DDT for position %" PRIu64, ddtPosition);
}
// Step 6: Update the corresponding DDT entry