From mboxrd@z Thu Jan 1 00:00:00 1970 From: Serhey Popovych Subject: [PATCH iproute2-next v2 0/3] ip/tunnel: Unify tunnel help message print routines Date: Fri, 9 Feb 2018 08:44:59 +0200 Message-ID: <1518158702-32604-1-git-send-email-serhe.popovych@gmail.com> To: netdev@vger.kernel.org Return-path: Received: from mail-lf0-f46.google.com ([209.85.215.46]:33099 "EHLO mail-lf0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750778AbeBIGpY (ORCPT ); Fri, 9 Feb 2018 01:45:24 -0500 Received: by mail-lf0-f46.google.com with SMTP id t139so9783392lff.0 for ; Thu, 08 Feb 2018 22:45:23 -0800 (PST) Received: from tuxracer.localdomain ([2a01:6d80::195:20:96:53]) by smtp.gmail.com with ESMTPSA id h1sm299682ljc.40.2018.02.08.22.45.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Feb 2018 22:45:21 -0800 (PST) Sender: netdev-owner@vger.kernel.org List-ID: 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. 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 | 33 +++++++++----------- 6 files changed, 165 insertions(+), 190 deletions(-) -- 1.7.10.4