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: <b0cc6bd4-e4e6-22ba-429d-4cea7996ccd4@gmail.com>
Date:   Sun, 1 Nov 2020 16:55:42 -0700
From:   David Ahern <dsahern@...il.com>
To:     Petr Machata <me@...chata.org>, David Ahern <dsahern@...il.com>
Cc:     netdev@...r.kernel.org, stephen@...workplumber.org,
        john.fastabend@...il.com, jiri@...dia.com, idosch@...dia.com,
        Jakub Kicinski <kuba@...nel.org>,
        Roman Mashak <mrv@...atatu.com>,
        Leon Romanovsky <leon@...nel.org>
Subject: Re: [PATCH iproute2-next v2 03/11] lib: utils: Add
 print_on_off_bool()

On 10/31/20 3:23 PM, Petr Machata wrote:
> 
> David Ahern <dsahern@...il.com> writes:
> 
>> On 10/30/20 6:29 AM, Petr Machata wrote:
>>> diff --git a/lib/utils.c b/lib/utils.c
>>> index 930877ae0f0d..8deec86ecbcd 100644
>>> --- a/lib/utils.c
>>> +++ b/lib/utils.c
>>> @@ -1763,3 +1763,11 @@ int parse_on_off(const char *msg, const char *realval, int *p_err)
>>>
>>>  	return parse_one_of(msg, realval, values_on_off, ARRAY_SIZE(values_on_off), p_err);
>>>  }
>>> +
>>> +void print_on_off_bool(FILE *fp, const char *flag, bool val)
>>> +{
>>> +	if (is_json_context())
>>> +		print_bool(PRINT_JSON, flag, NULL, val);
>>> +	else
>>> +		fprintf(fp, "%s %s ", flag, val ? "on" : "off");
>>> +}
>>>
>>
>> I think print_on_off should be fine and aligns with parse_on_off once it
>> returns a bool.
> 
> print_on_off() is already used in the RDMA tool, and actually outputs
> "on" and "off", unlike this. So I chose this instead.
> 
> I could rename the RDMA one though -- it's used in two places, whereas
> this is used in about two dozen instances across the codebase.
> 

yes, the rdma utils are using generic function names. The rdma version
should be renamed; perhaps rd_print_on_off. That seems to be once common
prefix. Added Leon.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