Skip to content

Commit 5c3a0fd

Browse files
JoePerchesdavem330
authored andcommitted
ip*.h: 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> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1fd5115 commit 5c3a0fd

6 files changed

Lines changed: 416 additions & 478 deletions

File tree

‎include/net/ip.h‎

Lines changed: 84 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -86,64 +86,61 @@ struct packet_type;
8686
struct rtable;
8787
struct sockaddr;
8888

89-
extern int igmp_mc_proc_init(void);
89+
int igmp_mc_proc_init(void);
9090

9191
/*
9292
* Functions provided by ip.c
9393
*/
9494

95-
extern int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
96-
__be32 saddr, __be32 daddr,
97-
struct ip_options_rcu *opt);
98-
extern int ip_rcv(struct sk_buff *skb, struct net_device *dev,
99-
struct packet_type *pt, struct net_device *orig_dev);
100-
extern int ip_local_deliver(struct sk_buff *skb);
101-
extern int ip_mr_input(struct sk_buff *skb);
102-
extern int ip_output(struct sk_buff *skb);
103-
extern int ip_mc_output(struct sk_buff *skb);
104-
extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
105-
extern int ip_do_nat(struct sk_buff *skb);
106-
extern void ip_send_check(struct iphdr *ip);
107-
extern int __ip_local_out(struct sk_buff *skb);
108-
extern int ip_local_out(struct sk_buff *skb);
109-
extern int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl);
110-
extern void ip_init(void);
111-
extern int ip_append_data(struct sock *sk, struct flowi4 *fl4,
112-
int getfrag(void *from, char *to, int offset, int len,
113-
int odd, struct sk_buff *skb),
114-
void *from, int len, int protolen,
115-
struct ipcm_cookie *ipc,
116-
struct rtable **rt,
117-
unsigned int flags);
118-
extern int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb);
119-
extern ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
120-
int offset, size_t size, int flags);
121-
extern struct sk_buff *__ip_make_skb(struct sock *sk,
122-
struct flowi4 *fl4,
123-
struct sk_buff_head *queue,
124-
struct inet_cork *cork);
125-
extern int ip_send_skb(struct net *net, struct sk_buff *skb);
126-
extern int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4);
127-
extern void ip_flush_pending_frames(struct sock *sk);
128-
extern struct sk_buff *ip_make_skb(struct sock *sk,
129-
struct flowi4 *fl4,
130-
int getfrag(void *from, char *to, int offset, int len,
131-
int odd, struct sk_buff *skb),
132-
void *from, int length, int transhdrlen,
133-
struct ipcm_cookie *ipc,
134-
struct rtable **rtp,
135-
unsigned int flags);
95+
int ip_build_and_send_pkt(struct sk_buff *skb, struct sock *sk,
96+
__be32 saddr, __be32 daddr,
97+
struct ip_options_rcu *opt);
98+
int ip_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt,
99+
struct net_device *orig_dev);
100+
int ip_local_deliver(struct sk_buff *skb);
101+
int ip_mr_input(struct sk_buff *skb);
102+
int ip_output(struct sk_buff *skb);
103+
int ip_mc_output(struct sk_buff *skb);
104+
int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
105+
int ip_do_nat(struct sk_buff *skb);
106+
void ip_send_check(struct iphdr *ip);
107+
int __ip_local_out(struct sk_buff *skb);
108+
int ip_local_out(struct sk_buff *skb);
109+
int ip_queue_xmit(struct sk_buff *skb, struct flowi *fl);
110+
void ip_init(void);
111+
int ip_append_data(struct sock *sk, struct flowi4 *fl4,
112+
int getfrag(void *from, char *to, int offset, int len,
113+
int odd, struct sk_buff *skb),
114+
void *from, int len, int protolen,
115+
struct ipcm_cookie *ipc,
116+
struct rtable **rt,
117+
unsigned int flags);
118+
int ip_generic_getfrag(void *from, char *to, int offset, int len, int odd,
119+
struct sk_buff *skb);
120+
ssize_t ip_append_page(struct sock *sk, struct flowi4 *fl4, struct page *page,
121+
int offset, size_t size, int flags);
122+
struct sk_buff *__ip_make_skb(struct sock *sk, struct flowi4 *fl4,
123+
struct sk_buff_head *queue,
124+
struct inet_cork *cork);
125+
int ip_send_skb(struct net *net, struct sk_buff *skb);
126+
int ip_push_pending_frames(struct sock *sk, struct flowi4 *fl4);
127+
void ip_flush_pending_frames(struct sock *sk);
128+
struct sk_buff *ip_make_skb(struct sock *sk, struct flowi4 *fl4,
129+
int getfrag(void *from, char *to, int offset,
130+
int len, int odd, struct sk_buff *skb),
131+
void *from, int length, int transhdrlen,
132+
struct ipcm_cookie *ipc, struct rtable **rtp,
133+
unsigned int flags);
136134

