env_dpdk: add spdk_env_dpdk_external_init()
This function indicates whether DPDK was initialized external to the SPDK env_dpdk library. This can be used in cases where we need to implement different behavior when DPDK is initialized outside of SPDK - in that case certain flags that SPDK would prefer may not have been specified. This will be used in the next patch. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I58d285bd4d9cda96b108624d65dedbec32164cfe Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446458 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
This commit is contained in:
parent
d631b855ff
commit
725f9de39a
@ -52,6 +52,14 @@ extern "C" {
|
||||
*/
|
||||
int spdk_env_dpdk_post_init(void);
|
||||
|
||||
/**
|
||||
* Check if DPDK was initialized external to the SPDK env_dpdk library.
|
||||
*
|
||||
* \return true if DPDK was initialized external to the SPDK env_dpdk library.
|
||||
* \return false otherwise
|
||||
*/
|
||||
bool spdk_env_dpdk_external_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -50,6 +50,7 @@
|
||||
|
||||
static char **g_eal_cmdline;
|
||||
static int g_eal_cmdline_argcount;
|
||||
static bool g_external_init = true;
|
||||
|
||||
static char *
|
||||
_sprintf_alloc(const char *format, ...)
|
||||
@ -395,6 +396,8 @@ spdk_env_init(const struct spdk_env_opts *opts)
|
||||
int i, rc;
|
||||
int orig_optind;
|
||||
|
||||
g_external_init = false;
|
||||
|
||||
rc = spdk_build_eal_cmdline(opts);
|
||||
if (rc < 0) {
|
||||
fprintf(stderr, "Invalid arguments to initialize DPDK\n");
|
||||
@ -445,3 +448,9 @@ spdk_env_init(const struct spdk_env_opts *opts)
|
||||
|
||||
return spdk_env_dpdk_post_init();
|
||||
}
|
||||
|
||||
bool
|
||||
spdk_env_dpdk_external_init(void)
|
||||
{
|
||||
return g_external_init;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user