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

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