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 C85F6A0C41; Wed, 15 Sep 2021 16:52:48 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B68664068F; Wed, 15 Sep 2021 16:52:48 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id F08594014F for ; Wed, 15 Sep 2021 16:52:46 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10107"; a="283341828" X-IronPort-AV: E=Sophos;i="5.85,295,1624345200"; d="scan'208";a="283341828" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2021 07:52:46 -0700 X-IronPort-AV: E=Sophos;i="5.85,295,1624345200"; d="scan'208";a="470952303" Received: from mmcgar2x-mobl.ger.corp.intel.com (HELO bricha3-MOBL.ger.corp.intel.com) ([10.252.4.169]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 15 Sep 2021 07:52:44 -0700 Date: Wed, 15 Sep 2021 15:52:41 +0100 From: Bruce Richardson To: Thomas Monjalon Cc: dev@dpdk.org, david.marchand@redhat.com, ferruh.yigit@intel.com, Anatoly Burakov Message-ID: References: <20210915143232.2994872-1-thomas@monjalon.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210915143232.2994872-1-thomas@monjalon.net> Subject: Re: [dpdk-dev] [PATCH] eal: remove plural syntax for single resource 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 Sender: "dev" On Wed, Sep 15, 2021 at 04:32:32PM +0200, Thomas Monjalon wrote: > Some comments and logs about cores, nodes and pages > were using plural or hypotetic plural (s) form > even if preceded by "0" or "no". > > It is replaced with singular form where appropriate. > > Signed-off-by: Thomas Monjalon > --- > lib/eal/common/eal_common_lcore.c | 13 +++++++++---- > lib/eal/common/rte_malloc.c | 4 ++-- > lib/eal/linux/eal_hugepage_info.c | 4 ++-- > lib/eal/linux/eal_memory.c | 4 ++-- > 4 files changed, 15 insertions(+), 10 deletions(-) > > diff --git a/lib/eal/common/eal_common_lcore.c b/lib/eal/common/eal_common_lcore.c > index 66d6bad1a7..6778ecc98f 100644 > --- a/lib/eal/common/eal_common_lcore.c > +++ b/lib/eal/common/eal_common_lcore.c > @@ -191,9 +191,12 @@ rte_eal_cpu_init(void) > /* Set the count of enabled logical cores of the EAL configuration */ > config->lcore_count = count; > RTE_LOG(DEBUG, EAL, > - "Support maximum %u logical core(s) by configuration.\n", > - RTE_MAX_LCORE); > - RTE_LOG(INFO, EAL, "Detected %u lcore(s)\n", config->lcore_count); > + "Support maximum %u logical core%s by configuration.\n", > + RTE_MAX_LCORE, > + RTE_MAX_LCORE > 1 ? "s" : ""); > + RTE_LOG(INFO, EAL, "Detected %u lcore%s\n", > + config->lcore_count, > + config->lcore_count > 1 ? "s" : ""); > Personally, I'd take the view that these values are so unlikely to be ever 1, that I'd leave them always pluralized rather than add the complexity. > /* sort all socket id's in ascending order */ > qsort(lcore_to_socket_id, RTE_DIM(lcore_to_socket_id), > @@ -208,7 +211,9 @@ rte_eal_cpu_init(void) > socket_id; > prev_socket_id = socket_id; > } > - RTE_LOG(INFO, EAL, "Detected %u NUMA nodes\n", config->numa_node_count); > + RTE_LOG(INFO, EAL, "Detected %u NUMA node%s\n", > + config->numa_node_count, > + config->numa_node_count > 1 ? "s" : ""); > Ok. However, as a general suggestion, is it easier to sidestep all this singular/plural decisions just by using "label: " type syntax, e.g. for here: "Detected NUMA nodes: 1" When printed in such a form there is no expectation of singular ever being used. > return 0; > } > diff --git a/lib/eal/common/rte_malloc.c b/lib/eal/common/rte_malloc.c > index 9d39e58c08..04cbb0078b 100644 > --- a/lib/eal/common/rte_malloc.c > +++ b/lib/eal/common/rte_malloc.c > @@ -65,10 +65,10 @@ malloc_socket(const char *type, size_t size, unsigned int align, > if (size == 0 || (align && !rte_is_power_of_2(align))) > return NULL; > > - /* if there are no hugepages and if we are not allocating from an > + /* if there are no hugepage and if we are not allocating from an This needs to be kept in the plural. Also applies to the instances below... > * external heap, use memory from any socket available. checking for > * socket being external may return -1 in case of invalid socket, but > - * that's OK - if there are no hugepages, it doesn't matter. > + * that's OK - if there are no hugepage, it doesn't matter. > */