nyx: Check if split restore files are 4MB aligned

This is a mitigation for cluster version of FastFS.
During a split restore, it is allowed only once to write a cluster that is not full.
This commit is contained in:
CTCaer 2019-08-28 02:25:48 +03:00
parent 6cc3d9df67
commit deb9c94bcd

View file

@ -922,6 +922,7 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
manual_system_maintenance(true);
bool use_multipart = false;
bool check_4MB_aligned = true;
if (allow_multi_part)
{
@ -968,8 +969,21 @@ static int _restore_emmc_part(emmc_tool_gui_t *gui, char *sd_path, int active_pa
totalSectors = (u32)((u64)totalCheckFileSize >> (u64)9);
}
else
{
totalCheckFileSize += (u64)fno.fsize;
if (check_4MB_aligned && (((u64)fno.fsize) % 0x400000))
{
s_printf(gui->txt_buf, "#FFDD00 The split file must be a#\n#FFDD00 multiple of 4 MiB.#\n#FFDD00 Aborting...#", res, outFilename);
lv_label_ins_text(gui->label_log, LV_LABEL_POS_LAST, gui->txt_buf);
manual_system_maintenance(true);
return 0;
}
check_4MB_aligned = false;
}
numSplitParts++;
}