diff mbox series

[RFC,1/9] devargs: fix data buffer storage type

Message ID 1608304614-13908-2-git-send-email-xuemingl@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series support global syntax | expand

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Xueming(Steven) Li Dec. 18, 2020, 3:16 p.m. UTC
The data field fo struct devargs is used as data scratch buffer, not a
const, remove.

Also fixes references to data field of struct devargs.

Fixes: 338327d731e6 ("devargs: add function to parse device layers")
Fixes: c99a2d4c6b7f ("eal: implement device iteration initialization")
Cc: gaetan.rivet@6wind.com
Cc: stable@dpdk.org

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
 examples/vdpa/main.c                   | 6 ++++--
 lib/librte_eal/common/eal_common_dev.c | 3 +--
 lib/librte_eal/include/rte_dev.h       | 2 +-
 lib/librte_eal/include/rte_devargs.h   | 2 +-
 4 files changed, 7 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/examples/vdpa/main.c b/examples/vdpa/main.c
index 97e967b9a2..88e9d8780a 100644
--- a/examples/vdpa/main.c
+++ b/examples/vdpa/main.c
@@ -294,9 +294,10 @@  static void cmd_list_vdpa_devices_parsed(
 	struct rte_vdpa_device *vdev;
 	struct rte_device *dev;
 	struct rte_dev_iterator dev_iter;
+	char args[16];
 
 	cmdline_printf(cl, "device name\tqueue num\tsupported features\n");
-	RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
+	RTE_DEV_FOREACH(dev, strcpy(args, "class=vdpa"), &dev_iter) {
 		vdev = rte_vdpa_find_device_by_name(dev->name);
 		if (!vdev)
 			continue;
@@ -528,6 +529,7 @@  main(int argc, char *argv[])
 	struct rte_vdpa_device *vdev;
 	struct rte_device *dev;
 	struct rte_dev_iterator dev_iter;
+	char args[16];
 
 	ret = rte_eal_init(argc, argv);
 	if (ret < 0)
@@ -549,7 +551,7 @@  main(int argc, char *argv[])
 		cmdline_interact(cl);
 		cmdline_stdin_exit(cl);
 	} else {
-		RTE_DEV_FOREACH(dev, "class=vdpa", &dev_iter) {
+		RTE_DEV_FOREACH(dev, strcpy(args, "class=vdpa"), &dev_iter) {
 			vdev = rte_vdpa_find_device_by_name(dev->name);
 			if (vdev == NULL) {
 				rte_panic("Failed to find vDPA dev for %s\n",
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 8a3bd3100a..793fbdf24b 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -572,8 +572,7 @@  rte_dev_event_callback_process(const char *device_name,
 }
 
 int
-rte_dev_iterator_init(struct rte_dev_iterator *it,
-		      const char *dev_str)
+rte_dev_iterator_init(struct rte_dev_iterator *it, char *dev_str)
 {
 	struct rte_devargs devargs;
 	struct rte_class *cls = NULL;
diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
index 6dd72c11a1..b320e98637 100644
--- a/lib/librte_eal/include/rte_dev.h
+++ b/lib/librte_eal/include/rte_dev.h
@@ -299,7 +299,7 @@  typedef void *(*rte_dev_iterate_t)(const void *start,
  */
 __rte_experimental
 int
-rte_dev_iterator_init(struct rte_dev_iterator *it, const char *str);
+rte_dev_iterator_init(struct rte_dev_iterator *it, char *str);
 
 /**
  * Iterates on a device iterator.
diff --git a/lib/librte_eal/include/rte_devargs.h b/lib/librte_eal/include/rte_devargs.h
index 296f19324f..8a5ffa2af2 100644
--- a/lib/librte_eal/include/rte_devargs.h
+++ b/lib/librte_eal/include/rte_devargs.h
@@ -69,7 +69,7 @@  struct rte_devargs {
 	struct rte_class *cls; /**< class handle. */
 	const char *bus_str; /**< bus-related part of device string. */
 	const char *cls_str; /**< class-related part of device string. */
-	const char *data; /**< Device string storage. */
+	char *data; /**< Device string storage. */
 };
 
 /**