From: David Ahern <dsahern@gmail.com>
To: netdev@vger.kernel.org, jiri@mellanox.com, arkadis@mellanox.com
Cc: David Ahern <dsahern@gmail.com>
Subject: [PATCH iproute2-next] devlink: Print size of -1 as unlimited
Date: Fri, 30 Mar 2018 09:21:44 -0700 [thread overview]
Message-ID: <20180330162144.27297-1-dsahern@gmail.com> (raw)
(u64)-1 essentially means the size is unlimited. Print as 'unlimited'
as opposed to the current unsigned int range of 4294967295.
Signed-off-by: David Ahern <dsahern@gmail.com>
---
devlink/devlink.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index ba02064b848c..fa33684cb20a 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -1405,6 +1405,14 @@ static void pr_out_uint(struct dl *dl, const char *name, unsigned int val)
}
}
+static void pr_out_u64(struct dl *dl, const char *name, uint64_t val)
+{
+ if (val == (uint64_t) -1)
+ return pr_out_str(dl, name, "unlimited");
+
+ return pr_out_uint(dl, name, val);
+}
+
static void pr_out_dev(struct dl *dl, struct nlattr **tb)
{
pr_out_handle(dl, tb);
@@ -4213,16 +4221,16 @@ static void resource_show(struct resource *resource,
pr_out_str(dl, "name", resource->name);
if (dl->verbose)
resource_path_print(dl, ctx->resources, resource->id);
- pr_out_uint(dl, "size", resource->size);
+ pr_out_u64(dl, "size", resource->size);
if (resource->size != resource->size_new)
- pr_out_uint(dl, "size_new", resource->size_new);
+ pr_out_u64(dl, "size_new", resource->size_new);
if (resource->occ_valid)
pr_out_uint(dl, "occ", resource->size_occ);
pr_out_str(dl, "unit", resource_unit_str_get(resource->unit));
if (resource->size_min != resource->size_max) {
pr_out_uint(dl, "size_min", resource->size_min);
- pr_out_uint(dl, "size_max", resource->size_max);
+ pr_out_u64(dl, "size_max", resource->size_max);
pr_out_uint(dl, "size_gran", resource->size_gran);
}
--
2.11.0
reply other threads:[~2018-03-30 16:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180330162144.27297-1-dsahern@gmail.com \
--to=dsahern@gmail.com \
--cc=arkadis@mellanox.com \
--cc=jiri@mellanox.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).