summaryrefslogtreecommitdiff
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorJan Blunck <jblunck@suse.de>2008-02-15 06:34:39 +0300
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-15 08:13:33 +0300
commitac748a09fc873915254ed69fe83f1a95436ee30a (patch)
tree1544b5d5d71e1d4902a1e1255ef8703260a0150e /fs/namespace.c
parent6ac08c39a16f72c2d3e845cb6849a1392fa03e80 (diff)
downloadlinux-ac748a09fc873915254ed69fe83f1a95436ee30a.tar.xz
Make set_fs_{root,pwd} take a struct path
In nearly all cases the set_fs_{root,pwd}() calls work on a struct path. Change the function to reflect this and use path_get() here. Signed-off-by: Jan Blunck <jblunck@suse.de> Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index ac19212c9bc3..eef57635ee07 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1650,15 +1650,14 @@ out1:
* Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
* It can block. Requires the big lock held.
*/
-void set_fs_root(struct fs_struct *fs, struct vfsmount *mnt,
- struct dentry *dentry)
+void set_fs_root(struct fs_struct *fs, struct path *path)
{
struct path old_root;
write_lock(&fs->lock);
old_root = fs->root;
- fs->root.mnt = mntget(mnt);
- fs->root.dentry = dget(dentry);
+ fs->root = *path;
+ path_get(path);
write_unlock(&fs->lock);
if (old_root.dentry)
path_put(&old_root);
@@ -1668,15 +1667,14 @@ void set_fs_root(struct fs_struct *fs, struct vfsmount *mnt,
* Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values.
* It can block. Requires the big lock held.
*/
-void set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
- struct dentry *dentry)
+void set_fs_pwd(struct fs_struct *fs, struct path *path)
{
struct path old_pwd;
write_lock(&fs->lock);
old_pwd = fs->pwd;
- fs->pwd.mnt = mntget(mnt);
- fs->pwd.dentry = dget(dentry);
+ fs->pwd = *path;
+ path_get(path);
write_unlock(&fs->lock);
if (old_pwd.dentry)
@@ -1697,12 +1695,10 @@ static void chroot_fs_refs(struct nameidata *old_nd, struct nameidata *new_nd)
task_unlock(p);
if (fs->root.dentry == old_nd->path.dentry
&& fs->root.mnt == old_nd->path.mnt)
- set_fs_root(fs, new_nd->path.mnt,
- new_nd->path.dentry);
+ set_fs_root(fs, &new_nd->path);
if (fs->pwd.dentry == old_nd->path.dentry
&& fs->pwd.mnt == old_nd->path.mnt)
- set_fs_pwd(fs, new_nd->path.mnt,
- new_nd->path.dentry);
+ set_fs_pwd(fs, &new_nd->path);
put_fs_struct(fs);
} else
task_unlock(p);
@@ -1845,6 +1841,7 @@ static void __init init_mount_tree(void)
{
struct vfsmount *mnt;
struct mnt_namespace *ns;
+ struct path root;
mnt = do_kern_mount("rootfs", 0, "rootfs", NULL);
if (IS_ERR(mnt))
@@ -1863,8 +1860,11 @@ static void __init init_mount_tree(void)
init_task.nsproxy->mnt_ns = ns;
get_mnt_ns(ns);
- set_fs_pwd(current->fs, ns->root, ns->root->mnt_root);
- set_fs_root(current->fs, ns->root, ns->root->mnt_root);
+ root.mnt = ns->root;
+ root.dentry = ns->root->mnt_root;
+
+ set_fs_pwd(current->fs, &root);
+ set_fs_root(current->fs, &root);
}
void __init mnt_init(void)