2021-01-12 16:38:06 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: =?UTF-8?q?Renaud=20M=C3=A9trich?= <rmetrich@redhat.com>
|
|
|
|
Date: Fri, 29 Nov 2019 11:02:00 +0100
|
|
|
|
Subject: [PATCH] grub_file_* instrumentation (new 'file' debug tag)
|
|
|
|
MIME-Version: 1.0
|
|
|
|
Content-Type: text/plain; charset=UTF-8
|
|
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
|
|
|
|
Signed-off-by: Renaud Métrich <rmetrich@redhat.com>
|
|
|
|
---
|
|
|
|
grub-core/kern/file.c | 14 ++++++++++++++
|
|
|
|
1 file changed, 14 insertions(+)
|
|
|
|
|
|
|
|
diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c
|
2023-02-15 16:54:38 +00:00
|
|
|
index 5b58f45cfd..ec10e54fc0 100644
|
2021-01-12 16:38:06 +00:00
|
|
|
--- a/grub-core/kern/file.c
|
|
|
|
+++ b/grub-core/kern/file.c
|
|
|
|
@@ -66,6 +66,8 @@ grub_file_open (const char *name, enum grub_file_type type)
|
|
|
|
const char *file_name;
|
|
|
|
grub_file_filter_id_t filter;
|
|
|
|
|
|
|
|
+ grub_dprintf ("file", "Opening `%s' ...\n", name);
|
|
|
|
+
|
2023-02-15 16:54:38 +00:00
|
|
|
/* Reset grub_errno before we start */
|
|
|
|
grub_errno = GRUB_ERR_NONE;
|
|
|
|
|
|
|
|
@@ -131,6 +133,8 @@ grub_file_open (const char *name, enum grub_file_type type)
|
2021-01-12 16:38:06 +00:00
|
|
|
if (!file)
|
|
|
|
grub_file_close (last_file);
|
|
|
|
|
|
|
|
+ grub_dprintf ("file", "Opening `%s' succeeded.\n", name);
|
|
|
|
+
|
|
|
|
return file;
|
|
|
|
|
|
|
|
fail:
|
2023-02-15 16:54:38 +00:00
|
|
|
@@ -141,6 +145,8 @@ grub_file_open (const char *name, enum grub_file_type type)
|
2021-01-12 16:38:06 +00:00
|
|
|
|
|
|
|
grub_free (file);
|
|
|
|
|
|
|
|
+ grub_dprintf ("file", "Opening `%s' failed.\n", name);
|
|
|
|
+
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-02-15 16:54:38 +00:00
|
|
|
@@ -172,6 +178,7 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len)
|
2021-01-12 16:38:06 +00:00
|
|
|
|
|
|
|
if (len == 0)
|
|
|
|
return 0;
|
|
|
|
+
|
|
|
|
read_hook = file->read_hook;
|
|
|
|
read_hook_data = file->read_hook_data;
|
|
|
|
if (!file->read_hook)
|
2023-02-15 16:54:38 +00:00
|
|
|
@@ -192,11 +199,18 @@ grub_file_read (grub_file_t file, void *buf, grub_size_t len)
|
2021-01-12 16:38:06 +00:00
|
|
|
grub_err_t
|
|
|
|
grub_file_close (grub_file_t file)
|
|
|
|
{
|
|
|
|
+ grub_dprintf ("file", "Closing `%s' ...\n", file->name);
|
|
|
|
if (file->fs->fs_close)
|
|
|
|
(file->fs->fs_close) (file);
|
|
|
|
|
|
|
|
if (file->device)
|
|
|
|
grub_device_close (file->device);
|
|
|
|
+
|
|
|
|
+ if (grub_errno == GRUB_ERR_NONE)
|
|
|
|
+ grub_dprintf ("file", "Closing `%s' succeeded.\n", file->name);
|
|
|
|
+ else
|
|
|
|
+ grub_dprintf ("file", "Closing `%s' failed with %d.\n", file->name, grub_errno);
|
|
|
|
+
|
|
|
|
grub_free (file->name);
|
|
|
|
grub_free (file);
|
|
|
|
return grub_errno;
|