From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6D058A04AF; Sun, 3 May 2020 22:32:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D41691D532; Sun, 3 May 2020 22:32:25 +0200 (CEST) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by dpdk.org (Postfix) with ESMTP id 6FDBC1D52B for ; Sun, 3 May 2020 22:32:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588537943; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jwLArlOAImSvqi3uQvKcXQv4IO8pCHM1WmwREFG8XMQ=; b=FvWPDngn/pyU1HLD2EtMEfYEjsm26pfs7DIl+JMPfwb+TWiKLgQgRR0c0dskvWUJKOb/a6 0cjdPRVbAc7AeeWKxr3jaM/1YWOjXb10wi6lriysQE/SK1l1PyFHC7N1LGdQRUuqR3AhH6 nntKKwbcFhYkvh3p+ude3fCxEmIc/D8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-166-LnhfKoBkO6OPE7Kjmb5sCg-1; Sun, 03 May 2020 16:32:20 -0400 X-MC-Unique: LnhfKoBkO6OPE7Kjmb5sCg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 755CD1895944; Sun, 3 May 2020 20:32:19 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.192.236]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9BC3A6F972; Sun, 3 May 2020 20:32:17 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, Jerin Jacob , Sunil Kumar Kori Date: Sun, 3 May 2020 22:31:31 +0200 Message-Id: <20200503203135.6493-5-david.marchand@redhat.com> In-Reply-To: <20200503203135.6493-1-david.marchand@redhat.com> References: <20200503203135.6493-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Subject: [dpdk-dev] [PATCH 4/8] trace: avoid confusion on optarg X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Prefer a local name to optarg which is a global symbol from the C library. Fixes: 8c8066ea6a7b ("trace: add trace mode configuration parameter") Signed-off-by: David Marchand --- .../common/eal_common_trace_utils.c | 32 +++++++++---------- lib/librte_eal/common/eal_trace.h | 8 ++--- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/librte_eal/common/eal_common_trace_utils.c b/lib/librte_ea= l/common/eal_common_trace_utils.c index fce8892c38..a7c5893b00 100644 --- a/lib/librte_eal/common/eal_common_trace_utils.c +++ b/lib/librte_eal/common/eal_common_trace_utils.c @@ -135,7 +135,7 @@ trace_dir_update(const char *str) } =20 int -eal_trace_args_save(const char *optarg) +eal_trace_args_save(const char *val) { =09struct trace *trace =3D trace_obj_get(); =09char *trace_args; @@ -144,17 +144,17 @@ eal_trace_args_save(const char *optarg) =09nb_args =3D trace->args.nb_args; =20 =09if (nb_args >=3D TRACE_MAX_ARGS) { -=09=09trace_err("ignoring trace %s as limit exceeds", optarg); +=09=09trace_err("ignoring trace %s as limit exceeds", val); =09=09return 0; =09} =20 -=09trace_args =3D calloc(1, (strlen(optarg) + 1)); +=09trace_args =3D calloc(1, (strlen(val) + 1)); =09if (trace_args =3D=3D NULL) { -=09=09trace_err("fail to allocate memory for %s", optarg); +=09=09trace_err("fail to allocate memory for %s", val); =09=09return -ENOMEM; =09} =20 -=09memcpy(trace_args, optarg, strlen(optarg)); +=09memcpy(trace_args, val, strlen(val)); =09trace->args.args[nb_args++] =3D trace_args; =09trace->args.nb_args =3D nb_args; =09return 0; @@ -194,17 +194,17 @@ trace_args_apply(const char *arg) } =20 int -eal_trace_bufsz_args_save(char const *optarg) +eal_trace_bufsz_args_save(char const *val) { =09struct trace *trace =3D trace_obj_get(); =09uint64_t bufsz; =20 -=09if (optarg =3D=3D NULL) { +=09if (val =3D=3D NULL) { =09=09trace_err("no optarg is passed"); =09=09return -EINVAL; =09} =20 -=09bufsz =3D rte_str_to_size(optarg); +=09bufsz =3D rte_str_to_size(val); =09if (bufsz =3D=3D 0) { =09=09trace_err("buffer size cannot be zero"); =09=09return -EINVAL; @@ -224,14 +224,14 @@ trace_bufsz_args_apply(void) } =20 int -eal_trace_mode_args_save(const char *optarg) +eal_trace_mode_args_save(const char *val) { =09struct trace *trace =3D trace_obj_get(); -=09size_t len =3D strlen(optarg); +=09size_t len =3D strlen(val); =09unsigned long tmp; =09char *pattern; =20 -=09if (optarg =3D=3D NULL) { +=09if (val =3D=3D NULL) { =09=09trace_err("no optarg is passed"); =09=09return -EINVAL; =09} @@ -247,7 +247,7 @@ eal_trace_mode_args_save(const char *optarg) =09=09return -ENOMEM; =09} =20 -=09sprintf(pattern, "%s*", optarg); +=09sprintf(pattern, "%s*", val); =20 =09if (fnmatch(pattern, "overwrite", 0) =3D=3D 0) =09=09tmp =3D RTE_TRACE_MODE_OVERWRITE; @@ -264,19 +264,19 @@ eal_trace_mode_args_save(const char *optarg) } =20 int -eal_trace_dir_args_save(char const *optarg) +eal_trace_dir_args_save(char const *val) { =09struct trace *trace =3D trace_obj_get(); =09uint32_t size =3D sizeof(trace->dir); =09char *dir_path =3D NULL; =09int rc; =20 -=09if (optarg =3D=3D NULL) { +=09if (val =3D=3D NULL) { =09=09trace_err("no optarg is passed"); =09=09return -EINVAL; =09} =20 -=09if (strlen(optarg) >=3D size) { +=09if (strlen(val) >=3D size) { =09=09trace_err("input string is too big"); =09=09return -ENAMETOOLONG; =09} @@ -287,7 +287,7 @@ eal_trace_dir_args_save(char const *optarg) =09=09return -ENOMEM; =09} =20 -=09sprintf(dir_path, "%s/", optarg); +=09sprintf(dir_path, "%s/", val); =09rc =3D trace_dir_update(dir_path); =20 =09free(dir_path); diff --git a/lib/librte_eal/common/eal_trace.h b/lib/librte_eal/common/eal_= trace.h index f53ccc0d50..7d95bd2aa9 100644 --- a/lib/librte_eal/common/eal_trace.h +++ b/lib/librte_eal/common/eal_trace.h @@ -111,10 +111,10 @@ void trace_mem_per_thread_free(void); /* EAL interface */ int eal_trace_init(void); void eal_trace_fini(void); -int eal_trace_args_save(const char *optarg); +int eal_trace_args_save(const char *val); void eal_trace_args_free(void); -int eal_trace_dir_args_save(const char *optarg); -int eal_trace_mode_args_save(const char *optarg); -int eal_trace_bufsz_args_save(const char *optarg); +int eal_trace_dir_args_save(const char *val); +int eal_trace_mode_args_save(const char *val); +int eal_trace_bufsz_args_save(const char *val); =20 #endif /* __EAL_TRACE_H */ --=20 2.23.0