From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (xvm-189-124.dc0.ghst.net [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D599BA0524; Fri, 8 Jan 2021 15:55:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5BFB7140FE5; Fri, 8 Jan 2021 15:55:13 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by mails.dpdk.org (Postfix) with ESMTP id 71084140FAF for ; Fri, 8 Jan 2021 15:55:11 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from xuemingl@nvidia.com) with SMTP; 8 Jan 2021 16:55:05 +0200 Received: from nvidia.com ([172.27.8.145]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 108Et0Wv013726; Fri, 8 Jan 2021 16:55:03 +0200 From: Xueming Li To: Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , Olivier Matz Cc: dev@dpdk.org, Viacheslav Ovsiienko , xuemingl@nvidia.com, Asaf Penso , gaetan.rivet@6wind.com, stable@dpdk.org Date: Fri, 8 Jan 2021 22:54:35 +0800 Message-Id: <20210108145441.23320-2-xuemingl@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <1608304614-13908-2-git-send-email-xuemingl@nvidia.com> References: <1608304614-13908-2-git-send-email-xuemingl@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v1 1/7] devargs: fix data buffer storage type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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