Module Name: src
Committed By: hannken
Date: Thu Apr 13 09:54:18 UTC 2017
Modified Files:
src/sys/miscfs/procfs: procfs_linux.c
Log Message:
Switch procfs_domounts() to mountlist iterator.
To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/miscfs/procfs/procfs_linux.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/miscfs/procfs/procfs_linux.c
diff -u src/sys/miscfs/procfs/procfs_linux.c:1.72 src/sys/miscfs/procfs/procfs_linux.c:1.73
--- src/sys/miscfs/procfs/procfs_linux.c:1.72 Mon Mar 28 17:23:47 2016
+++ src/sys/miscfs/procfs/procfs_linux.c Thu Apr 13 09:54:18 2017
@@ -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 @@ procfs_domounts(struct lwp *curl, struct
{
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,