3efed6
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
3efed6
From: Daniel Axtens <dja@axtens.net>
3efed6
Date: Tue, 12 May 2020 17:26:26 +1000
3efed6
Subject: [PATCH] rhel: extra file type fixes
3efed6
3efed6
Signed-off-by: Daniel Axtens <dja@axtens.net>
3efed6
[javierm: fix a couple of build errors caused by mismerges]
3efed6
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
3efed6
---
3efed6
 grub-core/commands/blscfg.c         | 2 +-
3efed6
 grub-core/loader/arm64/linux.c      | 1 +
3efed6
 grub-core/loader/i386/efi/linux.c   | 9 +++++----
3efed6
 grub-core/net/net.c                 | 2 +-
3efed6
 grub-core/normal/main.c             | 2 +-
3efed6
 grub-core/osdep/generic/blocklist.c | 4 ++--
3efed6
 6 files changed, 11 insertions(+), 9 deletions(-)
3efed6
3efed6
diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
b71686
index 70ce5c7bf..795a9f9f1 100644
3efed6
--- a/grub-core/commands/blscfg.c
3efed6
+++ b/grub-core/commands/blscfg.c
3efed6
@@ -463,7 +463,7 @@ static int read_entry (
3efed6
 
3efed6
   p = grub_xasprintf ("(%s)%s/%s", info->devid, info->dirname, filename);
3efed6
 
3efed6
-  f = grub_file_open (p);
3efed6
+  f = grub_file_open (p, GRUB_FILE_TYPE_CONFIG);
3efed6
   if (!f)
3efed6
     goto finish;
3efed6
 
3efed6
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
b71686
index 864724dd4..e1923cf72 100644
3efed6
--- a/grub-core/loader/arm64/linux.c
3efed6
+++ b/grub-core/loader/arm64/linux.c
3efed6
@@ -31,6 +31,7 @@
3efed6
 #include <grub/efi/memory.h>
3efed6
 #include <grub/efi/linux.h>
3efed6
 #include <grub/efi/pe32.h>
3efed6
+#include <grub/efi/sb.h>
3efed6
 #include <grub/i18n.h>
3efed6
 #include <grub/lib/cmdline.h>
3efed6
 #include <grub/verify.h>
3efed6
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
b71686
index 361e503cb..576f8c07e 100644
3efed6
--- a/grub-core/loader/i386/efi/linux.c
3efed6
+++ b/grub-core/loader/i386/efi/linux.c
3efed6
@@ -101,8 +101,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
3efed6
 
3efed6
   for (i = 0; i < argc; i++)
3efed6
     {
3efed6
-      grub_file_filter_disable_compression ();
3efed6
-      files[i] = grub_file_open (argv[i]);
3efed6
+      files[i] = grub_file_open (argv[i], GRUB_FILE_TYPE_LINUX_INITRD |
3efed6
+				 GRUB_FILE_TYPE_NO_DECOMPRESS);
3efed6
       if (! files[i])
3efed6
         goto fail;
3efed6
       nfiles++;
3efed6
@@ -182,7 +182,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
3efed6
       goto fail;
3efed6
     }
3efed6
 
3efed6
-  file = grub_file_open (argv[0]);
3efed6
+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
3efed6
   if (! file)
3efed6
     goto fail;
3efed6
 
3efed6
@@ -302,7 +302,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
3efed6
   grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
3efed6
   grub_create_loader_cmdline (argc, argv,
3efed6
                               linux_cmdline + sizeof (LINUX_IMAGE) - 1,
3efed6
-			      lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1));
3efed6
+			      lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1),
3efed6
+			      GRUB_VERIFY_KERNEL_CMDLINE);
3efed6
 
3efed6
   grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline);
3efed6
   grub_dprintf ("linux", "setting lh->cmd_line_ptr\n");
3efed6
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
b71686
index 0e72bbb9b..1fd104aea 100644
3efed6
--- a/grub-core/net/net.c
3efed6
+++ b/grub-core/net/net.c
3efed6
@@ -1907,7 +1907,7 @@ grub_net_search_configfile (char *config)
3efed6
 	  grub_dprintf ("net", "probe %s\n", config);
3efed6
 
3efed6
           grub_file_t file;
3efed6
-          file = grub_file_open (config);
3efed6
+          file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG);
3efed6
 
3efed6
           if (file)
3efed6
             {
3efed6
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
b71686
index cee71a4c2..49141039f 100644
3efed6
--- a/grub-core/normal/main.c
3efed6
+++ b/grub-core/normal/main.c
3efed6
@@ -363,7 +363,7 @@ grub_try_normal (const char *variable)
3efed6
 	if (config)
3efed6
 	  {
3efed6
 	    grub_file_t file;
3efed6
-	    file = grub_file_open (config);
3efed6
+	    file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG);
3efed6
 	    if (file)
3efed6
 	      {
3efed6
 		grub_file_close (file);
3efed6
diff --git a/grub-core/osdep/generic/blocklist.c b/grub-core/osdep/generic/blocklist.c
b71686
index 74024fd06..ab1f96da6 100644
3efed6
--- a/grub-core/osdep/generic/blocklist.c
3efed6
+++ b/grub-core/osdep/generic/blocklist.c
3efed6
@@ -60,7 +60,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
3efed6
       grub_disk_cache_invalidate_all ();
3efed6
 
3efed6
       grub_file_filter_disable_compression ();
3efed6
-      file = grub_file_open (core_path_dev);
3efed6
+      file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE);
3efed6
       if (file)
3efed6
 	{
3efed6
 	  if (grub_file_size (file) != core_size)
3efed6
@@ -118,7 +118,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
3efed6
   grub_file_t file;
3efed6
   /* Now read the core image to determine where the sectors are.  */
3efed6
   grub_file_filter_disable_compression ();
3efed6
-  file = grub_file_open (core_path_dev);
3efed6
+  file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE);
3efed6
   if (! file)
3efed6
     grub_util_error ("%s", grub_errmsg);
3efed6