From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 08/11] device-args: use a comma instead of semicolon to separate key/values
Date: Fri, 28 Feb 2014 18:25:47 +0100 [thread overview]
Message-ID: <1393608350-4431-9-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <1393608350-4431-1-git-send-email-olivier.matz@6wind.com>
This commit changes the API of --use-device. It changes the separator
used between each key/value pairs from ';' to ','. Indeed, ';' was not
the best choice as this character is also used to separate shell
commands, forcing the user to surround arguments with quotes.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
app/test/test_devargs.c | 10 +++++-----
app/test/test_eal_flags.c | 4 ++--
app/test/test_kvargs.c | 14 +++++++-------
lib/librte_eal/common/eal_common_devargs.c | 4 ++--
lib/librte_eal/common/include/rte_devargs.h | 8 ++++----
lib/librte_eal/linuxapp/eal/eal.c | 2 +-
lib/librte_kvargs/rte_kvargs.h | 6 +++---
7 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/app/test/test_devargs.c b/app/test/test_devargs.c
index 4d45d53..f5451b2 100644
--- a/app/test/test_devargs.c
+++ b/app/test/test_devargs.c
@@ -68,7 +68,7 @@ test_devargs(void)
goto fail;
if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "0000:5:00.0") < 0)
goto fail;
- if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, "04:00.0;arg=val") < 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, "04:00.0,arg=val") < 0)
goto fail;
if (rte_eal_devargs_add(RTE_DEVTYPE_BLACKLISTED_PCI, "0000:01:00.1") < 0)
goto fail;
@@ -80,20 +80,20 @@ test_devargs(void)
goto fail;
if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "eth_ring0") < 0)
goto fail;
- if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "eth_ring1;key=val;k2=val2") < 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "eth_ring1,key=val,k2=val2") < 0)
goto fail;
if (rte_eal_devargs_type_count(RTE_DEVTYPE_VIRTUAL) != 2)
goto fail;
free_devargs_list();
/* check virtual device with argument parsing */
- if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "eth_ring1;k1=val;k2=val2") < 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_VIRTUAL, "eth_ring1,k1=val,k2=val2") < 0)
goto fail;
devargs = TAILQ_FIRST(&devargs_list);
if (strncmp(devargs->virtual.drv_name, "eth_ring1",
sizeof(devargs->virtual.drv_name) != 0))
goto fail;
- if (strncmp(devargs->args, "k1=val;k2=val2", sizeof(devargs->args) != 0))
+ if (strncmp(devargs->args, "k1=val,k2=val2", sizeof(devargs->args) != 0))
goto fail;
free_devargs_list();
@@ -117,7 +117,7 @@ test_devargs(void)
goto fail;
if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "foo") == 0)
goto fail;
- if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, ";") == 0)
+ if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, ",") == 0)
goto fail;
if (rte_eal_devargs_add(RTE_DEVTYPE_WHITELISTED_PCI, "000f:0:0") == 0)
goto fail;
diff --git a/app/test/test_eal_flags.c b/app/test/test_eal_flags.c
index 9bab1a5..45d3d02 100644
--- a/app/test/test_eal_flags.c
+++ b/app/test/test_eal_flags.c
@@ -313,8 +313,8 @@ test_whitelist_flag(void)
const char *wlval2[] = {prgname, prefix, mp_flag, "-n", "1", "-c", "1",
use_device, "09:0B.3", use_device, "0a:0b.1"};
const char *wlval3[] = {prgname, prefix, mp_flag, "-n", "1", "-c", "1",
- use_device, "09:0B.3;type=test",
- use_device, "08:00.1;type=normal"};
+ use_device, "09:0B.3,type=test",
+ use_device, "08:00.1,type=normal"};
for (i = 0; i < sizeof(wlinval) / sizeof(wlinval[0]); i++) {
if (launch_proc(wlinval[i]) == 0) {
diff --git a/app/test/test_kvargs.c b/app/test/test_kvargs.c
index 2db9d08..c417ba2 100644
--- a/app/test/test_kvargs.c
+++ b/app/test/test_kvargs.c
@@ -84,7 +84,7 @@ static int test_valid_kvargs(void)
rte_kvargs_free(kvlist);
/* first test without valid_keys */
- args = "foo=1234;check=value0;check=value1";
+ args = "foo=1234,check=value0,check=value1";
valid_keys = NULL;
kvlist = rte_kvargs_parse(args, valid_keys);
if (kvlist == NULL) {
@@ -145,7 +145,7 @@ static int test_valid_kvargs(void)
rte_kvargs_free(kvlist);
/* second test using valid_keys */
- args = "foo=droids;check=value0;check=value1;check=wrong_value";
+ args = "foo=droids,check=value0,check=value1,check=wrong_value";
valid_keys = valid_keys_list;
kvlist = rte_kvargs_parse(args, valid_keys);
if (kvlist == NULL) {
@@ -190,11 +190,11 @@ static int test_invalid_kvargs(void)
/* list of argument that should fail */
const char *args_list[] = {
"wrong-key=x", /* key not in valid_keys_list */
- "foo=1;foo=", /* empty value */
- "foo=1;;foo=2", /* empty key/value */
- "foo=1;foo", /* no value */
- "foo=1;=2", /* no key */
- ";=", /* also test with a smiley */
+ "foo=1,foo=", /* empty value */
+ "foo=1,,foo=2", /* empty key/value */
+ "foo=1,foo", /* no value */
+ "foo=1,=2", /* no key */
+ ",=", /* also test with a smiley */
NULL };
const char **args;
const char *valid_keys_list[] = { "foo", "check", NULL };
diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c
index de4ac6c..3d6656a 100644
--- a/lib/librte_eal/common/eal_common_devargs.c
+++ b/lib/librte_eal/common/eal_common_devargs.c
@@ -70,8 +70,8 @@ rte_eal_devargs_add(enum rte_devtype devtype, const char *devargs_str)
memset(devargs, 0, sizeof(*devargs));
devargs->type = devtype;
- /* set the first ';' to '\0' to split name and arguments */
- sep = strchr(buf, ';');
+ /* set the first ',' to '\0' to split name and arguments */
+ sep = strchr(buf, ',');
if (sep != NULL) {
sep[0] = '\0';
snprintf(devargs->args, sizeof(devargs->args), "%s", sep + 1);
diff --git a/lib/librte_eal/common/include/rte_devargs.h b/lib/librte_eal/common/include/rte_devargs.h
index fbfbe45..6dd901a 100644
--- a/lib/librte_eal/common/include/rte_devargs.h
+++ b/lib/librte_eal/common/include/rte_devargs.h
@@ -96,12 +96,12 @@ extern struct rte_devargs_list devargs_list;
* Add a device to the user device list
*
* For PCI devices, the format of arguments string is "PCI_ADDR" or
- * "PCI_ADDR;key=val;key2=val2;...". Examples: "08:00.1", "0000:5:00.0",
- * "04:00.0;arg=val".
+ * "PCI_ADDR,key=val,key2=val2,...". Examples: "08:00.1", "0000:5:00.0",
+ * "04:00.0,arg=val".
*
* For virtual devices, the format of arguments string is "DRIVER_NAME*"
- * or "DRIVER_NAME*;key=val;key2=val2;...". Examples: "eth_ring",
- * "eth_ring0", "eth_pmdAnything;arg=0:arg2=1". The validity of the
+ * or "DRIVER_NAME*,key=val,key2=val2,...". Examples: "eth_ring",
+ * "eth_ring0", "eth_pmdAnything,arg=0:arg2=1". The validity of the
* driver name is not checked by this function, it is done when probing
* the drivers.
*
diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 6502755..67b2097 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -612,7 +612,7 @@ eal_parse_use_device(const char *optarg)
return -1;
/* remove arguments in 'dup' string */
- sep = strchr(dup, ';');
+ sep = strchr(dup, ',');
if (sep != NULL)
*sep = '\0';
diff --git a/lib/librte_kvargs/rte_kvargs.h b/lib/librte_kvargs/rte_kvargs.h
index 71c9630..ef4efab 100644
--- a/lib/librte_kvargs/rte_kvargs.h
+++ b/lib/librte_kvargs/rte_kvargs.h
@@ -40,7 +40,7 @@
* RTE Argument parsing
*
* This module can be used to parse arguments whose format is
- * key1=value1;key2=value2;key3=value3;...
+ * key1=value1,key2=value2,key3=value3,...
*
* The same key can appear several times with the same or a different
* value. Indeed, the arguments are stored as a list of key/values
@@ -58,7 +58,7 @@ extern "C" {
#define RTE_KVARGS_MAX 32
/** separator character used between each pair */
-#define RTE_KVARGS_PAIRS_DELIM ";"
+#define RTE_KVARGS_PAIRS_DELIM ","
/** separator character used between key and value */
#define RTE_KVARGS_KV_DELIM "="
@@ -83,7 +83,7 @@ struct rte_kvargs {
* Allocate a rte_kvargs and store key/value associations from a string
*
* The function allocates and fills a rte_kvargs structure from a given
- * string whose format is key1=value1;key2=value2;...
+ * string whose format is key1=value1,key2=value2,...
*
* The structure can be freed with rte_kvargs_free().
*
--
1.8.5.3
next prev parent reply other threads:[~2014-02-28 17:24 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-28 17:25 [dpdk-dev] [PATCH 00/11] eal: allow virtual pmd drivers as shared lib Olivier Matz
2014-02-28 17:25 ` [dpdk-dev] [PATCH 01/11] mk: use whole-archive option when creating dpdk binaries Olivier Matz
2014-04-10 13:58 ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 02/11] devices-args: introduce rte_devargs in eal Olivier Matz
2014-02-28 21:39 ` Stephen Hemminger
2014-03-01 12:02 ` Olivier MATZ
2014-03-01 12:14 ` [dpdk-dev] [PATCH v2 " Olivier Matz
2014-04-10 13:59 ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 03/11] devices-args: use rte_devargs and remove old whitelist code Olivier Matz
2014-03-01 12:14 ` [dpdk-dev] [PATCH v2 " Olivier Matz
2014-04-10 14:01 ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 04/11] devices-args: add a dump_devargs command in basic test application Olivier Matz
2014-04-10 14:02 ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 05/11] pci: rename device_list as pci_device_list Olivier Matz
2014-04-10 14:03 ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 06/11] vdev: rename eal_common_nonpci_devs.c as eal_common_vdev.c Olivier Matz
2014-04-10 14:39 ` Thomas Monjalon
2014-04-11 7:36 ` [dpdk-dev] [PATCH v2 06/11] vdev: rename nonpci_devs as vdev Olivier Matz
2014-04-11 11:25 ` Thomas Monjalon
2014-04-11 11:45 ` [dpdk-dev] [PATCH v3 " Olivier Matz
2014-04-11 12:37 ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 07/11] vdev: allow external registration of virtual device drivers Olivier Matz
2014-04-10 14:55 ` Thomas Monjalon
2014-04-11 7:36 ` [dpdk-dev] [PATCH v2 07/11 1/2] vdev: new registration API Olivier Matz
2014-04-11 7:36 ` [dpdk-dev] [PATCH v2 07/11 2/2] vdev: allow external registration of virtual device drivers Olivier Matz
2014-04-11 14:31 ` Thomas Monjalon
2014-04-11 10:49 ` [dpdk-dev] [PATCH v2 07/11 1/2] vdev: new registration API Neil Horman
2014-04-11 13:11 ` Thomas Monjalon
2014-04-11 15:50 ` Neil Horman
2014-04-11 16:18 ` Thomas Monjalon
2014-04-11 17:44 ` Neil Horman
2014-04-11 20:08 ` Richardson, Bruce
2014-04-12 6:05 ` Thomas Monjalon
2014-04-12 11:03 ` Neil Horman
2014-04-12 11:23 ` Richardson, Bruce
2014-04-12 14:06 ` Neil Horman
2014-04-14 13:20 ` John W. Linville
2014-04-14 13:45 ` Thomas Monjalon
2014-04-14 13:54 ` Neil Horman
2014-04-14 14:10 ` John W. Linville
2014-04-14 14:39 ` Thomas Monjalon
2014-04-11 14:31 ` Thomas Monjalon
2014-02-28 17:25 ` Olivier Matz [this message]
2014-04-10 14:05 ` [dpdk-dev] [PATCH 08/11] device-args: use a comma instead of semicolon to separate key/values Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 09/11] device-args: replace use-device eal option by pci-whitelist and vdev Olivier Matz
2014-03-01 12:14 ` [dpdk-dev] [PATCH v2 " Olivier Matz
2014-04-10 14:06 ` Thomas Monjalon
2014-03-03 17:14 ` [dpdk-dev] [PATCH " Richardson, Bruce
2014-03-04 13:09 ` Olivier MATZ
2014-03-04 13:14 ` Richardson, Bruce
2014-03-24 22:39 ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 10/11] device-args: allow to provide per pci device command line arguments Olivier Matz
2014-03-01 12:14 ` [dpdk-dev] [PATCH v2 " Olivier Matz
2014-04-10 14:06 ` Thomas Monjalon
2014-02-28 17:25 ` [dpdk-dev] [PATCH 11/11] testpmd: add several dump commands, useful for debug Olivier Matz
2014-03-01 12:15 ` [dpdk-dev] [PATCH v2 " Olivier Matz
2014-04-10 14:08 ` 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=1393608350-4431-9-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).