Skip to content

Commit

Permalink
Extern declarations in C files loses compile-time checking that
Browse files Browse the repository at this point in the history
the functions' calls match their definitions. Move them to header files.

Reviewed by:	jilles (previous version)
  • Loading branch information
bu7cher committed Dec 25, 2014
1 parent 92a41d3 commit a514061
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 38 deletions.
10 changes: 0 additions & 10 deletions sys/net/if_gif.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,6 @@ void (*ng_gif_input_orphan_p)(struct ifnet *ifp, struct mbuf *m, int af);
void (*ng_gif_attach_p)(struct ifnet *ifp);
void (*ng_gif_detach_p)(struct ifnet *ifp);

#ifdef INET
extern int in_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
extern int in_gif_encapcheck(const struct mbuf *, int, int, void *);
extern int in_gif_attach(struct gif_softc *);
#endif
#ifdef INET6
extern int in6_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
extern int in6_gif_encapcheck(const struct mbuf *, int, int, void *);
extern int in6_gif_attach(struct gif_softc *);
#endif
static int gif_set_tunnel(struct ifnet *, struct sockaddr *,
struct sockaddr *);
static void gif_delete_tunnel(struct ifnet *);
Expand Down
10 changes: 10 additions & 0 deletions sys/net/if_gif.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ void gif_input(struct mbuf *, struct ifnet *, int, uint8_t);
int gif_output(struct ifnet *, struct mbuf *, const struct sockaddr *,
struct route *);
int gif_encapcheck(const struct mbuf *, int, int, void *);
#ifdef INET
int in_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
int in_gif_encapcheck(const struct mbuf *, int, int, void *);
int in_gif_attach(struct gif_softc *);
#endif
#ifdef INET6
int in6_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
int in6_gif_encapcheck(const struct mbuf *, int, int, void *);
int in6_gif_attach(struct gif_softc *);
#endif
#endif /* _KERNEL */

#define GIFGOPTS _IOWR('i', 150, struct ifreq)
Expand Down
10 changes: 0 additions & 10 deletions sys/net/if_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,6 @@ static int gre_set_tunnel(struct ifnet *, struct sockaddr *,
struct sockaddr *);
static void gre_delete_tunnel(struct ifnet *);

int gre_input(struct mbuf **, int *, int);
#ifdef INET
extern int in_gre_attach(struct gre_softc *);
extern int in_gre_output(struct mbuf *, int, int);
#endif
#ifdef INET6
extern int in6_gre_attach(struct gre_softc *);
extern int in6_gre_output(struct mbuf *, int, int);
#endif

SYSCTL_DECL(_net_link);
static SYSCTL_NODE(_net_link, IFT_TUNNEL, gre, CTLFLAG_RW, 0,
"Generic Routing Encapsulation");
Expand Down
9 changes: 9 additions & 0 deletions sys/net/if_gre.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@ struct gre_softc {
#define gre_oip gre_gihdr->gi_ip
#define gre_oip6 gre_gi6hdr->gi6_ip6

int gre_input(struct mbuf **, int *, int);
#ifdef INET
int in_gre_attach(struct gre_softc *);
int in_gre_output(struct mbuf *, int, int);
#endif
#ifdef INET6
int in6_gre_attach(struct gre_softc *);
int in6_gre_output(struct mbuf *, int, int);
#endif
/*
* CISCO uses special type for GRE tunnel created as part of WCCP
* connection, while in fact those packets are just IPv4 encapsulated
Expand Down
4 changes: 0 additions & 4 deletions sys/netinet/in_gif.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ __FBSDID("$FreeBSD$");

#include <net/if_gif.h>

int in_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
int in_gif_encapcheck(const struct mbuf *, int, int, void *);
int in_gif_attach(struct gif_softc *);

static int gif_validate4(const struct ip *, struct gif_softc *,
struct ifnet *);
static int in_gif_input(struct mbuf **, int *, int);
Expand Down
5 changes: 0 additions & 5 deletions sys/netinet/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,6 @@ __FBSDID("$FreeBSD$");
#include <net/if_gre.h>

extern struct domain inetdomain;
extern int gre_input(struct mbuf **, int *, int);

int in_gre_attach(struct gre_softc *);
int in_gre_output(struct mbuf *, int, int);

static const struct protosw in_gre_protosw = {
.pr_type = SOCK_RAW,
.pr_domain = &inetdomain,
Expand Down
4 changes: 0 additions & 4 deletions sys/netinet6/in6_gif.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,6 @@ SYSCTL_DECL(_net_inet6_ip6);
SYSCTL_INT(_net_inet6_ip6, IPV6CTL_GIF_HLIM, gifhlim, CTLFLAG_VNET | CTLFLAG_RW,
&VNET_NAME(ip6_gif_hlim), 0, "");

int in6_gif_output(struct ifnet *, struct mbuf *, int, uint8_t);
int in6_gif_encapcheck(const struct mbuf *, int, int, void *);
int in6_gif_attach(struct gif_softc *);

static int gif_validate6(const struct ip6_hdr *, struct gif_softc *,
struct ifnet *);
static int in6_gif_input(struct mbuf **, int *, int);
Expand Down
5 changes: 0 additions & 5 deletions sys/netinet6/ip6_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ __FBSDID("$FreeBSD$");
#include <net/if_gre.h>

extern struct domain inet6domain;
extern int gre_input(struct mbuf **, int *, int);

int in6_gre_attach(struct gre_softc *);
int in6_gre_output(struct mbuf *, int, int);

struct protosw in6_gre_protosw = {
.pr_type = SOCK_RAW,
.pr_domain = &inet6domain,
Expand Down

0 comments on commit a514061

Please sign in to comment.