2006-05-07 Yoshinori K. Okuji <okuji@enbug.org>

Use the environment context in the menu. Remove the commands
        "default" and "timeout", and use variables instead.

        * normal/menu.c: Include grub/env.h.
        (print_entry): Cast TITLE to silence gcc.
        (get_timeout): New function.
        (set_timeout): Likewise.
        (get_entry_number): Likewise.
        (run_menu): Use a default entry, a fallback entry and a timeout
        in the environment variables "default", "fallback" and
        "timeout". Also, tweak the default entry if it is not within the
        current menu entries.
        (grub_menu_run): Use a fallback entry in the environment variable
        "fallback".

        * normal/main.c (read_config_file): Do not initialize
        NEWMENU->DEFAULT_ENTRY, NEWMENU->FALLBACK_ENTRY or
        NEWMENU->TIMEOUT.
        (grub_normal_execute): Use a data slot to store the menu.

        * include/grub/normal.h (struct grub_menu): Removed default_entry,
        fallback_entry and timeout.
        (struct grub_menu_list): Removed.
        (grub_menu_list_t): Likewise.
        (struct grub_context): Likewise.
        (grub_context_t): Likewise.
        (grub_context_get): Likewise.
        (grub_context_get_current_menu): Likewise.
        (grub_context_push_menu): Likewise.
        (grub_context_pop_menu): Likewise.
        (grub_default_init): Likewise.
        (grub_default_fini): Likewise.
        (grub_timeout_init): Likewise.
        (grub_timeout_fini): Likewise.

        * conf/sparc64-ieee1275.rmk (pkgdata_MODULES): Removed default.mod
        and timeout.mod.
        (normal_mod_SOURCES): Removed normal/context.c.

        * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Removed
        commands/default.c, commands/timeout.c and normal/context.c.
        (normal_mod_SOURCES): Removed normal/context.c.

        * conf/i386-pc.rmk (grub_emu_SOURCES): Removed commands/default.c,
        commands/timeout.c and normal/context.c.
        (normal_mod_SOURCES): Removed normal/context.c.

        * conf/i386-efi.rmk (grub_emu_SOURCES): Removed
        commands/default.c, commands/timeout.c and normal/context.c.
        (normal_mod_SOURCES): Removed normal/context.c.

        * conf/common.rmk (pkgdata_MODULES): Removed default.mod and
        timeout.mod.
        (default_mod_SOURCES): Removed.
        (default_mod_CFLAGS): Likewise.
        (default_mod_LDFLAGS): Likewise.
        (timeout_mod_SOURCES): Removed.
        (timeout_mod_CFLAGS): Likewise.
        (timeout_mod_LDFLAGS): Likewise.

        * DISTLIST: Removed commands/default.c, commands/timeout.c and
        normal/context.c.

        * commands/default.c: Removed.
        * commands/timeout.c: Likewise.
        * normal/context.c: Likewise.
This commit is contained in:
okuji 2006-05-07 18:28:24 +00:00
parent 1eb9cc1da4
commit 4e93851c0f
18 changed files with 225 additions and 643 deletions

View file

@ -1,7 +1,7 @@
/* normal.h - prototypes for the normal mode */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2005 Free Software Foundation, Inc.
* Copyright (C) 2002,2003,2005,2006 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -105,15 +105,6 @@ typedef struct grub_menu_entry *grub_menu_entry_t;
/* The menu. */
struct grub_menu
{
/* The default entry number. */
int default_entry;
/* The fallback entry number. */
int fallback_entry;
/* The timeout to boot the default entry automatically. */
int timeout;
/* The size of a menu. */
int size;
@ -122,22 +113,6 @@ struct grub_menu
};
typedef struct grub_menu *grub_menu_t;
/* A list of menus. */
struct grub_menu_list
{
grub_menu_t menu;
struct grub_menu_list *next;
};
typedef struct grub_menu_list *grub_menu_list_t;
/* The context. A context holds some global information. */
struct grub_context
{
/* The menu list. */
grub_menu_list_t menu_list;
};
typedef struct grub_context *grub_context_t;
/* This is used to store the names of filesystem modules for auto-loading. */
struct grub_fs_module_list
{
@ -175,10 +150,6 @@ void grub_menu_init_page (int nested, int edit);
int grub_arg_parse (grub_command_t parser, int argc, char **argv,
struct grub_arg_list *usr, char ***args, int *argnum);
void grub_arg_show_help (grub_command_t cmd);
grub_context_t grub_context_get (void);
grub_menu_t grub_context_get_current_menu (void);
grub_menu_t grub_context_push_menu (grub_menu_t menu);
void grub_context_pop_menu (void);
char *grub_normal_do_completion (char *buf, int *restore,
void (*hook) (const char *item, grub_completion_type_t type, int count));
grub_err_t grub_normal_print_device_info (const char *name);
@ -209,10 +180,6 @@ void grub_halt_init (void);
void grub_halt_fini (void);
void grub_reboot_init (void);
void grub_reboot_fini (void);
void grub_default_init (void);
void grub_default_fini (void);
void grub_timeout_init (void);
void grub_timeout_fini (void);
void grub_configfile_init (void);
void grub_configfile_fini (void);
void grub_search_init (void);