ofdisk: Exclude floppies from scanning.

It causes similar hang as CD on at least the qemu.
This commit is contained in:
Vladimir Serbinenko 2015-02-21 16:16:48 +01:00
parent ef7c843b44
commit 967e5aa591

View file

@ -34,7 +34,7 @@ struct ofdisk_hash_ent
char *open_path;
char *grub_devpath;
int is_boot;
int is_cdrom;
int is_removable;
/* Pointer to shortest available name on nodes representing canonical names,
otherwise NULL. */
const char *shortest;
@ -123,7 +123,7 @@ ofdisk_hash_add_real (char *devpath)
}
static int
check_string_cdrom (const char *str)
check_string_removable (const char *str)
{
const char *ptr = grub_strrchr (str, '/');
@ -131,7 +131,7 @@ check_string_cdrom (const char *str)
ptr++;
else
ptr = str;
return (grub_strncmp (ptr, "cdrom", 5) == 0);
return (grub_strncmp (ptr, "cdrom", 5) == 0 || grub_strncmp (ptr, "fd", 2) == 0);
}
static struct ofdisk_hash_ent *
@ -147,8 +147,8 @@ ofdisk_hash_add (char *devpath, char *curcan)
{
p->shortest = p->devpath;
p->grub_shortest = p->grub_devpath;
if (check_string_cdrom (devpath))
p->is_cdrom = 1;
if (check_string_removable (devpath))
p->is_removable = 1;
return p;
}
@ -158,8 +158,8 @@ ofdisk_hash_add (char *devpath, char *curcan)
else
grub_free (curcan);
if (check_string_cdrom (devpath) || check_string_cdrom (curcan))
pcan->is_cdrom = 1;
if (check_string_removable (devpath) || check_string_removable (curcan))
pcan->is_removable = 1;
if (!pcan)
grub_errno = GRUB_ERR_NONE;
@ -330,7 +330,7 @@ grub_ofdisk_iterate (grub_disk_dev_iterate_hook_t hook, void *hook_data,
}
}
if (!ent->is_boot && ent->is_cdrom)
if (!ent->is_boot && ent->is_removable)
continue;
if (hook (ent->grub_shortest, hook_data))