Eliminate grub_term_register_{input,output}_active. Default terminals are

automatically activated because they're the only terminal that has been loaded.

This solution is temporary.  In the future, all terminals should auto-enable,
but this is non-trivial due to resource conflict, and it shouldn't prevent
merge in trunk.
This commit is contained in:
Robert Millan 2010-01-09 23:42:17 +01:00
parent 75cc5b682e
commit 822873a7da
10 changed files with 33 additions and 62 deletions

View File

@ -1,5 +1,5 @@
2010-01-07 Vladimir Serbinenko <phcoder@gmail.com>
2010-01-07 Robert Millan <rmh.grub@aybabtu.com>
2010-01-09 Robert Millan <rmh.grub@aybabtu.com>
Support for multiple terminals.
@ -58,8 +58,6 @@
(grub_term_inputs_disabled): Likewise.
(grub_term_outputs): Likewise.
(grub_term_inputs): Likewise.
(grub_term_register_input_active): New function.
(grub_term_register_output_active): Likewise.
(grub_term_register_input): Rewritten.
(grub_term_register_output): Likewise.
(grub_term_unregister_input): Likewise.
@ -102,20 +100,8 @@
* normal/menu_text.c: Likewise.
* normal/menu_viewer.c: Removed. All users updated.
* normal/term.c: New file.
* term/efi/console.c (grub_console_init): Use
grub_term_register_input_active and grub_term_register_output_active.
* term/gfxterm.c (GRUB_MOD_INIT) [GRUB_MACHINE_MIPS_YEELOONG]: Likewise.
* term/i386/pc/at_keyboard.c (GRUB_MOD_INIT)
[GRUB_MACHINE_MIPS_YEELOONG] || [GRUB_MACHINE_COREBOOT]
|| [GRUB_MACHINE_QEMU]: Likewise.
* term/i386/pc/vga_text.c (GRUB_MOD_INIT) [GRUB_MACHINE_COREBOOT]
|| [GRUB_MACHINE_QEMU]: Likewise.
* term/i386/pc/console.c (grub_console_init): Likewise.
* term/ieee1275/ofconsole.c (grub_console_init): Likewise.
* util/console.c: Change order of includes to workaround a bug in
ncurses headers.
(grub_console_init): Use
grub_term_register_input_active and grub_term_register_output_active.
* term/terminfo.c: New argument oterm on all exported functions.
All users updated.
* util/grub-editenv.c (grub_term_input_class): Removed.

View File

@ -1,6 +1,6 @@
#! /bin/sh
#
# Copyright (C) 2009 Free Software Foundation, Inc.
# Copyright (C) 2009,2010 Free Software Foundation, Inc.
#
# This script is free software; the author
# gives unlimited permission to copy and/or distribute it,
@ -17,6 +17,4 @@ module=$1
grep -v "^#" | sed -n \
-e "/grub_term_register_input *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $module/;p;}" \
-e "/grub_term_register_input_active *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $module/;p;}" \
-e "/grub_term_register_output *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $module/;p;}" \
-e "/grub_term_register_output_active *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $module/;p;}"

View File

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2005,2007,2008,2009 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -198,38 +198,37 @@ extern struct grub_term_input *EXPORT_VAR(grub_term_inputs_disabled);
extern struct grub_term_output *EXPORT_VAR(grub_term_outputs);
extern struct grub_term_input *EXPORT_VAR(grub_term_inputs);
static inline void
grub_term_register_input_active (const char *name __attribute__ ((unused)),
grub_term_input_t term)
{
if (term->init)
term->init ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term));
}
static inline void
grub_term_register_input (const char *name __attribute__ ((unused)),
grub_term_input_t term)
{
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
GRUB_AS_LIST (term));
}
static inline void
grub_term_register_output_active (const char *name __attribute__ ((unused)),
grub_term_output_t term)
{
if (term->init)
term->init ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs), GRUB_AS_LIST (term));
if (grub_term_inputs)
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs_disabled),
GRUB_AS_LIST (term));
else
{
/* If this is the first terminal, enable automatically. */
if (term->init)
term->init ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term));
}
}
static inline void
grub_term_register_output (const char *name __attribute__ ((unused)),
grub_term_output_t term)
{
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
GRUB_AS_LIST (term));
if (grub_term_outputs)
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs_disabled),
GRUB_AS_LIST (term));
else
{
/* If this is the first terminal, enable automatically. */
if (term->init)
term->init ();
grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs),
GRUB_AS_LIST (term));
}
}
static inline void

