add some extra kernel exports to be used by ashmem and binder later
[openwrt/svn-archive/archive.git] / target / linux / generic-2.6 / patches-2.6.28 / 950-revert_xt_sctp_simplify.patch
1 --- a/include/linux/netfilter/xt_sctp.h
2 +++ b/include/linux/netfilter/xt_sctp.h
3 @@ -37,54 +37,68 @@ struct xt_sctp_info {
4
5 #define SCTP_CHUNKMAP_SET(chunkmap, type) \
6 do { \
7 - (chunkmap)[type / bytes(u_int32_t)] |= \
8 + chunkmap[type / bytes(u_int32_t)] |= \
9 1 << (type % bytes(u_int32_t)); \
10 } while (0)
11
12 #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
13 do { \
14 - (chunkmap)[type / bytes(u_int32_t)] &= \
15 + chunkmap[type / bytes(u_int32_t)] &= \
16 ~(1 << (type % bytes(u_int32_t))); \
17 } while (0)
18
19 #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
20 ({ \
21 - ((chunkmap)[type / bytes (u_int32_t)] & \
22 + (chunkmap[type / bytes (u_int32_t)] & \
23 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \
24 })
25
26 -#define SCTP_CHUNKMAP_RESET(chunkmap) \
27 - memset((chunkmap), 0, sizeof(chunkmap))
28 +#define SCTP_CHUNKMAP_RESET(chunkmap) \
29 + do { \
30 + int i; \
31 + for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
32 + chunkmap[i] = 0; \
33 + } while (0)
34
35 -#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
36 - memset((chunkmap), ~0U, sizeof(chunkmap))
37 +#define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
38 + do { \
39 + int i; \
40 + for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
41 + chunkmap[i] = ~0; \
42 + } while (0)
43
44 -#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
45 - memcpy((destmap), (srcmap), sizeof(srcmap))
46 +#define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
47 + do { \
48 + int i; \
49 + for (i = 0; i < ARRAY_SIZE(srcmap); i++) \
50 + destmap[i] = srcmap[i]; \
51 + } while (0)
52 +
53 +#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
54 +({ \
55 + int i; \
56 + int flag = 1; \
57 + for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
58 + if (chunkmap[i]) { \
59 + flag = 0; \
60 + break; \
61 + } \
62 + } \
63 + flag; \
64 +})
65
66 -#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
67 - __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
68 -static inline bool
69 -__sctp_chunkmap_is_clear(const u_int32_t *chunkmap, unsigned int n)
70 -{
71 - unsigned int i;
72 - for (i = 0; i < n; ++i)
73 - if (chunkmap[i])
74 - return false;
75 - return true;
76 -}
77 -
78 -#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
79 - __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
80 -static inline bool
81 -__sctp_chunkmap_is_all_set(const u_int32_t *chunkmap, unsigned int n)
82 -{
83 - unsigned int i;
84 - for (i = 0; i < n; ++i)
85 - if (chunkmap[i] != ~0U)
86 - return false;
87 - return true;
88 -}
89 +#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
90 +({ \
91 + int i; \
92 + int flag = 1; \
93 + for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
94 + if (chunkmap[i] != ~0) { \
95 + flag = 0; \
96 + break; \
97 + } \
98 + } \
99 + flag; \
100 +})
101
102 #endif /* _XT_SCTP_H_ */
103