diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2000-04-28 01:09:25 +0000 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2000-04-28 01:09:25 +0000 |
commit | b9ba7aeb165cffecdffb60aec8c3fa8d590d9ca9 (patch) | |
tree | 42d07b0c7246ae2536a702e7c5de9e2732341116 /include/linux/fs_struct.h | |
parent | 7406b0a326f2d70ade2671c37d1beef62249db97 (diff) |
Merge with 2.3.99-pre6.
Diffstat (limited to 'include/linux/fs_struct.h')
-rw-r--r-- | include/linux/fs_struct.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h new file mode 100644 index 000000000..e9c32f386 --- /dev/null +++ b/include/linux/fs_struct.h @@ -0,0 +1,59 @@ +#ifndef _LINUX_FS_STRUCT_H +#define _LINUX_FS_STRUCT_H +#ifdef __KERNEL__ + +struct fs_struct { + atomic_t count; + int umask; + struct dentry * root, * pwd, * altroot; + struct vfsmount * rootmnt, * pwdmnt, * altrootmnt; +}; + +#define INIT_FS { \ + ATOMIC_INIT(1), \ + 0022, \ + NULL, NULL, NULL, NULL, NULL, NULL \ +} + +extern void exit_fs(struct task_struct *); +extern void set_fs_altroot(void); + +/* + * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values. + * It can block. Requires the big lock held. + */ + +static inline void set_fs_root(struct fs_struct *fs, + struct vfsmount *mnt, + struct dentry *dentry) +{ + struct dentry *old_root = fs->root; + struct vfsmount *old_rootmnt = fs->rootmnt; + fs->rootmnt = mntget(mnt); + fs->root = dget(dentry); + 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. + */ + +static inline void set_fs_pwd(struct fs_struct *fs, + struct vfsmount *mnt, + struct dentry *dentry) +{ + struct dentry *old_pwd = fs->pwd; + struct vfsmount *old_pwdmnt = fs->pwdmnt; + fs->pwdmnt = mntget(mnt); + fs->pwd = dget(dentry); + dput(old_pwd); + mntput(old_pwdmnt); +} + +struct fs_struct *copy_fs_struct(struct fs_struct *old); +void put_fs_struct(struct fs_struct *fs); + +#endif +#endif |