Skip to content

Commit 8dea982

Browse files
a3a3elummakynes
authored andcommitted
netfilter: ipset: remove inline from static functions in .c files.
The inline function-specifier should not be used for static functions defined in .c files since it bloats the kernel. Instead leave the compiler to decide which functions to inline. While a couple of the files affected (ip_set_*_gen.h) are technically headers, they contain templates for generating the common parts of particular set-types and so we treat them like .c files. Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Acked-by: Jozsef Kadlecsik <kadlec@netfilter.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 017f77c commit 8dea982

19 files changed

Lines changed: 138 additions & 138 deletions

‎net/netfilter/ipset/ip_set_bitmap_gen.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext,
192192
}
193193

194194
#ifndef IP_SET_BITMAP_STORED_TIMEOUT
195-
static inline bool
195+
static bool
196196
mtype_is_filled(const struct mtype_elem *x)
197197
{
198198
return true;

‎net/netfilter/ipset/ip_set_bitmap_ip.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,49 +55,49 @@ struct bitmap_ip_adt_elem {
5555
u16 id;
5656
};
5757

58-
static inline u32
58+
static u32
5959
ip_to_id(const struct bitmap_ip *m, u32 ip)
6060
{
6161
return ((ip & ip_set_hostmask(m->netmask)) - m->first_ip) / m->hosts;
6262
}
6363

6464
/* Common functions */
6565

66-
static inline int
66+
static int
6767
bitmap_ip_do_test(const struct bitmap_ip_adt_elem *e,
6868
struct bitmap_ip *map, size_t dsize)
6969
{
7070
return !!test_bit(e->id, map->members);
7171
}
7272

73-
static inline int
73+
static int
7474
bitmap_ip_gc_test(u16 id, const struct bitmap_ip *map, size_t dsize)
7575
{
7676
return !!test_bit(id, map->members);
7777
}
7878

79-
static inline int
79+
static int
8080
bitmap_ip_do_add(const struct bitmap_ip_adt_elem *e, struct bitmap_ip *map,
8181
u32 flags, size_t dsize)
8282
{
8383
return !!test_bit(e->id, map->members);
8484
}
8585

86-
static inline int
86+
static int
8787
bitmap_ip_do_del(const struct bitmap_ip_adt_elem *e, struct bitmap_ip *map)
8888
{
8989
return !test_and_clear_bit(e->id, map->members);
9090
}
9191

92-
static inline int
92+
static int
9393
bitmap_ip_do_list(struct sk_buff *skb, const struct bitmap_ip *map, u32 id,
9494
size_t dsize)
9595
{
9696
return nla_put_ipaddr4(skb, IPSET_ATTR_IP,
9797
htonl(map->first_ip + id * map->hosts));
9898
}
9999

100-
static inline int
100+
static int
101101
bitmap_ip_do_head(struct sk_buff *skb, const struct bitmap_ip *map)
102102
{
103103
return nla_put_ipaddr4(skb, IPSET_ATTR_IP, htonl(map->first_ip)) ||

‎net/netfilter/ipset/ip_set_bitmap_ipmac.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ struct bitmap_ipmac_elem {
6565
unsigned char filled;
6666
} __aligned(__alignof__(u64));
6767

68-
static inline u32
68+
static u32
6969
ip_to_id(const struct bitmap_ipmac *m, u32 ip)
7070
{
7171
return ip - m->first_ip;
@@ -79,7 +79,7 @@ ip_to_id(const struct bitmap_ipmac *m, u32 ip)
7979

8080
/* Common functions */
8181

82-
static inline int
82+
static int
8383
bitmap_ipmac_do_test(const struct bitmap_ipmac_adt_elem *e,
8484
const struct bitmap_ipmac *map, size_t dsize)
8585
{
@@ -94,7 +94,7 @@ bitmap_ipmac_do_test(const struct bitmap_ipmac_adt_elem *e,
9494
return -EAGAIN;
9595
}
9696

97-
static inline int
97+
static int
9898
bitmap_ipmac_gc_test(u16 id, const struct bitmap_ipmac *map, size_t dsize)
9999
{
100100
const struct bitmap_ipmac_elem *elem;
@@ -106,13 +106,13 @@ bitmap_ipmac_gc_test(u16 id, const struct bitmap_ipmac *map, size_t dsize)
106106
return elem->filled == MAC_FILLED;
107107
}
108108

109-
static inline int
109+
static int
110110
bitmap_ipmac_is_filled(const struct bitmap_ipmac_elem *elem)
111111
{
112112
return elem->filled == MAC_FILLED;
113113
}
114114

115-
static inline int
115+
static int
116116
bitmap_ipmac_add_timeout(unsigned long *timeout,
117117
const struct bitmap_ipmac_adt_elem *e,
118118
const struct ip_set_ext *ext, struct ip_set *set,
@@ -139,7 +139,7 @@ bitmap_ipmac_add_timeout(unsigned long *timeout,
139139
return 0;
140140
}
141141

142-
static inline int
142+
static int
143143
bitmap_ipmac_do_add(const struct bitmap_ipmac_adt_elem *e,
144144
struct bitmap_ipmac *map, u32 flags, size_t dsize)
145145
{
@@ -177,14 +177,14 @@ bitmap_ipmac_do_add(const struct bitmap_ipmac_adt_elem *e,
177177
return IPSET_ADD_STORE_PLAIN_TIMEOUT;
178178
}
179179

180-
static inline int
180+
static int
181181
bitmap_ipmac_do_del(const struct bitmap_ipmac_adt_elem *e,
182182
struct bitmap_ipmac *map)
183183
{
184184
return !test_and_clear_bit(e->id, map->members);
185185
}
186186

187-
static inline int
187+
static int
188188
bitmap_ipmac_do_list(struct sk_buff *skb, const struct bitmap_ipmac *map,
189189
u32 id, size_t dsize)
190190
{
@@ -197,7 +197,7 @@ bitmap_ipmac_do_list(struct sk_buff *skb, const struct bitmap_ipmac *map,
197197
nla_put(skb, IPSET_ATTR_ETHER, ETH_ALEN, elem->ether));
198198
}
199199

200-
static inline int
200+
static int
201201
bitmap_ipmac_do_head(struct sk_buff *skb, const struct bitmap_ipmac *map)
202202
{
203203
return nla_put_ipaddr4(skb, IPSET_ATTR_IP, htonl(map->first_ip)) ||

‎net/netfilter/ipset/ip_set_bitmap_port.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,50 +46,50 @@ struct bitmap_port_adt_elem {
4646
u16 id;
4747
};
4848

49-
static inline u16
49+
static u16
5050
port_to_id(const struct bitmap_port *m, u16 port)
5151
{
5252
return port - m->first_port;
5353
}
5454

5555
/* Common functions */
5656

57-
static inline int
57+
static int
5858
bitmap_port_do_test(const struct bitmap_port_adt_elem *e,
5959
const struct bitmap_port *map, size_t dsize)
6060
{
6161
return !!test_bit(e->id, map->members);
6262
}
6363

64-
static inline int
64+
static int
6565
bitmap_port_gc_test(u16 id, const struct bitmap_port *map, size_t dsize)
6666
{
6767
return !!test_bit(id, map->members);
6868
}
6969

70-
static inline int
70+
static int
7171
bitmap_port_do_add(const struct bitmap_port_adt_elem *e,
7272
struct bitmap_port *map, u32 flags, size_t dsize)
7373
{
7474
return !!test_bit(e->id, map->members);
7575
}
7676

77-
static inline int
77+
static int
7878
bitmap_port_do_del(const struct bitmap_port_adt_elem *e,
7979
struct bitmap_port *map)
8080
{
8181
return !test_and_clear_bit(e->id, map->members);
8282
}
8383

84-
static inline int
84+
static int
8585
bitmap_port_do_list(struct sk_buff *skb, const struct bitmap_port *map, u32 id,
8686
size_t dsize)
8787
{
8888
return nla_put_net16(skb, IPSET_ATTR_PORT,
8989
htons(map->first_port + id));
9090
}
9191

92-
static inline int
92+
static int
9393
bitmap_port_do_head(struct sk_buff *skb, const struct bitmap_port *map)
9494
{
9595
return nla_put_net16(skb, IPSET_ATTR_PORT, htons(map->first_port)) ||

‎net/netfilter/ipset/ip_set_core.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ struct ip_set_net {
3535

3636
static unsigned int ip_set_net_id __read_mostly;
3737

38-
static inline struct ip_set_net *ip_set_pernet(struct net *net)
38+
static struct ip_set_net *ip_set_pernet(struct net *net)
3939
{
4040
return net_generic(net, ip_set_net_id);
4141
}
@@ -67,13 +67,13 @@ MODULE_ALIAS_NFNL_SUBSYS(NFNL_SUBSYS_IPSET);
6767
* serialized by ip_set_type_mutex.
6868
*/
6969

70-
static inline void
70+
static void
7171
ip_set_type_lock(void)
7272
{
7373
mutex_lock(&ip_set_type_mutex);
7474
}
7575

76-
static inline void
76+
static void
7777
ip_set_type_unlock(void)
7878
{
7979
mutex_unlock(&ip_set_type_mutex);
@@ -277,7 +277,7 @@ ip_set_free(void *members)
277277
}
278278
EXPORT_SYMBOL_GPL(ip_set_free);
279279

280-
static inline bool
280+
static bool
281281
flag_nested(const struct nlattr *nla)
282282
{
283283
return nla->nla_type & NLA_F_NESTED;
@@ -356,7 +356,7 @@ const struct ip_set_ext_type ip_set_extensions[] = {
356356
};
357357
EXPORT_SYMBOL_GPL(ip_set_extensions);
358358

359-
static inline bool
359+
static bool
360360
add_extension(enum ip_set_ext_id id, u32 flags, struct nlattr *tb[])
361361
{
362362
return ip_set_extensions[id].flag ?
@@ -506,15 +506,15 @@ EXPORT_SYMBOL_GPL(ip_set_match_extensions);
506506
* The set behind an index may change by swapping only, from userspace.
507507
*/
508508

509-
static inline void
509+
static void
510510
__ip_set_get(struct ip_set *set)
511511
{
512512
write_lock_bh(&ip_set_ref_lock);
513513
set->ref++;
514514
write_unlock_bh(&ip_set_ref_lock);
515515
}
516516

517-
static inline void
517+
static void
518518
__ip_set_put(struct ip_set *set)
519519
{
520520
write_lock_bh(&ip_set_ref_lock);
@@ -526,7 +526,7 @@ __ip_set_put(struct ip_set *set)
526526
/* set->ref can be swapped out by ip_set_swap, netlink events (like dump) need
527527
* a separate reference counter
528528
*/
529-
static inline void
529+
static void
530530
__ip_set_put_netlink(struct ip_set *set)
531531
{
532532
write_lock_bh(&ip_set_ref_lock);
@@ -541,7 +541,7 @@ __ip_set_put_netlink(struct ip_set *set)
541541
* so it can't be destroyed (or changed) under our foot.
542542
*/
543543

544-
static inline struct ip_set *
544+
static struct ip_set *
545545
ip_set_rcu_get(struct net *net, ip_set_id_t index)
546546
{
547547
struct ip_set *set;
@@ -670,7 +670,7 @@ EXPORT_SYMBOL_GPL(ip_set_get_byname);
670670
*
671671
*/
672672

673-
static inline void
673+
static void
674674
__ip_set_put_byindex(struct ip_set_net *inst, ip_set_id_t index)
675675
{
676676
struct ip_set *set;

‎net/netfilter/ipset/ip_set_hash_gen.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#ifdef IP_SET_HASH_WITH_MULTI
4040
#define AHASH_MAX(h) ((h)->ahash_max)
4141

42-
static inline u8
42+
static u8
4343
tune_ahash_max(u8 curr, u32 multi)
4444
{
4545
u32 n;
@@ -909,7 +909,7 @@ mtype_del(struct ip_set *set, void *value, const struct ip_set_ext *ext,
909909
return ret;
910910
}
911911

912-
static inline int
912+
static int
913913
mtype_data_match(struct mtype_elem *data, const struct ip_set_ext *ext,
914914
struct ip_set_ext *mext, struct ip_set *set, u32 flags)
915915
{

‎net/netfilter/ipset/ip_set_hash_ip.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct hash_ip4_elem {
4444

4545
/* Common functions */
4646

47-
static inline bool
47+
static bool
4848
hash_ip4_data_equal(const struct hash_ip4_elem *e1,
4949
const struct hash_ip4_elem *e2,
5050
u32 *multi)
@@ -63,7 +63,7 @@ hash_ip4_data_list(struct sk_buff *skb, const struct hash_ip4_elem *e)
6363
return true;
6464
}
6565

66-
static inline void
66+
static void
6767
hash_ip4_data_next(struct hash_ip4_elem *next, const struct hash_ip4_elem *e)
6868
{
6969
next->ip = e->ip;
@@ -171,15 +171,15 @@ struct hash_ip6_elem {
171171

172172
/* Common functions */
173173

174-
static inline bool
174+
static bool
175175
hash_ip6_data_equal(const struct hash_ip6_elem *ip1,
176176
const struct hash_ip6_elem *ip2,
177177
u32 *multi)
178178
{
179179
return ipv6_addr_equal(&ip1->ip.in6, &ip2->ip.in6);
180180
}
181181

182-
static inline void
182+
static void
183183
hash_ip6_netmask(union nf_inet_addr *ip, u8 prefix)
184184
{
185185
ip6_netmask(ip, prefix);
@@ -196,7 +196,7 @@ hash_ip6_data_list(struct sk_buff *skb, const struct hash_ip6_elem *e)
196196
return true;
197197
}
198198

199-
static inline void
199+
static void
200200
hash_ip6_data_next(struct hash_ip6_elem *next, const struct hash_ip6_elem *e)
201201
{
202202
}

‎net/netfilter/ipset/ip_set_hash_ipmac.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ struct hash_ipmac4_elem {
4747

4848
/* Common functions */
4949

50-
static inline bool
50+
static bool
5151
hash_ipmac4_data_equal(const struct hash_ipmac4_elem *e1,
5252
const struct hash_ipmac4_elem *e2,
5353
u32 *multi)
@@ -67,7 +67,7 @@ hash_ipmac4_data_list(struct sk_buff *skb, const struct hash_ipmac4_elem *e)
6767
return true;
6868
}
6969

70-
static inline void
70+
static void
7171
hash_ipmac4_data_next(struct hash_ipmac4_elem *next,
7272
const struct hash_ipmac4_elem *e)
7373
{
@@ -154,7 +154,7 @@ struct hash_ipmac6_elem {
154154

155155
/* Common functions */
156156

157-
static inline bool
157+
static bool
158158
hash_ipmac6_data_equal(const struct hash_ipmac6_elem *e1,
159159
const struct hash_ipmac6_elem *e2,
160160
u32 *multi)
@@ -175,7 +175,7 @@ hash_ipmac6_data_list(struct sk_buff *skb, const struct hash_ipmac6_elem *e)
175175
return true;
176176
}
177177

178-
static inline void
178+
static void
179179
hash_ipmac6_data_next(struct hash_ipmac6_elem *next,
180180
const struct hash_ipmac6_elem *e)
181181
{

0 commit comments

Comments
 (0)