From patchwork Tue Apr 9 13:11:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10891257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 601841805 for ; Tue, 9 Apr 2019 13:11:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43026288B3 for ; Tue, 9 Apr 2019 13:11:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 41827288EF; Tue, 9 Apr 2019 13:11:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 063DA288B3 for ; Tue, 9 Apr 2019 13:11:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726531AbfDINLq (ORCPT ); Tue, 9 Apr 2019 09:11:46 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:35116 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727324AbfDINLp (ORCPT ); Tue, 9 Apr 2019 09:11:45 -0400 Received: by mail-qt1-f194.google.com with SMTP id h39so1477576qte.2 for ; Tue, 09 Apr 2019 06:11:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xzTxoEi2yCbQU5dHrmnCjWW7dr8Rnebt8yp+BxTATYs=; b=LIcCdQIKmPK3LESn2jLCzznXZSKkrHDasMjCmglSBzDgL4wjuzhH4BX5j2zLWVyaVR w6vwHUDKynsbcMb9gTg2vy+xnv4wcmnpv7lyn3pzgkcj528nixLTmWou0v9KR/qkXORQ sXfpATzSq7SZnFftms/NITJmyso4KqMt6pci9QZajJUBqmMV7tI4V0HvqMRgqXgduZWu Vb/vAMjgvvLRs9OWEBf9cLKFFY8S40z8uPstPfgMtIy+dQ0iXq6WsN6Teq63XV8DELL4 GhEPsPJ3ZbXpzb2DiO8bj6zdYpI0EkCu/QLLIMMLoxU5jhwLgumZzQydnVwbjKg9FHBg L/OQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xzTxoEi2yCbQU5dHrmnCjWW7dr8Rnebt8yp+BxTATYs=; b=EgPG/J4b3fS8fCCsiK+raQSHHWfkKus8JKhtrqvKg3sIfkhrIrzUxS93rOqiouVtwf 98zeyyX0f7bEECwWC95X/zvzIAFKU5hnKJ+4tNWBgah6mvx1XrUNwHslmJCA+GZoFnHt +qZJNAQzwMNTKyeiNsXCuvlDooVczUzBnRMez3OPjkOvEqnyzdejiLELz1Xh79DUiW+4 OszmPvGOUcN6cohRfTYXzSU63xd2qp9Usr5Uibn/dNiducUXhsukcTKwXMURVIOjWNEv 2jm1+8W8R33Vxl4mQi6bqz2qWrZj5pM/qPK/OOvMFaSh3WRpdEX5T46VEOMLsYNy9Am3 TDew== X-Gm-Message-State: APjAAAXrfxaR6DEYLOjfX9Ph85utDSBSUR575+FCANAUy9Jn1mxecSjH cqOvJ/2jgmIsj4AaiWvDlWFV8E6udIM= X-Google-Smtp-Source: APXvYqyQ1Knd1LCyCOTEhOHhIrmwEe/FJI0bI3PCzl8Fx5ySjhU0+WVLIebwUzobrsqQ4TGx4sn7fw== X-Received: by 2002:ac8:3216:: with SMTP id x22mr30236660qta.114.1554815503992; Tue, 09 Apr 2019 06:11:43 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-49-251.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.49.251]) by smtp.gmail.com with ESMTPSA id n201sm17855465qka.10.2019.04.09.06.11.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 09 Apr 2019 06:11:37 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hDqXH-0004EO-Pl; Tue, 09 Apr 2019 10:11:35 -0300 From: Jason Gunthorpe To: linux-rdma@vger.kernel.org Cc: Jason Gunthorpe Subject: [PATCH ibdiags 06/16] ibdiags: Do not use optarg for process_opt Date: Tue, 9 Apr 2019 10:11:23 -0300 Message-Id: <20190409131133.16140-7-jgg@ziepe.ca> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409131133.16140-1-jgg@ziepe.ca> References: <20190409131133.16140-1-jgg@ziepe.ca> MIME-Version: 1.0 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jason Gunthorpe Avoid a -Wshadow warning from gcc, access the global directly instead. Signed-off-by: Jason Gunthorpe --- include/ibdiag_common.h | 3 +-- src/dump_fts.c | 3 +-- src/ibaddr.c | 3 +-- src/ibcacheedit.c | 3 +-- src/ibccconfig.c | 3 +-- src/ibccquery.c | 3 +-- src/ibdiag_common.c | 11 +++++------ src/iblinkinfo.c | 3 +-- src/ibnetdiscover.c | 3 +-- src/ibping.c | 3 +-- src/ibportstate.c | 1 - src/ibqueryerrors.c | 3 +-- src/ibroute.c | 3 +-- src/ibsendtrap.c | 1 - src/ibstat.c | 3 +-- src/ibsysstat.c | 3 +-- src/ibtracert.c | 3 +-- src/perfquery.c | 3 +-- src/saquery.c | 3 +-- src/sminfo.c | 3 +-- src/smpdump.c | 3 +-- src/smpquery.c | 3 +-- src/vendstat.c | 3 +-- 23 files changed, 25 insertions(+), 48 deletions(-) diff --git a/include/ibdiag_common.h b/include/ibdiag_common.h index 34f8eb7cdf3674..6e7ec3851bb190 100644 --- a/include/ibdiag_common.h +++ b/include/ibdiag_common.h @@ -135,8 +135,7 @@ struct ibdiag_opt { extern int ibdiag_process_opts(int argc, char *const argv[], void *context, const char *exclude_common_str, const struct ibdiag_opt custom_opts[], - int (*custom_handler) (void *cxt, int val, - char *optarg), + int (*custom_handler) (void *cxt, int val), const char *usage_args, const char *usage_examples[]); extern void ibdiag_show_usage(void); diff --git a/src/dump_fts.c b/src/dump_fts.c index 3a9299d174e441..b22282b4935bfe 100644 --- a/src/dump_fts.c +++ b/src/dump_fts.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -394,7 +393,7 @@ static void process_switch(ibnd_node_t *node, void *fabric) dump_node(node, srcport, (ibnd_fabric_t *)fabric); } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'a': diff --git a/src/ibaddr.c b/src/ibaddr.c index 1a721d0a003f23..c13f3bfc5c7976 100644 --- a/src/ibaddr.c +++ b/src/ibaddr.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -91,7 +90,7 @@ static int ib_resolve_addr(ib_portid_t * portid, int portnum, int show_lid, static int show_lid, show_gid; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'g': diff --git a/src/ibcacheedit.c b/src/ibcacheedit.c index 904089b3b2e8e8..e8dc244e051f77 100644 --- a/src/ibcacheedit.c +++ b/src/ibcacheedit.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -126,7 +125,7 @@ static int parse_guidbeforeafter(char *arg, return 0; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 1: diff --git a/src/ibccconfig.c b/src/ibccconfig.c index 19a075aa9dd435..54a501ee6cc910 100644 --- a/src/ibccconfig.c +++ b/src/ibccconfig.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -545,7 +544,7 @@ static const char *congestion_control_table(ib_portid_t *dest, char **argv, return NULL; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'c': diff --git a/src/ibccquery.c b/src/ibccquery.c index 9bcbf8645b7bd6..0882983c2ddeac 100644 --- a/src/ibccquery.c +++ b/src/ibccquery.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #define __STDC_FORMAT_MACROS @@ -340,7 +339,7 @@ static const char *timestamp_dump(ib_portid_t *dest, char **argv, int argc) return NULL; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'c': diff --git a/src/ibdiag_common.c b/src/ibdiag_common.c index 962527e0c6feab..cdb099dd3771a3 100644 --- a/src/ibdiag_common.c +++ b/src/ibdiag_common.c @@ -212,7 +212,7 @@ void ibdiag_show_usage(void) exit(2); } -static int process_opt(int ch, char *optarg) +static int process_opt(int ch) { char *endp; long val; @@ -373,8 +373,7 @@ static void make_str_opts(const struct option *o, char *p, unsigned size) int ibdiag_process_opts(int argc, char *const argv[], void *cxt, const char *exclude_common_str, const struct ibdiag_opt custom_opts[], - int (*custom_handler) (void *cxt, int val, - char *optarg), + int (*custom_handler) (void *cxt, int val), const char *usage_args, const char *usage_examples[]) { char str_opts[1024]; @@ -403,10 +402,10 @@ int ibdiag_process_opts(int argc, char *const argv[], void *cxt, if (!o) ibdiag_show_usage(); if (custom_handler) { - if (custom_handler(cxt, ch, optarg) && - process_opt(ch, optarg)) + if (custom_handler(cxt, ch) && + process_opt(ch)) ibdiag_show_usage(); - } else if (process_opt(ch, optarg)) + } else if (process_opt(ch)) ibdiag_show_usage(); } diff --git a/src/iblinkinfo.c b/src/iblinkinfo.c index e5f5b9a7e2d3fa..c838afebdaef3b 100644 --- a/src/iblinkinfo.c +++ b/src/iblinkinfo.c @@ -45,7 +45,6 @@ #include #include #include -#include #include #include @@ -513,7 +512,7 @@ static int diff_node(ibnd_node_t *node, ibnd_fabric_t *orig_fabric, return 0; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { struct ibnd_config *cfg = context; char *p; diff --git a/src/ibnetdiscover.c b/src/ibnetdiscover.c index 91ce56bf011b4d..9a5b3d515c32c3 100644 --- a/src/ibnetdiscover.c +++ b/src/ibnetdiscover.c @@ -44,7 +44,6 @@ #include #include #include -#include #include #include @@ -991,7 +990,7 @@ static int diff(ibnd_fabric_t *orig_fabric, ibnd_fabric_t *new_fabric) static int list, group, ports_report; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { struct ibnd_config *cfg = context; char *p; diff --git a/src/ibping.c b/src/ibping.c index b463043ae73eb6..591619a0b6709b 100644 --- a/src/ibping.c +++ b/src/ibping.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -175,7 +174,7 @@ static void report(int sig) static int server = 0, flood = 0; static unsigned count = ~0; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'c': diff --git a/src/ibportstate.c b/src/ibportstate.c index 75eafc5f12970b..f733cf8eab2a92 100644 --- a/src/ibportstate.c +++ b/src/ibportstate.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include diff --git a/src/ibqueryerrors.c b/src/ibqueryerrors.c index fa3321c5c6c853..f86daaab9a8374 100644 --- a/src/ibqueryerrors.c +++ b/src/ibqueryerrors.c @@ -46,7 +46,6 @@ #include #include #include -#include #include #include @@ -899,7 +898,7 @@ static void calculate_suppressed_fields(char *str) free(tmp); } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { struct ibnd_config *cfg = context; switch (ch) { diff --git a/src/ibroute.c b/src/ibroute.c index 76dab8940c49d4..15d726035bff19 100644 --- a/src/ibroute.c +++ b/src/ibroute.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include @@ -396,7 +395,7 @@ static const char *dump_unicast_tables(ib_portid_t *portid, int startlid, return 0; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'a': diff --git a/src/ibsendtrap.c b/src/ibsendtrap.c index b6751a957c9183..dd1a92722824e0 100644 --- a/src/ibsendtrap.c +++ b/src/ibsendtrap.c @@ -43,7 +43,6 @@ #include #define _GNU_SOURCE -#include #include #include diff --git a/src/ibstat.c b/src/ibstat.c index a6deccf5a91770..308e29118df654 100644 --- a/src/ibstat.c +++ b/src/ibstat.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include #include @@ -260,7 +259,7 @@ static int ports_list(char names[][UMAD_CA_NAME_LEN], int n) static int list_only, short_format, list_ports; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'l': diff --git a/src/ibsysstat.c b/src/ibsysstat.c index d49eafc63e4b23..9c2da8e7fd4884 100644 --- a/src/ibsysstat.c +++ b/src/ibsysstat.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -296,7 +295,7 @@ static int build_cpuinfo(void) return ncpu; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'o': diff --git a/src/ibtracert.c b/src/ibtracert.c index 98911db1442236..91461217bf705f 100644 --- a/src/ibtracert.c +++ b/src/ibtracert.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -756,7 +755,7 @@ static int resolve_lid(ib_portid_t *portid) static int dumplevel = 2, multicast, mlid; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 1: diff --git a/src/perfquery.c b/src/perfquery.c index 91fe94e74dafbe..b0baa3bec7d3bf 100644 --- a/src/perfquery.c +++ b/src/perfquery.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include @@ -716,7 +715,7 @@ static void dump_portsamples_control(ib_portid_t *portid, int port) port, buf); } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'x': diff --git a/src/saquery.c b/src/saquery.c index d9c5d387046807..b882b2bdaf08ba 100644 --- a/src/saquery.c +++ b/src/saquery.c @@ -50,7 +50,6 @@ #include #define _GNU_SOURCE -#include #include #include @@ -1521,7 +1520,7 @@ static enum saquery_command command = SAQUERY_CMD_QUERY; static uint16_t query_type; static char *src_lid, *dst_lid; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { struct query_params *p = context; diff --git a/src/sminfo.c b/src/sminfo.c index caec7cf00d5f3d..7e6a18a41e12fc 100644 --- a/src/sminfo.c +++ b/src/sminfo.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #include @@ -74,7 +73,7 @@ const char *const statestr[] = { static unsigned act; static int prio, state = SMINFO_STANDBY; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 'a': diff --git a/src/smpdump.c b/src/smpdump.c index 3f80ef56ca5868..beb7168bd9aab9 100644 --- a/src/smpdump.c +++ b/src/smpdump.c @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -152,7 +151,7 @@ static int str2DRPath(char *str, DRPath * path) static int dump_char, mgmt_class = IB_SMI_CLASS; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 's': diff --git a/src/smpquery.c b/src/smpquery.c index 4a104174fdcb34..5254d131de2b29 100644 --- a/src/smpquery.c +++ b/src/smpquery.c @@ -40,7 +40,6 @@ #include #include #include -#include #include #define __STDC_FORMAT_MACROS @@ -411,7 +410,7 @@ static const char *guid_info(ib_portid_t *dest, char **argv, int argc) return 0; } -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { switch (ch) { case 1: diff --git a/src/vendstat.c b/src/vendstat.c index e9916da1a9f456..f7c17578be837c 100644 --- a/src/vendstat.c +++ b/src/vendstat.c @@ -39,7 +39,6 @@ #include #include #include -#include #include #include @@ -291,7 +290,7 @@ static is3_config_space_t write_cs, read_cs; static unsigned write_cs_records, read_cs_records; -static int process_opt(void *context, int ch, char *optarg) +static int process_opt(void *context, int ch) { int ret; switch (ch) {