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

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