[2275] 2009-06-08 Vladimir Serbinenko <[email protected]>

Vladimir Serbinenko <[email protected]>
Newsgroups gmane.comp.boot-loaders.grub.cvs
Message-ID <[email protected]>
Revision: 2275
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=2275
Author:   phcoder
Date:     2009-06-08 13:29:05 +0000 (Mon, 08 Jun 2009)
Log Message:
-----------
2009-06-08  Vladimir Serbinenko  <[email protected]>

	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

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/disk/i386/pc/biosdisk.c

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog	2009-06-08 13:25:54 UTC (rev 2274)
+++ trunk/grub2/ChangeLog	2009-06-08 13:29:05 UTC (rev 2275)
@@ -1,3 +1,10 @@
+2009-06-08  Vladimir Serbinenko  <[email protected]>
+
+	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  <[email protected]>
 
 	* fs/hfs.c (grub_hfs_find_dir): Use union to avoid a warning

Modified: trunk/grub2/disk/i386/pc/biosdisk.c
===================================================================
--- trunk/grub2/disk/i386/pc/biosdisk.c	2009-06-08 13:25:54 UTC (rev 2274)
+++ trunk/grub2/disk/i386/pc/biosdisk.c	2009-06-08 13:29:05 UTC (rev 2275)
@@ -158,8 +158,20 @@
 					       &data->heads,
 					       &data->sectors) != 0)
         {
-          grub_free (data);
-          return grub_error (GRUB_ERR_BAD_DEVICE, "cannot get C/H/S values");
+	  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)
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.