137135
static inline struct sk_buff *ip_finish_skb(struct sock *sk, struct flowi4 *fl4)
138136
{
139137
return __ip_make_skb(sk, fl4, &sk->sk_write_queue, &inet_sk(sk)->cork.base);
140138
}
141139

142140
/* datagram.c */
143-
extern int ip4_datagram_connect(struct sock *sk,
144-
struct sockaddr *uaddr, int addr_len);
141+
int ip4_datagram_connect(struct sock *sk, struct sockaddr *uaddr, int addr_len);
145142

146-
extern void ip4_datagram_release_cb(struct sock *sk);
143+
void ip4_datagram_release_cb(struct sock *sk);
147144

148145
struct ip_reply_arg {
149146
struct kvec iov[1];
@@ -184,16 +181,16 @@ extern struct ipv4_config ipv4_config;
184181
#define NET_ADD_STATS_BH(net, field, adnd) SNMP_ADD_STATS_BH((net)->mib.net_statistics, field, adnd)
185182
#define NET_ADD_STATS_USER(net, field, adnd) SNMP_ADD_STATS_USER((net)->mib.net_statistics, field, adnd)
186183

187-
extern unsigned long snmp_fold_field(void __percpu *mib[], int offt);
184+
unsigned long snmp_fold_field(void __percpu *mib[], int offt);
188185
#if BITS_PER_LONG==32
189-
extern u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off);
186+
u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t sync_off);
190187
#else
191188
static inline u64 snmp_fold_field64(void __percpu *mib[], int offt, size_t syncp_off)
192189
{
193190
return snmp_fold_field(mib, offt);
194191
}
195192
#endif
196-
extern int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
193+
int snmp_mib_init(void __percpu *ptr[2], size_t mibsize, size_t align);
197194

198195
static inline void snmp_mib_free(void __percpu *ptr[SNMP_ARRAY_SZ])
199196
{
@@ -210,7 +207,7 @@ extern struct local_ports {
210207
seqlock_t lock;
211208
int range[2];
212209
} sysctl_local_ports;
213-
extern void inet_get_local_port_range(int *low, int *high);
210+
void inet_get_local_port_range(int *low, int *high);
214211

215212
extern unsigned long *sysctl_local_reserved_ports;
216213
static inline int inet_is_reserved_local_port(int port)
@@ -231,9 +228,9 @@ extern int sysctl_ip_early_demux;
231228
/* From ip_output.c */
232229
extern int sysctl_ip_dynaddr;
233230

234-
extern void ipfrag_init(void);
231+
void ipfrag_init(void);
235232

236-
extern void ip_static_sysctl_init(void);
233+
void ip_static_sysctl_init(void);
237234

238235
static inline bool ip_is_fragment(const struct iphdr *iph)
239236
{
@@ -262,7 +259,7 @@ int ip_dont_fragment(struct sock *sk, struct dst_entry *dst)
262259
!(dst_metric_locked(dst, RTAX_MTU)));
263260
}
264261

265-
extern void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more);
262+
void __ip_select_ident(struct iphdr *iph, struct dst_entry *dst, int more);
266263

267264
static inline void ip_select_ident(struct sk_buff *skb, struct dst_entry *dst, struct sock *sk)
268265
{
@@ -390,7 +387,7 @@ static inline int sk_mc_loop(struct sock *sk)
390387
return 1;
391388
}
392389

393-
extern bool ip_call_ra_chain(struct sk_buff *skb);
390+
bool ip_call_ra_chain(struct sk_buff *skb);
394391

395392
/*
396393
* Functions provided by ip_fragment.c
@@ -428,50 +425,52 @@ int ip_frag_nqueues(struct net *net);
428425
* Functions provided by ip_forward.c
429426
*/
430427

431-
extern int ip_forward(struct sk_buff *skb);
428+
int ip_forward(struct sk_buff *skb);
432429

433430
/*
434431
* Functions provided by ip_options.c
435432
*/
436433

437-
extern void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
438-
__be32 daddr, struct rtable *rt, int is_frag);
439-
extern int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb);
440-
extern void ip_options_fragment(struct sk_buff *skb);
441-
extern int ip_options_compile(struct net *net,
442-
struct ip_options *opt, struct sk_buff *skb);
443-
extern int ip_options_get(struct net *net, struct ip_options_rcu **optp,
444-
unsigned char *data, int optlen);
445-
extern int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp,
446-
unsigned char __user *data, int optlen);
447-
extern void ip_options_undo(struct ip_options * opt);
448-
extern void ip_forward_options(struct sk_buff *skb);
449-
extern int ip_options_rcv_srr(struct sk_buff *skb);
434+
void ip_options_build(struct sk_buff *skb, struct ip_options *opt,
435+
__be32 daddr, struct rtable *rt, int is_frag);
436+
int ip_options_echo(struct ip_options *dopt, struct sk_buff *skb);
437+
void ip_options_fragment(struct sk_buff *skb);
438+
int ip_options_compile(struct net *net, struct ip_options *opt,
439+
struct sk_buff *skb);
440+
int ip_options_get(struct net *net, struct ip_options_rcu **optp,
441+
unsigned char *data, int optlen);
442+
int ip_options_get_from_user(struct net *net, struct ip_options_rcu **optp,
443+
unsigned char __user *data, int optlen);
444+
void ip_options_undo(struct ip_options *opt);
445+
void ip_forward_options(struct sk_buff *skb);
446+
int ip_options_rcv_srr(struct sk_buff *skb);
450447

451448
/*
452449
* Functions provided by ip_sockglue.c
453450
*/
454451

455-
extern void ipv4_pktinfo_prepare(struct sk_buff *skb);
456-
extern void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
457-
extern int ip_cmsg_send(struct net *net,
458-
struct msghdr *msg, struct ipcm_cookie *ipc);
459-
extern int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen);
460-
extern int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen);
461-
extern int compat_ip_setsockopt(struct sock *sk, int level,
462-
int optname, char __user *optval, unsigned int optlen);
463-
extern int compat_ip_getsockopt(struct sock *sk, int level,
464-
int optname, char __user *optval, int __user *optlen);
465-
extern int ip_ra_control(struct sock *sk, unsigned char on, void (*destructor)(struct sock *));
466-
467-
extern int ip_recv_error(struct sock *sk, struct msghdr *msg, int len);
468-
extern void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err,
469-
__be16 port, u32 info, u8 *payload);
470-
extern void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
471-
u32 info);
452+
void ipv4_pktinfo_prepare(struct sk_buff *skb);
453+
void ip_cmsg_recv(struct msghdr *msg, struct sk_buff *skb);
454+
int ip_cmsg_send(struct net *net, struct msghdr *msg, struct ipcm_cookie *ipc);
455+
int ip_setsockopt(struct sock *sk, int level, int optname, char __user *optval,
456+
unsigned int optlen);
457+
int ip_getsockopt(struct sock *sk, int level, int optname, char __user *optval,
458+
int __user *optlen);
459+
int compat_ip_setsockopt(struct sock *sk, int level, int optname,
460+
char __user *optval, unsigned int optlen);
461+
int compat_ip_getsockopt(struct sock *sk, int level, int optname,
462+
char __user *optval, int __user *optlen);
463+
int ip_ra_control(struct sock *sk, unsigned char on,
464+
void (*destructor)(struct sock *));
465+
466+
int ip_recv_error(struct sock *sk, struct msghdr *msg, int len);
467+
void ip_icmp_error(struct sock *sk, struct sk_buff *skb, int err, __be16 port,
468+
u32 info, u8 *payload);
469+
void ip_local_error(struct sock *sk, int err, __be32 daddr, __be16 dport,
470+
u32 info);
472471

