fix: add BLKRRPART ioctl and fix ESP write/check loop count in GUI installer
After writing the partition table, call ioctl(fd, BLKRRPART) to force the kernel to re-read partitions immediately. Ventoy lacks this and relies on replug. Also fix hardcoded loop count 32 to HISOEFI_PART_BYTES / SIZE_1MB to match the new 64MB ESP size.
This commit is contained in:
@@ -584,7 +584,7 @@ static int hiperiso_check_efi_part_data(int fd, uint64_t offset)
|
||||
}
|
||||
|
||||
lseek(fd, offset, SEEK_SET);
|
||||
for (i = 0; i < 32; i++)
|
||||
for (i = 0; i < HISOEFI_PART_BYTES / SIZE_1MB; i++)
|
||||
{
|
||||
len = read(fd, buf, SIZE_1MB);
|
||||
if (len != SIZE_1MB || memcmp(buf, g_efi_part_raw_img + i * SIZE_1MB, SIZE_1MB))
|
||||
@@ -610,7 +610,7 @@ static int hiperiso_write_efipart(int fd, uint64_t offset, uint32_t secureboot)
|
||||
HiperisoProcSecureBoot((int)secureboot);
|
||||
|
||||
g_current_progress = PT_WRITE_HIPERISO_START;
|
||||
for (i = 0; i < 32; i++)
|
||||
for (i = 0; i < HISOEFI_PART_BYTES / SIZE_1MB; i++)
|
||||
{
|
||||
len = write(fd, g_efi_part_raw_img + i * SIZE_1MB, SIZE_1MB);
|
||||
vlog("write disk writelen:%lld datalen:%d [ %s ]\n",
|
||||
@@ -825,10 +825,9 @@ static void * hiperiso_update_thread(void *data)
|
||||
|
||||
vlog("fsync data1...\n");
|
||||
fsync(fd);
|
||||
ioctl(fd, BLKRRPART);
|
||||
hiso_safe_close_fd(fd);
|
||||
|
||||
g_current_progress = PT_SYNC_DATA2;
|
||||
|
||||
vlog("====================================\n");
|
||||
vlog("====== hiperiso update success ======\n");
|
||||
vlog("====================================\n");
|
||||
@@ -998,9 +997,9 @@ static void * hiperiso_install_thread(void *data)
|
||||
g_current_progress = PT_SYNC_DATA2;
|
||||
vlog("fsync data2...\n");
|
||||
fsync(fd);
|
||||
ioctl(fd, BLKRRPART);
|
||||
hiso_safe_close_fd(fd);
|
||||
|
||||
|
||||
vlog("====================================\n");
|
||||
vlog("====== hiperiso install success ======\n");
|
||||
vlog("====================================\n");
|
||||
|
||||
Reference in New Issue
Block a user