From: Neerav Parikh <neerav.par...@intel.com>

fcoeadm displays capacity information using SI units, that
is not in sync with how the capacity is reported by Linux
kernel and user-space tools like sg3_utils.
The Linux kernel uses IEC binary units to represent capacity
value calculated using base 2 (1024) and SI units for value
calculated using base 10 (1000).

This patch converts fcoeadm to use the same convetion of using
IEC prefixes as it does capacity calculation using base 2 (1024)
value.

Signed-off-by: Neerav Parikh <neerav.par...@intel.com>
Tested-by: Ross Brattain <ross.b.bratt...@intel.com>
---
 fcoeadm_display.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/fcoeadm_display.c b/fcoeadm_display.c
index 0f37248..906689c 100644
--- a/fcoeadm_display.c
+++ b/fcoeadm_display.c
@@ -737,18 +737,18 @@ show_short_lun_info(HBA_FCP_SCSI_ENTRY *ep, char *inqbuf,
        cap = (u_int64_t)blksize * lba;
 
        cap_abbr = cap / (1024.0 * 1024.0);
-       abbr = "MB";
+       abbr = "MiB";
        if (cap_abbr >= 1024) {
                cap_abbr /= 1024.0;
-               abbr = "GB";
+               abbr = "GiB";
        }
        if (cap_abbr >= 1024) {
                cap_abbr /= 1024.0;
-               abbr = "TB";
+               abbr = "TiB";
        }
        if (cap_abbr >= 1024) {
                cap_abbr /= 1024.0;
-               abbr = "PB";
+               abbr = "PiB";
        }
        snprintf(capstr, sizeof(capstr), "%0.2f %s", cap_abbr, abbr);
 
@@ -809,18 +809,18 @@ show_full_lun_info(HBA_HANDLE hba_handle,
        cap = (u_int64_t)blksize * lba;
 
        cap_abbr = cap / (1024.0 * 1024.0);
-       abbr = "MB";
+       abbr = "MiB";
        if (cap_abbr >= 1024) {
                cap_abbr /= 1024.0;
-               abbr = "GB";
+               abbr = "GiB";
        }
        if (cap_abbr >= 1024) {
                cap_abbr /= 1024.0;
-               abbr = "TB";
+               abbr = "TiB";
        }
        if (cap_abbr >= 1024) {
                cap_abbr /= 1024.0;
-               abbr = "PB";
+               abbr = "PiB";
        }
        snprintf(capstr, sizeof(capstr), "%0.2f %s", cap_abbr, abbr);
 

_______________________________________________
devel mailing list
devel@open-fcoe.org
https://lists.open-fcoe.org/mailman/listinfo/devel

Reply via email to