1.0.38 release

This commit is contained in:
longpanda 2021-03-16 19:35:19 +08:00
parent 26b3bca25b
commit 0717195481
8 changed files with 51 additions and 10 deletions

View file

@ -127,6 +127,7 @@ static ventoy_video_mode *g_video_mode_list = NULL;
static int g_enumerate_time_checked = 0;
static grub_uint64_t g_enumerate_start_time_ms;
static grub_uint64_t g_enumerate_finish_time_ms;
static int g_vtoy_file_flt[VTOY_FILE_FLT_BUTT] = {0};
static const char *g_menu_class[] =
{
@ -233,6 +234,17 @@ static grub_ssize_t ventoy_fs_read(grub_file_t file, char *buf, grub_size_t len)
return len;
}
static int ventoy_control_get_flag(const char *key)
{
const char *val = ventoy_get_env(key);
if (val && val[0] == '1' && val[1] == 0)
{
return 1;
}
return 0;
}
static grub_err_t ventoy_fs_close(grub_file_t file)
{
grub_file_close(g_old_file);
@ -1270,26 +1282,26 @@ static int ventoy_collect_img_files(const char *filename, const struct grub_dirh
return 0;
}
if (0 == grub_strcasecmp(filename + len - 4, ".iso"))
if (FILE_FLT(ISO) && 0 == grub_strcasecmp(filename + len - 4, ".iso"))
{
type = img_type_iso;
}
else if (g_wimboot_enable && (0 == grub_strcasecmp(filename + len - 4, ".wim")))
else if (FILE_FLT(WIM) && g_wimboot_enable && (0 == grub_strcasecmp(filename + len - 4, ".wim")))
{
type = img_type_wim;
}
else if (g_vhdboot_enable && (0 == grub_strcasecmp(filename + len - 4, ".vhd") ||
(len >= 5 && 0 == grub_strcasecmp(filename + len - 5, ".vhdx"))))
else if (FILE_FLT(VHD) && g_vhdboot_enable && (0 == grub_strcasecmp(filename + len - 4, ".vhd") ||
(len >= 5 && 0 == grub_strcasecmp(filename + len - 5, ".vhdx"))))
{
type = img_type_vhd;
}
#ifdef GRUB_MACHINE_EFI
else if (0 == grub_strcasecmp(filename + len - 4, ".efi"))
else if (FILE_FLT(EFI) && 0 == grub_strcasecmp(filename + len - 4, ".efi"))
{
type = img_type_efi;
}
#endif
else if (0 == grub_strcasecmp(filename + len - 4, ".img"))
else if (FILE_FLT(IMG) && 0 == grub_strcasecmp(filename + len - 4, ".img"))
{
if (len == 18 && grub_strncmp(filename, "ventoy_", 7) == 0)
{
@ -1301,7 +1313,7 @@ static int ventoy_collect_img_files(const char *filename, const struct grub_dirh
}
type = img_type_img;
}
else if (len >= 5 && 0 == grub_strcasecmp(filename + len - 5, ".vtoy"))
else if (FILE_FLT(VTOY) && len >= 5 && 0 == grub_strcasecmp(filename + len - 5, ".vtoy"))
{
type = img_type_vtoy;
}
@ -2076,6 +2088,13 @@ static grub_err_t ventoy_cmd_list_img(grub_extcmd_context_t ctxt, int argc, char
}
}
g_vtoy_file_flt[VTOY_FILE_FLT_ISO] = ventoy_control_get_flag("VTOY_FILE_FLT_ISO");
g_vtoy_file_flt[VTOY_FILE_FLT_WIM] = ventoy_control_get_flag("VTOY_FILE_FLT_WIM");
g_vtoy_file_flt[VTOY_FILE_FLT_EFI] = ventoy_control_get_flag("VTOY_FILE_FLT_EFI");
g_vtoy_file_flt[VTOY_FILE_FLT_IMG] = ventoy_control_get_flag("VTOY_FILE_FLT_IMG");
g_vtoy_file_flt[VTOY_FILE_FLT_VHD] = ventoy_control_get_flag("VTOY_FILE_FLT_VHD");
g_vtoy_file_flt[VTOY_FILE_FLT_VTOY] = ventoy_control_get_flag("VTOY_FILE_FLT_VTOY");
for (node = &g_img_iterator_head; node; node = node->next)
{
fs->fs_dir(dev, node->dir, ventoy_collect_img_files, node);

View file

@ -76,6 +76,20 @@
return (err);\
}
typedef enum VTOY_FILE_FLT
{
VTOY_FILE_FLT_ISO = 0, /* .iso */
VTOY_FILE_FLT_WIM, /* .wim */
VTOY_FILE_FLT_EFI, /* .efi */
VTOY_FILE_FLT_IMG, /* .img */
VTOY_FILE_FLT_VHD, /* .vhd(x) */
VTOY_FILE_FLT_VTOY, /* .vtoy */
VTOY_FILE_FLT_BUTT
}VTOY_FILE_FLT;
#define FILE_FLT(type) (0 == g_vtoy_file_flt[VTOY_FILE_FLT_##type])
typedef struct ventoy_initrd_ctx
{
const char *path_prefix;