]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/normal/main.c (read_config_file): Buffer config file.
authorVladimir Serbinenko <phcoder@gmail.com>
Sat, 18 Jan 2014 18:54:09 +0000 (19:54 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Sat, 18 Jan 2014 18:54:09 +0000 (19:54 +0100)
Reduces boot time.

ChangeLog
grub-core/normal/main.c

index c3bfa9fcb1bdc28bd00bb74e4a68c0b65eeb0fff..c84f7e7cc0097f1ecc13922ef6924b66809e3645 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-01-18  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/normal/main.c (read_config_file): Buffer config file.
+       Reduces boot time.
+
 2014-01-18  Andrey Borzenkov <arvidjaar@gmail.com>
 
        * acinclude.m4 (grub_CHECK_LINK_DIR): Check that we can also remove
index c36663f738ca9db88c67a3936f3b0a863676cb14..3a926fc5fa9eccef9968d524eb710a7e28f5fee7 100644 (file)
@@ -32,6 +32,7 @@
 #include <grub/i18n.h>
 #include <grub/charset.h>
 #include <grub/script_sh.h>
+#include <grub/bufio.h>
 
 GRUB_MOD_LICENSE ("GPLv3+");
 
@@ -104,7 +105,7 @@ read_config_file_getline (char **line, int cont __attribute__ ((unused)),
 static grub_menu_t
 read_config_file (const char *config)
 {
-  grub_file_t file;
+  grub_file_t rawfile, file;
   char *old_file = 0, *old_dir = 0;
   char *config_dir, *ptr = 0;
   const char *ctmp;
@@ -122,10 +123,17 @@ read_config_file (const char *config)
     }
 
   /* Try to open the config file.  */
-  file = grub_file_open (config);
-  if (! file)
+  rawfile = grub_file_open (config);
+  if (! rawfile)
     return 0;
 
+  file = grub_bufio_open (rawfile, 0);
+  if (! file)
+    {
+      grub_file_close (file);
+      return 0;
+    }
+
   ctmp = grub_env_get ("config_file");
   if (ctmp)
     old_file = grub_strdup (ctmp);