if_llatbl.h (186121) | if_llatbl.h (186149) |
---|---|
1/* 2 * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved. 3 * Copyright (c) 2004-2008 Qing Li. All rights reserved. 4 * Copyright (c) 2008 Kip Macy. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2004 Luigi Rizzo, Alessandro Cerri. All rights reserved. 3 * Copyright (c) 2004-2008 Qing Li. All rights reserved. 4 * Copyright (c) 2008 Kip Macy. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 11 unchanged lines hidden (view full) --- 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/net/if_llatbl.h 186121 2008-12-15 06:53:09Z kmacy $"); | 28__FBSDID("$FreeBSD: head/sys/net/if_llatbl.h 186149 2008-12-16 00:20:15Z kmacy $"); |
29 30#ifndef _NET_IF_LLATBL_H_ 31#define _NET_IF_LLATBL_H_ 32 33#include <sys/_rwlock.h> 34#include <netinet/in.h> 35 36struct ifnet; --- 39 unchanged lines hidden (view full) --- 76 77#define LLE_WLOCK(lle) rw_wlock(&(lle)->lle_lock) 78#define LLE_RLOCK(lle) rw_rlock(&(lle)->lle_lock) 79#define LLE_WUNLOCK(lle) rw_wunlock(&(lle)->lle_lock) 80#define LLE_RUNLOCK(lle) rw_runlock(&(lle)->lle_lock) 81#define LLE_DOWNGRADE(lle) rw_downgrade(&(lle)->lle_lock) 82#define LLE_TRY_UPGRADE(lle) rw_try_upgrade(&(lle)->lle_lock) 83#define LLE_LOCK_INIT(lle) rw_init_flags(&(lle)->lle_lock, "lle", RW_DUPOK) | 29 30#ifndef _NET_IF_LLATBL_H_ 31#define _NET_IF_LLATBL_H_ 32 33#include <sys/_rwlock.h> 34#include <netinet/in.h> 35 36struct ifnet; --- 39 unchanged lines hidden (view full) --- 76 77#define LLE_WLOCK(lle) rw_wlock(&(lle)->lle_lock) 78#define LLE_RLOCK(lle) rw_rlock(&(lle)->lle_lock) 79#define LLE_WUNLOCK(lle) rw_wunlock(&(lle)->lle_lock) 80#define LLE_RUNLOCK(lle) rw_runlock(&(lle)->lle_lock) 81#define LLE_DOWNGRADE(lle) rw_downgrade(&(lle)->lle_lock) 82#define LLE_TRY_UPGRADE(lle) rw_try_upgrade(&(lle)->lle_lock) 83#define LLE_LOCK_INIT(lle) rw_init_flags(&(lle)->lle_lock, "lle", RW_DUPOK) |
84#define LLE_LOCK_DESTROY(lle) rw_destroy(&(lle)->lle_lock) |
|
84#define LLE_WLOCK_ASSERT(lle) rw_assert(&(lle)->lle_lock, RA_WLOCKED) 85 86#define LLE_IS_VALID(lle) (((lle) != NULL) && ((lle) != (void *)-1)) 87 88#define LLE_ADDREF(lle) do { \ 89 LLE_WLOCK_ASSERT(lle); \ 90 KASSERT((lle)->lle_refcnt >= 0, \ 91 ("negative refcnt %d", (lle)->lle_refcnt)); \ --- 22 unchanged lines hidden (view full) --- 114 LLE_WLOCK(lle); \ 115 if ((lle)->lle_refcnt <= 1) \ 116 (lle)->lle_tbl->llt_free((lle)->lle_tbl, (lle));\ 117 else { \ 118 (lle)->lle_refcnt--; \ 119 LLE_WUNLOCK(lle); \ 120 } \ 121 /* guard against invalid refs */ \ | 85#define LLE_WLOCK_ASSERT(lle) rw_assert(&(lle)->lle_lock, RA_WLOCKED) 86 87#define LLE_IS_VALID(lle) (((lle) != NULL) && ((lle) != (void *)-1)) 88 89#define LLE_ADDREF(lle) do { \ 90 LLE_WLOCK_ASSERT(lle); \ 91 KASSERT((lle)->lle_refcnt >= 0, \ 92 ("negative refcnt %d", (lle)->lle_refcnt)); \ --- 22 unchanged lines hidden (view full) --- 115 LLE_WLOCK(lle); \ 116 if ((lle)->lle_refcnt <= 1) \ 117 (lle)->lle_tbl->llt_free((lle)->lle_tbl, (lle));\ 118 else { \ 119 (lle)->lle_refcnt--; \ 120 LLE_WUNLOCK(lle); \ 121 } \ 122 /* guard against invalid refs */ \ |
122 lle = 0; \ | 123 lle = NULL; \ |
123} while (0) 124 125 126#define ln_timer_ch lle_timer.ln_timer_ch 127#define la_timer lle_timer.la_timer 128 129/* XXX bad name */ 130#define L3_ADDR(lle) ((struct sockaddr *)(&lle[1])) --- 61 unchanged lines hidden --- | 124} while (0) 125 126 127#define ln_timer_ch lle_timer.ln_timer_ch 128#define la_timer lle_timer.la_timer 129 130/* XXX bad name */ 131#define L3_ADDR(lle) ((struct sockaddr *)(&lle[1])) --- 61 unchanged lines hidden --- |