Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys convert from CIRCLEQ to TAILQ.
details: https://anonhg.NetBSD.org/src/rev/94ff71d4f893
branches: trunk
changeset: 791552:94ff71d4f893
user: christos <christos%NetBSD.org@localhost>
date: Sat Nov 23 14:20:21 2013 +0000
description:
convert from CIRCLEQ to TAILQ.
diffstat:
sys/netinet/in_pcb.c | 36 ++++++++++++++----------------------
sys/netinet/in_pcb_hdr.h | 6 +++---
sys/netinet/raw_ip.c | 14 ++++++--------
sys/netinet/tcp_subr.c | 6 +++---
sys/netinet/tcp_usrreq.c | 10 +++-------
sys/netinet/udp_usrreq.c | 8 ++++----
sys/netinet6/icmp6.c | 6 +++---
sys/netinet6/in6_pcb.c | 33 +++++++++++++--------------------
sys/netinet6/raw_ip6.c | 6 +++---
9 files changed, 52 insertions(+), 73 deletions(-)
diffs (truncated from 420 to 300 lines):
diff -r d6a17eb6c97d -r 94ff71d4f893 sys/netinet/in_pcb.c
--- a/sys/netinet/in_pcb.c Sat Nov 23 13:46:22 2013 +0000
+++ b/sys/netinet/in_pcb.c Sat Nov 23 14:20:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in_pcb.c,v 1.145 2013/06/05 19:01:26 christos Exp $ */
+/* $NetBSD: in_pcb.c,v 1.146 2013/11/23 14:20:21 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -93,7 +93,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.145 2013/06/05 19:01:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.146 2013/11/23 14:20:21 christos Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -172,7 +172,7 @@
{
static ONCE_DECL(control);
- CIRCLEQ_INIT(&table->inpt_queue);
+ TAILQ_INIT(&table->inpt_queue);
table->inpt_porthashtbl = hashinit(bindhashsize, HASH_LIST, true,
&table->inpt_porthash);
table->inpt_bindhashtbl = hashinit(bindhashsize, HASH_LIST, true,
@@ -218,8 +218,7 @@
#endif
so->so_pcb = inp;
s = splnet();
- CIRCLEQ_INSERT_HEAD(&table->inpt_queue, &inp->inp_head,
- inph_queue);
+ TAILQ_INSERT_HEAD(&table->inpt_queue, &inp->inp_head, inph_queue);
LIST_INSERT_HEAD(INPCBHASH_PORT(table, inp->inp_lport), &inp->inp_head,
inph_lhash);
in_pcbstate(inp, INP_ATTACHED);
@@ -602,8 +601,7 @@
s = splnet();
in_pcbstate(inp, INP_ATTACHED);
LIST_REMOVE(&inp->inp_head, inph_lhash);
- CIRCLEQ_REMOVE(&inp->inp_table->inpt_queue, &inp->inp_head,
- inph_queue);
+ TAILQ_REMOVE(&inp->inp_table->inpt_queue, &inp->inp_head, inph_queue);
pool_put(&inpcb_pool, inp);
splx(s);
sofree(so); /* drops the socket's lock */
@@ -681,15 +679,13 @@
in_pcbnotifyall(struct inpcbtable *table, struct in_addr faddr, int errno,
void (*notify)(struct inpcb *, int))
{
- struct inpcb *inp, *ninp;
+ struct inpcb_hdr *inph, *ninph;
if (in_nullhost(faddr) || notify == 0)
return;
- for (inp = (struct inpcb *)CIRCLEQ_FIRST(&table->inpt_queue);
- inp != (void *)&table->inpt_queue;
- inp = ninp) {
- ninp = (struct inpcb *)CIRCLEQ_NEXT(inp, inp_queue);
+ TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ struct inpcb *inp = (struct inpcb *)inph;
if (inp->inp_af != AF_INET)
continue;
if (in_hosteq(inp->inp_faddr, faddr))
@@ -700,14 +696,12 @@
void
in_pcbpurgeif0(struct inpcbtable *table, struct ifnet *ifp)
{
- struct inpcb *inp, *ninp;
+ struct inpcb_hdr *inph, *ninph;
struct ip_moptions *imo;
int i, gap;
- for (inp = (struct inpcb *)CIRCLEQ_FIRST(&table->inpt_queue);
- inp != (void *)&table->inpt_queue;
- inp = ninp) {
- ninp = (struct inpcb *)CIRCLEQ_NEXT(inp, inp_queue);
+ TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ struct inpcb *inp = (struct inpcb *)inph;
if (inp->inp_af != AF_INET)
continue;
imo = inp->inp_moptions;
@@ -741,12 +735,10 @@
in_pcbpurgeif(struct inpcbtable *table, struct ifnet *ifp)
{
struct rtentry *rt;
- struct inpcb *inp, *ninp;
+ struct inpcb_hdr *inph, *ninph;
- for (inp = (struct inpcb *)CIRCLEQ_FIRST(&table->inpt_queue);
- inp != (void *)&table->inpt_queue;
- inp = ninp) {
- ninp = (struct inpcb *)CIRCLEQ_NEXT(inp, inp_queue);
+ TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ struct inpcb *inp = (struct inpcb *)inph;
if (inp->inp_af != AF_INET)
continue;
if ((rt = rtcache_validate(&inp->inp_route)) != NULL &&
diff -r d6a17eb6c97d -r 94ff71d4f893 sys/netinet/in_pcb_hdr.h
--- a/sys/netinet/in_pcb_hdr.h Sat Nov 23 13:46:22 2013 +0000
+++ b/sys/netinet/in_pcb_hdr.h Sat Nov 23 14:20:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: in_pcb_hdr.h,v 1.8 2012/06/25 15:28:39 christos Exp $ */
+/* $NetBSD: in_pcb_hdr.h,v 1.9 2013/11/23 14:20:21 christos Exp $ */
/*
* Copyright (C) 2003 WIDE Project.
@@ -73,7 +73,7 @@
struct inpcb_hdr {
LIST_ENTRY(inpcb_hdr) inph_hash;
LIST_ENTRY(inpcb_hdr) inph_lhash;
- CIRCLEQ_ENTRY(inpcb_hdr) inph_queue;
+ TAILQ_ENTRY(inpcb_hdr) inph_queue;
int inph_af; /* address family - AF_INET */
void * inph_ppcb; /* pointer to per-protocol pcb */
int inph_state; /* bind/connect state */
@@ -111,7 +111,7 @@
} vestigial_hooks_t;
struct inpcbtable {
- CIRCLEQ_HEAD(, inpcb_hdr) inpt_queue;
+ TAILQ_HEAD(, inpcb_hdr) inpt_queue;
struct inpcbhead *inpt_porthashtbl;
struct inpcbhead *inpt_bindhashtbl;
struct inpcbhead *inpt_connecthashtbl;
diff -r d6a17eb6c97d -r 94ff71d4f893 sys/netinet/raw_ip.c
--- a/sys/netinet/raw_ip.c Sat Nov 23 13:46:22 2013 +0000
+++ b/sys/netinet/raw_ip.c Sat Nov 23 14:20:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: raw_ip.c,v 1.116 2013/06/05 19:01:26 christos Exp $ */
+/* $NetBSD: raw_ip.c,v 1.117 2013/11/23 14:20:21 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.116 2013/06/05 19:01:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.117 2013/11/23 14:20:21 christos Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@@ -189,7 +189,7 @@
ip->ip_len = ntohs(ip->ip_len) - hlen;
NTOHS(ip->ip_off);
- CIRCLEQ_FOREACH(inph, &rawcbtable.inpt_queue, inph_queue) {
+ TAILQ_FOREACH(inph, &rawcbtable.inpt_queue, inph_queue) {
inp = (struct inpcb *)inph;
if (inp->inp_af != AF_INET)
continue;
@@ -247,14 +247,12 @@
struct in_addr faddr, struct in_addr laddr, int proto, int errno,
void (*notify)(struct inpcb *, int))
{
- struct inpcb *inp, *ninp;
+ struct inpcb_hdr *inph, *ninph;
int nmatch;
nmatch = 0;
- for (inp = (struct inpcb *)CIRCLEQ_FIRST(&table->inpt_queue);
- inp != (struct inpcb *)&table->inpt_queue;
- inp = ninp) {
- ninp = (struct inpcb *)inp->inp_queue.cqe_next;
+ TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ struct inpcb *inp = (struct inpcb *)inph;
if (inp->inp_af != AF_INET)
continue;
if (inp->inp_ip.ip_p && inp->inp_ip.ip_p != proto)
diff -r d6a17eb6c97d -r 94ff71d4f893 sys/netinet/tcp_subr.c
--- a/sys/netinet/tcp_subr.c Sat Nov 23 13:46:22 2013 +0000
+++ b/sys/netinet/tcp_subr.c Sat Nov 23 14:20:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_subr.c,v 1.251 2013/11/12 09:02:05 kefren Exp $ */
+/* $NetBSD: tcp_subr.c,v 1.252 2013/11/23 14:20:21 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.251 2013/11/12 09:02:05 kefren Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.252 2013/11/23 14:20:21 christos Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -1351,7 +1351,7 @@
/*
* Free the sequence queue of all TCP connections.
*/
- CIRCLEQ_FOREACH(inph, &tcbtable.inpt_queue, inph_queue) {
+ TAILQ_FOREACH(inph, &tcbtable.inpt_queue, inph_queue) {
switch (inph->inph_af) {
case AF_INET:
tp = intotcpcb((struct inpcb *)inph);
diff -r d6a17eb6c97d -r 94ff71d4f893 sys/netinet/tcp_usrreq.c
--- a/sys/netinet/tcp_usrreq.c Sat Nov 23 13:46:22 2013 +0000
+++ b/sys/netinet/tcp_usrreq.c Sat Nov 23 14:20:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_usrreq.c,v 1.168 2013/10/04 16:20:35 christos Exp $ */
+/* $NetBSD: tcp_usrreq.c,v 1.169 2013/11/23 14:20:21 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -95,7 +95,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.168 2013/10/04 16:20:35 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.169 2013/11/23 14:20:21 christos Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -1396,10 +1396,6 @@
struct sockaddr_in6 *in6;
const struct in6pcb *in6p;
#endif
- /*
- * sysctl_data is const, but CIRCLEQ_FOREACH can't use a const
- * struct inpcbtable pointer, so we have to discard const. :-/
- */
struct inpcbtable *pcbtbl = __UNCONST(rnode->sysctl_data);
const struct inpcb_hdr *inph;
struct tcpcb *tp;
@@ -1439,7 +1435,7 @@
mutex_enter(softnet_lock);
- CIRCLEQ_FOREACH(inph, &pcbtbl->inpt_queue, inph_queue) {
+ TAILQ_FOREACH(inph, &pcbtbl->inpt_queue, inph_queue) {
#ifdef INET
inp = (const struct inpcb *)inph;
#endif
diff -r d6a17eb6c97d -r 94ff71d4f893 sys/netinet/udp_usrreq.c
--- a/sys/netinet/udp_usrreq.c Sat Nov 23 13:46:22 2013 +0000
+++ b/sys/netinet/udp_usrreq.c Sat Nov 23 14:20:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: udp_usrreq.c,v 1.190 2013/06/05 19:01:26 christos Exp $ */
+/* $NetBSD: udp_usrreq.c,v 1.191 2013/11/23 14:20:21 christos Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.190 2013/06/05 19:01:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.191 2013/11/23 14:20:21 christos Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@@ -766,7 +766,7 @@
/*
* Locate pcb(s) for datagram.
*/
- CIRCLEQ_FOREACH(inph, &udbtable.inpt_queue, inph_queue) {
+ TAILQ_FOREACH(inph, &udbtable.inpt_queue, inph_queue) {
inp = (struct inpcb *)inph;
if (inp->inp_af != AF_INET)
continue;
@@ -911,7 +911,7 @@
/*
* Locate pcb(s) for datagram.
*/
- CIRCLEQ_FOREACH(inph, &udbtable.inpt_queue, inph_queue) {
+ TAILQ_FOREACH(inph, &udbtable.inpt_queue, inph_queue) {
in6p = (struct in6pcb *)inph;
if (in6p->in6p_af != AF_INET6)
continue;
diff -r d6a17eb6c97d -r 94ff71d4f893 sys/netinet6/icmp6.c
--- a/sys/netinet6/icmp6.c Sat Nov 23 13:46:22 2013 +0000
+++ b/sys/netinet6/icmp6.c Sat Nov 23 14:20:21 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: icmp6.c,v 1.162 2013/06/05 19:01:26 christos Exp $ */
+/* $NetBSD: icmp6.c,v 1.163 2013/11/23 14:20:22 christos Exp $ */
/* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.162 2013/06/05 19:01:26 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.163 2013/11/23 14:20:22 christos Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -1878,7 +1878,7 @@
return (IPPROTO_DONE);
}
- CIRCLEQ_FOREACH(inph, &raw6cbtable.inpt_queue, inph_queue) {
+ TAILQ_FOREACH(inph, &raw6cbtable.inpt_queue, inph_queue) {
in6p = (struct in6pcb *)inph;
if (in6p->in6p_af != AF_INET6)
continue;
Home |
Main Index |
Thread Index |
Old Index