Module Name: src
Committed By: knakahara
Date: Thu Jun 9 07:01:28 UTC 2022
Modified Files:
src/sys/netinet: in_pcb.c
src/sys/netinet6: in6_pcb.c
Log Message:
refactor: use TAILQ_FOREACH instead of TAILQ_FOREACH_SAFE about inpt_queue.
They don't use "ninph" pointer and don't remove elements.
To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 src/sys/netinet/in_pcb.c
cvs rdiff -u -r1.167 -r1.168 src/sys/netinet6/in6_pcb.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/netinet/in_pcb.c
diff -u src/sys/netinet/in_pcb.c:1.186 src/sys/netinet/in_pcb.c:1.187
--- src/sys/netinet/in_pcb.c:1.186 Tue Oct 19 20:01:09 2021
+++ src/sys/netinet/in_pcb.c Thu Jun 9 07:01:27 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: in_pcb.c,v 1.186 2021/10/19 20:01:09 roy Exp $ */
+/* $NetBSD: in_pcb.c,v 1.187 2022/06/09 07:01:27 knakahara 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.186 2021/10/19 20:01:09 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.187 2022/06/09 07:01:27 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -719,12 +719,12 @@ void
in_pcbnotifyall(struct inpcbtable *table, struct in_addr faddr, int errno,
void (*notify)(struct inpcb *, int))
{
- struct inpcb_hdr *inph, *ninph;
+ struct inpcb_hdr *inph;
if (in_nullhost(faddr) || notify == 0)
return;
- TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ TAILQ_FOREACH(inph, &table->inpt_queue, inph_queue) {
struct inpcb *inp = (struct inpcb *)inph;
if (inp->inp_af != AF_INET)
continue;
@@ -768,9 +768,9 @@ in_purgeifmcast(struct ip_moptions *imo,
void
in_pcbpurgeif0(struct inpcbtable *table, struct ifnet *ifp)
{
- struct inpcb_hdr *inph, *ninph;
+ struct inpcb_hdr *inph;
- TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ TAILQ_FOREACH(inph, &table->inpt_queue, inph_queue) {
struct inpcb *inp = (struct inpcb *)inph;
bool need_unlock = false;
@@ -795,9 +795,9 @@ void
in_pcbpurgeif(struct inpcbtable *table, struct ifnet *ifp)
{
struct rtentry *rt;
- struct inpcb_hdr *inph, *ninph;
+ struct inpcb_hdr *inph;
- TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ TAILQ_FOREACH(inph, &table->inpt_queue, inph_queue) {
struct inpcb *inp = (struct inpcb *)inph;
if (inp->inp_af != AF_INET)
continue;
Index: src/sys/netinet6/in6_pcb.c
diff -u src/sys/netinet6/in6_pcb.c:1.167 src/sys/netinet6/in6_pcb.c:1.168
--- src/sys/netinet6/in6_pcb.c:1.167 Tue Sep 8 14:12:57 2020
+++ src/sys/netinet6/in6_pcb.c Thu Jun 9 07:01:27 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: in6_pcb.c,v 1.167 2020/09/08 14:12:57 christos Exp $ */
+/* $NetBSD: in6_pcb.c,v 1.168 2022/06/09 07:01:27 knakahara Exp $ */
/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
/*
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.167 2020/09/08 14:12:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.168 2022/06/09 07:01:27 knakahara Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -698,7 +698,7 @@ in6_pcbnotify(struct inpcbtable *table,
u_int fport_arg, const struct sockaddr *src, u_int lport_arg, int cmd,
void *cmdarg, void (*notify)(struct in6pcb *, int))
{
- struct inpcb_hdr *inph, *ninph;
+ struct inpcb_hdr *inph;
struct sockaddr_in6 sa6_src;
const struct sockaddr_in6 *sa6_dst;
u_int16_t fport = fport_arg, lport = lport_arg;
@@ -737,7 +737,7 @@ in6_pcbnotify(struct inpcbtable *table,
}
errno = inet6ctlerrmap[cmd];
- TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ TAILQ_FOREACH(inph, &table->inpt_queue, inph_queue) {
struct in6pcb *in6p = (struct in6pcb *)inph;
struct rtentry *rt = NULL;
@@ -843,13 +843,13 @@ in6_pcbnotify(struct inpcbtable *table,
void
in6_pcbpurgeif0(struct inpcbtable *table, struct ifnet *ifp)
{
- struct inpcb_hdr *inph, *ninph;
+ struct inpcb_hdr *inph;
struct ip6_moptions *im6o;
struct in6_multi_mship *imm, *nimm;
KASSERT(ifp != NULL);
- TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ TAILQ_FOREACH(inph, &table->inpt_queue, inph_queue) {
struct in6pcb *in6p = (struct in6pcb *)inph;
bool need_unlock = false;
if (in6p->in6p_af != AF_INET6)
@@ -896,9 +896,9 @@ void
in6_pcbpurgeif(struct inpcbtable *table, struct ifnet *ifp)
{
struct rtentry *rt;
- struct inpcb_hdr *inph, *ninph;
+ struct inpcb_hdr *inph;
- TAILQ_FOREACH_SAFE(inph, &table->inpt_queue, inph_queue, ninph) {
+ TAILQ_FOREACH(inph, &table->inpt_queue, inph_queue) {
struct in6pcb *in6p = (struct in6pcb *)inph;
if (in6p->in6p_af != AF_INET6)
continue;