]> bbs.cooldavid.org Git - net-next-2.6.git/blame - include/linux/fs_struct.h
fs: fs_struct rwlock to spinlock
[net-next-2.6.git] / include / linux / fs_struct.h
CommitLineData
1da177e4
LT
1#ifndef _LINUX_FS_STRUCT_H
2#define _LINUX_FS_STRUCT_H
3
6ac08c39 4#include <linux/path.h>
1da177e4
LT
5
6struct fs_struct {
498052bb 7 int users;
2a4419b5 8 spinlock_t lock;
1da177e4 9 int umask;
498052bb 10 int in_exec;
7f2da1e7 11 struct path root, pwd;
1da177e4
LT
12};
13
aa362a83
CL
14extern struct kmem_cache *fs_cachep;
15
1da177e4 16extern void exit_fs(struct task_struct *);
ac748a09
JB
17extern void set_fs_root(struct fs_struct *, struct path *);
18extern void set_fs_pwd(struct fs_struct *, struct path *);
1da177e4 19extern struct fs_struct *copy_fs_struct(struct fs_struct *);
498052bb 20extern void free_fs_struct(struct fs_struct *);
3e93cd67
AV
21extern void daemonize_fs_struct(void);
22extern int unshare_fs_struct(void);
1da177e4 23
f7ad3c6b
MS
24static inline void get_fs_root(struct fs_struct *fs, struct path *root)
25{
2a4419b5 26 spin_lock(&fs->lock);
f7ad3c6b
MS
27 *root = fs->root;
28 path_get(root);
2a4419b5 29 spin_unlock(&fs->lock);
f7ad3c6b
MS
30}
31
32static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd)
33{
2a4419b5 34 spin_lock(&fs->lock);
f7ad3c6b
MS
35 *pwd = fs->pwd;
36 path_get(pwd);
2a4419b5 37 spin_unlock(&fs->lock);
f7ad3c6b
MS
38}
39
40static inline void get_fs_root_and_pwd(struct fs_struct *fs, struct path *root,
41 struct path *pwd)
42{
2a4419b5 43 spin_lock(&fs->lock);
f7ad3c6b
MS
44 *root = fs->root;
45 path_get(root);
46 *pwd = fs->pwd;
47 path_get(pwd);
2a4419b5 48 spin_unlock(&fs->lock);
f7ad3c6b
MS
49}
50
1da177e4 51#endif /* _LINUX_FS_STRUCT_H */