[CRIU] [PATCHv3 09/23] Revert "parasite: add parasite-compat.h & convert parasite.h types"

Dmitry Safonov dsafonov at virtuozzo.com
Fri Dec 9 10:19:35 PST 2016


This reverts commit 83fc7c1dc187d81a1543acfc36b33f0c99f42ef8.

No second compat parasite - no need in fixed-sized arguments between
parasite and criu and compat types.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/include/parasite-compat.h | 68 --------------------------------------
 criu/include/parasite.h        | 75 ++++++++++++++++++++----------------------
 criu/pie/parasite.c            | 12 +++----
 3 files changed, 41 insertions(+), 114 deletions(-)
 delete mode 100644 criu/include/parasite-compat.h

diff --git a/criu/include/parasite-compat.h b/criu/include/parasite-compat.h
deleted file mode 100644
index 7ff60576119a..000000000000
--- a/criu/include/parasite-compat.h
+++ /dev/null
@@ -1,68 +0,0 @@
-#ifndef __CR_PARASITE_COMPAT_H__
-#define __CR_PARASITE_COMPAT_H__
-
-/* XXX: define _compat types per-arch */
-
-#ifndef __ASSEMBLY__
-
-#include "images/core.pb-c.h"
-
-#if !defined(CONFIG_X86_64) && !defined(CONFIG_X86_32)
-#define rt_sigaction_t_compat rt_sigaction_t
-#endif
-
-struct parasite_dump_sa_args_compat {
-	rt_sigaction_t_compat sas[SIGMAX];
-};
-
-struct parasite_timeval_compat {
-	u32	tv_sec;
-	u32	tv_usec;
-};
-
-struct parasite_itimerval_compat {
-	struct parasite_timeval_compat it_interval;
-	struct parasite_timeval_compat it_value;
-};
-
-struct parasite_dump_itimers_args_compat {
-	struct parasite_itimerval_compat real;
-	struct parasite_itimerval_compat virt;
-	struct parasite_itimerval_compat prof;
-};
-
-struct parasite_timespec_compat {
-	u32	tv_sec;
-	u32	tv_nsec;
-};
-
-struct parasite_itimerspec_compat {
-	struct parasite_timespec_compat it_interval;
-	struct parasite_timespec_compat it_value;
-};
-
-struct posix_timer_compat {
-	s32 it_id;
-	struct parasite_itimerspec_compat val;
-	s32 overrun;
-};
-
-struct parasite_dump_posix_timers_args_compat {
-	s32 timer_n;
-	struct posix_timer_compat timer[0];
-};
-
-static inline int posix_timers_compat_dump_size(int timer_n)
-{
-	return sizeof(s32) + sizeof(struct posix_timer_compat) * timer_n;
-}
-
-typedef struct {
-	u32	ss_sp;
-	s32	ss_flags;
-	u32	ss_size;
-} stack_t_compat;
-
-#endif /* !__ASSEMBLY__ */
-
-#endif /* __CR_PARASITE_COMPAT_H__ */
diff --git a/criu/include/parasite.h b/criu/include/parasite.h
index 2763e743cf0e..cd6d793f8b56 100644
--- a/criu/include/parasite.h
+++ b/criu/include/parasite.h
@@ -41,27 +41,27 @@ enum {
 
 struct parasite_vma_entry
 {
-	u64		start;
-	u64		len;
-	s32		prot;
+	unsigned long	start;
+	unsigned long	len;
+	int		prot;
 };
 
 struct parasite_vdso_vma_entry {
-	u64	start;
-	u64	len;
-	u64	proxy_vdso_addr;
-	u64	proxy_vvar_addr;
-	s32		is_marked;
-	u8		try_fill_symtable;
-	u8		is_vdso;
+	unsigned long	start;
+	unsigned long	len;
+	unsigned long	proxy_vdso_addr;
+	unsigned long	proxy_vvar_addr;
+	int		is_marked;
+	bool		try_fill_symtable;
+	bool		is_vdso;
 };
 
 struct parasite_dump_pages_args {
-	u32	nr_vmas;
-	u32	add_prot;
-	u32	off;
-	u32	nr_segs;
-	u32	nr_pages;
+	unsigned int	nr_vmas;
+	unsigned int	add_prot;
+	unsigned int	off;
+	unsigned int	nr_segs;
+	unsigned int	nr_pages;
 };
 
 static inline struct parasite_vma_entry *pargs_vmas(struct parasite_dump_pages_args *a)
@@ -96,12 +96,12 @@ struct parasite_dump_posix_timers_args {
 };
 
 struct parasite_aio {
-	u64 ctx;
-	u64 size;
+	unsigned long ctx;
+	unsigned int size;
 };
 
 struct parasite_check_aios_args {
-	u32 nr_rings;
+	unsigned nr_rings;
 	struct parasite_aio ring[0];
 };
 
@@ -116,14 +116,14 @@ static inline int posix_timers_dump_size(int timer_n)
  */
 
 struct parasite_dump_misc {
-	u64 brk;
+	unsigned long		brk;
 
 	u32 pid;
 	u32 sid;
 	u32 pgid;
 	u32 umask;
 
-	s32 dumpable;
+	int dumpable;
 };
 
 /*
@@ -135,17 +135,17 @@ struct parasite_dump_misc {
 	 offsetof(struct parasite_dump_creds, groups)) / sizeof(unsigned int)) /* groups */
 
 struct parasite_dump_creds {
-	u32			cap_last_cap;
+	unsigned int		cap_last_cap;
 
 	u32			cap_inh[CR_CAP_SIZE];
 	u32			cap_prm[CR_CAP_SIZE];
 	u32			cap_eff[CR_CAP_SIZE];
 	u32			cap_bnd[CR_CAP_SIZE];
 
-	s32			uids[4];
-	s32			gids[4];
-	u32			secbits;
-	u32			ngroups;
+	int			uids[4];
+	int			gids[4];
+	unsigned int		secbits;
+	unsigned int		ngroups;
 	/*
 	 * FIXME -- this structure is passed to parasite code
 	 * through parasite args area so in parasite_dump_creds()
@@ -159,7 +159,7 @@ struct parasite_dump_creds {
 	 * of memory in use doesn't exceed the PAGE_SIZE and the
 	 * args area is at least one page (PARASITE_ARG_SIZE_MIN).
 	 */
-	u32			groups[0];
+	unsigned int		groups[0];
 };
 
 struct parasite_dump_thread {
@@ -189,8 +189,8 @@ static inline void copy_sas(ThreadSasEntry *dst, const stack_t *src)
 #define PARASITE_MAX_FDS	CR_SCM_MAX_FD * 3
 
 struct parasite_drain_fd {
-	s32	nr_fds;
-	s32	fds[0];
+	int	nr_fds;
+	int	fds[0];
 };
 
 struct fd_opts {
@@ -211,17 +211,16 @@ static inline int drain_fds_size(struct parasite_drain_fd *dfds)
 }
 
 struct parasite_tty_args {
-	s32	fd;
-	s32	type;
+	int	fd;
+	int	type;
 
-	s32	sid;
-	s32	pgrp;
+	int	sid;
+	int	pgrp;
+	bool	hangup;
 
-	s32	st_pckt;
-	s32	st_lock;
-	s32	st_excl;
-
-	u8	hangup;
+	int	st_pckt;
+	int	st_lock;
+	int	st_excl;
 };
 
 struct parasite_dump_cgroup_args {
@@ -235,6 +234,4 @@ struct parasite_dump_cgroup_args {
 
 #endif /* !__ASSEMBLY__ */
 
-#include "parasite-compat.h"
-
 #endif /* __CR_PARASITE_H__ */
diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c
index 9c7f3fa6a7df..e84d63405ca0 100644
--- a/criu/pie/parasite.c
+++ b/criu/pie/parasite.c
@@ -51,12 +51,10 @@ static int mprotect_vmas(struct parasite_dump_pages_args *args)
 	vmas = pargs_vmas(args);
 	for (i = 0; i < args->nr_vmas; i++) {
 		vma = vmas + i;
-		ret = sys_mprotect((void *)(uintptr_t)vma->start, vma->len,
-				vma->prot | args->add_prot);
+		ret = sys_mprotect((void *)vma->start, vma->len, vma->prot | args->add_prot);
 		if (ret) {
 			pr_err("mprotect(%08lx, %lu) failed with code %d\n",
-					(unsigned long)vma->start,
-					(unsigned long)vma->len, ret);
+						vma->start, vma->len, ret);
 			break;
 		}
 	}
@@ -451,7 +449,7 @@ static inline int tty_ioctl(int fd, int cmd, int *arg)
 
 static int sane_ring(struct parasite_aio *aio)
 {
-	struct aio_ring *ring = (struct aio_ring *)(uintptr_t)aio->ctx;
+	struct aio_ring *ring = (struct aio_ring *)aio->ctx;
 	unsigned nr;
 
 	nr = (aio->size - sizeof(struct aio_ring)) / sizeof(struct io_event);
@@ -470,7 +468,7 @@ static int parasite_check_aios(struct parasite_check_aios_args *args)
 	for (i = 0; i < args->nr_rings; i++) {
 		struct aio_ring *ring;
 
-		ring = (struct aio_ring *)(uintptr_t)args->ring[i].ctx;
+		ring = (struct aio_ring *)args->ring[i].ctx;
 		if (!sane_ring(&args->ring[i])) {
 			pr_err("Not valid ring #%d\n", i);
 			pr_info(" `- magic %x\n", ring->magic);
@@ -549,7 +547,7 @@ err_io:
 #ifdef CONFIG_VDSO
 static int parasite_check_vdso_mark(struct parasite_vdso_vma_entry *args)
 {
-	struct vdso_mark *m = (void *)(uintptr_t)args->start;
+	struct vdso_mark *m = (void *)args->start;
 
 	if (is_vdso_mark(m)) {
 		/*
-- 
2.10.2



More information about the CRIU mailing list