#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_max
+}ventoy_fs_type;
+
#pragma pack(1)
typedef struct ventoy_guid
static ventoy_guid vtoy_guid = VENTOY_GUID;
+static const char *g_ventoy_fs[ventoy_fs_max] =
+{
+ "exfat", "ntfs", "ext*", "xfs", "udf"
+};
+
static int vtoy_check_os_param(ventoy_os_param *param)
{
uint32_t i;
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
{
debug("param->vtoy_disk_size=%llu size=%llu\n",
(unsigned long long)param->vtoy_disk_size, (unsigned long long)size);
- if (param->vtoy_disk_size == size &&
+ if ((param->vtoy_disk_size == size || param->vtoy_disk_size == size + 512) &&
memcmp(vtguid, param->vtoy_disk_guid, 16) == 0)
{
debug("<%s> is right ventoy disk\n", device);