You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

65 lines
1.8 KiB

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Sat, 18 Jan 2014 19:54:09 +0100
Subject: [PATCH] * grub-core/normal/main.c (read_config_file): Buffer config
file. Reduces boot time.
---
grub-core/normal/main.c | 14 +++++++++++---
ChangeLog | 5 +++++
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index c36663f738c..3a926fc5fa9 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -32,6 +32,7 @@
#include <grub/i18n.h>
#include <grub/charset.h>
#include <grub/script_sh.h>
+#include <grub/bufio.h>
GRUB_MOD_LICENSE ("GPLv3+");
@@ -104,7 +105,7 @@ read_config_file_getline (char **line, int cont __attribute__ ((unused)),
static grub_menu_t
read_config_file (const char *config)
{
- grub_file_t file;
+ grub_file_t rawfile, file;
char *old_file = 0, *old_dir = 0;
char *config_dir, *ptr = 0;
const char *ctmp;
@@ -122,10 +123,17 @@ read_config_file (const char *config)
}
/* Try to open the config file. */
- file = grub_file_open (config);
- if (! file)
+ rawfile = grub_file_open (config);
+ if (! rawfile)
return 0;
+ file = grub_bufio_open (rawfile, 0);
+ if (! file)
+ {
+ grub_file_close (file);
+ return 0;
+ }
+
ctmp = grub_env_get ("config_file");
if (ctmp)
old_file = grub_strdup (ctmp);
diff --git a/ChangeLog b/ChangeLog
index c3bfa9fcb1b..c84f7e7cc00 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* acinclude.m4 (grub_CHECK_LINK_DIR): Check that we can also remove