Re: [PATCH iproute2-next 0/3] ip/tunnel: Unify tunnel help message print routines

2018-02-08 Thread Serhey Popovych
David Ahern wrote:
> On 2/8/18 8:35 PM, David Ahern wrote:
>> On 2/8/18 3:50 AM, Serhey Popovych wrote:
>>> To show only relevant diffs of ip and ipv6 variants help message print
>>> routines needs to be unified and improved.
>>>
>>> Get rid of print_usage() and usage() wrappers: use single function to
>>> output help message. As side effect we return -1 from parse function
>>> instead of calling exit(2) in case of "... tunnel " is
>>> found.
>>>
>>> Additionally we get pointer to @struct link_util and can directly access
>>> ->id information to prepare customized help message.
>>>
>>> Split calls to fprintf() two group: one that contains format string with
>>> specifiers (thus requiring parameters) and another one that does not.
>>> This helps compiler to optimize calls to fprintf() with fputs() when no
>>> format specifiers in string. Do not use fputs() directly to keep code
>>> formatting nice.
>>>
>>> After this series applied following diffs:
>>>
>>>   # diff -urN ip/link_gre{,6}.c
>>>   # diff -urN ip/link_vti{,6}.c
>>>   # diff -urN ip/link_ip{,6}tnl.c
>>>
>>> in scope of help print routines reduced to necessary minimum.
>>>
>>> Tested minimally by compiling and executing "ip link help " and
>>> "ip link add type help" commands. Looks correct.
>>>
>>> See individual patch description for more information.
>>
>> Series applied to iproute2-next
>>
>>
> 
> 
> I take that back. Before pushing I noticed you dropped the '6' from the
> name all of the ipv6 print_help functions. Why?
> 

You are right. I probably should not do that change in this series. Will
send v2. There is no '6' in name for link_gre6.c for example so I
decided to drop it from the rest to reduce number of diffs.

Sorry for this.



signature.asc
Description: OpenPGP digital signature


Re: [PATCH iproute2-next 0/3] ip/tunnel: Unify tunnel help message print routines

2018-02-08 Thread David Ahern
On 2/8/18 8:35 PM, David Ahern wrote:
> On 2/8/18 3:50 AM, Serhey Popovych wrote:
>> To show only relevant diffs of ip and ipv6 variants help message print
>> routines needs to be unified and improved.
>>
>> Get rid of print_usage() and usage() wrappers: use single function to
>> output help message. As side effect we return -1 from parse function
>> instead of calling exit(2) in case of "... tunnel " is
>> found.
>>
>> Additionally we get pointer to @struct link_util and can directly access
>> ->id information to prepare customized help message.
>>
>> Split calls to fprintf() two group: one that contains format string with
>> specifiers (thus requiring parameters) and another one that does not.
>> This helps compiler to optimize calls to fprintf() with fputs() when no
>> format specifiers in string. Do not use fputs() directly to keep code
>> formatting nice.
>>
>> After this series applied following diffs:
>>
>>   # diff -urN ip/link_gre{,6}.c
>>   # diff -urN ip/link_vti{,6}.c
>>   # diff -urN ip/link_ip{,6}tnl.c
>>
>> in scope of help print routines reduced to necessary minimum.
>>
>> Tested minimally by compiling and executing "ip link help " and
>> "ip link add type help" commands. Looks correct.
>>
>> See individual patch description for more information.
> 
> Series applied to iproute2-next
> 
> 


I take that back. Before pushing I noticed you dropped the '6' from the
name all of the ipv6 print_help functions. Why?


Re: [PATCH iproute2-next 0/3] ip/tunnel: Unify tunnel help message print routines

2018-02-08 Thread David Ahern
On 2/8/18 3:50 AM, Serhey Popovych wrote:
> To show only relevant diffs of ip and ipv6 variants help message print
> routines needs to be unified and improved.
> 
> Get rid of print_usage() and usage() wrappers: use single function to
> output help message. As side effect we return -1 from parse function
> instead of calling exit(2) in case of "... tunnel " is
> found.
> 
> Additionally we get pointer to @struct link_util and can directly access
> ->id information to prepare customized help message.
> 
> Split calls to fprintf() two group: one that contains format string with
> specifiers (thus requiring parameters) and another one that does not.
> This helps compiler to optimize calls to fprintf() with fputs() when no
> format specifiers in string. Do not use fputs() directly to keep code
> formatting nice.
> 
> After this series applied following diffs:
> 
>   # diff -urN ip/link_gre{,6}.c
>   # diff -urN ip/link_vti{,6}.c
>   # diff -urN ip/link_ip{,6}tnl.c
> 
> in scope of help print routines reduced to necessary minimum.
> 
> Tested minimally by compiling and executing "ip link help " and
> "ip link add type help" commands. Looks correct.
> 
> See individual patch description for more information.

Series applied to iproute2-next




[PATCH iproute2-next 0/3] ip/tunnel: Unify tunnel help message print routines

2018-02-08 Thread Serhey Popovych
To show only relevant diffs of ip and ipv6 variants help message print
routines needs to be unified and improved.

Get rid of print_usage() and usage() wrappers: use single function to
output help message. As side effect we return -1 from parse function
instead of calling exit(2) in case of "... tunnel " is
found.

Additionally we get pointer to @struct link_util and can directly access
->id information to prepare customized help message.

Split calls to fprintf() two group: one that contains format string with
specifiers (thus requiring parameters) and another one that does not.
This helps compiler to optimize calls to fprintf() with fputs() when no
format specifiers in string. Do not use fputs() directly to keep code
formatting nice.

After this series applied following diffs:

  # diff -urN ip/link_gre{,6}.c
  # diff -urN ip/link_vti{,6}.c
  # diff -urN ip/link_ip{,6}tnl.c

in scope of help print routines reduced to necessary minimum.

Tested minimally by compiling and executing "ip link help " and
"ip link add type help" commands. Looks correct.

See individual patch description for more information.

Reviews, commands and suggestions are welcome.

Thanks,
Serhii

Serhey Popovych (3):
  vti/vti6: Unify vti_print_help()
  gre/gre6: Unify gre_print_help()
  iptnl/ip6tnl: Unify iptunnel_print_help()

 ip/link_gre.c|   73 
 ip/link_gre6.c   |   74 +
 ip/link_ip6tnl.c |   58 ++-
 ip/link_iptnl.c  |   88 ++
 ip/link_vti.c|   42 +++---
 ip/link_vti6.c   |   45 +---
 6 files changed, 178 insertions(+), 202 deletions(-)

-- 
1.7.10.4