[kernel] fixup 2.6.34 kernel headers to properly export XT_ALIGN() to userspace
[openwrt/svn-archive/archive.git] / target / linux / generic / patches-2.6.34 / 200-netfilter_xtables_align.patch
1 --- a/include/linux/kernel.h
2 +++ b/include/linux/kernel.h
3 @@ -4,6 +4,8 @@
4 /*
5 * 'kernel.h' contains some often-used function prototypes etc
6 */
7 +#define __ALIGN_KERNEL(x, a) __ALIGN_KERNEL_MASK(x, (typeof(x))(a) - 1)
8 +#define __ALIGN_KERNEL_MASK(x, mask) (((x) + (mask)) & ~(mask))
9
10 #ifdef __KERNEL__
11
12 @@ -37,8 +39,8 @@ extern const char linux_proc_banner[];
13
14 #define STACK_MAGIC 0xdeadbeef
15
16 -#define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1)
17 -#define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask))
18 +#define ALIGN(x, a) __ALIGN_KERNEL((x), (a))
19 +#define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
20 #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
21 #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
22
23 --- a/include/linux/netfilter/x_tables.h
24 +++ b/include/linux/netfilter/x_tables.h
25 @@ -1,6 +1,6 @@
26 #ifndef _X_TABLES_H
27 #define _X_TABLES_H
28 -
29 +#include <linux/kernel.h>
30 #include <linux/types.h>
31
32 #define XT_FUNCTION_MAXNAMELEN 30
33 @@ -93,7 +93,7 @@ struct _xt_align {
34 __u64 u64;
35 };
36
37 -#define XT_ALIGN(s) ALIGN((s), __alignof__(struct _xt_align))
38 +#define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align))
39
40 /* Standard return verdict, or do jump. */
41 #define XT_STANDARD_TARGET ""
42 @@ -598,7 +598,7 @@ struct _compat_xt_align {
43 compat_u64 u64;
44 };
45
46 -#define COMPAT_XT_ALIGN(s) ALIGN((s), __alignof__(struct _compat_xt_align))
47 +#define COMPAT_XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _compat_xt_align))
48
49 extern void xt_compat_lock(u_int8_t af);
50 extern void xt_compat_unlock(u_int8_t af);