2010-01-07 Robert Millan <rmh.grub@aybabtu.com>
Merge prefix-redefinition-fix branch. * normal/autofs.c (read_fs_list): Make function capable of being run multiple times, gracefuly replacing the previous data structures. * normal/dyncmd.c (read_command_list): Likewise. * normal/handler.c (read_handler_list): Likewise. * normal/main.c (read_lists): New function. Calls all the list reading functions. (grub_normal_execute): Use read_lists() instead of calling all list reading functions explicitly. Register read_lists() as a variable hook attached to ${prefix}.
This commit is contained in:
commit
e2e936b2f2
5 changed files with 65 additions and 22 deletions
15
ChangeLog
15
ChangeLog
|
@ -1,3 +1,18 @@
|
|||
2010-01-07 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
Merge prefix-redefinition-fix branch.
|
||||
|
||||
* normal/autofs.c (read_fs_list): Make function capable of being
|
||||
run multiple times, gracefuly replacing the previous data
|
||||
structures.
|
||||
* normal/dyncmd.c (read_command_list): Likewise.
|
||||
* normal/handler.c (read_handler_list): Likewise.
|
||||
* normal/main.c (read_lists): New function. Calls all the
|
||||
list reading functions.
|
||||
(grub_normal_execute): Use read_lists() instead of calling all
|
||||
list reading functions explicitly. Register read_lists() as a
|
||||
variable hook attached to ${prefix}.
|
||||
|
||||
2010-01-07 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Merge crypto branch.
|
||||
|
|
|
@ -51,12 +51,6 @@ void
|
|||
read_fs_list (void)
|
||||
{
|
||||
const char *prefix;
|
||||
static int first_time = 1;
|
||||
|
||||
/* Make sure that this function does not get executed twice. */
|
||||
if (! first_time)
|
||||
return;
|
||||
first_time = 0;
|
||||
|
||||
prefix = grub_env_get ("prefix");
|
||||
if (prefix)
|
||||
|
@ -67,11 +61,27 @@ read_fs_list (void)
|
|||
if (filename)
|
||||
{
|
||||
grub_file_t file;
|
||||
grub_fs_autoload_hook_t tmp_autoload_hook;
|
||||
|
||||
grub_sprintf (filename, "%s/fs.lst", prefix);
|
||||
|
||||
/* This rules out the possibility that read_fs_list() is invoked
|
||||
recursively when we call grub_file_open() below. */
|
||||
tmp_autoload_hook = grub_fs_autoload_hook;
|
||||
grub_fs_autoload_hook = NULL;
|
||||
|
||||
file = grub_file_open (filename);
|
||||
if (file)
|
||||
{
|
||||
/* Override previous fs.lst. */
|
||||
while (fs_module_list)
|
||||
{
|
||||
grub_named_list_t tmp;
|
||||
tmp = fs_module_list->next;
|
||||
grub_free (fs_module_list);
|
||||
fs_module_list = tmp;
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
char *buf;
|
||||
|
@ -113,6 +123,7 @@ read_fs_list (void)
|
|||
}
|
||||
|
||||
grub_file_close (file);
|
||||
grub_fs_autoload_hook = tmp_autoload_hook;
|
||||
}
|
||||
|
||||
grub_free (filename);
|
||||
|
|
|
@ -63,12 +63,6 @@ void
|
|||
read_command_list (void)
|
||||
{
|
||||
const char *prefix;
|
||||
static int first_time = 1;
|
||||
|
||||
/* Make sure that this function does not get executed twice. */
|
||||
if (! first_time)
|
||||
return;
|
||||
first_time = 0;
|
||||
|
||||
prefix = grub_env_get ("prefix");
|
||||
if (prefix)
|
||||
|
@ -85,6 +79,16 @@ read_command_list (void)
|
|||
if (file)
|
||||
{
|
||||
char *buf = NULL;
|
||||
|
||||
/* Override previous commands.lst. */
|
||||
while (grub_command_list)
|
||||
{
|
||||
grub_command_t tmp;
|
||||
tmp = grub_command_list->next;
|
||||
grub_free (grub_command_list);
|
||||
grub_command_list = tmp;
|
||||
}
|
||||
|
||||
for (;; grub_free (buf))
|
||||
{
|
||||
char *p, *name, *modname;
|
||||
|
|
|
@ -135,7 +135,6 @@ void
|
|||
read_handler_list (void)
|
||||
{
|
||||
const char *prefix;
|
||||
static int first_time = 1;
|
||||
const char *class_name;
|
||||
|
||||
auto int iterate_handler (grub_handler_t handler);
|
||||
|
@ -162,11 +161,6 @@ read_handler_list (void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Make sure that this function does not get executed twice. */
|
||||
if (! first_time)
|
||||
return;
|
||||
first_time = 0;
|
||||
|
||||
prefix = grub_env_get ("prefix");
|
||||
if (prefix)
|
||||
{
|
||||
|
@ -182,6 +176,16 @@ read_handler_list (void)
|
|||
if (file)
|
||||
{
|
||||
char *buf = NULL;
|
||||
|
||||
/* Override previous handler.lst. */
|
||||
while (grub_handler_class_list)
|
||||
{
|
||||
grub_handler_class_t tmp;
|
||||
tmp = grub_handler_class_list->next;
|
||||
grub_free (grub_handler_class_list);
|
||||
grub_handler_class_list = tmp;
|
||||
}
|
||||
|
||||
for (;; grub_free (buf))
|
||||
{
|
||||
char *p;
|
||||
|
|
|
@ -418,6 +418,17 @@ grub_normal_init_page (void)
|
|||
|
||||
static int reader_nested;
|
||||
|
||||
static char *
|
||||
read_lists (struct grub_env_var *var __attribute__ ((unused)),
|
||||
const char *val)
|
||||
{
|
||||
read_command_list ();
|
||||
read_fs_list ();
|
||||
read_handler_list ();
|
||||
read_crypto_list ();
|
||||
return val ? grub_strdup (val) : NULL;
|
||||
}
|
||||
|
||||
/* Read the config file CONFIG and execute the menu interface or
|
||||
the command line interface if BATCH is false. */
|
||||
void
|
||||
|
@ -425,10 +436,8 @@ grub_normal_execute (const char *config, int nested, int batch)
|
|||
{
|
||||
grub_menu_t menu = 0;
|
||||
|
||||
read_command_list ();
|
||||
read_fs_list ();
|
||||
read_handler_list ();
|
||||
read_crypto_list ();
|
||||
read_lists (NULL, NULL);
|
||||
grub_register_variable_hook ("prefix", NULL, read_lists);
|
||||
grub_command_execute ("parser.grub", 0, 0);
|
||||
|
||||
reader_nested = nested;
|
||||
|
|
Loading…
Add table
Reference in a new issue