[CRIU] [PATCH 2/5] deduplication: add dedup comand to criu

Tikhomirov Pavel snorcht at gmail.com
Sun Oct 13 05:22:53 PDT 2013


Signed-off-by: Tikhomirov Pavel <snorcht at gmail.com>
---
 Makefile.crtools   |    1 +
 cr-dedup.c         |    9 +++++++++
 crtools.c          |    7 +++++++
 include/cr-dedup.h |    6 ++++++
 include/crtools.h  |    1 +
 5 files changed, 24 insertions(+)
 create mode 100644 cr-dedup.c
 create mode 100644 include/cr-dedup.h

diff --git a/Makefile.crtools b/Makefile.crtools
index facd8bc..35f2f25 100644
--- a/Makefile.crtools
+++ b/Makefile.crtools
@@ -11,6 +11,7 @@ obj-y	+= proc_parse.o
 obj-y	+= cr-dump.o
 obj-y	+= cr-show.o
 obj-y	+= cr-check.o
+obj-y	+= cr-dedup.o
 obj-y	+= util.o
 obj-y	+= sysctl.o
 obj-y	+= ptrace.o
diff --git a/cr-dedup.c b/cr-dedup.c
new file mode 100644
index 0000000..4f959dd
--- /dev/null
+++ b/cr-dedup.c
@@ -0,0 +1,9 @@
+#include <unistd.h>
+
+#include "crtools.h"
+#include "cr-dedup.h"
+
+int cr_dedup(void)
+{
+	return 0;
+}
diff --git a/crtools.c b/crtools.c
index fe725bf..051cc9e 100644
--- a/crtools.c
+++ b/crtools.c
@@ -30,6 +30,7 @@
 #include "tty.h"
 #include "file-lock.h"
 #include "cr-service.h"
+#include "cr-dedup.h"
 
 struct cr_options opts;
 
@@ -345,6 +346,10 @@ int main(int argc, char *argv[])
 	if (!strcmp(argv[optind], "service"))
 		return cr_service(opts.restore_detach);
 
+	if (!strcmp(argv[optind], "dedup")) {
+		return cr_dedup();
+	}
+
 	pr_msg("Unknown command \"%s\"\n", argv[optind]);
 usage:
 	pr_msg("\n"
@@ -356,6 +361,7 @@ usage:
 "  criu exec -p PID <syscall-string>\n"
 "  criu page-server\n"
 "  criu service [<options>]\n"
+"  criu dedup\n"
 "\n"
 "Commands:\n"
 "  dump           checkpoint a process/tree identified by pid\n"
@@ -366,6 +372,7 @@ usage:
 "  exec           execute a system call by other task\n"
 "  page-server    launch page server\n"
 "  service        launch service\n"
+"  dedup          remove dublicates in memory dump\n"
 	);
 
 	if (argc < 2) {
diff --git a/include/cr-dedup.h b/include/cr-dedup.h
new file mode 100644
index 0000000..3840a12
--- /dev/null
+++ b/include/cr-dedup.h
@@ -0,0 +1,6 @@
+#ifndef __CR_DEDUP_H__
+#define __CR_DEDUP_H__
+
+int cr_dedup(void);
+
+#endif
diff --git a/include/crtools.h b/include/crtools.h
index 8548869..c430474 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -121,6 +121,7 @@ int cr_show(int pid);
 int convert_to_elf(char *elf_path, int fd_core);
 int cr_check(void);
 int cr_exec(int pid, char **opts);
+int cr_dedup(void);
 
 #define O_DUMP	(O_RDWR | O_CREAT | O_EXCL)
 #define O_SHOW	(O_RDONLY)
-- 
1.7.9.5



More information about the CRIU mailing list