Commit 4bd4b5fc authored by Adrian Reber's avatar Adrian Reber Committed by Andrei Vagin

config: move init_opts() to config.c

This just moves the functions init_opts() and deprecated_ok() also to
config.c as that is where most of the option and configuration setup
and handling is done today.
Signed-off-by: 's avatarAdrian Reber <areber@redhat.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent f3f6edb4
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
#include "common/xmalloc.h" #include "common/xmalloc.h"
struct cr_options opts;
char **global_conf = NULL; char **global_conf = NULL;
char **user_conf = NULL; char **user_conf = NULL;
...@@ -219,6 +221,40 @@ static int init_config(int argc, char **argv, int *global_cfg_argc, int *user_cf ...@@ -219,6 +221,40 @@ static int init_config(int argc, char **argv, int *global_cfg_argc, int *user_cf
return 0; return 0;
} }
void init_opts(void)
{
memset(&opts, 0, sizeof(opts));
/* Default options */
opts.final_state = TASK_DEAD;
INIT_LIST_HEAD(&opts.ext_mounts);
INIT_LIST_HEAD(&opts.inherit_fds);
INIT_LIST_HEAD(&opts.external);
INIT_LIST_HEAD(&opts.join_ns);
INIT_LIST_HEAD(&opts.new_cgroup_roots);
INIT_LIST_HEAD(&opts.irmap_scan_paths);
opts.cpu_cap = CPU_CAP_DEFAULT;
opts.manage_cgroups = CG_MODE_DEFAULT;
opts.ps_socket = -1;
opts.ghost_limit = DEFAULT_GHOST_LIMIT;
opts.timeout = DEFAULT_TIMEOUT;
opts.empty_ns = 0;
opts.status_fd = -1;
opts.log_level = DEFAULT_LOGLEVEL;
}
bool deprecated_ok(char *what)
{
if (opts.deprecated_ok)
return true;
pr_err("Deprecated functionality (%s) rejected.\n", what);
pr_err("Use the --deprecated option or set CRIU_DEPRECATED environment.\n");
pr_err("For details visit https://criu.org/Deprecation\n");
return false;
}
static int parse_cpu_cap(struct cr_options *opts, const char *optarg) static int parse_cpu_cap(struct cr_options *opts, const char *optarg)
{ {
bool inverse = false; bool inverse = false;
......
...@@ -52,42 +52,6 @@ ...@@ -52,42 +52,6 @@
#include "setproctitle.h" #include "setproctitle.h"
#include "sysctl.h" #include "sysctl.h"
struct cr_options opts;
void init_opts(void)
{
memset(&opts, 0, sizeof(opts));
/* Default options */
opts.final_state = TASK_DEAD;
INIT_LIST_HEAD(&opts.ext_mounts);
INIT_LIST_HEAD(&opts.inherit_fds);
INIT_LIST_HEAD(&opts.external);
INIT_LIST_HEAD(&opts.join_ns);
INIT_LIST_HEAD(&opts.new_cgroup_roots);
INIT_LIST_HEAD(&opts.irmap_scan_paths);
opts.cpu_cap = CPU_CAP_DEFAULT;
opts.manage_cgroups = CG_MODE_DEFAULT;
opts.ps_socket = -1;
opts.ghost_limit = DEFAULT_GHOST_LIMIT;
opts.timeout = DEFAULT_TIMEOUT;
opts.empty_ns = 0;
opts.status_fd = -1;
opts.log_level = DEFAULT_LOGLEVEL;
}
bool deprecated_ok(char *what)
{
if (opts.deprecated_ok)
return true;
pr_err("Deprecated functionality (%s) rejected.\n", what);
pr_err("Use the --deprecated option or set CRIU_DEPRECATED environment.\n");
pr_err("For details visit https://criu.org/Deprecation\n");
return false;
}
static void rlimit_unlimit_nofile_self(void) static void rlimit_unlimit_nofile_self(void)
{ {
struct rlimit new; struct rlimit new;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment