(grub_util_biosdisk_get_grub_dev): Shortcut when hdg.start is
zero only if device_is_wholedisk() returns true.
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.
#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)
{
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);