From 987f9bd776f634c6f6509601e195ed2935637d03 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Fri, 7 Feb 2014 07:31:38 +0000 Subject: [PATCH] scst_sysfs: Fix a build failure on kernels 2.6.2[678] The sysfs API is supported from kernel 2.6.26 on and uses the swap() macro while the swap() macro was introduced in kernel 2.6.29. Hence provide a definition of the swap() macro for kernels before 2.6.29. Signed-off-by: Sebastian Herbszt [bvanassche: Moved swap() definition a few lines down and added #ifndef/#endif] git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5269 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- scst/include/scst.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scst/include/scst.h b/scst/include/scst.h index 16990b147..367848d76 100644 --- a/scst/include/scst.h +++ b/scst/include/scst.h @@ -119,6 +119,13 @@ typedef _Bool bool; #define nr_cpumask_bits NR_CPUS #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) +#ifndef swap +#define swap(a, b) \ + do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0) +#endif +#endif + /* verify cpu argument to cpumask_* operators */ static inline unsigned int cpumask_check(unsigned int cpu) {