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

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