[v2,4/5] kvargs: remove experimental function to compare string

Message ID 20210929213943.17817-5-olivier.matz@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series kvargs: promote or remove experimental api |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Olivier Matz Sept. 29, 2021, 9:39 p.m. UTC
  The function was designed to be used as a handler for
rte_kvargs_process() to compare the value string in a kvlist. For
readability, its usages in DPDK have been replaced by
rte_kvargs_get_with_value() in previous commit.

Remove this function, as it is not used anymore.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Xueming Li <xuemingl@nvidia.com>
---
 lib/kvargs/rte_kvargs.c |  9 ---------
 lib/kvargs/rte_kvargs.h | 26 --------------------------
 lib/kvargs/version.map  |  2 --
 3 files changed, 37 deletions(-)
  

Comments

Olivier Matz Sept. 30, 2021, 2 p.m. UTC | #1
On Wed, Sep 29, 2021 at 11:39:42PM +0200, Olivier Matz wrote:
> The function was designed to be used as a handler for
> rte_kvargs_process() to compare the value string in a kvlist. For
> readability, its usages in DPDK have been replaced by
> rte_kvargs_get_with_value() in previous commit.
> 
> Remove this function, as it is not used anymore.
> 
> Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> Reviewed-by: Xueming Li <xuemingl@nvidia.com>

Maybe a quick note could be added in the release note. Something like
this:

* kvargs: The experimental function ``rte_kvargs_strcmp()`` has been
  removed. Its usages have been replaced by a new function
  ``rte_kvargs_get_with_value()``.

David, do you want me to send a v3 with this note?

Thanks,
Olivier
  
David Marchand Sept. 30, 2021, 3:19 p.m. UTC | #2
On Thu, Sep 30, 2021 at 4:00 PM Olivier Matz <olivier.matz@6wind.com> wrote:
>
> On Wed, Sep 29, 2021 at 11:39:42PM +0200, Olivier Matz wrote:
> > The function was designed to be used as a handler for
> > rte_kvargs_process() to compare the value string in a kvlist. For
> > readability, its usages in DPDK have been replaced by
> > rte_kvargs_get_with_value() in previous commit.
> >
> > Remove this function, as it is not used anymore.
> >
> > Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
> > Reviewed-by: Xueming Li <xuemingl@nvidia.com>
>
> Maybe a quick note could be added in the release note. Something like
> this:
>
> * kvargs: The experimental function ``rte_kvargs_strcmp()`` has been
>   removed. Its usages have been replaced by a new function
>   ``rte_kvargs_get_with_value()``.
>
> David, do you want me to send a v3 with this note?

Yes, a RN update for API changes is a good practice :-).
No need to send v3, I'll add it and merge the series (soon).

Thanks Olivier.
  

Patch

diff --git a/lib/kvargs/rte_kvargs.c b/lib/kvargs/rte_kvargs.c
index 20abb23183..11f624ef14 100644
--- a/lib/kvargs/rte_kvargs.c
+++ b/lib/kvargs/rte_kvargs.c
@@ -283,12 +283,3 @@  rte_kvargs_parse_delim(const char *args, const char * const valid_keys[],
 	free(copy);
 	return kvlist;
 }
-
-int
-rte_kvargs_strcmp(const char *key __rte_unused,
-		  const char *value, void *opaque)
-{
-	const char *str = opaque;
-
-	return -abs(strcmp(str, value));
-}
diff --git a/lib/kvargs/rte_kvargs.h b/lib/kvargs/rte_kvargs.h
index e40df1bd2a..3c1754c3d9 100644
--- a/lib/kvargs/rte_kvargs.h
+++ b/lib/kvargs/rte_kvargs.h
@@ -197,32 +197,6 @@  int rte_kvargs_process(const struct rte_kvargs *kvlist,
 unsigned rte_kvargs_count(const struct rte_kvargs *kvlist,
 	const char *key_match);
 
-/**
- * Generic kvarg handler for string comparison.
- *
- * This function can be used for a generic string comparison processing
- * on a list of kvargs.
- *
- * @param key
- *   kvarg pair key.
- *
- * @param value
- *   kvarg pair value.
- *
- * @param opaque
- *   Opaque pointer to a string.
- *
- * @return
- *   0 if the strings match.
- *   !0 otherwise or on error.
- *
- *   Unlike strcmp, comparison ordering is not kept.
- *   In order for rte_kvargs_process to stop processing on match error,
- *   a negative value is returned even if strcmp had returned a positive one.
- */
-__rte_experimental
-int rte_kvargs_strcmp(const char *key, const char *value, void *opaque);
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/kvargs/version.map b/lib/kvargs/version.map
index 82879b7140..0d42cd58a8 100644
--- a/lib/kvargs/version.map
+++ b/lib/kvargs/version.map
@@ -14,8 +14,6 @@  DPDK_22 {
 EXPERIMENTAL {
 	global:
 
-	rte_kvargs_strcmp;
-
 	# added in 21.11
 	rte_kvargs_get_with_value;
 };