Skip to content

Commit

Permalink
Make debug=file show which file filters get run.
Browse files Browse the repository at this point in the history
If one of the file filters breaks things, it's hard to figure out where
it has happened.

This makes grub log which filter is being run, which makes it easier to
figure out where you are in the sequence of events.

Signed-off-by: Peter Jones <[email protected]>
  • Loading branch information
vathpela committed Jul 29, 2022
1 parent 0298109 commit d3d6518
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions grub-core/kern/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ void (*EXPORT_VAR (grub_grubnet_fini)) (void);

grub_file_filter_t grub_file_filters[GRUB_FILE_FILTER_MAX];

static char *filter_names[] = {
[GRUB_FILE_FILTER_VERIFY] = "GRUB_FILE_FILTER_VERIFY",
[GRUB_FILE_FILTER_GZIO] = "GRUB_FILE_FILTER_GZIO",
[GRUB_FILE_FILTER_XZIO] = "GRUB_FILE_FILTER_XZIO",
[GRUB_FILE_FILTER_LZOPIO] = "GRUB_FILE_FILTER_LZOPIO",
[GRUB_FILE_FILTER_MAX] = "GRUB_FILE_FILTER_MAX"
};

/* Get the device part of the filename NAME. It is enclosed by parentheses. */
char *
grub_file_get_device_name (const char *name)
Expand Down Expand Up @@ -121,6 +129,9 @@ grub_file_open (const char *name, enum grub_file_type type)
if (grub_file_filters[filter])
{
last_file = file;
if (filter < GRUB_FILE_FILTER_MAX)
grub_dprintf ("file", "Running %s file filter\n",
filter_names[filter]);
file = grub_file_filters[filter] (file, type);
if (file && file != last_file)
{
Expand Down

0 comments on commit d3d6518

Please sign in to comment.