Module Name: src
Committed By: hannken
Date: Thu Apr 13 09:46:59 UTC 2017
Modified Files:
src/sys/compat/netbsd32: netbsd32_compat_20.c
Log Message:
Switch compat_20_netbsd32_getfsstat() to mountlist iterator.
To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/netbsd32/netbsd32_compat_20.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/compat/netbsd32/netbsd32_compat_20.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_20.c:1.35 src/sys/compat/netbsd32/netbsd32_compat_20.c:1.36
--- src/sys/compat/netbsd32/netbsd32_compat_20.c:1.35 Tue Mar 28 18:44:04 2017
+++ src/sys/compat/netbsd32/netbsd32_compat_20.c Thu Apr 13 09:46:59 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_20.c,v 1.35 2017/03/28 18:44:04 chs Exp $ */
+/* $NetBSD: netbsd32_compat_20.c,v 1.36 2017/04/13 09:46:59 hannken Exp $ */
/*
* Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_20.c,v 1.35 2017/03/28 18:44:04 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_20.c,v 1.36 2017/04/13 09:46:59 hannken Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -85,7 +85,8 @@ compat_20_netbsd32_getfsstat(struct lwp
} */
int root = 0;
struct proc *p = l->l_proc;
- struct mount *mp, *nmp;
+ mount_iterator_t *iter;
+ struct mount *mp;
struct statvfs *sb;
struct netbsd32_statfs sb32;
void *sfsp;
@@ -95,32 +96,24 @@ compat_20_netbsd32_getfsstat(struct lwp
sb = STATVFSBUF_GET();
maxcount = SCARG(uap, bufsize) / sizeof(struct netbsd32_statfs);
sfsp = SCARG_P32(uap, buf);
- mutex_enter(&mountlist_lock);
+ mountlist_iterator_init(&iter);
count = 0;
- for (mp = TAILQ_FIRST(&mountlist); mp != NULL; mp = nmp) {
- if (vfs_busy(mp, &nmp)) {
- continue;
- }
+ while ((mp = mountlist_iterator_next(iter)) != NULL) {
if (sfsp && count < maxcount) {
error = dostatvfs(mp, sb, l, SCARG(uap, flags), 0);
if (error) {
- vfs_unbusy(mp, false, &nmp);
error = 0;
continue;
}
compat_20_netbsd32_from_statvfs(sb, &sb32);
error = copyout(&sb32, sfsp, sizeof(sb32));
- if (error) {
- vfs_unbusy(mp, false, NULL);
+ if (error)
goto out;
- }
sfsp = (char *)sfsp + sizeof(sb32);
root |= strcmp(sb->f_mntonname, "/") == 0;
}
count++;
- vfs_unbusy(mp, false, &nmp);
}
- mutex_exit(&mountlist_lock);
if (root == 0 && p->p_cwdi->cwdi_rdir) {
/*
@@ -144,6 +137,7 @@ compat_20_netbsd32_getfsstat(struct lwp
else
*retval = count;
out:
+ mountlist_iterator_destroy(iter);
STATVFSBUF_PUT(sb);
return error;
}