[CRIU] [PATCH 1/3] criu/config: rename variables counting options in config files

Mike Rapoport rppt at linux.vnet.ibm.com
Wed May 9 17:17:50 MSK 2018


s/first_count/global_cfg_argc
s/second_count/user_cfg_argc

Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
 criu/config.c          | 6 +++---
 criu/crtools.c         | 8 ++++----
 criu/include/crtools.h | 3 ++-
 3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/criu/config.c b/criu/config.c
index 10630c6..5ff433c 100644
--- a/criu/config.c
+++ b/criu/config.c
@@ -184,7 +184,7 @@ static void init_configuration(int argc, char *argv[], int defaults_forbidden)
 	}
 }
 
-void init_config(int argc, char **argv, int *first_count, int *second_count)
+void init_config(int argc, char **argv, int *global_cfg_argc, int *user_cfg_argc)
 {
 	int help_or_configs;
 	bool usage_error;
@@ -198,7 +198,7 @@ void init_config(int argc, char **argv, int *first_count, int *second_count)
 
 	init_configuration(argc, argv, (help_or_configs == DEFAULT_CONFIGS_FORBIDDEN));
 	if (global_conf != NULL)
-		*first_count = count_elements(global_conf);
+		*global_cfg_argc = count_elements(global_conf);
 	if (user_conf != NULL)
-		*second_count = count_elements(user_conf);
+		*user_cfg_argc = count_elements(user_conf);
 }
diff --git a/criu/crtools.c b/criu/crtools.c
index 26ae8d1..d9645ad 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -267,7 +267,7 @@ int main(int argc, char *argv[], char *envp[])
 	bool has_exec_cmd = false;
 	bool has_sub_command;
 	int opt = 0, idx;
-	int first_count = 1, second_count = 1;
+	int global_cfg_argc = 0, user_cfg_argc = 0;
 	int state = PARSING_GLOBAL_CONF;
 	int log_level = DEFAULT_LOGLEVEL;
 	char *imgs_dir = ".";
@@ -391,17 +391,17 @@ int main(int argc, char *argv[], char *envp[])
 		return cr_service_work(atoi(argv[2]));
 	}
 
-	init_config(argc, argv, &first_count, &second_count);
+	init_config(argc, argv, &global_cfg_argc, &user_cfg_argc);
 
 	while (1) {
 		idx = -1;
 
 		switch (state) {
 		case PARSING_GLOBAL_CONF:
-			opt = getopt_long(first_count, global_conf, short_opts, long_opts, &idx);
+			opt = getopt_long(global_cfg_argc, global_conf, short_opts, long_opts, &idx);
 			break;
 		case PARSING_USER_CONF:
-			opt = getopt_long(second_count, user_conf, short_opts, long_opts, &idx);
+			opt = getopt_long(user_cfg_argc, user_conf, short_opts, long_opts, &idx);
 			break;
 		case PARSING_ARGV:
 			opt = getopt_long(argc, argv, short_opts, long_opts, &idx);
diff --git a/criu/include/crtools.h b/criu/include/crtools.h
index 75038f8..234894f 100644
--- a/criu/include/crtools.h
+++ b/criu/include/crtools.h
@@ -32,7 +32,8 @@ extern int cr_lazy_pages(bool daemon);
 extern int check_add_feature(char *arg);
 extern void pr_check_features(const char *offset, const char *sep, int width);
 
-extern void init_config(int argc, char **argv, int *first_cnt, int *second_cnt);
+extern void init_config(int argc, char **argv,
+			int *global_cfg_argc, int *user_cfg_argc);
 
 #define PPREP_HEAD_INACTIVE	((struct pprep_head *)-1)
 
-- 
2.7.4



More information about the CRIU mailing list