DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1 01/13] common/mlx5: replace strsep with strtok_r
@ 2020-08-20 14:50 Ophir Munk
  2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 02/13] common/mlx5: replace linux __bexx types with rte Ophir Munk
                   ` (13 more replies)
  0 siblings, 14 replies; 30+ messages in thread
From: Ophir Munk @ 2020-08-20 14:50 UTC (permalink / raw)
  To: dev; +Cc: Ophir Munk, Gregory Etelson, Ophir Munk

From: Ophir Munk <ophirmu@mellanox.com>

strsep() is a non-standardized API (by C or POSIX) and thus it is
non-portable between different operating systems. Replace it with
strtok_r() which is standardized by the C standard, and hence also by
POSIX.
The replacement occurs in the code that extracts individual PCI class
names (e.g. class=net:vdpa:foo:bar).

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
---
 drivers/common/mlx5/mlx5_common_pci.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index d4ff039..02417c6 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -72,6 +72,7 @@ bus_cmdline_options_handler(__rte_unused const char *key,
 	int class_val;
 	char *found;
 	char *nstr;
+	char *refstr = NULL;
 
 	*ret = 0;
 	nstr = strdup(class_names);
@@ -80,21 +81,22 @@ bus_cmdline_options_handler(__rte_unused const char *key,
 		return *ret;
 	}
 	nstr_org = nstr;
-	while (nstr) {
+	found = strtok_r(nstr, ":", &refstr);
+	if (!found)
+		goto err;
+	do {
 		/* Extract each individual class name. Multiple
 		 * class key,value is supplied as class=net:vdpa:foo:bar.
 		 */
-		found = strsep(&nstr, ":");
-		if (!found)
-			continue;
-		/* Check if its a valid class. */
 		class_val = class_name_to_value(found);
+		/* Check if its a valid class. */
 		if (class_val < 0) {
 			*ret = -EINVAL;
 			goto err;
 		}
 		*ret |= class_val;
-	}
+		found = strtok_r(NULL, ":", &refstr);
+	} while (found);
 err:
 	free(nstr_org);
 	if (*ret < 0)
-- 
2.8.4


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2020-09-22 12:20 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-20 14:50 [dpdk-dev] [PATCH v1 01/13] common/mlx5: replace strsep with strtok_r Ophir Munk
2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 02/13] common/mlx5: replace linux __bexx types with rte Ophir Munk
2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 03/13] net/mlx5: rename mlx5 enumeration REG_NONE Ophir Munk
2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 04/13] net/mlx5: move mlx5_get_ifname prototype under Linux Ophir Munk
2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 05/13] net/mlx5: fix removal of unused inclusion files Ophir Munk
2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 06/13] net/mlx5: remove Netlink dependency in shared code Ophir Munk
2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 07/13] net/mlx5: fix unused utility macros Ophir Munk
2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 08/13] net/mlx5: call meter detach only if DR is supported Ophir Munk
2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 09/13] net/mlx5: add ICMP protocol number definition Ophir Munk
2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 10/13] net/mlx5: remove more DV dependencies Ophir Munk
2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 11/13] net/mlx5: remove ibv_* dependency in rx/tx objects Ophir Munk
2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 12/13] net/mlx5: separate vlan strip modification Ophir Munk
2020-08-20 14:50 ` [dpdk-dev] [PATCH v1 13/13] linux/mlx5: refactor VLAN Ophir Munk
2020-08-25  9:31 ` [dpdk-dev] [PATCH v2 00/13] mlx5 PMD multi OS support - part #4 Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 01/13] common/mlx5: replace strsep with strtok_r Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 02/13] common/mlx5: replace Linux __bexx types with rte Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 03/13] net/mlx5: rename mlx5 enumeration REG_NONE Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 04/13] net/mlx5: move mlx5_get_ifname prototype under Linux Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 05/13] net/mlx5: fix removal of unused inclusion files Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 06/13] net/mlx5: remove Netlink dependency in shared code Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 07/13] net/mlx5: fix unused utility macros Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 08/13] net/mlx5: call meter detach only if DR is supported Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 09/13] net/mlx5: add ICMP protocol number definition Ophir Munk
2020-09-22 11:49     ` Thomas Monjalon
2020-09-22 12:20       ` Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 10/13] net/mlx5: remove more DV dependencies Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 11/13] net/mlx5: remove ibv_* dependency in Rx/Tx objects Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 12/13] net/mlx5: separate VLAN strip modification Ophir Munk
2020-08-25  9:31   ` [dpdk-dev] [PATCH v2 13/13] linux/mlx5: refactor VLAN Ophir Munk
     [not found] ` <20200825092943.26312-1-ophirmu@mellanox.com>
2020-08-27  9:53   ` [dpdk-dev] [PATCH v2 00/13] mlx5 PMD multi OS support - part #4 Raslan Darawsheh

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).