2009-06-08 Vladimir Serbinenko <phcoder@gmail.com>

Not fail if unable to retrieve C/H/S on LBA disks

	* disk/i386/pc/biosdisk.c (grub_biosdisk_open): behave gracefully 
	if unable to retrieve C/H/S on LBA disks
This commit is contained in:
phcoder 2009-06-08 13:29:05 +00:00
parent b57ea2c975
commit de65ee2b2c
2 changed files with 21 additions and 2 deletions

View file

@ -1,3 +1,10 @@
2009-06-08 Vladimir Serbinenko <phcoder@gmail.com>
Not fail if unable to retrieve C/H/S on LBA disks
* disk/i386/pc/biosdisk.c (grub_biosdisk_open): behave gracefully
if unable to retrieve C/H/S on LBA disks
2009-06-08 Pavel Roskin <proski@gnu.org>
* fs/hfs.c (grub_hfs_find_dir): Use union to avoid a warning

View file

@ -157,10 +157,22 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)
&data->cylinders,
&data->heads,
&data->sectors) != 0)
{
if (total_sectors && (data->flags & GRUB_BIOSDISK_FLAG_LBA))
{
data->sectors = 63;
data->heads = 255;
data->cylinders
= grub_divmod64 (total_sectors
+ data->heads * data->sectors - 1,
data->heads * data->sectors, 0);
}
else
{
grub_free (data);
return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get C/H/S values");
}
}
if (! total_sectors)
total_sectors = data->cylinders * data->heads * data->sectors;