[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] fix fdisk GPT size counting math errors
From:       Jody Bruchon <jody () jodybruchon ! com>
Date:       2013-08-19 17:20:21
Message-ID: 521253D5.7060503 () jodybruchon ! com
[Download RAW message or body]

BusyBox fdisk GPT support does not multiply the total sector count by 
the sector size in bytes before calculating total disk and partition 
sizes. This patch fixes the math to display correct sizes.

Regards,
Jody Lee Bruchon

["001-fix-fdisk-gpt.patch" (text/plain)]

--- a/util-linux/fdisk_gpt.c	2013-05-11 19:30:45.000000000 -0400
+++ b/util-linux/fdisk_gpt.c	2013-08-19 13:16:53.319521471 -0400
@@ -95,7 +95,7 @@
 
 	numstr6[5] = '\0';
 
-	smart_ulltoa5(total_number_of_sectors, numstr6, " KMGTPEZY");
+	smart_ulltoa5(total_number_of_sectors * sector_size, numstr6, " KMGTPEZY");
 	printf("Disk %s: %llu sectors, %s\n", disk_device,
 		(unsigned long long)total_number_of_sectors,
 		numstr6);
@@ -112,7 +112,7 @@
 	for (i = 0; i < n_parts; i++) {
 		gpt_partition *p = gpt_part(i);
 		if (p->lba_start) {
-			smart_ulltoa5(1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start),
+			smart_ulltoa5((1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start)) * sector_size,
 				numstr6, " KMGTPEZY");
 			printf("%4u %15llu %15llu %11s   %04x  ",
 				i + 1,


_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic