2005-02-27 Yoshinori K. Okuji <okuji@enbug.org>
* commands/default.h: New file. * commands/timeout.h: Likewise. * normal/context.c: Likewise. * util/misc.c: Do not include sys/times.h. Include sys/time.h and grub/machine/time.h. (grub_get_rtc): Rewritten with gettimeofday. * util/grub-emu.c (main): Call grub_default_init and grub_timeout_init before grub_normal_init, and call grub_timeout_fini and grub_default_fini after grub_main. * util/console.c (grub_ncurses_checkkey): Return the read character or -1. * normal/menu.c (run_menu): Set MENU->TIMEOUT to -1 once it timeouts. * normal/main.c (read_config_file): Push MENU. If this fails, print an error and wait for a user input. Print an error only if GRUB_ERRNO is not GRUB_ERR_NONE. If a menu is empty or an error occurs, pop MENU. (grub_normal_execute): Pop and free MENU after grub_menu_run returns. * kern/loader.c (grub_loader_boot): Call grub_machine_fini. * include/grub/powerpc/ieee1275/time.h [GRUB_UTIL]: Do not include time.h. [GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as without GRUB_UTIL. * include/grub/i386/pc/time.h [GRUB_UTIL]: Do not include time.h. [GRUB_UTIL] (GRUB_TICKS_PER_SECOND): Use the same definition as without GRUB_UTIL. * include/grub/normal.h (struct grub_menu_list): New struct. (grub_menu_list_t): New type. (struct grub_context): New struct. (grub_context_t): New type. (grub_register_command): Got rid of EXPORT_FUNC. (grub_unregister_command): Likewise. (grub_context_get): New prototype. (grub_context_get_current_menu): Likewise. (grub_context_push_menu): Likewise. (grub_context_pop_menu): Likewise. [GRUB_UTIL] (grub_default_init): Likewise. [GRUB_UTIL] (grub_default_fini): Likewise. [GRUB_UTIL] (grub_timeout_init): Likewise. [GRUB_UTIL] (grub_timeout_fini): Likewise. * conf/i386-pc.rmk (grub_emu_SOURCES): Added commands/default.c, commands/timeout.c and normal/context.c. (pkgdata_MODULES): Added default.mod and timeout.mod. (normal_mod_SOURCES): Added normal/context.c. (default_mod_SOURCES): New variable. (default_mod_CFLAGS): Likewise. (timeout_mod_SOURCES): Likewise. (timeout_mod_CFLAGS): Likewise. * conf/powerpc-ieee1275.rmk (grub_emu_SOURCES): Copied from conf/i386-pc.rmk. (pkgdata_MODULES): Added default.mod and timeout.mod. (normal_mod_SOURCES): Added normal/context.c. (default_mod_SOURCES): New variable. (default_mod_CFLAGS): Likewise. (timeout_mod_SOURCES): Likewise. (timeout_mod_CFLAGS): Likewise. * Makefile.in (all-local): Added $(MKFILES).
This commit is contained in:
parent
4ed2e1dd1c
commit
93f3a1d868
18 changed files with 895 additions and 273 deletions
|
@ -116,6 +116,22 @@ 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;
|
||||
|
||||
/* To exit from the normal mode. */
|
||||
extern grub_jmp_buf grub_exit_env;
|
||||
|
||||
|
@ -126,14 +142,14 @@ void grub_menu_entry_run (grub_menu_entry_t entry);
|
|||
void grub_cmdline_run (int nested);
|
||||
int grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
|
||||
int echo_char, int readline);
|
||||
void EXPORT_FUNC(grub_register_command) (const char *name,
|
||||
void grub_register_command (const char *name,
|
||||
grub_err_t (*func) (struct grub_arg_list *state,
|
||||
int argc, char **args),
|
||||
unsigned flags,
|
||||
const char *summary,
|
||||
const char *description,
|
||||
const struct grub_arg_option *parser);
|
||||
void EXPORT_FUNC(grub_unregister_command) (const char *name);
|
||||
void grub_unregister_command (const char *name);
|
||||
grub_command_t grub_command_find (char *cmdline);
|
||||
grub_err_t grub_set_history (int newsize);
|
||||
int grub_iterate_commands (int (*iterate) (grub_command_t));
|
||||
|
@ -144,7 +160,10 @@ 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);
|
||||
|
||||
#ifdef GRUB_UTIL
|
||||
void grub_normal_init (void);
|
||||
|
@ -169,6 +188,10 @@ 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);
|
||||
#endif
|
||||
|
||||
#endif /* ! GRUB_NORMAL_HEADER */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue