Skip to content

Commit a0f4ecf

Browse files
committed
netfilter: Remove extern from function prototypes
There are a mix of function prototypes with and without extern in the kernel sources. Standardize on not using extern for function prototypes. Function prototypes don't need to be written with extern. extern is assumed by the compiler. Its use is as unnecessary as using auto to declare automatic/local variables in a block. Signed-off-by: Joe Perches <joe@perches.com>
1 parent aae8c28 commit a0f4ecf

11 files changed

Lines changed: 133 additions & 136 deletions

‎include/linux/netfilter.h‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static inline void nf_inet_addr_mask(const union nf_inet_addr *a1,
3535
result->all[3] = a1->all[3] & mask->all[3];
3636
}
3737

38-
extern int netfilter_init(void);
38+
int netfilter_init(void);
3939

4040
/* Largest hook number + 1 */
4141
#define NF_MAX_HOOKS 8
@@ -208,7 +208,7 @@ int compat_nf_getsockopt(struct sock *sk, u_int8_t pf, int optval,
208208
/* Call this before modifying an existing packet: ensures it is
209209
modifiable and linear to the point you care about (writable_len).
210210
Returns true or false. */
211-
extern int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);
211+
int skb_make_writable(struct sk_buff *skb, unsigned int writable_len);
212212

213213
struct flowi;
214214
struct nf_queue_entry;
@@ -269,8 +269,8 @@ nf_checksum_partial(struct sk_buff *skb, unsigned int hook,
269269
return csum;
270270
}
271271

272-
extern int nf_register_afinfo(const struct nf_afinfo *afinfo);
273-
extern void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
272+
int nf_register_afinfo(const struct nf_afinfo *afinfo);
273+
void nf_unregister_afinfo(const struct nf_afinfo *afinfo);
274274

275275
#include <net/flow.h>
276276
extern void (*nf_nat_decode_session_hook)(struct sk_buff *, struct flowi *);
@@ -315,7 +315,7 @@ nf_nat_decode_session(struct sk_buff *skb, struct flowi *fl, u_int8_t family)
315315

316316
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
317317
extern void (*ip_ct_attach)(struct sk_buff *, const struct sk_buff *) __rcu;
318-
extern void nf_ct_attach(struct sk_buff *, const struct sk_buff *);
318+
void nf_ct_attach(struct sk_buff *, const struct sk_buff *);
319319
extern void (*nf_ct_destroy)(struct nf_conntrack *) __rcu;
320320

321321
struct nf_conn;

‎include/linux/netfilter/nf_conntrack_common.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ struct ip_conntrack_stat {
2323
};
2424

2525
/* call to create an explicit dependency on nf_conntrack. */
26-
extern void need_conntrack(void);
26+
void need_conntrack(void);
2727

2828
#endif /* _NF_CONNTRACK_COMMON_H */

