mirror of
https://github.com/aaru-dps/libaaruformat.git
synced 2026-02-04 05:24:56 +00:00
Repurpose two unused header fields to store biggest image sector size.
This commit is contained in:
@@ -117,8 +117,7 @@ typedef struct AaruHeaderV2
|
||||
int64_t lastWrittenTime; ///< Last modification FILETIME (100 ns since 1601-01-01 UTC).
|
||||
uint8_t guid[GUID_SIZE]; ///< 128-bit image GUID (binary, not text); stable across children.
|
||||
uint8_t blockAlignmentShift; ///< log2 block alignment (block size alignment = 2^blockAlignmentShift bytes).
|
||||
uint8_t dataShift; ///< log2 sectors/items per block-index increment in DDT entries (2^dataShift).
|
||||
uint8_t tableShift; ///< log2 sectors spanned by each primary DDT entry (0 = single-level).
|
||||
uint16_t biggestSectorSize; ///< size of biggest sector in the image (in bytes).
|
||||
uint64_t featureCompatible; ///< Feature bits: unimplemented bits are ignorable (still R/W safe).
|
||||
uint64_t featureCompatibleRo; ///< Feature bits: unimplemented -> degrade to read-only access.
|
||||
uint64_t featureIncompatible; ///< Feature bits: any unimplemented -> abort (cannot open safely).
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <errno.h>
|
||||
#include <limits.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@@ -146,6 +147,8 @@ AARU_EXPORT int32_t AARU_CALL aaruf_write_sector(void *context, uint64_t sector_
|
||||
return AARUF_ERROR_SECTOR_OUT_OF_BOUNDS;
|
||||
}
|
||||
|
||||
if(length > ctx->header.biggestSectorSize) ctx->header.biggestSectorSize = (uint16_t)length;
|
||||
|
||||
if(!ctx->rewinded)
|
||||
{
|
||||
if(sector_address <= ctx->last_written_block)
|
||||
|
||||
@@ -784,8 +784,7 @@ typedef struct
|
||||
{
|
||||
GUID guid;
|
||||
byte blockAlignmentShift;
|
||||
byte dataShift;
|
||||
byte tableShift;
|
||||
uint16 biggestSectorSize;
|
||||
FeaturesCompatible featureCompatible;
|
||||
uint64 featureCompatibleRo;
|
||||
uint64 featureIncompatible;
|
||||
|
||||
@@ -811,8 +811,7 @@ struct AaruHeader
|
||||
{
|
||||
type::GUID guid;
|
||||
u8 blockAlignmentShift;
|
||||
u8 dataShift;
|
||||
u8 tableShift;
|
||||
u16 biggestSectorSize;
|
||||
u64 featureCompatible;
|
||||
u64 featureCompatibleRo;
|
||||
u64 featureIncompatible;
|
||||
|
||||
@@ -106,8 +106,7 @@ int upgrade_ddt_to_alpha21(const char *path)
|
||||
printf(" Index offset: %llu bytes\n", (unsigned long long)header.indexOffset);
|
||||
printf(" Media type: %u (%s)\n", header.mediaType, media_type_to_string(header.mediaType));
|
||||
printf(" Block alignment shift: %u\n", header.blockAlignmentShift);
|
||||
printf(" Data shift: %u\n", header.dataShift);
|
||||
printf(" Table shift: %u\n", header.tableShift);
|
||||
printf(" Biggest sector size: %u bytes\n", header.biggestSectorSize);
|
||||
|
||||
// Display important warnings
|
||||
printf("\n");
|
||||
|
||||
Reference in New Issue
Block a user