From 2d290eb69993401913e84de3f61008e35c921551 Mon Sep 17 00:00:00 2001 From: matt Date: Fri, 23 Aug 2002 20:50:25 +0000 Subject: [PATCH] Use the qtype_FOREACH macros. Print out address of hook that could not be disestablished. --- sys/kern/kern_subr.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index 308a4f24140d..4e7d93afa123 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_subr.c,v 1.82 2002/07/20 03:58:24 thorpej Exp $ */ +/* $NetBSD: kern_subr.c,v 1.83 2002/08/23 20:50:25 matt Exp $ */ /*- * Copyright (c) 1997, 1998, 1999, 2002 The NetBSD Foundation, Inc. @@ -90,7 +90,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.82 2002/07/20 03:58:24 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_subr.c,v 1.83 2002/08/23 20:50:25 matt Exp $"); #include "opt_ddb.h" #include "opt_md.h" @@ -408,11 +408,13 @@ hook_disestablish(list, vhook) #ifdef DIAGNOSTIC struct hook_desc *hd; - for (hd = list->lh_first; hd != NULL; hd = hd->hk_list.le_next) + LIST_FOREACH(hd, list, hk_list) { if (hd == vhook) break; + } + if (hd == NULL) - panic("hook_disestablish: hook not established"); + panic("hook_disestablish: hook %p not established", vhook); #endif LIST_REMOVE((struct hook_desc *)vhook, hk_list); free(vhook, M_DEVBUF); @@ -533,8 +535,7 @@ domountroothook() { struct hook_desc *hd; - for (hd = mountroothook_list.lh_first; hd != NULL; - hd = hd->hk_list.le_next) { + LIST_FOREACH(hd, &mountroothook_list, hk_list) { if (hd->hk_arg == (void *)root_device) { (*hd->hk_fn)(hd->hk_arg); return; @@ -641,7 +642,7 @@ powerhook_disestablish(vhook) CIRCLEQ_FOREACH(dp, &powerhook_list, sfd_list) if (dp == vhook) goto found; - panic("powerhook_disestablish: hook not established"); + panic("powerhook_disestablish: hook %p not established", vhook); found: #endif @@ -738,11 +739,11 @@ setroot(bootdv, bootpartition) if (vops != NULL && vops->vfs_mountroot == mountroot && rootspec == NULL && (bootdv == NULL || bootdv->dv_class != DV_IFNET)) { - for (ifp = ifnet.tqh_first; ifp != NULL; - ifp = ifp->if_list.tqe_next) + TAILQ_FOREACH(ifp, &ifnet, if_list) { if ((ifp->if_flags & (IFF_LOOPBACK|IFF_POINTOPOINT)) == 0) break; + } if (ifp == NULL) { /* * Can't find a suitable interface; ask the @@ -1099,8 +1100,7 @@ getdisk(str, len, defpart, devp, isdump) printf(" %s[a-%c]", raidrootdev[j].dv_xname, 'a' + MAXPARTITIONS - 1); #endif - for (dv = alldevs.tqh_first; dv != NULL; - dv = dv->dv_list.tqe_next) { + TAILQ_FOREACH(dv, &alldevs, dv_list) { if (dv->dv_class == DV_DISK) printf(" %s[a-%c]", dv->dv_xname, 'a' + MAXPARTITIONS - 1);