diff options
| author | cgd <cgd@NetBSD.org> | 1995-06-18 20:01:08 +0000 |
|---|---|---|
| committer | cgd <cgd@NetBSD.org> | 1995-06-18 20:01:08 +0000 |
| commit | f90cf78fbaf5ff6d733ed35537bc6567a77cb0e8 (patch) | |
| tree | 2e42d37c4e303844fcf6d7f3f2099ec6791ac600 /sys | |
| parent | 8f62c773e89467c252bb590cb1fe34e1a3c8530e (diff) | |
convert pcb lists to CIRCLEQs, so that the end can be looked at more
easily, and so that the original (insque/remque) logic can be effectively
mimiced. (This fixes a bug in the previous set of list changes.)
also (since terminator is no longer null) reinstate uninitted list checks,
but mark them XXX.
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/netinet/in_pcb.c | 27 | ||||
| -rw-r--r-- | sys/netinet/in_pcb.h | 6 | ||||
| -rw-r--r-- | sys/netinet/raw_ip.c | 7 | ||||
| -rw-r--r-- | sys/netinet/tcp_timer.c | 23 | ||||
| -rw-r--r-- | sys/netinet/udp_usrreq.c | 7 |
5 files changed, 42 insertions, 28 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index dc749c50a10..12530f76346 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.c,v 1.20 1995/06/12 06:49:55 mycroft Exp $ */ +/* $NetBSD: in_pcb.c,v 1.21 1995/06/18 20:01:08 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1991, 1993 @@ -64,7 +64,7 @@ in_pcbinit(table) struct inpcbtable *table; { - LIST_INIT(&table->inpt_list); + CIRCLEQ_INIT(&table->inpt_queue); table->inpt_lastport = 0; } @@ -81,7 +81,7 @@ in_pcballoc(so, table) bzero((caddr_t)inp, sizeof(*inp)); inp->inp_table = table; inp->inp_socket = so; - LIST_INSERT_HEAD(&table->inpt_list, inp, inp_list); + CIRCLEQ_INSERT_HEAD(&table->inpt_queue, inp, inp_queue); so->so_pcb = (caddr_t)inp; return (0); } @@ -306,7 +306,7 @@ in_pcbdetach(inp) if (inp->inp_route.ro_rt) rtfree(inp->inp_route.ro_rt); ip_freemoptions(inp->inp_moptions); - LIST_REMOVE(inp, inp_list); + CIRCLEQ_REMOVE(&inp->inp_table->inpt_queue, inp, inp_queue); FREE(inp, M_PCB); } @@ -372,17 +372,18 @@ in_pcbnotify(table, dst, fport_arg, laddr, lport_arg, errno, notify) if (faddr.s_addr == INADDR_ANY) return; - for (inp = table->inpt_list.lh_first; inp != 0;) { + for (inp = table->inpt_queue.cqh_first; + inp != (struct inpcb *)&table->inpt_queue;) { if (inp->inp_faddr.s_addr != faddr.s_addr || inp->inp_socket == 0 || inp->inp_fport != fport || inp->inp_lport != lport || inp->inp_laddr.s_addr != laddr.s_addr) { - inp = inp->inp_list.le_next; + inp = inp->inp_queue.cqe_next; continue; } oinp = inp; - inp = inp->inp_list.le_next; + inp = inp->inp_queue.cqe_next; if (notify) (*notify)(oinp, errno); } @@ -404,14 +405,15 @@ in_pcbnotifyall(table, dst, errno, notify) if (faddr.s_addr == INADDR_ANY) return; - for (inp = table->inpt_list.lh_first; inp != 0;) { + for (inp = table->inpt_queue.cqh_first; + inp != (struct inpcb *)&table->inpt_queue;) { if (inp->inp_faddr.s_addr != faddr.s_addr || inp->inp_socket == 0) { - inp = inp->inp_list.le_next; + inp = inp->inp_queue.cqe_next; continue; } oinp = inp; - inp = inp->inp_list.le_next; + inp = inp->inp_queue.cqe_next; if (notify) (*notify)(oinp, errno); } @@ -480,8 +482,9 @@ in_pcblookup(table, faddr, fport_arg, laddr, lport_arg, flags) int matchwild = 3, wildcard; u_int16_t fport = fport_arg, lport = lport_arg; - for (inp = table->inpt_list.lh_first; inp != 0; - inp = inp->inp_list.le_next) { + for (inp = table->inpt_queue.cqh_first; + inp != (struct inpcb *)&table->inpt_queue; + inp = inp->inp_queue.cqe_next) { if (inp->inp_lport != lport) continue; wildcard = 0; diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 9b1cd8d834f..1b62eaf3daa 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -1,4 +1,4 @@ -/* $NetBSD: in_pcb.h,v 1.11 1995/06/12 06:49:56 mycroft Exp $ */ +/* $NetBSD: in_pcb.h,v 1.12 1995/06/18 20:01:13 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1990, 1993 @@ -45,7 +45,7 @@ * control block. */ struct inpcb { - LIST_ENTRY(inpcb) inp_list; + CIRCLEQ_ENTRY(inpcb) inp_queue; struct inpcbtable *inp_table; struct in_addr inp_faddr; /* foreign host table entry */ struct in_addr inp_laddr; /* local host table entry */ @@ -61,7 +61,7 @@ struct inpcb { }; struct inpcbtable { - LIST_HEAD(inpcbhead, inpcb) inpt_list; + CIRCLEQ_HEAD(inpcbhead, inpcb) inpt_queue; u_int16_t inpt_lastport; }; diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 0a6968f3811..88fc13da5fb 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -1,4 +1,4 @@ -/* $NetBSD: raw_ip.c,v 1.20 1995/06/12 00:47:49 mycroft Exp $ */ +/* $NetBSD: raw_ip.c,v 1.21 1995/06/18 20:01:15 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1988, 1993 @@ -91,8 +91,9 @@ rip_input(m) struct socket *last = 0; ripsrc.sin_addr = ip->ip_src; - for (inp = rawcbtable.inpt_list.lh_first; inp != 0; - inp = inp->inp_list.le_next) { + for (inp = rawcbtable.inpt_queue.cqh_first; + inp != (struct inpcb *)&rawcbtable.inpt_queue; + inp = inp->inp_queue.cqe_next) { if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != ip->ip_p) continue; if (inp->inp_laddr.s_addr && diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index fe9a1fab97d..708277cbb24 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_timer.c,v 1.11 1995/06/12 00:47:58 mycroft Exp $ */ +/* $NetBSD: tcp_timer.c,v 1.12 1995/06/18 20:01:17 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1988, 1990, 1993 @@ -75,8 +75,10 @@ tcp_fasttimo() int s; s = splnet(); - for (inp = tcbtable.inpt_list.lh_first; inp != 0; - inp = inp->inp_list.le_next) { + inp = tcbtable.inpt_queue.cqh_first; + if (inp) /* XXX */ + for (; inp != (struct inpcb *)&tcbtable.inpt_queue; + inp = inp->inp_queue.cqe_next) { if ((tp = (struct tcpcb *)inp->inp_ppcb) && (tp->t_flags & TF_DELACK)) { tp->t_flags &= ~TF_DELACK; @@ -106,8 +108,13 @@ tcp_slowtimo() /* * Search through tcb's and update active timers. */ - for (ip = tcbtable.inpt_list.lh_first; ip != 0; ip = ipnxt) { - ipnxt = ip->inp_list.le_next; + ip = tcbtable.inpt_queue.cqh_first; + if (ip == (struct inpcb *)0) { /* XXX */ + splx(s); + return; + } + for (; ip != (struct inpcb *)&tcbtable.inpt_queue; ip = ipnxt) { + ipnxt = ip->inp_queue.cqe_next; tp = intotcpcb(ip); if (tp == 0) continue; @@ -116,8 +123,10 @@ tcp_slowtimo() (void) tcp_usrreq(tp->t_inpcb->inp_socket, PRU_SLOWTIMO, (struct mbuf *)0, (struct mbuf *)i, (struct mbuf *)0); - if (ipnxt->inp_list.le_prev != - &ip->inp_list.le_next) + /* XXX NOT MP SAFE */ + if ((ipnxt == (void *)&tcbtable.inpt_queue && + tcbtable.inpt_queue.cqh_last != ip) || + ipnxt->inp_queue.cqe_prev != ip) goto tpgone; } } diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index 52c5fa54459..bba248b24ed 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $NetBSD: udp_usrreq.c,v 1.21 1995/06/12 06:48:56 mycroft Exp $ */ +/* $NetBSD: udp_usrreq.c,v 1.22 1995/06/18 20:01:19 cgd Exp $ */ /* * Copyright (c) 1982, 1986, 1988, 1990, 1993 @@ -184,8 +184,9 @@ udp_input(m, iphlen) * (Algorithm copied from raw_intr().) */ last = NULL; - for (inp = udbtable.inpt_list.lh_first; inp != 0; - inp = inp->inp_list.le_next) { + for (inp = udbtable.inpt_queue.cqh_first; + inp != (struct inpcb *)&udbtable.inpt_queue; + inp = inp->inp_queue.cqe_next) { if (inp->inp_lport != uh->uh_dport) continue; if (inp->inp_laddr.s_addr != INADDR_ANY) { |
