summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_mount.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/vfs_mount.c')
-rw-r--r--sys/kern/vfs_mount.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index c3fc5dc..fc39a6b 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1601,3 +1601,30 @@ vfs_copyopt(opts, name, dest, len)
}
return (ENOENT);
}
+
+
+/*
+ * This is a helper function for filesystems to traverse their
+ * vnodes. See MNT_VNODE_FOREACH() in sys/mount.h
+ */
+
+struct vnode *
+__mnt_vnode_next(struct vnode **nvp, struct mount *mp)
+{
+ struct vnode *vp;
+
+ mtx_assert(&mp->mnt_mtx, MA_OWNED);
+ vp = *nvp;
+ /* Check if we are done */
+ if (vp == NULL)
+ return (NULL);
+ /* If our next vnode is no longer ours, start over */
+ if (vp->v_mount != mp)
+ vp = TAILQ_FIRST(&mp->mnt_nvnodelist);
+ /* Save pointer to next vnode in list */
+ if (vp != NULL)
+ *nvp = TAILQ_NEXT(vp, v_nmntvnodes);
+ else
+ *nvp = NULL;
+ return (vp);
+}
OpenPOWER on IntegriCloud