Skip to content

Commit

Permalink
1.0.66 release
Browse files Browse the repository at this point in the history
  • Loading branch information
ventoy committed Feb 13, 2022
1 parent c57717a commit ba5978d
Show file tree
Hide file tree
Showing 287 changed files with 3,348 additions and 225 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/issue_template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ body:
attributes:
label: Ventoy Version
description: What version of ventoy are you running?
placeholder: 1.0.65
placeholder: 1.0.66
validations:
required: true
- type: dropdown
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,14 @@ static void EFIAPI ventoy_dump_chain(ventoy_chain_head *chain)
debug("os_param->vtoy_img_size=<%llu>", chain->os_param.vtoy_img_size);
debug("os_param->vtoy_img_location_addr=<0x%llx>", chain->os_param.vtoy_img_location_addr);
debug("os_param->vtoy_img_location_len=<%u>", chain->os_param.vtoy_img_location_len);
debug("os_param->vtoy_reserved=<%u %u %u %u %u>",
debug("os_param->vtoy_reserved=<%u %u %u %u %u %u %u>",
g_os_param_reserved[0],
g_os_param_reserved[1],
g_os_param_reserved[2],
g_os_param_reserved[3],
g_os_param_reserved[4]
g_os_param_reserved[4],
g_os_param_reserved[5],
g_os_param_reserved[6]
);

ventoy_debug_pause();
Expand Down Expand Up @@ -578,7 +580,7 @@ STATIC EFI_STATUS EFIAPI ventoy_find_iso_disk(IN EFI_HANDLE ImageHandle)
if (CompareMem(g_chain->os_param.vtoy_disk_guid, pBuffer + 0x180, 16) == 0)
{
pMBR = (MBR_HEAD *)pBuffer;
if (pMBR->PartTbl[0].FsFlag != 0xEE)
if (g_os_param_reserved[6] == 0 && pMBR->PartTbl[0].FsFlag != 0xEE)
{
if (pMBR->PartTbl[0].StartSectorId != 2048 ||
pMBR->PartTbl[1].SectorCount != 65536 ||
Expand Down Expand Up @@ -956,6 +958,7 @@ STATIC EFI_STATUS EFIAPI ventoy_parse_cmdline(IN EFI_HANDLE ImageHandle)
debug("memdisk mode iso_buf_size:%u", g_iso_buf_size);

g_chain = chain;
g_os_param_reserved = (UINT8 *)(g_chain->os_param.vtoy_reserved);
gMemdiskMode = TRUE;
}
else
Expand Down
97 changes: 94 additions & 3 deletions GRUB2/MOD_SRC/grub-2.04/grub-core/kern/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,109 @@ int ventoy_check_file_exist(const char * fmt, ...)
}
}

typedef struct grub_vlnk
{
int srclen;
char src[512];
char dst[512];
struct grub_vlnk *next;
}grub_vlnk;

static grub_vlnk *g_vlnk_list;

int grub_file_is_vlnk_suffix(const char *name, int len)
{
grub_uint32_t suffix;

if (len > 9)
{
suffix = *(grub_uint32_t *)(name + len - 4);
if (grub_strncmp(name + len - 9, ".vlnk.", 6) == 0)
{
/* .iso .wim .img .vhd .efi .dat */
if (suffix == 0x6F73692E || suffix == 0x6D69772E ||
suffix == 0x676D692E || suffix == 0x6468762E ||
suffix == 0x6966652E || suffix == 0x7461642E)
{
return 1;
}
}
else if (len > 10 && grub_strncmp(name + len - 10, ".vlnk.", 6) == 0)
{
/* vhdx vtoy */
if (suffix == 0x78646876 || suffix == 0x796F7476)
{
return 1;
}
}
}

return 0;
}

int grub_file_add_vlnk(const char *src, const char *dst)
{
grub_vlnk *node = NULL;

if (src && dst)
{
node = grub_zalloc(sizeof(grub_vlnk));
if (node)
{
node->srclen = (int)grub_strlen(src);
grub_strncpy(node->src, src, sizeof(node->src) - 1);
grub_strncpy(node->dst, dst, sizeof(node->dst) - 1);

node->next = g_vlnk_list;
g_vlnk_list = node;
return 0;
}
}

return 1;
}

const char *grub_file_get_vlnk(const char *name, int *vlnk)
{
int len;
grub_vlnk *node = g_vlnk_list;

len = grub_strlen(name);
if (!grub_file_is_vlnk_suffix(name, len))
{
return name;
}

while (node)
{
if (node->srclen == len && grub_strcmp(name, node->src) == 0)
{
*vlnk = 1;
return node->dst;
}
node = node->next;
}

return name;
}

grub_file_t
grub_file_open (const char *name, enum grub_file_type type)
{
int vlnk = 0;
grub_device_t device = 0;
grub_file_t file = 0, last_file = 0;
char *device_name;
const char *file_name;
grub_file_filter_id_t filter;

/* <DESC> : mem:xxx:size:xxx format in chainloader */
if (grub_strncmp(name, GRUB_MEMFILE_MEM, grub_strlen(GRUB_MEMFILE_MEM)) == 0) {
/* <DESC> : mem:xxx:size:xxx format in chainloader grub_strlen(GRUB_MEMFILE_MEM) */
if (grub_strncmp(name, GRUB_MEMFILE_MEM, 4) == 0) {
return grub_memfile_open(name);
}
}

if (g_vlnk_list && (type & GRUB_FILE_TYPE_NO_VLNK) == 0)
name = grub_file_get_vlnk(name, &vlnk);

device_name = grub_file_get_device_name (name);
if (grub_errno)
Expand All @@ -141,6 +231,7 @@ grub_file_open (const char *name, enum grub_file_type type)
goto fail;

file->device = device;
file->vlnk = vlnk;

/* In case of relative pathnames and non-Unix systems (like Windows)
* name of host files may not start with `/'. Blocklists for host files
Expand Down
38 changes: 38 additions & 0 deletions GRUB2/MOD_SRC/grub-2.04/grub-core/kern/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,44 @@ probe_dummy_iter (const char *filename __attribute__ ((unused)),
return 1;
}

grub_fs_t grub_fs_list_probe(grub_device_t device, const char **list)
{
int i;
grub_fs_t p;

if (!device->disk)
return 0;

for (p = grub_fs_list; p; p = p->next)
{
for (i = 0; list[i]; i++)
{
if (grub_strcmp(p->name, list[i]) == 0)
break;
}

if (list[i] == NULL)
continue;

grub_dprintf("fs", "Detecting %s...\n", p->name);

(p->fs_dir) (device, "/", probe_dummy_iter, NULL);
if (grub_errno == GRUB_ERR_NONE)
return p;

grub_error_push ();
grub_dprintf ("fs", "%s detection failed.\n", p->name);
grub_error_pop ();

if (grub_errno != GRUB_ERR_BAD_FS && grub_errno != GRUB_ERR_OUT_OF_RANGE) {
return 0;
}
grub_errno = GRUB_ERR_NONE;
}

return 0;
}

grub_fs_t
grub_fs_probe (grub_device_t device)
{
Expand Down
Loading

0 comments on commit ba5978d

Please sign in to comment.