]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* util/hostdisk.c (device_is_wholedisk): New function.
authordavem <davem@localhost>
Thu, 30 Apr 2009 13:23:48 +0000 (13:23 +0000)
committerdavem <davem@localhost>
Thu, 30 Apr 2009 13:23:48 +0000 (13:23 +0000)
(grub_util_biosdisk_get_grub_dev): Shortcut when hdg.start is
zero only if device_is_wholedisk() returns true.

ChangeLog
util/hostdisk.c

index d0df5dc686d7cbac444876833cafb181449a0f34..9097f250fdc64ace2529b4dcd74ea7e93c27913b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-04-30  David S. Miller  <davem@davemloft.net>
 
+       * util/hostdisk.c (device_is_wholedisk): New function.
+       (grub_util_biosdisk_get_grub_dev): Shortcut when hdg.start is
+       zero only if device_is_wholedisk() returns true.
+
        * util/hostdisk.c (convert_system_partition_to_system_disk):
        Handle virtual disk devices named /dev/vdiskX as found on sparc
        and powerpc.
index af93f97591ab7188dbc2968099c298e873259edb..eaccb73dc6cd66de53408d1445f526e19bf95590 100644 (file)
@@ -833,6 +833,16 @@ convert_system_partition_to_system_disk (const char *os_dev)
 #endif
 }
 
+static int
+device_is_wholedisk (const char *os_dev)
+{
+  int len = strlen (os_dev);
+
+  if (os_dev[len - 1] < '0' || os_dev[len - 1] > '9')
+    return 1;
+  return 0;
+}
+
 static int
 find_system_device (const char *os_dev)
 {
@@ -968,7 +978,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
 
     grub_util_info ("%s starts from %lu", os_dev, hdg.start);
     
-    if (hdg.start == 0)
+    if (hdg.start == 0 && device_is_wholedisk (os_dev))
       return name;
 
     grub_util_info ("opening the device %s", name);