2009-05-23 Colin D Bennett <colin@gibibit.com>

Cleaned up `include/grub/normal.h'.  Grouped prototypes by
	definition file, and functions defined in `normal/menu.c' have had
	their prototypes moved to `include/grub/menu.h' for consistency.

	* include/grub/menu.h (grub_menu_execute_callback): Added; moved
	from normal.h.
	(grub_menu_get_entry): Likewise.
	(grub_menu_get_timeout): Likewise.
	(grub_menu_set_timeout): Likewise.
	(grub_menu_execute_entry): Likewise.
	(grub_menu_execute_with_fallback): Likewise.
	(grub_menu_entry_run): Likewise.

	* include/grub/normal.h: Re-ordered and grouped function
	prototypes by file that the function is defined in.
	(grub_menu_execute_callback): Removed; moved to menu.h.
	(grub_menu_get_entry): Likewise.
	(grub_menu_get_timeout): Likewise.
	(grub_menu_set_timeout): Likewise.
	(grub_menu_execute_entry): Likewise.
	(grub_menu_execute_with_fallback): Likewise.
	(grub_menu_entry_run): Likewise.
	(grub_menu_addentry): Renamed from this ...
	(grub_normal_add_menu_entry): ... to this.

	* normal/main.c (grub_menu_addentry): Renamed from this ...
	(grub_normal_add_menu_entry): ... to this.

	* script/sh/execute.c (grub_script_execute_menuentry): Update
	reference to renamed grub_menu_addentry function.
This commit is contained in:
cbennett 2009-05-24 08:39:29 +00:00
parent 861f03a5b9
commit 230c0ad633
5 changed files with 95 additions and 39 deletions

View file

@ -1,3 +1,36 @@
2009-05-23 Colin D Bennett <colin@gibibit.com>
Cleaned up `include/grub/normal.h'. Grouped prototypes by
definition file, and functions defined in `normal/menu.c' have had
their prototypes moved to `include/grub/menu.h' for consistency.
* include/grub/menu.h (grub_menu_execute_callback): Added; moved
from normal.h.
(grub_menu_get_entry): Likewise.
(grub_menu_get_timeout): Likewise.
(grub_menu_set_timeout): Likewise.
(grub_menu_execute_entry): Likewise.
(grub_menu_execute_with_fallback): Likewise.
(grub_menu_entry_run): Likewise.
* include/grub/normal.h: Re-ordered and grouped function
prototypes by file that the function is defined in.
(grub_menu_execute_callback): Removed; moved to menu.h.
(grub_menu_get_entry): Likewise.
(grub_menu_get_timeout): Likewise.
(grub_menu_set_timeout): Likewise.
(grub_menu_execute_entry): Likewise.
(grub_menu_execute_with_fallback): Likewise.
(grub_menu_entry_run): Likewise.
(grub_menu_addentry): Renamed from this ...
(grub_normal_add_menu_entry): ... to this.
* normal/main.c (grub_menu_addentry): Renamed from this ...
(grub_normal_add_menu_entry): ... to this.
* script/sh/execute.c (grub_script_execute_menuentry): Update
reference to renamed grub_menu_addentry function.
2009-05-23 Felix Zielcke <fzielcke@z-51.de>
* commands/i386/pc/drivemap.c (MODNAME): Remove. Update all users.

View file

@ -1,4 +1,4 @@
/* menu.h - Menu and menu entry model declarations. */
/* menu.h - Menu model function prototypes and data structures. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
@ -57,4 +57,35 @@ struct grub_menu
};
typedef struct grub_menu *grub_menu_t;
/* Callback structure menu viewers can use to provide user feedback when
default entries are executed, possibly including fallback entries. */
typedef struct grub_menu_execute_callback
{
/* Called immediately before ENTRY is booted. */
void (*notify_booting) (grub_menu_entry_t entry, void *userdata);
/* Called when executing one entry has failed, and another entry, ENTRY, will
be executed as a fallback. The implementation of this function should
delay for a period of at least 2 seconds before returning in order to
allow the user time to read the information before it can be lost by
executing ENTRY. */
void (*notify_fallback) (grub_menu_entry_t entry, void *userdata);
/* Called when an entry has failed to execute and there is no remaining
fallback entry to attempt. */
void (*notify_failure) (void *userdata);
}
*grub_menu_execute_callback_t;
grub_menu_entry_t grub_menu_get_entry (grub_menu_t menu, int no);
int grub_menu_get_timeout (void);
void grub_menu_set_timeout (int timeout);
void grub_menu_execute_entry (grub_menu_entry_t entry);
void grub_menu_execute_with_fallback (grub_menu_t menu,
grub_menu_entry_t entry,
grub_menu_execute_callback_t callback,
void *callback_data);
void grub_menu_entry_run (grub_menu_entry_t entry);
#endif /* GRUB_MENU_HEADER */

