From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7134E42BF9; Thu, 1 Jun 2023 00:05:53 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2E2A34282D; Thu, 1 Jun 2023 00:05:47 +0200 (CEST) Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) by mails.dpdk.org (Postfix) with ESMTP id 0E2CD406B3 for ; Thu, 1 Jun 2023 00:05:46 +0200 (CEST) Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-1b011cffe7fso809885ad.1 for ; Wed, 31 May 2023 15:05:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20221208.gappssmtp.com; s=20221208; t=1685570745; x=1688162745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=f/aMPsznXrBTMh4bSGTj+TgnvJi8WP76XRMDNB8O0OA=; b=ve/RR7ypn2rcSsr9yj6K9VHq5M8XlrKlwXsweQHFL41cOeAXnKlEG3qsijh8BKwWkm MUaMvdfA7bGRY8L5HhF6sklD4B1sDwoBIGN6RYPgObnnAIJERWAobRp6f7kEpQfKf1cl 0Nl2kUhSH7JC6M8uZD6xuFpMoNYllIMkGI2qUAz2kQfDk+pFaziSS2YJciALwDRecr+5 AWc428agvwuqKyfwPXdioFLbqo4qgcKQN402FG0Gu47z1iwpAeAAlYCVW2T+OPwGPZER Vn53f86L3LGFbZ6wEDyvkCxvXvdgt4sA0Ynjd7rfw5p50BUcMdOWxHcJuAxEYnhBFgPh TNkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685570745; x=1688162745; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f/aMPsznXrBTMh4bSGTj+TgnvJi8WP76XRMDNB8O0OA=; b=W9o3kSs3338PmnjUy/TMkQ/ix85L/sh7L+Y5BDojxJkcAiyr/0ptDX6d0k+SLNaCTM F8wacvxNASQqiOxjdTnAg6Q5hZxMAY2sam5UtEAF9VQtGyXpurMuMPdy3Pp3C2EjI51y IRVmN5yRbm9cUXt5GCYpeFzs6IWiFGaaAogw3UyWAaiWK1cy6OsrfSTHsy+KbLmqpoBd Jry8TzUrUP8bSs7LvXqecebheVu3d7aqCbSXeUpnXzBbRvwQOIfAYV55fGlI8Rtp8BNV y/pI02zVqmR7cNGtN2t90FejxSfSoSO9RhVfOq/mEJRgIwtIPXloThEjYX45dCAr4lJH Jx3g== X-Gm-Message-State: AC+VfDzgtNKPTNk0AsoTYJU4QA3EnEiJMu34tJrIM+iD/lkpsIlxvQzE r6D+Iy7ewGm8NAMj/YTaMJ0P6YY2eLPi+d6yFSV3Kw== X-Google-Smtp-Source: ACHHUZ6rJcxdJAKMntDX/sv/3FJzMqYavDrh9o38vmB8+ny43D0GprsnQhxYhZaVD6jxC7uFgTlMPA== X-Received: by 2002:a17:902:7d8e:b0:1af:d4f0:1dbe with SMTP id a14-20020a1709027d8e00b001afd4f01dbemr4940952plm.23.1685570744959; Wed, 31 May 2023 15:05:44 -0700 (PDT) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id g23-20020a1709029f9700b001b077301b15sm1888623plq.156.2023.05.31.15.05.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 May 2023 15:05:44 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Subject: [PATCH 1/2] lib: replace rte_strlcpy() with strlcpy() Date: Wed, 31 May 2023 15:05:32 -0700 Message-Id: <20230531220533.29910-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230531220533.29910-1-stephen@networkplumber.org> References: <20230531220533.29910-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org The function rte_strlcpy is intended to be a platform specific wrapper function and only used where necessary. Prefer using the OS supplied strlcpy() if available. Signed-off-by: Stephen Hemminger --- lib/eal/common/eal_common_memzone.c | 2 +- lib/fib/rte_fib.c | 2 +- lib/fib/rte_fib6.c | 2 +- lib/hash/rte_thash.c | 4 +-- lib/mempool/rte_mempool.c | 2 +- lib/mldev/mldev_utils.c | 40 ++++++++++++++--------------- lib/rib/rte_rib.c | 2 +- lib/rib/rte_rib6.c | 2 +- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c index a9cd91ffeac3..802a7f6a3f6b 100644 --- a/lib/eal/common/eal_common_memzone.c +++ b/lib/eal/common/eal_common_memzone.c @@ -274,7 +274,7 @@ rte_memzone_free(const struct rte_memzone *mz) if (mz == NULL) return -EINVAL; - rte_strlcpy(name, mz->name, RTE_MEMZONE_NAMESIZE); + strlcpy(name, mz->name, RTE_MEMZONE_NAMESIZE); mcfg = rte_eal_get_configuration()->mem_config; arr = &mcfg->memzones; diff --git a/lib/fib/rte_fib.c b/lib/fib/rte_fib.c index 0c3b20e00a5a..067268ba507d 100644 --- a/lib/fib/rte_fib.c +++ b/lib/fib/rte_fib.c @@ -208,7 +208,7 @@ rte_fib_create(const char *name, int socket_id, struct rte_fib_conf *conf) goto free_te; } - rte_strlcpy(fib->name, name, sizeof(fib->name)); + strlcpy(fib->name, name, sizeof(fib->name)); fib->rib = rib; fib->type = conf->type; fib->def_nh = conf->default_nh; diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c index 28c69b38999f..9c6401f71018 100644 --- a/lib/fib/rte_fib6.c +++ b/lib/fib/rte_fib6.c @@ -209,7 +209,7 @@ rte_fib6_create(const char *name, int socket_id, struct rte_fib6_conf *conf) goto free_te; } - rte_strlcpy(fib->name, name, sizeof(fib->name)); + strlcpy(fib->name, name, sizeof(fib->name)); fib->rib = rib; fib->type = conf->type; fib->def_nh = conf->default_nh; diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index 0249883b8d07..5a4e8d4a0dc3 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -255,7 +255,7 @@ rte_thash_init_ctx(const char *name, uint32_t key_len, uint32_t reta_sz, goto free_te; } - rte_strlcpy(ctx->name, name, sizeof(ctx->name)); + strlcpy(ctx->name, name, sizeof(ctx->name)); ctx->key_len = key_len; ctx->reta_sz_log = reta_sz; LIST_INIT(&ctx->head); @@ -574,7 +574,7 @@ rte_thash_add_helper(struct rte_thash_ctx *ctx, const char *name, uint32_t len, if (ent == NULL) return -ENOMEM; - rte_strlcpy(ent->name, name, sizeof(ent->name)); + strlcpy(ent->name, name, sizeof(ent->name)); ent->offset = start; ent->len = end - start; ent->tuple_offset = offset; diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c index cf5dea2304a7..5c0afa2d7060 100644 --- a/lib/mempool/rte_mempool.c +++ b/lib/mempool/rte_mempool.c @@ -1546,7 +1546,7 @@ mempool_handle_info(const char *cmd __rte_unused, const char *params, if (!params || strlen(params) == 0) return -EINVAL; - rte_strlcpy(name, params, RTE_MEMZONE_NAMESIZE); + strlcpy(name, params, RTE_MEMZONE_NAMESIZE); rte_tel_data_start_dict(d); mp_arg.pool_name = name; diff --git a/lib/mldev/mldev_utils.c b/lib/mldev/mldev_utils.c index d2442b123b8c..054db2efba80 100644 --- a/lib/mldev/mldev_utils.c +++ b/lib/mldev/mldev_utils.c @@ -50,40 +50,40 @@ rte_ml_io_type_to_str(enum rte_ml_io_type type, char *str, int len) { switch (type) { case RTE_ML_IO_TYPE_UNKNOWN: - rte_strlcpy(str, "unknown", len); + strlcpy(str, "unknown", len); break; case RTE_ML_IO_TYPE_INT8: - rte_strlcpy(str, "int8", len); + strlcpy(str, "int8", len); break; case RTE_ML_IO_TYPE_UINT8: - rte_strlcpy(str, "uint8", len); + strlcpy(str, "uint8", len); break; case RTE_ML_IO_TYPE_INT16: - rte_strlcpy(str, "int16", len); + strlcpy(str, "int16", len); break; case RTE_ML_IO_TYPE_UINT16: - rte_strlcpy(str, "uint16", len); + strlcpy(str, "uint16", len); break; case RTE_ML_IO_TYPE_INT32: - rte_strlcpy(str, "int32", len); + strlcpy(str, "int32", len); break; case RTE_ML_IO_TYPE_UINT32: - rte_strlcpy(str, "uint32", len); + strlcpy(str, "uint32", len); break; case RTE_ML_IO_TYPE_FP8: - rte_strlcpy(str, "float8", len); + strlcpy(str, "float8", len); break; case RTE_ML_IO_TYPE_FP16: - rte_strlcpy(str, "float16", len); + strlcpy(str, "float16", len); break; case RTE_ML_IO_TYPE_FP32: - rte_strlcpy(str, "float32", len); + strlcpy(str, "float32", len); break; case RTE_ML_IO_TYPE_BFLOAT16: - rte_strlcpy(str, "bfloat16", len); + strlcpy(str, "bfloat16", len); break; default: - rte_strlcpy(str, "invalid", len); + strlcpy(str, "invalid", len); } } @@ -92,27 +92,27 @@ rte_ml_io_format_to_str(enum rte_ml_io_format format, char *str, int len) { switch (format) { case RTE_ML_IO_FORMAT_NCHW: - rte_strlcpy(str, "NCHW", len); + strlcpy(str, "NCHW", len); break; case RTE_ML_IO_FORMAT_NHWC: - rte_strlcpy(str, "NHWC", len); + strlcpy(str, "NHWC", len); break; case RTE_ML_IO_FORMAT_CHWN: - rte_strlcpy(str, "CHWN", len); + strlcpy(str, "CHWN", len); break; case RTE_ML_IO_FORMAT_3D: - rte_strlcpy(str, "3D", len); + strlcpy(str, "3D", len); break; case RTE_ML_IO_FORMAT_2D: - rte_strlcpy(str, "Matrix", len); + strlcpy(str, "Matrix", len); break; case RTE_ML_IO_FORMAT_1D: - rte_strlcpy(str, "Vector", len); + strlcpy(str, "Vector", len); break; case RTE_ML_IO_FORMAT_SCALAR: - rte_strlcpy(str, "Scalar", len); + strlcpy(str, "Scalar", len); break; default: - rte_strlcpy(str, "invalid", len); + strlcpy(str, "invalid", len); } } diff --git a/lib/rib/rte_rib.c b/lib/rib/rte_rib.c index 812a2597d117..57837c632bde 100644 --- a/lib/rib/rte_rib.c +++ b/lib/rib/rte_rib.c @@ -453,7 +453,7 @@ rte_rib_create(const char *name, int socket_id, const struct rte_rib_conf *conf) goto free_te; } - rte_strlcpy(rib->name, name, sizeof(rib->name)); + strlcpy(rib->name, name, sizeof(rib->name)); rib->tree = NULL; rib->max_nodes = conf->max_nodes; rib->node_pool = node_pool; diff --git a/lib/rib/rte_rib6.c b/lib/rib/rte_rib6.c index ae44281ae105..acb00a4809f1 100644 --- a/lib/rib/rte_rib6.c +++ b/lib/rib/rte_rib6.c @@ -522,7 +522,7 @@ rte_rib6_create(const char *name, int socket_id, goto free_te; } - rte_strlcpy(rib->name, name, sizeof(rib->name)); + strlcpy(rib->name, name, sizeof(rib->name)); rib->tree = NULL; rib->max_nodes = conf->max_nodes; rib->node_pool = node_pool; -- 2.39.2