Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/osf1 Switch osf1_sys_getfsstat() to mountlist ite...



details:   https://anonhg.NetBSD.org/src/rev/3606144a861a
branches:  trunk
changeset: 352870:3606144a861a
user:      hannken <hannken%NetBSD.org@localhost>
date:      Thu Apr 13 09:17:55 2017 +0000

description:
Switch osf1_sys_getfsstat() to mountlist iterator.
Compile tested only.

diffstat:

 sys/compat/osf1/osf1_mount.c |  22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diffs (64 lines):

diff -r 7336b93f7f22 -r 3606144a861a sys/compat/osf1/osf1_mount.c
--- a/sys/compat/osf1/osf1_mount.c      Thu Apr 13 07:58:45 2017 +0000
+++ b/sys/compat/osf1/osf1_mount.c      Thu Apr 13 09:17:55 2017 +0000
@@ -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 @@
 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 @@
 
        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_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



Home | Main Index | Thread Index | Old Index