diff options
author | Karel Zak | 2019-02-12 14:21:54 +0100 |
---|---|---|
committer | Karel Zak | 2019-02-12 14:21:54 +0100 |
commit | 39f37044b3146f222cda182494abd4ddb5217335 (patch) | |
tree | 472f506af3a8c37bfd531a24b2da55025a7217bd /disk-utils | |
parent | lib/strutils: support two decimal places in size_to_human_string() output (diff) | |
download | kernel-qcow2-util-linux-39f37044b3146f222cda182494abd4ddb5217335.tar.gz kernel-qcow2-util-linux-39f37044b3146f222cda182494abd4ddb5217335.tar.xz kernel-qcow2-util-linux-39f37044b3146f222cda182494abd4ddb5217335.zip |
fdisk: use 2 decimal places for size in disk summary
In the disk summary it seems nice, but I'm not sure about lists (SIZE
columns). It seems more readable to keep the lists with one decimal
place only. New output:
# sfdisk --list /dev/sda
Old output:
Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors
New output:
Disk /dev/sda: 223.58 GiB, 240057409536 bytes, 468862128 sectors
The rest is unchanged:
...
Device Start End Sectors Size Type
/dev/sda1 2048 411647 409600 200M EFI System
/dev/sda2 411648 821247 409600 200M Linux filesystem
/dev/sda3 821248 274087935 273266688 130.3G Linux filesystem
/dev/sda4 274087936 378945535 104857600 50G Linux filesystem
/dev/sda5 378945536 468862094 89916559 42.9G Linux filesystem
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1673452
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'disk-utils')
-rw-r--r-- | disk-utils/cfdisk.c | 3 | ||||
-rw-r--r-- | disk-utils/fdisk-list.c | 8 |
2 files changed, 7 insertions, 4 deletions
diff --git a/disk-utils/cfdisk.c b/disk-utils/cfdisk.c index 25f8e1a9e..ff1bc44c1 100644 --- a/disk-utils/cfdisk.c +++ b/disk-utils/cfdisk.c @@ -1699,7 +1699,8 @@ static int ui_refresh(struct cfdisk *cf) if (!ui_enabled) return -EINVAL; - strsz = size_to_human_string(SIZE_SUFFIX_SPACE + strsz = size_to_human_string(SIZE_DECIMAL_2DIGITS + | SIZE_SUFFIX_SPACE | SIZE_SUFFIX_3LETTER, bytes); lb = fdisk_get_label(cf->cxt, NULL); diff --git a/disk-utils/fdisk-list.c b/disk-utils/fdisk-list.c index 916621d75..6bc52d704 100644 --- a/disk-utils/fdisk-list.c +++ b/disk-utils/fdisk-list.c @@ -53,7 +53,8 @@ void list_disk_geometry(struct fdisk_context *cxt) { struct fdisk_label *lb = fdisk_get_label(cxt, NULL); uint64_t bytes = fdisk_get_nsectors(cxt) * fdisk_get_sector_size(cxt); - char *strsz = size_to_human_string(SIZE_SUFFIX_SPACE + char *strsz = size_to_human_string(SIZE_DECIMAL_2DIGITS + | SIZE_SUFFIX_SPACE | SIZE_SUFFIX_3LETTER, bytes); color_scheme_enable("header", UL_COLOR_BOLD); @@ -283,8 +284,9 @@ void list_freespace(struct fdisk_context *cxt) } bytes = sumsize * fdisk_get_sector_size(cxt); - strsz = size_to_human_string(SIZE_SUFFIX_SPACE - | SIZE_SUFFIX_3LETTER, bytes); + strsz = size_to_human_string(SIZE_DECIMAL_2DIGITS + | SIZE_SUFFIX_SPACE + | SIZE_SUFFIX_3LETTER, bytes); color_scheme_enable("header", UL_COLOR_BOLD); fdisk_info(cxt, _("Unpartitioned space %s: %s, %ju bytes, %ju sectors"), |