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:   Mon, 20 Jul 2020 10:44:35 -0600
From:   David Ahern <dsahern@...il.com>
To:     Moshe Shemesh <moshe@...lanox.com>,
        Stephen Hemminger <stephen@...workplumber.org>
Cc:     Jiri Pirko <jiri@...lanox.com>, netdev@...r.kernel.org,
        Vladyslav Tarasiuk <vladyslavt@...lanox.com>
Subject: Re: [PATCH iproute2-next 1/3] devlink: Add a possibility to print
 arrays of devlink port handles

On 7/19/20 7:36 AM, Moshe Shemesh wrote:
> From: Vladyslav Tarasiuk <vladyslavt@...lanox.com>
> 
> Add a capability of printing port handles for arrays in non-JSON format
> in devlink-health manner.
> 
> Signed-off-by: Vladyslav Tarasiuk <vladyslavt@...lanox.com>
> Reviewed-by: Jiri Pirko <jiri@...lanox.com>
> ---
>  devlink/devlink.c |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 
> diff --git a/devlink/devlink.c b/devlink/devlink.c
> index 6768149..bb4588e 100644
> --- a/devlink/devlink.c
> +++ b/devlink/devlink.c
> @@ -2112,7 +2112,19 @@ static void __pr_out_port_handle_start(struct dl *dl, const char *bus_name,
>  			open_json_object(buf);
>  		}
>  	} else {
> -		pr_out("%s:", buf);
> +		if (array) {
> +			if (should_arr_last_port_handle_end(dl, bus_name, dev_name, port_index))
> +				__pr_out_indent_dec();
> +			if (should_arr_last_port_handle_start(dl, bus_name,
> +							      dev_name, port_index)) {
> +				pr_out("%s:", buf);
> +				__pr_out_newline();
> +				__pr_out_indent_inc();
> +				arr_last_port_handle_set(dl, bus_name, dev_name, port_index);
> +			}
> +		} else {
> +			pr_out("%s:", buf);
> +		}
>  	}
>  }
>  
> 

Why can't the 'if (dl->json_output) {' check be removed and this part be
folded in with the context handled automatically by the print functions?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