Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet Make local functions/variables static



details:   https://anonhg.NetBSD.org/src/rev/96ee4224742c
branches:  trunk
changeset: 797845:96ee4224742c
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Thu Jul 31 00:56:23 2014 +0000

description:
Make local functions/variables static

No functional change.

diffstat:

 sys/netinet/ip_carp.c |  145 +++++++++++++++++++++++++------------------------
 1 files changed, 75 insertions(+), 70 deletions(-)

diffs (truncated from 397 to 300 lines):

diff -r 15b2d520fa98 -r 96ee4224742c sys/netinet/ip_carp.c
--- a/sys/netinet/ip_carp.c     Wed Jul 30 23:56:01 2014 +0000
+++ b/sys/netinet/ip_carp.c     Thu Jul 31 00:56:23 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_carp.c,v 1.57 2014/06/06 01:02:47 rmind Exp $       */
+/*     $NetBSD: ip_carp.c,v 1.58 2014/07/31 00:56:23 ozaki-r Exp $     */
 /*     $OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $   */
 
 /*
@@ -31,7 +31,7 @@
 #include "opt_mbuftrace.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.57 2014/06/06 01:02:47 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_carp.c,v 1.58 2014/07/31 00:56:23 ozaki-r Exp $");
 
 /*
  * TODO:
@@ -153,8 +153,8 @@
        LIST_HEAD(__carp_mchead, carp_mc_entry) carp_mc_listhead;
 };
 
-int carp_suppress_preempt = 0;
-int carp_opts[CARPCTL_MAXID] = { 0, 1, 0, 0, 0 };      /* XXX for now */
+static int carp_suppress_preempt = 0;
+static int carp_opts[CARPCTL_MAXID] = { 0, 1, 0, 0, 0 };       /* XXX for now */
 
 static percpu_t *carpstat_percpu;
 
@@ -185,47 +185,50 @@
                addlog("\n");                                           \
        }
 
-void   carp_hmac_prepare(struct carp_softc *);
-void   carp_hmac_generate(struct carp_softc *, u_int32_t *,
-           unsigned char *);
-int    carp_hmac_verify(struct carp_softc *, u_int32_t *,
-           unsigned char *);
-void   carp_setroute(struct carp_softc *, int);
-void   carp_proto_input_c(struct mbuf *, struct carp_header *, sa_family_t);
+static void    carp_hmac_prepare(struct carp_softc *);
+static void    carp_hmac_generate(struct carp_softc *, u_int32_t *,
+                   unsigned char *);
+static int     carp_hmac_verify(struct carp_softc *, u_int32_t *,
+                   unsigned char *);
+static void    carp_setroute(struct carp_softc *, int);
+static void    carp_proto_input_c(struct mbuf *, struct carp_header *,
+                   sa_family_t);
 void   carpattach(int);
-void   carpdetach(struct carp_softc *);
-int    carp_prepare_ad(struct mbuf *, struct carp_softc *,
-           struct carp_header *);
-void   carp_send_ad_all(void);
-void   carp_send_ad(void *);
-void   carp_send_arp(struct carp_softc *);
-void   carp_master_down(void *);
-int    carp_ioctl(struct ifnet *, u_long, void *);
-void   carp_start(struct ifnet *);
-void   carp_setrun(struct carp_softc *, sa_family_t);
-void   carp_set_state(struct carp_softc *, int);
-int    carp_addrcount(struct carp_if *, struct in_ifaddr *, int);
+static void    carpdetach(struct carp_softc *);
+static int     carp_prepare_ad(struct mbuf *, struct carp_softc *,
+                   struct carp_header *);
+static void    carp_send_ad_all(void);
+static void    carp_send_ad(void *);
+static void    carp_send_arp(struct carp_softc *);
+static void    carp_master_down(void *);
+static int     carp_ioctl(struct ifnet *, u_long, void *);
+static void    carp_start(struct ifnet *);
+static void    carp_setrun(struct carp_softc *, sa_family_t);
+static void    carp_set_state(struct carp_softc *, int);
+static int     carp_addrcount(struct carp_if *, struct in_ifaddr *, int);
 enum   { CARP_COUNT_MASTER, CARP_COUNT_RUNNING };
 
-void   carp_multicast_cleanup(struct carp_softc *);
-int    carp_set_ifp(struct carp_softc *, struct ifnet *);
-void   carp_set_enaddr(struct carp_softc *);
-void   carp_addr_updated(void *);
-u_int32_t      carp_hash(struct carp_softc *, u_char *);
-int    carp_set_addr(struct carp_softc *, struct sockaddr_in *);
-int    carp_join_multicast(struct carp_softc *);
+static void    carp_multicast_cleanup(struct carp_softc *);
+static int     carp_set_ifp(struct carp_softc *, struct ifnet *);
+static void    carp_set_enaddr(struct carp_softc *);
+#if 0
+static void    carp_addr_updated(void *);
+#endif
+static u_int32_t       carp_hash(struct carp_softc *, u_char *);
+static int     carp_set_addr(struct carp_softc *, struct sockaddr_in *);
+static int     carp_join_multicast(struct carp_softc *);
 #ifdef INET6
-void   carp_send_na(struct carp_softc *);
-int    carp_set_addr6(struct carp_softc *, struct sockaddr_in6 *);
-int    carp_join_multicast6(struct carp_softc *);
+static void    carp_send_na(struct carp_softc *);
+static int     carp_set_addr6(struct carp_softc *, struct sockaddr_in6 *);
+static int     carp_join_multicast6(struct carp_softc *);
 #endif
