Commit fc7be130 authored by Al Viro's avatar Al Viro

vfs: switch pnode.h macros to struct mount *

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 863d684f
......@@ -716,9 +716,9 @@ static struct mount *clone_mnt(struct mount *old, struct dentry *root,
if (flag & CL_SLAVE) {
list_add(&mnt->mnt_slave, &old->mnt_slave_list);
mnt->mnt_master = old;
CLEAR_MNT_SHARED(&mnt->mnt);
CLEAR_MNT_SHARED(mnt);
} else if (!(flag & CL_PRIVATE)) {
if ((flag & CL_MAKE_SHARED) || IS_MNT_SHARED(&old->mnt))
if ((flag & CL_MAKE_SHARED) || IS_MNT_SHARED(old))
list_add(&mnt->mnt_share, &old->mnt_share);
if (IS_MNT_SLAVE(old))
list_add(&mnt->mnt_slave, &old->mnt_slave);
......@@ -1050,7 +1050,7 @@ static int show_mountinfo(struct seq_file *m, void *v)
show_mnt_opts(m, mnt);
/* Tagged fields ("foo:X" or "bar") */
if (IS_MNT_SHARED(mnt))
if (IS_MNT_SHARED(r))
seq_printf(m, " shared:%i", r->mnt_group_id);
if (IS_MNT_SLAVE(r)) {
int master = r->mnt_master->mnt_group_id;
......@@ -1059,7 +1059,7 @@ static int show_mountinfo(struct seq_file *m, void *v)
if (dom && dom != master)
seq_printf(m, " propagate_from:%i", dom);
}
if (IS_MNT_UNBINDABLE(mnt))
if (IS_MNT_UNBINDABLE(r))
seq_puts(m, " unbindable");
/* Filesystem specific data */
......@@ -1421,7 +1421,7 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
struct mount *res, *p, *q, *r;
struct path path;
if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&mnt->mnt))
if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(mnt))
return NULL;
res = q = clone_mnt(mnt, dentry, flag);
......@@ -1436,7 +1436,7 @@ struct mount *copy_tree(struct mount *mnt, struct dentry *dentry,
continue;
for (s = r; s; s = next_mnt(s, &r->mnt)) {
if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(&s->mnt)) {
if (!(flag & CL_COPY_ALL) && IS_MNT_UNBINDABLE(s)) {
s = skip_mnt_tree(s);
continue;
}
......@@ -1509,7 +1509,7 @@ static void cleanup_group_ids(struct mount *mnt, struct mount *end)
struct mount *p;
for (p = mnt; p != end; p = next_mnt(p, &mnt->mnt)) {
if (p->mnt_group_id && !IS_MNT_SHARED(&p->mnt))
if (p->mnt_group_id && !IS_MNT_SHARED(p))
mnt_release_group_id(p);
}
}
......@@ -1519,7 +1519,7 @@ static int invent_group_ids(struct mount *mnt, bool recurse)
struct mount *p;
for (p = mnt; p; p = recurse ? next_mnt(p, &mnt->mnt) : NULL) {
if (!p->mnt_group_id && !IS_MNT_SHARED(&p->mnt)) {
if (!p->mnt_group_id && !IS_MNT_SHARED(p)) {
int err = mnt_alloc_group_id(p);
if (err) {
cleanup_group_ids(mnt, p);
......@@ -1603,7 +1603,7 @@ static int attach_recursive_mnt(struct mount *source_mnt,
struct mount *child, *p;
int err;
if (IS_MNT_SHARED(&dest_mnt->mnt)) {
if (IS_MNT_SHARED(dest_mnt)) {
err = invent_group_ids(source_mnt, true);
if (err)
goto out;
......@@ -1614,7 +1614,7 @@ static int attach_recursive_mnt(struct mount *source_mnt,
br_write_lock(vfsmount_lock);
if (IS_MNT_SHARED(&dest_mnt->mnt)) {
if (IS_MNT_SHARED(dest_mnt)) {
for (p = source_mnt; p; p = next_mnt(p, &source_mnt->mnt))
set_mnt_shared(p);
}
......@@ -1636,7 +1636,7 @@ static int attach_recursive_mnt(struct mount *source_mnt,
return 0;
out_cleanup_ids:
if (IS_MNT_SHARED(&dest_mnt->mnt))
if (IS_MNT_SHARED(dest_mnt))
cleanup_group_ids(source_mnt, NULL);
out:
return err;
......@@ -1764,7 +1764,7 @@ static int do_loopback(struct path *path, char *old_name,
old = real_mount(old_path.mnt);
err = -EINVAL;
if (IS_MNT_UNBINDABLE(old_path.mnt))
if (IS_MNT_UNBINDABLE(old))
goto out2;
if (!check_mnt(real_mount(path->mnt)) || !check_mnt(old))
......@@ -1859,7 +1859,7 @@ static inline int tree_contains_unbindable(struct mount *mnt)
{
struct mount *p;
for (p = mnt; p; p = next_mnt(p, &mnt->mnt)) {
if (IS_MNT_UNBINDABLE(&p->mnt))
if (IS_MNT_UNBINDABLE(p))
return 1;
}
return 0;
......@@ -1884,9 +1884,10 @@ static int do_move_mount(struct path *path, char *old_name)
goto out;
old = real_mount(old_path.mnt);
p = real_mount(path->mnt);
err = -EINVAL;
if (!check_mnt(real_mount(path->mnt)) || !check_mnt(old))
if (!check_mnt(p) || !check_mnt(old))
goto out1;
if (d_unlinked(path->dentry))
......@@ -1905,17 +1906,16 @@ static int do_move_mount(struct path *path, char *old_name)
/*
* Don't move a mount residing in a shared parent.
*/
if (IS_MNT_SHARED(&old->mnt_parent->mnt))
if (IS_MNT_SHARED(old->mnt_parent))
goto out1;
/*
* Don't move a mount tree containing unbindable mounts to a destination
* mount which is shared.
*/
if (IS_MNT_SHARED(path->mnt) &&
tree_contains_unbindable(old))
if (IS_MNT_SHARED(p) && tree_contains_unbindable(old))
goto out1;
err = -ELOOP;
for (p = real_mount(path->mnt); mnt_has_parent(p); p = p->mnt_parent)
for (; mnt_has_parent(p); p = p->mnt_parent)
if (p == old)
goto out1;
......@@ -2643,9 +2643,9 @@ SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
error = -EINVAL;
new_mnt = real_mount(new.mnt);
root_mnt = real_mount(root.mnt);
if (IS_MNT_SHARED(old.mnt) ||
IS_MNT_SHARED(&new_mnt->mnt_parent->mnt) ||
IS_MNT_SHARED(&root_mnt->mnt_parent->mnt))
if (IS_MNT_SHARED(real_mount(old.mnt)) ||
IS_MNT_SHARED(new_mnt->mnt_parent) ||
IS_MNT_SHARED(root_mnt->mnt_parent))
goto out4;
if (!check_mnt(root_mnt) || !check_mnt(new_mnt))
goto out4;
......
......@@ -82,7 +82,7 @@ static int do_make_slave(struct mount *mnt)
if (peer_mnt == mnt)
peer_mnt = NULL;
}
if (IS_MNT_SHARED(&mnt->mnt) && list_empty(&mnt->mnt_share))
if (IS_MNT_SHARED(mnt) && list_empty(&mnt->mnt_share))
mnt_release_group_id(mnt);
list_del_init(&mnt->mnt_share);
......@@ -107,7 +107,7 @@ static int do_make_slave(struct mount *mnt)
}
}
mnt->mnt_master = master;
CLEAR_MNT_SHARED(&mnt->mnt);
CLEAR_MNT_SHARED(mnt);
return 0;
}
......@@ -199,7 +199,7 @@ static struct mount *get_source(struct mount *dest,
/* slave of the earlier, then */
*type = CL_SLAVE;
/* beginning of peer group among the slaves? */
if (IS_MNT_SHARED(&dest->mnt))
if (IS_MNT_SHARED(dest))
*type |= CL_MAKE_SHARED;
return last_src;
}
......
......@@ -11,11 +11,11 @@
#include <linux/list.h>
#include "mount.h"
#define IS_MNT_SHARED(mnt) ((mnt)->mnt_flags & MNT_SHARED)
#define IS_MNT_SLAVE(mnt) ((mnt)->mnt_master)
#define IS_MNT_NEW(mnt) (!(mnt)->mnt_ns)
#define CLEAR_MNT_SHARED(mnt) ((mnt)->mnt_flags &= ~MNT_SHARED)
#define IS_MNT_UNBINDABLE(mnt) ((mnt)->mnt_flags & MNT_UNBINDABLE)
#define IS_MNT_SHARED(m) ((m)->mnt.mnt_flags & MNT_SHARED)
#define IS_MNT_SLAVE(m) ((m)->mnt_master)
#define IS_MNT_NEW(m) (!(m)->mnt_ns)
#define CLEAR_MNT_SHARED(m) ((m)->mnt.mnt_flags &= ~MNT_SHARED)
#define IS_MNT_UNBINDABLE(m) ((m)->mnt.mnt_flags & MNT_UNBINDABLE)
#define CL_EXPIRE 0x01
#define CL_SLAVE 0x02
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment