]> glassweightruler.freedombox.rocks Git - Ventoy.git/commitdiff
update vtoytool
authorlongpanda <admin@ventoy.net>
Wed, 14 Apr 2021 02:26:27 +0000 (10:26 +0800)
committerlongpanda <admin@ventoy.net>
Wed, 14 Apr 2021 02:26:27 +0000 (10:26 +0800)
VtoyTool/vtoydump.c
VtoyTool/vtoytool/00/vtoytool_32
VtoyTool/vtoytool/00/vtoytool_64
VtoyTool/vtoytool/00/vtoytool_aa64
VtoyTool/vtoytool/00/vtoytool_m64e

index d33151a44029c1fde8a5c621ddd11c71e7d226d7..34c1ee7e5e1b613357c2fa64a41417b7b937dadb 100644 (file)
@@ -435,6 +435,33 @@ static int vtoy_printf_iso_path(ventoy_os_param *param)
     return 0;
 }
 
+static int vtoy_check_device(ventoy_os_param *param, const char *device)
+{
+    unsigned long long size; 
+    uint8_t vtguid[16] = {0};
+    uint8_t vtsig[4] = {0};
+
+    debug("vtoy_check_device for <%s>\n", device);
+
+    size = vtoy_get_disk_size_in_byte(device);
+    vtoy_get_disk_guid(device, vtguid, vtsig);
+
+    debug("param->vtoy_disk_size=%llu size=%llu\n", 
+        (unsigned long long)param->vtoy_disk_size, (unsigned long long)size);
+
+    if (memcmp(vtguid, param->vtoy_disk_guid, 16) == 0 &&
+        memcmp(vtsig, param->vtoy_disk_signature, 4) == 0)
+    {
+        debug("<%s> is right ventoy disk\n", device);
+        return 0;
+    }
+    else
+    {
+        debug("<%s> is NOT right ventoy disk\n", device);
+        return 1;
+    }
+}
+
 static int vtoy_print_os_param(ventoy_os_param *param, char *diskname)
 {
     int   cnt = 0;
@@ -442,16 +469,20 @@ static int vtoy_print_os_param(ventoy_os_param *param, char *diskname)
     const char *fs;
 
     cnt = vtoy_find_disk_by_size(param->vtoy_disk_size, diskname);
-    if (cnt > 1)
+    debug("find disk by size %llu, cnt=%d...\n", (unsigned long long)param->vtoy_disk_size, cnt);
+    if (1 == cnt)
     {
-        cnt = vtoy_find_disk_by_guid(param, diskname);
+        if (vtoy_check_device(param, diskname) != 0)
+        {
+            cnt = 0;
+        }
     }
-    else if (cnt == 0)
+    else
     {
         cnt = vtoy_find_disk_by_guid(param, diskname);
-        debug("find 0 disk by size, try with guid cnt=%d...\n", cnt);
+        debug("find disk by guid cnt=%d...\n", cnt);
     }
-
+    
     if (param->vtoy_disk_part_type < ventoy_fs_max)
     {
         fs = g_ventoy_fs[param->vtoy_disk_part_type];
@@ -472,33 +503,6 @@ static int vtoy_print_os_param(ventoy_os_param *param, char *diskname)
     }
 }
 
-static int vtoy_check_device(ventoy_os_param *param, const char *device)
-{
-    unsigned long long size; 
-    uint8_t vtguid[16] = {0};
-    uint8_t vtsig[4] = {0};
-
-    debug("vtoy_check_device for <%s>\n", device);
-
-    size = vtoy_get_disk_size_in_byte(device);
-    vtoy_get_disk_guid(device, vtguid, vtsig);
-
-    debug("param->vtoy_disk_size=%llu size=%llu\n", 
-        (unsigned long long)param->vtoy_disk_size, (unsigned long long)size);
-
-    if (memcmp(vtguid, param->vtoy_disk_guid, 16) == 0 &&
-        memcmp(vtsig, param->vtoy_disk_signature, 4) == 0)
-    {
-        debug("<%s> is right ventoy disk\n", device);
-        return 0;
-    }
-    else
-    {
-        debug("<%s> is NOT right ventoy disk\n", device);
-        return 1;
-    }
-}
-
 /*
  *  Find disk and image path from ventoy runtime data.
  *  By default data is read from phymem(legacy bios) or efivar(UEFI), if -f is input, data is read from file.
index a9e11f864b4f96687212f5aedaf607e07326894a..6cda86be93f1ce56ab9f7b42c1e1f80f1757bf88 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_32 and b/VtoyTool/vtoytool/00/vtoytool_32 differ
index 52a4e5611e0e84ce851c5160a357bef3e69bcad5..1acd940fbd504b3d96245cad850ed9324a800993 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_64 and b/VtoyTool/vtoytool/00/vtoytool_64 differ
index c342a7961c71c32ac25f0fcdfa6b930d04c614c1..9a429bc5ffe74bcac6b965e0f08577041e62a41d 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_aa64 and b/VtoyTool/vtoytool/00/vtoytool_aa64 differ
index 35098d76f634b1548b9b57e8172be58daa378572..3fd69195dfbd4e489fa295081ca061da9f6c6ed5 100644 (file)
Binary files a/VtoyTool/vtoytool/00/vtoytool_m64e and b/VtoyTool/vtoytool/00/vtoytool_m64e differ