mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2025-12-16 11:14:39 +00:00
Read uncompressed DDT v1 into memory.
This commit is contained in:
@@ -217,26 +217,26 @@ int32_t process_ddt_v1(aaruformat_context *ctx, IndexEntry *entry, bool *found_u
|
|||||||
break;
|
break;
|
||||||
// TODO: Check CRC
|
// TODO: Check CRC
|
||||||
case None:
|
case None:
|
||||||
#ifdef __linux__
|
ctx->user_data_ddt = (uint64_t *)malloc(ddt_header.length);
|
||||||
TRACE("Memory mapping deduplication table at position %" PRIu64, entry->offset + sizeof(ddt_header));
|
if(ctx->user_data_ddt == NULL)
|
||||||
ctx->mapped_memory_ddt_size = sizeof(uint64_t) * ddt_header.entries;
|
|
||||||
ctx->user_data_ddt = mmap(NULL, ctx->mapped_memory_ddt_size, PROT_READ, MAP_SHARED,
|
|
||||||
fileno(ctx->imageStream), entry->offset + sizeof(ddt_header));
|
|
||||||
|
|
||||||
if(ctx->user_data_ddt == MAP_FAILED)
|
|
||||||
{
|
{
|
||||||
*found_user_data_ddt = false;
|
TRACE("Cannot allocate memory for DDT, continuing...");
|
||||||
FATAL("Could not read map deduplication table.");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx->in_memory_ddt = false;
|
read_bytes = fread(ctx->user_data_ddt, 1, ddt_header.entries * sizeof(uint64_t), ctx->imageStream);
|
||||||
|
|
||||||
|
if(read_bytes != ddt_header.entries * sizeof(uint64_t))
|
||||||
|
{
|
||||||
|
free(ctx->user_data_ddt);
|
||||||
|
TRACE("Could not read deduplication table, continuing...");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx->in_memory_ddt = true;
|
||||||
|
*found_user_data_ddt = true;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#else // TODO: Implement
|
|
||||||
TRACE("Uncompressed DDT not yet implemented...");
|
|
||||||
*found_user_data_ddt = false;
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
default:
|
default:
|
||||||
TRACE("Found unknown compression type %d, continuing...", ddt_header.compression);
|
TRACE("Found unknown compression type %d, continuing...", ddt_header.compression);
|
||||||
*found_user_data_ddt = false;
|
*found_user_data_ddt = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user