kvargs: add the key in handler pameters
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> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
This commit is contained in:
parent
d8e2337ac4
commit
95418a30be
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -403,7 +403,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;
|
||||
@ -426,7 +426,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;
|
||||
@ -476,7 +476,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;
|
||||
@ -490,7 +490,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;
|
||||
@ -510,7 +510,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;
|
||||
|
Loading…
Reference in New Issue
Block a user