From: Anatoly Burakov Date: Tue, 15 May 2018 10:44:52 +0000 (+0100) Subject: eal: move runtime directory creation after args parsing X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3f697d2ee592867c11c8378ef517f003e06dd6f0;p=dpdk.git eal: move runtime directory creation after args parsing The intention of the original code was to create runtime data directory as early as possible, however it was moved too early, before the arguments were parsed, resulting in --file-prefix option essentially not working. Fix this by moving eal_create_runtime_dir() to after command line arguments parsing. Fixes: 56236363b481 ("eal: add directory for runtime data") Reported-by: Andrew Rybchenko Signed-off-by: Anatoly Burakov Tested-by: Andrew Rybchenko --- diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c index c890bfe347..7f8475eac7 100644 --- a/lib/librte_eal/bsdapp/eal/eal.c +++ b/lib/librte_eal/bsdapp/eal/eal.c @@ -586,13 +586,6 @@ rte_eal_init(int argc, char **argv) /* set log level as early as possible */ eal_log_level_parse(argc, argv); - /* create runtime data directory */ - if (eal_create_runtime_dir() < 0) { - rte_eal_init_alert("Cannot create runtime directory\n"); - rte_errno = EACCES; - return -1; - } - if (rte_eal_cpu_init() < 0) { rte_eal_init_alert("Cannot detect lcores."); rte_errno = ENOTSUP; @@ -607,6 +600,13 @@ rte_eal_init(int argc, char **argv) return -1; } + /* create runtime data directory */ + if (eal_create_runtime_dir() < 0) { + rte_eal_init_alert("Cannot create runtime directory\n"); + rte_errno = EACCES; + return -1; + } + /* FreeBSD always uses legacy memory model */ internal_config.legacy_mem = true; diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c index bed5823bd7..150d5dd139 100644 --- a/lib/librte_eal/linuxapp/eal/eal.c +++ b/lib/librte_eal/linuxapp/eal/eal.c @@ -803,13 +803,6 @@ rte_eal_init(int argc, char **argv) /* set log level as early as possible */ eal_log_level_parse(argc, argv); - /* create runtime data directory */ - if (eal_create_runtime_dir() < 0) { - rte_eal_init_alert("Cannot create runtime directory\n"); - rte_errno = EACCES; - return -1; - } - if (rte_eal_cpu_init() < 0) { rte_eal_init_alert("Cannot detect lcores."); rte_errno = ENOTSUP; @@ -824,6 +817,13 @@ rte_eal_init(int argc, char **argv) return -1; } + /* create runtime data directory */ + if (eal_create_runtime_dir() < 0) { + rte_eal_init_alert("Cannot create runtime directory\n"); + rte_errno = EACCES; + return -1; + } + if (eal_plugins_init() < 0) { rte_eal_init_alert("Cannot init plugins\n"); rte_errno = EINVAL;