More Makefile cleanups, otherwise mainly noticeable are the netfilter fix
[davej-history.git] / include / linux / fs_struct.h
blob3d2df3cf4202b676a7b58535dad9784eaec08869
1 #ifndef _LINUX_FS_STRUCT_H
2 #define _LINUX_FS_STRUCT_H
3 #ifdef __KERNEL__
5 struct fs_struct {
6 atomic_t count;
7 rwlock_t lock;
8 int umask;
9 struct dentry * root, * pwd, * altroot;
10 struct vfsmount * rootmnt, * pwdmnt, * altrootmnt;
13 #define INIT_FS { \
14 ATOMIC_INIT(1), \
15 RW_LOCK_UNLOCKED, \
16 0022, \
17 NULL, NULL, NULL, NULL, NULL, NULL \
20 extern void exit_fs(struct task_struct *);
21 extern void set_fs_altroot(void);
24 * Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
25 * It can block. Requires the big lock held.
28 static inline void set_fs_root(struct fs_struct *fs,
29 struct vfsmount *mnt,
30 struct dentry *dentry)
32 struct dentry *old_root;
33 struct vfsmount *old_rootmnt;
34 write_lock(&fs->lock);
35 old_root = fs->root;
36 old_rootmnt = fs->rootmnt;
37 fs->rootmnt = mntget(mnt);
38 fs->root = dget(dentry);
39 write_unlock(&fs->lock);
40 if (old_root) {
41 dput(old_root);
42 mntput(old_rootmnt);
47 * Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values.
48 * It can block. Requires the big lock held.
51 static inline void set_fs_pwd(struct fs_struct *fs,
52 struct vfsmount *mnt,
53 struct dentry *dentry)
55 struct dentry *old_pwd;
56 struct vfsmount *old_pwdmnt;
57 write_lock(&fs->lock);
58 old_pwd = fs->pwd;
59 old_pwdmnt = fs->pwdmnt;
60 fs->pwdmnt = mntget(mnt);
61 fs->pwd = dget(dentry);
62 write_unlock(&fs->lock);
63 if (old_pwd) {
64 dput(old_pwd);
65 mntput(old_pwdmnt);
69 struct fs_struct *copy_fs_struct(struct fs_struct *old);
70 void put_fs_struct(struct fs_struct *fs);
72 #endif
73 #endif