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
c42a8c6d
Commit
c42a8c6d
authored
May 23, 2021
by
longpanda
Browse files
misc update
parent
4b1dd4d3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
14 deletions
+32
-14
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
+32
-14
No files found.
GRUB2/MOD_SRC/grub-2.04/grub-core/ventoy/ventoy_plugin.c
View file @
c42a8c6d
...
@@ -56,6 +56,27 @@ static auto_memdisk *g_auto_memdisk_head = NULL;
...
@@ -56,6 +56,27 @@ static auto_memdisk *g_auto_memdisk_head = NULL;
static
image_list
*
g_image_list_head
=
NULL
;
static
image_list
*
g_image_list_head
=
NULL
;
static
conf_replace
*
g_conf_replace_head
=
NULL
;
static
conf_replace
*
g_conf_replace_head
=
NULL
;
static
int
ventoy_plugin_is_parent
(
const
char
*
pat
,
int
patlen
,
const
char
*
isopath
)
{
if
(
patlen
>
1
)
{
if
(
isopath
[
patlen
]
==
'/'
&&
ventoy_strncmp
(
pat
,
isopath
,
patlen
)
==
0
&&
grub_strchr
(
isopath
+
patlen
+
1
,
'/'
)
==
NULL
)
{
return
1
;
}
}
else
{
if
(
pat
[
0
]
==
'/'
&&
grub_strchr
(
isopath
+
1
,
'/'
)
==
NULL
)
{
return
1
;
}
}
return
0
;
}
static
int
ventoy_plugin_control_check
(
VTOY_JSON
*
json
,
const
char
*
isodisk
)
static
int
ventoy_plugin_control_check
(
VTOY_JSON
*
json
,
const
char
*
isodisk
)
{
{
int
rc
=
0
;
int
rc
=
0
;
...
@@ -2178,8 +2199,7 @@ install_template * ventoy_plugin_find_install_template(const char *isopath)
...
@@ -2178,8 +2199,7 @@ install_template * ventoy_plugin_find_install_template(const char *isopath)
{
{
if
(
node
->
type
==
auto_install_type_parent
)
if
(
node
->
type
==
auto_install_type_parent
)
{
{
if
(
node
->
pathlen
<
len
&&
(
isopath
[
node
->
pathlen
]
==
'/'
)
&&
if
(
node
->
pathlen
<
len
&&
ventoy_plugin_is_parent
(
node
->
isopath
,
node
->
pathlen
,
isopath
))
ventoy_strncmp
(
node
->
isopath
,
isopath
,
node
->
pathlen
)
==
0
)
{
{
return
node
;
return
node
;
}
}
...
@@ -2314,8 +2334,7 @@ const char * ventoy_plugin_get_injection(const char *isopath)
...
@@ -2314,8 +2334,7 @@ const char * ventoy_plugin_get_injection(const char *isopath)
{
{
if
(
node
->
type
==
injection_type_parent
)
if
(
node
->
type
==
injection_type_parent
)
{
{
if
(
node
->
pathlen
<
len
&&
isopath
[
node
->
pathlen
]
==
'/'
&&
if
(
node
->
pathlen
<
len
&&
ventoy_plugin_is_parent
(
node
->
isopath
,
node
->
pathlen
,
isopath
))
ventoy_strncmp
(
node
->
isopath
,
isopath
,
node
->
pathlen
)
==
0
)
{
{
return
node
->
archive
;
return
node
->
archive
;
}
}
...
@@ -2350,7 +2369,8 @@ const char * ventoy_plugin_get_menu_alias(int type, const char *isopath)
...
@@ -2350,7 +2369,8 @@ const char * ventoy_plugin_get_menu_alias(int type, const char *isopath)
const
char
*
ventoy_plugin_get_menu_class
(
int
type
,
const
char
*
name
,
const
char
*
path
)
const
char
*
ventoy_plugin_get_menu_class
(
int
type
,
const
char
*
name
,
const
char
*
path
)
{
{
int
len
;
int
namelen
;
int
pathlen
;
menu_class
*
node
=
NULL
;
menu_class
*
node
=
NULL
;
if
(
!
g_menu_class_head
)
if
(
!
g_menu_class_head
)
...
@@ -2358,6 +2378,9 @@ const char * ventoy_plugin_get_menu_class(int type, const char *name, const char
...
@@ -2358,6 +2378,9 @@ const char * ventoy_plugin_get_menu_class(int type, const char *name, const char
return
NULL
;
return
NULL
;
}
}
namelen
=
(
int
)
grub_strlen
(
name
);
pathlen
=
(
int
)
grub_strlen
(
path
);
if
(
vtoy_class_image_file
==
type
)
if
(
vtoy_class_image_file
==
type
)
{
{
for
(
node
=
g_menu_class_head
;
node
;
node
=
node
->
next
)
for
(
node
=
g_menu_class_head
;
node
;
node
=
node
->
next
)
...
@@ -2369,17 +2392,14 @@ const char * ventoy_plugin_get_menu_class(int type, const char *name, const char
...
@@ -2369,17 +2392,14 @@ const char * ventoy_plugin_get_menu_class(int type, const char *name, const char
if
(
node
->
parent
)
if
(
node
->
parent
)
{
{
len
=
(
int
)
grub_strlen
(
path
);
if
((
node
->
patlen
<
pathlen
)
&&
ventoy_plugin_is_parent
(
node
->
pattern
,
node
->
patlen
,
path
))
if
((
node
->
patlen
<
len
)
&&
(
path
[
node
->
patlen
]
==
'/'
)
&&
(
grub_strncmp
(
path
,
node
->
pattern
,
node
->
patlen
)
==
0
))
{
{
return
node
->
class
;
return
node
->
class
;
}
}
}
}
else
else
{
{
len
=
(
int
)
grub_strlen
(
name
);
if
((
node
->
patlen
<
namelen
)
&&
grub_strstr
(
name
,
node
->
pattern
))
if
((
node
->
patlen
<
len
)
&&
grub_strstr
(
name
,
node
->
pattern
))
{
{
return
node
->
class
;
return
node
->
class
;
}
}
...
@@ -2388,10 +2408,9 @@ const char * ventoy_plugin_get_menu_class(int type, const char *name, const char
...
@@ -2388,10 +2408,9 @@ const char * ventoy_plugin_get_menu_class(int type, const char *name, const char
}
}
else
else
{
{
len
=
(
int
)
grub_strlen
(
name
);
for
(
node
=
g_menu_class_head
;
node
;
node
=
node
->
next
)
for
(
node
=
g_menu_class_head
;
node
;
node
=
node
->
next
)
{
{
if
(
node
->
type
==
type
&&
node
->
patlen
==
len
&&
grub_strncmp
(
name
,
node
->
pattern
,
len
)
==
0
)
if
(
node
->
type
==
type
&&
node
->
patlen
==
name
len
&&
grub_strncmp
(
name
,
node
->
pattern
,
name
len
)
==
0
)
{
{
return
node
->
class
;
return
node
->
class
;
}
}
...
@@ -2653,8 +2672,7 @@ static const vtoy_password * ventoy_plugin_get_password(const char *isopath)
...
@@ -2653,8 +2672,7 @@ static const vtoy_password * ventoy_plugin_get_password(const char *isopath)
{
{
if
(
node
->
type
==
vtoy_menu_pwd_parent
)
if
(
node
->
type
==
vtoy_menu_pwd_parent
)
{
{
if
(
node
->
pathlen
<
len
&&
(
isopath
[
node
->
pathlen
]
==
'/'
)
&&
if
(
node
->
pathlen
<
len
&&
ventoy_plugin_is_parent
(
node
->
isopath
,
node
->
pathlen
,
isopath
))
ventoy_strncmp
(
node
->
isopath
,
isopath
,
node
->
pathlen
)
==
0
)
{
{
return
&
(
node
->
password
);
return
&
(
node
->
password
);
}
}
...
...
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