[CRIU] [PATCH] parasite: Move selftests into separate helper

Cyrill Gorcunov gorcunov at openvz.org
Thu Oct 11 12:49:58 EDT 2012


Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 parasite.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/parasite.c b/parasite.c
index 5588f3a..b14782a 100644
--- a/parasite.c
+++ b/parasite.c
@@ -477,14 +477,26 @@ static int fini(void)
 	return 0;
 }
 
-int __used parasite_service(unsigned int cmd, void *args)
+static void __always_unused __builtin_self_tests(void)
 {
-	BUILD_BUG_ON(sizeof(struct parasite_dump_pages_args) > PARASITE_ARG_SIZE);
+	/*
+	 * Please, don't forget to update this routine if
+	 * you add some new structure into parasite arguments.
+	 */
+
 	BUILD_BUG_ON(sizeof(struct parasite_init_args) > PARASITE_ARG_SIZE);
+	BUILD_BUG_ON(sizeof(struct parasite_log_args) > PARASITE_ARG_SIZE);
+	BUILD_BUG_ON(sizeof(struct parasite_dump_pages_args) > PARASITE_ARG_SIZE);
+	BUILD_BUG_ON(sizeof(struct parasite_dump_sa_args) > PARASITE_ARG_SIZE);
+	BUILD_BUG_ON(sizeof(struct parasite_dump_itimers_args) > PARASITE_ARG_SIZE);
 	BUILD_BUG_ON(sizeof(struct parasite_dump_misc) > PARASITE_ARG_SIZE);
+	BUILD_BUG_ON(sizeof(struct parasite_dump_creds) > PARASITE_ARG_SIZE);
 	BUILD_BUG_ON(sizeof(struct parasite_dump_tid_info) > PARASITE_ARG_SIZE);
 	BUILD_BUG_ON(sizeof(struct parasite_drain_fd) > PARASITE_ARG_SIZE);
+}
 
+int __used parasite_service(unsigned int cmd, void *args)
+{
 	pr_info("Parasite cmd %d/%x process\n", cmd, cmd);
 
 	switch (cmd) {
-- 
1.7.7.6



More information about the CRIU mailing list