‎include/linux/netfilter/nf_conntrack_h323.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ struct nf_ct_h323_master {
2929

3030
struct nf_conn;
3131

32-
extern int get_h225_addr(struct nf_conn *ct, unsigned char *data,
33-
TransportAddress *taddr,
34-
union nf_inet_addr *addr, __be16 *port);
35-
extern void nf_conntrack_h245_expect(struct nf_conn *new,
36-
struct nf_conntrack_expect *this);
37-
extern void nf_conntrack_q931_expect(struct nf_conn *new,
38-
struct nf_conntrack_expect *this);
32+
int get_h225_addr(struct nf_conn *ct, unsigned char *data,
33+
TransportAddress *taddr, union nf_inet_addr *addr,
34+
__be16 *port);
35+
void nf_conntrack_h245_expect(struct nf_conn *new,
36+
struct nf_conntrack_expect *this);
37+
void nf_conntrack_q931_expect(struct nf_conn *new,
38+
struct nf_conntrack_expect *this);
3939
extern int (*set_h245_addr_hook) (struct sk_buff *skb, unsigned int protoff,
4040
unsigned char **data, int dataoff,
4141
H245_TransportAddress *taddr,

‎include/linux/netfilter/nf_conntrack_proto_gre.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
8787
/* delete keymap entries */
8888
void nf_ct_gre_keymap_destroy(struct nf_conn *ct);
8989

90-
extern void nf_ct_gre_keymap_flush(struct net *net);
91-
extern void nf_nat_need_gre(void);
90+
void nf_ct_gre_keymap_flush(struct net *net);
91+
void nf_nat_need_gre(void);
9292

9393
#endif /* __KERNEL__ */
9494
#endif /* _CONNTRACK_PROTO_GRE_H */

‎include/linux/netfilter/nf_conntrack_sip.h‎

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -157,35 +157,34 @@ extern unsigned int (*nf_nat_sdp_media_hook)(struct sk_buff *skb,
157157
unsigned int medialen,
158158
union nf_inet_addr *rtp_addr);
159159

160-
extern int ct_sip_parse_request(const struct nf_conn *ct,
161-
const char *dptr, unsigned int datalen,
162-
unsigned int *matchoff, unsigned int *matchlen,
163-
union nf_inet_addr *addr, __be16 *port);
164-
extern int ct_sip_get_header(const struct nf_conn *ct, const char *dptr,
165-
unsigned int dataoff, unsigned int datalen,
166-
enum sip_header_types type,
167-
unsigned int *matchoff, unsigned int *matchlen);
168-
extern int ct_sip_parse_header_uri(const struct nf_conn *ct, const char *dptr,
169-
unsigned int *dataoff, unsigned int datalen,
170-
enum sip_header_types type, int *in_header,
171-
unsigned int *matchoff, unsigned int *matchlen,
172-
union nf_inet_addr *addr, __be16 *port);
173-
extern int ct_sip_parse_address_param(const struct nf_conn *ct, const char *dptr,
174-
unsigned int dataoff, unsigned int datalen,
175-
const char *name,
176-
unsigned int *matchoff, unsigned int *matchlen,
177-
union nf_inet_addr *addr, bool delim);
178-
extern int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr,
179-
unsigned int off, unsigned int datalen,
180-
const char *name,
181-
unsigned int *matchoff, unsigned int *matchen,
182-
unsigned int *val);
183-
184-
extern int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr,
185-
unsigned int dataoff, unsigned int datalen,
186-
enum sdp_header_types type,
187-
enum sdp_header_types term,
188-
unsigned int *matchoff, unsigned int *matchlen);
160+
int ct_sip_parse_request(const struct nf_conn *ct, const char *dptr,
161+
unsigned int datalen, unsigned int *matchoff,
162+
unsigned int *matchlen, union nf_inet_addr *addr,
163+
__be16 *port);
164+
int ct_sip_get_header(const struct nf_conn *ct, const char *dptr,
165+
unsigned int dataoff, unsigned int datalen,
166+
enum sip_header_types type, unsigned int *matchoff,
167+
unsigned int *matchlen);
168+
int ct_sip_parse_header_uri(const struct nf_conn *ct, const char *dptr,
169+
unsigned int *dataoff, unsigned int datalen,
170+
enum sip_header_types type, int *in_header,
171+
unsigned int *matchoff, unsigned int *matchlen,
172+
union nf_inet_addr *addr, __be16 *port);
173+
int ct_sip_parse_address_param(const struct nf_conn *ct, const char *dptr,
174+
unsigned int dataoff, unsigned int datalen,
175+
const char *name, unsigned int *matchoff,
176+
unsigned int *matchlen, union nf_inet_addr *addr,
177+
bool delim);
178+
int ct_sip_parse_numerical_param(const struct nf_conn *ct, const char *dptr,
179+
unsigned int off, unsigned int datalen,
180+
const char *name, unsigned int *matchoff,
181+
unsigned int *matchen, unsigned int *val);
182+
183+
int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr,
184+
unsigned int dataoff, unsigned int datalen,
185+
enum sdp_header_types type,
186+
enum sdp_header_types term,
187+
unsigned int *matchoff, unsigned int *matchlen);
189188

