From: Vladimir Serbinenko Date: Mon, 23 Dec 2013 23:05:22 +0000 (+0100) Subject: Skip apple ghosts X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2f1fd54c383cac307c8043fc4b7f46ff84c1d6d4;p=thirdparty%2Fgrub.git Skip apple ghosts --- diff --git a/grub-core/disk/efi/efidisk.c b/grub-core/disk/efi/efidisk.c index 4a2811c59..4189b087b 100644 --- a/grub-core/disk/efi/efidisk.c +++ b/grub-core/disk/efi/efidisk.c @@ -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) diff --git a/grub-core/loader/efi/appleloader.c b/grub-core/loader/efi/appleloader.c index 3777c7f0b..74888c463 100644 --- a/grub-core/loader/efi/appleloader.c +++ b/grub-core/loader/efi/appleloader.c @@ -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 = \ { \ diff --git a/include/grub/efi/api.h b/include/grub/efi/api.h index a0dfec72e..ad0f0ec71 100644 --- a/include/grub/efi/api.h +++ b/include/grub/efi/api.h @@ -280,6 +280,12 @@ { 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