473472
#ifdef CONFIG_PROC_FS
474-
extern int ip_misc_proc_init(void);
473+
int ip_misc_proc_init(void);
475474
#endif
476475

477476
#endif /* _IP_H */

‎include/net/ip6_fib.h‎

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -267,48 +267,41 @@ typedef struct rt6_info *(*pol_lookup_t)(struct net *,
267267
* exported functions
268268
*/
269269

270-
extern struct fib6_table *fib6_get_table(struct net *net, u32 id);
271-
extern struct fib6_table *fib6_new_table(struct net *net, u32 id);
272-
extern struct dst_entry *fib6_rule_lookup(struct net *net,
273-
struct flowi6 *fl6, int flags,
274-
pol_lookup_t lookup);
270+
struct fib6_table *fib6_get_table(struct net *net, u32 id);
271+
struct fib6_table *fib6_new_table(struct net *net, u32 id);
272+
struct dst_entry *fib6_rule_lookup(struct net *net, struct flowi6 *fl6,
273+
int flags, pol_lookup_t lookup);
275274

276-
extern struct fib6_node *fib6_lookup(struct fib6_node *root,
277-
const struct in6_addr *daddr,
278-
const struct in6_addr *saddr);
275+
struct fib6_node *fib6_lookup(struct fib6_node *root,
276+
const struct in6_addr *daddr,
277+
const struct in6_addr *saddr);
279278

280-
struct fib6_node *fib6_locate(struct fib6_node *root,
281-
const struct in6_addr *daddr, int dst_len,
282-
const struct in6_addr *saddr, int src_len);
279+
struct fib6_node *fib6_locate(struct fib6_node *root,
280+
const struct in6_addr *daddr, int dst_len,
281+
const struct in6_addr *saddr, int src_len);
283282

284-
extern void fib6_clean_all_ro(struct net *net,
285-
int (*func)(struct rt6_info *, void *arg),
286-
int prune, void *arg);
283+
void fib6_clean_all_ro(struct net *net,
284+
int (*func)(struct rt6_info *, void *arg),
285+
int prune, void *arg);
287286

288-
extern void fib6_clean_all(struct net *net,
289-
int (*func)(struct rt6_info *, void *arg),
290-
int prune, void *arg);
287+
void fib6_clean_all(struct net *net, int (*func)(struct rt6_info *, void *arg),
288+
int prune, void *arg);
291289

292-
extern int fib6_add(struct fib6_node *root,
293-
struct rt6_info *rt,
294-
struct nl_info *info);
290+
int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info);
295291

296-
extern int fib6_del(struct rt6_info *rt,
297-
struct nl_info *info);
292+
int fib6_del(struct rt6_info *rt, struct nl_info *info);
298293

299-
extern void inet6_rt_notify(int event, struct rt6_info *rt,
300-
struct nl_info *info);
294+
void inet6_rt_notify(int event, struct rt6_info *rt, struct nl_info *info);
301295

302-
extern void fib6_run_gc(unsigned long expires,
303-
struct net *net, bool force);
296+
void fib6_run_gc(unsigned long expires, struct net *net, bool force);
304297

305-
extern void fib6_gc_cleanup(void);
298+
void fib6_gc_cleanup(void);
306299

307-
extern int fib6_init(void);
300+
int fib6_init(void);
308301

309302
#ifdef CONFIG_IPV6_MULTIPLE_TABLES
310-
extern int fib6_rules_init(void);
311-
extern void fib6_rules_cleanup(void);
303+
int fib6_rules_init(void);
304+
void fib6_rules_cleanup(void);
312305
#else
313306
static inline int fib6_rules_init(void)
314307
{

0 commit comments

Comments
 (0)