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