Source-Changes-HG archive

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

[src/trunk]: src/sys/miscfs/procfs Switch procfs_domounts() to mountlist iter...



details:   https://anonhg.NetBSD.org/src/rev/697381d38d94
branches:  trunk
changeset: 823128:697381d38d94
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Apr 13 09:54:18 2017 +0000

description:
Switch procfs_domounts() to mountlist iterator.

diffstat:

 sys/miscfs/procfs/procfs_linux.c |  18 +++++++-----------
 1 files changed, 7 insertions(+), 11 deletions(-)

diffs (50 lines):

diff -r b55d04b47c8f -r 697381d38d94 sys/miscfs/procfs/procfs_linux.c
--- a/sys/miscfs/procfs/procfs_linux.c  Thu Apr 13 09:52:18 2017 +0000
+++ b/sys/miscfs/procfs/procfs_linux.c  Thu Apr 13 09:54:18 2017 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: procfs_linux.c,v 1.72 2016/03/28 17:23:47 mlelstv Exp $      */
+/*      $NetBSD: procfs_linux.c,v 1.73 2017/04/13 09:54:18 hannken Exp $      */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.72 2016/03/28 17:23:47 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_linux.c,v 1.73 2017/04/13 09:54:18 hannken Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -603,26 +603,22 @@
 {
        char *bf, *mtab = NULL;
        size_t mtabsz = 0;
-       struct mount *mp, *nmp;
+       mount_iterator_t *iter;
+       struct mount *mp;
        int error = 0, root = 0;
        struct cwdinfo *cwdi = curl->l_proc->p_cwdi;
 
        bf = malloc(LBFSZ, M_TEMP, M_WAITOK);
 
-       mutex_enter(&mountlist_lock);
-       for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) {
+       mountlist_iterator_init(&iter);
+       while ((mp = mountlist_iterator_next(iter)) != NULL) {
                struct statvfs sfs;
 
-               if (vfs_busy(mp, &nmp))
-                       continue;
-
                if ((error = dostatvfs(mp, &sfs, curl, MNT_WAIT, 0)) == 0)
                        root |= procfs_format_sfs(&mtab, &mtabsz, bf, LBFSZ,
                            &sfs, curl, 0);
-
-               vfs_unbusy(mp, false, &nmp);
        }
-       mutex_exit(&mountlist_lock);
+       mountlist_iterator_destroy(iter);
 
        /*
         * If we are inside a chroot that is not itself a mount point,



Home | Main Index | Thread Index | Old Index