update vtoytool

This commit is contained in:
longpanda 2021-04-14 10:26:27 +08:00
parent 2750f0c5a7
commit 0aff8f5109
5 changed files with 41 additions and 37 deletions

View File

@ -435,43 +435,6 @@ static int vtoy_printf_iso_path(ventoy_os_param *param)
return 0;
}
static int vtoy_print_os_param(ventoy_os_param *param, char *diskname)
{
int cnt = 0;
char *path = param->vtoy_img_path;
const char *fs;
cnt = vtoy_find_disk_by_size(param->vtoy_disk_size, diskname);
if (cnt > 1)
{
cnt = vtoy_find_disk_by_guid(param, diskname);
}
else if (cnt == 0)
{
cnt = vtoy_find_disk_by_guid(param, diskname);
debug("find 0 disk by size, try with guid cnt=%d...\n", cnt);
}
if (param->vtoy_disk_part_type < ventoy_fs_max)
{
fs = g_ventoy_fs[param->vtoy_disk_part_type];
}
else
{
fs = "unknown";
}
if (1 == cnt)
{
printf("/dev/%s#%s#%s\n", diskname, fs, path);
return 0;
}
else
{
return 1;
}
}
static int vtoy_check_device(ventoy_os_param *param, const char *device)
{
unsigned long long size;
@ -499,6 +462,47 @@ static int vtoy_check_device(ventoy_os_param *param, const char *device)
}
}
static int vtoy_print_os_param(ventoy_os_param *param, char *diskname)
{
int cnt = 0;
char *path = param->vtoy_img_path;
const char *fs;
cnt = vtoy_find_disk_by_size(param->vtoy_disk_size, diskname);
debug("find disk by size %llu, cnt=%d...\n", (unsigned long long)param->vtoy_disk_size, cnt);
if (1 == cnt)
{
if (vtoy_check_device(param, diskname) != 0)
{
cnt = 0;
}
}
else
{
cnt = vtoy_find_disk_by_guid(param, diskname);
debug("find disk by guid cnt=%d...\n", cnt);
}
if (param->vtoy_disk_part_type < ventoy_fs_max)
{
fs = g_ventoy_fs[param->vtoy_disk_part_type];
}
else
{
fs = "unknown";
}
if (1 == cnt)
{
printf("/dev/%s#%s#%s\n", diskname, fs, path);
return 0;
}
else
{
return 1;
}
}
/*
* Find disk and image path from ventoy runtime data.
* By default data is read from phymem(legacy bios) or efivar(UEFI), if -f is input, data is read from file.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.