netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2-next v3 0/3] ip/tunnel: Unify tunnel help message print routines
@ 2018-02-09  6:58 Serhey Popovych
  2018-02-09  6:58 ` [PATCH iproute2-next v3 1/3] vti/vti6: Unify vti_print_help() Serhey Popovych
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Serhey Popovych @ 2018-02-09  6:58 UTC (permalink / raw)
  To: netdev

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 <help|garbage>" 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 <kind>" and
"ip link add type help" commands. Looks correct.

See individual patch description for more information.

Reviews, commands and suggestions are welcome.

v3
  Address commit message format issues and checkpatch in link_vti6.c

v2
  Dropped function prefix changes from the series: this is not strictly
  relared change and should be done separately.

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 |   45 ++++++++++++++--------------
 ip/link_iptnl.c  |   88 ++++++++++++++++++++++++++----------------------------
 ip/link_vti.c    |   42 +++++++++++---------------
 ip/link_vti6.c   |   34 ++++++++++-----------
 6 files changed, 166 insertions(+), 190 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-09 16:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-09  6:58 [PATCH iproute2-next v3 0/3] ip/tunnel: Unify tunnel help message print routines Serhey Popovych
2018-02-09  6:58 ` [PATCH iproute2-next v3 1/3] vti/vti6: Unify vti_print_help() Serhey Popovych
2018-02-09  6:58 ` [PATCH iproute2-next v3 2/3] gre/gre6: Unify gre_print_help() Serhey Popovych
2018-02-09  6:58 ` [PATCH iproute2-next v3 3/3] iptnl/ip6tnl: Unify iptunnel_print_help() Serhey Popovych
2018-02-09 16:09 ` [PATCH iproute2-next v3 0/3] ip/tunnel: Unify tunnel help message print routines David Ahern

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).