The recent push to use correct scaling terms (kB for 1000, KiB for
1024 - such as commit 9dfdead) missed some places in virsh.
* tools/virsh.c (prettyCapacity, cmdDominfo, cmdFreecell)
(cmdNodeinfo, cmdNodeMemStats): Use KiB, not kB, when referring to
multiples of 1024.
---
tools/virsh.c | 24 ++++++++++++------------
1 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/tools/virsh.c b/tools/virsh.c
index 7159744..2527d7b 100644
--- a/tools/virsh.c
+++ b/tools/virsh.c
@@ -514,16 +514,16 @@ prettyCapacity(unsigned long long val,
*unit = "";
return (double)val;
} else if (val < (1024.0l * 1024.0l)) {
- *unit = "KB";
+ *unit = "KiB";
return (((double)val / 1024.0l));
} else if (val < (1024.0l * 1024.0l * 1024.0l)) {
- *unit = "MB";
+ *unit = "MiB";
return (double)val / (1024.0l * 1024.0l);
} else if (val < (1024.0l * 1024.0l * 1024.0l * 1024.0l)) {
- *unit = "GB";
+ *unit = "GiB";
return (double)val / (1024.0l * 1024.0l * 1024.0l);
} else {
- *unit = "TB";
+ *unit = "TiB";
return (double)val / (1024.0l * 1024.0l * 1024.0l * 1024.0l);
}
}
@@ -4541,13 +4541,13 @@ cmdDominfo(vshControl *ctl, const vshCmd *cmd)
}
if (info.maxMem != UINT_MAX)
- vshPrint(ctl, "%-15s %lu kB\n", _("Max memory:"),
+ vshPrint(ctl, "%-15s %lu KiB\n", _("Max memory:"),
info.maxMem);
else
vshPrint(ctl, "%-15s %s\n", _("Max memory:"),
_("no limit"));
- vshPrint(ctl, "%-15s %lu kB\n", _("Used memory:"),
+ vshPrint(ctl, "%-15s %lu KiB\n", _("Used memory:"),
info.memory);
} else {
@@ -4823,13 +4823,13 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd)
memory = 0;
for (cell = 0; cell < nodes_cnt; cell++) {
- vshPrint(ctl, "%5lu: %10llu kB\n", nodes_id[cell],
+ vshPrint(ctl, "%5lu: %10llu KiB\n", nodes_id[cell],
(nodes_free[cell]/1024));
memory += nodes_free[cell];
}
vshPrintExtra(ctl, "--------------------\n");
- vshPrintExtra(ctl, "%5s: %10llu kB\n", _("Total"),
memory/1024);
+ vshPrintExtra(ctl, "%5s: %10llu KiB\n", _("Total"),
memory/1024);
} else {
if (!cell_given) {
memory = virNodeGetFreeMemory(ctl->conn);
@@ -4842,9 +4842,9 @@ cmdFreecell(vshControl *ctl, const vshCmd *cmd)
}
if (cell == -1)
- vshPrint(ctl, "%s: %llu kB\n", _("Total"),
(memory/1024));
+ vshPrint(ctl, "%s: %llu KiB\n", _("Total"),
(memory/1024));
else
- vshPrint(ctl, "%d: %llu kB\n", cell, (memory/1024));
+ vshPrint(ctl, "%d: %llu KiB\n", cell, (memory/1024));
}
func_ret = true;
@@ -6513,7 +6513,7 @@ cmdNodeinfo(vshControl *ctl, const vshCmd *cmd ATTRIBUTE_UNUSED)
vshPrint(ctl, "%-20s %d\n", _("Core(s) per socket:"),
info.cores);
vshPrint(ctl, "%-20s %d\n", _("Thread(s) per core:"),
info.threads);
vshPrint(ctl, "%-20s %d\n", _("NUMA cell(s):"), info.nodes);
- vshPrint(ctl, "%-20s %lu kB\n", _("Memory size:"), info.memory);
+ vshPrint(ctl, "%-20s %lu KiB\n", _("Memory size:"),
info.memory);
return true;
}
@@ -6699,7 +6699,7 @@ cmdNodeMemStats(vshControl *ctl, const vshCmd *cmd)
}
for (i = 0; i < nparams; i++)
- vshPrint(ctl, "%-7s: %20llu kB\n", params[i].field, params[i].value);
+ vshPrint(ctl, "%-7s: %20llu KiB\n", params[i].field, params[i].value);
ret = true;
--
1.7.7.6