]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2005-03-28 Yoshinori K. Okuji <okuji@enbug.org>
authorokuji <okuji@localhost>
Sun, 27 Mar 2005 23:20:09 +0000 (23:20 +0000)
committerokuji <okuji@localhost>
Sun, 27 Mar 2005 23:20:09 +0000 (23:20 +0000)
  * lib/device.c (get_drive_geometry): Use ST.ST_SIZE instead of
  ST.ST_BLOCKS to get the total number of sectors, because st_blocks
  is not the same if it is a sparse file.

ChangeLog
lib/device.c

index 0d8610312092e108e1730178428d125aa63fdaa4..68699faadb8ea3a029eea5a4724c969e68710591 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2005-03-28  Yoshinori K. Okuji  <okuji@enbug.org>
+
+       * lib/device.c (get_drive_geometry): Use ST.ST_SIZE instead of
+       ST.ST_BLOCKS to get the total number of sectors, because st_blocks
+       is not the same if it is a sparse file.
+
 2005-03-19  Yoshinori K. Okuji  <okuji@enbug.org>
 
        * stage2/stage2.c (cmain): Initialize DEFAULT_FILE to an empty
index b05f3a9066127d73012f46032e485925465c8a11..d0663b396d1b3c9528bf8f7d8c7148cde14273bd 100644 (file)
@@ -1,7 +1,7 @@
 /* device.c - Some helper functions for OS devices and BIOS drives */
 /*
  *  GRUB  --  GRand Unified Bootloader
- *  Copyright (C) 1999,2000,2001,2002,2003,2004  Free Software Foundation, Inc.
+ *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005  Free Software Foundation, Inc.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -248,8 +248,8 @@ partially. This is not fatal."
       }
 
     /* Set the total sectors properly, if we can. */
-    if (! fstat (fd, &st) && st.st_blocks)
-      geom->total_sectors = st.st_blocks;
+    if (! fstat (fd, &st) && st.st_size)
+      geom->total_sectors = st.st_size >> SECTOR_BITS;
     else
       geom->total_sectors = geom->cylinders * geom->heads * geom->sectors;
   }