Switch to using queue access macros instead of refering to the member

fields explicitly.
This commit is contained in:
matt 2001-11-05 18:02:15 +00:00
parent a76b375c0f
commit b5e785f38d
8 changed files with 37 additions and 45 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.97 2001/09/17 17:26:59 thorpej Exp $ */
/* $NetBSD: if.c,v 1.98 2001/11/05 18:02:15 matt Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@ -1493,9 +1493,9 @@ ifconf(cmd, data)
int space = ifc->ifc_len, error = 0;
ifrp = ifc->ifc_req;
for (ifp = ifnet.tqh_first; ifp != 0; ifp = ifp->if_list.tqe_next) {
TAILQ_FOREACH(ifp, &ifnet, if_list) {
bcopy(ifp->if_xname, ifr.ifr_name, IFNAMSIZ);
if ((ifa = ifp->if_addrlist.tqh_first) == 0) {
if ((ifa = TAILQ_FIRST(&ifp->if_addrlist)) == 0) {
memset((caddr_t)&ifr.ifr_addr, 0, sizeof(ifr.ifr_addr));
if (space >= (int)sizeof (ifr)) {
error = copyout((caddr_t)&ifr, (caddr_t)ifrp,
@ -1505,7 +1505,7 @@ ifconf(cmd, data)
}
space -= sizeof (ifr), ifrp++;
} else
for (; ifa != 0; ifa = ifa->ifa_list.tqe_next) {
for (; ifa != 0; ifa = TAILQ_NEXT(ifa, ifa_list)) {
struct sockaddr *sa = ifa->ifa_addr;
#if defined(COMPAT_43) || defined(COMPAT_LINUX) || defined(COMPAT_SVR4)
if (cmd == OSIOCGIFCONF) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_ether.h,v 1.25 2001/06/03 03:24:23 thorpej Exp $ */
/* $NetBSD: if_ether.h,v 1.26 2001/11/05 18:02:15 matt Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -204,11 +204,11 @@ struct ether_multistep {
/* struct ethercom *ec; */ \
/* struct ether_multi *enm; */ \
{ \
for ((enm) = (ec)->ec_multiaddrs.lh_first; \
for ((enm) = LIST_FIRST(&(ec)->ec_multiaddrs); \
(enm) != NULL && \
(bcmp((enm)->enm_addrlo, (addrlo), ETHER_ADDR_LEN) != 0 || \
bcmp((enm)->enm_addrhi, (addrhi), ETHER_ADDR_LEN) != 0); \
(enm) = (enm)->enm_list.le_next); \
(enm) = LIST_NEXT((enm), enm_list)); \
}
/*
@ -223,7 +223,7 @@ struct ether_multistep {
/* struct ether_multi *enm; */ \
{ \
if (((enm) = (step).e_enm) != NULL) \
(step).e_enm = (enm)->enm_list.le_next; \
(step).e_enm = LIST_NEXT((enm), enm_list); \
}
#define ETHER_FIRST_MULTI(step, ec, enm) \
@ -231,7 +231,7 @@ struct ether_multistep {
/* struct ethercom *ec; */ \
/* struct ether_multi *enm; */ \
{ \
(step).e_enm = (ec)->ec_multiaddrs.lh_first; \
(step).e_enm = LIST_FIRST(&(ec)->ec_multiaddrs); \
ETHER_NEXT_MULTI((step), (enm)); \
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_spppsubr.c,v 1.27 2001/10/29 19:15:48 martin Exp $ */
/* $NetBSD: if_spppsubr.c,v 1.28 2001/11/05 18:02:15 matt Exp $ */
/*
* Synchronous PPP/Cisco link level subroutines.
@ -4516,15 +4516,15 @@ sppp_get_ip_addrs(struct sppp *sp, u_long *src, u_long *dst, u_long *srcmask)
* Pick the first AF_INET address from the list,
* aliases don't make any sense on a p2p link anyway.
*/
for (ifa = ifp->if_addrlist.tqh_first, si = 0;
ifa;
ifa = ifa->ifa_list.tqe_next)
si = 0;
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
if (ifa->ifa_addr->sa_family == AF_INET) {
si = (struct sockaddr_in *)ifa->ifa_addr;
sm = (struct sockaddr_in *)ifa->ifa_netmask;
if (si)
break;
}
}
if (ifa) {
if (si && si->sin_addr.s_addr) {
ssrc = si->sin_addr.s_addr;
@ -4556,9 +4556,8 @@ sppp_set_ip_addr(struct sppp *sp, u_long src)
* aliases don't make any sense on a p2p link anyway.
*/
for (ifa = ifp->if_addrlist.tqh_first, si = 0;
ifa;
ifa = ifa->ifa_list.tqe_next)
si = 0;
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list)
{
if (ifa->ifa_addr->sa_family == AF_INET)
{
@ -4603,9 +4602,8 @@ sppp_get_ip6_addrs(struct sppp *sp, struct in6_addr *src, struct in6_addr *dst,
* Pick the first link-local AF_INET6 address from the list,
* aliases don't make any sense on a p2p link anyway.
*/
for (ifa = ifp->if_addrlist.tqh_first, si = 0;
ifa;
ifa = ifa->ifa_list.tqe_next)
si = 0;
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list)
if (ifa->ifa_addr->sa_family == AF_INET6) {
si = (struct sockaddr_in6 *)ifa->ifa_addr;
sm = (struct sockaddr_in6 *)ifa->ifa_netmask;
@ -4658,9 +4656,7 @@ sppp_set_ip6_addr(struct sppp *sp, const struct in6_addr *src)
*/
sin6 = NULL;
for (ifa = ifp->if_addrlist.tqh_first;
ifa;
ifa = ifa->ifa_list.tqe_next)
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list)
{
if (ifa->ifa_addr->sa_family == AF_INET6)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_stf.c,v 1.17 2001/07/18 16:43:10 thorpej Exp $ */
/* $NetBSD: if_stf.c,v 1.18 2001/11/05 18:02:16 matt Exp $ */
/* $KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
/*
@ -343,9 +343,7 @@ stf_getsrcifa6(ifp)
#if defined(__bsdi__) || (defined(__FreeBSD__) && __FreeBSD__ < 3)
for (ia = ifp->if_addrlist; ia; ia = ia->ifa_next)
#else
for (ia = ifp->if_addrlist.tqh_first;
ia;
ia = ia->ifa_list.tqe_next)
TAILQ_FIRST(ia, &ifp->if_addrlist, ifa_list) {
#endif
{
if (ia->ifa_addr == NULL)
@ -361,9 +359,9 @@ stf_getsrcifa6(ifp)
INADDR_TO_IA(in, ia4);
#else
#ifdef __OpenBSD__
for (ia4 = in_ifaddr.tqh_first;
for (ia4 = TAILQ_FIRST(&in_ifaddr);
ia4;
ia4 = ia4->ia_list.tqe_next)
ia4 = TAILQ_NEXT(ia4, ia_list))
#elif defined(__FreeBSD__) && __FreeBSD__ >= 3
for (ia4 = TAILQ_FIRST(&in_ifaddrhead);
ia4;
@ -537,7 +535,7 @@ stf_checkaddr4(sc, in, inifp)
* reject packets with broadcast
*/
#if defined(__OpenBSD__) || defined(__NetBSD__)
for (ia4 = in_ifaddr.tqh_first; ia4; ia4 = ia4->ia_list.tqe_next)
TAILQ_FOREACH(ia4, &in_ifaddr, ia_list)
#elif defined(__FreeBSD__) && __FreeBSD__ >= 3
for (ia4 = TAILQ_FIRST(&in_ifaddrhead);
ia4;

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_tun.c,v 1.46 2001/10/31 20:08:17 atatat Exp $ */
/* $NetBSD: if_tun.c,v 1.47 2001/11/05 18:02:16 matt Exp $ */
/*
* Copyright (c) 1988, Julian Onions <jpo@cs.nott.ac.uk>
@ -279,8 +279,7 @@ tunclose(dev, flag, mode, p)
if (ifp->if_flags & IFF_RUNNING) {
/* find internet addresses and delete routes */
struct ifaddr *ifa;
for (ifa = ifp->if_addrlist.tqh_first; ifa != 0;
ifa = ifa->ifa_list.tqe_next) {
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
#ifdef INET
if (ifa->ifa_addr->sa_family == AF_INET) {
rtinit(ifa, (int)RTM_DELETE,
@ -313,8 +312,7 @@ tuninit(tp)
ifp->if_flags |= IFF_UP | IFF_RUNNING;
tp->tun_flags &= ~(TUN_IASET|TUN_DSTADDR);
for (ifa = ifp->if_addrlist.tqh_first; ifa != 0;
ifa = ifa->ifa_list.tqe_next) {
TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) {
#ifdef INET
if (ifa->ifa_addr->sa_family == AF_INET) {
struct sockaddr_in *sin;

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_usrreq.c,v 1.15 2000/03/30 09:45:40 augustss Exp $ */
/* $NetBSD: raw_usrreq.c,v 1.16 2001/11/05 18:02:16 matt Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -94,7 +94,7 @@ raw_input(m0, va_alist)
va_end(ap);
last = 0;
for (rp = rawcb.lh_first; rp != 0; rp = rp->rcb_list.le_next) {
LIST_FOREACH(rp, &rawcb, rcb_list) {
if (rp->rcb_proto.sp_family != proto->sp_family)
continue;
if (rp->rcb_proto.sp_protocol &&

View File

@ -1,4 +1,4 @@
/* $NetBSD: route.c,v 1.48 2001/10/16 02:42:36 itojun Exp $ */
/* $NetBSD: route.c,v 1.49 2001/11/05 18:02:16 matt Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -209,7 +209,7 @@ rtalloc1(dst, report)
info.rti_info[RTAX_GATEWAY] = rt->rt_gateway;
if (rt->rt_ifp != NULL) {
info.rti_info[RTAX_IFP] =
rt->rt_ifp->if_addrlist.tqh_first->ifa_addr;
TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr;
info.rti_info[RTAX_IFA] = rt->rt_ifa->ifa_addr;
}
rt_missmsg(RTM_ADD, &info, rt->rt_flags, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtsock.c,v 1.52 2001/10/29 07:02:32 simonb Exp $ */
/* $NetBSD: rtsock.c,v 1.53 2001/11/05 18:02:16 matt Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -315,7 +315,7 @@ route_output(m, va_alist)
genmask = rt->rt_genmask;
if (rtm->rtm_addrs & (RTA_IFP | RTA_IFA)) {
if ((ifp = rt->rt_ifp) != NULL) {
ifpaddr = ifp->if_addrlist.tqh_first->ifa_addr;
ifpaddr = TAILQ_FIRST(&ifp->if_addrlist)->ifa_addr;
ifaaddr = rt->rt_ifa->ifa_addr;
if (ifp->if_flags & IFF_POINTOPOINT)
brdaddr = rt->rt_ifa->ifa_dstaddr;
@ -787,7 +787,7 @@ rt_newaddrmsg(cmd, ifa, error, rt)
int ncmd = cmd == RTM_ADD ? RTM_NEWADDR : RTM_DELADDR;
ifaaddr = sa = ifa->ifa_addr;
ifpaddr = ifp->if_addrlist.tqh_first->ifa_addr;
ifpaddr = TAILQ_FIRST(&ifp->if_addrlist)->ifa_addr;
netmask = ifa->ifa_netmask;
brdaddr = ifa->ifa_dstaddr;
memset(&ifam, 0, sizeof(ifam));
@ -871,7 +871,7 @@ sysctl_dumpentry(rn, v)
netmask = rt_mask(rt);
genmask = rt->rt_genmask;
if (rt->rt_ifp) {
ifpaddr = rt->rt_ifp->if_addrlist.tqh_first->ifa_addr;
ifpaddr = TAILQ_FIRST(&rt->rt_ifp->if_addrlist)->ifa_addr;
ifaaddr = rt->rt_ifa->ifa_addr;
if (rt->rt_ifp->if_flags & IFF_POINTOPOINT)
brdaddr = rt->rt_ifa->ifa_dstaddr;
@ -907,10 +907,10 @@ sysctl_iflist(af, w, type)
int len, error = 0;
memset(&info, 0, sizeof(info));
for (ifp = ifnet.tqh_first; ifp != 0; ifp = ifp->if_list.tqe_next) {
TAILQ_FOREACH(ifp, &ifnet, if_list) {
if (w->w_arg && w->w_arg != ifp->if_index)
continue;
ifa = ifp->if_addrlist.tqh_first;
ifa = TAILQ_FIRST(&ifp->if_addrlist);
ifpaddr = ifa->ifa_addr;
switch(type) {
case NET_RT_IFLIST:
@ -999,7 +999,7 @@ sysctl_iflist(af, w, type)
panic("sysctl_iflist(2)");
}
}
while ((ifa = ifa->ifa_list.tqe_next) != NULL) {
while ((ifa = TAILQ_NEXT(ifa, ifa_list)) != NULL) {
if (af && af != ifa->ifa_addr->sa_family)
continue;
ifaaddr = ifa->ifa_addr;