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]
Date:   Wed, 2 May 2018 16:38:52 +0300
From:   Leon Romanovsky <leon@...nel.org>
To:     Stephen Hemminger <stephen@...workplumber.org>
Cc:     Steve Wise <swise@...ngridcomputing.com>, dsahern@...il.com,
        netdev@...r.kernel.org, linux-rdma@...r.kernel.org
Subject: Re: [PATCH RFC iproute2-next 2/2] rdma: print provider resource
 attributes

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@...ngridcomputing.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

Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