* grub-core/disk/efi/efidisk.c (grub_efidisk_get_device_name):

Handle CD-ROMs.
This commit is contained in:
Andrey Borzenkov 2013-10-14 17:06:39 +02:00 committed by Vladimir 'phcoder' Serbinenko
parent 6de9ee86bf
commit 44016e527a
2 changed files with 75 additions and 62 deletions

View file

@ -1,3 +1,8 @@
2013-10-14 Andrey Borzenkov <arvidjaar@gmail.com>
* grub-core/disk/efi/efidisk.c (grub_efidisk_get_device_name):
Handle CD-ROMs.
2013-10-14 Vladimir Serbinenko <phcoder@gmail.com> 2013-10-14 Vladimir Serbinenko <phcoder@gmail.com>
Pass-through unknown E820 types. It required reorganisation of mmap Pass-through unknown E820 types. It required reorganisation of mmap

View file

@ -799,9 +799,16 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
if (! ldp) if (! ldp)
return 0; return 0;
if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE if (GRUB_EFI_DEVICE_PATH_TYPE (ldp) == GRUB_EFI_MEDIA_DEVICE_PATH_TYPE)
&& (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp) {
== GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE)) int is_cdrom = 0;
switch (GRUB_EFI_DEVICE_PATH_SUBTYPE (ldp))
{
case GRUB_EFI_CDROM_DEVICE_PATH_SUBTYPE:
is_cdrom = 1;
/* Intentionally fall through */
case GRUB_EFI_HARD_DRIVE_DEVICE_PATH_SUBTYPE:
{ {
struct grub_efidisk_get_device_name_ctx ctx; struct grub_efidisk_get_device_name_ctx ctx;
char *dev_name; char *dev_name;
@ -849,6 +856,8 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
if (! ctx.partition_name) if (! ctx.partition_name)
{ {
grub_disk_close (parent); grub_disk_close (parent);
if (is_cdrom)
return grub_strdup (device_name);
return 0; return 0;
} }
@ -860,11 +869,10 @@ grub_efidisk_get_device_name (grub_efi_handle_t *handle)
return dev_name; return dev_name;
} }
else }
{ }
/* This should be an entire disk. */ /* This may be guessed device - floppy, cdrom or entire disk. */
if (!get_diskname_from_path (dp, device_name)) if (!get_diskname_from_path (dp, device_name))
return 0; return 0;
return grub_strdup (device_name); return grub_strdup (device_name);
}
} }