DPDK patches and discussions
 help / color / mirror / Atom feed
From: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
To: dev@dpdk.org
Cc: "Dmitry Kozlyuk" <dmitry.kozliuk@gmail.com>,
	"Ray Kinsella" <mdr@ashroe.eu>,
	"Morten Brørup" <mb@smartsharesystems.com>,
	"Bruce Richardson" <bruce.richardson@intel.com>,
	"Chengwen Feng" <fengchengwen@huawei.com>
Subject: [PATCH v4 3/4] eal: uninline rte_str_to_size
Date: Sat, 27 Aug 2022 14:32:21 +0300	[thread overview]
Message-ID: <20220827113222.3951505-4-dmitry.kozliuk@gmail.com> (raw)
In-Reply-To: <20220827113222.3951505-1-dmitry.kozliuk@gmail.com>

There is no reason for rte_str_to_size() to be inline.
Move the implementation out of <rte_common.h>.
Export it as a stable ABI because it always has been public.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/eal/common/eal_common_string_fns.c | 32 ++++++++++++++++++++++++++
 lib/eal/include/rte_common.h           | 30 ++----------------------
 lib/eal/version.map                    |  1 +
 3 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/lib/eal/common/eal_common_string_fns.c b/lib/eal/common/eal_common_string_fns.c
index 0236ae4023..5fc4ee71dc 100644
--- a/lib/eal/common/eal_common_string_fns.c
+++ b/lib/eal/common/eal_common_string_fns.c
@@ -64,3 +64,35 @@ rte_strscpy(char *dst, const char *src, size_t dsize)
 	rte_errno = E2BIG;
 	return -rte_errno;
 }
+
+uint64_t
+rte_str_to_size(const char *str)
+{
+	char *endptr;
+	unsigned long long size;
+
+	while (isspace((int)*str))
+		str++;
+	if (*str == '-')
+		return 0;
+
+	errno = 0;
+	size = strtoull(str, &endptr, 0);
+	if (errno)
+		return 0;
+
+	if (*endptr == ' ')
+		endptr++; /* allow 1 space gap */
+
+	switch (*endptr) {
+	case 'G': case 'g':
+		size *= 1024; /* fall-through */
+	case 'M': case 'm':
+		size *= 1024; /* fall-through */
+	case 'K': case 'k':
+		size *= 1024; /* fall-through */
+	default:
+		break;
+	}
+	return size;
+}
diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h
index b65555bac6..86c50c55e0 100644
--- a/lib/eal/include/rte_common.h
+++ b/lib/eal/include/rte_common.h
@@ -873,34 +873,8 @@ rte_log2_u64(uint64_t v)
  * @return
  *     Number.
  */
-static inline uint64_t
-rte_str_to_size(const char *str)
-{
-	char *endptr;
-	unsigned long long size;
-
-	while (isspace((int)*str))
-		str++;
-	if (*str == '-')
-		return 0;
-
-	errno = 0;
-	size = strtoull(str, &endptr, 0);
-	if (errno)
-		return 0;
-
-	if (*endptr == ' ')
-		endptr++; /* allow 1 space gap */
-
-	switch (*endptr){
-	case 'G': case 'g': size *= 1024; /* fall-through */
-	case 'M': case 'm': size *= 1024; /* fall-through */
-	case 'K': case 'k': size *= 1024; /* fall-through */
-	default:
-		break;
-	}
-	return size;
-}
+uint64_t
+rte_str_to_size(const char *str);
 
 /**
  * Function to terminate the application immediately, printing an error
diff --git a/lib/eal/version.map b/lib/eal/version.map
index 1f293e768b..773b0902c0 100644
--- a/lib/eal/version.map
+++ b/lib/eal/version.map
@@ -261,6 +261,7 @@ DPDK_23 {
 	rte_socket_id;
 	rte_socket_id_by_idx;
 	rte_srand;
+	rte_str_to_size;
 	rte_strerror;
 	rte_strscpy;
 	rte_strsplit;
-- 
2.33.1


  parent reply	other threads:[~2022-08-27 11:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-21 20:50 [PATCH 0/3] eal: small rte_common.h fixes and cleanup Dmitry Kozlyuk
2022-08-21 20:50 ` [PATCH 1/3] eal: fix pointer arithmetic with an expression argument Dmitry Kozlyuk
2022-08-22  7:14   ` Morten Brørup
2022-08-21 20:50 ` [PATCH 2/3] eal: uninline rte_str_to_size Dmitry Kozlyuk
2022-08-22  7:24   ` Morten Brørup
2022-08-22 14:06     ` Bruce Richardson
2022-08-21 20:50 ` [PATCH 3/3] eal: deduplicate roundup code Dmitry Kozlyuk
2022-08-22  7:25   ` Morten Brørup
2022-08-22 14:06 ` [PATCH 0/3] eal: small rte_common.h fixes and cleanup Bruce Richardson
2022-08-24  3:52 ` fengchengwen
2022-08-25 15:37 ` [PATCH v2 0/4] " Dmitry Kozlyuk
2022-08-25 15:37   ` [PATCH v2 1/4] eal: fix pointer arithmetic with an expression argument Dmitry Kozlyuk
2022-08-25 15:37   ` [PATCH v2 2/4] eal: deduplicate roundup code Dmitry Kozlyuk
2022-08-25 15:37   ` [PATCH v2 3/4] eal: uninline rte_str_to_size Dmitry Kozlyuk
2022-08-25 15:37   ` [PATCH v2 4/4] eal: remove unneeded includes from a public header Dmitry Kozlyuk
2022-08-25 22:33   ` [PATCH v3 0/4] eal: small rte_common.h fixes and cleanup Dmitry Kozlyuk
2022-08-25 22:33     ` [PATCH v3 1/4] eal: fix pointer arithmetic with an expression argument Dmitry Kozlyuk
2022-08-25 22:33     ` [PATCH v3 2/4] eal: deduplicate roundup code Dmitry Kozlyuk
2022-08-25 22:33     ` [PATCH v3 3/4] eal: uninline rte_str_to_size Dmitry Kozlyuk
2022-08-25 22:33     ` [PATCH v3 4/4] eal: remove unneeded includes from a public header Dmitry Kozlyuk
2022-08-27 11:32     ` [PATCH v4 0/4] eal: small rte_common.h fixes and cleanup Dmitry Kozlyuk
2022-08-27 11:32       ` [PATCH v4 1/4] eal: fix pointer arithmetic with an expression argument Dmitry Kozlyuk
2022-08-27 11:32       ` [PATCH v4 2/4] eal: deduplicate roundup code Dmitry Kozlyuk
2022-08-27 11:32       ` Dmitry Kozlyuk [this message]
2022-08-27 11:32       ` [PATCH v4 4/4] eal: remove unneeded includes from a public header Dmitry Kozlyuk
2022-08-29  8:29         ` Bruce Richardson
2022-09-21  9:27         ` David Marchand
2022-09-21 11:37         ` David Marchand
2022-09-21 13:30       ` [PATCH v4 0/4] eal: small rte_common.h fixes and cleanup David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220827113222.3951505-4-dmitry.kozliuk@gmail.com \
    --to=dmitry.kozliuk@gmail.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=fengchengwen@huawei.com \
    --cc=mb@smartsharesystems.com \
    --cc=mdr@ashroe.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).