Rename ofconsole to console.

* grub-core/commands/terminal.c (handle_command): Handle ofconsole
	as sysnonym to console.
	* grub-core/term/ieee1275/ofconsole.c: Renamed to ..
	* grub-core/term/ieee1275/console.c: ... this. All users updated.
	Rename grub_ofconsole_ to grub_console_. All users updated
	(grub_console_term_output): Rename "ofconsole" to "console".
	* grub-core/term/terminfo.c (grub_cmd_terminfo): Handle "ofconsole"
	as "console".
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-01-29 17:01:27 +01:00
parent 64c8b8f64c
commit ca8c0baf25
5 changed files with 67 additions and 38 deletions

View file

@ -1,3 +1,16 @@
2012-01-29 Vladimir Serbinenko <phcoder@gmail.com>
Rename ofconsole to console.
* grub-core/commands/terminal.c (handle_command): Handle ofconsole
as sysnonym to console.
* grub-core/term/ieee1275/ofconsole.c: Renamed to ..
* grub-core/term/ieee1275/console.c: ... this. All users updated.
Rename grub_ofconsole_ to grub_console_. All users updated
(grub_console_term_output): Rename "ofconsole" to "console".
* grub-core/term/terminfo.c (grub_cmd_terminfo): Handle "ofconsole"
as "console".
2012-01-29 Vladimir Serbinenko <phcoder@gmail.com> 2012-01-29 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/loader/i386/pc/plan9.c (grub_cmd_plan9): Remove PXE * grub-core/loader/i386/pc/plan9.c (grub_cmd_plan9): Remove PXE

View file

