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

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