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.
This commit is contained in:
parent
2b7a7354d9
commit
6884fee4be
2 changed files with 9 additions and 3 deletions
|
@ -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>
|
2005-03-19 Yoshinori K. Okuji <okuji@enbug.org>
|
||||||
|
|
||||||
* stage2/stage2.c (cmain): Initialize DEFAULT_FILE to an empty
|
* stage2/stage2.c (cmain): Initialize DEFAULT_FILE to an empty
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* device.c - Some helper functions for OS devices and BIOS drives */
|
/* device.c - Some helper functions for OS devices and BIOS drives */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* 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
|
* 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
|
* 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. */
|
/* Set the total sectors properly, if we can. */
|
||||||
if (! fstat (fd, &st) && st.st_blocks)
|
if (! fstat (fd, &st) && st.st_size)
|
||||||
geom->total_sectors = st.st_blocks;
|
geom->total_sectors = st.st_size >> SECTOR_BITS;
|
||||||
else
|
else
|
||||||
geom->total_sectors = geom->cylinders * geom->heads * geom->sectors;
|
geom->total_sectors = geom->cylinders * geom->heads * geom->sectors;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue