route.h (121770) | route.h (122334) |
---|---|
1/* 2 * Copyright (c) 1980, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)route.h 8.4 (Berkeley) 1/9/95 | 1/* 2 * Copyright (c) 1980, 1986, 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 17 unchanged lines hidden (view full) --- 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)route.h 8.4 (Berkeley) 1/9/95 |
34 * $FreeBSD: head/sys/net/route.h 121770 2003-10-30 23:02:51Z sam $ | 34 * $FreeBSD: head/sys/net/route.h 122334 2003-11-08 23:36:32Z sam $ |
35 */ 36 37#ifndef _NET_ROUTE_H_ 38#define _NET_ROUTE_H_ 39 40/* 41 * Kernel resident routing tables. 42 * --- 218 unchanged lines hidden (view full) --- 261 262#define RT_LOCK_INIT(_rt) \ 263 mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK) 264#define RT_LOCK(_rt) mtx_lock(&(_rt)->rt_mtx) 265#define RT_UNLOCK(_rt) mtx_unlock(&(_rt)->rt_mtx) 266#define RT_LOCK_DESTROY(_rt) mtx_destroy(&(_rt)->rt_mtx) 267#define RT_LOCK_ASSERT(_rt) mtx_assert(&(_rt)->rt_mtx, MA_OWNED) 268 | 35 */ 36 37#ifndef _NET_ROUTE_H_ 38#define _NET_ROUTE_H_ 39 40/* 41 * Kernel resident routing tables. 42 * --- 218 unchanged lines hidden (view full) --- 261 262#define RT_LOCK_INIT(_rt) \ 263 mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK) 264#define RT_LOCK(_rt) mtx_lock(&(_rt)->rt_mtx) 265#define RT_UNLOCK(_rt) mtx_unlock(&(_rt)->rt_mtx) 266#define RT_LOCK_DESTROY(_rt) mtx_destroy(&(_rt)->rt_mtx) 267#define RT_LOCK_ASSERT(_rt) mtx_assert(&(_rt)->rt_mtx, MA_OWNED) 268 |
269#define RTFREE_LOCKED(_rt) do { \ 270 if ((_rt)->rt_refcnt <= 1) \ 271 rtfree(_rt); \ 272 else { \ 273 (_rt)->rt_refcnt--; \ 274 RT_UNLOCK(_rt); \ 275 } \ 276 /* guard against invalid refs */ \ 277 _rt = 0; \ | 269#define RT_ADDREF(_rt) do { \ 270 RT_LOCK_ASSERT(_rt); \ 271 KASSERT((_rt)->rt_refcnt >= 0, \ 272 ("negative refcnt %ld", (_rt)->rt_refcnt)); \ 273 (_rt)->rt_refcnt++; \ 274} while (0); 275#define RT_REMREF(_rt) do { \ 276 RT_LOCK_ASSERT(_rt); \ 277 KASSERT((_rt)->rt_refcnt > 0, \ 278 ("bogus refcnt %ld", (_rt)->rt_refcnt)); \ 279 (_rt)->rt_refcnt--; \ 280} while (0); 281 282#define RTFREE_LOCKED(_rt) do { \ 283 if ((_rt)->rt_refcnt <= 1) \ 284 rtfree(_rt); \ 285 else { \ 286 RT_REMREF(_rt); \ 287 RT_UNLOCK(_rt); \ 288 } \ 289 /* guard against invalid refs */ \ 290 _rt = 0; \ |
278 } while (0) | 291 } while (0) |
279#define RTFREE(_rt) do { \ 280 RT_LOCK(_rt); \ 281 RTFREE_LOCKED(_rt); \ | 292#define RTFREE(_rt) do { \ 293 RT_LOCK(_rt); \ 294 RTFREE_LOCKED(_rt); \ |
282 } while (0) 283 284extern struct radix_node_head *rt_tables[AF_MAX+1]; 285 286struct ifmultiaddr; 287 288void route_init(void); 289int rt_getifa(struct rt_addrinfo *); --- 23 unchanged lines hidden --- | 295 } while (0) 296 297extern struct radix_node_head *rt_tables[AF_MAX+1]; 298 299struct ifmultiaddr; 300 301void route_init(void); 302int rt_getifa(struct rt_addrinfo *); --- 23 unchanged lines hidden --- |