[2154] * util/hostdisk.c (device_is_wholedisk): New function.

"David S. Miller" <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2154
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2154
Author:   davem
Date:     2009-04-30 13:23:48 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
	* 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.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/util/hostdisk.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-04-30 13:21:14 UTC (rev 2153)
+++ trunk/grub2/ChangeLog	2009-04-30 13:23:48 UTC (rev 2154)
@@ -1,5 +1,9 @@
 2009-04-30  David S. Miller  <[email protected]>
 
+	* 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.

Modified: trunk/grub2/util/hostdisk.c
===================================================================
--- trunk/grub2/util/hostdisk.c	2009-04-30 13:21:14 UTC (rev 2153)
+++ trunk/grub2/util/hostdisk.c	2009-04-30 13:23:48 UTC (rev 2154)
@@ -834,6 +834,16 @@
 }
 
 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)
 {
   int i;
@@ -968,7 +978,7 @@
 
     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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.