mirror of https://github.com/ventoy/Ventoy.git
Code Optimization
This commit is contained in:
parent
4a42bdfce7
commit
1ab1799b72
|
@ -188,6 +188,21 @@ void * ventoy_alloc_chain(grub_size_t size)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ventoy_memfile_env_set(const char *prefix, const void *buf, unsigned long long len)
|
||||||
|
{
|
||||||
|
char name[128];
|
||||||
|
char val[64];
|
||||||
|
|
||||||
|
grub_snprintf(name, sizeof(name), "%s_addr", prefix);
|
||||||
|
grub_snprintf(val, sizeof(val), "0x%llx", (ulonglong)(ulong)buf);
|
||||||
|
grub_env_set(name, val);
|
||||||
|
|
||||||
|
grub_snprintf(name, sizeof(name), "%s_size", prefix);
|
||||||
|
grub_snprintf(val, sizeof(val), "%llu", len);
|
||||||
|
grub_env_set(name, val);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
static int ventoy_arch_mode_init(void)
|
static int ventoy_arch_mode_init(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1036,8 +1036,6 @@ static grub_err_t ventoy_cmd_concat_efi_iso(grub_extcmd_context_t ctxt, int argc
|
||||||
int totlen = 0;
|
int totlen = 0;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
char name[32];
|
|
||||||
char value[32];
|
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
char *data = NULL;
|
char *data = NULL;
|
||||||
ventoy_iso9660_override *dirent;
|
ventoy_iso9660_override *dirent;
|
||||||
|
@ -1097,13 +1095,7 @@ static grub_err_t ventoy_cmd_concat_efi_iso(grub_extcmd_context_t ctxt, int argc
|
||||||
grub_file_read(file, data + sizeof(ventoy_chain_head) + len, file->size);
|
grub_file_read(file, data + sizeof(ventoy_chain_head) + len, file->size);
|
||||||
grub_file_close(file);
|
grub_file_close(file);
|
||||||
|
|
||||||
grub_snprintf(name, sizeof(name), "%s_addr", args[1]);
|
ventoy_memfile_env_set(args[1], data, (ulonglong)totlen);
|
||||||
grub_snprintf(value, sizeof(value), "0x%llx", (ulonglong)(ulong)data);
|
|
||||||
grub_env_set(name, value);
|
|
||||||
|
|
||||||
grub_snprintf(name, sizeof(name), "%s_size", args[1]);
|
|
||||||
grub_snprintf(value, sizeof(value), "%d", (int)(totlen));
|
|
||||||
grub_env_set(name, value);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1170,8 +1162,6 @@ grub_ssize_t ventoy_load_file_with_prompt(grub_file_t file, void *buf, grub_ssiz
|
||||||
static grub_err_t ventoy_cmd_load_file_to_mem(grub_extcmd_context_t ctxt, int argc, char **args)
|
static grub_err_t ventoy_cmd_load_file_to_mem(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
{
|
{
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
char name[32];
|
|
||||||
char value[32];
|
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
enum grub_file_type type;
|
enum grub_file_type type;
|
||||||
|
@ -1222,13 +1212,7 @@ static grub_err_t ventoy_cmd_load_file_to_mem(grub_extcmd_context_t ctxt, int ar
|
||||||
grub_file_read(file, buf, file->size);
|
grub_file_read(file, buf, file->size);
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_snprintf(name, sizeof(name), "%s_addr", args[2]);
|
ventoy_memfile_env_set(args[2], buf, (ulonglong)(file->size));
|
||||||
grub_snprintf(value, sizeof(value), "0x%llx", (unsigned long long)(unsigned long)buf);
|
|
||||||
grub_env_set(name, value);
|
|
||||||
|
|
||||||
grub_snprintf(name, sizeof(name), "%s_size", args[2]);
|
|
||||||
grub_snprintf(value, sizeof(value), "%llu", (unsigned long long)file->size);
|
|
||||||
grub_env_set(name, value);
|
|
||||||
|
|
||||||
grub_file_close(file);
|
grub_file_close(file);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
@ -1240,8 +1224,6 @@ static grub_err_t ventoy_cmd_load_img_memdisk(grub_extcmd_context_t ctxt, int ar
|
||||||
{
|
{
|
||||||
int rc = 1;
|
int rc = 1;
|
||||||
int headlen;
|
int headlen;
|
||||||
char name[32];
|
|
||||||
char value[32];
|
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
|
|
||||||
|
@ -1273,13 +1255,7 @@ static grub_err_t ventoy_cmd_load_img_memdisk(grub_extcmd_context_t ctxt, int ar
|
||||||
|
|
||||||
grub_file_read(file, buf + headlen, file->size);
|
grub_file_read(file, buf + headlen, file->size);
|
||||||
|
|
||||||
grub_snprintf(name, sizeof(name), "%s_addr", args[1]);
|
ventoy_memfile_env_set(args[1], buf, (ulonglong)(file->size));
|
||||||
grub_snprintf(value, sizeof(value), "0x%llx", (unsigned long long)(unsigned long)buf);
|
|
||||||
grub_env_set(name, value);
|
|
||||||
|
|
||||||
grub_snprintf(name, sizeof(name), "%s_size", args[1]);
|
|
||||||
grub_snprintf(value, sizeof(value), "%llu", (unsigned long long)file->size);
|
|
||||||
grub_env_set(name, value);
|
|
||||||
|
|
||||||
grub_file_close(file);
|
grub_file_close(file);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
|
|
|
@ -1572,7 +1572,6 @@ grub_err_t ventoy_cmd_trailer_cpio(grub_extcmd_context_t ctxt, int argc, char **
|
||||||
grub_uint8_t *bufend;
|
grub_uint8_t *bufend;
|
||||||
cpio_newc_header *head;
|
cpio_newc_header *head;
|
||||||
grub_file_t file;
|
grub_file_t file;
|
||||||
char value[64];
|
|
||||||
const grub_uint8_t trailler[124] = {
|
const grub_uint8_t trailler[124] = {
|
||||||
0x30, 0x37, 0x30, 0x37, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
0x30, 0x37, 0x30, 0x37, 0x30, 0x31, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
||||||
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
|
||||||
|
@ -1644,10 +1643,7 @@ grub_err_t ventoy_cmd_trailer_cpio(grub_extcmd_context_t ctxt, int argc, char **
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_snprintf(value, sizeof(value), "0x%llx", (ulonglong)(ulong)g_ventoy_cpio_buf);
|
ventoy_memfile_env_set("ventoy_cpio", g_ventoy_cpio_buf, (ulonglong)bufsize);
|
||||||
ventoy_set_env("ventoy_cpio_addr", value);
|
|
||||||
grub_snprintf(value, sizeof(value), "%d", bufsize);
|
|
||||||
ventoy_set_env("ventoy_cpio_size", value);
|
|
||||||
|
|
||||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||||
}
|
}
|
||||||
|
@ -1669,7 +1665,6 @@ grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, cha
|
||||||
const char *pLastChain = NULL;
|
const char *pLastChain = NULL;
|
||||||
const char *compatible;
|
const char *compatible;
|
||||||
ventoy_chain_head *chain;
|
ventoy_chain_head *chain;
|
||||||
char envbuf[64];
|
|
||||||
|
|
||||||
(void)ctxt;
|
(void)ctxt;
|
||||||
(void)argc;
|
(void)argc;
|
||||||
|
@ -1757,10 +1752,7 @@ grub_err_t ventoy_cmd_linux_chain_data(grub_extcmd_context_t ctxt, int argc, cha
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
|
||||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
|
||||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
|
||||||
|
|
||||||
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
||||||
|
|
||||||
|
@ -1921,8 +1913,6 @@ out:
|
||||||
grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, char **args)
|
grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
{
|
{
|
||||||
static char *buf = NULL;
|
static char *buf = NULL;
|
||||||
char name[128];
|
|
||||||
char value[64];
|
|
||||||
grub_fs_t fs;
|
grub_fs_t fs;
|
||||||
char *device_name = NULL;
|
char *device_name = NULL;
|
||||||
grub_device_t dev = NULL;
|
grub_device_t dev = NULL;
|
||||||
|
@ -1967,13 +1957,7 @@ grub_err_t ventoy_cmd_linux_systemd_menu(grub_extcmd_context_t ctxt, int argc, c
|
||||||
ctx.len = VTOY_LINUX_SYSTEMD_MENU_MAX_BUF;
|
ctx.len = VTOY_LINUX_SYSTEMD_MENU_MAX_BUF;
|
||||||
fs->fs_dir(dev, "/loader/entries", ventoy_systemd_conf_hook, &ctx);
|
fs->fs_dir(dev, "/loader/entries", ventoy_systemd_conf_hook, &ctx);
|
||||||
|
|
||||||
grub_snprintf(name, sizeof(name), "%s_addr", args[1]);
|
ventoy_memfile_env_set(args[1], buf, (ulonglong)(ctx.pos));
|
||||||
grub_snprintf(value, sizeof(value), "0x%llx", (ulonglong)(ulong)buf);
|
|
||||||
grub_env_set(name, value);
|
|
||||||
|
|
||||||
grub_snprintf(name, sizeof(name), "%s_size", args[1]);
|
|
||||||
grub_snprintf(value, sizeof(value), "%d", ctx.pos);
|
|
||||||
grub_env_set(name, value);
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
grub_check_free(device_name);
|
grub_check_free(device_name);
|
||||||
|
@ -2011,8 +1995,6 @@ grub_err_t ventoy_cmd_linux_limine_menu(grub_extcmd_context_t ctxt, int argc, ch
|
||||||
char *start = NULL;
|
char *start = NULL;
|
||||||
char *nextline = NULL;
|
char *nextline = NULL;
|
||||||
grub_file_t file = NULL;
|
grub_file_t file = NULL;
|
||||||
char name[128];
|
|
||||||
char value[64];
|
|
||||||
char *title = NULL;
|
char *title = NULL;
|
||||||
char *kernel = NULL;
|
char *kernel = NULL;
|
||||||
char *initrd = NULL;
|
char *initrd = NULL;
|
||||||
|
@ -2120,13 +2102,7 @@ grub_err_t ventoy_cmd_linux_limine_menu(grub_extcmd_context_t ctxt, int argc, ch
|
||||||
sub = 0;
|
sub = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_snprintf(name, sizeof(name), "%s_addr", args[1]);
|
ventoy_memfile_env_set(args[1], buf, (ulonglong)pos);
|
||||||
grub_snprintf(value, sizeof(value), "0x%llx", (ulonglong)(ulong)buf);
|
|
||||||
grub_env_set(name, value);
|
|
||||||
|
|
||||||
grub_snprintf(name, sizeof(name), "%s_size", args[1]);
|
|
||||||
grub_snprintf(value, sizeof(value), "%d", pos);
|
|
||||||
grub_env_set(name, value);
|
|
||||||
|
|
||||||
end:
|
end:
|
||||||
grub_check_free(filebuf);
|
grub_check_free(filebuf);
|
||||||
|
|
|
@ -1118,7 +1118,6 @@ grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||||
const char *pLastChain = NULL;
|
const char *pLastChain = NULL;
|
||||||
const char *compatible;
|
const char *compatible;
|
||||||
ventoy_chain_head *chain;
|
ventoy_chain_head *chain;
|
||||||
char envbuf[64];
|
|
||||||
|
|
||||||
(void)ctxt;
|
(void)ctxt;
|
||||||
(void)argc;
|
(void)argc;
|
||||||
|
@ -1197,10 +1196,7 @@ grub_err_t ventoy_cmd_unix_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
|
||||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
|
||||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
|
||||||
|
|
||||||
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,6 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
|
||||||
int patchoffset[2];
|
int patchoffset[2];
|
||||||
ventoy_patch_vhd *patch1;
|
ventoy_patch_vhd *patch1;
|
||||||
ventoy_patch_vhd *patch2;
|
ventoy_patch_vhd *patch2;
|
||||||
char envbuf[64];
|
|
||||||
|
|
||||||
(void)ctxt;
|
(void)ctxt;
|
||||||
(void)argc;
|
(void)argc;
|
||||||
|
@ -356,15 +355,9 @@ grub_err_t ventoy_cmd_patch_vhdboot(grub_extcmd_context_t ctxt, int argc, char *
|
||||||
|
|
||||||
/* set buffer and size */
|
/* set buffer and size */
|
||||||
#ifdef GRUB_MACHINE_EFI
|
#ifdef GRUB_MACHINE_EFI
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (ulong)g_vhdboot_totbuf);
|
ventoy_memfile_env_set("vtoy_vhd_buf", g_vhdboot_totbuf, (ulonglong)(g_vhdboot_isolen + sizeof(ventoy_chain_head)));
|
||||||
grub_env_set("vtoy_vhd_buf_addr", envbuf);
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "%d", (int)(g_vhdboot_isolen + sizeof(ventoy_chain_head)));
|
|
||||||
grub_env_set("vtoy_vhd_buf_size", envbuf);
|
|
||||||
#else
|
#else
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (ulong)g_vhdboot_isobuf);
|
ventoy_memfile_env_set("vtoy_vhd_buf", g_vhdboot_isobuf, (ulonglong)g_vhdboot_isolen);
|
||||||
grub_env_set("vtoy_vhd_buf_addr", envbuf);
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "%d", g_vhdboot_isolen);
|
|
||||||
grub_env_set("vtoy_vhd_buf_size", envbuf);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
VENTOY_CMD_RETURN(GRUB_ERR_NONE);
|
||||||
|
@ -645,7 +638,6 @@ grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||||
grub_disk_t disk;
|
grub_disk_t disk;
|
||||||
const char *pLastChain = NULL;
|
const char *pLastChain = NULL;
|
||||||
ventoy_chain_head *chain;
|
ventoy_chain_head *chain;
|
||||||
char envbuf[64];
|
|
||||||
|
|
||||||
(void)ctxt;
|
(void)ctxt;
|
||||||
(void)argc;
|
(void)argc;
|
||||||
|
@ -695,10 +687,7 @@ grub_err_t ventoy_cmd_raw_chain_data(grub_extcmd_context_t ctxt, int argc, char
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
|
||||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
|
||||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
|
||||||
|
|
||||||
grub_env_export("vtoy_chain_mem_addr");
|
grub_env_export("vtoy_chain_mem_addr");
|
||||||
grub_env_export("vtoy_chain_mem_size");
|
grub_env_export("vtoy_chain_mem_size");
|
||||||
|
|
|
@ -2033,7 +2033,6 @@ grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc,
|
||||||
grub_uint8_t *param = NULL;
|
grub_uint8_t *param = NULL;
|
||||||
grub_uint8_t *exe_data = NULL;
|
grub_uint8_t *exe_data = NULL;
|
||||||
ventoy_windows_data *rtdata = NULL;
|
ventoy_windows_data *rtdata = NULL;
|
||||||
char envbuf[64] = {0};
|
|
||||||
char exename[128] = {0};
|
char exename[128] = {0};
|
||||||
wim_tail wim_data;
|
wim_tail wim_data;
|
||||||
|
|
||||||
|
@ -2076,13 +2075,7 @@ grub_err_t ventoy_cmd_windows_wimboot_data(grub_extcmd_context_t ctxt, int argc,
|
||||||
rtdata = (ventoy_windows_data *)(param + jump_align + sizeof(ventoy_os_param));
|
rtdata = (ventoy_windows_data *)(param + jump_align + sizeof(ventoy_os_param));
|
||||||
ventoy_fill_windows_rtdata(rtdata, chain->os_param.vtoy_img_path, dataflag);
|
ventoy_fill_windows_rtdata(rtdata, chain->os_param.vtoy_img_path, dataflag);
|
||||||
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (ulong)param);
|
ventoy_memfile_env_set("vtoy_wimboot_mem", param, (ulonglong)(wim_data.bin_align_len));
|
||||||
grub_env_set("vtoy_wimboot_mem_addr", envbuf);
|
|
||||||
debug("vtoy_wimboot_mem_addr: %s\n", envbuf);
|
|
||||||
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", wim_data.bin_align_len);
|
|
||||||
grub_env_set("vtoy_wimboot_mem_size", envbuf);
|
|
||||||
debug("vtoy_wimboot_mem_size: %s\n", envbuf);
|
|
||||||
|
|
||||||
grub_env_set(args[1], exename);
|
grub_env_set(args[1], exename);
|
||||||
grub_env_set(args[2], wim64 ? "64" : "32");
|
grub_env_set(args[2], wim64 ? "64" : "32");
|
||||||
|
@ -2105,7 +2098,6 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
|
||||||
const char *pLastChain = NULL;
|
const char *pLastChain = NULL;
|
||||||
const char *compatible;
|
const char *compatible;
|
||||||
ventoy_chain_head *chain;
|
ventoy_chain_head *chain;
|
||||||
char envbuf[64];
|
|
||||||
|
|
||||||
(void)ctxt;
|
(void)ctxt;
|
||||||
(void)argc;
|
(void)argc;
|
||||||
|
@ -2200,10 +2192,7 @@ grub_err_t ventoy_cmd_windows_chain_data(grub_extcmd_context_t ctxt, int argc, c
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
|
||||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
|
||||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
|
||||||
|
|
||||||
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
||||||
|
|
||||||
|
@ -2437,7 +2426,6 @@ static grub_err_t ventoy_vlnk_wim_chain_data(grub_file_t wimfile)
|
||||||
ventoy_img_chunk *chunknode;
|
ventoy_img_chunk *chunknode;
|
||||||
ventoy_override_chunk *override;
|
ventoy_override_chunk *override;
|
||||||
ventoy_img_chunk_list wimchunk;
|
ventoy_img_chunk_list wimchunk;
|
||||||
char envbuf[128];
|
|
||||||
|
|
||||||
debug("vlnk wim chain data begin <%s> ...\n", wimfile->name);
|
debug("vlnk wim chain data begin <%s> ...\n", wimfile->name);
|
||||||
|
|
||||||
|
@ -2494,10 +2482,7 @@ static grub_err_t ventoy_vlnk_wim_chain_data(grub_file_t wimfile)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
|
||||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
|
||||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
|
||||||
|
|
||||||
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
||||||
|
|
||||||
|
@ -2602,7 +2587,6 @@ static grub_err_t ventoy_normal_wim_chain_data(grub_file_t wimfile)
|
||||||
ventoy_img_chunk *chunknode;
|
ventoy_img_chunk *chunknode;
|
||||||
ventoy_override_chunk *override;
|
ventoy_override_chunk *override;
|
||||||
ventoy_img_chunk_list wimchunk;
|
ventoy_img_chunk_list wimchunk;
|
||||||
char envbuf[128];
|
|
||||||
|
|
||||||
debug("normal wim chain data begin <%s> ...\n", wimfile->name);
|
debug("normal wim chain data begin <%s> ...\n", wimfile->name);
|
||||||
|
|
||||||
|
@ -2659,10 +2643,7 @@ static grub_err_t ventoy_normal_wim_chain_data(grub_file_t wimfile)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "0x%lx", (unsigned long)chain);
|
ventoy_memfile_env_set("vtoy_chain_mem", chain, (ulonglong)size);
|
||||||
grub_env_set("vtoy_chain_mem_addr", envbuf);
|
|
||||||
grub_snprintf(envbuf, sizeof(envbuf), "%u", size);
|
|
||||||
grub_env_set("vtoy_chain_mem_size", envbuf);
|
|
||||||
|
|
||||||
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
grub_memset(chain, 0, sizeof(ventoy_chain_head));
|
||||||
|
|
||||||
|
|
|
@ -304,6 +304,7 @@ grub_uint64_t grub_udf_get_last_file_attr_offset
|
||||||
grub_uint64_t *fe_entry_size_offset
|
grub_uint64_t *fe_entry_size_offset
|
||||||
);
|
);
|
||||||
int ventoy_is_efi_os(void);
|
int ventoy_is_efi_os(void);
|
||||||
|
void ventoy_memfile_env_set(const char *prefix, const void *buf, unsigned long long len);
|
||||||
|
|
||||||
#endif /* __VENTOY_H__ */
|
#endif /* __VENTOY_H__ */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue