Module Name: src Committed By: hannken Date: Thu Apr 13 09:17:55 UTC 2017
Modified Files: src/sys/compat/osf1: osf1_mount.c Log Message: Switch osf1_sys_getfsstat() to mountlist iterator. Compile tested only. To generate a diff of this commit: cvs rdiff -u -r1.53 -r1.54 src/sys/compat/osf1/osf1_mount.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/osf1/osf1_mount.c diff -u src/sys/compat/osf1/osf1_mount.c:1.53 src/sys/compat/osf1/osf1_mount.c:1.54 --- src/sys/compat/osf1/osf1_mount.c:1.53 Fri Oct 23 19:40:11 2015 +++ src/sys/compat/osf1/osf1_mount.c Thu Apr 13 09:17:55 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: osf1_mount.c,v 1.53 2015/10/23 19:40:11 maxv Exp $ */ +/* $NetBSD: osf1_mount.c,v 1.54 2017/04/13 09:17:55 hannken Exp $ */ /* * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. @@ -58,7 +58,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: osf1_mount.c,v 1.53 2015/10/23 19:40:11 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: osf1_mount.c,v 1.54 2017/04/13 09:17:55 hannken Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -132,7 +132,8 @@ osf1_sys_fstatfs(struct lwp *l, const st int osf1_sys_getfsstat(struct lwp *l, const struct osf1_sys_getfsstat_args *uap, register_t *retval) { - struct mount *mp, *nmp; + mount_iterator_t *iter; + struct mount *mp; struct statvfs *sp; struct osf1_statfs osfs; char *osf_sfsp; @@ -143,13 +144,9 @@ osf1_sys_getfsstat(struct lwp *l, const maxcount = SCARG(uap, bufsize) / sizeof(struct osf1_statfs); osf_sfsp = (void *)SCARG(uap, buf); - mutex_enter(&mountlist_lock); - for (count = 0, mp = TAILQ_FIRST(&mountlist); - mp != NULL; - mp = nmp) { - if (vfs_busy(mp, &nmp)) { - continue; - } + mountlist_iterator_init(&iter); + count = 0; + while ((mp = mountlist_iterator_next(iter)) != NULL) { if (osf_sfsp && count < maxcount) { sp = &mp->mnt_stat; /* @@ -164,16 +161,15 @@ osf1_sys_getfsstat(struct lwp *l, const osf1_cvt_statfs_from_native(sp, &osfs); if ((error = copyout(&osfs, osf_sfsp, sizeof (struct osf1_statfs)))) { - vfs_unbusy(mp, false, NULL); + mountlist_iterator_destroy(iter); return (error); } osf_sfsp += sizeof (struct osf1_statfs); } } count++; - vfs_unbusy(mp, false, &nmp); } - mutex_exit(&mountlist_lock); + mountlist_iterator_destroy(iter); if (osf_sfsp && count > maxcount) *retval = maxcount; else