Blame view

include/linux/fs_struct.h 1.12 KB
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
1
2
  #ifndef _LINUX_FS_STRUCT_H
  #define _LINUX_FS_STRUCT_H
6ac08c39a   Jan Blunck   Use struct path i...
3
  #include <linux/path.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4
5
  
  struct fs_struct {
498052bba   Al Viro   New locking/refco...
6
  	int users;
2a4419b5b   Nick Piggin   fs: fs_struct rwl...
7
  	spinlock_t lock;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
8
  	int umask;
498052bba   Al Viro   New locking/refco...
9
  	int in_exec;
7f2da1e7d   Al Viro   [PATCH] kill altroot
10
  	struct path root, pwd;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
11
  };
aa362a83e   Christoph Lameter   [PATCH] Move fs_c...
12
  extern struct kmem_cache *fs_cachep;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13
  extern void exit_fs(struct task_struct *);
ac748a09f   Jan Blunck   Make set_fs_{root...
14
15
  extern void set_fs_root(struct fs_struct *, struct path *);
  extern void set_fs_pwd(struct fs_struct *, struct path *);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
16
  extern struct fs_struct *copy_fs_struct(struct fs_struct *);
498052bba   Al Viro   New locking/refco...
17
  extern void free_fs_struct(struct fs_struct *);
3e93cd671   Al Viro   Take fs_struct ha...
18
19
  extern void daemonize_fs_struct(void);
  extern int unshare_fs_struct(void);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
20

f7ad3c6be   Miklos Szeredi   vfs: add helpers ...
21
22
  static inline void get_fs_root(struct fs_struct *fs, struct path *root)
  {
2a4419b5b   Nick Piggin   fs: fs_struct rwl...
23
  	spin_lock(&fs->lock);
f7ad3c6be   Miklos Szeredi   vfs: add helpers ...
24
25
  	*root = fs->root;
  	path_get(root);
2a4419b5b   Nick Piggin   fs: fs_struct rwl...
26
  	spin_unlock(&fs->lock);
f7ad3c6be   Miklos Szeredi   vfs: add helpers ...
27
28
29
30
  }
  
  static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd)
  {
2a4419b5b   Nick Piggin   fs: fs_struct rwl...
31
  	spin_lock(&fs->lock);
f7ad3c6be   Miklos Szeredi   vfs: add helpers ...
32
33
  	*pwd = fs->pwd;
  	path_get(pwd);
2a4419b5b   Nick Piggin   fs: fs_struct rwl...
34
  	spin_unlock(&fs->lock);
f7ad3c6be   Miklos Szeredi   vfs: add helpers ...
35
36
37
38
39
  }
  
  static inline void get_fs_root_and_pwd(struct fs_struct *fs, struct path *root,
  				       struct path *pwd)
  {
2a4419b5b   Nick Piggin   fs: fs_struct rwl...
40
  	spin_lock(&fs->lock);
f7ad3c6be   Miklos Szeredi   vfs: add helpers ...
41
42
43
44
  	*root = fs->root;
  	path_get(root);
  	*pwd = fs->pwd;
  	path_get(pwd);
2a4419b5b   Nick Piggin   fs: fs_struct rwl...
45
  	spin_unlock(&fs->lock);
f7ad3c6be   Miklos Szeredi   vfs: add helpers ...
46
  }
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47
  #endif /* _LINUX_FS_STRUCT_H */