[CRIU] [PATCH 06/19] compel: remove not needed from uapi

Cyrill Gorcunov gorcunov at openvz.org
Wed Sep 21 13:54:21 PDT 2016


From: Dmitry Safonov <dsafonov at virtuozzo.com>

Delete plugins/include/asm/std directory - let it be without plugin
name.
Make symlinks to reuse criu's files, except those, which will
be deleted after libcompel from criu (like syscalls).

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 compel/arch/x86/plugins/include/asm/linkage.h      |  1 +
 .../plugins/include/asm/{std => }/syscall-types.h  |  0
 compel/arch/x86/plugins/std/call32.S               | 72 +---------------------
 compel/include/int.h                               |  1 +
 compel/include/uapi/int.h                          | 15 -----
 compel/plugins/Makefile                            | 21 ++++---
 compel/plugins/include/uapi/plugin-std.h           |  9 +++
 compel/plugins/include/uapi/std/syscall-types.h    |  4 +-
 compel/plugins/std/std.c                           |  2 +-
 9 files changed, 28 insertions(+), 97 deletions(-)
 create mode 120000 compel/arch/x86/plugins/include/asm/linkage.h
 rename compel/arch/x86/plugins/include/asm/{std => }/syscall-types.h (100%)
 mode change 100644 => 120000 compel/arch/x86/plugins/std/call32.S
 create mode 120000 compel/include/int.h
 delete mode 100644 compel/include/uapi/int.h

diff --git a/compel/arch/x86/plugins/include/asm/linkage.h b/compel/arch/x86/plugins/include/asm/linkage.h
new file mode 120000
index 000000000000..b1b2fe3ee342
--- /dev/null
+++ b/compel/arch/x86/plugins/include/asm/linkage.h
@@ -0,0 +1 @@
+../../../../../../criu/arch/x86/include/asm/linkage.h
\ No newline at end of file
diff --git a/compel/arch/x86/plugins/include/asm/std/syscall-types.h b/compel/arch/x86/plugins/include/asm/syscall-types.h
similarity index 100%
rename from compel/arch/x86/plugins/include/asm/std/syscall-types.h
rename to compel/arch/x86/plugins/include/asm/syscall-types.h
diff --git a/compel/arch/x86/plugins/std/call32.S b/compel/arch/x86/plugins/std/call32.S
deleted file mode 100644
index 935461dcdc86..000000000000
--- a/compel/arch/x86/plugins/std/call32.S
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * call32.S - assembly helpers for mixed-bitness code
- * From kernel selftests originally: tools/testing/selftests/x86/thunks.S
- * Copyright (c) 2015 Andrew Lutomirski
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * These are little helpers that make it easier to switch bitness on
- * the fly.
- */
-
-#include "asm/linkage.h"
-
-#define __USER32_CS	0x23
-#define __USER_CS	0x33
-
-	.text
-
-/*
- * @rdi: Stack to use
- * @esi: Pointer to function for calling
- */
-ENTRY(call32_from_64)
-	/* Callee-saving registers due to ABI */
-	pushq %rbx
-	pushq %rbp
-	pushq %r12
-	pushq %r13
-	pushq %r14
-	pushq %r15
-	pushfq
-
-	/* Switch stacks */
-	sub $8, %rdi
-	mov %rsp,(%rdi)
-	mov %rdi,%rsp
-
-	/* Switch into compatibility mode */
-	pushq $__USER32_CS
-	pushq $1f
-	lretq
-
-1:
-	.code32
-	/* Run function and switch back */
-	call *%esi
-	jmp $__USER_CS,$1f
-	.code64
-
-1:
-	/* Restore the stack */
-	mov (%rsp),%rsp
-	add $8, %rdi
-
-	/* Restore registers */
-	popfq
-	popq %r15
-	popq %r14
-	popq %r13
-	popq %r12
-	popq %rbp
-	popq %rbx
-	ret
-END(call32_from_64)
diff --git a/compel/arch/x86/plugins/std/call32.S b/compel/arch/x86/plugins/std/call32.S
new file mode 120000
index 000000000000..b0fd67bc0ef3
--- /dev/null
+++ b/compel/arch/x86/plugins/std/call32.S
@@ -0,0 +1 @@
+../../../../../criu/arch/x86/call32.S
\ No newline at end of file
diff --git a/compel/include/int.h b/compel/include/int.h
new file mode 120000
index 000000000000..5c118d596759
--- /dev/null
+++ b/compel/include/int.h
@@ -0,0 +1 @@
+../../criu/include/asm-generic/int.h
\ No newline at end of file
diff --git a/compel/include/uapi/int.h b/compel/include/uapi/int.h
deleted file mode 100644
index ac3088d5ac3b..000000000000
--- a/compel/include/uapi/int.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef __CR_INT_H__
-#define __CR_INT_H__
-
-#include <stdint.h>
-
-typedef uint64_t	u64;
-typedef int64_t		s64;
-typedef uint32_t	u32;
-typedef int32_t		s32;
-typedef uint16_t	u16;
-typedef int16_t		s16;
-typedef uint8_t		u8;
-typedef int8_t		s8;
-
-#endif /* __CR_INT_H__ */
diff --git a/compel/plugins/Makefile b/compel/plugins/Makefile
index f0b1de802368..626a9782f934 100644
--- a/compel/plugins/Makefile
+++ b/compel/plugins/Makefile
@@ -2,24 +2,27 @@
 
 ARCH_DIR		:= compel/arch/$(ARCH)/plugins
 
