From owner-svn-src-projects@freebsd.org Sun Aug 23 18:26:02 2015 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 77BA29C19E5 for ; Sun, 23 Aug 2015 18:26:02 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 670FC1366; Sun, 23 Aug 2015 18:26:02 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id t7NIQ2DE047148; Sun, 23 Aug 2015 18:26:02 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id t7NIPsmT047111; Sun, 23 Aug 2015 18:25:54 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <201508231825.t7NIPsmT047111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 23 Aug 2015 18:25:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r287062 - in projects/routing/sys: fs/nfs net netgraph/netflow netinet netinet6 netpfil/ipfw X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Aug 2015 18:26:02 -0000 Author: melifaro Date: Sun Aug 23 18:25:53 2015 New Revision: 287062 URL: https://svnweb.freebsd.org/changeset/base/287062 Log: Hide 'struct rtentry' and all its macro inside new header: net/route_internal.h The goal is to make its opaque for all code except route/rtsock and proto domain _rmx. Modified: projects/routing/sys/fs/nfs/nfsport.h projects/routing/sys/net/if.c projects/routing/sys/net/if_disc.c projects/routing/sys/net/if_loop.c projects/routing/sys/net/if_stf.c projects/routing/sys/net/radix_mpath.c projects/routing/sys/net/route.c projects/routing/sys/net/route.h projects/routing/sys/net/rt_nhops.c projects/routing/sys/net/rtsock.c projects/routing/sys/netgraph/netflow/netflow.c projects/routing/sys/netinet/if_ether.c projects/routing/sys/netinet/in.c projects/routing/sys/netinet/in_gif.c projects/routing/sys/netinet/in_rmx.c projects/routing/sys/netinet/sctp_os_bsd.h projects/routing/sys/netinet6/icmp6.c projects/routing/sys/netinet6/in6.c projects/routing/sys/netinet6/in6_gif.c projects/routing/sys/netinet6/in6_ifattach.c projects/routing/sys/netinet6/in6_rmx.c projects/routing/sys/netinet6/ip6_forward.c projects/routing/sys/netinet6/ip6_input.c projects/routing/sys/netinet6/nd6.c projects/routing/sys/netinet6/nd6_nbr.c projects/routing/sys/netinet6/nd6_rtr.c projects/routing/sys/netpfil/ipfw/ip_fw_table_algo.c Modified: projects/routing/sys/fs/nfs/nfsport.h ============================================================================== --- projects/routing/sys/fs/nfs/nfsport.h Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/fs/nfs/nfsport.h Sun Aug 23 18:25:53 2015 (r287062) @@ -82,6 +82,7 @@ #include #include #include +#include #include #include #include Modified: projects/routing/sys/net/if.c ============================================================================== --- projects/routing/sys/net/if.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/net/if.c Sun Aug 23 18:25:53 2015 (r287062) @@ -75,6 +75,7 @@ #include #include #include +#include #include #if defined(INET) || defined(INET6) Modified: projects/routing/sys/net/if_disc.c ============================================================================== --- projects/routing/sys/net/if_disc.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/net/if_disc.c Sun Aug 23 18:25:53 2015 (r287062) @@ -49,6 +49,7 @@ #include #include #include +#include #include #include Modified: projects/routing/sys/net/if_loop.c ============================================================================== --- projects/routing/sys/net/if_loop.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/net/if_loop.c Sun Aug 23 18:25:53 2015 (r287062) @@ -54,6 +54,7 @@ #include #include #include +#include #include #include Modified: projects/routing/sys/net/if_stf.c ============================================================================== --- projects/routing/sys/net/if_stf.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/net/if_stf.c Sun Aug 23 18:25:53 2015 (r287062) @@ -96,6 +96,7 @@ #include #include #include +#include #include #include #include Modified: projects/routing/sys/net/radix_mpath.c ============================================================================== --- projects/routing/sys/net/radix_mpath.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/net/radix_mpath.c Sun Aug 23 18:25:53 2015 (r287062) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/net/route.c ============================================================================== --- projects/routing/sys/net/route.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/net/route.c Sun Aug 23 18:25:53 2015 (r287062) @@ -57,6 +57,7 @@ #include #include #include +#include #include #include Modified: projects/routing/sys/net/route.h ============================================================================== --- projects/routing/sys/net/route.h Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/net/route.h Sun Aug 23 18:25:53 2015 (r287062) @@ -107,7 +107,9 @@ VNET_DECLARE(u_int, rt_add_addr_allfibs) #endif #endif -#if defined(_KERNEL) || defined(_WANT_RTENTRY) +struct rtentry; +#if !defined(_KERNEL) || defined(_WANT_RTENTRY) +/* This structure is kept for compatibility reasons only */ struct rtentry { struct radix_node rt_nodes[2]; /* tree glue, and other values */ /* @@ -126,11 +128,10 @@ struct rtentry { u_long rt_mtu; /* MTU for this path */ u_long rt_weight; /* absolute weight */ u_long rt_expire; /* lifetime for route, e.g. redirect */ -#define rt_endzero rt_pksent - counter_u64_t rt_pksent; /* packets sent using this route */ +#define rt_endzero rt_mtx struct mtx rt_mtx; /* mutex for routing entry */ }; -#endif /* _KERNEL || _WANT_RTENTRY */ +#endif /* !_KERNEL || _WANT_RTENTRY */ #define RTF_UP 0x1 /* route usable */ #define RTF_GATEWAY 0x2 /* destination is a gateway */ @@ -291,59 +292,6 @@ struct rt_addrinfo { #define RT_LINK_IS_UP(ifp) (!((ifp)->if_capabilities & IFCAP_LINKSTATE) \ || (ifp)->if_link_state == LINK_STATE_UP) -#define RT_LOCK_INIT(_rt) \ - mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK) -#define RT_LOCK(_rt) mtx_lock(&(_rt)->rt_mtx) -#define RT_UNLOCK(_rt) mtx_unlock(&(_rt)->rt_mtx) -#define RT_LOCK_DESTROY(_rt) mtx_destroy(&(_rt)->rt_mtx) -#define RT_LOCK_ASSERT(_rt) mtx_assert(&(_rt)->rt_mtx, MA_OWNED) -#define RT_UNLOCK_COND(_rt) do { \ - if (mtx_owned(&(_rt)->rt_mtx)) \ - mtx_unlock(&(_rt)->rt_mtx); \ -} while (0) - -#define RT_ADDREF(_rt) do { \ - RT_LOCK_ASSERT(_rt); \ - KASSERT((_rt)->rt_refcnt >= 0, \ - ("negative refcnt %d", (_rt)->rt_refcnt)); \ - (_rt)->rt_refcnt++; \ -} while (0) - -#define RT_REMREF(_rt) do { \ - RT_LOCK_ASSERT(_rt); \ - KASSERT((_rt)->rt_refcnt > 0, \ - ("bogus refcnt %d", (_rt)->rt_refcnt)); \ - (_rt)->rt_refcnt--; \ -} while (0) - -#define RTFREE_LOCKED(_rt) do { \ - if ((_rt)->rt_refcnt <= 1) \ - rtfree(_rt); \ - else { \ - RT_REMREF(_rt); \ - RT_UNLOCK(_rt); \ - } \ - /* guard against invalid refs */ \ - _rt = 0; \ -} while (0) - -#define RTFREE(_rt) do { \ - RT_LOCK(_rt); \ - RTFREE_LOCKED(_rt); \ -} while (0) - -#define RO_RTFREE(_ro) do { \ - if ((_ro)->ro_rt) { \ - if ((_ro)->ro_flags & RT_NORTREF) { \ - (_ro)->ro_flags &= ~RT_NORTREF; \ - (_ro)->ro_rt = NULL; \ - } else { \ - RT_LOCK((_ro)->ro_rt); \ - RTFREE_LOCKED((_ro)->ro_rt); \ - } \ - } \ -} while (0) - struct radix_node_head *rt_tables_get_rnh(int, int); struct ifmultiaddr; Modified: projects/routing/sys/net/rt_nhops.c ============================================================================== --- projects/routing/sys/net/rt_nhops.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/net/rt_nhops.c Sun Aug 23 18:25:53 2015 (r287062) @@ -55,6 +55,7 @@ #include #include #include +#include #include #ifdef RADIX_MPATH Modified: projects/routing/sys/net/rtsock.c ============================================================================== --- projects/routing/sys/net/rtsock.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/net/rtsock.c Sun Aug 23 18:25:53 2015 (r287062) @@ -59,6 +59,7 @@ #include #include #include +#include #include #include Modified: projects/routing/sys/netgraph/netflow/netflow.c ============================================================================== --- projects/routing/sys/netgraph/netflow/netflow.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netgraph/netflow/netflow.c Sun Aug 23 18:25:53 2015 (r287062) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: projects/routing/sys/netinet/if_ether.c ============================================================================== --- projects/routing/sys/netinet/if_ether.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet/if_ether.c Sun Aug 23 18:25:53 2015 (r287062) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netinet/in.c ============================================================================== --- projects/routing/sys/netinet/in.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet/in.c Sun Aug 23 18:25:53 2015 (r287062) @@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netinet/in_gif.c ============================================================================== --- projects/routing/sys/netinet/in_gif.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet/in_gif.c Sun Aug 23 18:25:53 2015 (r287062) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netinet/in_rmx.c ============================================================================== --- projects/routing/sys/netinet/in_rmx.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet/in_rmx.c Sun Aug 23 18:25:53 2015 (r287062) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netinet/sctp_os_bsd.h ============================================================================== --- projects/routing/sys/netinet/sctp_os_bsd.h Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet/sctp_os_bsd.h Sun Aug 23 18:25:53 2015 (r287062) @@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netinet6/icmp6.c ============================================================================== --- projects/routing/sys/netinet6/icmp6.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet6/icmp6.c Sun Aug 23 18:25:53 2015 (r287062) @@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netinet6/in6.c ============================================================================== --- projects/routing/sys/netinet6/in6.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet6/in6.c Sun Aug 23 18:25:53 2015 (r287062) @@ -88,6 +88,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netinet6/in6_gif.c ============================================================================== --- projects/routing/sys/netinet6/in6_gif.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet6/in6_gif.c Sun Aug 23 18:25:53 2015 (r287062) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netinet6/in6_ifattach.c ============================================================================== --- projects/routing/sys/netinet6/in6_ifattach.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet6/in6_ifattach.c Sun Aug 23 18:25:53 2015 (r287062) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netinet6/in6_rmx.c ============================================================================== --- projects/routing/sys/netinet6/in6_rmx.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet6/in6_rmx.c Sun Aug 23 18:25:53 2015 (r287062) @@ -77,6 +77,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netinet6/ip6_forward.c ============================================================================== --- projects/routing/sys/netinet6/ip6_forward.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet6/ip6_forward.c Sun Aug 23 18:25:53 2015 (r287062) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netinet6/ip6_input.c ============================================================================== --- projects/routing/sys/netinet6/ip6_input.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet6/ip6_input.c Sun Aug 23 18:25:53 2015 (r287062) @@ -91,6 +91,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include Modified: projects/routing/sys/netinet6/nd6.c ============================================================================== --- projects/routing/sys/netinet6/nd6.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet6/nd6.c Sun Aug 23 18:25:53 2015 (r287062) @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netinet6/nd6_nbr.c ============================================================================== --- projects/routing/sys/netinet6/nd6_nbr.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet6/nd6_nbr.c Sun Aug 23 18:25:53 2015 (r287062) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef RADIX_MPATH #include #endif Modified: projects/routing/sys/netinet6/nd6_rtr.c ============================================================================== --- projects/routing/sys/netinet6/nd6_rtr.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netinet6/nd6_rtr.c Sun Aug 23 18:25:53 2015 (r287062) @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include Modified: projects/routing/sys/netpfil/ipfw/ip_fw_table_algo.c ============================================================================== --- projects/routing/sys/netpfil/ipfw/ip_fw_table_algo.c Sun Aug 23 18:24:55 2015 (r287061) +++ projects/routing/sys/netpfil/ipfw/ip_fw_table_algo.c Sun Aug 23 18:25:53 2015 (r287062) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include /* ip_fw.h requires IFNAMSIZ */ #include #include +#include #include #include /* struct ipfw_rule_ref */