diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2016-08-23 17:18:45 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2016-08-23 17:18:45 +0200 |
commit | 29483ffb075f1a64d2183ebe188b83f5704ba637 (patch) | |
tree | 16651b685d79ed5959c024a299df27b5ee5c8f36 | |
parent | 607f2b404e992174d7c5956d11e8f35f78d2701f (diff) | |
download | busybox-w32-29483ffb075f1a64d2183ebe188b83f5704ba637.tar.gz busybox-w32-29483ffb075f1a64d2183ebe188b83f5704ba637.tar.bz2 busybox-w32-29483ffb075f1a64d2183ebe188b83f5704ba637.zip |
fdisk: tweak some messages
"Total allocated sectors 2021315 greater than the maximum 2020356"
maximum what?
Turns out, that's the CHS size of the disk.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | util-linux/fdisk.c | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 6b5e3880f..a048dd93b 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c | |||
@@ -1897,22 +1897,23 @@ static void | |||
1897 | list_disk_geometry(void) | 1897 | list_disk_geometry(void) |
1898 | { | 1898 | { |
1899 | ullong bytes = ((ullong)total_number_of_sectors << 9); | 1899 | ullong bytes = ((ullong)total_number_of_sectors << 9); |
1900 | long megabytes = bytes / 1000000; | 1900 | ullong xbytes = bytes / (1024*1024); |
1901 | 1901 | char x = 'M'; | |
1902 | if (megabytes < 10000) | 1902 | |
1903 | printf("\nDisk %s: %lu MB, %llu bytes\n", | 1903 | if (xbytes >= 10000) { |
1904 | disk_device, megabytes, bytes); | 1904 | xbytes += 512; /* fdisk util-linux 2.28 does this */ |
1905 | else | 1905 | xbytes /= 1024; |
1906 | printf("\nDisk %s: %lu.%lu GB, %llu bytes\n", | 1906 | x = 'G'; |
1907 | disk_device, megabytes/1000, (megabytes/100)%10, bytes); | 1907 | } |
1908 | printf("%u heads, %u sectors/track, %u cylinders", | 1908 | printf("Disk %s: %llu %cB, %llu bytes, %"SECT_FMT"u sectors\n" |
1909 | g_heads, g_sectors, g_cylinders); | 1909 | "%u cylinders, %u heads, %u sectors/track\n" |
1910 | if (units_per_sector == 1) | 1910 | "Units: %s of %u * %u = %u bytes\n\n", |
1911 | printf(", total %"SECT_FMT"u sectors", | 1911 | disk_device, xbytes, x, |
1912 | total_number_of_sectors / (sector_size/512)); | 1912 | bytes, total_number_of_sectors, |
1913 | printf("\nUnits = %s of %u * %u = %u bytes\n\n", | 1913 | g_cylinders, g_heads, g_sectors, |
1914 | str_units(PLURAL), | 1914 | str_units(PLURAL), |
1915 | units_per_sector, sector_size, units_per_sector * sector_size); | 1915 | units_per_sector, sector_size, units_per_sector * sector_size |
1916 | ); | ||
1916 | } | 1917 | } |
1917 | 1918 | ||
1918 | /* | 1919 | /* |
@@ -2277,6 +2278,7 @@ verify(void) | |||
2277 | { | 2278 | { |
2278 | int i, j; | 2279 | int i, j; |
2279 | sector_t total = 1; | 2280 | sector_t total = 1; |
2281 | sector_t chs_size; | ||
2280 | sector_t first[g_partitions], last[g_partitions]; | 2282 | sector_t first[g_partitions], last[g_partitions]; |
2281 | struct partition *p; | 2283 | struct partition *p; |
2282 | 2284 | ||
@@ -2338,11 +2340,14 @@ verify(void) | |||
2338 | } | 2340 | } |
2339 | } | 2341 | } |
2340 | 2342 | ||
2341 | if (total > g_heads * g_sectors * g_cylinders) | 2343 | chs_size = (sector_t)g_heads * g_sectors * g_cylinders; |
2342 | printf("Total allocated sectors %u greater than the maximum " | 2344 | if (total > chs_size) |
2343 | "%u\n", total, g_heads * g_sectors * g_cylinders); | 2345 | printf("Total allocated sectors %u" |
2346 | " greater than CHS size %"SECT_FMT"u\n", | ||
2347 | total, chs_size | ||
2348 | ); | ||
2344 | else { | 2349 | else { |
2345 | total = g_heads * g_sectors * g_cylinders - total; | 2350 | total = chs_size - total; |
2346 | if (total != 0) | 2351 | if (total != 0) |
2347 | printf("%"SECT_FMT"u unallocated sectors\n", total); | 2352 | printf("%"SECT_FMT"u unallocated sectors\n", total); |
2348 | } | 2353 | } |