Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Ip3iI-0007kJ-Lt for mharc-grub-devel@gnu.org; Mon, 05 Nov 2007 10:18:06 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ip3iG-0007hU-RR for grub-devel@gnu.org; Mon, 05 Nov 2007 10:18:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ip3iG-0007gQ-84 for grub-devel@gnu.org; Mon, 05 Nov 2007 10:18:04 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ip3iF-0007gJ-Vf for grub-devel@gnu.org; Mon, 05 Nov 2007 10:18:03 -0500 Received: from aybabtu.com ([69.60.117.155]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ip3iF-0006m3-GJ for grub-devel@gnu.org; Mon, 05 Nov 2007 10:18:03 -0500 Received: from [192.168.10.6] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1Ip3iE-0007mV-0J for grub-devel@gnu.org; Mon, 05 Nov 2007 16:18:02 +0100 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1Ip3i2-0000uG-BI for grub-devel@gnu.org; Mon, 05 Nov 2007 16:17:50 +0100 Date: Mon, 5 Nov 2007 16:17:50 +0100 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20071105151750.GA3401@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="liOOAslEiF7prFVr" Content-Disposition: inline Organization: free as in freedom X-Message-Flag: Microsoft discourages use of Outlook. X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: PC partitions and big disks X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Nov 2007 15:18:05 -0000 --liOOAslEiF7prFVr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This should make the error much clearer when partition exceeds 2 TiB on a PC partition map (currently, all user gets is a "out of partition" error which is hard to figure out if you're unaware of the 2 TiB limit). Comments? -- Robert Millan I know my rights; I want my phone call! What use is a phone call, if you are unable to speak? (as seen on /.) --liOOAslEiF7prFVr Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="bigdisk.diff" * include/grub/types.h (ULONG_MAX32): New macro. (ULONG_MAX64): Likewise. (ULONG_MAX): Use ULONG_MAX32 / ULONG_MAX64 to define it. * util/misc.c (grub_util_warn): New function. * util/biosdisk.c (grub_util_biosdisk_get_grub_dev): Issue a warning when `disk->total_sectors' exceeds ULONG_MAX32 on `pc' partmap. diff -ur grub2/include/grub/types.h grub2.bigdisk/include/grub/types.h --- grub2/include/grub/types.h 2007-10-27 13:56:58.000000000 +0200 +++ grub2.bigdisk/include/grub/types.h 2007-11-05 16:07:57.000000000 +0100 @@ -92,10 +92,13 @@ typedef grub_int32_t grub_ssize_t; #endif +#define ULONG_MAX32 4294967295UL +#define ULONG_MAX64 18446744073709551615UL + #if GRUB_CPU_SIZEOF_VOID_P == 8 -# define ULONG_MAX 18446744073709551615UL +# define ULONG_MAX ULONG_MAX64 #else -# define ULONG_MAX 4294967295UL +# define ULONG_MAX ULONG_MAX32 #endif /* The type for representing a file offset. */ diff -ur grub2/util/biosdisk.c grub2.bigdisk/util/biosdisk.c --- grub2/util/biosdisk.c 2007-07-22 01:32:31.000000000 +0200 +++ grub2.bigdisk/util/biosdisk.c 2007-11-05 16:10:03.000000000 +0100 @@ -738,6 +738,9 @@ if (pcdata) { + if (disk->total_sectors > ULONG_MAX32) + grub_util_warn ("Size of disk exceeds maximum permitted by partition map"); + if (pcdata->bsd_part < 0) grub_util_info ("DOS partition %d starts from %lu", pcdata->dos_part, partition->start); diff -ur grub2/util/misc.c grub2.bigdisk/util/misc.c --- grub2/util/misc.c 2007-10-21 14:29:33.000000000 +0200 +++ grub2.bigdisk/util/misc.c 2007-11-05 16:06:37.000000000 +0100 @@ -58,6 +58,19 @@ } void +grub_util_warn (const char *fmt, ...) +{ + va_list ap; + + fprintf (stderr, "%s: warning: ", progname); + va_start (ap, fmt); + vfprintf (stderr, fmt, ap); + va_end (ap); + fputc ('\n', stderr); + fflush (stderr); +} + +void grub_util_error (const char *fmt, ...) { va_list ap; --liOOAslEiF7prFVr--