Blob Blame History Raw
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Daniel Axtens <dja@axtens.net>
Date: Tue, 12 May 2020 17:26:26 +1000
Subject: [PATCH] rhel: extra file type fixes

Signed-off-by: Daniel Axtens <dja@axtens.net>
[javierm: fix a couple of build errors caused by mismerges]
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
 grub-core/commands/blscfg.c         | 2 +-
 grub-core/loader/arm64/linux.c      | 1 +
 grub-core/loader/i386/efi/linux.c   | 9 +++++----
 grub-core/net/net.c                 | 2 +-
 grub-core/normal/main.c             | 2 +-
 grub-core/osdep/generic/blocklist.c | 4 ++--
 6 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/grub-core/commands/blscfg.c b/grub-core/commands/blscfg.c
index 70ce5c7bf6f..795a9f9f178 100644
--- a/grub-core/commands/blscfg.c
+++ b/grub-core/commands/blscfg.c
@@ -463,7 +463,7 @@ static int read_entry (
 
   p = grub_xasprintf ("(%s)%s/%s", info->devid, info->dirname, filename);
 
-  f = grub_file_open (p);
+  f = grub_file_open (p, GRUB_FILE_TYPE_CONFIG);
   if (!f)
     goto finish;
 
diff --git a/grub-core/loader/arm64/linux.c b/grub-core/loader/arm64/linux.c
index 864724dd4fa..e1923cf7257 100644
--- a/grub-core/loader/arm64/linux.c
+++ b/grub-core/loader/arm64/linux.c
@@ -31,6 +31,7 @@
 #include <grub/efi/memory.h>
 #include <grub/efi/linux.h>
 #include <grub/efi/pe32.h>
+#include <grub/efi/sb.h>
 #include <grub/i18n.h>
 #include <grub/lib/cmdline.h>
 #include <grub/verify.h>
diff --git a/grub-core/loader/i386/efi/linux.c b/grub-core/loader/i386/efi/linux.c
index 361e503cb52..576f8c07eaf 100644
--- a/grub-core/loader/i386/efi/linux.c
+++ b/grub-core/loader/i386/efi/linux.c
@@ -101,8 +101,8 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
 
   for (i = 0; i < argc; i++)
     {
-      grub_file_filter_disable_compression ();
-      files[i] = grub_file_open (argv[i]);
+      files[i] = grub_file_open (argv[i], GRUB_FILE_TYPE_LINUX_INITRD |
+				 GRUB_FILE_TYPE_NO_DECOMPRESS);
       if (! files[i])
         goto fail;
       nfiles++;
@@ -182,7 +182,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
       goto fail;
     }
 
-  file = grub_file_open (argv[0]);
+  file = grub_file_open (argv[0], GRUB_FILE_TYPE_LINUX_KERNEL);
   if (! file)
     goto fail;
 
@@ -302,7 +302,8 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
   grub_memcpy (linux_cmdline, LINUX_IMAGE, sizeof (LINUX_IMAGE));
   grub_create_loader_cmdline (argc, argv,
                               linux_cmdline + sizeof (LINUX_IMAGE) - 1,
-			      lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1));
+			      lh->cmdline_size - (sizeof (LINUX_IMAGE) - 1),
+			      GRUB_VERIFY_KERNEL_CMDLINE);
 
   grub_dprintf ("linux", "cmdline:%s\n", linux_cmdline);
   grub_dprintf ("linux", "setting lh->cmd_line_ptr\n");
diff --git a/grub-core/net/net.c b/grub-core/net/net.c
index 0e72bbb9b39..1fd104aeaf2 100644
--- a/grub-core/net/net.c
+++ b/grub-core/net/net.c
@@ -1907,7 +1907,7 @@ grub_net_search_configfile (char *config)
 	  grub_dprintf ("net", "probe %s\n", config);
 
           grub_file_t file;
-          file = grub_file_open (config);
+          file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG);
 
           if (file)
             {
diff --git a/grub-core/normal/main.c b/grub-core/normal/main.c
index cee71a4c2ab..49141039f8f 100644
--- a/grub-core/normal/main.c
+++ b/grub-core/normal/main.c
@@ -363,7 +363,7 @@ grub_try_normal (const char *variable)
 	if (config)
 	  {
 	    grub_file_t file;
-	    file = grub_file_open (config);
+	    file = grub_file_open (config, GRUB_FILE_TYPE_CONFIG);
 	    if (file)
 	      {
 		grub_file_close (file);
diff --git a/grub-core/osdep/generic/blocklist.c b/grub-core/osdep/generic/blocklist.c
index 74024fd06f3..ab1f96da62d 100644
--- a/grub-core/osdep/generic/blocklist.c
+++ b/grub-core/osdep/generic/blocklist.c
@@ -60,7 +60,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
       grub_disk_cache_invalidate_all ();
 
       grub_file_filter_disable_compression ();
-      file = grub_file_open (core_path_dev);
+      file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE);
       if (file)
 	{
 	  if (grub_file_size (file) != core_size)
@@ -118,7 +118,7 @@ grub_install_get_blocklist (grub_device_t root_dev,
   grub_file_t file;
   /* Now read the core image to determine where the sectors are.  */
   grub_file_filter_disable_compression ();
-  file = grub_file_open (core_path_dev);
+  file = grub_file_open (core_path_dev, GRUB_FILE_TYPE_NONE);
   if (! file)
     grub_util_error ("%s", grub_errmsg);