[PATCH 2/2] plugins: unix-callback -- Convert it into new format

Cyrill Gorcunov gorcunov at openvz.org
Wed Aug 13 12:19:56 PDT 2014


Plugin engine output:

 | (00.000480) Plugin "unix-lib" (version 512 hooks 7)
 | (00.000508) 	   0 -> 0x7f0417ed709d
 | (00.000518) 	   1 -> 0x7f0417ed7443
 | (00.000615) Plugin "syslog-lib" (version 512 hooks 7)
 | (00.000629) 	   0 -> 0x7f0417cd463a
 | (00.000637) 	   1 -> 0x7f0417cd4714

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 test/unix-callback/syslog-lib.c | 11 ++++++-----
 test/unix-callback/unix-lib.c   | 17 ++++++-----------
 2 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/test/unix-callback/syslog-lib.c b/test/unix-callback/syslog-lib.c
index c7950cad497b..a6b0d3cde75b 100644
--- a/test/unix-callback/syslog-lib.c
+++ b/test/unix-callback/syslog-lib.c
@@ -11,10 +11,7 @@
 #include "criu-plugin.h"
 #include "criu-log.h"
 
-extern cr_plugin_dump_unix_sk_t cr_plugin_dump_unix_sk;
-extern cr_plugin_restore_unix_sk_t cr_plugin_restore_unix_sk;
-
-int cr_plugin_dump_unix_sk(int sk, int id)
+static int cr_plugin_dump_unix_sk(int sk, int id)
 {
 	struct sockaddr_un addr;
 	socklen_t addr_len = sizeof(addr);
@@ -36,7 +33,7 @@ int cr_plugin_dump_unix_sk(int sk, int id)
 	return 0;
 }
 
-int cr_plugin_restore_unix_sk(int id)
+static int cr_plugin_restore_unix_sk(int id)
 {
 	struct sockaddr_un addr;
 	socklen_t addr_len;
@@ -64,3 +61,7 @@ int cr_plugin_restore_unix_sk(int id)
 
 	return sk;
 }
+
+CR_PLUGIN_REGISTER_DUMMY("syslog-lib")
+CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__DUMP_UNIX_SK, cr_plugin_dump_unix_sk)
+CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__RESTORE_UNIX_SK, cr_plugin_restore_unix_sk)
diff --git a/test/unix-callback/unix-lib.c b/test/unix-callback/unix-lib.c
index 44b149848668..35f9a4938911 100644
--- a/test/unix-callback/unix-lib.c
+++ b/test/unix-callback/unix-lib.c
@@ -17,10 +17,6 @@
 
 #include "unix.pb-c.h"
 
-extern cr_plugin_init_t cr_plugin_init;
-extern cr_plugin_dump_unix_sk_t cr_plugin_dump_unix_sk;
-extern cr_plugin_restore_unix_sk_t cr_plugin_restore_unix_sk;
-
 #define SK_NAME "/tmp/criu.unix.callback.test"
 static int get_srv_socket(void)
 {
@@ -56,12 +52,7 @@ static int get_srv_socket(void)
 	return skd;
 }
 
-int cr_plugin_init(void)
-{
-	return 0;
-}
-
-int cr_plugin_dump_unix_sk(int sk, int sk_id)
+static int cr_plugin_dump_unix_sk(int sk, int sk_id)
 {
 	struct sockaddr_un addr;
 	socklen_t addr_len = sizeof(addr);
@@ -128,7 +119,7 @@ int cr_plugin_dump_unix_sk(int sk, int sk_id)
 	return 0;
 }
 
-int cr_plugin_restore_unix_sk(int sk_id)
+static int cr_plugin_restore_unix_sk(int sk_id)
 {
 	struct sockaddr_un addr;
 	socklen_t addr_len;
@@ -185,3 +176,7 @@ int cr_plugin_restore_unix_sk(int sk_id)
 
 	return sk;
 }
+
+CR_PLUGIN_REGISTER_DUMMY("unix-lib")
+CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__DUMP_UNIX_SK, cr_plugin_dump_unix_sk)
+CR_PLUGIN_REGISTER_HOOK(CR_PLUGIN_HOOK__RESTORE_UNIX_SK, cr_plugin_restore_unix_sk)
-- 
1.9.3


--WChQLJJJfbwij+9x--


More information about the CRIU mailing list