From: Chengwen Feng <fengchengwen@huawei.com>
To: <thomas@monjalon.net>, <ferruh.yigit@amd.com>
Cc: <dev@dpdk.org>
Subject: [PATCH 1/9] kvargs: detailed definition of callback prototype
Date: Thu, 2 Mar 2023 07:48:17 +0000 [thread overview]
Message-ID: <20230302074825.31947-2-fengchengwen@huawei.com> (raw)
In-Reply-To: <20230302074825.31947-1-fengchengwen@huawei.com>
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(-)
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
next prev parent reply other threads:[~2023-03-02 7:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-02 7:48 [PATCH 0/9] fix kvargs callback prototype not clearly defined Chengwen Feng
2023-03-02 7:48 ` Chengwen Feng [this message]
2023-03-02 7:48 ` [PATCH 2/9] compressdev: fix segment fault when parse input args Chengwen Feng
2023-03-02 7:48 ` [PATCH 3/9] compressdev: fix null name " Chengwen Feng
2023-03-02 7:48 ` [PATCH 4/9] cryptodev: fix segment fault " Chengwen Feng
2023-03-02 7:48 ` [PATCH 5/9] cryptodev: fix null name " Chengwen Feng
2023-03-02 7:48 ` [PATCH 6/9] net/hns3: fix segment fault when parse runtime config Chengwen Feng
2023-03-02 7:48 ` [PATCH 7/9] net/virtio: fix segment fault when parse devargs Chengwen Feng
2023-03-02 7:48 ` [PATCH 8/9] dma/skeleton: " Chengwen Feng
2023-03-02 7:48 ` [PATCH 9/9] raw/skeleton: " Chengwen Feng
2023-03-02 7:50 [PATCH 0/9] fix kvargs callback prototype not clearly defined Chengwen Feng
2023-03-02 7:50 ` [PATCH 1/9] kvargs: detailed definition of callback prototype Chengwen Feng
2023-03-09 13:12 ` Olivier Matz
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=20230302074825.31947-2-fengchengwen@huawei.com \
--to=fengchengwen@huawei.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=thomas@monjalon.net \
/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).