From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4603A09FD for ; Fri, 18 Dec 2020 16:17:19 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B920ECB41; Fri, 18 Dec 2020 16:17:18 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 42DB0CAFF for ; Fri, 18 Dec 2020 16:17:10 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@nvidia.com) with SMTP; 18 Dec 2020 17:17:04 +0200 Received: from nvidia.com (pegasus05.mtr.labs.mlnx [10.210.16.100]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0BIFH4qZ010856; Fri, 18 Dec 2020 17:17:04 +0200 From: Xueming Li To: Viacheslav Ovsiienko , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Olivier Matz , Matan Azrad Cc: dev@dpdk.org, xuemingl@nvidia.com, Asaf Penso , gaetan.rivet@6wind.com, stable@dpdk.org Date: Fri, 18 Dec 2020 15:16:46 +0000 Message-Id: <1608304614-13908-2-git-send-email-xuemingl@nvidia.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1608304614-13908-1-git-send-email-xuemingl@nvidia.com> References: <1608304614-13908-1-git-send-email-xuemingl@nvidia.com> Subject: [dpdk-stable] [RFC 1/9] devargs: fix data buffer storage type X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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 --- 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 --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. */ }; /** -- 2.25.1