|
|
a85e8e |
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
|
|
|
a85e8e |
Subject: [PATCH 032/260] * grub-core/normal/main.c (read_config_file): Buffer
|
|
|
a85e8e |
config file. Reduces boot time.
|
|
|
a85e8e |
|
|
|
a85e8e |
---
|
|
|
a85e8e |
ChangeLog | 5 +++++
|
|
|
a85e8e |
grub-core/normal/main.c | 14 +++++++++++---
|
|
|
a85e8e |
2 files changed, 16 insertions(+), 3 deletions(-)
|
|
|
a85e8e |
|
|
|
a85e8e |
diff --git a/ChangeLog b/ChangeLog
|
|
|
a85e8e |
index c3bfa9fcb..c84f7e7cc 100644
|
|
|
a85e8e |
--- a/ChangeLog
|
|
|
a85e8e |
+++ b/ChangeLog
|
|
|
a85e8e |
@@ -1,3 +1,8 @@
|
|
|
a85e8e |
+2014-01-18 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
a85e8e |
+
|
|
|
a85e8e |
+ * grub-core/normal/main.c (read_config_file): Buffer config file.
|
|
|
a85e8e |
+ Reduces boot time.
|
|
|
a85e8e |
+
|
|
|
a85e8e |
2014-01-18 Andrey Borzenkov <arvidjaar@gmail.com>
|
|
|
a85e8e |
|
|
|
a85e8e |
* 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
|
|
|
a85e8e |
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);
|
|
|
a85e8e |
--
|
|
|
a85e8e |
2.13.0
|
|
|
a85e8e |
|