View file

@ -43,58 +43,47 @@ typedef enum grub_completion_type grub_completion_type_t;
extern struct grub_menu_viewer grub_normal_text_menu_viewer;
/* Callback structure menu viewers can use to provide user feedback when
default entries are executed, possibly including fallback entries. */
typedef struct grub_menu_execute_callback
{
/* Called immediately before ENTRY is booted. */
void (*notify_booting) (grub_menu_entry_t entry, void *userdata);
/* Called when executing one entry has failed, and another entry, ENTRY, will
be executed as a fallback. The implementation of this function should
delay for a period of at least 2 seconds before returning in order to
allow the user time to read the information before it can be lost by
executing ENTRY. */
void (*notify_fallback) (grub_menu_entry_t entry, void *userdata);
/* Called when an entry has failed to execute and there is no remaining
fallback entry to attempt. */
void (*notify_failure) (void *userdata);
}
*grub_menu_execute_callback_t;
/* Defined in `main.c'. */
void grub_enter_normal_mode (const char *config);
void grub_normal_execute (const char *config, int nested, int batch);
void grub_menu_execute_with_fallback (grub_menu_t menu,
grub_menu_entry_t entry,
grub_menu_execute_callback_t callback,
void *callback_data);
void grub_menu_entry_run (grub_menu_entry_t entry);
void grub_menu_execute_entry(grub_menu_entry_t entry);
grub_menu_entry_t grub_menu_get_entry (grub_menu_t menu, int no);
int grub_menu_get_timeout (void);
void grub_menu_set_timeout (int timeout);
void grub_normal_init_page (void);
void grub_menu_init_page (int nested, int edit);
grub_err_t grub_normal_add_menu_entry (int argc, const char **args,
const char *sourcecode);
char *grub_file_getline (grub_file_t file);
void grub_cmdline_run (int nested);
/* Defined in `cmdline.c'. */
int grub_cmdline_get (const char *prompt, char cmdline[], unsigned max_len,
int echo_char, int readline);
grub_err_t grub_set_history (int newsize);
void grub_normal_init_page (void);
void grub_menu_init_page (int nested, int edit);
/* Defined in `completion.c'. */
char *grub_normal_do_completion (char *buf, int *restore,
void (*hook) (const char *item, grub_completion_type_t type, int count));
/* Defined in `misc.c'. */
grub_err_t grub_normal_print_device_info (const char *name);
/* Defined in `color.c'. */
char *grub_env_write_color_normal (struct grub_env_var *var, const char *val);
char *grub_env_write_color_highlight (struct grub_env_var *var, const char *val);
void grub_parse_color_name_pair (grub_uint8_t *ret, const char *name);
/* Defined in `menu_text.c'. */
void grub_wait_after_message (void);
char *grub_file_getline (grub_file_t file);
/* Defined in `handler.c'. */
void read_handler_list (void);
void free_handler_list (void);
/* Defined in `dyncmd.c'. */
void read_command_list (void);
/* Defined in `autofs.c'. */
void read_fs_list (void);
void grub_cmdline_run (int nested);
grub_err_t grub_menu_addentry (int argc, const char **args,
const char *sourcecode);
#ifdef GRUB_UTIL
void grub_normal_init (void);

View file

@ -149,9 +149,12 @@ free_menu_entry_classes (struct grub_menu_entry_class *head)
}
}
/* Add a menu entry to the current menu context (as given by the environment
variable data slot `menu'). As the configuration file is read, the script
parser calls this when a menu entry is to be created. */
grub_err_t
grub_menu_addentry (int argc, const char **args,
const char *sourcecode)
grub_normal_add_menu_entry (int argc, const char **args,
const char *sourcecode)
{
const char *menutitle = 0;
const char *menusourcecode;

View file

@ -222,8 +222,8 @@ grub_script_execute_menuentry (struct grub_script_cmd *cmd)
}
}
grub_menu_addentry (argcount, (const char **) args,
cmd_menuentry->sourcecode);
grub_normal_add_menu_entry (argcount, (const char **) args,
cmd_menuentry->sourcecode);
/* Free arguments. */
for (i = 0; i < argcount; i++)