From cfc980c614925bfa57feffb27609861fbba262af Mon Sep 17 00:00:00 2001 From: Mike Rapoport Date: Tue, 15 Aug 2017 09:23:49 +0300 Subject: [PATCH] kdat: move kerndat initialization to the very beginning With kdat cache and unified kerndat_init() we can call it very early in crtools and then kdat information will be available for all cr-* actions. Signed-off-by: Mike Rapoport Signed-off-by: Pavel Emelyanov --- criu/cr-dump.c | 6 ------ criu/cr-restore.c | 3 --- criu/crtools.c | 4 ++++ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/criu/cr-dump.c b/criu/cr-dump.c index 8fdf85259..985a64ba5 100644 --- a/criu/cr-dump.c +++ b/criu/cr-dump.c @@ -1553,9 +1553,6 @@ int cr_pre_dump_tasks(pid_t pid) if (cr_plugin_init(CR_PLUGIN_STAGE__PRE_DUMP)) goto err; - if (kerndat_init()) - goto err; - if (lsm_check_opts()) goto err; @@ -1732,9 +1729,6 @@ int cr_dump_tasks(pid_t pid) if (cr_plugin_init(CR_PLUGIN_STAGE__DUMP)) goto err; - if (kerndat_init()) - goto err; - if (lsm_check_opts()) goto err; diff --git a/criu/cr-restore.c b/criu/cr-restore.c index bbe0bc670..1c11cdf39 100644 --- a/criu/cr-restore.c +++ b/criu/cr-restore.c @@ -2197,9 +2197,6 @@ int cr_restore_tasks(void) if (init_stats(RESTORE_STATS)) goto err; - if (kerndat_init()) - goto err; - if (lsm_check_opts()) goto err; diff --git a/criu/crtools.c b/criu/crtools.c index af1f0c588..ebfd1d6a7 100644 --- a/criu/crtools.c +++ b/criu/crtools.c @@ -47,6 +47,7 @@ #include "fault-injection.h" #include "lsm.h" #include "proc_parse.h" +#include "kerndat.h" #include "setproctitle.h" #include "sysctl.h" @@ -316,6 +317,9 @@ int main(int argc, char *argv[], char *envp[]) if (init_service_fd()) return 1; + if (kerndat_init()) + return 1; + if (!strcmp(argv[1], "swrk")) { if (argc < 3) goto usage;