Blame SOURCES/0014-Make-a-way-to-say-e-3-isn-t-viable-for-a-kind-of-dev.patch

5e6fc3
From ca71ba77abee7cea805e71a7faded706d19e4c58 Mon Sep 17 00:00:00 2001
5e6fc3
From: Peter Jones <pjones@redhat.com>
5e6fc3
Date: Wed, 20 Jun 2018 16:16:00 -0400
5e6fc3
Subject: [PATCH 14/39] Make a way to say "-e 3" isn't viable for a kind of
5e6fc3
 device.
5e6fc3
5e6fc3
Signed-off-by: Peter Jones <pjones@redhat.com>
5e6fc3
---
5e6fc3
 src/creator.c | 7 +++++++
5e6fc3
 src/linux.c   | 5 ++++-
5e6fc3
 src/linux.h   | 2 ++
5e6fc3
 3 files changed, 13 insertions(+), 1 deletion(-)
5e6fc3
5e6fc3
diff --git a/src/creator.c b/src/creator.c
5e6fc3
index 76c1c1f7a99..55b411ee3da 100644
5e6fc3
--- a/src/creator.c
5e6fc3
+++ b/src/creator.c
5e6fc3
@@ -243,6 +243,13 @@ efi_va_generate_file_device_path_from_esp(uint8_t *buf, ssize_t size,
5e6fc3
 		va_end(aq);
5e6fc3
 	}
5e6fc3
 
5e6fc3
+        if (!(options & (EFIBOOT_ABBREV_FILE|EFIBOOT_ABBREV_HD)) &&
5e6fc3
+            (dev->flags & DEV_ABBREV_ONLY)) {
5e6fc3
+                errno = EINVAL;
5e6fc3
+                efi_error("Device must use File() or HD() device path");
5e6fc3
+                goto err;
5e6fc3
+        }
5e6fc3
+
5e6fc3
 	if ((options & EFIBOOT_ABBREV_EDD10)
5e6fc3
 			&& (!(options & EFIBOOT_ABBREV_FILE)
5e6fc3
 			    && !(options & EFIBOOT_ABBREV_HD))) {
5e6fc3
diff --git a/src/linux.c b/src/linux.c
5e6fc3
index 436fb882a98..83adc510944 100644
5e6fc3
--- a/src/linux.c
5e6fc3
+++ b/src/linux.c
5e6fc3
@@ -448,8 +448,11 @@ struct device HIDDEN
5e6fc3
                         continue;
5e6fc3
                 }
5e6fc3
                 debug(DEBUG, "%s matched %s", probe->name, current);
5e6fc3
+                dev->flags |= probe->flags;
5e6fc3
 
5e6fc3
-                if (probe->flags & DEV_PROVIDES_HD || probe->flags & DEV_PROVIDES_ROOT)
5e6fc3
+                if (probe->flags & DEV_PROVIDES_HD ||
5e6fc3
+                    probe->flags & DEV_PROVIDES_ROOT ||
5e6fc3
+                    probe->flags & DEV_ABBREV_ONLY)
5e6fc3
                         needs_root = false;
5e6fc3
                 dev->probes[n++] = dev_probes[i];
5e6fc3
                 current += pos;
5e6fc3
diff --git a/src/linux.h b/src/linux.h
5e6fc3
index 7b18bda31c6..ef7dba769bd 100644
5e6fc3
--- a/src/linux.h
5e6fc3
+++ b/src/linux.h
5e6fc3
@@ -106,6 +106,7 @@ struct dev_probe;
5e6fc3
 
5e6fc3
 struct device {
5e6fc3
         enum interface_type interface_type;
5e6fc3
+        uint32_t flags;
5e6fc3
         char *link;
5e6fc3
         char *device;
5e6fc3
         char *driver;
5e6fc3
@@ -246,6 +247,7 @@ extern ssize_t HIDDEN make_mac_path(uint8_t *buf, ssize_t size,
5e6fc3
 
5e6fc3
 #define DEV_PROVIDES_ROOT       1
5e6fc3
 #define DEV_PROVIDES_HD         2
5e6fc3
+#define DEV_ABBREV_ONLY         4
5e6fc3
 
5e6fc3
 struct dev_probe {
5e6fc3
         char *name;
5e6fc3
-- 
5e6fc3
2.17.1
5e6fc3