[CRIU] [rfc 2/3] plugins: Introduce entry points for external inet sockets plugins

Cyrill Gorcunov gorcunov at openvz.org
Fri Mar 7 06:43:46 PST 2014


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 include/criu-plugin.h |  3 +++
 include/plugin.h      |  3 +++
 plugin.c              | 17 +++++++++++++++++
 3 files changed, 23 insertions(+)

diff --git a/include/criu-plugin.h b/include/criu-plugin.h
index 3e0fd414be3b..f2d50b2ffd01 100644
--- a/include/criu-plugin.h
+++ b/include/criu-plugin.h
@@ -29,6 +29,9 @@ typedef void (cr_plugin_fini_t)(void);
 typedef int (cr_plugin_dump_unix_sk_t)(int fd, int id);
 typedef int (cr_plugin_restore_unix_sk_t)(int id);
 
+typedef int (cr_plugin_dump_inet_sk_t)(int fd, int id, int family, int type, int proto);
+typedef int (cr_plugin_restore_inet_sk_t)(int id, int family, int type, int proto);
+
 typedef int (cr_plugin_dump_file_t)(int fd, int id);
 typedef int (cr_plugin_restore_file_t)(int id);
 
diff --git a/include/plugin.h b/include/plugin.h
index 3c53e3003de3..d3669deea72d 100644
--- a/include/plugin.h
+++ b/include/plugin.h
@@ -11,6 +11,9 @@ int cr_plugin_init(void);
 int cr_plugin_dump_unix_sk(int fd, int id);
 int cr_plugin_restore_unix_sk(int id);
 
+int cr_plugin_dump_inet_sk(int fd, int id, int family, int type, int proto);
+int cr_plugin_restore_inet_sk(int id, int family, int type, int proto);
+
 int cr_plugin_dump_file(int fd, int id);
 int cr_plugin_restore_file(int id);
 
diff --git a/plugin.c b/plugin.c
index 367f9fda39eb..617b2ad10d57 100644
--- a/plugin.c
+++ b/plugin.c
@@ -17,6 +17,8 @@ struct cr_plugin_entry {
 
 		cr_plugin_dump_unix_sk_t	*cr_plugin_dump_unix_sk;
 		cr_plugin_restore_unix_sk_t	*cr_plugin_restore_unix_sk;
+		cr_plugin_dump_inet_sk_t	*cr_plugin_dump_inet_sk;
+		cr_plugin_restore_inet_sk_t	*cr_plugin_restore_inet_sk;
 		cr_plugin_dump_file_t		*cr_plugin_dump_file;
 		cr_plugin_restore_file_t	*cr_plugin_restore_file;
 		cr_plugin_dump_ext_mount_t	*cr_plugin_dump_ext_mount;
@@ -32,6 +34,8 @@ struct cr_plugins {
 
 	struct cr_plugin_entry *cr_plugin_dump_unix_sk;
 	struct cr_plugin_entry *cr_plugin_restore_unix_sk;
+	struct cr_plugin_entry *cr_plugin_dump_inet_sk;
+	struct cr_plugin_entry *cr_plugin_restore_inet_sk;
 	struct cr_plugin_entry *cr_plugin_dump_file;
 	struct cr_plugin_entry *cr_plugin_restore_file;
 	struct cr_plugin_entry *cr_plugin_dump_ext_mount;
@@ -82,6 +86,16 @@ int cr_plugin_restore_unix_sk(int id)
 	return run_plugin_funcs(cr_plugin_restore_unix_sk, id);
 }
 
+int cr_plugin_dump_inet_sk(int fd, int id, int family, int type, int proto)
+{
+	return run_plugin_funcs(cr_plugin_dump_inet_sk, fd, id, family, type, proto);
+}
+
+int cr_plugin_restore_inet_sk(int id, int family, int type, int proto)
+{
+	return run_plugin_funcs(cr_plugin_restore_inet_sk, id, family, type, proto);
+}
+
 int cr_plugin_dump_file(int fd, int id)
 {
 	return run_plugin_funcs(cr_plugin_dump_file, fd, id);
@@ -123,6 +137,9 @@ static int cr_lib_load(char *path)
 	add_plugin_func(cr_plugin_dump_unix_sk);
 	add_plugin_func(cr_plugin_restore_unix_sk);
 
+	add_plugin_func(cr_plugin_dump_inet_sk);
+	add_plugin_func(cr_plugin_restore_inet_sk);
+
 	add_plugin_func(cr_plugin_dump_file);
 	add_plugin_func(cr_plugin_restore_file);
 
-- 
1.8.3.1



More information about the CRIU mailing list