summaryrefslogtreecommitdiff
path: root/sys/netatalk
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-11-13 15:07:24 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-11-13 15:07:24 +0000
commit7fd99c4223ef66697195f7c350bbd2db5035aad1 (patch)
tree680fbec6d5d489f4cfdd6783bf5a066ff30f8979 /sys/netatalk
parent32e887a25e9cf2c0addbd3c7c3df3d12302770dc (diff)
Use TAILQ_ macros instead of handrolling them self. Tested by myself.
Diffstat (limited to 'sys/netatalk')
-rw-r--r--sys/netatalk/aarp.c18
-rw-r--r--sys/netatalk/at_control.c27
2 files changed, 13 insertions, 32 deletions
diff --git a/sys/netatalk/aarp.c b/sys/netatalk/aarp.c
index d59b9c272f0..62a7739b4dc 100644
--- a/sys/netatalk/aarp.c
+++ b/sys/netatalk/aarp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aarp.c,v 1.8 2008/10/15 19:12:18 blambert Exp $ */
+/* $OpenBSD: aarp.c,v 1.9 2009/11/13 15:07:23 claudio Exp $ */
/*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -166,7 +166,7 @@ at_ifawithnet( sat, ifa )
struct sockaddr_at *sat2;
struct netrange *nr;
- for (; ifa; ifa = ifa->ifa_list.tqe_next ) {
+ for (; ifa; ifa = TAILQ_NEXT(ifa, ifa_list)) {
if ( ifa->ifa_addr->sa_family != AF_APPLETALK ) {
continue;
}
@@ -222,7 +222,7 @@ aarpwhohas( ac, sat )
* net is phase 2, generate an 802.2 and SNAP header.
*/
if (( aa = (struct at_ifaddr *)
- at_ifawithnet( sat, ac->ac_if.if_addrlist.tqh_first )) == NULL ) {
+ at_ifawithnet( sat, TAILQ_FIRST(&ac->ac_if.if_addrlist))) == NULL ) {
m_freem( m );
return;
}
@@ -277,7 +277,7 @@ aarpresolve( ac, m, destsat, desten )
if ( at_broadcast( destsat )) {
if (( aa = (struct at_ifaddr *)at_ifawithnet( destsat,
- ((struct ifnet *)ac)->if_addrlist.tqh_first )) == NULL ) {
+ TAILQ_FIRST(&((struct ifnet *)ac)->if_addrlist))) == NULL ) {
m_freem( m );
return( 0 );
}
@@ -404,7 +404,7 @@ at_aarpinput( ac, m )
sat.sat_family = AF_APPLETALK;
sat.sat_addr.s_net = net;
if (( aa = (struct at_ifaddr *)at_ifawithnet( &sat,
- ac->ac_if.if_addrlist.tqh_first )) == NULL ) {
+ TAILQ_FIRST(&ac->ac_if.if_addrlist))) == NULL ) {
m_freem( m );
return;
}
@@ -415,8 +415,8 @@ at_aarpinput( ac, m )
* Since we don't know the net, we just look for the first
* phase 1 address on the interface.
*/
- for ( aa = (struct at_ifaddr *)ac->ac_if.if_addrlist.tqh_first; aa;
- aa = (struct at_ifaddr *)aa->aa_ifa.ifa_list.tqe_next ) {
+ for ( aa = (struct at_ifaddr *)TAILQ_FIRST(&ac->ac_if.if_addrlist); aa;
+ aa = (struct at_ifaddr *)TAILQ_NEXT(&aa->aa_ifa, ifa_list)) {
if ( AA_SAT( aa )->sat_family == AF_APPLETALK &&
( aa->aa_flags & AFA_PHASE2 ) == 0 ) {
break;
@@ -617,8 +617,8 @@ aarpprobe( arg )
* interface with the same address as we're looking for. If the
* net is phase 2, generate an 802.2 and SNAP header.
*/
- for ( aa = (struct at_ifaddr *)ac->ac_if.if_addrlist.tqh_first; aa;
- aa = (struct at_ifaddr *)aa->aa_ifa.ifa_list.tqe_next) {
+ for ( aa = (struct at_ifaddr *)TAILQ_FIRST(&ac->ac_if.if_addrlist); aa;
+ aa = (struct at_ifaddr *)TAILQ_NEXT(&aa->aa_ifa, ifa_list)) {
if ( AA_SAT( aa )->sat_family == AF_APPLETALK &&
( aa->aa_flags & AFA_PROBING )) {
break;
diff --git a/sys/netatalk/at_control.c b/sys/netatalk/at_control.c
index 91f1900fc93..4f9f371d71b 100644
--- a/sys/netatalk/at_control.c
+++ b/sys/netatalk/at_control.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: at_control.c,v 1.13 2008/06/08 19:10:33 claudio Exp $ */
+/* $OpenBSD: at_control.c,v 1.14 2009/11/13 15:07:23 claudio Exp $ */
/*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -113,7 +113,7 @@ at_control( cmd, data, ifp, p )
struct at_aliasreq *ifra = (struct at_aliasreq *)data;
struct at_ifaddr *aa0;
struct at_ifaddr *aa = 0;
- struct ifaddr *ifa, *ifa0;
+ struct ifaddr *ifa0;
if ( ifp ) {
for ( aa = at_ifaddr; aa; aa = aa->aa_next ) {
@@ -190,14 +190,7 @@ at_control( cmd, data, ifp, p )
aa = aa0;
- if (( ifa = ifp->if_addrlist.tqh_first ) != NULL ) {
- for ( ; ifa->ifa_list.tqe_next; ifa = ifa->ifa_list.tqe_next )
- ;
- ifa->ifa_list.tqe_next = (struct ifaddr *)aa;
- } else {
- ifp->if_addrlist.tqh_first = (struct ifaddr *)aa;
- }
-
+ TAILQ_INSERT_TAIL(&ifp->if_addrlist, (struct ifaddr *)aa, ifa_list);
/* FreeBSD found this. Whew */
aa->aa_ifa.ifa_refcnt++;
@@ -265,19 +258,7 @@ at_control( cmd, data, ifp, p )
case SIOCDIFADDR:
at_scrub( ifp, aa );
ifa0 = (struct ifaddr *)aa;
- if (( ifa = ifp->if_addrlist.tqh_first ) == ifa0 ) {
- ifp->if_addrlist.tqh_first = ifa->ifa_list.tqe_next;
- } else {
- while ( ifa->ifa_list.tqe_next &&
- ( ifa->ifa_list.tqe_next != ifa0 )) {
- ifa = ifa->ifa_list.tqe_next;
- }
- if ( ifa->ifa_list.tqe_next ) {
- ifa->ifa_list.tqe_next = ifa0->ifa_list.tqe_next;
- } else {
- panic( "at_control" );
- }
- }
+ TAILQ_REMOVE(&ifp->if_addrlist, ifa0, ifa_list);
/* FreeBSD */
IFAFREE(ifa0);