2008-03-28 Robert Millan <rmh@aybabtu.com>

Surpass 1 TiB disk addressing limit.  Note: there are no plans to handle
        the 2 TiB disk limit in GRUB Legacy, since that would need considerable
        rework.  If you have >2TiB disks, use GRUB 2 instead.

        * grub/asmstub.c (biosdisk): Add unsigned qualifier to `sector'.
        * stage2/bios.c (biosdisk): Likewise.
        * stage2/disk_io.c (rawread, devread, rawwrite, devwrite): Likewise.
        * stage2/shared.h (rawread, devread, rawwrite, devwrite): Likewise.
        * lib/device.c (get_drive_geometry): Replace BLKGETSIZE with
        BLKGETSIZE64.
This commit is contained in:
robertmh 2008-03-28 13:22:28 +00:00
parent bce46bf7f1
commit fe11b298f6
6 changed files with 31 additions and 18 deletions

View file

@ -1,3 +1,16 @@
2008-03-28 Robert Millan <rmh@aybabtu.com>
Surpass 1 TiB disk addressing limit. Note: there are no plans to handle
the 2 TiB disk limit in GRUB Legacy, since that would need considerable
rework. If you have >2TiB disks, use GRUB 2 instead.
* grub/asmstub.c (biosdisk): Add unsigned qualifier to `sector'.
* stage2/bios.c (biosdisk): Likewise.
* stage2/disk_io.c (rawread, devread, rawwrite, devwrite): Likewise.
* stage2/shared.h (rawread, devread, rawwrite, devwrite): Likewise.
* lib/device.c (get_drive_geometry): Replace BLKGETSIZE with
BLKGETSIZE64.
2007-10-29 Pavel Roskin <proski@gnu.org> 2007-10-29 Pavel Roskin <proski@gnu.org>
* configure.ac: Test if '--build-id=none' is supported by the * configure.ac: Test if '--build-id=none' is supported by the

View file

