From d5a49e9f4841d7e69292f0579e3da98670cc4efb Mon Sep 17 00:00:00 2001 From: Maurizio Lombardi Date: Tue, 27 Jun 2023 17:23:09 +0200 Subject: [PATCH] replace SI suffixes with binary suffixes Signed-off-by: Maurizio Lombardi --- Documentation/nvme-create-ns.txt | 18 +++++++++--------- nvme-print-stdout.c | 8 ++++---- nvme.c | 4 ++-- plugins/huawei/huawei-nvme.c | 4 ++-- plugins/netapp/netapp-nvme.c | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Documentation/nvme-create-ns.txt b/Documentation/nvme-create-ns.txt index 28046b68e136..48747ec8905c 100644 --- a/Documentation/nvme-create-ns.txt +++ b/Documentation/nvme-create-ns.txt @@ -21,8 +21,8 @@ SYNOPSIS [--nphndls= | -n ] [--block-size= | -b ] [--timeout= | -t ] - [--nsze-si= | -S ] - [--ncap-si= | -C ] + [--nsze-bi= | -S ] + [--ncap-bi= | -C ] [--azr | -z] [--rar= | -r ] [--ror= | -o ] @@ -96,15 +96,15 @@ OPTIONS selected for the create-ns operation. Conflicts with --flbas argument. -S:: ---nsze-si:: - The namespace size (NSZE) in standard SI units. - The value SI suffixed is divided by the namespace LBA size to set as NSZE. +--nsze-bi:: + The namespace size (NSZE) in binary units. + The binary-suffixed value is divided by the namespace LBA size to set as NSZE. If the value not suffixed it is set as same with the nsze option. -C:: ---ncap-si:: - The namespace capacity (NCAP) in standard SI units. - The value SI suffixed is divided by the namespace LBA size to set as NCAP. +--ncap-bi:: + The namespace capacity (NCAP) in binary units. + The binary-suffixed value is divided by the namespace LBA size to set as NCAP. If the value not suffixed it is set as same with the ncap option. -z:: @@ -145,4 +145,4 @@ EXAMPLES NVME ---- -Part of the nvme-user suite \ No newline at end of file +Part of the nvme-user suite diff --git a/nvme-print-stdout.c b/nvme-print-stdout.c index 09be9ff0d145..912390d7bd6d 100644 --- a/nvme-print-stdout.c +++ b/nvme-print-stdout.c @@ -4513,8 +4513,8 @@ static void stdout_list_item(nvme_ns_t n) double nsze = nvme_ns_get_lba_count(n) * lba; double nuse = nvme_ns_get_lba_util(n) * lba; - const char *s_suffix = suffix_si_get(&nsze); - const char *u_suffix = suffix_si_get(&nuse); + const char *s_suffix = suffix_binary_get(&nsze); + const char *u_suffix = suffix_binary_get(&nuse); const char *l_suffix = suffix_binary_get(&lba); snprintf(usage, sizeof(usage), "%6.2f %2sB / %6.2f %2sB", nuse, @@ -4566,8 +4566,8 @@ static void stdout_ns_details(nvme_ns_t n) double nsze = nvme_ns_get_lba_count(n) * lba; double nuse = nvme_ns_get_lba_util(n) * lba; - const char *s_suffix = suffix_si_get(&nsze); - const char *u_suffix = suffix_si_get(&nuse); + const char *s_suffix = suffix_binary_get(&nsze); + const char *u_suffix = suffix_binary_get(&nuse); const char *l_suffix = suffix_binary_get(&lba); sprintf(usage,"%6.2f %2sB / %6.2f %2sB", nuse, u_suffix, nsze, s_suffix); diff --git a/nvme.c b/nvme.c index 54e899dff530..4fd3f9274d00 100644 --- a/nvme.c +++ b/nvme.c @@ -3009,8 +3009,8 @@ static int parse_lba_num_si(struct nvme_dev *dev, const char *opt, i = flbas & NVME_NS_FLBAS_LOWER_MASK; lbas = (1 << ns.lbaf[i].ds) + ns.lbaf[i].ms; - if (suffix_si_parse(val, &endptr, (uint64_t *)num)) { - nvme_show_error("Expected long suffixed integer argument for '%s-si' but got '%s'!", + if (suffix_binary_parse(val, &endptr, (uint64_t *)num)) { + nvme_show_error("Expected long suffixed integer argument for '%s-bi' but got '%s'!", opt, val); return -errno; } diff --git a/plugins/huawei/huawei-nvme.c b/plugins/huawei/huawei-nvme.c index 82e190f31cf9..0717826284e5 100644 --- a/plugins/huawei/huawei-nvme.c +++ b/plugins/huawei/huawei-nvme.c @@ -211,8 +211,8 @@ static void huawei_print_list_item(struct huawei_list_item *list_item, double nsze = le64_to_cpu(list_item->ns.nsze) * lba; double nuse = le64_to_cpu(list_item->ns.nuse) * lba; - const char *s_suffix = suffix_si_get(&nsze); - const char *u_suffix = suffix_si_get(&nuse); + const char *s_suffix = suffix_binary_get(&nsze); + const char *u_suffix = suffix_binary_get(&nuse); char usage[128]; char nguid_buf[2 * sizeof(list_item->ns.nguid) + 1]; diff --git a/plugins/netapp/netapp-nvme.c b/plugins/netapp/netapp-nvme.c index 2ecdcc512fcd..d802b04be29d 100644 --- a/plugins/netapp/netapp-nvme.c +++ b/plugins/netapp/netapp-nvme.c @@ -265,7 +265,7 @@ static void netapp_smdevices_print(struct smdevice_info *devices, int count, int nvme_id_ns_flbas_to_lbaf_inuse(devices[i].ns.flbas, &lba_index); unsigned long long lba = 1ULL << devices[i].ns.lbaf[lba_index].ds; double nsze = le64_to_cpu(devices[i].ns.nsze) * lba; - const char *s_suffix = suffix_si_get(&nsze); + const char *s_suffix = suffix_binary_get(&nsze); char size[128]; sprintf(size, "%.2f%sB", nsze, s_suffix); -- 2.39.3