diff options
author | yar <yar@FreeBSD.org> | 2006-11-27 16:33:44 +0000 |
---|---|---|
committer | yar <yar@FreeBSD.org> | 2006-11-27 16:33:44 +0000 |
commit | 6c1cc19152b33b40556371e89b993ae0faf46414 (patch) | |
tree | 232eae51944070e8dac72428311ed27a70767c07 /usr.bin/systat | |
parent | b0a259a119095a312283f38b1211dee644d90232 (diff) | |
download | FreeBSD-src-6c1cc19152b33b40556371e89b993ae0faf46414.zip FreeBSD-src-6c1cc19152b33b40556371e89b993ae0faf46414.tar.gz |
Add the Tera scale factor, which is an easy job now.
More scale factors would overflow the command line where
the help for "scale" were shown.
Diffstat (limited to 'usr.bin/systat')
-rw-r--r-- | usr.bin/systat/convtbl.c | 5 | ||||
-rw-r--r-- | usr.bin/systat/convtbl.h | 5 |
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 */ }; |