Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Make some functions static
details: https://anonhg.NetBSD.org/src/rev/430a317b6dfc
branches: trunk
changeset: 337839:430a317b6dfc
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Thu Apr 30 09:57:38 2015 +0000
description:
Make some functions static
- rtflushall
- rtcache_clear
- rtcache_invalidate
And pull these static inline functions in route.c
- rt_destroy
- rt_setkey
diffstat:
sys/net/route.c | 40 +++++++++++++++++++++++++++++++++++-----
sys/net/route.h | 32 +-------------------------------
2 files changed, 36 insertions(+), 36 deletions(-)
diffs (159 lines):
diff -r 6de87ff13e9d -r 430a317b6dfc sys/net/route.c
--- a/sys/net/route.c Thu Apr 30 06:37:26 2015 +0000
+++ b/sys/net/route.c Thu Apr 30 09:57:38 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.c,v 1.143 2015/04/28 02:56:58 ozaki-r Exp $ */
+/* $NetBSD: route.c,v 1.144 2015/04/30 09:57:38 ozaki-r Exp $ */
/*-
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -94,7 +94,7 @@
#include "opt_route.h"
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.143 2015/04/28 02:56:58 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.144 2015/04/30 09:57:38 ozaki-r Exp $");
#include <sys/param.h>
#ifdef RTFLUSH_DEBUG
@@ -144,10 +144,14 @@
static int rtdeletemsg(struct rtentry *);
static int rtflushclone1(struct rtentry *, void *);
static void rtflushclone(sa_family_t family, struct rtentry *);
+static void rtflushall(int);
static void rt_maskedcopy(const struct sockaddr *,
struct sockaddr *, const struct sockaddr *);
+static void rtcache_clear(struct route *);
+static void rtcache_invalidate(struct dom_rtlist *);
+
#ifdef RTFLUSH_DEBUG
static void sysctl_net_rtcache_setup(struct sysctllog **);
static void
@@ -168,6 +172,32 @@
}
#endif /* RTFLUSH_DEBUG */
+static inline void
+rt_destroy(struct rtentry *rt)
+{
+ if (rt->_rt_key != NULL)
+ sockaddr_free(rt->_rt_key);
+ if (rt->rt_gateway != NULL)
+ sockaddr_free(rt->rt_gateway);
+ if (rt_gettag(rt) != NULL)
+ sockaddr_free(rt_gettag(rt));
+ rt->_rt_key = rt->rt_gateway = rt->rt_tag = NULL;
+}
+
+static inline const struct sockaddr *
+rt_setkey(struct rtentry *rt, const struct sockaddr *key, int flags)
+{
+ if (rt->_rt_key == key)
+ goto out;
+
+ if (rt->_rt_key != NULL)
+ sockaddr_free(rt->_rt_key);
+ rt->_rt_key = sockaddr_dup(key, flags);
+out:
+ rt->rt_nodes->rn_key = (const char *)rt->_rt_key;
+ return rt->_rt_key;
+}
+
struct ifaddr *
rt_get_ifa(struct rtentry *rt)
{
@@ -291,7 +321,7 @@
route_listener_cb, NULL);
}
-void
+static void
rtflushall(int family)
{
struct domain *dom;
@@ -1385,7 +1415,7 @@
static struct dom_rtlist invalid_routes = LIST_HEAD_INITIALIZER(dom_rtlist);
-void
+static void
rtcache_invalidate(struct dom_rtlist *rtlist)
{
struct route *ro;
@@ -1400,7 +1430,7 @@
}
}
-void
+static void
rtcache_clear(struct route *ro)
{
rtcache_invariants(ro);
diff -r 6de87ff13e9d -r 430a317b6dfc sys/net/route.h
--- a/sys/net/route.h Thu Apr 30 06:37:26 2015 +0000
+++ b/sys/net/route.h Thu Apr 30 09:57:38 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: route.h,v 1.90 2015/04/06 09:45:58 ozaki-r Exp $ */
+/* $NetBSD: route.h,v 1.91 2015/04/30 09:57:38 ozaki-r Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -358,7 +358,6 @@
extern struct rtstat rtstat;
struct socket;
-struct dom_rtlist;
void rt_init(void);
@@ -379,7 +378,6 @@
void rt_newmsg(int, struct rtentry *);
struct rtentry *
rtalloc1(const struct sockaddr *, int);
-void rtflushall(int);
void rtfree(struct rtentry *);
int rtinit(struct ifaddr *, int, int);
void rtredirect(const struct sockaddr *, const struct sockaddr *,
@@ -403,40 +401,12 @@
struct sockaddr *
rt_gettag(struct rtentry *);
-static inline void
-rt_destroy(struct rtentry *rt)
-{
- if (rt->_rt_key != NULL)
- sockaddr_free(rt->_rt_key);
- if (rt->rt_gateway != NULL)
- sockaddr_free(rt->rt_gateway);
- if (rt_gettag(rt) != NULL)
- sockaddr_free(rt_gettag(rt));
- rt->_rt_key = rt->rt_gateway = rt->rt_tag = NULL;
-}
-
-static inline const struct sockaddr *
-rt_setkey(struct rtentry *rt, const struct sockaddr *key, int flags)
-{
- if (rt->_rt_key == key)
- goto out;
-
- if (rt->_rt_key != NULL)
- sockaddr_free(rt->_rt_key);
- rt->_rt_key = sockaddr_dup(key, flags);
-out:
- rt->rt_nodes->rn_key = (const char *)rt->_rt_key;
- return rt->_rt_key;
-}
-
-void rtcache_clear(struct route *);
void rtcache_copy(struct route *, const struct route *);
void rtcache_free(struct route *);
struct rtentry *
rtcache_init(struct route *);
struct rtentry *
rtcache_init_noclone(struct route *);
-void rtcache_invalidate(struct dom_rtlist *);
struct rtentry *
rtcache_lookup2(struct route *, const struct sockaddr *, int,
int *);
Home |
Main Index |
Thread Index |
Old Index