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>
This commit is contained in:
Jim Harris 2021-08-06 22:00:25 +00:00 committed by Tomasz Zawadzki
parent 33acbe9caf
commit 690783a3ae

View File

@ -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__