#define INI_PATH "/etc/npu-engine.ini"
#define DEFAULT_RESV_MEM_SIZE 0 /* default mode is the CMA allocation */
-#define DEFAULT_TEST_MODE 1 /* test mode is enabled in default for unit tests */
#define DEFAULT_WORKING_DIR "/tmp/"
#define DEFAULT_LOG_DIR "/tmp/"
#define ENV_RESV_MEM_SIZE "NE_RESV_MEM_SIZE"
#define ENV_WORKING_DIR "NE_WORKING_DIR"
#define ENV_LOG_DIR "NE_LOG_DIR"
-#define ENV_TEST_MODE "NE_TEST_MODE"
static conf_t config;
const conf_t *conf = &config;
* @param[in] resv_mem_size config string for reserved mem size
* @param[in] working_dir config string for working dir
* @param[in] log_dir config string for log dir
- * @param[in] test_mode config string for test mode
* @param[out] c The configuration object to be updated.
* @note if a config param is NULL, it is not set. so use default one.
*/
static void
load_conf_each (const char *resv_mem_size, const char *working_dir,
- const char *log_dir, const int test_mode, conf_t *c)
+ const char *log_dir, conf_t *c)
{
if (resv_mem_size) {
uint64_t val;
strncpy (c->log_dir, log_dir, strlen(log_dir));
c->log_dir[strlen(log_dir)] = '\x00';
}
-
- if (test_mode != -1)
- c->test_mode = test_mode;
}
/**
const char *resv_mem_size = iniparser_getstring(ini, "main:resv_mem_size", NULL);
const char *working_dir = iniparser_getstring(ini, "main:working_dir", NULL);
const char *log_dir = iniparser_getstring(ini, "main:log_dir", NULL);
- int test_mode = iniparser_getboolean(ini, "main:test_mode", -1);
- load_conf_each (resv_mem_size, working_dir, log_dir, test_mode, c);
+ load_conf_each (resv_mem_size, working_dir, log_dir, c);
}
/**
const char *resv_mem_size = getenv (ENV_RESV_MEM_SIZE);
const char *working_dir = getenv (ENV_WORKING_DIR);
const char *log_dir = getenv (ENV_LOG_DIR);
- const char *test_mode_str = getenv (ENV_TEST_MODE);
- int test_mode = -1;
-
- /* the below is iniparser's getboolean condition */
- if (test_mode_str) {
- test_mode = (test_mode_str[0] == '1'
- || test_mode_str[0] == 't' || test_mode_str[0] == 'T'
- || test_mode_str[0] == 'y' || test_mode_str[0] == 'Y');
- }
- load_conf_each (resv_mem_size, working_dir, log_dir, test_mode, c);
+ load_conf_each (resv_mem_size, working_dir, log_dir, c);
}
/**
config.reserved_mem_size = DEFAULT_RESV_MEM_SIZE;
- config.test_mode = DEFAULT_TEST_MODE;
-
strncpy (config.working_dir, DEFAULT_WORKING_DIR, strlen(DEFAULT_WORKING_DIR));
config.working_dir[strlen(DEFAULT_WORKING_DIR)] = '\x00';
return 0;
}
-
-/**
- * @brief Check if the current running mose is 'test'
- * @return 1 if in the 'test' mode, otherwise 0
- * @note The behavior of calling before loading default configuration is undefined.
- */
-int is_test_mode(void)
-{
- return config.test_mode;
-}
COMM_SOCIP,
COMM_PCIE,
} communication_method; /**< Determined at build-time. Not configurable at runtime. The activated N1x plugin. */
- int test_mode; /**< NE_TEST_MODE, [main] test_mode, indicates whether NE runs in test mode */
char working_dir[MAX_DIR_LEN]; /**< NE_WORKING_DIR, [main] working_dir, the path where the daemon is executed */
char log_dir[MAX_DIR_LEN]; /**< NE_LOG_DIR, [main] log_dir, the path where log files are created */
} conf_t;
*/
int load_conf(const char *inipath);
-/**
- * @brief Check if the current running mose is 'test'
- * @return 1 if in the 'test' mode, otherwise 0
- * @note The behavior of calling before loading default configuration is undefined.
- */
-int is_test_mode(void);
-
#endif /* NE_CONF_H__ */