]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Skip apple ghosts
authorVladimir Serbinenko <phcoder@gmail.com>
Mon, 23 Dec 2013 23:05:22 +0000 (00:05 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Mon, 23 Dec 2013 23:05:22 +0000 (00:05 +0100)
grub-core/disk/efi/efidisk.c
grub-core/loader/efi/appleloader.c
include/grub/efi/api.h

index 4a2811c59b0ff6f6ed26655d0ade5e982617a96a..4189b087bbc02a02480c16206840f5be1fb9073a 100644 (file)
@@ -333,6 +333,21 @@ name_devices (struct grub_efidisk_data *devices)
       if (! dp)
        continue;
 
+      /* Ghosts proudly presented by Apple.  */
+      if (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE
+         && GRUB_EFI_DEVICE_PATH_SUBTYPE (dp)
+         == GRUB_EFI_VENDOR_MEDIA_DEVICE_PATH_SUBTYPE)
+       {
+         grub_efi_vendor_device_path_t *vendor = (grub_efi_vendor_device_path_t *) dp;
+         const struct grub_efi_guid apple = GRUB_EFI_VENDOR_APPLE_GUID;
+
+         if (vendor->header.length == sizeof (*vendor)
+             && grub_memcmp (&vendor->vendor_guid, &apple,
+                             sizeof (vendor->vendor_guid)) == 0
+             && find_parent_device (devices, d))
+           continue;
+       }
+
       m = d->block_io->media;
       if (GRUB_EFI_DEVICE_PATH_TYPE (dp) == GRUB_EFI_ACPI_DEVICE_PATH_TYPE
          && GRUB_EFI_DEVICE_PATH_SUBTYPE (dp)
index 3777c7f0b2c6c2b1e0df382101530bca23c385a0..74888c463badded765411ed69c655ac9b9b1dfa9 100644 (file)
@@ -89,8 +89,7 @@ struct piwg_full_device_path
          .subtype = GRUB_EFI_PIWG_DEVICE_PATH_SUBTYPE,                 \
          .length = sizeof (struct grub_efi_piwg_device_path)           \
        },                                                              \
-       .guid = {0x2B0585EB, 0xD8B8, 0x49A9, {0x8B, 0x8C, 0xE2, 0x1B,   \
-                                             0x01, 0xAE, 0xF2, 0xB7}}  \
+       .guid = GRUB_EFI_VENDOR_APPLE_GUID                              \
       },                                                               \
        .end =                                                          \
          {                                                             \
index a0dfec72ea17b9ddc794cabc30c12b4ce39cb09d..ad0f0ec710529a496423ecabc86c458fa5acd30d 100644 (file)
   { 0xb1b621d5, 0xf19c, 0x41a5, \
       { 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } \
   }
+
+#define GRUB_EFI_VENDOR_APPLE_GUID \
+  { 0x2B0585EB, 0xD8B8, 0x49A9,        \
+      { 0x8B, 0x8C, 0xE2, 0x1B, 0x01, 0xAE, 0xF2, 0xB7 } \
+  }
+
 struct grub_efi_sal_system_table
 {
   grub_uint32_t signature;
@@ -815,14 +821,6 @@ typedef struct grub_efi_uart_device_path grub_efi_uart_device_path_t;
 
 #define GRUB_EFI_VENDOR_MESSAGING_DEVICE_PATH_SUBTYPE  10
 
-struct grub_efi_vendor_messaging_device_path
-{
-  grub_efi_device_path_t header;
-  grub_efi_packed_guid_t vendor_guid;
-  grub_efi_uint8_t vendor_defined_data[0];
-} GRUB_PACKED;
-typedef struct grub_efi_vendor_messaging_device_path grub_efi_vendor_messaging_device_path_t;
-
 /* Media Device Path.  */
 #define GRUB_EFI_MEDIA_DEVICE_PATH_TYPE                        4