[CRIU] [PATCH v2 1/4] Add log_level to the global options structure
Adrian Reber
adrian at lisas.de
Wed May 9 20:16:47 MSK 2018
From: Adrian Reber <areber at redhat.com>
For the upcoming RPC configuration file support the log_level needs to
be part of the global options structure, to be able to set it from the
RPC code path.
Signed-off-by: Adrian Reber <areber at redhat.com>
---
criu/crtools.c | 10 +++++-----
criu/include/cr_options.h | 1 +
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/criu/crtools.c b/criu/crtools.c
index 26ae8d1..27e54e0 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -80,6 +80,7 @@ void init_opts(void)
opts.timeout = DEFAULT_TIMEOUT;
opts.empty_ns = 0;
opts.status_fd = -1;
+ opts.log_level = DEFAULT_LOGLEVEL;
}
static int parse_join_ns(const char *ptr)
@@ -269,7 +270,6 @@ int main(int argc, char *argv[], char *envp[])
int opt = 0, idx;
int first_count = 1, second_count = 1;
int state = PARSING_GLOBAL_CONF;
- int log_level = DEFAULT_LOGLEVEL;
char *imgs_dir = ".";
#define BOOL_OPT(OPT_NAME, SAVE_TO) \
@@ -476,11 +476,11 @@ int main(int argc, char *argv[], char *envp[])
if (optarg) {
if (optarg[0] == 'v')
/* handle -vvvvv */
- log_level += strlen(optarg) + 1;
+ opts.log_level += strlen(optarg) + 1;
else
- log_level = atoi(optarg);
+ opts.log_level = atoi(optarg);
} else
- log_level++;
+ opts.log_level++;
break;
case 1043: {
int fd;
@@ -772,7 +772,7 @@ int main(int argc, char *argv[], char *envp[])
return 1;
}
- log_set_loglevel(log_level);
+ log_set_loglevel(opts.log_level);
if (log_init(opts.output))
return 1;
diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
index f0e84c1..1365b2e 100644
--- a/criu/include/cr_options.h
+++ b/criu/include/cr_options.h
@@ -123,6 +123,7 @@ struct cr_options {
bool orphan_pts_master;
int check_only;
int remote;
+ int log_level;
};
extern struct cr_options opts;
--
1.8.3.1
More information about the CRIU
mailing list