nlm: Ensure callback code also checks that the files match
[GitHub/mt8127/android_kernel_alcatel_ttab.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>
c28cc364
NP
5#include <linux/spinlock.h>
6#include <linux/seqlock.h>
1da177e4
LT
7
8struct 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
17extern struct kmem_cache *fs_cachep;
18
1da177e4 19extern void exit_fs(struct task_struct *);
dcf787f3
AV
20extern void set_fs_root(struct fs_struct *, const struct path *);
21extern void set_fs_pwd(struct fs_struct *, const struct path *);
1da177e4 22extern struct fs_struct *copy_fs_struct(struct fs_struct *);
498052bb 23extern void free_fs_struct(struct fs_struct *);
3e93cd67 24extern int unshare_fs_struct(void);
1da177e4 25
f7ad3c6b
MS
26static inline void get_fs_root(struct fs_struct *fs, struct path *root)
27{
2a4419b5 28 spin_lock(&fs->lock);
f7ad3c6b
MS
29 *root = fs->root;
30 path_get(root);
2a4419b5 31 spin_unlock(&fs->lock);
f7ad3c6b
MS
32}
33
34static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd)
35{
2a4419b5 36 spin_lock(&fs->lock);
f7ad3c6b
MS
37 *pwd = fs->pwd;
38 path_get(pwd);
2a4419b5 39 spin_unlock(&fs->lock);
f7ad3c6b
MS
40}
41
42static inline void get_fs_root_and_pwd(struct fs_struct *fs, struct path *root,
43 struct path *pwd)
44{
2a4419b5 45 spin_lock(&fs->lock);
f7ad3c6b
MS
46 *root = fs->root;
47 path_get(root);
48 *pwd = fs->pwd;
49 path_get(pwd);
2a4419b5 50 spin_unlock(&fs->lock);
f7ad3c6b
MS
51}
52
3151527e
EB
53extern bool current_chrooted(void);
54
1da177e4 55#endif /* _LINUX_FS_STRUCT_H */