diff --git a/include/aaruformat/enums.h b/include/aaruformat/enums.h index c0a6ee7..fe2b3ef 100644 --- a/include/aaruformat/enums.h +++ b/include/aaruformat/enums.h @@ -141,6 +141,7 @@ typedef enum DataBlock = 0x4B4C4244, ///< Block containing data. DeDuplicationTable = 0x2A544444, ///< Block containing a deduplication table (v1). DeDuplicationTable2 = 0x32544444, ///< Block containing a deduplication table v2. + DeDuplicationTableSecondary = 0x53545444, ///< Block containing a secondary deduplication table (v2). IndexBlock = 0x58444E49, ///< Block containing the index (v1). IndexBlock2 = 0x32584449, ///< Block containing the index v2. IndexBlock3 = 0x33584449, ///< Block containing the index v3. diff --git a/src/close.c b/src/close.c index be4c208..4d3869c 100644 --- a/src/close.c +++ b/src/close.c @@ -106,7 +106,7 @@ static int32_t write_cached_secondary_ddt(aaruformat_context *ctx) // Prepare DDT header for the cached table DdtHeader2 ddt_header = {0}; - ddt_header.identifier = DeDuplicationTable2; + ddt_header.identifier = DeDuplicationTableSecondary; ddt_header.type = UserData; ddt_header.compression = ctx->compression_enabled ? Lzma : None; ddt_header.levels = ctx->user_data_ddt_header.levels; @@ -208,7 +208,8 @@ static int32_t write_cached_secondary_ddt(aaruformat_context *ctx) for(unsigned int k = 0; k < utarray_len(ctx->index_entries); k++) { entry = (IndexEntry *)utarray_eltptr(ctx->index_entries, k); - if(entry && entry->offset == ctx->cached_ddt_offset && entry->blockType == DeDuplicationTable2) + if(entry && entry->offset == ctx->cached_ddt_offset && + entry->blockType == DeDuplicationTableSecondary) { TRACE("Found old DDT index entry at position %u, removing", k); utarray_erase(ctx->index_entries, k, 1); @@ -219,7 +220,7 @@ static int32_t write_cached_secondary_ddt(aaruformat_context *ctx) // Add new index entry for the newly written secondary DDT IndexEntry new_ddt_entry; - new_ddt_entry.blockType = DeDuplicationTable2; + new_ddt_entry.blockType = DeDuplicationTableSecondary; new_ddt_entry.dataType = UserData; new_ddt_entry.offset = end_of_file; diff --git a/src/ddt/ddt_v2.c b/src/ddt/ddt_v2.c index f84fda8..66b43db 100644 --- a/src/ddt/ddt_v2.c +++ b/src/ddt/ddt_v2.c @@ -1202,7 +1202,7 @@ bool set_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bo // Prepare DDT header for the never-written cached table memset(&ddt_header, 0, sizeof(DdtHeader2)); - ddt_header.identifier = DeDuplicationTable2; + ddt_header.identifier = DeDuplicationTableSecondary; ddt_header.type = UserData; ddt_header.compression = ctx->compression_enabled ? Lzma : None; // Use no compression for simplicity ddt_header.levels = ctx->user_data_ddt_header.levels; @@ -1303,7 +1303,7 @@ bool set_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bo // Add index entry for the newly written secondary DDT IndexEntry new_ddt_entry; - new_ddt_entry.blockType = DeDuplicationTable2; + new_ddt_entry.blockType = DeDuplicationTableSecondary; new_ddt_entry.dataType = UserData; new_ddt_entry.offset = end_of_file; @@ -1376,7 +1376,7 @@ bool set_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bo // Prepare DDT header for the cached table memset(&ddt_header, 0, sizeof(DdtHeader2)); - ddt_header.identifier = DeDuplicationTable2; + ddt_header.identifier = DeDuplicationTableSecondary; ddt_header.type = UserData; ddt_header.compression = ctx->compression_enabled ? Lzma : None; ddt_header.levels = ctx->user_data_ddt_header.levels; @@ -1489,7 +1489,7 @@ bool set_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bo for(unsigned int i = 0; i < utarray_len(ctx->index_entries); i++) { entry = (IndexEntry *)utarray_eltptr(ctx->index_entries, i); - if(entry && entry->offset == ctx->cached_ddt_offset && entry->blockType == DeDuplicationTable2) + if(entry && entry->offset == ctx->cached_ddt_offset && entry->blockType == DeDuplicationTableSecondary) { TRACE("Found old DDT index entry at position %u, removing", i); utarray_erase(ctx->index_entries, i, 1); @@ -1500,7 +1500,7 @@ bool set_ddt_multi_level_v2(aaruformat_context *ctx, uint64_t sector_address, bo // Add new index entry for the newly written secondary DDT IndexEntry new_ddt_entry; - new_ddt_entry.blockType = DeDuplicationTable2; + new_ddt_entry.blockType = DeDuplicationTableSecondary; new_ddt_entry.dataType = UserData; new_ddt_entry.offset = end_of_file;