Blame SOURCES/0279-Make-debug-file-show-which-file-filters-get-run.patch

d3c3ab
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
d3c3ab
From: Peter Jones <pjones@redhat.com>
d3c3ab
Date: Fri, 29 Jul 2022 15:56:00 -0400
d3c3ab
Subject: [PATCH] Make debug=file show which file filters get run.
d3c3ab
d3c3ab
If one of the file filters breaks things, it's hard to figure out where
d3c3ab
it has happened.
d3c3ab
d3c3ab
This makes grub log which filter is being run, which makes it easier to
d3c3ab
figure out where you are in the sequence of events.
d3c3ab
d3c3ab
Signed-off-by: Peter Jones <pjones@redhat.com>
d3c3ab
(cherry picked from commit d3d6518a13b5440a3be6c66b0ae47447182f2891)
d3c3ab
---
d3c3ab
 grub-core/kern/file.c | 11 +++++++++++
d3c3ab
 1 file changed, 11 insertions(+)
d3c3ab
d3c3ab
diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c
d3c3ab
index ed69fc0f0f..3f175630ea 100644
d3c3ab
--- a/grub-core/kern/file.c
d3c3ab
+++ b/grub-core/kern/file.c
d3c3ab
@@ -30,6 +30,14 @@ void (*EXPORT_VAR (grub_grubnet_fini)) (void);
d3c3ab
 
d3c3ab
 grub_file_filter_t grub_file_filters[GRUB_FILE_FILTER_MAX];
d3c3ab
 
d3c3ab
+static char *filter_names[] = {
d3c3ab
+    [GRUB_FILE_FILTER_VERIFY] = "GRUB_FILE_FILTER_VERIFY",
d3c3ab
+    [GRUB_FILE_FILTER_GZIO] = "GRUB_FILE_FILTER_GZIO",
d3c3ab
+    [GRUB_FILE_FILTER_XZIO] = "GRUB_FILE_FILTER_XZIO",
d3c3ab
+    [GRUB_FILE_FILTER_LZOPIO] = "GRUB_FILE_FILTER_LZOPIO",
d3c3ab
+    [GRUB_FILE_FILTER_MAX] = "GRUB_FILE_FILTER_MAX"
d3c3ab
+};
d3c3ab
+
d3c3ab
 /* Get the device part of the filename NAME. It is enclosed by parentheses.  */
d3c3ab
 char *
d3c3ab
 grub_file_get_device_name (const char *name)
d3c3ab
@@ -121,6 +129,9 @@ grub_file_open (const char *name, enum grub_file_type type)
d3c3ab
     if (grub_file_filters[filter])
d3c3ab
       {
d3c3ab
 	last_file = file;
d3c3ab
+	if (filter < GRUB_FILE_FILTER_MAX)
d3c3ab
+	  grub_dprintf ("file", "Running %s file filter\n",
d3c3ab
+			filter_names[filter]);
d3c3ab
 	file = grub_file_filters[filter] (file, type);
d3c3ab
 	if (file && file != last_file)
d3c3ab
 	  {