From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 09/11] kvargs: add the key in handler pameters
Date: Tue, 28 Jan 2014 17:06:42 +0100 [thread overview]
Message-ID: <1390925204-10800-10-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <1390925204-10800-1-git-send-email-olivier.matz@6wind.com>
This argument can be useful when rte_kvargs_process() is called with
key=NULL, in this case the handler is invoked for all entries of the
kvlist.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
lib/librte_kvargs/rte_kvargs.c | 2 +-
lib/librte_kvargs/rte_kvargs.h | 2 +-
lib/librte_pmd_pcap/rte_eth_pcap.c | 10 +++++-----
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c
index 73034fc..1ff7056 100644
--- a/lib/librte_kvargs/rte_kvargs.c
+++ b/lib/librte_kvargs/rte_kvargs.c
@@ -161,7 +161,7 @@ rte_kvargs_process(const struct rte_kvargs *kvlist,
for (i = 0; i < kvlist->count; i++) {
pair = &kvlist->pairs[i];
if (strcmp(pair->key, key_match) == 0) {
- if ((*handler)(pair->value, opaque_arg) < 0)
+ if ((*handler)(pair->key, pair->value, opaque_arg) < 0)
return -1;
}
}
diff --git a/lib/librte_kvargs/rte_kvargs.h b/lib/librte_kvargs/rte_kvargs.h
index 35572ba..c080c06 100644
--- a/lib/librte_kvargs/rte_kvargs.h
+++ b/lib/librte_kvargs/rte_kvargs.h
@@ -64,7 +64,7 @@ extern "C" {
#define RTE_KVARGS_KV_DELIM "="
/** Type of callback function used by rte_kvargs_process() */
-typedef int (*arg_handler_t)(const char *value, void *opaque);
+typedef int (*arg_handler_t)(const char *key, const char *value, void *opaque);
/** A key/value association */
struct rte_kvargs_pair {
diff --git a/lib/librte_pmd_pcap/rte_eth_pcap.c b/lib/librte_pmd_pcap/rte_eth_pcap.c
index 8484497..6649f0f 100644
--- a/lib/librte_pmd_pcap/rte_eth_pcap.c
+++ b/lib/librte_pmd_pcap/rte_eth_pcap.c
@@ -419,7 +419,7 @@ static struct eth_dev_ops ops = {
* reference of it for use it later on.
*/
static int
-open_rx_pcap(const char *value, void *extra_args)
+open_rx_pcap(const char *key __rte_unused, const char *value, void *extra_args)
{
unsigned i;
const char *pcap_filename = value;
@@ -442,7 +442,7 @@ open_rx_pcap(const char *value, void *extra_args)
* for use it later on.
*/
static int
-open_tx_pcap(const char *value, void *extra_args)
+open_tx_pcap(const char *key __rte_unused, const char *value, void *extra_args)
{
unsigned i;
const char *pcap_filename = value;
@@ -492,7 +492,7 @@ open_iface_live(const char *iface, pcap_t **pcap) {
* Opens an interface for reading and writing
*/
static inline int
-open_rx_tx_iface(const char *value, void *extra_args)
+open_rx_tx_iface(const char *key __rte_unused, const char *value, void *extra_args)
{
const char *iface = value;
pcap_t **pcap = extra_args;
@@ -506,7 +506,7 @@ open_rx_tx_iface(const char *value, void *extra_args)
* Opens a NIC for reading packets from it
*/
static inline int
-open_rx_iface(const char *value, void *extra_args)
+open_rx_iface(const char *key __rte_unused, const char *value, void *extra_args)
{
unsigned i;
const char *iface = value;
@@ -526,7 +526,7 @@ open_rx_iface(const char *value, void *extra_args)
* Opens a NIC for writing packets to it
*/
static inline int
-open_tx_iface(const char *value, void *extra_args)
+open_tx_iface(const char *key __rte_unused, const char *value, void *extra_args)
{
unsigned i;
const char *iface = value;
--
1.8.4.rc3
next prev parent reply other threads:[~2014-01-28 16:06 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-28 16:06 [dpdk-dev] [PATCH 00/11] add rte_kvargs library: a key/value args parser Olivier Matz
2014-01-28 16:06 ` [dpdk-dev] [PATCH 01/11] kvargs: add a new library to parse key/value arguments Olivier Matz
2014-01-29 15:45 ` Richardson, Bruce
2014-01-28 16:06 ` [dpdk-dev] [PATCH 02/11] kvargs: use the new library in pmd_pcap Olivier Matz
2014-01-29 15:46 ` Richardson, Bruce
2014-01-28 16:06 ` [dpdk-dev] [PATCH 03/11] kvargs: remove driver name in arguments Olivier Matz
2014-01-29 15:47 ` Richardson, Bruce
2014-01-28 16:06 ` [dpdk-dev] [PATCH 04/11] kvargs: remove useless size field Olivier Matz
2014-01-29 17:14 ` Richardson, Bruce
2014-01-28 16:06 ` [dpdk-dev] [PATCH 05/11] kvargs: rework API to fix memory leak Olivier Matz
2014-01-30 11:22 ` Richardson, Bruce
2014-01-28 16:06 ` [dpdk-dev] [PATCH 06/11] kvargs: simpler parsing and allow duplicated keys Olivier Matz
2014-01-29 17:17 ` Richardson, Bruce
2014-01-29 22:17 ` Olivier MATZ
2014-01-30 11:23 ` Richardson, Bruce
2014-01-28 16:06 ` [dpdk-dev] [PATCH 07/11] kvargs: be strict when matching a key Olivier Matz
2014-01-30 11:23 ` Richardson, Bruce
2014-01-28 16:06 ` [dpdk-dev] [PATCH 08/11] kvargs: add const attribute in handler parameters Olivier Matz
2014-01-30 11:24 ` Richardson, Bruce
2014-01-28 16:06 ` Olivier Matz [this message]
2014-01-30 11:34 ` [dpdk-dev] [PATCH 09/11] kvargs: add the key in handler pameters Richardson, Bruce
2014-01-28 16:06 ` [dpdk-dev] [PATCH 10/11] kvargs: make the NULL key to match all entries Olivier Matz
2014-01-30 11:34 ` Richardson, Bruce
2014-01-28 16:06 ` [dpdk-dev] [PATCH 11/11] kvargs: add test case in app/test Olivier Matz
2014-01-30 11:35 ` Richardson, Bruce
2014-02-04 14:53 ` [dpdk-dev] [PATCH 00/11] add rte_kvargs library: a key/value args parser Thomas Monjalon
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=1390925204-10800-10-git-send-email-olivier.matz@6wind.com \
--to=olivier.matz@6wind.com \
--cc=dev@dpdk.org \
/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).