Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/rpc.lockd use LIST_FOREACH macro.



details:   https://anonhg.NetBSD.org/src/rev/ddf7b818b2d9
branches:  trunk
changeset: 544202:ddf7b818b2d9
user:      yamt <yamt%NetBSD.org@localhost>
date:      Fri Mar 14 14:03:00 2003 +0000

description:
use LIST_FOREACH macro.

diffstat:

 usr.sbin/rpc.lockd/lockd_lock.c |  20 +++++++-------------
 1 files changed, 7 insertions(+), 13 deletions(-)

diffs (69 lines):

diff -r 87c4c3e0f527 -r ddf7b818b2d9 usr.sbin/rpc.lockd/lockd_lock.c
--- a/usr.sbin/rpc.lockd/lockd_lock.c   Fri Mar 14 13:53:08 2003 +0000
+++ b/usr.sbin/rpc.lockd/lockd_lock.c   Fri Mar 14 14:03:00 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lockd_lock.c,v 1.13 2003/03/14 13:53:08 yamt Exp $     */
+/*     $NetBSD: lockd_lock.c,v 1.14 2003/03/14 14:03:00 yamt Exp $     */
 
 /*
  * Copyright (c) 2000 Manuel Bouyer.
@@ -115,8 +115,7 @@
 
        siglock();
        /* search through the list for lock holder */
-       for (fl = LIST_FIRST(&lcklst_head); fl != NULL;
-           fl = LIST_NEXT(fl, lcklst)) {
+       LIST_FOREACH(fl, &lcklst_head, lcklst) {
                if (fl->status != LKST_LOCKED)
                        continue;
                if (memcmp(&fl->filehandle, &filehandle, sizeof(filehandle)))
@@ -198,8 +197,7 @@
        newfl->flags = flags;
        siglock();
        /* look for a lock rq from this host for this fh */
-       for (fl = LIST_FIRST(&lcklst_head); fl != NULL;
-           fl = LIST_NEXT(fl, lcklst)) {
+       LIST_FOREACH(fl, &lcklst_head, lcklst) {
                if (memcmp(&newfl->filehandle, &fl->filehandle,
                    sizeof(fhandle_t)) == 0) {
                        if (strcmp(newfl->client_name, fl->client_name) == 0 &&
@@ -283,8 +281,7 @@
 
        memcpy(&filehandle, lck->fh.n_bytes, sizeof(fhandle_t));
        siglock();
-       for (fl = LIST_FIRST(&lcklst_head); fl != NULL;
-           fl = LIST_NEXT(fl, lcklst)) {
+       LIST_FOREACH(fl, &lcklst_head, lcklst) {
                if (strcmp(fl->client_name, lck->caller_name) ||
                    memcmp(&filehandle, &fl->filehandle, sizeof(fhandle_t)) ||
                    fl->client.oh.n_len != lck->oh.n_len ||
@@ -364,8 +361,7 @@
                 * if we're here we have a child that exited
                 * Find the associated file_lock.
                 */
-               for (fl = LIST_FIRST(&lcklst_head); fl != NULL;
-                   fl = LIST_NEXT(fl, lcklst)) {
+               LIST_FOREACH(fl, &lcklst_head, lcklst) {
                        if (pid == fl->locker)
                                break;
                }
@@ -619,8 +615,7 @@
        LIST_REMOVE(rfl, lcklst);
 
        /* process the next LKST_WAITING lock request for this fh */
-       for (fl = LIST_FIRST(&lcklst_head); fl != NULL;
-            fl = LIST_NEXT(fl, lcklst)) {
+       LIST_FOREACH(fl, &lcklst_head, lcklst) {
                if (fl->status != LKST_WAITING ||
                    memcmp(&rfl->filehandle, &fl->filehandle,
                    sizeof(fhandle_t)) != 0)
@@ -682,8 +677,7 @@
        struct sm_stat_res res;
        int retval;
 
-       for (hp = LIST_FIRST(&hostlst_head); hp != NULL;
-           hp = LIST_NEXT(hp, hostlst)) {
+       LIST_FOREACH(hp, &hostlst_head, hostlst) {
                if (strcmp(hostname, hp->name) == 0) {
                        /* already monitored, just bump refcnt */
                        hp->refcnt++;



Home | Main Index | Thread Index | Old Index