Blame SOURCES/0032-grub-core-normal-main.c-read_config_file-Buffer-conf.patch

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