190189
#endif /* __KERNEL__ */
191190
#endif /* __NF_CONNTRACK_SIP_H__ */

‎include/linux/netfilter/nfnetlink.h‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ struct nfnetlink_subsystem {
2525
const struct nfnl_callback *cb; /* callback for individual types */
2626
};
2727

28-
extern int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
29-
extern int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
30-
31-
extern int nfnetlink_has_listeners(struct net *net, unsigned int group);
32-
extern struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size,
33-
u32 dst_portid, gfp_t gfp_mask);
34-
extern int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid,
35-
unsigned int group, int echo, gfp_t flags);
36-
extern int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error);
37-
extern int nfnetlink_unicast(struct sk_buff *skb, struct net *net,
38-
u32 portid, int flags);
39-
40-
extern void nfnl_lock(__u8 subsys_id);
41-
extern void nfnl_unlock(__u8 subsys_id);
28+
int nfnetlink_subsys_register(const struct nfnetlink_subsystem *n);
29+
int nfnetlink_subsys_unregister(const struct nfnetlink_subsystem *n);
30+
31+
int nfnetlink_has_listeners(struct net *net, unsigned int group);
32+
struct sk_buff *nfnetlink_alloc_skb(struct net *net, unsigned int size,
33+
u32 dst_portid, gfp_t gfp_mask);
34+
int nfnetlink_send(struct sk_buff *skb, struct net *net, u32 portid,
35+
unsigned int group, int echo, gfp_t flags);
36+
int nfnetlink_set_err(struct net *net, u32 portid, u32 group, int error);
37+
int nfnetlink_unicast(struct sk_buff *skb, struct net *net, u32 portid,
38+
int flags);
39+
40+
void nfnl_lock(__u8 subsys_id);
41+
void nfnl_unlock(__u8 subsys_id);
4242

4343
#define MODULE_ALIAS_NFNL_SUBSYS(subsys) \
4444
MODULE_ALIAS("nfnetlink-subsys-" __stringify(subsys))

‎include/linux/netfilter/nfnetlink_acct.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
struct nf_acct;
88

9-
extern struct nf_acct *nfnl_acct_find_get(const char *filter_name);
10-
extern void nfnl_acct_put(struct nf_acct *acct);
11-
extern void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct);
9+
struct nf_acct *nfnl_acct_find_get(const char *filter_name);
10+
void nfnl_acct_put(struct nf_acct *acct);
11+
void nfnl_acct_update(const struct sk_buff *skb, struct nf_acct *nfacct);
1212

1313
#endif /* _NFNL_ACCT_H */

‎include/linux/netfilter/x_tables.h‎

