From ac474223bc8b9dbb28c5f38fc9a5dc07bde7c57b Mon Sep 17 00:00:00 2001 From: vasilito Date: Wed, 1 Jul 2026 07:22:51 +0300 Subject: [PATCH] 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. --- src/gui/Web/hiperiso_http.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/gui/Web/hiperiso_http.c b/src/gui/Web/hiperiso_http.c index 41daca7..bf3444a 100644 --- a/src/gui/Web/hiperiso_http.c +++ b/src/gui/Web/hiperiso_http.c @@ -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");