代码拉取完成,页面将自动刷新
同步操作将从 OpenCloudOS Stream/grub2 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From c53ef0ff4c471f284ecb7bc2f75d0c5ae28fbd9f Mon Sep 17 00:00:00 2001
From: nilusyi <[email protected]>
Date: Sun, 7 Apr 2024 11:15:34 +0800
Subject: [PATCH 269/272] revert Add hidden menu entries
no need of this function
Signed-off-by: nilusyi <[email protected]>
---
grub-core/commands/blscfg.c | 2 +-
grub-core/commands/legacycfg.c | 4 ++--
grub-core/commands/menuentry.c | 17 +++--------------
grub-core/normal/menu.c | 22 ++++------------------
grub-core/normal/menu_text.c | 4 ----
include/grub/menu.h | 2 --
include/grub/normal.h | 2 +-
7 files changed, 11 insertions(+), 42 deletions(-)
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
index ed1bf11aa..047a9d15c 100644
--- a/grub-core/commands/blscfg.c
+++ b/grub-core/commands/blscfg.c
@@ -953,7 +953,7 @@ static void create_entry (struct bls_entry *entry)
clinux, options ? " " : "", options ? options : "",
initrd ? initrd : "", dt ? dt : "");
- grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, 0, &index, entry);
+ grub_normal_add_menu_entry (argc, argv, classes, id, users, hotkey, NULL, src, 0, &index, entry);
grub_dprintf ("blscfg", "Added entry %d id:\"%s\"\n", index, id);
finish:
diff --git a/grub-core/commands/legacycfg.c b/grub-core/commands/legacycfg.c
index c22b74ab5..a43c0533d 100644
--- a/grub-core/commands/legacycfg.c
+++ b/grub-core/commands/legacycfg.c
@@ -143,7 +143,7 @@ legacy_file (const char *filename)
args[0] = oldname;
grub_normal_add_menu_entry (1, args, NULL, NULL, "legacy",
NULL, NULL,
- entrysrc, 0, 0, NULL, NULL);
+ entrysrc, 0, NULL, NULL);
grub_free (args);
entrysrc[0] = 0;
grub_free (oldname);
@@ -205,7 +205,7 @@ legacy_file (const char *filename)
}
args[0] = entryname;
grub_normal_add_menu_entry (1, args, NULL, NULL, NULL,
- NULL, NULL, entrysrc, 0, 0, NULL, NULL);
+ NULL, NULL, entrysrc, 0, NULL, NULL);
grub_free (args);
}
diff --git a/grub-core/commands/menuentry.c b/grub-core/commands/menuentry.c
index 787dc978a..5bf972139 100644
--- a/grub-core/commands/menuentry.c
+++ b/grub-core/commands/menuentry.c
@@ -78,7 +78,7 @@ grub_normal_add_menu_entry (int argc, const char **args,
char **classes, const char *id,
const char *users, const char *hotkey,
const char *prefix, const char *sourcecode,
- int submenu, int hidden,
+ int submenu,
int *index, struct bls_entry *bls)
{
int menu_hotkey = 0;
@@ -196,11 +196,9 @@ grub_normal_add_menu_entry (int argc, const char **args,
(*last)->args = menu_args;
(*last)->sourcecode = menu_sourcecode;
(*last)->submenu = submenu;
- (*last)->hidden = hidden;
(*last)->bls = bls;
- if (!hidden)
- menu->size++;
+ menu->size++;
if (index)
*index = ind;
@@ -302,7 +300,6 @@ grub_cmd_menuentry (grub_extcmd_context_t ctxt, int argc, char **args)
ctxt->state[2].arg, 0,
ctxt->state[3].arg,
ctxt->extcmd->cmd->name[0] == 's',
- ctxt->extcmd->cmd->name[0] == 'h',
NULL, NULL);
src = args[argc - 1];
@@ -321,7 +318,6 @@ grub_cmd_menuentry (grub_extcmd_context_t ctxt, int argc, char **args)
users,
ctxt->state[2].arg, prefix, src + 1,
ctxt->extcmd->cmd->name[0] == 's',
- ctxt->extcmd->cmd->name[0] == 'h',
NULL, NULL);
src[len - 1] = ch;
@@ -330,7 +326,7 @@ grub_cmd_menuentry (grub_extcmd_context_t ctxt, int argc, char **args)
return r;
}
-static grub_extcmd_t cmd, cmd_sub, cmd_hidden;
+static grub_extcmd_t cmd, cmd_sub;
void
grub_menu_init (void)
@@ -346,13 +342,6 @@ grub_menu_init (void)
| GRUB_COMMAND_FLAG_EXTRACTOR,
N_("BLOCK"), N_("Define a submenu."),
options);
- cmd_hidden = grub_register_extcmd ("hiddenentry", grub_cmd_menuentry,
- GRUB_COMMAND_FLAG_BLOCKS
- | GRUB_COMMAND_ACCEPT_DASH
- | GRUB_COMMAND_FLAG_EXTRACTOR,
- N_("BLOCK"),
- N_("Define a hidden menu entry."),
- options);
}
void
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
index d58dbe443..23293b5ce 100644
--- a/grub-core/normal/menu.c
+++ b/grub-core/normal/menu.c
@@ -41,8 +41,6 @@
grub_err_t (*grub_gfxmenu_try_hook) (int entry, grub_menu_t menu,
int nested) = NULL;
-#define MENU_INCLUDE_HIDDEN 0x10000
-
enum timeout_style {
TIMEOUT_STYLE_MENU,
TIMEOUT_STYLE_COUNTDOWN,
@@ -83,20 +81,8 @@ grub_menu_get_entry (grub_menu_t menu, int no)
{
grub_menu_entry_t e;
- if (no & MENU_INCLUDE_HIDDEN) {
- no &= ~MENU_INCLUDE_HIDDEN;
-
- for (e = menu->entry_list; e && no > 0; e = e->next, no--)
- ;
- } else {
- for (e = menu->entry_list; e && no > 0; e = e->next, no--) {
- /* Skip hidden entries */
- while (e && e->hidden)
- e = e->next;
- }
- while (e && e->hidden)
- e = e->next;
- }
+ for (e = menu->entry_list; e && no > 0; e = e->next, no--)
+ ;
return e;
}
@@ -108,10 +94,10 @@ get_entry_index_by_hotkey (grub_menu_t menu, int hotkey)
grub_menu_entry_t entry;
int i;
- for (i = 0, entry = menu->entry_list; entry;
+ for (i = 0, entry = menu->entry_list; i < menu->size;
i++, entry = entry->next)
if (entry->hotkey == hotkey)
- return i | MENU_INCLUDE_HIDDEN;
+ return i;
return -1;
}
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
index 161083663..b1321eb26 100644
--- a/grub-core/normal/menu_text.c
+++ b/grub-core/normal/menu_text.c
@@ -290,10 +290,6 @@ print_entries (grub_menu_t menu, const struct menu_viewer_data *data)
e, data);
if (e)
e = e->next;
-
- /* Skip hidden entries */
- while (e && e->hidden)
- e = e->next;
}
grub_term_gotoxy (data->term,
diff --git a/include/grub/menu.h b/include/grub/menu.h
index 43080828c..0acdc2aa6 100644
--- a/include/grub/menu.h
+++ b/include/grub/menu.h
@@ -68,8 +68,6 @@ struct grub_menu_entry
int submenu;
- int hidden;
-
/* The next element. */
struct grub_menu_entry *next;
diff --git a/include/grub/normal.h b/include/grub/normal.h
index 8c712a9e5..8839ad85a 100644
--- a/include/grub/normal.h
+++ b/include/grub/normal.h
@@ -145,7 +145,7 @@ grub_normal_add_menu_entry (int argc, const char **args, char **classes,
const char *id,
const char *users, const char *hotkey,
const char *prefix, const char *sourcecode,
- int submenu, int hidden, int *index, struct bls_entry *bls);
+ int submenu, int *index, struct bls_entry *bls);
grub_err_t
grub_normal_set_password (const char *user, const char *password);
--
2.41.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。