summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/systat/convtbl.c5
-rw-r--r--usr.bin/systat/convtbl.h5
2 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/systat/convtbl.c b/usr.bin/systat/convtbl.c
index 0e16de6..81b5991 100644
--- a/usr.bin/systat/convtbl.c
+++ b/usr.bin/systat/convtbl.c
@@ -41,6 +41,7 @@
#define KILO (1024LL)
#define MEGA (KILO * 1024)
#define GIGA (MEGA * 1024)
+#define TERA (GIGA * 1024)
struct convtbl {
uintmax_t mul;
@@ -55,11 +56,13 @@ static struct convtbl convtbl[] = {
[SC_KILOBYTE] = { BYTE, KILO, "KB", "kbyte" },
[SC_MEGABYTE] = { BYTE, MEGA, "MB", "mbyte" },
[SC_GIGABYTE] = { BYTE, GIGA, "GB", "gbyte" },
+ [SC_TERABYTE] = { BYTE, TERA, "TB", "tbyte" },
[SC_BIT] = { BIT, BITS, "b", "bit" },
[SC_KILOBIT] = { BIT, KILO, "Kb", "kbit" },
[SC_MEGABIT] = { BIT, MEGA, "Mb", "mbit" },
[SC_GIGABIT] = { BIT, GIGA, "Gb", "gbit" },
+ [SC_TERABIT] = { BIT, TERA, "Tb", "tbit" },
[SC_AUTO] = { 0, 0, "", "auto" }
};
@@ -82,7 +85,7 @@ get_tbl_ptr(const uintmax_t size, const int scale)
* index as the array index into the conversion table.
*/
for (tmp = size, idx = SC_KILOBYTE;
- tmp >= MEGA && idx < SC_GIGABYTE;
+ tmp >= MEGA && idx < SC_BIT - 1;
tmp >>= 10, idx++);
return (&convtbl[idx]);
diff --git a/usr.bin/systat/convtbl.h b/usr.bin/systat/convtbl.h
index c3daa0f..051e1cd 100644
--- a/usr.bin/systat/convtbl.h
+++ b/usr.bin/systat/convtbl.h
@@ -34,15 +34,20 @@
#include <sys/types.h>
#include <stdint.h>
+/*
+ * Keep the order in the enum.
+ */
enum scale {
SC_BYTE,
SC_KILOBYTE,
SC_MEGABYTE,
SC_GIGABYTE,
+ SC_TERABYTE,
SC_BIT,
SC_KILOBIT,
SC_MEGABIT,
SC_GIGABIT,
+ SC_TERABIT,
SC_AUTO /* KEEP THIS LAST */
};
OpenPOWER on IntegriCloud