* grub-core/normal/main.c (read_config_file): Buffer config file.

Reduces boot time.
This commit is contained in:
Vladimir Serbinenko 2014-01-18 19:54:09 +01:00
parent e0a850947f
commit 41155a5722
2 changed files with 16 additions and 3 deletions
ChangeLog
grub-core/normal

View file

@ -1,3 +1,8 @@
2014-01-18 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/main.c (read_config_file): Buffer config file.
Reduces boot time.
2014-01-18 Andrey Borzenkov <arvidjaar@gmail.com> 2014-01-18 Andrey Borzenkov <arvidjaar@gmail.com>
* acinclude.m4 (grub_CHECK_LINK_DIR): Check that we can also remove * acinclude.m4 (grub_CHECK_LINK_DIR): Check that we can also remove

View file

@ -32,6 +32,7 @@
#include <grub/i18n.h> #include <grub/i18n.h>
#include <grub/charset.h> #include <grub/charset.h>
#include <grub/script_sh.h> #include <grub/script_sh.h>
#include <grub/bufio.h>
GRUB_MOD_LICENSE ("GPLv3+"); GRUB_MOD_LICENSE ("GPLv3+");
@ -104,7 +105,7 @@ read_config_file_getline (char **line, int cont __attribute__ ((unused)),
static grub_menu_t static grub_menu_t
read_config_file (const char *config) read_config_file (const char *config)
{ {
grub_file_t file; grub_file_t rawfile, file;
char *old_file = 0, *old_dir = 0; char *old_file = 0, *old_dir = 0;
char *config_dir, *ptr = 0; char *config_dir, *ptr = 0;
const char *ctmp; const char *ctmp;
@ -122,10 +123,17 @@ read_config_file (const char *config)
} }
/* Try to open the config file. */ /* Try to open the config file. */
file = grub_file_open (config); rawfile = grub_file_open (config);
if (! file) if (! rawfile)
return 0; return 0;
file = grub_bufio_open (rawfile, 0);
if (! file)
{
grub_file_close (file);
return 0;
}
ctmp = grub_env_get ("config_file"); ctmp = grub_env_get ("config_file");
if (ctmp) if (ctmp)
old_file = grub_strdup (ctmp); old_file = grub_strdup (ctmp);