From: Stephen Hemminger <stephen@networkplumber.org>
To: Leon Romanovsky <leon@kernel.org>
Cc: Steve Wise <swise@opengridcomputing.com>,
dsahern@gmail.com, netdev@vger.kernel.org,
linux-rdma@vger.kernel.org
Subject: Re: [PATCH RFC iproute2-next 2/2] rdma: print provider resource attributes
Date: Wed, 2 May 2018 07:32:16 -0700 [thread overview]
Message-ID: <20180502073216.0794a08a@xeon-e3> (raw)
In-Reply-To: <20180502133852.GK20375@mtr-leonro.local>
[-- Attachment #1: Type: text/plain, Size: 1938 bytes --]
On Wed, 2 May 2018 16:38:52 +0300
Leon Romanovsky <leon@kernel.org> wrote:
> On Mon, Apr 30, 2018 at 08:25:24AM -0700, Stephen Hemminger wrote:
> > On Mon, 30 Apr 2018 07:36:18 -0700
> > Steve Wise <swise@opengridcomputing.com> wrote:
> >
> > > +#define nla_type(attr) ((attr)->nla_type & NLA_TYPE_MASK)
> > > +
> > > +void newline(struct rd *rd)
> > > +{
> > > + if (rd->json_output)
> > > + jsonw_end_array(rd->jw);
> > > + else
> > > + pr_out("\n");
> > > +}
> > > +
> > > +void newline_indent(struct rd *rd)
> > > +{
> > > + newline(rd);
> > > + if (!rd->json_output)
> > > + pr_out(" ");
> > > +}
> > > +
> > > +static int print_provider_string(struct rd *rd, const char *key_str,
> > > + const char *val_str)
> > > +{
> > > + if (rd->json_output) {
> > > + jsonw_string_field(rd->jw, key_str, val_str);
> > > + return 0;
> > > + } else {
> > > + return pr_out("%s %s ", key_str, val_str);
> > > + }
> > > +}
> > > +
> > > +static int print_provider_s32(struct rd *rd, const char *key_str, int32_t val,
> > > + enum rdma_nldev_print_type print_type)
> > > +{
> > > + if (rd->json_output) {
> > > + jsonw_int_field(rd->jw, key_str, val);
> > > + return 0;
> > > + }
> > > + switch (print_type) {
> > > + case RDMA_NLDEV_PRINT_TYPE_UNSPEC:
> > > + return pr_out("%s %d ", key_str, val);
> > > + case RDMA_NLDEV_PRINT_TYPE_HEX:
> > > + return pr_out("%s 0x%x ", key_str, val);
> > > + default:
> > > + return -EINVAL;
> > > + }
> > > +}
> > > +
> >
> > This code should get converted to json_print library that handles the
> > different output modes; rather than rolling it's own equivalent functionality.
>
> Can it be done after this patch is merged? It will simplify review and
> testing because current code is implemented to be in the same format as
> the rest of the tool.
>
> Thanks
Sure, I was just encouraging future direction.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2018-05-02 14:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-30 15:01 [PATCH RFC iproute2-next 0/2] RDMA tool provider resource tracking Steve Wise
2018-04-30 14:36 ` [PATCH RFC iproute2-next 1/2] rdma: update rdma_netlink.h to get provider attrs Steve Wise
2018-05-02 15:17 ` David Ahern
2018-04-30 14:36 ` [PATCH RFC iproute2-next 2/2] rdma: print provider resource attributes Steve Wise
2018-04-30 15:25 ` Stephen Hemminger
2018-05-02 13:38 ` Leon Romanovsky
2018-05-02 14:32 ` Stephen Hemminger [this message]
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=20180502073216.0794a08a@xeon-e3 \
--to=stephen@networkplumber.org \
--cc=dsahern@gmail.com \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=swise@opengridcomputing.com \
/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).