From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f41.google.com (mail-wg0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 15B7F6949 for ; Tue, 28 Jan 2014 17:06:03 +0100 (CET) Received: by mail-wg0-f41.google.com with SMTP id n12so6302508wgh.4 for ; Tue, 28 Jan 2014 08:07:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RtG34DxB8HI5y5ESspBMIK85j55hP45mD1XXwzVU0G4=; b=hGyvbLL6sxYWRf0/LJOyVHw2F3XOjxK09vP8OnGaGVD8/qa2cxerAMlw/t4rxUvv6x BweK0fjQwmDaMt1WArsfoJOOBtJerN/bhXB/B2txm7gvuWAL3yDzy09H0t6KIwH9E3Rd tbG8D+BYlPxBYAFxyFx5IwnW0uzZW8apctLBPmP8P8xcrQWQAhZuOi1dvYaJLb7Ompg4 Qi3sGqcnRyMNqWfUSBebqX4Dghwq83/Vg3mMkWcO8TJkeu/ZRwVWfPZ6OjQb+8suCu2l l57prh9+bCxKSP1L/NJL7LwTQSDKRV0iLcIdFj3k+bJhSlNbeYHMBGKDTGuZiGRK6LLd EuTw== X-Gm-Message-State: ALoCoQmnJIJymxzGRrH6svVQAkMhWOIIxUu8pb3fpiqdSg21tar6PLXXTun7mogyFLQ9VsVrZWOH X-Received: by 10.180.96.228 with SMTP id dv4mr2517045wib.24.1390925242548; Tue, 28 Jan 2014 08:07:22 -0800 (PST) Received: from glumotte.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id d6sm36407821wic.9.2014.01.28.08.07.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Jan 2014 08:07:21 -0800 (PST) From: Olivier Matz To: dev@dpdk.org Date: Tue, 28 Jan 2014 17:06:42 +0100 Message-Id: <1390925204-10800-10-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 1.8.4.rc3 In-Reply-To: <1390925204-10800-1-git-send-email-olivier.matz@6wind.com> References: <1390925204-10800-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH 09/11] kvargs: add the key in handler pameters X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Jan 2014 16:06:04 -0000 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 --- 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