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.
+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>
* configure.ac: Test if '--build-id=none' is supported by the
int
biosdisk (int subfunc, int drive, struct geometry *geometry,
- int sector, int nsec, int segment)
+ unsigned int sector, int nsec, int segment)
{
char *buf;
int fd = geometry->flags;
# ifndef CDROM_GET_CAPABILITY
# define CDROM_GET_CAPABILITY 0x5331 /* get capabilities */
# endif /* ! CDROM_GET_CAPABILITY */
-# ifndef BLKGETSIZE
-# define BLKGETSIZE _IO(0x12,96) /* return device size */
-# endif /* ! BLKGETSIZE */
+# ifndef BLKGETSIZE64
+# define BLKGETSIZE64 _IOR(0x12,114,size_t) /* return device size */
+# endif /* ! BLKGETSIZE64 */
#endif /* __linux__ */
/* Use __FreeBSD_kernel__ instead of __FreeBSD__ for compatibility with
/* Linux */
{
struct hd_geometry hdg;
- unsigned long nr;
+ unsigned long long nr;
if (ioctl (fd, HDIO_GETGEO, &hdg))
goto fail;
- if (ioctl (fd, BLKGETSIZE, &nr))
+ if (ioctl (fd, BLKGETSIZE64, &nr))
goto fail;
/* Got the geometry, so save it. */
geom->cylinders = hdg.cylinders;
geom->heads = hdg.heads;
geom->sectors = hdg.sectors;
- geom->total_sectors = nr;
+ geom->total_sectors = nr / 512;
goto success;
}
return the error number. Otherwise, return 0. */
int
biosdisk (int read, int drive, struct geometry *geometry,
- int sector, int nsec, int segment)
+ unsigned int sector, int nsec, int segment)
{
int err;
}
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 sector_size_bits = log2 (buf_geom.sector_size);
*/
if (disk_read_func)
{
- int sector_num = sector;
+ unsigned int sector_num = sector;
int length = buf_geom.sector_size - byte_offset;
if (length > size)
length = size;
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
#ifndef STAGE1_5
int
-rawwrite (int drive, int sector, char *buf)
+rawwrite (int drive, unsigned int sector, char *buf)
{
if (sector == 0)
{
}
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 (current_partition != 0xFFFFFF
/* Low-level disk I/O */
int get_diskinfo (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);
/* Command-line interface functions. */
int gunzip_read (char *buf, int len);
#endif /* NO_DECOMPRESSION */
-int rawread (int drive, int sector, int byte_offset, int byte_len, char *buf);
-int devread (int sector, int byte_offset, int byte_len, char *buf);
-int rawwrite (int drive, int sector, char *buf);
-int devwrite (int sector, int sector_len, char *buf);
+int rawread (int drive, unsigned 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, unsigned int sector, char *buf);
+int devwrite (unsigned int sector, int sector_len, char *buf);
/* Parse a device string and initialize the global parameters. */
char *set_device (char *device);