From 027de555e271b3954fbd749c293ec807cf720405 Mon Sep 17 00:00:00 2001 From: Vladimir 'phcoder' Serbinenko Date: Fri, 9 Apr 2010 21:07:24 +0200 Subject: [PATCH] * normal/autofs.c (read_fs_list): New parameter 'prefix'. All users updated. * normal/crypto.c (read_crypto_list): Likewise. * normal/dyncmd.c (read_command_list): Likewise. * normal/term.c (read_terminal_list): Likewise. * normal/main.c (read_lists): Use explicit prefix. (read_lists_hook): Use read_lists. (grub_normal_execute): Likewise. --- ChangeLog | 11 +++++++++++ include/grub/normal.h | 8 ++++---- normal/autofs.c | 5 +---- normal/crypto.c | 4 +--- normal/dyncmd.c | 5 +---- normal/main.c | 23 +++++++++++++++-------- normal/term.c | 4 +--- 7 files changed, 34 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index a2a33b2ef..5f3251fcb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2010-04-09 Vladimir Serbinenko + + * normal/autofs.c (read_fs_list): New parameter 'prefix'. + All users updated. + * normal/crypto.c (read_crypto_list): Likewise. + * normal/dyncmd.c (read_command_list): Likewise. + * normal/term.c (read_terminal_list): Likewise. + * normal/main.c (read_lists): Use explicit prefix. + (read_lists_hook): Use read_lists. + (grub_normal_execute): Likewise. + 2010-04-09 Vladimir Serbinenko * util/grub-mkrescue.in: Fix incorrect path in coreboot part. diff --git a/include/grub/normal.h b/include/grub/normal.h index fe45ddf71..35eedf5ae 100644 --- a/include/grub/normal.h +++ b/include/grub/normal.h @@ -96,17 +96,17 @@ void read_handler_list (void); void free_handler_list (void); /* Defined in `dyncmd.c'. */ -void read_command_list (void); +void read_command_list (const char *prefix); /* Defined in `autofs.c'. */ -void read_fs_list (void); +void read_fs_list (const char *prefix); void grub_context_init (void); void grub_context_fini (void); -void read_crypto_list (void); +void read_crypto_list (const char *prefix); -void read_terminal_list (void); +void read_terminal_list (const char *prefix); void grub_set_more (int onoff); diff --git a/normal/autofs.c b/normal/autofs.c index 11b3fc1be..e1d4c017c 100644 --- a/normal/autofs.c +++ b/normal/autofs.c @@ -51,11 +51,8 @@ autoload_fs_module (void) /* Read the file fs.lst for auto-loading. */ void -read_fs_list (void) +read_fs_list (const char *prefix) { - const char *prefix; - - prefix = grub_env_get ("prefix"); if (prefix) { char *filename; diff --git a/normal/crypto.c b/normal/crypto.c index f051e2c4c..465c9f81d 100644 --- a/normal/crypto.c +++ b/normal/crypto.c @@ -66,14 +66,12 @@ grub_crypto_spec_free (void) /* Read the file crypto.lst for auto-loading. */ void -read_crypto_list (void) +read_crypto_list (const char *prefix) { - const char *prefix; char *filename; grub_file_t file; char *buf = NULL; - prefix = grub_env_get ("prefix"); if (!prefix) { grub_errno = GRUB_ERR_NONE; diff --git a/normal/dyncmd.c b/normal/dyncmd.c index ca9a82289..a3cafa514 100644 --- a/normal/dyncmd.c +++ b/normal/dyncmd.c @@ -60,11 +60,8 @@ grub_dyncmd_dispatcher (struct grub_command *cmd, /* Read the file command.lst for auto-loading. */ void -read_command_list (void) +read_command_list (const char *prefix) { - const char *prefix; - - prefix = grub_env_get ("prefix"); if (prefix) { char *filename; diff --git a/normal/main.c b/normal/main.c index 5a5467485..df92e622b 100644 --- a/normal/main.c +++ b/normal/main.c @@ -434,14 +434,20 @@ grub_normal_init_page (struct grub_term_output *term) grub_free (unicode_msg); } +static void +read_lists (const char *val) +{ + read_command_list (val); + read_fs_list (val); + read_crypto_list (val); + read_terminal_list (val); +} + static char * -read_lists (struct grub_env_var *var __attribute__ ((unused)), - const char *val) +read_lists_hook (struct grub_env_var *var __attribute__ ((unused)), + const char *val) { - read_command_list (); - read_fs_list (); - read_crypto_list (); - read_terminal_list (); + read_lists (val); return val ? grub_strdup (val) : NULL; } @@ -451,10 +457,11 @@ void grub_normal_execute (const char *config, int nested, int batch) { grub_menu_t menu = 0; + const char *prefix = grub_env_get ("prefix"); - read_lists (NULL, NULL); + read_lists (prefix); read_handler_list (); - grub_register_variable_hook ("prefix", NULL, read_lists); + grub_register_variable_hook ("prefix", NULL, read_lists_hook); grub_command_execute ("parser.grub", 0, 0); if (config) diff --git a/normal/term.c b/normal/term.c index 7bedd6799..688141dab 100644 --- a/normal/term.c +++ b/normal/term.c @@ -167,14 +167,12 @@ grub_terminal_autoload_free (void) /* Read the file terminal.lst for auto-loading. */ void -read_terminal_list (void) +read_terminal_list (const char *prefix) { - const char *prefix; char *filename; grub_file_t file; char *buf = NULL; - prefix = grub_env_get ("prefix"); if (!prefix) { grub_errno = GRUB_ERR_NONE; -- 2.39.2