diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-10-15 18:33:52 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-10-15 18:33:52 +0000 |
commit | 686681a48f738d9e220062ffd4127694c02d7dbd (patch) | |
tree | 38d0d4a0c39d2fe03b6e6bf137c9e7723df36598 /usr.sbin | |
parent | ea9a8b68b4d0303dbe4709462ab6801b42082163 (diff) |
Use queue macros instead of directly accessing fields. ok miod@ pat@ millert@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/pstat/pstat.c | 20 | ||||
-rw-r--r-- | usr.sbin/ypserv/ypserv/ypserv_db.c | 10 |
2 files changed, 16 insertions, 14 deletions
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c index 18e2ab5fbf8..2be43508307 100644 --- a/usr.sbin/pstat/pstat.c +++ b/usr.sbin/pstat/pstat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pstat.c,v 1.52 2005/05/26 01:45:02 pedro Exp $ */ +/* $OpenBSD: pstat.c,v 1.53 2005/10/15 18:33:51 otto Exp $ */ /* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */ /*- @@ -40,7 +40,7 @@ static char copyright[] = #if 0 from: static char sccsid[] = "@(#)pstat.c 8.9 (Berkeley) 2/16/94"; #else -static char *rcsid = "$OpenBSD: pstat.c,v 1.52 2005/05/26 01:45:02 pedro Exp $"; +static char *rcsid = "$OpenBSD: pstat.c,v 1.53 2005/10/15 18:33:51 otto Exp $"; #endif #endif /* not lint */ @@ -705,10 +705,11 @@ kinfo_vnodes(int *avnodes) evbuf = vbuf + (numvnodes + 20) * (sizeof(struct vnode *) + sizeof(struct vnode)); KGET(V_MOUNTLIST, mountlist); - for (num = 0, mp = mountlist.cqh_first; ; mp = mount.mnt_list.cqe_next) { + for (num = 0, mp = CIRCLEQ_FIRST(&mountlist); ; + mp = CIRCLEQ_NEXT(&mount, mnt_list)) { KGET2(mp, &mount, sizeof(mount), "mount entry"); - for (vp = mount.mnt_vnodelist.lh_first; - vp != NULL; vp = vnode.v_mntvnodes.le_next) { + for (vp = LIST_FIRST(&mount.mnt_vnodelist); + vp != NULL; vp = LIST_NEXT(&vnode, v_mntvnodes)) { KGET2(vp, &vnode, sizeof(vnode), "vnode"); if ((bp + sizeof(struct vnode *) + sizeof(struct vnode)) > evbuf) @@ -720,7 +721,7 @@ kinfo_vnodes(int *avnodes) bp += sizeof(struct vnode); num++; } - if (mp == mountlist.cqh_last) + if (mp == CIRCLEQ_LAST(&mountlist)) break; } *avnodes = num; @@ -780,7 +781,8 @@ ttymode(void) free(itp); } else { KGET(TTY_TTYLIST, tty_head); - for (tp = tty_head.tqh_first; tp; tp = tty.tty_link.tqe_next) { + for (tp = TAILQ_FIRST(&tty_head); tp; + tp = TAILQ_NEXT(&tty, tty_link)) { KGET2(tp, &tty, sizeof tty, "tty struct"); tty2itty(&tty, &itty); ttyprt(&itty); @@ -892,7 +894,7 @@ filemode(void) * structure, and then an array of file structs (whose addresses are * derivable from the previous entry). */ - addr = ((struct filelist *)buf)->lh_first; + addr = LIST_FIRST((struct filelist *)buf); ffp = (struct file *)(buf + sizeof(struct filelist)); nfile = (len - sizeof(struct filelist)) / sizeof(struct file); @@ -900,7 +902,7 @@ filemode(void) (void)printf("%*s TYPE FLG CNT MSG %*s OFFSET\n", 8, "LOC", 8, "DATA"); - for (; (char *)ffp < buf + len; addr = ffp->f_list.le_next, ffp++) { + for (; (char *)ffp < buf + len; addr = LIST_NEXT(ffp, f_list), ffp++) { memmove(&fp, ffp, sizeof fp); if ((unsigned)fp.f_type > DTYPE_SOCKET) continue; diff --git a/usr.sbin/ypserv/ypserv/ypserv_db.c b/usr.sbin/ypserv/ypserv/ypserv_db.c index 79d6dd5b98b..d8e36f0ff0e 100644 --- a/usr.sbin/ypserv/ypserv/ypserv_db.c +++ b/usr.sbin/ypserv/ypserv/ypserv_db.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ypserv_db.c,v 1.20 2003/07/15 06:10:46 deraadt Exp $ */ +/* $OpenBSD: ypserv_db.c,v 1.21 2005/10/15 18:33:51 otto Exp $ */ /* * Copyright (c) 1994 Mats O Jansson <moj@stacken.kth.se> @@ -34,7 +34,7 @@ */ #ifndef LINT -static const char rcsid[] = "$OpenBSD: ypserv_db.c,v 1.20 2003/07/15 06:10:46 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: ypserv_db.c,v 1.21 2005/10/15 18:33:51 otto Exp $"; #endif /* @@ -177,7 +177,7 @@ ypdb_close_all(void) #ifdef DEBUG yplog(" ypdb_close_all(): start"); #endif - while (maps.cqh_first != (void *)&maps) + while (!CIRCLEQ_EMPTY(&maps)) ypdb_close_last(); #ifdef DEBUG yplog(" ypdb_close_all(): done"); @@ -219,13 +219,13 @@ ypdb_open_db(domainname domain, mapname map, ypstat *status, /* * check for preloaded domain, map */ - for (d = doms.lh_first ; d != NULL ; d = d->domsl.le_next) { + LIST_FOREACH(d, &doms, domsl) { if (strcmp(domain, d->domain) == 0) break; } if (d) { - for (m = d->dmaps.lh_first ; m != NULL ; m = m->mapsl.le_next) + LIST_FOREACH(m, &d->dmaps, mapsl) if (strcmp(map, m->map) == 0) break; } |