Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netatalk atalk(4): Don't abuse queue(9) internals.



details:   https://anonhg.NetBSD.org/src/rev/b598f4c6bbfb
branches:  trunk
changeset: 374066:b598f4c6bbfb
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Thu Mar 30 11:21:08 2023 +0000

description:
atalk(4): Don't abuse queue(9) internals.

diffstat:

 sys/netatalk/at_control.c |  22 +++++++++++-----------
 sys/netatalk/ddp_input.c  |  12 +++++-------
 2 files changed, 16 insertions(+), 18 deletions(-)

diffs (146 lines):

diff -r c9cdb67cd9b1 -r b598f4c6bbfb sys/netatalk/at_control.c
--- a/sys/netatalk/at_control.c Thu Mar 30 11:02:15 2023 +0000
+++ b/sys/netatalk/at_control.c Thu Mar 30 11:21:08 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: at_control.c,v 1.42 2021/09/21 15:01:59 christos Exp $  */
+/*     $NetBSD: at_control.c,v 1.43 2023/03/30 11:21:08 riastradh Exp $         */
 
 /*
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.42 2021/09/21 15:01:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.43 2023/03/30 11:21:08 riastradh Exp $");
 
 #include "opt_atalk.h"
 
@@ -88,7 +88,7 @@ at_control(u_long cmd, void *data, struc
          * If we have an ifp, then find the matching at_ifaddr if it exists
          */
        if (ifp)
-               for (aa = at_ifaddr.tqh_first; aa; aa = aa->aa_list.tqe_next)
+               TAILQ_FOREACH(aa, &at_ifaddr, aa_list)
                        if (aa->aa_ifp == ifp)
                                break;
 
