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

39700a
From 221f6e1ac22f66881276d4cb012d588ecfb17e47 Mon Sep 17 00:00:00 2001
39700a
From: Vladimir Serbinenko <phcoder@gmail.com>
39700a
Date: Sat, 18 Jan 2014 19:54:09 +0100
39700a
Subject: [PATCH 032/143] 	* grub-core/normal/main.c (read_config_file):
39700a
 Buffer config file. 	Reduces boot time.
39700a
39700a
---
39700a
 ChangeLog               |  5 +++++
39700a
 grub-core/normal/main.c | 14 +++++++++++---
39700a
 2 files changed, 16 insertions(+), 3 deletions(-)
39700a
39700a
diff --git a/ChangeLog b/ChangeLog
39700a
index c3bfa9f..c84f7e7 100644
39700a
--- a/ChangeLog
39700a
+++ b/ChangeLog
39700a
@@ -1,3 +1,8 @@
39700a
+2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
39700a
+
39700a
+	* grub-core/normal/main.c (read_config_file): Buffer config file.
39700a
+	Reduces boot time.
39700a
+
39700a
 2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
39700a
 
39700a
 	* acinclude.m4 (grub_CHECK_LINK_DIR): Check that we can also remove
39700a
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
39700a
index c36663f..3a926fc 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);
39700a
-- 
39700a
1.9.3
39700a