* 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.
This commit is contained in:
davem 2009-04-30 13:23:48 +00:00
parent 6966215ddb
commit ad22a610fe
2 changed files with 15 additions and 1 deletions

View file

@ -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.

View 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);