@ -113,7 +113,7 @@ kernel = {
ieee1275 = kern/ieee1275/ieee1275.c; ieee1275 = kern/ieee1275/ieee1275.c;
ieee1275 = kern/ieee1275/mmap.c; ieee1275 = kern/ieee1275/mmap.c;
ieee1275 = kern/ieee1275/openfw.c; ieee1275 = kern/ieee1275/openfw.c;
ieee1275 = term/ieee1275/ofconsole.c; ieee1275 = term/ieee1275/console.c;
ieee1275 = kern/ieee1275/init.c; ieee1275 = kern/ieee1275/init.c;
terminfoinkernel = term/terminfo.c; terminfoinkernel = term/terminfo.c;

View file

@ -95,11 +95,15 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled,
while (1) while (1)
{ {
for (term = *disabled; term; term = term->next) for (term = *disabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0) if (grub_strcmp (args[i], term->name) == 0
|| (grub_strcmp (args[i], "ofconsole") == 0
&& grub_strcmp ("console", term->name) == 0))
break; break;
if (term == 0) if (term == 0)
for (term = *enabled; term; term = term->next) for (term = *enabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0) if (grub_strcmp (args[i], term->name) == 0
|| (grub_strcmp (args[i], "ofconsole") == 0
&& grub_strcmp ("console", term->name) == 0))
break; break;
if (term) if (term)
break; break;
@ -108,6 +112,8 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled,
args[i]); args[i]);
for (aut = autoloads; aut; aut = aut->next) for (aut = autoloads; aut; aut = aut->next)
if (grub_strcmp (args[i], aut->name) == 0 if (grub_strcmp (args[i], aut->name) == 0
|| (grub_strcmp (args[i], "ofconsole") == 0
&& grub_strcmp ("console", aut->name) == 0)
|| (aut->name[0] && aut->name[grub_strlen (aut->name) - 1] == '*' || (aut->name[0] && aut->name[grub_strlen (aut->name) - 1] == '*'
&& grub_memcmp (args[i], aut->name, && grub_memcmp (args[i], aut->name,
grub_strlen (aut->name) - 1) == 0)) grub_strlen (aut->name) - 1) == 0))
@ -131,7 +137,9 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled,
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
{ {
for (term = *disabled; term; term = term->next) for (term = *disabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0) if (grub_strcmp (args[i], term->name) == 0
|| (grub_strcmp (args[i], "ofconsole") == 0
&& grub_strcmp ("console", term->name) == 0))
break; break;
if (term) if (term)
{ {
@ -150,7 +158,9 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled,
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
{ {
for (term = *enabled; term; term = term->next) for (term = *enabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0) if (grub_strcmp (args[i], term->name) == 0
|| (grub_strcmp (args[i], "ofconsole") == 0
&& grub_strcmp ("console", term->name) == 0))
break; break;
if (term) if (term)
{ {
@ -168,7 +178,9 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled,
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
{ {
for (term = *disabled; term; term = term->next) for (term = *disabled; term; term = term->next)
if (grub_strcmp (args[i], term->name) == 0) if (grub_strcmp (args[i], term->name) == 0
|| (grub_strcmp (args[i], "ofconsole") == 0
&& grub_strcmp ("console", term->name) == 0))
break; break;
if (term) if (term)
{ {
@ -186,7 +198,9 @@ handle_command (int argc, char **args, struct abstract_terminal **enabled,
{ {
next = term->next; next = term->next;
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
if (grub_strcmp (args[i], term->name) == 0) if (grub_strcmp (args[i], term->name) == 0
|| (grub_strcmp (args[i], "ofconsole") == 0
&& grub_strcmp ("console", term->name) == 0))
break; break;
if (i == argc) if (i == argc)
{ {

View file

@ -1,4 +1,4 @@
/* ofconsole.c -- Open Firmware console for GRUB. */ /* console.c -- Open Firmware console for GRUB. */
/* /*
* GRUB -- GRand Unified Bootloader * GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc. * Copyright (C) 2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
@ -29,7 +29,7 @@
static grub_ieee1275_ihandle_t stdout_ihandle; static grub_ieee1275_ihandle_t stdout_ihandle;
static grub_ieee1275_ihandle_t stdin_ihandle; static grub_ieee1275_ihandle_t stdin_ihandle;
extern struct grub_terminfo_output_state grub_ofconsole_terminfo_output; extern struct grub_terminfo_output_state grub_console_terminfo_output;
struct color struct color
{ {
@ -74,7 +74,7 @@ readkey (struct grub_term_input *term __attribute__ ((unused)))
} }
static void static void
grub_ofconsole_dimensions (void) grub_console_dimensions (void)
{ {
grub_ieee1275_ihandle_t options; grub_ieee1275_ihandle_t options;
grub_ssize_t lval; grub_ssize_t lval;
@ -90,7 +90,7 @@ grub_ofconsole_dimensions (void)
if (! grub_ieee1275_get_property (options, "screen-#columns", if (! grub_ieee1275_get_property (options, "screen-#columns",
val, lval, 0)) val, lval, 0))
grub_ofconsole_terminfo_output.width grub_console_terminfo_output.width
= (grub_uint8_t) grub_strtoul (val, 0, 10); = (grub_uint8_t) grub_strtoul (val, 0, 10);
} }
if (! grub_ieee1275_get_property_length (options, "screen-#rows", &lval) if (! grub_ieee1275_get_property_length (options, "screen-#rows", &lval)
@ -99,20 +99,20 @@ grub_ofconsole_dimensions (void)
char val[lval]; char val[lval];
if (! grub_ieee1275_get_property (options, "screen-#rows", if (! grub_ieee1275_get_property (options, "screen-#rows",
val, lval, 0)) val, lval, 0))
grub_ofconsole_terminfo_output.height grub_console_terminfo_output.height
= (grub_uint8_t) grub_strtoul (val, 0, 10); = (grub_uint8_t) grub_strtoul (val, 0, 10);
} }
} }
/* Use a small console by default. */ /* Use a small console by default. */
if (! grub_ofconsole_terminfo_output.width) if (! grub_console_terminfo_output.width)
grub_ofconsole_terminfo_output.width = 80; grub_console_terminfo_output.width = 80;
if (! grub_ofconsole_terminfo_output.height) if (! grub_console_terminfo_output.height)
grub_ofconsole_terminfo_output.height = 24; grub_console_terminfo_output.height = 24;
} }
static void static void
grub_ofconsole_setcursor (struct grub_term_output *term, grub_console_setcursor (struct grub_term_output *term,
int on) int on)
{ {
grub_terminfo_setcursor (term, on); grub_terminfo_setcursor (term, on);
@ -128,7 +128,7 @@ grub_ofconsole_setcursor (struct grub_term_output *term,
} }
static grub_err_t static grub_err_t
grub_ofconsole_init_input (struct grub_term_input *term) grub_console_init_input (struct grub_term_input *term)
{ {
grub_ssize_t actual; grub_ssize_t actual;
@ -141,7 +141,7 @@ grub_ofconsole_init_input (struct grub_term_input *term)
} }
static grub_err_t static grub_err_t
grub_ofconsole_init_output (struct grub_term_output *term) grub_console_init_output (struct grub_term_output *term)
{ {
grub_ssize_t actual; grub_ssize_t actual;
@ -168,7 +168,7 @@ grub_ofconsole_init_output (struct grub_term_output *term)
grub_terminfo_setcolorstate (term, GRUB_TERM_COLOR_NORMAL); grub_terminfo_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
} }
grub_ofconsole_dimensions (); grub_console_dimensions ();
grub_terminfo_output_init (term); grub_terminfo_output_init (term);
@ -177,39 +177,39 @@ grub_ofconsole_init_output (struct grub_term_output *term)
struct grub_terminfo_input_state grub_ofconsole_terminfo_input = struct grub_terminfo_input_state grub_console_terminfo_input =
{ {
.readkey = readkey .readkey = readkey
}; };
struct grub_terminfo_output_state grub_ofconsole_terminfo_output = struct grub_terminfo_output_state grub_console_terminfo_output =
{ {
.put = put, .put = put,
.width = 80, .width = 80,
.height = 24 .height = 24
}; };
static struct grub_term_input grub_ofconsole_term_input = static struct grub_term_input grub_console_term_input =
{ {
.name = "ofconsole", .name = "console",
.init = grub_ofconsole_init_input, .init = grub_console_init_input,
.getkey = grub_terminfo_getkey, .getkey = grub_terminfo_getkey,
.data = &grub_ofconsole_terminfo_input .data = &grub_console_terminfo_input
}; };
static struct grub_term_output grub_ofconsole_term_output = static struct grub_term_output grub_console_term_output =
{ {
.name = "ofconsole", .name = "console",
.init = grub_ofconsole_init_output, .init = grub_console_init_output,
.putchar = grub_terminfo_putchar, .putchar = grub_terminfo_putchar,
.getxy = grub_terminfo_getxy, .getxy = grub_terminfo_getxy,
.getwh = grub_terminfo_getwh, .getwh = grub_terminfo_getwh,
.gotoxy = grub_terminfo_gotoxy, .gotoxy = grub_terminfo_gotoxy,
.cls = grub_terminfo_cls, .cls = grub_terminfo_cls,
.setcolorstate = grub_terminfo_setcolorstate, .setcolorstate = grub_terminfo_setcolorstate,
.setcursor = grub_ofconsole_setcursor, .setcursor = grub_console_setcursor,
.flags = GRUB_TERM_CODE_TYPE_ASCII, .flags = GRUB_TERM_CODE_TYPE_ASCII,
.data = &grub_ofconsole_terminfo_output, .data = &grub_console_terminfo_output,
.normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR, .normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR,
.highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR, .highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR,
}; };
@ -220,8 +220,8 @@ void grub_terminfo_init (void);
void void
grub_console_init_early (void) grub_console_init_early (void)
{ {
grub_term_register_input ("ofconsole", &grub_ofconsole_term_input); grub_term_register_input ("console", &grub_console_term_input);
grub_term_register_output ("ofconsole", &grub_ofconsole_term_output); grub_term_register_output ("console", &grub_console_term_output);
} }
void void
@ -235,15 +235,15 @@ grub_console_init_lately (void)
type = "ieee1275"; type = "ieee1275";
grub_terminfo_init (); grub_terminfo_init ();
grub_terminfo_output_register (&grub_ofconsole_term_output, type); grub_terminfo_output_register (&grub_console_term_output, type);
} }
void void
grub_console_fini (void) grub_console_fini (void)
{ {
grub_term_unregister_input (&grub_ofconsole_term_input); grub_term_unregister_input (&grub_console_term_input);
grub_term_unregister_output (&grub_ofconsole_term_output); grub_term_unregister_output (&grub_console_term_output);
grub_terminfo_output_unregister (&grub_ofconsole_term_output); grub_terminfo_output_unregister (&grub_console_term_output);
grub_terminfo_fini (); grub_terminfo_fini ();
} }

View file

@ -673,7 +673,9 @@ grub_cmd_terminfo (grub_extcmd_context_t ctxt, int argc, char **args)
for (cur = terminfo_outputs; cur; for (cur = terminfo_outputs; cur;
cur = ((struct grub_terminfo_output_state *) cur->data)->next) cur = ((struct grub_terminfo_output_state *) cur->data)->next)
if (grub_strcmp (args[0], cur->name) == 0) if (grub_strcmp (args[0], cur->name) == 0
|| (grub_strcmp (args[0], "ofconsole") == 0
&& grub_strcmp ("console", cur->name) == 0))
{ {
cur->flags = (cur->flags & ~GRUB_TERM_CODE_TYPE_MASK) | encoding; cur->flags = (cur->flags & ~GRUB_TERM_CODE_TYPE_MASK) | encoding;