[PATCH] fdisk: fix sector_t for multi-terabyte disks

John Spencer maillist-busybox at barfooze.de
Fri May 16 15:02:29 UTC 2014


ping

John Spencer wrote:
>>From 8290bae43ae7a7fc71c0228d18b77db24faea764 Mon Sep 17 00:00:00 2001
> From: John Spencer <maillist-busybox at barfooze.de>
> Date: Thu, 21 Nov 2013 21:38:10 +0100
> Subject: [PATCH] fdisk: fix sector_t for multi-terabyte disks
> 
> before:
> Disk /dev/sdb: 4294967295 sectors, 4095M
> 
> after:
> Disk /dev/sdb: 5860533168 sectors, 2794G
> 
> Signed-off-by: John Spencer <maillist-busybox at barfooze.de>
> ---
>  util-linux/fdisk.c | 13 ++-----------
>  1 file changed, 2 insertions(+), 11 deletions(-)
> 
> diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
> index 39eb27b..a21f62f 100644
> --- a/util-linux/fdisk.c
> +++ b/util-linux/fdisk.c
> @@ -85,17 +85,8 @@ enum {
>  
>  
>  typedef unsigned long long ullong;
> -/* Used for sector numbers. Partition formats we know
> - * do not support more than 2^32 sectors
> - */
> -typedef uint32_t sector_t;
> -#if UINT_MAX == 4294967295
> -# define SECT_FMT ""
> -#elif ULONG_MAX == 4294967295
> -# define SECT_FMT "l"
> -#else
> -# error Cant detect sizeof(uint32_t)
> -#endif
> +typedef uint64_t sector_t;
> +#define SECT_FMT "ll"
>  
>  struct hd_geometry {
>  	unsigned char heads;



More information about the busybox mailing list