Lines changed: 63 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -229,50 +229,48 @@ struct xt_table_info {
229229

230230
#define XT_TABLE_INFO_SZ (offsetof(struct xt_table_info, entries) \
231231
+ nr_cpu_ids * sizeof(char *))
232-
extern int xt_register_target(struct xt_target *target);
233-
extern void xt_unregister_target(struct xt_target *target);
234-
extern int xt_register_targets(struct xt_target *target, unsigned int n);
235-
extern void xt_unregister_targets(struct xt_target *target, unsigned int n);
236-
237-
extern int xt_register_match(struct xt_match *target);
238-
extern void xt_unregister_match(struct xt_match *target);
239-
extern int xt_register_matches(struct xt_match *match, unsigned int n);
240-
extern void xt_unregister_matches(struct xt_match *match, unsigned int n);
241-
242-
extern int xt_check_match(struct xt_mtchk_param *,
243-
unsigned int size, u_int8_t proto, bool inv_proto);
244-
extern int xt_check_target(struct xt_tgchk_param *,
245-
unsigned int size, u_int8_t proto, bool inv_proto);
246-
247-
extern struct xt_table *xt_register_table(struct net *net,
248-
const struct xt_table *table,
249-
struct xt_table_info *bootstrap,
250-
struct xt_table_info *newinfo);
251-
extern void *xt_unregister_table(struct xt_table *table);
252-
253-
extern struct xt_table_info *xt_replace_table(struct xt_table *table,
254-
unsigned int num_counters,
255-
struct xt_table_info *newinfo,
256-
int *error);
257-
258-
extern struct xt_match *xt_find_match(u8 af, const char *name, u8 revision);
259-
extern struct xt_target *xt_find_target(u8 af, const char *name, u8 revision);
260-
extern struct xt_match *xt_request_find_match(u8 af, const char *name,
261-
u8 revision);
262-
extern struct xt_target *xt_request_find_target(u8 af, const char *name,
263-
u8 revision);
264-
extern int xt_find_revision(u8 af, const char *name, u8 revision,
265-
int target, int *err);
266-
267-
extern struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
268-
const char *name);
269-
extern void xt_table_unlock(struct xt_table *t);
270-
271-
extern int xt_proto_init(struct net *net, u_int8_t af);
272-
extern void xt_proto_fini(struct net *net, u_int8_t af);
273-
274-
extern struct xt_table_info *xt_alloc_table_info(unsigned int size);
275-
extern void xt_free_table_info(struct xt_table_info *info);
232+
int xt_register_target(struct xt_target *target);
233+
void xt_unregister_target(struct xt_target *target);
234+
int xt_register_targets(struct xt_target *target, unsigned int n);
235+
void xt_unregister_targets(struct xt_target *target, unsigned int n);
236+
237+
int xt_register_match(struct xt_match *target);
238+
void xt_unregister_match(struct xt_match *target);
239+
int xt_register_matches(struct xt_match *match, unsigned int n);
240+
void xt_unregister_matches(struct xt_match *match, unsigned int n);
241+
242+
int xt_check_match(struct xt_mtchk_param *, unsigned int size, u_int8_t proto,
243+
bool inv_proto);
244+
int xt_check_target(struct xt_tgchk_param *, unsigned int size, u_int8_t proto,
245+
bool inv_proto);
246+
247+
struct xt_table *xt_register_table(struct net *net,
248+
const struct xt_table *table,
249+
struct xt_table_info *bootstrap,
250+
struct xt_table_info *newinfo);
251+
void *xt_unregister_table(struct xt_table *table);
252+
253+
struct xt_table_info *xt_replace_table(struct xt_table *table,
254+
unsigned int num_counters,
255+
struct xt_table_info *newinfo,
256+
int *error);
257+
258+
struct xt_match *xt_find_match(u8 af, const char *name, u8 revision);
259+
struct xt_target *xt_find_target(u8 af, const char *name, u8 revision);
260+
struct xt_match *xt_request_find_match(u8 af, const char *name, u8 revision);
261+
struct xt_target *xt_request_find_target(u8 af, const char *name, u8 revision);
262+
int xt_find_revision(u8 af, const char *name, u8 revision, int target,
263+
int *err);
264+
265+
struct xt_table *xt_find_table_lock(struct net *net, u_int8_t af,
266+
const char *name);
267+
void xt_table_unlock(struct xt_table *t);
268+
269+
int xt_proto_init(struct net *net, u_int8_t af);
270+
void xt_proto_fini(struct net *net, u_int8_t af);
271+
272+
struct xt_table_info *xt_alloc_table_info(unsigned int size);
273+
void xt_free_table_info(struct xt_table_info *info);
276274