-int    carp_clone_create(struct if_clone *, int);
-int    carp_clone_destroy(struct ifnet *);
-int    carp_ether_addmulti(struct carp_softc *, struct ifreq *);
-int    carp_ether_delmulti(struct carp_softc *, struct ifreq *);
-void   carp_ether_purgemulti(struct carp_softc *);
+static int     carp_clone_create(struct if_clone *, int);
+static int     carp_clone_destroy(struct ifnet *);
+static int     carp_ether_addmulti(struct carp_softc *, struct ifreq *);
+static int     carp_ether_delmulti(struct carp_softc *, struct ifreq *);
+static void    carp_ether_purgemulti(struct carp_softc *);
 
-static void sysctl_net_inet_carp_setup(struct sysctllog **);
+static void    sysctl_net_inet_carp_setup(struct sysctllog **);
 
 struct if_clone carp_cloner =
     IF_CLONE_INITIALIZER("carp", carp_clone_create, carp_clone_destroy);
@@ -236,7 +239,7 @@
        return (in_cksum(m, len));
 }
 
-void
+static void
 carp_hmac_prepare(struct carp_softc *sc)
 {
        u_int8_t carp_version = CARP_VERSION, type = CARP_ADVERTISEMENT;
@@ -319,7 +322,7 @@
                sc->sc_pad[i] ^= 0x36 ^ 0x5c;
 }
 
-void
+static void
 carp_hmac_generate(struct carp_softc *sc, u_int32_t counter[2],
     unsigned char md[20])
 {
@@ -338,7 +341,7 @@
        SHA1Final(md, &sha1ctx);
 }
 
-int
+static int
 carp_hmac_verify(struct carp_softc *sc, u_int32_t counter[2],
     unsigned char md[20])
 {
@@ -349,7 +352,7 @@
        return (memcmp(md, md2, sizeof(md2)));
 }
 
-void
+static void
 carp_setroute(struct carp_softc *sc, int cmd)
 {
        struct ifaddr *ifa;
@@ -595,7 +598,7 @@
 }
 #endif /* INET6 */
 
-void
+static void
 carp_proto_input_c(struct mbuf *m, struct carp_header *ch, sa_family_t af)
 {
        struct carp_softc *sc;
@@ -762,7 +765,7 @@
        carpstat_percpu = percpu_alloc(sizeof(uint64_t) * CARP_NSTATS);
 }
 
-int
+static int
 carp_clone_create(struct if_clone *ifc, int unit)
 {
        extern int ifqmaxlen;
@@ -829,7 +832,7 @@
        return (0);
 }
 
-int
+static int
 carp_clone_destroy(struct ifnet *ifp)
 {
        struct carp_softc *sc = ifp->if_softc;
@@ -845,7 +848,7 @@
        return (0);
 }
 
-void
+static void
 carpdetach(struct carp_softc *sc)
 {
        struct carp_if *cif;
@@ -898,7 +901,7 @@
        }
 }
 
-int
+static int
 carp_prepare_ad(struct mbuf *m, struct carp_softc *sc,
     struct carp_header *ch)
 {
@@ -916,7 +919,7 @@
        return (0);
 }
 
-void
+static void
 carp_send_ad_all(void)
 {
        struct ifnet *ifp;
@@ -937,7 +940,7 @@
 }
 
 
-void
+static void
 carp_send_ad(void *v)
 {
        struct carp_header ch;
@@ -1162,7 +1165,7 @@
  * the virtual router MAC address for each IP address
  * associated with the virtual router.
  */
-void
+static void
 carp_send_arp(struct carp_softc *sc)
 {
        struct ifaddr *ifa;
@@ -1184,7 +1187,7 @@
 }
 
 #ifdef INET6
-void
+static void
 carp_send_na(struct carp_softc *sc)
 {
        struct ifaddr *ifa;
@@ -1225,7 +1228,7 @@
                c -= a; c -= b; c ^= (b >> 15);         \
        } while (0)
 
-u_int32_t
+static u_int32_t
 carp_hash(struct carp_softc *sc, u_char *src)
 {
        u_int32_t a = 0x9e3779b9, b = sc->sc_hashkey[0], c = sc->sc_hashkey[1];
@@ -1245,7 +1248,7 @@
        return (c);
 }
 
-int
+static int
 carp_addrcount(struct carp_if *cif, struct in_ifaddr *ia, int type)
 {
        struct carp_softc *vh;
@@ -1406,7 +1409,7 @@
        return (0);
 }
 
-void
+static void
 carp_master_down(void *v)
 {
        struct carp_softc *sc = v;
@@ -1436,7 +1439,7 @@
  * When in backup state, af indicates whether to reset the master down timer
  * for v4 or v6. If it's set to zero, reset the ones which are already pending.
  */
-void
+static void
 carp_setrun(struct carp_softc *sc, sa_family_t af)
 {
        struct timeval tv;
@@ -1493,7 +1496,7 @@
        }
 }
 
-void
+static void
 carp_multicast_cleanup(struct carp_softc *sc)
 {
        struct ip_moptions *imo = &sc->sc_imo;
@@ -1527,7 +1530,7 @@
        carp_ether_purgemulti(sc);
 }
 
-int
+static int
 carp_set_ifp(struct carp_softc *sc, struct ifnet *ifp)
 {
        struct carp_if *cif, *ncif = NULL;
@@ -1631,7 +1634,7 @@
        return (0);
 }
 
-void
+static void
 carp_set_enaddr(struct carp_softc *sc)
 {
        uint8_t enaddr[ETHER_ADDR_LEN];
@@ -1653,7 +1656,8 @@
        if_set_sadl(&sc->sc_if, enaddr, sizeof(enaddr), false);
 }
 
-void



Home | Main Index | Thread Index | Old Index