]> glassweightruler.freedombox.rocks Git - Ventoy.git/blobdiff - VtoyTool/vtoydump.c
LiveCD
[Ventoy.git] / VtoyTool / vtoydump.c
index fd557cf96e57b77ac4a447612ba5250e7ee5b6a4..5c3c39c0447afaecf447de9052eaa5566d6d15b4 100644 (file)
@@ -43,6 +43,18 @@ typedef unsigned char   uint8_t;
 
 #define VENTOY_GUID { 0x77772020, 0x2e77, 0x6576, { 0x6e, 0x74, 0x6f, 0x79, 0x2e, 0x6e, 0x65, 0x74 }}
 
+typedef enum ventoy_fs_type
+{
+    ventoy_fs_exfat = 0, /* 0: exfat */
+    ventoy_fs_ntfs,      /* 1: NTFS */
+    ventoy_fs_ext,       /* 2: ext2/ext3/ext4 */
+    ventoy_fs_xfs,       /* 3: XFS */
+    ventoy_fs_udf,       /* 4: UDF */
+    ventoy_fs_fat,       /* 5: FAT */
+
+    ventoy_fs_max
+}ventoy_fs_type;
+
 #pragma pack(1)
 
 typedef struct ventoy_guid
@@ -130,6 +142,11 @@ static int verbose = 0;
 
 static ventoy_guid vtoy_guid = VENTOY_GUID;
 
+static const char *g_ventoy_fs[ventoy_fs_max] = 
+{
+    "exfat", "ntfs", "ext*", "xfs", "udf", "fat"
+};
+
 static int vtoy_check_os_param(ventoy_os_param *param)
 {
     uint32_t i;
@@ -138,6 +155,16 @@ static int vtoy_check_os_param(ventoy_os_param *param)
     
     if (memcmp(&param->guid, &vtoy_guid, sizeof(ventoy_guid)))
     {
+        uint8_t *data1 = (uint8_t *)(&param->guid);
+        uint8_t *data2 = (uint8_t *)(&vtoy_guid);
+        
+        for (i = 0; i < 16; i++)
+        {
+            if (data1[i] != data2[i])
+            {
+                debug("guid not equal i = %u, 0x%02x, 0x%02x\n", i, data1[i], data2[i]);
+            }
+        }
         return 1;
     }
 
@@ -410,14 +437,10 @@ static int vtoy_print_os_param(ventoy_os_param *param, char *diskname)
         cnt = vtoy_find_disk_by_guid(param->vtoy_disk_guid, diskname);
         debug("find 0 disk by size, try with guid cnt=%d...\n", cnt);
     }
-    
-    if (param->vtoy_disk_part_type == 0)
-    {
-        fs = "exfat";
-    }
-    else if (param->vtoy_disk_part_type == 0)
+
+    if (param->vtoy_disk_part_type < ventoy_fs_max)
     {
-        fs = "ntfs";
+        fs = g_ventoy_fs[param->vtoy_disk_part_type];
     }
     else
     {