View File

@ -365,8 +365,8 @@ grub_console_init (void)
return;
}
grub_term_register_input_active ("console", &grub_console_term_input);
grub_term_register_output_active ("console", &grub_console_term_output);
grub_term_register_input ("console", &grub_console_term_input);
grub_term_register_output ("console", &grub_console_term_output);
}
void

View File

@ -953,11 +953,7 @@ static grub_command_t cmd;
GRUB_MOD_INIT(term_gfxterm)
{
#ifdef GRUB_MACHINE_MIPS_YEELOONG
grub_term_register_output_active ("gfxterm", &grub_video_term);
#else
grub_term_register_output ("gfxterm", &grub_video_term);
#endif
cmd = grub_register_command ("background_image",
grub_gfxterm_background_image_cmd,
0, "Load background image for active terminal.");

View File

@ -278,11 +278,7 @@ static struct grub_term_input grub_at_keyboard_term =
GRUB_MOD_INIT(at_keyboard)
{
#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU) || defined (GRUB_MACHINE_MIPS_YEELOONG)
grub_term_register_input_active ("at_keyboard", &grub_at_keyboard_term);
#else
grub_term_register_input ("at_keyboard", &grub_at_keyboard_term);
#endif
}
GRUB_MOD_FINI(at_keyboard)

View File

@ -71,8 +71,8 @@ static struct grub_term_output grub_console_term_output =
void
grub_console_init (void)
{
grub_term_register_output_active ("console", &grub_console_term_output);
grub_term_register_input_active ("console", &grub_console_term_input);
grub_term_register_output ("console", &grub_console_term_output);
grub_term_register_input ("console", &grub_console_term_input);
}
void

View File

@ -163,16 +163,12 @@ static struct grub_term_output grub_vga_text_term =
.setcolorstate = grub_console_setcolorstate,
.setcolor = grub_console_setcolor,
.getcolor = grub_console_getcolor,
.setcursor = grub_vga_text_setcursor
.setcursor = grub_vga_text_setcursor,
};
GRUB_MOD_INIT(vga_text)
{
#if defined (GRUB_MACHINE_COREBOOT) || defined (GRUB_MACHINE_QEMU)
grub_term_register_output_active ("vga_text", &grub_vga_text_term);
#else
grub_term_register_output ("vga_text", &grub_vga_text_term);
#endif
}
GRUB_MOD_FINI(vga_text)

View File

@ -420,8 +420,8 @@ static struct grub_term_output grub_ofconsole_term_output =
void
grub_console_init (void)
{
grub_term_register_input_active ("ofconsole", &grub_ofconsole_term_input);
grub_term_register_output_active ("ofconsole", &grub_ofconsole_term_output);
grub_term_register_input ("ofconsole", &grub_ofconsole_term_input);
grub_term_register_output ("ofconsole", &grub_ofconsole_term_output);
}
void

View File

@ -373,8 +373,8 @@ static struct grub_term_output grub_ncurses_term_output =
void
grub_console_init (void)
{
grub_term_register_output_active ("console", &grub_ncurses_term_output);
grub_term_register_input_active ("console", &grub_ncurses_term_input);
grub_term_register_output ("console", &grub_ncurses_term_output);
grub_term_register_input ("console", &grub_ncurses_term_input);
}
void