forked from daos-stack/spdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0001-env_dpdk-tokenize-env_context.patch
54 lines (48 loc) · 1.72 KB
/
0001-env_dpdk-tokenize-env_context.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
From 690783a3ae82ebe58c00d643520a66103d66d540 Mon Sep 17 00:00:00 2001
From: Jim Harris <james.r.harris@intel.com>
Date: Fri, 6 Aug 2021 22:00:25 +0000
Subject: [PATCH] env_dpdk: tokenize env_context
DPDK requires each command line parameter to be
passed as a separate string in the args array. So
we need to tokenize opts.env_context to handle the
case where a user passes multiple arguments in the
env_context string.
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: Ifc72a7c25b31f1296d3aba3a3f7664ad8edf128f
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9132
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
---
lib/env_dpdk/init.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/lib/env_dpdk/init.c b/lib/env_dpdk/init.c
index 9c8962eaa..5854bd9cb 100644
--- a/lib/env_dpdk/init.c
+++ b/lib/env_dpdk/init.c
@@ -401,10 +401,19 @@ build_eal_cmdline(const struct spdk_env_opts *opts)
}
if (opts->env_context) {
- args = push_arg(args, &argcount, strdup(opts->env_context));
- if (args == NULL) {
- return -1;
+ char *ptr = strdup(opts->env_context);
+ char *tok = strtok(ptr, " \t");
+
+ /* DPDK expects each argument as a separate string in the argv
+ * array, so we need to tokenize here in case the caller
+ * passed multiple arguments in the env_context string.
+ */
+ while (tok != NULL) {
+ args = push_arg(args, &argcount, strdup(tok));
+ tok = strtok(NULL, " \t");
}
+
+ free(ptr);
}
#ifdef __linux__
--
2.26.2