]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
ofdisk: Exclude floppies from scanning.
authorVladimir Serbinenko <phcoder@gmail.com>
Sat, 21 Feb 2015 15:16:48 +0000 (16:16 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Sat, 21 Feb 2015 15:16:48 +0000 (16:16 +0100)
It causes similar hang as CD on at least the qemu.

grub-core/disk/ieee1275/ofdisk.c

index 6870b39587de2ef31d26ab6f6f16818b86f54347..5d886378238e6ebada5ef6a890acd73a4d140ef2 100644 (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))