Switch procfs_domounts() to mountlist iterator.
This commit is contained in:
parent
cb023de545
commit
769f0c92c9
|
@ -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 proc *p,
|
|||
{
|
||||
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,
|
||||
|
|
Loading…
Reference in New Issue