lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <4ed1fd0ab7cc906d9a56d4eebeb5dac267c6b219.1607640819.git.me@pmachata.org>
Date:   Fri, 11 Dec 2020 00:02:21 +0100
From:   Petr Machata <me@...chata.org>
To:     netdev@...r.kernel.org, dsahern@...il.com,
        stephen@...workplumber.org
Cc:     Petr Machata <me@...chata.org>
Subject: [PATCH iproute2-next 07/10] dcb: Add -i to enable IEC mode

Allow switching "dcb" into the ISO/IEC mode of units by passing -i.

Signed-off-by: Petr Machata <me@...chata.org>
---
 dcb/dcb.c      | 10 +++++++---
 dcb/dcb.h      |  1 +
 man/man8/dcb.8 |  5 +++++
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/dcb/dcb.c b/dcb/dcb.c
index 9332a8b2e3d4..4b4a5b9354c6 100644
--- a/dcb/dcb.c
+++ b/dcb/dcb.c
@@ -310,8 +310,8 @@ static void dcb_help(void)
 		"Usage: dcb [ OPTIONS ] OBJECT { COMMAND | help }\n"
 		"       dcb [ -f | --force ] { -b | --batch } filename [ -N | --Netns ] netnsname\n"
 		"where  OBJECT := ets\n"
-		"       OPTIONS := [ -V | --Version | -j | --json | -p | --pretty\n"
-		"                  | -s | --statistics | -v | --verbose ]\n");
+		"       OPTIONS := [ -V | --Version | -i | --iec | -j | --json\n"
+		"                  | -p | --pretty | -s | --statistics | -v | --verbose]\n");
 }
 
 static int dcb_cmd(struct dcb *dcb, int argc, char **argv)
@@ -345,6 +345,7 @@ int main(int argc, char **argv)
 		{ "Version",		no_argument,		NULL, 'V' },
 		{ "force",		no_argument,		NULL, 'f' },
 		{ "batch",		required_argument,	NULL, 'b' },
+		{ "iec",		no_argument,		NULL, 'i' },
 		{ "json",		no_argument,		NULL, 'j' },
 		{ "pretty",		no_argument,		NULL, 'p' },
 		{ "statistics",		no_argument,		NULL, 's' },
@@ -365,7 +366,7 @@ int main(int argc, char **argv)
 		return EXIT_FAILURE;
 	}
 
-	while ((opt = getopt_long(argc, argv, "b:fhjpsvN:V",
+	while ((opt = getopt_long(argc, argv, "b:fhijpsvN:V",
 				  long_options, NULL)) >= 0) {
 
 		switch (opt) {
@@ -394,6 +395,9 @@ int main(int argc, char **argv)
 				goto dcb_free;
 			}
 			break;
+		case 'i':
+			dcb->use_iec = true;
+			break;
 		case 'h':
 			dcb_help();
 			return 0;
diff --git a/dcb/dcb.h b/dcb/dcb.h
index b2a13b3065f2..8637efc159b9 100644
--- a/dcb/dcb.h
+++ b/dcb/dcb.h
@@ -12,6 +12,7 @@ struct dcb {
 	struct mnl_socket *nl;
 	bool json_output;
 	bool stats;
+	bool use_iec;
 };
 
 int dcb_parse_mapping(const char *what_key, __u32 key, __u32 max_key,
diff --git a/man/man8/dcb.8 b/man/man8/dcb.8
index f853b7baaf33..15b43942585a 100644
--- a/man/man8/dcb.8
+++ b/man/man8/dcb.8
@@ -43,6 +43,11 @@ failure will cause termination of dcb.
 Don't terminate dcb on errors in batch mode. If there were any errors during
 execution of the commands, the application return code will be non zero.
 
+.TP
+.BR "\-i" , " --iec"
+When showing rates, use ISO/IEC 1024-based prefixes (Ki, Mi, Bi) instead of
+the 1000-based ones (K, M, B).
+
 .TP
 .BR "\-j" , " --json"
 Generate JSON output.
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