OSDN Git Service

Make a way to say "-e 3" isn't viable for a kind of device.
authorPeter Jones <pjones@redhat.com>
Wed, 20 Jun 2018 20:16:00 +0000 (16:16 -0400)
committerPeter Jones <pjones@redhat.com>
Wed, 20 Jun 2018 21:23:22 +0000 (17:23 -0400)
Signed-off-by: Peter Jones <pjones@redhat.com>
src/creator.c
src/linux.c
src/linux.h

index 76c1c1f..55b411e 100644 (file)
@@ -243,6 +243,13 @@ efi_va_generate_file_device_path_from_esp(uint8_t *buf, ssize_t size,
                va_end(aq);
        }
 
+        if (!(options & (EFIBOOT_ABBREV_FILE|EFIBOOT_ABBREV_HD)) &&
+            (dev->flags & DEV_ABBREV_ONLY)) {
+                errno = EINVAL;
+                efi_error("Device must use File() or HD() device path");
+                goto err;
+        }
+
        if ((options & EFIBOOT_ABBREV_EDD10)
                        && (!(options & EFIBOOT_ABBREV_FILE)
                            && !(options & EFIBOOT_ABBREV_HD))) {
index 436fb88..83adc51 100644 (file)
@@ -448,8 +448,11 @@ struct device HIDDEN
                         continue;
                 }
                 debug(DEBUG, "%s matched %s", probe->name, current);
+                dev->flags |= probe->flags;
 
-                if (probe->flags & DEV_PROVIDES_HD || probe->flags & DEV_PROVIDES_ROOT)
+                if (probe->flags & DEV_PROVIDES_HD ||
+                    probe->flags & DEV_PROVIDES_ROOT ||
+                    probe->flags & DEV_ABBREV_ONLY)
                         needs_root = false;
                 dev->probes[n++] = dev_probes[i];
                 current += pos;
index 7b18bda..ef7dba7 100644 (file)
@@ -106,6 +106,7 @@ struct dev_probe;
 
 struct device {
         enum interface_type interface_type;
+        uint32_t flags;
         char *link;
         char *device;
         char *driver;
@@ -246,6 +247,7 @@ extern ssize_t HIDDEN make_mac_path(uint8_t *buf, ssize_t size,
 
 #define DEV_PROVIDES_ROOT       1
 #define DEV_PROVIDES_HD         2
+#define DEV_ABBREV_ONLY         4
 
 struct dev_probe {
         char *name;