Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
dadigang
Ventoy
Commits
a37c6af8
"git@developer.sourcefind.cn:hehl2/torchaudio.git" did not exist on "d1adb7f667db69b4ffab99d97ce48d3b3a389800"
Commit
a37c6af8
authored
Feb 03, 2021
by
longpanda
Browse files
Display warning message if ISO file has an invalid size.
parent
61d4248d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
3 deletions
+44
-3
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
+29
-2
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
+2
-0
INSTALL/grub/grub.cfg
INSTALL/grub/grub.cfg
+13
-1
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy.c
View file @
a37c6af8
...
...
@@ -534,6 +534,26 @@ static grub_err_t ventoy_cmd_incr(grub_extcmd_context_t ctxt, int argc, char **a
VENTOY_CMD_RETURN
(
GRUB_ERR_NONE
);
}
static
grub_err_t
ventoy_cmd_mod
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
long
value1
=
0
;
long
value2
=
0
;
char
buf
[
32
];
if
(
argc
!=
3
)
{
return
grub_error
(
GRUB_ERR_BAD_ARGUMENT
,
"Usage: %s {Int} {Int} {Variable}"
,
cmd_raw_name
);
}
value1
=
grub_strtol
(
args
[
0
],
NULL
,
10
);
value2
=
grub_strtol
(
args
[
1
],
NULL
,
10
);
grub_snprintf
(
buf
,
sizeof
(
buf
),
"%ld"
,
(
value1
%
value2
));
grub_env_set
(
args
[
2
],
buf
);
VENTOY_CMD_RETURN
(
GRUB_ERR_NONE
);
}
static
grub_err_t
ventoy_cmd_file_size
(
grub_extcmd_context_t
ctxt
,
int
argc
,
char
**
args
)
{
int
rc
=
1
;
...
...
@@ -3236,14 +3256,15 @@ static grub_err_t ventoy_cmd_parse_volume(grub_extcmd_context_t ctxt, int argc,
int
len
;
grub_file_t
file
;
char
buf
[
64
];
grub_uint64_t
size
;
ventoy_iso9660_vd
pvd
;
(
void
)
ctxt
;
(
void
)
argc
;
if
(
argc
!=
3
)
if
(
argc
!=
4
)
{
return
grub_error
(
GRUB_ERR_BAD_ARGUMENT
,
"Usage: %s sysid volid
\n
"
,
cmd_raw_name
);
return
grub_error
(
GRUB_ERR_BAD_ARGUMENT
,
"Usage: %s sysid volid
space
\n
"
,
cmd_raw_name
);
}
file
=
ventoy_grub_file_open
(
VENTOY_FILE_TYPE
,
"%s"
,
args
[
0
]);
...
...
@@ -3269,6 +3290,11 @@ static grub_err_t ventoy_cmd_parse_volume(grub_extcmd_context_t ctxt, int argc,
grub_memcpy
(
buf
,
pvd
.
vol
,
sizeof
(
pvd
.
vol
));
ventoy_set_env
(
args
[
2
],
buf
);
size
=
pvd
.
space
;
size
*=
2048
;
grub_snprintf
(
buf
,
sizeof
(
buf
),
"%llu"
,
(
ulonglong
)
size
);
ventoy_set_env
(
args
[
3
],
buf
);
end:
grub_file_close
(
file
);
...
...
@@ -4050,6 +4076,7 @@ static int ventoy_env_init(void)
static
cmd_para
ventoy_cmds
[]
=
{
{
"vt_incr"
,
ventoy_cmd_incr
,
0
,
NULL
,
"{Var} {INT}"
,
"Increase integer variable"
,
NULL
},
{
"vt_mod"
,
ventoy_cmd_mod
,
0
,
NULL
,
"{Int} {Int} {Var}"
,
"mod integer variable"
,
NULL
},
{
"vt_strstr"
,
ventoy_cmd_strstr
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_str_begin"
,
ventoy_cmd_strbegin
,
0
,
NULL
,
""
,
""
,
NULL
},
{
"vt_debug"
,
ventoy_cmd_debug
,
0
,
NULL
,
"{on|off}"
,
"turn debug on/off"
,
NULL
},
...
...
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_def.h
View file @
a37c6af8
...
...
@@ -163,6 +163,8 @@ typedef struct ventoy_iso9660_vd
grub_uint8_t
res
;
char
sys
[
32
];
char
vol
[
32
];
grub_uint8_t
res2
[
8
];
grub_uint32_t
space
;
}
ventoy_iso9660_vd
;
#pragma pack()
...
...
INSTALL/grub/grub.cfg
View file @
a37c6af8
...
...
@@ -964,7 +964,19 @@ function iso_common_menuentry {
unset vt_volume_id
vt_chosen_img_path vt_chosen_path vt_chosen_size
vt_parse_iso_volume "${vtoy_iso_part}${vt_chosen_path}" vt_system_id vt_volume_id
vt_parse_iso_volume "${vtoy_iso_part}${vt_chosen_path}" vt_system_id vt_volume_id vt_volume_space
if [ $vt_volume_space -ne $vt_chosen_size ]; then
vt_mod $vt_chosen_size 2048 vt_chosen_size_mod
if [ $vt_volume_space -gt $vt_chosen_size -o $vt_chosen_size_mod -ne 0 ]; then
echo -e "\n $vt_volume_space $vt_chosen_size $vt_chosen_size_mod\n"
echo -e "\n The size of the iso file \"$vt_chosen_size\" is invalid. File corrupted ?\n"
echo -e " 此ISO文件的大小 \"$vt_chosen_size\" 有问题,请确认文件是否损坏。\n"
echo -e "\n press ENTER to exit (请按 回车 键返回) ..."
read vtInputKey
return
fi
fi
if vt_check_password "${vt_chosen_path}"; then
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment