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

List:       busybox
Subject:    Fdisk GPT disk/partition size display
From:       Justin Maggard <jmaggard10 () gmail ! com>
Date:       2011-03-29 2:02:33
Message-ID: AANLkTim7FBrvrOey4tkyCvPwEOHVHivw4OxmmpQVqfFk () mail ! gmail ! com
[Download RAW message or body]

The latest busybox fdisk utility with GPT enabled displays the wrong
size for the disk and partitions.  This appears to be because
smart_ulltoa5() is expecting bytes, where gpt_list_table() is sending
sectors.  The attached patch fixes it for me.

-Justin

["busybox-fix-gpt-size-disp.diff" (text/x-patch)]

--- busybox-1.18.4/util-linux/fdisk_gpt.c	2011-03-28 13:30:59.000000000 +0000
+++ busybox-1.18.4-jm/util-linux/fdisk_gpt.c	2011-03-29 01:56:45.000000000 +0000
@@ -95,7 +95,8 @@ gpt_list_table(int xtra UNUSED_PARAM)
 
 	numstr6[5] = '\0';
 
-	smart_ulltoa5(total_number_of_sectors, numstr6, " KMGTPEZY");
+	smart_ulltoa5((unsigned long long)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 +113,8 @@ gpt_list_table(int xtra UNUSED_PARAM)
 	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