(09-17-2020, 11:38 AM)geole Wrote: Hello
The response is
(initramfs) /ventoy/tool/vtoydump -f /ventoy/ventoy_os_param -c sdb -v
get os param from file /ventoy_os_param
Failed to open file /ventoy_os_param error 2
ventoy os param not found 2
(initramfs)
I don't knwon why it use /ventoy_os_param as the file name. Obviously you input /ventoy/ventoy_os_param
Code:
int rc;
int ch;
int print_path = 0;
char filename[256] = {0};
char diskname[256] = {0};
char device[64] = {0};
ventoy_os_param *param = NULL;
while ((ch = getopt(argc, argv, "c:f:p:v::")) != -1)
{
if (ch == 'f')
{
strncpy(filename, optarg, sizeof(filename) - 1);
}
else if (ch == 'v')
{
verbose = 1;
}
else if (ch == 'c')
{
strncpy(device, optarg, sizeof(device) - 1);
}
else if (ch == 'p')
{
print_path = 1;
strncpy(filename, optarg, sizeof(filename) - 1);
}
else
{
fprintf(stderr, "Usage: %s -f datafile [ -v ] \n", argv[0]);
return 1;
}
}
if (filename[0] == 0)
{
fprintf(stderr, "Usage: %s -f datafile [ -v ] \n", argv[0]);
return 1;
}
param = malloc(sizeof(ventoy_os_param));
if (NULL == param)
{
fprintf(stderr, "failed to alloc memory with size %d error %d\n",
(int)sizeof(ventoy_os_param), errno);
return 1;
}
memset(param, 0, sizeof(ventoy_os_param));
debug("get os pararm from file %s\n", filename);
rc = vtoy_os_param_from_file(filename, param);
if (rc)
{
debug("ventoy os param not found %d\n", rc);
goto end;
}