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

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