]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
2008-03-28 Robert Millan <rmh@aybabtu.com>
authorrobertmh <robertmh@localhost>
Fri, 28 Mar 2008 13:22:28 +0000 (13:22 +0000)
committerrobertmh <robertmh@localhost>
Fri, 28 Mar 2008 13:22:28 +0000 (13:22 +0000)
        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.

ChangeLog
grub/asmstub.c
lib/device.c
stage2/bios.c
stage2/disk_io.c
stage2/shared.h

index f1fb4212070c0e4250c77f9e648fc3e1ceef3d9f..816315a2085a9691e2a26d2418f5b11ae9cb8541 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * configure.ac: Test if '--build-id=none' is supported by the
index bcb4fae92894d71db2f69bfe3ac2069345275068..88d704e5e7e72a1bb5798991876355ab36357d14 100644 (file)
@@ -962,7 +962,7 @@ hex_dump (void *buf, size_t size)
 
 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;
index 8abd2a907b080fdb0ace97b7c2f6c2babe51ddc2..d04b54ef7c8f540706dcefc0f00aeed0ad91a019 100644 (file)
@@ -69,9 +69,9 @@ struct hd_geometry
 # 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
@@ -152,19 +152,19 @@ get_drive_geometry (struct geometry *geom, char **map, int drive)
   /* 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;
   }
index 2d85e40b9d881373103d590fa765a633b11799f3..f3665caf03124794c044d1a843a7c4cfbda134e8 100644 (file)
@@ -47,7 +47,7 @@ extern int get_diskinfo_floppy (int drive,
    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;
   
index b9bc5264376d05078b1993e8c0e42a06d6317907..800e0fbe1805c123c96c09ba0718d684217cde28 100644 (file)
@@ -137,7 +137,7 @@ log2 (unsigned long word)
 }
 
 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);
@@ -261,7 +261,7 @@ rawread (int drive, int sector, int byte_offset, int byte_len, char *buf)
        */
       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;
@@ -291,7 +291,7 @@ 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)
+devread (unsigned int sector, int byte_offset, int byte_len, char *buf)
 {
   /*
    *  Check partition boundaries
@@ -330,7 +330,7 @@ devread (int sector, int byte_offset, int byte_len, char *buf)
 
 #ifndef STAGE1_5
 int
-rawwrite (int drive, int sector, char *buf)
+rawwrite (int drive, unsigned int sector, char *buf)
 {
   if (sector == 0)
     {
@@ -363,7 +363,7 @@ rawwrite (int drive, int sector, char *buf)
 }
 
 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
index 609549a509dfe784dc83d569bdbc42abcd8b2136..2db6cc662ca32106d8a6967ad6bc0306fa3f49df 100644 (file)
@@ -811,7 +811,7 @@ int checkkey (void);
 /* 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. */
@@ -924,10 +924,10 @@ int gunzip_test_header (void);
 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);