summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Volkov <pva@gentoo.org>2010-08-12 16:05:22 +0100
committerPeter Volkov <pva@gentoo.org>2010-08-12 16:05:22 +0100
commit444ea456bcd8dedbab2adc7c50ecb4bb204e9d20 (patch)
tree2a45a7073ab2a46f44aabf1a80356cf217de1709 /2.6.34/0010-make-XT_ALIGN-usable-in-exported-headers-by-exporting-__ALIGN_KERNEL.patch
parentinitial 2.6.34 patchset based on last 2.6.33 patchset (diff)
downloadlinux-headers-patches-444ea456bcd8dedbab2adc7c50ecb4bb204e9d20.tar.gz
linux-headers-patches-444ea456bcd8dedbab2adc7c50ecb4bb204e9d20.tar.bz2
linux-headers-patches-444ea456bcd8dedbab2adc7c50ecb4bb204e9d20.zip
Patch for bug #325257
Diffstat (limited to '2.6.34/0010-make-XT_ALIGN-usable-in-exported-headers-by-exporting-__ALIGN_KERNEL.patch')
-rw-r--r--2.6.34/0010-make-XT_ALIGN-usable-in-exported-headers-by-exporting-__ALIGN_KERNEL.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/2.6.34/0010-make-XT_ALIGN-usable-in-exported-headers-by-exporting-__ALIGN_KERNEL.patch b/2.6.34/0010-make-XT_ALIGN-usable-in-exported-headers-by-exporting-__ALIGN_KERNEL.patch
new file mode 100644
index 0000000..eb09d12
--- /dev/null
+++ b/2.6.34/0010-make-XT_ALIGN-usable-in-exported-headers-by-exporting-__ALIGN_KERNEL.patch
@@ -0,0 +1,73 @@
+xtables: make XT_ALIGN() usable in exported headers by exporting __ALIGN_KERNEL()
+
+XT_ALIGN() was rewritten through ALIGN() by commit 42107f5009da223daa800d6da6904d77297ae829
+"netfilter: xtables: symmetric COMPAT_XT_ALIGN definition".
+ALIGN() is not exported in userspace headers, which created compile problem for tc(8)
+and will create problem for iptables(8).
+
+We can't export generic looking name ALIGN() but we can export less generic
+__ALIGN_KERNEL() (suggested by Ben Hutchings).
+Google knows nothing about __ALIGN_KERNEL().
+
+COMPAT_XT_ALIGN() changed for symmetry.
+
+Reported-by: Andreas Henriksson <andreas@???>
+Signed-off-by: Alexey Dobriyan <adobriyan@???>
+
+http://archives.free.net.ph/message/20100413.110647.ec33e197.ca.html
+https://bugs.gentoo.org/show_bug.cgi?id=325257
+
+=== modified file 'include/linux/kernel.h'
+--- include/linux/kernel.h 2010-08-12 09:36:38 +0000
++++ include/linux/kernel.h 2010-08-12 09:40:56 +0000
+@@ -4,6 +4,8 @@
+ /*
+ * 'kernel.h' contains some often-used function prototypes etc
+ */
++#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
++#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
+
+ #ifdef __KERNEL__
+
+@@ -37,8 +39,8 @@
+
+ #define STACK_MAGIC 0xdeadbeef
+
+-#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
+-#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
++#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
++#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
+ #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
+ #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
+
+
+=== modified file 'include/linux/netfilter/x_tables.h'
+--- include/linux/netfilter/x_tables.h 2010-08-12 09:36:38 +0000
++++ include/linux/netfilter/x_tables.h 2010-08-12 09:41:49 +0000
+@@ -1,6 +1,7 @@
+ #ifndef _X_TABLES_H
+ #define _X_TABLES_H
+
++#include <linux/kernel.h>
+ #include <linux/types.h>
+
+ #define XT_FUNCTION_MAXNAMELEN 30
+@@ -93,7 +94,7 @@
+ __u64 u64;
+ };
+
+-#define XT_ALIGN(s) ALIGN((s), __alignof__(struct _xt_align))
++#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align))
+
+ /* Standard return verdict, or do jump. */
+ #define XT_STANDARD_TARGET ""
+@@ -598,7 +599,7 @@
+ compat_u64 u64;
+ };
+
+-#define COMPAT_XT_ALIGN(s) ALIGN((s), __alignof__(struct _compat_xt_align))
++#define COMPAT_XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _compat_xt_align))
+
+ extern void xt_compat_lock(u_int8_t af);
+ extern void xt_compat_unlock(u_int8_t af);
+