[CRIU] [PATCH 1/3] zdtm: moved lib/atomic.h to lib/arch/x86/include/asm/atomic.h

Pavel Emelyanov xemul at parallels.com
Tue Jan 22 09:54:48 EST 2013


On 01/22/2013 12:51 PM, Alexander Kartashov wrote:
> The file lib/atomic.h is the only machine-dependent file in the test suite
> that breaks compilation of the test static/session01 on ARM.
> 
> The file is moved into a separate directory and the build system is modified
> accordingly to prevent this.
> 
> Signed-off-by: Alexander Kartashov <alekskartashov at parallels.com>
> ---
>  test/zdtm/lib/arch/x86/include/asm/atomic.h |   42 +++++++++++++++++++++++++++
>  test/zdtm/lib/atomic.h                      |   42 ---------------------------
>  test/zdtm/lib/lock.h                        |    2 +-
>  test/zdtm/live/static/Makefile              |    2 +-
>  4 files changed, 44 insertions(+), 44 deletions(-)
>  create mode 100644 test/zdtm/lib/arch/x86/include/asm/atomic.h
>  delete mode 100644 test/zdtm/lib/atomic.h

Should be "renamed ..." :\

> diff --git a/test/zdtm/lib/arch/x86/include/asm/atomic.h b/test/zdtm/lib/arch/x86/include/asm/atomic.h
> new file mode 100644
> index 0000000..3debc48
> --- /dev/null
> +++ b/test/zdtm/lib/arch/x86/include/asm/atomic.h
> @@ -0,0 +1,42 @@
> +#ifndef ATOMIC_H__
> +#define ATOMIC_H__
> +
> +#define atomic_set(mem, v)					\
> +	({							\
> +		asm volatile ("lock xchg %0, %1\n"		\
> +				: "+r" (v), "+m" (*mem)		\
> +				:				\
> +				: "cc", "memory");		\
> +	})
> +
> +#define atomic_get(mem)						\
> +	({							\
> +		uint32_t ret__ = 0;					\
> +		asm volatile ("lock xadd %0, %1\n"		\
> +				: "+r" (ret__),	"+m" (*mem)	\
> +				:				\
> +				: "cc", "memory");		\
> +		ret__;						\
> +	})
> +
> +#define atomic_inc(mem)						\
> +	({							\
> +		uint32_t ret__ = 1;					\
> +		asm volatile ("lock xadd %0, %1\n"		\
> +				: "+r" (ret__),	"+m" (*mem)	\
> +				:				\
> +				: "cc", "memory");		\
> +		ret__;						\
> +	})
> +
> +#define atomic_dec(mem)						\
> +	({							\
> +		uint32_t ret__ = -1;					\
> +		asm volatile ("lock xadd %0, %1\n"		\
> +				: "+r" (ret__),	"+m" (*mem)	\
> +				:				\
> +				: "cc", "memory");		\
> +		ret__;						\
> +	})
> +
> +#endif /* ATOMIC_H__ */
> diff --git a/test/zdtm/lib/atomic.h b/test/zdtm/lib/atomic.h
> deleted file mode 100644
> index 3debc48..0000000
> --- a/test/zdtm/lib/atomic.h
> +++ /dev/null
> @@ -1,42 +0,0 @@
> -#ifndef ATOMIC_H__
> -#define ATOMIC_H__
> -
> -#define atomic_set(mem, v)					\
> -	({							\
> -		asm volatile ("lock xchg %0, %1\n"		\
> -				: "+r" (v), "+m" (*mem)		\
> -				:				\
> -				: "cc", "memory");		\
> -	})
> -
> -#define atomic_get(mem)						\
> -	({							\
> -		uint32_t ret__ = 0;					\
> -		asm volatile ("lock xadd %0, %1\n"		\
> -				: "+r" (ret__),	"+m" (*mem)	\
> -				:				\
> -				: "cc", "memory");		\
> -		ret__;						\
> -	})
> -
> -#define atomic_inc(mem)						\
> -	({							\
> -		uint32_t ret__ = 1;					\
> -		asm volatile ("lock xadd %0, %1\n"		\
> -				: "+r" (ret__),	"+m" (*mem)	\
> -				:				\
> -				: "cc", "memory");		\
> -		ret__;						\
> -	})
> -
> -#define atomic_dec(mem)						\
> -	({							\
> -		uint32_t ret__ = -1;					\
> -		asm volatile ("lock xadd %0, %1\n"		\
> -				: "+r" (ret__),	"+m" (*mem)	\
> -				:				\
> -				: "cc", "memory");		\
> -		ret__;						\
> -	})
> -
> -#endif /* ATOMIC_H__ */
> diff --git a/test/zdtm/lib/lock.h b/test/zdtm/lib/lock.h
> index 20d7cbd..9abd01a 100644
> --- a/test/zdtm/lib/lock.h
> +++ b/test/zdtm/lib/lock.h
> @@ -6,7 +6,7 @@
>  #include <sys/time.h>
>  #include <limits.h>
>  #include <errno.h>
> -#include <atomic.h>
> +#include "asm/atomic.h"
>  
>  #define BUG_ON(condition)						\
>  	do {								\
> diff --git a/test/zdtm/live/static/Makefile b/test/zdtm/live/static/Makefile
> index 602fbbc..eb5c968 100644
> --- a/test/zdtm/live/static/Makefile
> +++ b/test/zdtm/live/static/Makefile
> @@ -1,6 +1,6 @@
>  LIBDIR	= ../../lib
>  LIB	= $(LIBDIR)/libzdtmtst.a
> -override CPPFLAGS += -I$(LIBDIR)
> +override CPPFLAGS += -I$(LIBDIR) -iquote $(LIBDIR)/arch/$(ARCH)/include
>  CFLAGS	= -g -O2 -Wall -Werror -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0
>  
>  TST_NOFILE	=				\
> 




More information about the CRIU mailing list