move mount.h out of fs_struct.h
PATCH 1/1 move mount.h out of fs_struct.h
It's only need for the two monster-inlines set_fs_root and set_fs_pwd that should better be out of line anyway. Some additional cleanup like named initializers as extra bonus.
fs/namespace.c +48 -0
@@ -879,6 +879,54 @@ out1:free_page (type_page);return retval; +} + +/* +* 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) +{ +struct dentry *old_root; +struct vfsmount *old_rootmnt; +write_lock (&fs->lock); +spin_lock (&dcache_lock); + old_root = fs->root; + old_rootmnt = fs->rootmnt; + fs->rootmnt =mntget (mnt); + fs->root =dget (dentry); +spin_unlock (&dcache_lock); +write_unlock (&fs->lock); +if (old_root) { +dput (old_root); +mntput (old_rootmnt); + } +} + +/* +* 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) +{ +struct dentry *old_pwd; +struct vfsmount *old_pwdmnt; + +write_lock (&fs->lock); +spin_lock (&dcache_lock); + old_pwd = fs->pwd; + old_pwdmnt = fs->pwdmnt; + fs->pwdmnt =mntget (mnt); + fs->pwd =dget (dentry); +spin_unlock (&dcache_lock); +write_unlock (&fs->lock); + +if (old_pwd) { +dput (old_pwd); +mntput (old_pwdmnt); + } }static void chroot_fs_refs (struct nameidata *old_nd,struct nameidata *new_nd)
include/linux/fs_struct.h +11 -63
88 lines not on this page · raw message