]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
1.0.36 release v1.0.36
authorlongpanda <admin@ventoy.net>
Sat, 27 Feb 2021 09:57:41 +0000 (17:57 +0800)
committerlongpanda <admin@ventoy.net>
Sat, 27 Feb 2021 09:57:41 +0000 (17:57 +0800)
58 files changed:
INSTALL/README
INSTALL/Ventoy2Disk.exe
INSTALL/VentoyWeb.sh
INSTALL/grub/grub.cfg
INSTALL/tool/VentoyWorker.sh
INSTALL/tool/ventoy_lib.sh
LinuxGUI/Ventoy2Disk/Core/ventoy_disk.c
LinuxGUI/Ventoy2Disk/Core/ventoy_log.c
LinuxGUI/Ventoy2Disk/Core/ventoy_util.c
LinuxGUI/Ventoy2Disk/Core/ventoy_util.h
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/API.txt [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/API.txt with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/COPYRIGHT.txt [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/COPYRIGHT.txt with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/Configuration.txt [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/Configuration.txt with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/History.txt [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/History.txt with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/License.txt [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/License.txt with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/Media Access API.txt [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/Media Access API.txt with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/buildlib.sh [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_access.c [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_access.c with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_access.h [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_access.h with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_cache.c [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_cache.c with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_cache.h [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_cache.h with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_defs.h [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_defs.h with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_filelib.c [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_filelib.c with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_filelib.h [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_filelib.h with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_format.c [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_format.c with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_format.h [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_format.h with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_list.h [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_list.h with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_misc.c [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_misc.c with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_misc.h [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_misc.h with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_opts.h [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_opts.h with 83% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_string.c [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_string.c with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_string.h [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_string.h with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_table.c [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_table.c with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_table.h [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_table.h with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_types.h [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_types.h with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_write.c [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_write.c with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_write.h [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_write.h with 100% similarity]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_32.a [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_64.a [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_aa64.a [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/example.c [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_access.h [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_cache.h [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_defs.h [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_filelib.h [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_format.h [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_list.h [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_misc.h [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_opts.h [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_string.h [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_table.h [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_types.h [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_write.h [deleted file]
LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/version.txt [moved from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/version.txt with 100% similarity]
LinuxGUI/Ventoy2Disk/Web/ventoy_http.c
LinuxGUI/WebUI/index.html
LinuxGUI/build.sh
Ventoy2Disk/Ventoy2Disk/Utility.c

index 2535f490165736cd8b5933bf231b596a29c502cb..db836ce63a8806bc9490d34fa6737d08310d229c 100644 (file)
@@ -18,9 +18,8 @@ Please refer https://www.ventoy.net/en/doc_start.html for details.
 
 
 ========== VentoyWeb.sh ===============
 
 
 ========== VentoyWeb.sh ===============
-sudo sh VentoyWeb.sh 
-Normally, it will popup a web browser window. 
-If not you can open your browser and visit http://127.0.0.1:24680
+1. sudo sh VentoyWeb.sh 
+2. open your browser and visit http://127.0.0.1:24680
 
 
 
 
 
 
index 770a8b1b5e06246b5ec7bc66b7b53f646fe66994..d831232bb537176b2afb7085b1b31267a7b50786 100644 (file)
Binary files a/INSTALL/Ventoy2Disk.exe and b/INSTALL/Ventoy2Disk.exe differ
index bb6a910acb4ee93f8bc1dce62bf826cb6c35820d..721e419ad6b7a6cd7cc76fada237aa60f9141979 100644 (file)
@@ -97,6 +97,11 @@ if [ -f ./tool/$TOOLDIR/V2DServer.xz ]; then
     chmod +x ./tool/$TOOLDIR/V2DServer
 fi
 
     chmod +x ./tool/$TOOLDIR/V2DServer
 fi
 
+
+V2DServer "$HOST" "$PORT" &
+wID=$!
+sleep 1
+
 vtVer=$(cat ventoy/version)
 echo ""
 echo "==============================================================="
 vtVer=$(cat ventoy/version)
 echo ""
 echo "==============================================================="
@@ -112,7 +117,7 @@ echo ""
 echo "################## Press Ctrl + C to exit #####################"
 echo ""
 
 echo "################## Press Ctrl + C to exit #####################"
 echo ""
 
-V2DServer "$HOST" "$PORT"
+wait $wID
 
 if [ -n "$OLDDIR" ]; then 
     CURDIR=$(pwd)
 
 if [ -n "$OLDDIR" ]; then 
     CURDIR=$(pwd)
index a7d44ca3a6d1513fcfc9e60c65058101c3395e5a..3f44dad5cd1488c691ed3294251327b42b21b5d3 100644 (file)
@@ -1546,7 +1546,7 @@ function img_unsupport_menuentry {
 #############################################################
 #############################################################
 
 #############################################################
 #############################################################
 
-set VENTOY_VERSION="1.0.35"
+set VENTOY_VERSION="1.0.36"
 
 #ACPI not compatible with Window7/8, so disable by default
 set VTOY_PARAM_NO_ACPI=1
 
 #ACPI not compatible with Window7/8, so disable by default
 set VTOY_PARAM_NO_ACPI=1
index ac2102c8bf122f735d56ecde38c3b31a313df0c2..c820ffc46969d99b39cce47047d32cb855c2712a 100644 (file)
@@ -125,11 +125,7 @@ if [ "$MODE" = "list" ]; then
 fi
 
 #check mountpoint
 fi
 
 #check mountpoint
-grep "^$DISK" /proc/mounts | while read mtline; do
-    mtpnt=$(echo $mtline | awk '{print $2}')
-    vtdebug "Trying to umount $mtpnt ..."
-    umount $mtpnt >/dev/null 2>&1
-done
+check_umount_disk "$DISK"
 
 if grep "$DISK" /proc/mounts; then
     vterr "$DISK is already mounted, please umount it first!"
 
 if grep "$DISK" /proc/mounts; then
     vterr "$DISK is already mounted, please umount it first!"
@@ -299,6 +295,9 @@ if [ "$MODE" = "install" ]; then
         xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1
     fi
     
         xzcat ./boot/core.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=2047 seek=1
     fi
     
+    # check and umount
+    check_umount_disk "$DISK"
+    
     xzcat ./ventoy/ventoy.disk.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start_sector
     
     #test UUID
     xzcat ./ventoy/ventoy.disk.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start_sector
     
     #test UUID
@@ -317,10 +316,7 @@ if [ "$MODE" = "install" ]; then
     vtinfo "esp partition processing ..."
     
     sleep 1
     vtinfo "esp partition processing ..."
     
     sleep 1
-    mtpnt=$(grep "^${PART2}" /proc/mounts | awk '{print $2}')
-    if [ -n "$mtpnt" ]; then
-        umount $mtpnt >/dev/null 2>&1
-    fi
+    check_umount_disk "$DISK"    
     
     if [ "$SECUREBOOT" != "YES" ]; then        
         mkdir ./tmp_mnt
     
     if [ "$SECUREBOOT" != "YES" ]; then        
         mkdir ./tmp_mnt
@@ -332,10 +328,7 @@ if [ "$MODE" = "install" ]; then
                 break
             fi
             
                 break
             fi
             
-            mtpnt=$(grep "^${PART2}" /proc/mounts | awk '{print $2}')
-            if [ -n "$mtpnt" ]; then
-                umount $mtpnt >/dev/null 2>&1
-            fi    
+            check_umount_disk "$DISK"            
             sleep 2
         done
         
             sleep 2
         done
         
@@ -349,6 +342,8 @@ if [ "$MODE" = "install" ]; then
         mv ./tmp_mnt/EFI/BOOT/grubx64_real.efi  ./tmp_mnt/EFI/BOOT/BOOTX64.EFI
         mv ./tmp_mnt/EFI/BOOT/grubia32_real.efi  ./tmp_mnt/EFI/BOOT/BOOTIA32.EFI
         
         mv ./tmp_mnt/EFI/BOOT/grubx64_real.efi  ./tmp_mnt/EFI/BOOT/BOOTX64.EFI
         mv ./tmp_mnt/EFI/BOOT/grubia32_real.efi  ./tmp_mnt/EFI/BOOT/BOOTIA32.EFI
         
+        sync
+        
         for tt in 1 2 3; do
             if umount ./tmp_mnt; then
                 vtdebug "umount part2 success"
         for tt in 1 2 3; do
             if umount ./tmp_mnt; then
                 vtdebug "umount part2 success"
@@ -439,15 +434,19 @@ else
     dd status=none conv=fsync if=./rsvdata.bin seek=2040 bs=512 count=8 of=${DISK}
     rm -f ./rsvdata.bin
 
     dd status=none conv=fsync if=./rsvdata.bin seek=2040 bs=512 count=8 of=${DISK}
     rm -f ./rsvdata.bin
 
+    check_umount_disk "$DISK"
+    
     xzcat ./ventoy/ventoy.disk.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start
 
     sync
     xzcat ./ventoy/ventoy.disk.img.xz | dd status=none conv=fsync of=$DISK bs=512 count=$VENTOY_SECTOR_NUM seek=$part2_start
 
     sync
-    
+
     if [ "$SECUREBOOT" != "YES" ]; then
         mkdir ./tmp_mnt
         
         vtdebug "mounting part2 ...."        
     if [ "$SECUREBOOT" != "YES" ]; then
         mkdir ./tmp_mnt
         
         vtdebug "mounting part2 ...."        
-        for tt in 1 2 3 4 5; do            
+        for tt in 1 2 3 4 5; do
+            check_umount_disk "$DISK"
+
             if mount ${PART2} ./tmp_mnt > /dev/null 2>&1; then
                 vtdebug "mounting part2 success"
                 break
             if mount ${PART2} ./tmp_mnt > /dev/null 2>&1; then
                 vtdebug "mounting part2 success"
                 break
@@ -467,6 +466,7 @@ else
         mv ./tmp_mnt/EFI/BOOT/grubx64_real.efi  ./tmp_mnt/EFI/BOOT/BOOTX64.EFI
         mv ./tmp_mnt/EFI/BOOT/grubia32_real.efi  ./tmp_mnt/EFI/BOOT/BOOTIA32.EFI
         
         mv ./tmp_mnt/EFI/BOOT/grubx64_real.efi  ./tmp_mnt/EFI/BOOT/BOOTX64.EFI
         mv ./tmp_mnt/EFI/BOOT/grubia32_real.efi  ./tmp_mnt/EFI/BOOT/BOOTIA32.EFI
         
+        sync
         
         for tt in 1 2 3; do
             if umount ./tmp_mnt > /dev/null 2>&1; then
         
         for tt in 1 2 3; do
             if umount ./tmp_mnt > /dev/null 2>&1; then
index c108197a0b7680f26ac4248147e294984668b2f1..a394eb14c69f660128cd035fd511c69f78fe5758 100644 (file)
@@ -97,6 +97,14 @@ get_disk_part_name() {
     fi
 }
 
     fi
 }
 
+check_umount_disk() {
+    DiskOrPart="$1"
+    grep "^${DiskOrPart}" /proc/mounts | while read mtline; do
+        mtpnt=$(echo $mtline | awk '{print $2}')
+        vtdebug "Trying to umount $mtpnt ..."
+        umount $mtpnt >/dev/null 2>&1
+    done
+}
 
 get_ventoy_version_from_cfg() {
     if grep -q 'set.*VENTOY_VERSION=' $1; then
 
 get_ventoy_version_from_cfg() {
     if grep -q 'set.*VENTOY_VERSION=' $1; then
@@ -218,6 +226,14 @@ format_ventoy_disk_mbr() {
     fi
     
     part2_start_sector=$(expr $part1_end_sector + 1)
     fi
     
     part2_start_sector=$(expr $part1_end_sector + 1)
+    
+    modsector=$(expr $part2_start_sector % 8)
+    if [ $modsector -gt 0 ]; then
+        vtdebug "modsector:$modsector need to be aligned with 4KB"
+        part1_end_sector=$(expr $part1_end_sector - $modsector)
+        part2_start_sector=$(expr $part1_end_sector + 1)
+    fi
+    
     part2_end_sector=$(expr $part2_start_sector + $VENTOY_SECTOR_NUM - 1)
 
     export part2_start_sector
     part2_end_sector=$(expr $part2_start_sector + $VENTOY_SECTOR_NUM - 1)
 
     export part2_start_sector
@@ -302,6 +318,8 @@ EOF
 
     echo "create efi fat fs $PART2 ..."
     for i in 0 1 2 3 4 5 6 7 8 9; do
 
     echo "create efi fat fs $PART2 ..."
     for i in 0 1 2 3 4 5 6 7 8 9; do
+        check_umount_disk "$PART2"
+
         if mkfs.vfat -F 16 -n VTOYEFI $PART2; then
             echo 'success'
             break
         if mkfs.vfat -F 16 -n VTOYEFI $PART2; then
             echo 'success'
             break
@@ -333,6 +351,14 @@ format_ventoy_disk_gpt() {
     fi
     
     part2_start_sector=$(expr $part1_end_sector + 1)
     fi
     
     part2_start_sector=$(expr $part1_end_sector + 1)
+    
+    modsector=$(expr $part2_start_sector % 8)
+    if [ $modsector -gt 0 ]; then
+        vtdebug "modsector:$modsector need to be aligned with 4KB"
+        part1_end_sector=$(expr $part1_end_sector - $modsector)
+        part2_start_sector=$(expr $part1_end_sector + 1)
+    fi
+    
     part2_end_sector=$(expr $part2_start_sector + $VENTOY_SECTOR_NUM - 1)
 
     export part2_start_sector
     part2_end_sector=$(expr $part2_start_sector + $VENTOY_SECTOR_NUM - 1)
 
     export part2_start_sector
@@ -397,7 +423,10 @@ format_ventoy_disk_gpt() {
     fi
 
     echo "create efi fat fs $PART2 ..."
     fi
 
     echo "create efi fat fs $PART2 ..."
+    
     for i in 0 1 2 3 4 5 6 7 8 9; do
     for i in 0 1 2 3 4 5 6 7 8 9; do
+        check_umount_disk "$PART2"
+        
         if mkfs.vfat -F 16 -n VTOYEFI $PART2; then
             echo 'success'
             break
         if mkfs.vfat -F 16 -n VTOYEFI $PART2; then
             echo 'success'
             break
index 4d0871b86f32ac80fadb55fa8af0a7855616c9b5..4df2040ec7ac96a777c657939f32c89f20aa2b8d 100644 (file)
@@ -330,6 +330,7 @@ static int fatlib_is_secure_boot_enable(void)
     flfile = fl_fopen("/EFI/BOOT/grubx64_real.efi", "rb");
     if (flfile)
     {
     flfile = fl_fopen("/EFI/BOOT/grubx64_real.efi", "rb");
     if (flfile)
     {
+        vlog("/EFI/BOOT/grubx64_real.efi find, secure boot in enabled\n");
         fl_fclose(flfile);
         return 1;
     }
         fl_fclose(flfile);
         return 1;
     }
@@ -504,7 +505,10 @@ int ventoy_get_vtoy_data(ventoy_disk *info, int *ppartstyle)
         goto end;
     }
 
         goto end;
     }
 
-    vdebug("now check secure boot ...\n");
+    vdebug("ventoy partition layout check OK: [%llu %llu] [%llu %llu]\n", 
+               part1_start_sector, part1_sector_count, part2_start_sector, part2_sector_count);
+
+    vdebug("now check secure boot for %s ...\n", info->disk_path);
 
     g_fatlib_media_fd = fd;
     g_fatlib_media_offset = part2_start_sector;
 
     g_fatlib_media_fd = fd;
     g_fatlib_media_offset = part2_start_sector;
@@ -546,7 +550,7 @@ int ventoy_get_vtoy_data(ventoy_disk *info, int *ppartstyle)
 
     rc = 0;
 end:
 
     rc = 0;
 end:
-    close(fd);
+    vtoy_safe_close_fd(fd);
     return rc;
 }
 
     return rc;
 }
 
index 469f843ebae0e29eee13d407922f835a3232b808..6e788c2f8e8ea77859ef5d317d76f36c6fd1d558 100644 (file)
@@ -80,6 +80,34 @@ void ventoy_syslog_newline(int level, const char *Fmt, ...)
     pthread_mutex_unlock(&g_log_mutex);
 }
 
     pthread_mutex_unlock(&g_log_mutex);
 }
 
+void ventoy_syslog_printf(const char *Fmt, ...)
+{
+    char log[512];
+    va_list arg;
+    time_t stamp;
+    struct tm ttm;
+    FILE *fp;
+    
+    time(&stamp);
+    localtime_r(&stamp, &ttm);
+
+    va_start(arg, Fmt);
+    vsnprintf(log, 512, Fmt, arg);
+    va_end(arg);
+
+    pthread_mutex_lock(&g_log_mutex);
+    fp = fopen(VTOY_LOG_FILE, "a+");
+    if (fp)
+    {
+        fprintf(fp, "[%04u/%02u/%02u %02u:%02u:%02u] %s", 
+           ttm.tm_year, ttm.tm_mon, ttm.tm_mday,
+           ttm.tm_hour, ttm.tm_min, ttm.tm_sec,
+           log);
+        fclose(fp);
+    }
+    pthread_mutex_unlock(&g_log_mutex);
+}
+
 void ventoy_syslog(int level, const char *Fmt, ...)
 {
     char log[512];
 void ventoy_syslog(int level, const char *Fmt, ...)
 {
     char log[512];
index 562c3a093c3ac49cd641cc2846ccf47a39521066..d15a4191712827b7f78dd5111c76edb74de1b4e8 100644 (file)
@@ -347,6 +347,7 @@ static int ventoy_fill_gpt_partname(uint16_t Name[36], const char *asciiName)
 int ventoy_fill_gpt(uint64_t size, uint64_t reserve, int align4k, VTOY_GPT_INFO *gpt)
 {
     uint64_t ReservedSector = 33;
 int ventoy_fill_gpt(uint64_t size, uint64_t reserve, int align4k, VTOY_GPT_INFO *gpt)
 {
     uint64_t ReservedSector = 33;
+    uint64_t ModSectorCount = 0;
     uint64_t Part1SectorCount = 0;
     uint64_t DiskSectorCount = size / 512;
     VTOY_GPT_HDR *Head = &gpt->Head;
     uint64_t Part1SectorCount = 0;
     uint64_t DiskSectorCount = size / 512;
     VTOY_GPT_HDR *Head = &gpt->Head;
@@ -362,18 +363,28 @@ int ventoy_fill_gpt(uint64_t size, uint64_t reserve, int align4k, VTOY_GPT_INFO
         ReservedSector += reserve / 512;
     }
 
         ReservedSector += reserve / 512;
     }
 
+    Part1SectorCount = DiskSectorCount - ReservedSector - (VTOYEFI_PART_BYTES / 512) - 2048;
+
+    ModSectorCount = (Part1SectorCount % 8);
+    if (ModSectorCount)
+    {
+        vlog("Part1SectorCount:%llu is not aligned by 4KB (%llu)\n", (_ull)Part1SectorCount, (_ull)ModSectorCount);
+    }
+
     // check aligned with 4KB
     if (align4k)
     {
     // check aligned with 4KB
     if (align4k)
     {
-        if (DiskSectorCount % 8)
+        if (ModSectorCount)
         {
         {
-            vdebug("Disk need to align with 4KB %u\n", (uint32_t)(DiskSectorCount % 8));
-            ReservedSector += (DiskSectorCount % 8);
+            vdebug("Disk need to align with 4KB %u\n", (uint32_t)ModSectorCount);
+            Part1SectorCount -= ModSectorCount;
+        }
+        else
+        {
+            vdebug("no need to align with 4KB\n");
         }
     }
 
         }
     }
 
-    Part1SectorCount = DiskSectorCount - ReservedSector - (VTOYEFI_PART_BYTES / 512) - 2048;
-
     memcpy(Head->Signature, "EFI PART", 8);
     Head->Version[2] = 0x01;
     Head->Length = 92;
     memcpy(Head->Signature, "EFI PART", 8);
     Head->Version[2] = 0x01;
     Head->Length = 92;
@@ -461,7 +472,7 @@ int VentoyFillMBRLocation(uint64_t DiskSizeInBytes, uint32_t StartSectorId, uint
     return 0;
 }
 
     return 0;
 }
 
-int ventoy_fill_mbr(uint64_t size, uint64_t reserve, int align4k, int PartStyle, MBR_HEAD *pMBR)
+int ventoy_fill_mbr(uint64_t size, uint64_t reserve, int align4k, MBR_HEAD *pMBR)
 {
     ventoy_guid Guid;
     uint32_t DiskSignature;
 {
     ventoy_guid Guid;
     uint32_t DiskSignature;
@@ -498,11 +509,6 @@ int ventoy_fill_mbr(uint64_t size, uint64_t reserve, int align4k, int PartStyle,
                ReservedSector = (uint32_t)(reserve / 512);
        }
 
                ReservedSector = (uint32_t)(reserve / 512);
        }
 
-    if (PartStyle)
-    {
-        ReservedSector += 33; // backup GPT part table
-    }
-
     // check aligned with 4KB
     if (align4k)
     {
     // check aligned with 4KB
     if (align4k)
     {
@@ -512,11 +518,14 @@ int ventoy_fill_mbr(uint64_t size, uint64_t reserve, int align4k, int PartStyle,
             vlog("Disk need to align with 4KB %u\n", (uint32_t)(sectors % 8));
             ReservedSector += (uint32_t)(sectors % 8);
         }
             vlog("Disk need to align with 4KB %u\n", (uint32_t)(sectors % 8));
             ReservedSector += (uint32_t)(sectors % 8);
         }
+        else
+        {
+            vdebug("no need to align with 4KB\n");
+        }
     }
 
        vlog("ReservedSector: %u\n", ReservedSector);
 
     }
 
        vlog("ReservedSector: %u\n", ReservedSector);
 
-    
     //Part1
     PartStartSector = VTOYIMG_PART_START_SECTOR;
        PartSectorCount = DiskSectorCount - ReservedSector - VTOYEFI_PART_BYTES / 512 - PartStartSector;
     //Part1
     PartStartSector = VTOYIMG_PART_START_SECTOR;
        PartSectorCount = DiskSectorCount - ReservedSector - VTOYEFI_PART_BYTES / 512 - PartStartSector;
index eb093106109ff2db6658ea115112d3d8090183a0..72cec62d6a32de0acb6246d1cd868c879b67f648 100644 (file)
@@ -46,7 +46,7 @@ int unxz(unsigned char *in, int in_size,
 int ventoy_read_file_to_buf(const char *FileName, int ExtLen, void **Bufer, int *BufLen);
 const char * ventoy_get_local_version(void);
 int ventoy_fill_gpt(uint64_t size, uint64_t reserve, int align4k, VTOY_GPT_INFO *gpt);
 int ventoy_read_file_to_buf(const char *FileName, int ExtLen, void **Bufer, int *BufLen);
 const char * ventoy_get_local_version(void);
 int ventoy_fill_gpt(uint64_t size, uint64_t reserve, int align4k, VTOY_GPT_INFO *gpt);
-int ventoy_fill_mbr(uint64_t size, uint64_t reserve, int align4k, int PartStyle, MBR_HEAD *pMBR);
+int ventoy_fill_mbr(uint64_t size, uint64_t reserve, int align4k, MBR_HEAD *pMBR);
 
 #endif /* __VENTOY_UTIL_H__ */
 
 
 #endif /* __VENTOY_UTIL_H__ */
 
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/buildlib.sh b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/buildlib.sh
deleted file mode 100644 (file)
index dec432f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/bin/sh
-
-rm -rf include
-rm -rf lib
-
-cd release
-gcc -O2 -D_FILE_OFFSET_BITS=64 fat*.c -c
-ar -rc libfat_io_64.a *.o
-rm -f *.o
-
-
-gcc -m32 -O2 -D_FILE_OFFSET_BITS=64 fat*.c -c
-ar -rc libfat_io_32.a *.o
-rm -f *.o
-
-
-aarch64-linux-gnu-gcc -O2 -D_FILE_OFFSET_BITS=64 fat*.c -c
-ar -rc libfat_io_aa64.a *.o
-rm -f *.o
-
-
-cd -
-
-
-mkdir lib
-mkdir include
-
-mv release/*.a lib/
-cp -a release/*.h include/
-
similarity index 83%
rename from LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/include/fat_opts.h
rename to LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/fat_opts.h
index ac4dc860acdca9a59a6882867e690358f4bfbff3..6db158c425452f3fc3ad4a1a6ad16cd2e9f2d315 100644 (file)
@@ -63,7 +63,7 @@
 
 // Include support for formatting disks (1 / 0)?
 #ifndef FATFS_INC_FORMAT_SUPPORT
 
 // Include support for formatting disks (1 / 0)?
 #ifndef FATFS_INC_FORMAT_SUPPORT
-    #define FATFS_INC_FORMAT_SUPPORT        1
+    #define FATFS_INC_FORMAT_SUPPORT        0
 #endif
 
 // Sector size used
 #endif
 
 // Sector size used
 
 // Printf output (directory listing / debug)
 #ifndef FAT_PRINTF
 
 // Printf output (directory listing / debug)
 #ifndef FAT_PRINTF
-    // Don't include stdio, but there is a printf function available
-    #ifdef FAT_PRINTF_NOINC_STDIO
-        extern int printf(const char* ctrl1, ... );
-        #define FAT_PRINTF(a)               printf a
-    // Include stdio to use printf
-    #else
-        #include <stdio.h>
-        #define FAT_PRINTF(a)               printf a
-    #endif
+    void ventoy_syslog_printf(const char *Fmt, ...);
+    #define FAT_PRINTF(a) ventoy_syslog_printf a
 #endif
 
 // Time/Date support requires time.h
 #endif
 
 // Time/Date support requires time.h
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_32.a b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_32.a
deleted file mode 100644 (file)
index e68fa38..0000000
Binary files a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_32.a and /dev/null differ
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_64.a b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_64.a
deleted file mode 100644 (file)
index 8598a87..0000000
Binary files a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_64.a and /dev/null differ
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_aa64.a b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_aa64.a
deleted file mode 100644 (file)
index 7b9b66c..0000000
Binary files a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_aa64.a and /dev/null differ
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/example.c b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/example.c
deleted file mode 100644 (file)
index 5d30e5b..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-#include <stdio.h>\r
-#include "fat_filelib.h"\r
-\r
-int media_init()\r
-{\r
-    // ...\r
-    return 1;\r
-}\r
-\r
-int media_read(unsigned long sector, unsigned char *buffer, unsigned long sector_count)\r
-{\r
-    unsigned long i;\r
-\r
-    for (i=0;i<sector_count;i++)\r
-    {\r
-        // ...\r
-        // Add platform specific sector (512 bytes) read code here\r
-        //..\r
-\r
-        sector ++;\r
-        buffer += 512;\r
-    }\r
-\r
-    return 1;\r
-}\r
-\r
-int media_write(unsigned long sector, unsigned char *buffer, unsigned long sector_count)\r
-{\r
-    unsigned long i;\r
-\r
-    for (i=0;i<sector_count;i++)\r
-    {\r
-        // ...\r
-        // Add platform specific sector (512 bytes) write code here\r
-        //..\r
-\r
-        sector ++;\r
-        buffer += 512;\r
-    }\r
-\r
-    return 1;\r
-}\r
-\r
-void main()\r
-{\r
-    FL_FILE *file;\r
-\r
-    // Initialise media\r
-    media_init();\r
-\r
-    // Initialise File IO Library\r
-    fl_init();\r
-\r
-    // Attach media access functions to library\r
-    if (fl_attach_media(media_read, media_write) != FAT_INIT_OK)\r
-    {\r
-        printf("ERROR: Media attach failed\n");\r
-        return; \r
-    }\r
-\r
-    // List root directory\r
-    fl_listdirectory("/");\r
-\r
-    // Create File\r
-    file = fl_fopen("/file.bin", "w");\r
-    if (file)\r
-    {\r
-        // Write some data\r
-        unsigned char data[] = { 1, 2, 3, 4 };\r
-        if (fl_fwrite(data, 1, sizeof(data), file) != sizeof(data))\r
-            printf("ERROR: Write file failed\n");\r
-    }\r
-    else\r
-        printf("ERROR: Create file failed\n");\r
-\r
-    // Close file\r
-    fl_fclose(file);\r
-\r
-    // Delete File\r
-    if (fl_remove("/file.bin") < 0)\r
-        printf("ERROR: Delete file failed\n");\r
-\r
-    // List root directory\r
-    fl_listdirectory("/");\r
-\r
-    fl_shutdown();\r
-}\r
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_access.h b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_access.h
deleted file mode 100644 (file)
index 1752387..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-#ifndef __FAT_ACCESS_H__
-#define __FAT_ACCESS_H__
-
-#include "fat_defs.h"
-#include "fat_opts.h"
-
-//-----------------------------------------------------------------------------
-// Defines
-//-----------------------------------------------------------------------------
-#define FAT_INIT_OK                         0
-#define FAT_INIT_MEDIA_ACCESS_ERROR         (-1)
-#define FAT_INIT_INVALID_SECTOR_SIZE        (-2)
-#define FAT_INIT_INVALID_SIGNATURE          (-3)
-#define FAT_INIT_ENDIAN_ERROR               (-4)
-#define FAT_INIT_WRONG_FILESYS_TYPE         (-5)
-#define FAT_INIT_WRONG_PARTITION_TYPE       (-6)
-#define FAT_INIT_STRUCT_PACKING             (-7)
-
-#define FAT_DIR_ENTRIES_PER_SECTOR          (FAT_SECTOR_SIZE / FAT_DIR_ENTRY_SIZE)
-
-//-----------------------------------------------------------------------------
-// Function Pointers
-//-----------------------------------------------------------------------------
-typedef int (*fn_diskio_read) (uint32 sector, uint8 *buffer, uint32 sector_count);
-typedef int (*fn_diskio_write)(uint32 sector, uint8 *buffer, uint32 sector_count);
-
-//-----------------------------------------------------------------------------
-// Structures
-//-----------------------------------------------------------------------------
-struct disk_if
-{
-    // User supplied function pointers for disk IO
-    fn_diskio_read          read_media;
-    fn_diskio_write         write_media;
-};
-
-// Forward declaration
-struct fat_buffer;
-
-struct fat_buffer
-{
-    uint8                   sector[FAT_SECTOR_SIZE * FAT_BUFFER_SECTORS];
-    uint32                  address;
-    int                     dirty;
-    uint8 *                 ptr;
-
-    // Next in chain of sector buffers
-    struct fat_buffer       *next;
-};
-
-typedef enum eFatType
-{
-    FAT_TYPE_16,
-    FAT_TYPE_32
-} tFatType;
-
-struct fatfs
-{
-    // Filesystem globals
-    uint8                   sectors_per_cluster;
-    uint32                  cluster_begin_lba;
-    uint32                  rootdir_first_cluster;
-    uint32                  rootdir_first_sector;
-    uint32                  rootdir_sectors;
-    uint32                  fat_begin_lba;
-    uint16                  fs_info_sector;
-    uint32                  lba_begin;
-    uint32                  fat_sectors;
-    uint32                  next_free_cluster;
-    uint16                  root_entry_count;
-    uint16                  reserved_sectors;
-    uint8                   num_of_fats;
-    tFatType                fat_type;
-
-    // Disk/Media API
-    struct disk_if          disk_io;
-
-    // [Optional] Thread Safety
-    void                    (*fl_lock)(void);
-    void                    (*fl_unlock)(void);
-
-    // Working buffer
-    struct fat_buffer        currentsector;
-
-    // FAT Buffer
-    struct fat_buffer        *fat_buffer_head;
-    struct fat_buffer        fat_buffers[FAT_BUFFERS];
-};
-
-struct fs_dir_list_status
-{
-    uint32                  sector;
-    uint32                  cluster;
-    uint8                   offset;
-};
-
-struct fs_dir_ent
-{
-    char                    filename[FATFS_MAX_LONG_FILENAME];
-    uint8                   is_dir;
-    uint32                  cluster;
-    uint32                  size;
-
-#if FATFS_INC_TIME_DATE_SUPPORT
-    uint16                  access_date;
-    uint16                  write_time;
-    uint16                  write_date;
-    uint16                  create_date;
-    uint16                  create_time;
-#endif
-};
-
-//-----------------------------------------------------------------------------
-// Prototypes
-//-----------------------------------------------------------------------------
-int     fatfs_init(struct fatfs *fs);
-uint32  fatfs_lba_of_cluster(struct fatfs *fs, uint32 Cluster_Number);
-int     fatfs_sector_reader(struct fatfs *fs, uint32 Startcluster, uint32 offset, uint8 *target);
-int     fatfs_sector_read(struct fatfs *fs, uint32 lba, uint8 *target, uint32 count);
-int     fatfs_sector_write(struct fatfs *fs, uint32 lba, uint8 *target, uint32 count);
-int     fatfs_read_sector(struct fatfs *fs, uint32 cluster, uint32 sector, uint8 *target);
-int     fatfs_write_sector(struct fatfs *fs, uint32 cluster, uint32 sector, uint8 *target);
-void    fatfs_show_details(struct fatfs *fs);
-uint32  fatfs_get_root_cluster(struct fatfs *fs);
-uint32  fatfs_get_file_entry(struct fatfs *fs, uint32 Cluster, char *nametofind, struct fat_dir_entry *sfEntry);
-int     fatfs_sfn_exists(struct fatfs *fs, uint32 Cluster, char *shortname);
-int     fatfs_update_file_length(struct fatfs *fs, uint32 Cluster, char *shortname, uint32 fileLength);
-int     fatfs_mark_file_deleted(struct fatfs *fs, uint32 Cluster, char *shortname);
-void    fatfs_list_directory_start(struct fatfs *fs, struct fs_dir_list_status *dirls, uint32 StartCluster);
-int     fatfs_list_directory_next(struct fatfs *fs, struct fs_dir_list_status *dirls, struct fs_dir_ent *entry);
-int     fatfs_update_timestamps(struct fat_dir_entry *directoryEntry, int create, int modify, int access);
-
-#endif
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_cache.h b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_cache.h
deleted file mode 100644 (file)
index 348d5d3..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __FAT_CACHE_H__
-#define __FAT_CACHE_H__
-
-#include "fat_filelib.h"
-
-//-----------------------------------------------------------------------------
-// Prototypes
-//-----------------------------------------------------------------------------
-int fatfs_cache_init(struct fatfs *fs, FL_FILE *file);
-int fatfs_cache_get_next_cluster(struct fatfs *fs, FL_FILE *file, uint32 clusterIdx, uint32 *pNextCluster);
-int fatfs_cache_set_next_cluster(struct fatfs *fs, FL_FILE *file, uint32 clusterIdx, uint32 nextCluster);
-
-#endif
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_defs.h b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_defs.h
deleted file mode 100644 (file)
index 5fe8d6a..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
-#ifndef __FAT_DEFS_H__
-#define __FAT_DEFS_H__
-
-#include "fat_opts.h"
-#include "fat_types.h"
-
-//-----------------------------------------------------------------------------
-//            FAT32 Offsets
-//        Name                Offset
-//-----------------------------------------------------------------------------
-
-// Boot Sector
-#define BS_JMPBOOT              0    // Length = 3
-#define BS_OEMNAME              3    // Length = 8
-#define BPB_BYTSPERSEC          11    // Length = 2
-#define BPB_SECPERCLUS          13    // Length = 1
-#define BPB_RSVDSECCNT          14    // Length = 2
-#define BPB_NUMFATS             16    // Length = 1
-#define BPB_ROOTENTCNT          17    // Length = 2
-#define BPB_TOTSEC16            19    // Length = 2
-#define BPB_MEDIA               21    // Length = 1
-#define    BPB_FATSZ16          22    // Length = 2
-#define BPB_SECPERTRK           24    // Length = 2
-#define BPB_NUMHEADS            26    // Length = 2
-#define BPB_HIDDSEC             28    // Length = 4
-#define BPB_TOTSEC32            32    // Length = 4
-
-// FAT 12/16
-#define BS_FAT_DRVNUM           36    // Length = 1
-#define BS_FAT_BOOTSIG          38    // Length = 1
-#define BS_FAT_VOLID            39    // Length = 4
-#define BS_FAT_VOLLAB           43    // Length = 11
-#define BS_FAT_FILSYSTYPE       54    // Length = 8
-
-// FAT 32
-#define BPB_FAT32_FATSZ32       36    // Length = 4
-#define BPB_FAT32_EXTFLAGS      40    // Length = 2
-#define BPB_FAT32_FSVER         42    // Length = 2
-#define BPB_FAT32_ROOTCLUS      44    // Length = 4
-#define BPB_FAT32_FSINFO        48    // Length = 2
-#define BPB_FAT32_BKBOOTSEC     50    // Length = 2
-#define BS_FAT32_DRVNUM         64    // Length = 1
-#define BS_FAT32_BOOTSIG        66    // Length = 1
-#define BS_FAT32_VOLID          67    // Length = 4
-#define BS_FAT32_VOLLAB         71    // Length = 11
-#define BS_FAT32_FILSYSTYPE     82    // Length = 8
-
-//-----------------------------------------------------------------------------
-// FAT Types
-//-----------------------------------------------------------------------------
-#define FAT_TYPE_FAT12          1
-#define FAT_TYPE_FAT16          2
-#define FAT_TYPE_FAT32          3
-
-//-----------------------------------------------------------------------------
-// FAT32 Specific Statics
-//-----------------------------------------------------------------------------
-#define SIGNATURE_POSITION              510
-#define SIGNATURE_VALUE                 0xAA55
-#define PARTITION1_TYPECODE_LOCATION    450
-#define FAT32_TYPECODE1                 0x0B
-#define FAT32_TYPECODE2                 0x0C
-#define PARTITION1_LBA_BEGIN_LOCATION   454
-#define PARTITION1_SIZE_LOCATION        458
-
-#define FAT_DIR_ENTRY_SIZE              32
-#define FAT_SFN_SIZE_FULL               11
-#define FAT_SFN_SIZE_PARTIAL            8
-
-//-----------------------------------------------------------------------------
-// FAT32 File Attributes and Types
-//-----------------------------------------------------------------------------
-#define FILE_ATTR_READ_ONLY             0x01
-#define FILE_ATTR_HIDDEN                0x02
-#define FILE_ATTR_SYSTEM                0x04
-#define FILE_ATTR_SYSHID                0x06
-#define FILE_ATTR_VOLUME_ID             0x08
-#define FILE_ATTR_DIRECTORY             0x10
-#define FILE_ATTR_ARCHIVE               0x20
-#define FILE_ATTR_LFN_TEXT              0x0F
-#define FILE_HEADER_BLANK               0x00
-#define FILE_HEADER_DELETED             0xE5
-#define FILE_TYPE_DIR                   0x10
-#define FILE_TYPE_FILE                  0x20
-
-//-----------------------------------------------------------------------------
-// Time / Date details
-//-----------------------------------------------------------------------------
-#define FAT_TIME_HOURS_SHIFT            11
-#define FAT_TIME_HOURS_MASK             0x1F
-#define FAT_TIME_MINUTES_SHIFT          5
-#define FAT_TIME_MINUTES_MASK           0x3F
-#define FAT_TIME_SECONDS_SHIFT          0
-#define FAT_TIME_SECONDS_MASK           0x1F
-#define FAT_TIME_SECONDS_SCALE          2
-#define FAT_DATE_YEAR_SHIFT             9
-#define FAT_DATE_YEAR_MASK              0x7F
-#define FAT_DATE_MONTH_SHIFT            5
-#define FAT_DATE_MONTH_MASK             0xF
-#define FAT_DATE_DAY_SHIFT              0
-#define FAT_DATE_DAY_MASK               0x1F
-#define FAT_DATE_YEAR_OFFSET            1980
-
-//-----------------------------------------------------------------------------
-// Other Defines
-//-----------------------------------------------------------------------------
-#define FAT32_LAST_CLUSTER              0xFFFFFFFF
-#define FAT32_INVALID_CLUSTER           0xFFFFFFFF
-
-STRUCT_PACK_BEGIN
-struct fat_dir_entry STRUCT_PACK
-{
-    uint8 Name[11];
-    uint8 Attr;
-    uint8 NTRes;
-    uint8 CrtTimeTenth;
-    uint8 CrtTime[2];
-    uint8 CrtDate[2];
-    uint8 LstAccDate[2];
-    uint16 FstClusHI;
-    uint8 WrtTime[2];
-    uint8 WrtDate[2];
-    uint16 FstClusLO;
-    uint32 FileSize;
-} STRUCT_PACKED;
-STRUCT_PACK_END
-
-#endif
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_filelib.h b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_filelib.h
deleted file mode 100644 (file)
index a40a28f..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-#ifndef __FAT_FILELIB_H__
-#define __FAT_FILELIB_H__
-
-#include "fat_opts.h"
-#include "fat_access.h"
-#include "fat_list.h"
-
-//-----------------------------------------------------------------------------
-// Defines
-//-----------------------------------------------------------------------------
-#ifndef SEEK_CUR
-    #define SEEK_CUR    1
-#endif
-
-#ifndef SEEK_END
-    #define SEEK_END    2
-#endif
-
-#ifndef SEEK_SET
-    #define SEEK_SET    0
-#endif
-
-#ifndef EOF
-    #define EOF         (-1)
-#endif
-
-//-----------------------------------------------------------------------------
-// Structures
-//-----------------------------------------------------------------------------
-struct sFL_FILE;
-
-struct cluster_lookup
-{
-    uint32 ClusterIdx;
-    uint32 CurrentCluster;
-};
-
-typedef struct sFL_FILE
-{
-    uint32                  parentcluster;
-    uint32                  startcluster;
-    uint32                  bytenum;
-    uint32                  filelength;
-    int                     filelength_changed;
-    char                    path[FATFS_MAX_LONG_FILENAME];
-    char                    filename[FATFS_MAX_LONG_FILENAME];
-    uint8                   shortfilename[11];
-
-#ifdef FAT_CLUSTER_CACHE_ENTRIES
-    uint32                  cluster_cache_idx[FAT_CLUSTER_CACHE_ENTRIES];
-    uint32                  cluster_cache_data[FAT_CLUSTER_CACHE_ENTRIES];
-#endif
-
-    // Cluster Lookup
-    struct cluster_lookup   last_fat_lookup;
-
-    // Read/Write sector buffer
-    uint8                   file_data_sector[FAT_SECTOR_SIZE];
-    uint32                  file_data_address;
-    int                     file_data_dirty;
-
-    // File fopen flags
-    uint8                   flags;
-#define FILE_READ           (1 << 0)
-#define FILE_WRITE          (1 << 1)
-#define FILE_APPEND         (1 << 2)
-#define FILE_BINARY         (1 << 3)
-#define FILE_ERASE          (1 << 4)
-#define FILE_CREATE         (1 << 5)
-
-    struct fat_node         list_node;
-} FL_FILE;
-
-//-----------------------------------------------------------------------------
-// Prototypes
-//-----------------------------------------------------------------------------
-
-// External
-void                fl_init(void);
-void                fl_attach_locks(void (*lock)(void), void (*unlock)(void));
-int                 fl_attach_media(fn_diskio_read rd, fn_diskio_write wr);
-void                fl_shutdown(void);
-
-// Standard API
-void*               fl_fopen(const char *path, const char *modifiers);
-void                fl_fclose(void *file);
-int                 fl_fflush(void *file);
-int                 fl_fgetc(void *file);
-char *              fl_fgets(char *s, int n, void *f);
-int                 fl_fputc(int c, void *file);
-int                 fl_fputs(const char * str, void *file);
-int                 fl_fwrite(const void * data, int size, int count, void *file );
-int                 fl_fread(void * data, int size, int count, void *file );
-int                 fl_fseek(void *file , long offset , int origin );
-int                 fl_fgetpos(void *file , uint32 * position);
-long                fl_ftell(void *f);
-int                 fl_feof(void *f);
-int                 fl_remove(const char * filename);
-
-// Equivelant dirent.h
-typedef struct fs_dir_list_status    FL_DIR;
-typedef struct fs_dir_ent            fl_dirent;
-
-FL_DIR*             fl_opendir(const char* path, FL_DIR *dir);
-int                 fl_readdir(FL_DIR *dirls, fl_dirent *entry);
-int                 fl_closedir(FL_DIR* dir);
-
-// Extensions
-void                fl_listdirectory(const char *path);
-int                 fl_createdirectory(const char *path);
-int                 fl_is_dir(const char *path);
-
-int                 fl_format(uint32 volume_sectors, const char *name);
-
-// Test hooks
-#ifdef FATFS_INC_TEST_HOOKS
-struct fatfs*       fl_get_fs(void);
-#endif
-
-//-----------------------------------------------------------------------------
-// Stdio file I/O names
-//-----------------------------------------------------------------------------
-#ifdef USE_FILELIB_STDIO_COMPAT_NAMES
-
-#define FILE            FL_FILE
-
-#define fopen(a,b)      fl_fopen(a, b)
-#define fclose(a)       fl_fclose(a)
-#define fflush(a)       fl_fflush(a)
-#define fgetc(a)        fl_fgetc(a)
-#define fgets(a,b,c)    fl_fgets(a, b, c)
-#define fputc(a,b)      fl_fputc(a, b)
-#define fputs(a,b)      fl_fputs(a, b)
-#define fwrite(a,b,c,d) fl_fwrite(a, b, c, d)
-#define fread(a,b,c,d)  fl_fread(a, b, c, d)
-#define fseek(a,b,c)    fl_fseek(a, b, c)
-#define fgetpos(a,b)    fl_fgetpos(a, b)
-#define ftell(a)        fl_ftell(a)
-#define feof(a)         fl_feof(a)
-#define remove(a)       fl_remove(a)
-#define mkdir(a)        fl_createdirectory(a)
-#define rmdir(a)        0
-
-#endif
-
-#endif
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_format.h b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_format.h
deleted file mode 100644 (file)
index a8a6bba..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef __FAT_FORMAT_H__
-#define __FAT_FORMAT_H__
-
-#include "fat_defs.h"
-#include "fat_opts.h"
-#include "fat_access.h"
-
-//-----------------------------------------------------------------------------
-// Prototypes
-//-----------------------------------------------------------------------------
-int fatfs_format(struct fatfs *fs, uint32 volume_sectors, const char *name);
-int fatfs_format_fat16(struct fatfs *fs, uint32 volume_sectors, const char *name);
-int fatfs_format_fat32(struct fatfs *fs, uint32 volume_sectors, const char *name);
-
-#endif
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_list.h b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_list.h
deleted file mode 100644 (file)
index bd386ef..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-#ifndef __FAT_LIST_H__
-#define __FAT_LIST_H__
-
-#ifndef FAT_ASSERT
-    #define FAT_ASSERT(x)
-#endif
-
-#ifndef FAT_INLINE
-    #define FAT_INLINE
-#endif
-
-//-----------------------------------------------------------------
-// Types
-//-----------------------------------------------------------------
-struct fat_list;
-
-struct fat_node
-{
-    struct fat_node    *previous;
-    struct fat_node    *next;
-};
-
-struct fat_list
-{
-    struct fat_node    *head;
-    struct fat_node    *tail;
-};
-
-//-----------------------------------------------------------------
-// Macros
-//-----------------------------------------------------------------
-#define fat_list_entry(p, t, m)     p ? ((t *)((char *)(p)-(char*)(&((t *)0)->m))) : 0
-#define fat_list_next(l, p)         (p)->next
-#define fat_list_prev(l, p)         (p)->previous
-#define fat_list_first(l)           (l)->head
-#define fat_list_last(l)            (l)->tail
-#define fat_list_for_each(l, p)     for ((p) = (l)->head; (p); (p) = (p)->next)
-
-//-----------------------------------------------------------------
-// Inline Functions
-//-----------------------------------------------------------------
-
-//-----------------------------------------------------------------
-// fat_list_init:
-//-----------------------------------------------------------------
-static FAT_INLINE void fat_list_init(struct fat_list *list)
-{
-    FAT_ASSERT(list);
-
-    list->head = list->tail = 0;
-}
-//-----------------------------------------------------------------
-// fat_list_remove:
-//-----------------------------------------------------------------
-static FAT_INLINE void fat_list_remove(struct fat_list *list, struct fat_node *node)
-{
-    FAT_ASSERT(list);
-    FAT_ASSERT(node);
-
-    if(!node->previous)
-        list->head = node->next;
-    else
-        node->previous->next = node->next;
-
-    if(!node->next)
-        list->tail = node->previous;
-    else
-        node->next->previous = node->previous;
-}
-//-----------------------------------------------------------------
-// fat_list_insert_after:
-//-----------------------------------------------------------------
-static FAT_INLINE void fat_list_insert_after(struct fat_list *list, struct fat_node *node, struct fat_node *new_node)
-{
-    FAT_ASSERT(list);
-    FAT_ASSERT(node);
-    FAT_ASSERT(new_node);
-
-    new_node->previous = node;
-    new_node->next = node->next;
-    if (!node->next)
-        list->tail = new_node;
-    else
-        node->next->previous = new_node;
-    node->next = new_node;
-}
-//-----------------------------------------------------------------
-// fat_list_insert_before:
-//-----------------------------------------------------------------
-static FAT_INLINE void fat_list_insert_before(struct fat_list *list, struct fat_node *node, struct fat_node *new_node)
-{
-    FAT_ASSERT(list);
-    FAT_ASSERT(node);
-    FAT_ASSERT(new_node);
-
-    new_node->previous = node->previous;
-    new_node->next = node;
-    if (!node->previous)
-        list->head = new_node;
-    else
-        node->previous->next = new_node;
-    node->previous = new_node;
-}
-//-----------------------------------------------------------------
-// fat_list_insert_first:
-//-----------------------------------------------------------------
-static FAT_INLINE void fat_list_insert_first(struct fat_list *list, struct fat_node *node)
-{
-    FAT_ASSERT(list);
-    FAT_ASSERT(node);
-
-    if (!list->head)
-    {
-        list->head = node;
-        list->tail = node;
-        node->previous = 0;
-        node->next = 0;
-    }
-    else
-        fat_list_insert_before(list, list->head, node);
-}
-//-----------------------------------------------------------------
-// fat_list_insert_last:
-//-----------------------------------------------------------------
-static FAT_INLINE void fat_list_insert_last(struct fat_list *list, struct fat_node *node)
-{
-    FAT_ASSERT(list);
-    FAT_ASSERT(node);
-
-    if (!list->tail)
-        fat_list_insert_first(list, node);
-     else
-        fat_list_insert_after(list, list->tail, node);
-}
-//-----------------------------------------------------------------
-// fat_list_is_empty:
-//-----------------------------------------------------------------
-static FAT_INLINE int fat_list_is_empty(struct fat_list *list)
-{
-    FAT_ASSERT(list);
-
-    return !list->head;
-}
-//-----------------------------------------------------------------
-// fat_list_pop_head:
-//-----------------------------------------------------------------
-static FAT_INLINE struct fat_node * fat_list_pop_head(struct fat_list *list)
-{
-    struct fat_node * node;
-
-    FAT_ASSERT(list);
-
-    node = fat_list_first(list);
-    if (node)
-        fat_list_remove(list, node);
-
-    return node;
-}
-
-#endif
-
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_misc.h b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_misc.h
deleted file mode 100644 (file)
index 0c02634..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef __FAT_MISC_H__
-#define __FAT_MISC_H__
-
-#include "fat_defs.h"
-#include "fat_opts.h"
-
-//-----------------------------------------------------------------------------
-// Defines
-//-----------------------------------------------------------------------------
-#define MAX_LONGFILENAME_ENTRIES    20
-#define MAX_LFN_ENTRY_LENGTH        13
-
-//-----------------------------------------------------------------------------
-// Macros
-//-----------------------------------------------------------------------------
-#define GET_32BIT_WORD(buffer, location)    ( ((uint32)buffer[location+3]<<24) + ((uint32)buffer[location+2]<<16) + ((uint32)buffer[location+1]<<8) + (uint32)buffer[location+0] )
-#define GET_16BIT_WORD(buffer, location)    ( ((uint16)buffer[location+1]<<8) + (uint16)buffer[location+0] )
-
-#define SET_32BIT_WORD(buffer, location, value)    { buffer[location+0] = (uint8)((value)&0xFF); \
-                                                  buffer[location+1] = (uint8)((value>>8)&0xFF); \
-                                                  buffer[location+2] = (uint8)((value>>16)&0xFF); \
-                                                  buffer[location+3] = (uint8)((value>>24)&0xFF); }
-
-#define SET_16BIT_WORD(buffer, location, value)    { buffer[location+0] = (uint8)((value)&0xFF); \
-                                                  buffer[location+1] = (uint8)((value>>8)&0xFF); }
-
-//-----------------------------------------------------------------------------
-// Structures
-//-----------------------------------------------------------------------------
-struct lfn_cache
-{
-#if FATFS_INC_LFN_SUPPORT
-    // Long File Name Structure (max 260 LFN length)
-    uint8 String[MAX_LONGFILENAME_ENTRIES][MAX_LFN_ENTRY_LENGTH];
-    uint8 Null;
-#endif
-    uint8 no_of_strings;
-};
-
-//-----------------------------------------------------------------------------
-// Prototypes
-//-----------------------------------------------------------------------------
-void    fatfs_lfn_cache_init(struct lfn_cache *lfn, int wipeTable);
-void    fatfs_lfn_cache_entry(struct lfn_cache *lfn, uint8 *entryBuffer);
-char*   fatfs_lfn_cache_get(struct lfn_cache *lfn);
-int     fatfs_entry_lfn_text(struct fat_dir_entry *entry);
-int     fatfs_entry_lfn_invalid(struct fat_dir_entry *entry);
-int     fatfs_entry_lfn_exists(struct lfn_cache *lfn, struct fat_dir_entry *entry);
-int     fatfs_entry_sfn_only(struct fat_dir_entry *entry);
-int     fatfs_entry_is_dir(struct fat_dir_entry *entry);
-int     fatfs_entry_is_file(struct fat_dir_entry *entry);
-int     fatfs_lfn_entries_required(char *filename);
-void    fatfs_filename_to_lfn(char *filename, uint8 *buffer, int entry, uint8 sfnChk);
-void    fatfs_sfn_create_entry(char *shortfilename, uint32 size, uint32 startCluster, struct fat_dir_entry *entry, int dir);
-int     fatfs_lfn_create_sfn(char *sfn_output, char *filename);
-int     fatfs_lfn_generate_tail(char *sfn_output, char *sfn_input, uint32 tailNum);
-void    fatfs_convert_from_fat_time(uint16 fat_time, int *hours, int *minutes, int *seconds);
-void    fatfs_convert_from_fat_date(uint16 fat_date, int *day, int *month, int *year);
-uint16  fatfs_convert_to_fat_time(int hours, int minutes, int seconds);
-uint16  fatfs_convert_to_fat_date(int day, int month, int year);
-void    fatfs_print_sector(uint32 sector, uint8 *data);
-
-#endif
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_opts.h b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_opts.h
deleted file mode 100644 (file)
index ac4dc86..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-#ifndef __FAT_OPTS_H__
-#define __FAT_OPTS_H__
-
-#ifdef FATFS_USE_CUSTOM_OPTS_FILE
-    #include "fat_custom.h"
-#endif
-
-//-------------------------------------------------------------
-// Configuration
-//-------------------------------------------------------------
-
-// Is the processor little endian (1) or big endian (0)
-#ifndef FATFS_IS_LITTLE_ENDIAN
-    #define FATFS_IS_LITTLE_ENDIAN          1
-#endif
-
-// Max filename Length
-#ifndef FATFS_MAX_LONG_FILENAME
-    #define FATFS_MAX_LONG_FILENAME         260
-#endif
-
-// Max open files (reduce to lower memory requirements)
-#ifndef FATFS_MAX_OPEN_FILES
-    #define FATFS_MAX_OPEN_FILES            2
-#endif
-
-// Number of sectors per FAT_BUFFER (min 1)
-#ifndef FAT_BUFFER_SECTORS
-    #define FAT_BUFFER_SECTORS              1
-#endif
-
-// Max FAT sectors to buffer (min 1)
-// (mem used is FAT_BUFFERS * FAT_BUFFER_SECTORS * FAT_SECTOR_SIZE)
-#ifndef FAT_BUFFERS
-    #define FAT_BUFFERS                     1
-#endif
-
-// Size of cluster chain cache (can be undefined)
-// Mem used = FAT_CLUSTER_CACHE_ENTRIES * 4 * 2
-// Improves access speed considerably
-//#define FAT_CLUSTER_CACHE_ENTRIES         128
-
-// Include support for writing files (1 / 0)?
-#ifndef FATFS_INC_WRITE_SUPPORT
-    #define FATFS_INC_WRITE_SUPPORT         1
-#endif
-
-// Support long filenames (1 / 0)?
-// (if not (0) only 8.3 format is supported)
-#ifndef FATFS_INC_LFN_SUPPORT
-    #define FATFS_INC_LFN_SUPPORT           1
-#endif
-
-// Support directory listing (1 / 0)?
-#ifndef FATFS_DIR_LIST_SUPPORT
-    #define FATFS_DIR_LIST_SUPPORT          1
-#endif
-
-// Support time/date (1 / 0)?
-#ifndef FATFS_INC_TIME_DATE_SUPPORT
-    #define FATFS_INC_TIME_DATE_SUPPORT     0
-#endif
-
-// Include support for formatting disks (1 / 0)?
-#ifndef FATFS_INC_FORMAT_SUPPORT
-    #define FATFS_INC_FORMAT_SUPPORT        1
-#endif
-
-// Sector size used
-#define FAT_SECTOR_SIZE                     512
-
-// Printf output (directory listing / debug)
-#ifndef FAT_PRINTF
-    // Don't include stdio, but there is a printf function available
-    #ifdef FAT_PRINTF_NOINC_STDIO
-        extern int printf(const char* ctrl1, ... );
-        #define FAT_PRINTF(a)               printf a
-    // Include stdio to use printf
-    #else
-        #include <stdio.h>
-        #define FAT_PRINTF(a)               printf a
-    #endif
-#endif
-
-// Time/Date support requires time.h
-#if FATFS_INC_TIME_DATE_SUPPORT
-    #include <time.h>
-#endif
-
-#endif
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_string.h b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_string.h
deleted file mode 100644 (file)
index 90ca8e0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __FILESTRING_H__
-#define __FILESTRING_H__
-
-//-----------------------------------------------------------------------------
-// Prototypes
-//-----------------------------------------------------------------------------
-int fatfs_total_path_levels(char *path);
-int fatfs_get_substring(char *Path, int levelreq, char *output, int max_len);
-int fatfs_split_path(char *FullPath, char *Path, int max_path, char *FileName, int max_filename);
-int fatfs_compare_names(char* strA, char* strB);
-int fatfs_string_ends_with_slash(char *path);
-int fatfs_get_sfn_display_name(char* out, char* in);
-int fatfs_get_extension(char* filename, char* out, int maxlen);
-int fatfs_create_path_string(char* path, char *filename, char* out, int maxlen);
-
-#ifndef NULL
-    #define NULL 0
-#endif
-
-#endif
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_table.h b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_table.h
deleted file mode 100644 (file)
index ead75f3..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef __FAT_TABLE_H__
-#define __FAT_TABLE_H__
-
-#include "fat_opts.h"
-#include "fat_misc.h"
-
-//-----------------------------------------------------------------------------
-// Prototypes
-//-----------------------------------------------------------------------------
-void    fatfs_fat_init(struct fatfs *fs);
-int     fatfs_fat_purge(struct fatfs *fs);
-uint32  fatfs_find_next_cluster(struct fatfs *fs, uint32 current_cluster);
-void    fatfs_set_fs_info_next_free_cluster(struct fatfs *fs, uint32 newValue);
-int     fatfs_find_blank_cluster(struct fatfs *fs, uint32 start_cluster, uint32 *free_cluster);
-int     fatfs_fat_set_cluster(struct fatfs *fs, uint32 cluster, uint32 next_cluster);
-int     fatfs_fat_add_cluster_to_chain(struct fatfs *fs, uint32 start_cluster, uint32 newEntry);
-int     fatfs_free_cluster_chain(struct fatfs *fs, uint32 start_cluster);
-uint32  fatfs_count_free_clusters(struct fatfs *fs);
-
-#endif
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_types.h b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_types.h
deleted file mode 100644 (file)
index 5e2cca8..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#ifndef __FAT_TYPES_H__
-#define __FAT_TYPES_H__
-
-// Detect 64-bit compilation on GCC
-#if defined(__GNUC__) && defined(__SIZEOF_LONG__)
-    #if __SIZEOF_LONG__ == 8
-        #define FATFS_DEF_UINT32_AS_INT
-    #endif
-#endif
-
-//-------------------------------------------------------------
-// System specific types
-//-------------------------------------------------------------
-#ifndef FATFS_NO_DEF_TYPES
-    typedef unsigned char uint8;
-    typedef unsigned short uint16;
-
-    // If compiling on a 64-bit machine, use int as 32-bits
-    #ifdef FATFS_DEF_UINT32_AS_INT
-        typedef unsigned int uint32;
-    // Else for 32-bit machines & embedded systems, use long...
-    #else
-        typedef unsigned long uint32;
-    #endif
-#endif
-
-#ifndef NULL
-    #define NULL 0
-#endif
-
-//-------------------------------------------------------------
-// Endian Macros
-//-------------------------------------------------------------
-// FAT is little endian so big endian systems need to swap words
-
-// Little Endian - No swap required
-#if FATFS_IS_LITTLE_ENDIAN == 1
-
-    #define FAT_HTONS(n) (n)
-    #define FAT_HTONL(n) (n)
-
-// Big Endian - Swap required
-#else
-
-    #define FAT_HTONS(n) ((((uint16)((n) & 0xff)) << 8) | (((n) & 0xff00) >> 8))
-    #define FAT_HTONL(n) (((((uint32)(n) & 0xFF)) << 24) | \
-                    ((((uint32)(n) & 0xFF00)) << 8) | \
-                    ((((uint32)(n) & 0xFF0000)) >> 8) | \
-                    ((((uint32)(n) & 0xFF000000)) >> 24))
-
-#endif
-
-//-------------------------------------------------------------
-// Structure Packing Compile Options
-//-------------------------------------------------------------
-#ifdef __GNUC__
-    #define STRUCT_PACK
-    #define STRUCT_PACK_BEGIN
-    #define STRUCT_PACK_END
-    #define STRUCT_PACKED           __attribute__ ((packed))
-#else
-    // Other compilers may require other methods of packing structures
-    #define STRUCT_PACK
-    #define STRUCT_PACK_BEGIN
-    #define STRUCT_PACK_END
-    #define STRUCT_PACKED
-#endif
-
-#endif
diff --git a/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_write.h b/LinuxGUI/Ventoy2Disk/Lib/fat_io_lib/release/fat_write.h
deleted file mode 100644 (file)
index 5558a86..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef __FAT_WRITE_H__
-#define __FAT_WRITE_H__
-
-#include "fat_defs.h"
-#include "fat_opts.h"
-
-//-----------------------------------------------------------------------------
-// Prototypes
-//-----------------------------------------------------------------------------
-int fatfs_add_file_entry(struct fatfs *fs, uint32 dirCluster, char *filename, char *shortfilename, uint32 startCluster, uint32 size, int dir);
-int fatfs_add_free_space(struct fatfs *fs, uint32 *startCluster, uint32 clusters);
-int fatfs_allocate_free_space(struct fatfs *fs, int newFile, uint32 *startCluster, uint32 size);
-
-#endif
index 755a08c2ba94cac4981a6eec1b7be7a60f80d798..e7329d8a351593bff942a6c65265957758446157 100644 (file)
@@ -346,6 +346,8 @@ static int ventoy_clean_disk(int fd, uint64_t size)
     len = write(fd, buf, zerolen);
     vdebug("write disk at off:%llu writelen:%lld datalen:%d\n", (_ull)offset, (_ll)len, zerolen);
 
     len = write(fd, buf, zerolen);
     vdebug("write disk at off:%llu writelen:%lld datalen:%d\n", (_ull)offset, (_ll)len, zerolen);
 
+    fsync(fd);
+
     free(buf);
     return 0;
 }
     free(buf);
     return 0;
 }
@@ -800,7 +802,7 @@ static void * ventoy_install_thread(void *data)
     else
     {
         vdebug("Fill MBR part table\n");
     else
     {
         vdebug("Fill MBR part table\n");
-        ventoy_fill_mbr(disk->size_in_byte, thread->reserveBytes, thread->align4kb, 0, &MBR);
+        ventoy_fill_mbr(disk->size_in_byte, thread->reserveBytes, thread->align4kb, &MBR);
         Part1StartSector = MBR.PartTbl[0].StartSectorId;
         Part1SectorCount = MBR.PartTbl[0].SectorCount;
         Part2StartSector = MBR.PartTbl[1].StartSectorId;
         Part1StartSector = MBR.PartTbl[0].StartSectorId;
         Part1SectorCount = MBR.PartTbl[0].SectorCount;
         Part2StartSector = MBR.PartTbl[1].StartSectorId;
index c77ee448501cd7b26fe20cdf3184d444a95d8f62..8b16692726ab195bb60b1572e3f037416a01ebb6 100644 (file)
     var vtoy_cur_process_disk_name;\r
     var vtoy_chrome_app_mode = (window.location.href.indexOf('chrome-app') >= 0) ? 1 : 0;\r
 \r
     var vtoy_cur_process_disk_name;\r
     var vtoy_chrome_app_mode = (window.location.href.indexOf('chrome-app') >= 0) ? 1 : 0;\r
 \r
+\r
     function sort_language_list() {\r
         var tmp;\r
         for (var i = 0; i < vtoy_language_data.length; i++) {\r
     function sort_language_list() {\r
         var tmp;\r
         for (var i = 0; i < vtoy_language_data.length; i++) {\r
index 21830acc54286db5176417257525a2edeeed9ea2..001c4850a9dbb0a90e7849a166bcab441a7dca6f 100644 (file)
@@ -5,9 +5,9 @@ build_func() {
     toolDir=$3
     
     XXFLAG='-std=gnu99 -D_FILE_OFFSET_BITS=64'
     toolDir=$3
     
     XXFLAG='-std=gnu99 -D_FILE_OFFSET_BITS=64'
-    XXLIB="./Ventoy2Disk/Lib/fat_io_lib/lib/libfat_io_${libsuffix}.a"
+    XXLIB=""
     
     
-    echo "CC=$1 libsuffix=$libsuffix"    
+    echo "CC=$1 libsuffix=$libsuffix toolDir=$toolDir"    
     
     $1 $XXFLAG -c -Wall -Wextra -Wshadow -Wformat-security -Winit-self \
         -Wmissing-prototypes -O2 -DLINUX \
     
     $1 $XXFLAG -c -Wall -Wextra -Wshadow -Wformat-security -Winit-self \
         -Wmissing-prototypes -O2 -DLINUX \
@@ -29,6 +29,7 @@ build_func() {
         -I./Ventoy2Disk/Lib/xz-embedded/userspace \
         -I ./Ventoy2Disk/Lib/exfat/src/libexfat \
         -I ./Ventoy2Disk/Lib/exfat/src/mkfs \
         -I./Ventoy2Disk/Lib/xz-embedded/userspace \
         -I ./Ventoy2Disk/Lib/exfat/src/libexfat \
         -I ./Ventoy2Disk/Lib/exfat/src/mkfs \
+        -I ./Ventoy2Disk/Lib/fat_io_lib \
         \
         -L ./Ventoy2Disk/Lib/fat_io_lib/lib \
         Ventoy2Disk/*.c \
         \
         -L ./Ventoy2Disk/Lib/fat_io_lib/lib \
         Ventoy2Disk/*.c \
@@ -37,6 +38,7 @@ build_func() {
         Ventoy2Disk/Lib/xz-embedded/linux/lib/decompress_unxz.c \
         Ventoy2Disk/Lib/exfat/src/libexfat/*.c \
         Ventoy2Disk/Lib/exfat/src/mkfs/*.c \
         Ventoy2Disk/Lib/xz-embedded/linux/lib/decompress_unxz.c \
         Ventoy2Disk/Lib/exfat/src/libexfat/*.c \
         Ventoy2Disk/Lib/exfat/src/mkfs/*.c \
+        Ventoy2Disk/Lib/fat_io_lib/*.c \
         $XXLIB \
         -l pthread \
         ./civetweb.o \
         $XXLIB \
         -l pthread \
         ./civetweb.o \
index cf86fef4924dc78dbc29c8321f77218a0ba352bb..800855e6d68fe5efeedb840e9e465a4efdf6f622 100644 (file)
@@ -592,6 +592,7 @@ int VentoyFillWholeGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo)
 int VentoyFillGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo)\r
 {\r
     INT64 ReservedValue = 0;\r
 int VentoyFillGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo)\r
 {\r
     INT64 ReservedValue = 0;\r
+    UINT64 ModSectorCount = 0;\r
     UINT64 ReservedSector = 33;\r
     UINT64 Part1SectorCount = 0;\r
     UINT64 DiskSectorCount = DiskSizeBytes / 512;\r
     UINT64 ReservedSector = 33;\r
     UINT64 Part1SectorCount = 0;\r
     UINT64 DiskSectorCount = DiskSizeBytes / 512;\r
@@ -609,18 +610,28 @@ int VentoyFillGpt(UINT64 DiskSizeBytes, VTOY_GPT_INFO *pInfo)
         ReservedSector += ReservedValue * 2048;\r
     }\r
 \r
         ReservedSector += ReservedValue * 2048;\r
     }\r
 \r
+    Part1SectorCount = DiskSectorCount - ReservedSector - (VENTOY_EFI_PART_SIZE / 512) - 2048;\r
+\r
+    ModSectorCount = (Part1SectorCount % 8);\r
+    if (ModSectorCount)\r
+    {\r
+        Log("Part1SectorCount:%llu is not aligned by 4KB (%llu)", (ULONGLONG)Part1SectorCount, (ULONGLONG)ModSectorCount);\r
+    }\r
+\r
     // check aligned with 4KB\r
     if (IsPartNeed4KBAlign())\r
     {\r
     // check aligned with 4KB\r
     if (IsPartNeed4KBAlign())\r
     {\r
-        if (DiskSectorCount % 8)\r
+        if (ModSectorCount)\r
         {\r
         {\r
-            Log("Disk need to align with 4KB %u", (UINT32)(DiskSectorCount % 8));\r
-            ReservedSector += (DiskSectorCount % 8);\r
+            Log("Disk need to align with 4KB %u", (UINT32)ModSectorCount);\r
+            Part1SectorCount -= ModSectorCount;\r
+        }\r
+        else\r
+        {\r
+            Log("no need to align with 4KB");\r
         }\r
     }\r
 \r
         }\r
     }\r
 \r
-    Part1SectorCount = DiskSectorCount - ReservedSector - (VENTOY_EFI_PART_SIZE / 512) - 2048;\r
-\r
     memcpy(Head->Signature, "EFI PART", 8);\r
     Head->Version[2] = 0x01;\r
     Head->Length = 92;\r
     memcpy(Head->Signature, "EFI PART", 8);\r
     Head->Version[2] = 0x01;\r
     Head->Length = 92;\r