@@ -109,7 +109,7 @@ at_control(u_long cmd, void *data, struc
                 * NEXT interface!
                 */
                if (ifra->ifra_addr.sat_family == AF_APPLETALK) {
-                       for (; aa; aa = aa->aa_list.tqe_next)
+                       for (; aa; aa = TAILQ_NEXT(aa, aa_list))
                                if (aa->aa_ifp == ifp &&
                                    sateqaddr(&aa->aa_addr, &ifra->ifra_addr))
                                        break;
@@ -141,7 +141,7 @@ at_control(u_long cmd, void *data, struc
                         * This may leave aa pointing to the first address on
                         * the NEXT interface!
                         */
-                       for (; aa; aa = aa->aa_list.tqe_next) {
+                       for (; aa; aa = TAILQ_NEXT(aa, aa_list)) {
                                if (aa->aa_ifp == ifp &&
                                    (aa->aa_flags & AFA_PHASE2) == 0)
                                        break;
@@ -152,7 +152,7 @@ at_control(u_long cmd, void *data, struc
                         * This may leave aa pointing to the first address on
                         * the NEXT interface!
                         */
-                       for (; aa; aa = aa->aa_list.tqe_next) {
+                       for (; aa; aa = TAILQ_NEXT(aa, aa_list)) {
                                if (aa->aa_ifp == ifp &&
                                    (aa->aa_flags & AFA_PHASE2))
                                        break;
@@ -177,7 +177,7 @@ at_control(u_long cmd, void *data, struc
 
                        callout_init(&aa->aa_probe_ch, 0);
 
-                       if ((aa0 = at_ifaddr.tqh_first) != NULL) {
+                       if ((aa0 = TAILQ_FIRST(&at_ifaddr)) != NULL) {
                                /*
                                 * Don't let the loopback be first, since the
                                 * first address is the machine's default
@@ -245,7 +245,7 @@ at_control(u_long cmd, void *data, struc
                         * If the request is specifying phase 1, then
                         * only look at a phase one address
                         */
-                       for (; aa; aa = aa->aa_list.tqe_next) {
+                       for (; aa; aa = TAILQ_NEXT(aa, aa_list)) {
                                if (aa->aa_ifp == ifp &&
                                    (aa->aa_flags & AFA_PHASE2) == 0)
                                        break;
@@ -255,7 +255,7 @@ at_control(u_long cmd, void *data, struc
                         * If the request is specifying phase 2, then
                         * only look at a phase two address
                         */
-                       for (; aa; aa = aa->aa_list.tqe_next) {
+                       for (; aa; aa = TAILQ_NEXT(aa, aa_list)) {
                                if (aa->aa_ifp == ifp &&
                                    (aa->aa_flags & AFA_PHASE2))
                                        break;
@@ -264,7 +264,7 @@ at_control(u_long cmd, void *data, struc
                        /*
                         * default to everything
                         */
-                       for (; aa; aa = aa->aa_list.tqe_next) {
+                       for (; aa; aa = TAILQ_NEXT(aa, aa_list)) {
                                if (aa->aa_ifp == ifp)
                                        break;
                        }
@@ -682,7 +682,7 @@ at_broadcast(const struct sockaddr_at *s
        /*
          * failing that, if the net is one we have, it's a broadcast as well.
          */
-       for (aa = at_ifaddr.tqh_first; aa; aa = aa->aa_list.tqe_next) {
+       TAILQ_FOREACH(aa, &at_ifaddr, aa_list) {
                if ((aa->aa_ifp->if_flags & IFF_BROADCAST)
                    && (ntohs(sat->sat_addr.s_net) >= ntohs(aa->aa_firstnet)
                  && ntohs(sat->sat_addr.s_net) <= ntohs(aa->aa_lastnet)))
diff -r c9cdb67cd9b1 -r b598f4c6bbfb sys/netatalk/ddp_input.c
--- a/sys/netatalk/ddp_input.c  Thu Mar 30 11:02:15 2023 +0000
+++ b/sys/netatalk/ddp_input.c  Thu Mar 30 11:21:08 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ddp_input.c,v 1.33 2022/09/03 02:48:00 thorpej Exp $    */
+/*     $NetBSD: ddp_input.c,v 1.34 2023/03/30 11:21:08 riastradh Exp $  */
 
 /*
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ddp_input.c,v 1.33 2022/09/03 02:48:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddp_input.c,v 1.34 2023/03/30 11:21:08 riastradh Exp $");
 #include "opt_atalk.h"
 
 #include <sys/param.h>
@@ -163,7 +163,7 @@ ddp_input(struct mbuf *m, struct ifnet *
                from.sat_addr.s_node = elh->el_snode;
                from.sat_port = ddps.dsh_sport;
 
-               for (aa = at_ifaddr.tqh_first; aa; aa = aa->aa_list.tqe_next) {
+               TAILQ_FOREACH(aa, &at_ifaddr, aa_list) {
                        if (aa->aa_ifp == ifp &&
                            (aa->aa_flags & AFA_PHASE2) == 0 &&
                            (AA_SAT(aa)->sat_addr.s_node ==
@@ -199,8 +199,7 @@ ddp_input(struct mbuf *m, struct ifnet *
                to.sat_port = ddpe.deh_dport;
 
                if (to.sat_addr.s_net == ATADDR_ANYNET) {
-                       for (aa = at_ifaddr.tqh_first; aa;
-                           aa = aa->aa_list.tqe_next) {
+                       TAILQ_FOREACH(aa, &at_ifaddr, aa_list) {
                                if (phase == 1 && (aa->aa_flags & AFA_PHASE2))
                                        continue;
 
@@ -216,8 +215,7 @@ ddp_input(struct mbuf *m, struct ifnet *
                                        break;
                        }
                } else {
-                       for (aa = at_ifaddr.tqh_first; aa;
-                           aa = aa->aa_list.tqe_next) {
+                       TAILQ_FOREACH(aa, &at_ifaddr, aa_list) {
                                if (to.sat_addr.s_net == aa->aa_firstnet &&
                                    to.sat_addr.s_node == 0)
                                        break;



Home | Main Index | Thread Index | Old Index