if (strcmp (&Footer.Magic[0], AFF_SEGMENT_FOOTER_MAGIC) != 0)
return AAFF_INVALID_FOOTER;
return AAFF_OK;
}
-static int AaffReadSegmentPage (t_pAaff pAaff, unsigned long long SearchPage, unsigned long long *pFoundPage, unsigned char **ppData, unsigned int *pDataLen)
- unsigned long long Nr; // The table's position in the pAewf->pTableArr, for debug output only
- unsigned long long ChunkFrom; // Number of the chunk referred to by the first entry of this table (very first chunk has number 0)
- unsigned long long ChunkTo; // Number of the chunk referred to by the last entry of this table
- t_pSegment pSegment; // The file segment where the table is located
- unsigned long long Offset; // The offset of the table inside the segment file (start of t_AewfSectionTable, not of the preceding t_AewfSection)
- unsigned long Size; // The length of the table (same as allocated length for pEwfTable)
- unsigned int ChunkCount; // The number of chunk; this is the same as pTableData->Chunkcount, however, pTableData might not be available (NULL)
- unsigned int SectionSectorsSize; // Silly EWF format has no clean way of knowing size of the last (possibly compressed) chunk of a table
- time_t LastUsed; // Last usage of this table, for cache management
- t_pAewfSectionTable pEwfTable; // Contains the original EWF table section or NULL, if never read or kicked out from cache
-} t_Table, *t_pTable;
-
-typedef struct _t_Aewf
-{
- t_pSegment pSegmentArr; // Array of all segment files (in correct order)
- t_pTable pTableArr; // Array of all chunk offset tables found in the segment files (in correct order)
- unsigned Segments;
- unsigned Tables;
- unsigned long long Chunks; // Total number of chunks in all tables
- unsigned long long TableCache; // Current amount RAM used by tables, in bytes
- unsigned long long OpenSegments; // Current number of open segment files
- unsigned long long SectorSize;
- unsigned long long Sectors;
- unsigned long long ChunkSize;
- unsigned long long ImageSize; // Equals to Sectors * SectorSize
- unsigned char *pChunkBuffCompressed;
- unsigned char *pChunkBuffUncompressed;
- unsigned long long ChunkBuffUncompressedDataLen; // This normally always is equal to the chunk size (32K), except maybe for the last chunk, if the image's total size is not a multiple of the chunk size
- unsigned int ChunkBuffSize;
- unsigned long long ChunkInBuff; // Chunk currently residing in pChunkBuffUncompressed
- char *pErrorText; // Used for assembling error text during option parsing
- time_t LastStatsUpdate;
- char *pInfo;
-
- // Statistics
- unsigned long long SegmentCacheHits;
- unsigned long long SegmentCacheMisses;
- unsigned long long TableCacheHits;
- unsigned long long TableCacheMisses;
- unsigned long long ChunkCacheHits;
- unsigned long long ChunkCacheMisses;
- unsigned long long ReadOperations; // How many times did xmount call the function AewfRead
- unsigned long long DataReadFromImage; // The data (in bytes) read from the image
- unsigned long long DataReadFromImageRaw; // The same data (in bytes), after uncompression (if any)
- unsigned long long DataRequestedByCaller; // How much data was given back to the caller
- unsigned long long TablesReadFromImage; // The overhead of the table read operations (in bytes)
-
- unsigned long long ChunksRead;
- unsigned long long BytesRead;
-
- // Options
- unsigned long long MaxTableCache; // Max. amount of bytes in pTableArr[x].pTableData, in bytes
- unsigned long long MaxOpenSegments; // Max. number of open files in pSegmentArr
- char *pStatsFilename; // Statistics file
- unsigned long long StatsRefresh; // The time in seconds between update of the stats file
DEBUG_PRINTF ("%lld sectors à %lld bytes", pAewf->Sectors, pAewf->SectorSize)
}
LastSection = (Pos == Section.OffsetNextSection);
Pos = Section.OffsetNextSection;
} while (!LastSection);
DEBUG_PRINTF ("\n");
CHK (CloseFile (&pFile))
}
if (pVolume == NULL)
return AEWF_VOLUME_MISSING;
if (pAewf->Chunks != pVolume->ChunkCount)
return AEWF_WRONG_CHUNK_COUNT;
pAewf->ChunkBuffSize = pAewf->ChunkSize + 4096; // reserve some extra space (for CRC and as compressed data might be slightly larger than uncompressed data with some imagers)
+ FILE *pFile; // NULL if file is not opened (never read or kicked out form cache)
+ time_t LastUsed;
+} t_Segment, *t_pSegment;
+
+typedef struct
+{
+ uint64_t Nr; // The table's position in the pAewf->pTableArr, for debug output only
+ uint64_t ChunkFrom; // Number of the chunk referred to by the first entry of this table (very first chunk has number 0)
+ uint64_t ChunkTo; // Number of the chunk referred to by the last entry of this table
+ t_pSegment pSegment; // The file segment where the table is located
+ uint64_t Offset; // The offset of the table inside the segment file (start of t_AewfSectionTable, not of the preceding t_AewfSection)
+ unsigned long Size; // The length of the table (same as allocated length for pEwfTable)
+ unsigned int ChunkCount; // The number of chunk; this is the same as pTableData->Chunkcount, however, pTableData might not be available (NULL)
+ unsigned int SectionSectorsSize; // Silly EWF format has no clean way of knowing size of the last (possibly compressed) chunk of a table
+ time_t LastUsed; // Last usage of this table, for cache management
+ t_pAewfSectionTable pEwfTable; // Contains the original EWF table section or NULL, if never read or kicked out from cache
+} t_Table, *t_pTable;
+
+typedef struct _t_Aewf
+{
+ t_pSegment pSegmentArr; // Array of all segment files (in correct order)
+ t_pTable pTableArr; // Array of all chunk offset tables found in the segment files (in correct order)
+ unsigned Segments;
+ unsigned Tables;
+ uint64_t Chunks; // Total number of chunks in all tables
+ uint64_t TableCache; // Current amount RAM used by tables, in bytes
+ uint64_t OpenSegments; // Current number of open segment files
+ uint64_t SectorSize;
+ uint64_t Sectors;
+ uint64_t ChunkSize;
+ uint64_t ImageSize; // Equals to Sectors * SectorSize
+ char *pChunkBuffCompressed;
+ char *pChunkBuffUncompressed;
+ uint64_t ChunkBuffUncompressedDataLen; // This normally always is equal to the chunk size (32K), except maybe for the last chunk, if the image's total size is not a multiple of the chunk size
+ unsigned int ChunkBuffSize;
+ uint64_t ChunkInBuff; // Chunk currently residing in pChunkBuffUncompressed
+ char *pErrorText; // Used for assembling error text during option parsing
+ time_t LastStatsUpdate;
+ char *pInfo;
+
+ // Statistics
+ uint64_t SegmentCacheHits;
+ uint64_t SegmentCacheMisses;
+ uint64_t TableCacheHits;
+ uint64_t TableCacheMisses;
+ uint64_t ChunkCacheHits;
+ uint64_t ChunkCacheMisses;
+ uint64_t ReadOperations; // How many times did xmount call the function AewfRead
+ uint64_t DataReadFromImage; // The data (in bytes) read from the image
+ uint64_t DataReadFromImageRaw; // The same data (in bytes), after uncompression (if any)
+ uint64_t DataRequestedByCaller; // How much data was given back to the caller
+ uint64_t TablesReadFromImage; // The overhead of the table read operations (in bytes)
+
+ uint64_t ChunksRead;
+ uint64_t BytesRead;
+
+ // Options
+ uint64_t MaxTableCache; // Max. amount of bytes in pTableArr[x].pTableData, in bytes
+ uint64_t MaxOpenSegments; // Max. number of open files in pSegmentArr
+ char *pStatsFilename; // Statistics file
+ uint64_t StatsRefresh; // The time in seconds between update of the stats file
asprintf (&pdd->pInfo, "dd image made of %u pieces, %llu bytes in total (%0.3f GiB)", pdd->Pieces, pdd->TotalSize, pdd->TotalSize / (1024.0*1024.0*1024.0));