0001
0002 #ifndef _LINUX_FS_STRUCT_H
0003 #define _LINUX_FS_STRUCT_H
0004
0005 #include <linux/path.h>
0006 #include <linux/spinlock.h>
0007 #include <linux/seqlock.h>
0008
0009 struct fs_struct {
0010 int users;
0011 spinlock_t lock;
0012 seqcount_spinlock_t seq;
0013 int umask;
0014 int in_exec;
0015 struct path root, pwd;
0016 } __randomize_layout;
0017
0018 extern struct kmem_cache *fs_cachep;
0019
0020 extern void exit_fs(struct task_struct *);
0021 extern void set_fs_root(struct fs_struct *, const struct path *);
0022 extern void set_fs_pwd(struct fs_struct *, const struct path *);
0023 extern struct fs_struct *copy_fs_struct(struct fs_struct *);
0024 extern void free_fs_struct(struct fs_struct *);
0025 extern int unshare_fs_struct(void);
0026
0027 static inline void get_fs_root(struct fs_struct *fs, struct path *root)
0028 {
0029 spin_lock(&fs->lock);
0030 *root = fs->root;
0031 path_get(root);
0032 spin_unlock(&fs->lock);
0033 }
0034
0035 static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd)
0036 {
0037 spin_lock(&fs->lock);
0038 *pwd = fs->pwd;
0039 path_get(pwd);
0040 spin_unlock(&fs->lock);
0041 }
0042
0043 extern bool current_chrooted(void);
0044
0045 #endif