hidemenu fix
PATCH 1/1 hidemenu fix
Hi,
This patch moves the screen init code from reader to menu, so that hidemenu would work as before. A minor side effect is that if grub.cfg is not found, the "GNU GRUB" header would not be printed, but I guess this is not an issue.
Signature · 1 line
Bean
kern/rescue_reader.c +0 -8
@@ -26,13 +26,6 @@static char linebuf[GRUB_RESCUE_BUF_SIZE ]; -static grub_err_t -grub_rescue_init (void ) -{ -grub_printf ("Entering rescue mode...\n" ); -return 0 ; -} -/* Prompt to input a command and read the line. */ static grub_err_t grub_rescue_read_line (char **line,int cont)
@@ -77,7 +70,6 @@ grub_rescue_read_line (char **line, int cont)static struct grub_reader grub_rescue_reader = { .name ="rescue" , - .init = grub_rescue_init, .read_line = grub_rescue_read_line };
normal/main.c +1 -9
@@ -474,14 +474,7 @@ grub_cmdline_run (int nested)grub_reader_t reader =grub_reader_get_current (); reader_nested = nested; -if (reader->init) - reader->init (); -grub_reader_loop (0 ); -} -static grub_err_t -grub_normal_reader_init (void ) -{grub_normal_init_page ();grub_setcursor (1 );
@@ -491,7 +484,7 @@ grub_normal_reader_init (void) device/file completions.%s ]\n\n", reader_nested ? " ESC at any time exits." : ""); -return 0 ; +grub_reader_loop (0 ); }static char cmdline[GRUB_MAX_CMDLINE ];
@@ -524,7 +517,6 @@ grub_normal_read_line (char **line, int cont)static struct grub_reader grub_normal_reader = { .name ="normal" , - .init = grub_normal_reader_init, .read_line = grub_normal_read_line };
Quoted 6 lines · Bean
Hi,
This patch moves the screen init code from reader to menu, so that hidemenu would work as before. A minor side effect is that if grub.cfg is not found, the "GNU GRUB" header would not be printed, but I guess this is not an issue.
Hi Bean,
I don't understand this very well. First of all, which part is supposed to be responsible for printing the header? Are you changing that? Right now it is being printed twice.
Quoted 11 lines
kern/rescue_reader.c +0
-7-static grub_err_t -grub_rescue_init (void ) -{ -grub_printf ("Entering rescue mode...\n" ); -return 0 ; -} -/* Prompt to input a command and read the line. */ static grub_err_t grub_rescue_read_line (char **line,int cont)
kern/rescue_reader.c grub_rescue_read_line (char **line, int cont) · line 74
Quoted 6 lines
kern/rescue_reader.c +0
-1@@ -77,7 +70,6 @@ grub_rescue_read_line (char **line, int cont)static struct grub_reader grub_rescue_reader = { .name ="rescue" , - .init = grub_rescue_init, .read_line = grub_rescue_read_line };
Why is grub_rescue_init being removed?
normal/main.c grub_normal_read_line (char **line, int cont) · line 521
Quoted 7 lines
normal/main.c +0
-1@@ -524,7 +517,6 @@ grub_normal_read_line (char **line, int cont)static struct grub_reader grub_normal_reader = { .name ="normal" , - .init = grub_normal_reader_init, .read_line = grub_normal_read_line };
And this one, too. If readers are no longer responsible for printing a header, shouldn't we adjust whatever code that was calling their init functions, and the grub_reader struct as well?
This patch looks like a kludge to me. Can we discuss what's wrong with the current design, and what options do we have to solve this?
Signature · 5 lines
Robert Millan The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and how) you may access your data; but nobody's threatening your freedom: we still allow you to remove your data and not access it at all."
Quoted 8 lines · Robert Millan
Quoted 6 lines · Bean
Hi,
This patch moves the screen init code from reader to menu, so that hidemenu would work as before. A minor side effect is that if grub.cfg is not found, the "GNU GRUB" header would not be printed, but I guess this is not an issue.
Quoted 5 lines
Hi Bean,
I don't understand this very well. First of all, which part is supposed to be responsible for printing the header? Are you changing that? Right now it is being printed twice.
The menu would init screen and print a header, when you click "c", it clear screen again and print another header. This method should be the right way. Previously the later code is in normal reader, which cause screen to be cleared prematurely.
Quoted 12 lines
Quoted 12 lines
kern/rescue_reader.c +0
-7-static grub_err_t -grub_rescue_init (void ) -{ - grub_printf ("Entering rescue mode...\n"); - return 0; -} -/* Prompt to input a command and read the line. */ static
grub_err_t
grub_rescue_read_line (char **line, int cont)(quoted diff) +0
-0@@ -77,7 +70,6 @@ grub_rescue_read_line (char **line, int cont)
Quoted 8 lines
Quoted 6 lines
static struct
grub_readergrub_rescue_reader=
{
.name = "rescue",
- .init =grub_rescue_init,
.read_line =grub_rescue_read_line
};Why is
grub_rescue_initbeing removed?
If it's not removed, it would print "Entering rescue mode..." before the timeout, as rescue reader is started quite early. This is not a big issue, but to get a silent effect, we can remove this as well. In effect, we can always tell the current reader from command prompt, there is no need for the "welcome" message. (It also saves a few bytes in kernel)
Quoted 13 lines
Quoted 8 lines
(quoted diff) +0
-0@@ -524,7 +517,6 @@ grub_normal_read_line (char **line, int cont)static struct
grub_readergrub_normal_reader=
{
.name = "normal",
- .init =grub_normal_reader_init,
.read_line =grub_normal_read_line
};And this one, too. If readers are no longer responsible for printing a header, shouldn't we adjust whatever code that was calling their init functions, and the
grub_readerstruct as well?
Quoted 2 lines
This patch looks like a kludge to me. Can we discuss what's wrong with the current design, and what options do we have to solve this?
I think the new handling is correct. The printing of header is the job of menu viewer, not reader. Suppose we switch to a graphic viewer, then the current design would have problem, as it assume control over the whole screen, but we might want to draw it in a window. Only menu viewer knows how to draw it properly.
Signature · 1 line
Bean