[1/9] kvargs: detailed definition of callback prototype
Checks
Commit Message
The rte_kvargs_process() was used to parse KV pairs, it also supports
to parse 'only keys' (e.g. socket_id) type. And the callback function
(which prototype is arg_handler_t) parameter 'value' is NULL when
parsed 'only keys'.
But where there is no detailed definition of 'value' maybe NULL, so
this patch adds it.
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
---
lib/kvargs/rte_kvargs.h | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
Comments
Hi Chengwen,
The patch looks good to me.
Please find below few minor style comments.
On Thu, Mar 02, 2023 at 07:50:04AM +0000, Chengwen Feng wrote:
> [PATCH 1/9] kvargs: detailed definition of callback prototype
kvargs: add API documentation for process callback
>
> The rte_kvargs_process() was used to parse KV pairs, it also supports
was -> is
> to parse 'only keys' (e.g. socket_id) type. And the callback function
> (which prototype is arg_handler_t) parameter 'value' is NULL when
> parsed 'only keys'.
parsed -> parsing
>
> But where there is no detailed definition of 'value' maybe NULL, so
-where
maybe -> may be
> this patch adds it.
>
> Cc: stable@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
With this:
Acked-by: Olivier Matz <zer0@droids-corp.org>
Thanks!
> ---
> lib/kvargs/rte_kvargs.h | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/lib/kvargs/rte_kvargs.h b/lib/kvargs/rte_kvargs.h
> index 359a9f5b09..4900b750bc 100644
> --- a/lib/kvargs/rte_kvargs.h
> +++ b/lib/kvargs/rte_kvargs.h
> @@ -36,7 +36,19 @@ extern "C" {
> /** separator character used between key and value */
> #define RTE_KVARGS_KV_DELIM "="
>
> -/** Type of callback function used by rte_kvargs_process() */
> +/**
> + * Callback prototype used by rte_kvargs_process().
> + *
> + * @param key
> + * The key to consider, it will not be NULL.
> + * @param value
> + * The value corresponding to the key, it may be NULL (e.g. only with key)
> + * @param opaque
> + * An opaque pointer coming from the caller.
> + * @return
> + * - >=0 handle key success.
> + * - <0 on error.
> + */
> typedef int (*arg_handler_t)(const char *key, const char *value, void *opaque);
>
> /** A key/value association */
> --
> 2.17.1
>
@@ -36,7 +36,19 @@ extern "C" {
/** separator character used between key and value */
#define RTE_KVARGS_KV_DELIM "="
-/** Type of callback function used by rte_kvargs_process() */
+/**
+ * Callback prototype used by rte_kvargs_process().
+ *
+ * @param key
+ * The key to consider, it will not be NULL.
+ * @param value
+ * The value corresponding to the key, it may be NULL (e.g. only with key)
+ * @param opaque
+ * An opaque pointer coming from the caller.
+ * @return
+ * - >=0 handle key success.
+ * - <0 on error.
+ */
typedef int (*arg_handler_t)(const char *key, const char *value, void *opaque);
/** A key/value association */