[CRIU] [PATCH 7/8] parasite-syscall: Make args being void *

Cyrill Gorcunov gorcunov at openvz.org
Tue Feb 21 15:22:17 EST 2012


There is no point in makeing it parasite_status_t.
The possible lack of header in structures passed
will be addressed in next patch.

This one allows to drop useless type convention
in parasite_execute call.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 parasite-syscall.c |   19 +++++++++----------
 1 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/parasite-syscall.c b/parasite-syscall.c
index 605299d..a147d8f 100644
--- a/parasite-syscall.c
+++ b/parasite-syscall.c
@@ -227,7 +227,7 @@ err:
 }
 
 static int parasite_execute(unsigned long cmd, struct parasite_ctl *ctl,
-			    parasite_status_t *args, int args_size)
+			    void *args, int args_size)
 {
 	int ret;
 
@@ -242,11 +242,13 @@ static int parasite_execute(unsigned long cmd, struct parasite_ctl *ctl,
 
 	memcpy(args, ctl->addr_args, args_size);
 	if (!ret)
-		ret = args->ret;
+		ret = ((parasite_status_t *)args)->ret;
 
 	if (ret)
 		pr_err("Parasite exited with %d ret (%li at %li)\n",
-		       ret, args->sys_ret, args->line);
+		       ret,
+		       ((parasite_status_t *)args)->sys_ret,
+		       ((parasite_status_t *)args)->line);
 
 	return ret;
 }
@@ -367,7 +369,7 @@ static int parasite_file_cmd(char *what, int cmd, int type,
 	if (ret < 0)
 		goto out;
 
-	ret = parasite_execute(cmd, ctl, (parasite_status_t *)&args, sizeof(args));
+	ret = parasite_execute(cmd, ctl, &args, sizeof(args));
 
 	fchmod(cr_fdset->fds[type], CR_FD_PERM);
 out:
@@ -382,8 +384,7 @@ static int parasite_init(struct parasite_ctl *ctl, pid_t pid)
 
 	args.sun_len = gen_parasite_saddr(&args.saddr, pid);
 
-	return parasite_execute(PARASITE_CMD_INIT, ctl,
-				(parasite_status_t *)&args, sizeof(args));
+	return parasite_execute(PARASITE_CMD_INIT, ctl, &args, sizeof(args));
 }
 
 static int parasite_set_logfd(struct parasite_ctl *ctl, pid_t pid)
@@ -416,9 +417,7 @@ int parasite_dump_itimers_seized(struct parasite_ctl *ctl, struct cr_fdset *cr_f
 
 int parasite_dump_misc_seized(struct parasite_ctl *ctl, struct parasite_dump_misc *misc)
 {
-	return parasite_execute(PARASITE_CMD_DUMP_MISC, ctl,
-				(parasite_status_t *)misc,
-				sizeof(struct parasite_dump_misc));
+	return parasite_execute(PARASITE_CMD_DUMP_MISC, ctl, misc, sizeof(*misc));
 }
 
 /*
@@ -485,7 +484,7 @@ int parasite_dump_pages_seized(struct parasite_ctl *ctl, struct list_head *vma_a
 		}
 
 		ret = parasite_execute(PARASITE_CMD_DUMPPAGES, ctl,
-				       (parasite_status_t *) &parasite_dumppages,
+				       &parasite_dumppages,
 				       sizeof(parasite_dumppages));
 		if (ret) {
 			pr_panic("Dumping pages failed with %li (%li) at %li\n",
-- 
1.7.7.6



More information about the CRIU mailing list