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

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