277275
/**
278276
* xt_recseq - recursive seqcount for netfilter use
@@ -353,8 +351,8 @@ static inline unsigned long ifname_compare_aligned(const char *_a,
353351
return ret;
354352
}
355353

356-
extern struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *);
357-
extern void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *);
354+
struct nf_hook_ops *xt_hook_link(const struct xt_table *, nf_hookfn *);
355+
void xt_hook_unlink(const struct xt_table *, struct nf_hook_ops *);
358356

359357
#ifdef CONFIG_COMPAT
360358
#include <net/compat.h>
@@ -414,25 +412,25 @@ struct _compat_xt_align {
414412

415413
#define COMPAT_XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _compat_xt_align))
416414

417-
extern void xt_compat_lock(u_int8_t af);
418-
extern void xt_compat_unlock(u_int8_t af);
419-
420-
extern int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta);
421-
extern void xt_compat_flush_offsets(u_int8_t af);
422-
extern void xt_compat_init_offsets(u_int8_t af, unsigned int number);
423-
extern int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
424-
425-
extern int xt_compat_match_offset(const struct xt_match *match);
426-
extern int xt_compat_match_from_user(struct xt_entry_match *m,
427-
void **dstptr, unsigned int *size);
428-
extern int xt_compat_match_to_user(const struct xt_entry_match *m,
429-
void __user **dstptr, unsigned int *size);
430-
431-
extern int xt_compat_target_offset(const struct xt_target *target);
432-
extern void xt_compat_target_from_user(struct xt_entry_target *t,
433-
void **dstptr, unsigned int *size);
434-
extern int xt_compat_target_to_user(const struct xt_entry_target *t,
435-
void __user **dstptr, unsigned int *size);
415+
void xt_compat_lock(u_int8_t af);
416+
void xt_compat_unlock(u_int8_t af);
417+
418+
int xt_compat_add_offset(u_int8_t af, unsigned int offset, int delta);
419+
void xt_compat_flush_offsets(u_int8_t af);
420+
void xt_compat_init_offsets(u_int8_t af, unsigned int number);
421+
int xt_compat_calc_jump(u_int8_t af, unsigned int offset);
422+
423+
int xt_compat_match_offset(const struct xt_match *match);
424+
int xt_compat_match_from_user(struct xt_entry_match *m, void **dstptr,
425+
unsigned int *size);
426+
int xt_compat_match_to_user(const struct xt_entry_match *m,
427+
void __user **dstptr, unsigned int *size);
428+
429+
int xt_compat_target_offset(const struct xt_target *target);
430+
void xt_compat_target_from_user(struct xt_entry_target *t, void **dstptr,
431+
unsigned int *size);
432+
int xt_compat_target_to_user(const struct xt_entry_target *t,
433+
void __user **dstptr, unsigned int *size);
436434

437435
#endif /* CONFIG_COMPAT */
438436
#endif /* _X_TABLES_H */

‎include/linux/netfilter_bridge.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ enum nf_br_hook_priorities {
2525
#define BRNF_PPPoE 0x20
2626

2727
/* Only used in br_forward.c */
28-
extern int nf_bridge_copy_header(struct sk_buff *skb);
28+
int nf_bridge_copy_header(struct sk_buff *skb);
2929
static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
3030
{
3131
if (skb->nf_bridge &&
@@ -53,7 +53,7 @@ static inline unsigned int nf_bridge_mtu_reduction(const struct sk_buff *skb)
5353
return 0;
5454
}
5555

56-
extern int br_handle_frame_finish(struct sk_buff *skb);
56+
int br_handle_frame_finish(struct sk_buff *skb);
5757
/* Only used in br_device.c */
5858
static inline int br_nf_pre_routing_finish_bridge_slow(struct sk_buff *skb)
5959
{

‎include/linux/netfilter_ipv4.h‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <uapi/linux/netfilter_ipv4.h>
88

9-
extern int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type);
10-
extern __sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
11-
unsigned int dataoff, u_int8_t protocol);
9+
int ip_route_me_harder(struct sk_buff *skb, unsigned addr_type);
10+
__sum16 nf_ip_checksum(struct sk_buff *skb, unsigned int hook,
11+
unsigned int dataoff, u_int8_t protocol);
1212
#endif /*__LINUX_IP_NETFILTER_H*/

0 commit comments

Comments
 (0)