summaryrefslogtreecommitdiff
path: root/lib/librte_kvargs
diff options
context:
space:
mode:
authorOlivier Matz <olivier.matz@6wind.com>2014-01-28 17:06:36 +0100
committerDavid Marchand <david.marchand@6wind.com>2014-02-26 11:01:14 +0100
commit991543e81569e3ed0983bd7f5ae290f34ed091f4 (patch)
treed150cbccf35350028d0386c0089bcd67adde5c61 /lib/librte_kvargs
parent07f7d55dd235c2ad590f86a34eb699fe12b2ec7d (diff)
downloaddpdk-991543e81569e3ed0983bd7f5ae290f34ed091f4.zip
dpdk-991543e81569e3ed0983bd7f5ae290f34ed091f4.tar.gz
dpdk-991543e81569e3ed0983bd7f5ae290f34ed091f4.tar.xz
kvargs: remove driver name in arguments
Now that rte_kvargs is a generic library, there is no need to have an argument for the driver name in rte_kvargs_tokenize() and rte_kvargs_parse() prototypes. This argument was only used to log the driver name in case of error. Instead, we can add a log in init function of pmd_pcap and pmd_ring. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Diffstat (limited to 'lib/librte_kvargs')
-rw-r--r--lib/librte_kvargs/rte_kvargs.c13
-rw-r--r--lib/librte_kvargs/rte_kvargs.h4
2 files changed, 7 insertions, 10 deletions
diff --git a/lib/librte_kvargs/rte_kvargs.c b/lib/librte_kvargs/rte_kvargs.c
index 3acb895..c3d65af 100644
--- a/lib/librte_kvargs/rte_kvargs.c
+++ b/lib/librte_kvargs/rte_kvargs.c
@@ -91,8 +91,7 @@ rte_kvargs_add_pair(struct rte_kvargs *kvlist, char *key, char *val)
* strtok() is used so the params string will be copied to be modified.
*/
static int
-rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *name,
- const char *params)
+rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *params)
{
unsigned i, count;
char *args;
@@ -101,7 +100,7 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *name,
/* If params are empty, nothing to do */
if (params == NULL || params[0] == 0) {
- RTE_LOG(ERR, PMD, "Couldn't parse %s device, empty arguments\n", name);
+ RTE_LOG(ERR, PMD, "Cannot parse empty arguments\n");
return -1;
}
@@ -110,7 +109,7 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *name,
*/
args = strdup(params);
if(args == NULL){
- RTE_LOG(ERR, PMD, "Couldn't parse %s device \n", name);
+ RTE_LOG(ERR, PMD, "Cannot parse arguments: not enough memory\n");
return -1;
}
@@ -127,7 +126,8 @@ rte_kvargs_tokenize(struct rte_kvargs *kvlist, const char *name,
if (pair[0] == NULL || pair[1] == NULL || pair[0][0] == 0
|| pair[1][0] == 0) {
RTE_LOG(ERR, PMD,
- "Couldn't parse %s device, wrong key or value \n", name);
+ "Cannot parse arguments: wrong key or value\n"
+ "params=<%s>\n", params);
goto error;
}
@@ -230,14 +230,13 @@ rte_kvargs_process(const struct rte_kvargs *kvlist,
*/
int
rte_kvargs_parse(struct rte_kvargs *kvlist,
- const char *name,
const char *args,
const char *valid_keys[])
{
int ret;
- ret = rte_kvargs_tokenize(kvlist, name, args);
+ ret = rte_kvargs_tokenize(kvlist, args);
if (ret < 0)
return ret;
diff --git a/lib/librte_kvargs/rte_kvargs.h b/lib/librte_kvargs/rte_kvargs.h
index bf32ce2..288e05f 100644
--- a/lib/librte_kvargs/rte_kvargs.h
+++ b/lib/librte_kvargs/rte_kvargs.h
@@ -100,8 +100,6 @@ int rte_kvargs_init(struct rte_kvargs *kvlist);
*
* @param kvlist
* The rte_kvargs structure
- * @param name
- * The name of the driver
* @param args
* The input string containing the key/value associations
* @param valid_keys
@@ -112,7 +110,7 @@ int rte_kvargs_init(struct rte_kvargs *kvlist);
* - 0 on success
* - Negative on error
*/
-int rte_kvargs_parse(struct rte_kvargs *kvlist, const char *name,
+int rte_kvargs_parse(struct rte_kvargs *kvlist,
const char *args, const char *valid_keys[]);
/**