summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-01-31 04:51:25 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2010-03-03 20:07:57 +0100
commit1f707137b55764740981d022d29c622832a61880 (patch)
treeaf5f72ea7df1afbc1f3b5bb53a3ab3d8ebaae1e0 /fs
parentfix NFS4 handling of mountpoint stat (diff)
downloadlinux-1f707137b55764740981d022d29c622832a61880.tar.xz
linux-1f707137b55764740981d022d29c622832a61880.zip
new helper: iterate_mounts()
apply function to vfsmounts in set returned by collect_mounts(), stop if it returns non-zero. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/namespace.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index d25d4602ab50..d5906c19e08e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1246,6 +1246,21 @@ void drop_collected_mounts(struct vfsmount *mnt)
release_mounts(&umount_list);
}
+int iterate_mounts(int (*f)(struct vfsmount *, void *), void *arg,
+ struct vfsmount *root)
+{
+ struct vfsmount *mnt;
+ int res = f(root, arg);
+ if (res)
+ return res;
+ list_for_each_entry(mnt, &root->mnt_list, mnt_list) {
+ res = f(mnt, arg);
+ if (res)
+ return res;
+ }
+ return 0;
+}
+
static void cleanup_group_ids(struct vfsmount *mnt, struct vfsmount *end)
{
struct vfsmount *p;