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

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