fs_struct.h 999 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef _LINUX_FS_STRUCT_H
  2. #define _LINUX_FS_STRUCT_H
  3. #include <linux/path.h>
  4. #include <linux/spinlock.h>
  5. #include <linux/seqlock.h>
  6. struct fs_struct {
  7. int users;
  8. spinlock_t lock;
  9. seqcount_t seq;
  10. int umask;
  11. int in_exec;
  12. struct path root, pwd;
  13. };
  14. extern struct kmem_cache *fs_cachep;
  15. extern void exit_fs(struct task_struct *);
  16. extern void set_fs_root(struct fs_struct *, const struct path *);
  17. extern void set_fs_pwd(struct fs_struct *, const struct path *);
  18. extern struct fs_struct *copy_fs_struct(struct fs_struct *);
  19. extern void free_fs_struct(struct fs_struct *);
  20. extern int unshare_fs_struct(void);
  21. static inline void get_fs_root(struct fs_struct *fs, struct path *root)
  22. {
  23. spin_lock(&fs->lock);
  24. *root = fs->root;
  25. path_get(root);
  26. spin_unlock(&fs->lock);
  27. }
  28. static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd)
  29. {
  30. spin_lock(&fs->lock);
  31. *pwd = fs->pwd;
  32. path_get(pwd);
  33. spin_unlock(&fs->lock);
  34. }
  35. extern bool current_chrooted(void);
  36. #endif /* _LINUX_FS_STRUCT_H */