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 BA19EA00C2; Sun, 21 Aug 2022 22:50:42 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 30BDB42826; Sun, 21 Aug 2022 22:50:33 +0200 (CEST) Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) by mails.dpdk.org (Postfix) with ESMTP id 3BDFD427FF for ; Sun, 21 Aug 2022 22:50:31 +0200 (CEST) Received: by mail-lf1-f48.google.com with SMTP id z6so12742929lfu.9 for ; Sun, 21 Aug 2022 13:50:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc; bh=2twvjwwKwC57/PTmEykq78tBahFNZnNst+W3DZOGlb8=; b=OiG+/NeFFDLB2NKixozlk412M3yAyYEXgQC9NoZrvtD85Q9SYXIrPZz796Cq7KjyTS kM+TZ8x8vFVufDUgsQgaJiGdcsKYBSudsqxvMlogGurPeAZoklQHvJbnv9lCoSziNES7 oY+zYPnMSQ5JE2MHhsk2uIhT66zPHiwg2GOeO/Qe6Ys0Jl/uPlw0gahQhPT4nhkGd8kQ 7MhVCgcaMcS+esVEPhRkjBy1PQLaDVpZoJWv7STz5ZwRTWYlhRR2AGJFSwk3mFVk9oq0 XRhx9f5rk3D7UAfYKo6CDQrp+ZbhJzU89SX/v4yifDlkdTwQUeZ5zXTTtahLGBg6y75O afFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc; bh=2twvjwwKwC57/PTmEykq78tBahFNZnNst+W3DZOGlb8=; b=DWz5cZfsmkcS0Ytcbp0QndkdthCNJBaIqgcLdnTk/xMW6oQ0E8Yhk/kd3wgxFzq8f7 gDl+724jHJ36gwM7UEAEEzp8Q9kyyliINlogmYUBueVoaTA9XyXFAHR0xESSmB0hpioZ q23BbCYMVVjxJQST5KGtIeGw+FUbWLt3CZI+C+9Ef1iLgCmAFiFaMP8+SaTO/1J0AB7h M/d705Bbs6cKQ5sxIEIekGSq4vgxWDCBy7HnvqV/Jn+8TOgPbDlnNzPut8E/JXKBqe0q gbE0fuVM0MPqpeN4tP6wXnFZplnbK/AUofPaUtvUYH5uGjojCCMNETFni58ZGqMCzh/5 0j9A== X-Gm-Message-State: ACgBeo268yngZviqOGVBiIdVcaHv0LiSaEXJV+upXHxj+30hr/cyfXUJ 3vW2z7+vIjhenLC4BKJ4R84APjEUt04= X-Google-Smtp-Source: AA6agR6iJH99srsKPlx8M+PcFWfBucap1CaVi5RBsyjw7yf1YHviSxwzWxmIDxyZH73Odr+qjgBWpg== X-Received: by 2002:a05:6512:1524:b0:48a:aff5:59d0 with SMTP id bq36-20020a056512152400b0048aaff559d0mr5592877lfb.122.1661115030468; Sun, 21 Aug 2022 13:50:30 -0700 (PDT) Received: from sovereign.. (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id b17-20020a056512071100b00492c77c55ddsm1337897lfs.67.2022.08.21.13.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Aug 2022 13:50:29 -0700 (PDT) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: Dmitry Kozlyuk , Ray Kinsella Subject: [PATCH 2/3] eal: uninline rte_str_to_size Date: Sun, 21 Aug 2022 23:50:08 +0300 Message-Id: <20220821205009.1317044-3-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220821205009.1317044-1-dmitry.kozliuk@gmail.com> References: <20220821205009.1317044-1-dmitry.kozliuk@gmail.com> 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 There is no reason for rte_str_to_size() to be inline. Move the implementation out of . Export it as a stable ABI because it always has been public. Signed-off-by: Dmitry Kozlyuk --- Now doesn't need to #include and , but removing them breaks some DPDK code, may break user code too. I'm not sure what is the compatibility policy in this regard. If such a breakage is allowed, I'd remove includes and fix DPDK code. 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 d517e9f75f..772e40f8c2 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -875,34 +875,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