[CRIU] [PATCH 1/4] compel: uapi -- Drop compiler.h from the headers

Pavel Emelyanov xemul at virtuozzo.com
Tue Nov 15 22:51:10 PST 2016


On 11/15/2016 09:01 PM, Cyrill Gorcunov wrote:
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  compel/arch/x86/src/lib/include/uapi/asm/fpu.h | 10 ++++------
>  compel/include/uapi/infect.h                   |  5 ++---
>  2 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h
> index 90071a1445b5..8739a0104856 100644
> --- a/compel/arch/x86/src/lib/include/uapi/asm/fpu.h
> +++ b/compel/arch/x86/src/lib/include/uapi/asm/fpu.h
> @@ -5,8 +5,6 @@
>  #include <stdbool.h>
>  #include <stdint.h>
>  
> -#include "common/compiler.h"
> -
>  #define FP_MIN_ALIGN_BYTES		64
>  
>  #define FP_XSTATE_MAGIC1		0x46505853U
> @@ -61,17 +59,17 @@ struct i387_fxsave_struct {
>  		uint32_t		sw_reserved[12];
>  	};
>  
> -} __aligned(16);
> +} __attribute__((aligned(16)));

C'mon, guys, are we going to open-code everything from compiler.h? I'm OK
with dropping the page.h from uapi, but such a generic stuff as helpers for
__attribute__s and BUILD_BUG_ONs? No, please. Just install this header into
/whatever/include/compel/common/ and that's it.

>  struct xsave_hdr_struct {
>  	uint64_t			xstate_bv;
>  	uint64_t			reserved1[2];
>  	uint64_t			reserved2[5];
> -} __packed;
> +} __attribute__((__packed__));
>  
>  struct ymmh_struct {
>  	uint32_t			ymmh_space[64];
> -} __packed;
> +} __attribute__((__packed__));
>  
>  /*
>   * cpu requires it to be 64 byte aligned
> @@ -80,7 +78,7 @@ struct xsave_struct {
>  	struct i387_fxsave_struct	i387;
>  	struct xsave_hdr_struct		xsave_hdr;
>  	struct ymmh_struct		ymmh;
> -} __aligned(FP_MIN_ALIGN_BYTES) __packed;
> +} __attribute__((aligned(FP_MIN_ALIGN_BYTES))) __attribute__((__packed__));
>  
>  /*
>   * This one is used in restorer.
> diff --git a/compel/include/uapi/infect.h b/compel/include/uapi/infect.h
> index 38051f4373d4..1943a9b3ad2b 100644
> --- a/compel/include/uapi/infect.h
> +++ b/compel/include/uapi/infect.h
> @@ -8,8 +8,6 @@
>  #include <compel/ksigset.h>
>  #include <compel/compel.h>
>  
> -#include "common/compiler.h"
> -
>  #define PARASITE_START_AREA_MIN	(4096)
>  
>  extern int compel_stop_task(int pid);
> @@ -52,11 +50,12 @@ extern int compel_cure_local(struct parasite_ctl *ctl);
>  extern int compel_cure(struct parasite_ctl *ctl);
>  
>  #define PARASITE_ARG_SIZE_MIN	( 1 << 12)
> +#define COMPEL_BLD_BUG_ON(condition)	((void)sizeof(char[1 - 2*!!(condition)]))
>  
>  #define compel_parasite_args(ctl, type)					\
>  	({								\
>  	 	void *___ret;						\
> -		BUILD_BUG_ON(sizeof(type) > PARASITE_ARG_SIZE_MIN);	\
> +		COMPEL_BLD_BUG_ON(sizeof(type) > PARASITE_ARG_SIZE_MIN);\
>  		___ret = compel_parasite_args_p(ctl);			\
>  	 	___ret;							\
>  	})
> 



More information about the CRIU mailing list