-ccflags-y		+= -iquote $(obj)/include/
-ccflags-y		+= -iquote $(obj)/include/uapi
-ccflags-y		+= -iquote $(SRC_DIR)/criu/include
-ccflags-y		+= -iquote $(SRC_DIR)/criu/arch/$(ARCH)/include
+# General compel includes
 ccflags-y		+= -iquote $(SRC_DIR)/compel/include
-ccflags-y		+= -iquote $(SRC_DIR)/$(ARCH_DIR)/include
 
-asflags-y		+= -iquote $(SRC_DIR)/criu/arch/$(ARCH)/include
-asflags-y		+= -iquote $(SRC_DIR)/compel/plugins/include/uapi
+# General compel/plugins includes
+ccflags-y		+= -iquote $(obj)/include
+ccflags-y		+= -iquote $(obj)/include/uapi
+asflags-y		+= -iquote $(obj)/include/uapi
+
+# Arch compel/plugins includes
+ccflags-y		+= -iquote $(SRC_DIR)/$(ARCH_DIR)/include
+asflags-y		+= -iquote $(SRC_DIR)/$(ARCH_DIR)/include
 asflags-y		+= -iquote $(SRC_DIR)/$(ARCH_DIR)
 
+
 #
 # STD plugin
 target			+= std
 std-obj-y		+= std/std.o
 std-obj-y		+= std/string.o
-std-obj-y		+= arch/$(ARCH)/plugins/std/syscalls-64.o
-std-obj-y		+= arch/$(ARCH)/plugins/std/calls32.o
+std-obj-y		+= ./$(ARCH_DIR)/std/syscalls-64.o
+std-obj-y		+= ./$(ARCH_DIR)/std/call32.o
 
 sys-proto-generic	:= $(obj)/include/uapi/std/syscall.h
 sys-codes-generic	:= $(obj)/include/uapi/std/syscall-codes.h
diff --git a/compel/plugins/include/uapi/plugin-std.h b/compel/plugins/include/uapi/plugin-std.h
index 292db8839383..5eaa31f04e45 100644
--- a/compel/plugins/include/uapi/plugin-std.h
+++ b/compel/plugins/include/uapi/plugin-std.h
@@ -1,6 +1,15 @@
 #ifndef COMPEL_PLUGIN_STD_STD_H__
 #define COMPEL_PLUGIN_STD_STD_H__
 
+#include "uapi/plugins.h"
 #include "uapi/std/syscall.h"
 
+struct prologue_init_args {
+	struct sockaddr		*ctl_sock_addr;
+	socklen_t		ctl_sock_addr_len;
+
+	unsigned int		arg_s;
+	void			*arg_p;
+};
+
 #endif /* COMPEL_PLUGIN_STD_STD_H__ */
diff --git a/compel/plugins/include/uapi/std/syscall-types.h b/compel/plugins/include/uapi/std/syscall-types.h
index 1b8188299103..564d027f206d 100644
--- a/compel/plugins/include/uapi/std/syscall-types.h
+++ b/compel/plugins/include/uapi/std/syscall-types.h
@@ -14,6 +14,8 @@
 #include <fcntl.h>
 #include <time.h>
 
+#include "int.h"
+
 struct cap_header {
 	u32 version;
 	int pid;
@@ -50,6 +52,6 @@ struct krlimit {
 /* Type of timers in the kernel.  */
 typedef int kernel_timer_t;
 
-#include "asm/std/syscall-types.h"
+#include "asm/syscall-types.h"
 
 #endif /* COMPEL_SYSCALL_TYPES_H__ */
diff --git a/compel/plugins/std/std.c b/compel/plugins/std/std.c
index b3ea971f9079..69bbb9bed20a 100644
--- a/compel/plugins/std/std.c
+++ b/compel/plugins/std/std.c
@@ -1,6 +1,6 @@
 #include <sys/types.h>
 
-#include "uapi/int.h"
+#include "int.h"
 #include "uapi/plugins.h"
 #include "uapi/plugin-std.h"
 
-- 
2.7.4



More information about the CRIU mailing list