@ -962,7 +962,7 @@ hex_dump (void *buf, size_t size)
int int
biosdisk (int subfunc, int drive, struct geometry *geometry, biosdisk (int subfunc, int drive, struct geometry *geometry,
int sector, int nsec, int segment) unsigned int sector, int nsec, int segment)
{ {
char *buf; char *buf;
int fd = geometry->flags; int fd = geometry->flags;

View file

@ -69,9 +69,9 @@ struct hd_geometry
# ifndef CDROM_GET_CAPABILITY # ifndef CDROM_GET_CAPABILITY
# define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */ # define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
# endif /* ! CDROM_GET_CAPABILITY */ # endif /* ! CDROM_GET_CAPABILITY */
# ifndef BLKGETSIZE # ifndef BLKGETSIZE64
# define BLKGETSIZE _IO(0x12,96) /* return device size */ # define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size */
# endif /* ! BLKGETSIZE */ # endif /* ! BLKGETSIZE64 */
#endif /* __linux__ */ #endif /* __linux__ */
/* Use __FreeBSD_kernel__ instead of __FreeBSD__ for compatibility with /* Use __FreeBSD_kernel__ instead of __FreeBSD__ for compatibility with
@ -152,19 +152,19 @@ get_drive_geometry (struct geometry *geom, char **map, int drive)
/* Linux */ /* Linux */
{ {
struct hd_geometry hdg; struct hd_geometry hdg;
unsigned long nr; unsigned long long nr;
if (ioctl (fd, HDIO_GETGEO, &hdg)) if (ioctl (fd, HDIO_GETGEO, &hdg))
goto fail; goto fail;
if (ioctl (fd, BLKGETSIZE, &nr)) if (ioctl (fd, BLKGETSIZE64, &nr))
goto fail; goto fail;
/* Got the geometry, so save it. */ /* Got the geometry, so save it. */
geom->cylinders = hdg.cylinders; geom->cylinders = hdg.cylinders;
geom->heads = hdg.heads; geom->heads = hdg.heads;
geom->sectors = hdg.sectors; geom->sectors = hdg.sectors;
geom->total_sectors = nr; geom->total_sectors = nr / 512;
goto success; goto success;
} }

View file

@ -47,7 +47,7 @@ extern int get_diskinfo_floppy (int drive,
return the error number. Otherwise, return 0. */ return the error number. Otherwise, return 0. */
int int
biosdisk (int read, int drive, struct geometry *geometry, biosdisk (int read, int drive, struct geometry *geometry,
int sector, int nsec, int segment) unsigned int sector, int nsec, int segment)
{ {
int err; int err;

View file

@ -137,7 +137,7 @@ log2 (unsigned long word)
} }
int int
rawread (int drive, int sector, int byte_offset, int byte_len, char *buf) rawread (int drive, unsigned int sector, int byte_offset, int byte_len, char *buf)
{ {
int slen, sectors_per_vtrack; int slen, sectors_per_vtrack;
int sector_size_bits = log2 (buf_geom.sector_size); int sector_size_bits = log2 (buf_geom.sector_size);
@ -261,7 +261,7 @@ rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
*/ */
if (disk_read_func) if (disk_read_func)
{ {
int sector_num = sector; unsigned int sector_num = sector;
int length = buf_geom.sector_size - byte_offset; int length = buf_geom.sector_size - byte_offset;
if (length > size) if (length > size)
length = size; length = size;
@ -291,7 +291,7 @@ rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
int int
devread (int sector, int byte_offset, int byte_len, char *buf) devread (unsigned int sector, int byte_offset, int byte_len, char *buf)
{ {
/* /*
* Check partition boundaries * Check partition boundaries
@ -330,7 +330,7 @@ devread (int sector, int byte_offset, int byte_len, char *buf)
#ifndef STAGE1_5 #ifndef STAGE1_5
int int
rawwrite (int drive, int sector, char *buf) rawwrite (int drive, unsigned int sector, char *buf)
{ {
if (sector == 0) if (sector == 0)
{ {
@ -363,7 +363,7 @@ rawwrite (int drive, int sector, char *buf)
} }
int int
devwrite (int sector, int sector_count, char *buf) devwrite (unsigned int sector, int sector_count, char *buf)
{ {
#if defined(GRUB_UTIL) && defined(__linux__) #if defined(GRUB_UTIL) && defined(__linux__)
if (current_partition != 0xFFFFFF if (current_partition != 0xFFFFFF

View file

@ -811,7 +811,7 @@ int checkkey (void);
/* Low-level disk I/O */ /* Low-level disk I/O */
int get_diskinfo (int drive, struct geometry *geometry); int get_diskinfo (int drive, struct geometry *geometry);
int biosdisk (int subfunc, int drive, struct geometry *geometry, int biosdisk (int subfunc, int drive, struct geometry *geometry,
int sector, int nsec, int segment); unsigned int sector, int nsec, int segment);
void stop_floppy (void); void stop_floppy (void);
/* Command-line interface functions. */ /* Command-line interface functions. */
@ -924,10 +924,10 @@ int gunzip_test_header (void);
int gunzip_read (char *buf, int len); int gunzip_read (char *buf, int len);
#endif /* NO_DECOMPRESSION */ #endif /* NO_DECOMPRESSION */
int rawread (int drive, int sector, int byte_offset, int byte_len, char *buf); int rawread (int drive, unsigned int sector, int byte_offset, int byte_len, char *buf);
int devread (int sector, int byte_offset, int byte_len, char *buf); int devread (unsigned int sector, int byte_offset, int byte_len, char *buf);
int rawwrite (int drive, int sector, char *buf); int rawwrite (int drive, unsigned int sector, char *buf);
int devwrite (int sector, int sector_len, char *buf); int devwrite (unsigned int sector, int sector_len, char *buf);
/* Parse a device string and initialize the global parameters. */ /* Parse a device string and initialize the global parameters. */
char *set_device (char *device); char *set_device (char *device);