Blame view

include/linux/fs_struct.h 1.19 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>
c28cc3646   Nick Piggin   fs: fs_struct use...
4
5
  #include <linux/spinlock.h>
  #include <linux/seqlock.h>
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
6
7
  
  struct fs_struct {
498052bba   Al Viro   New locking/refco...
8
  	int users;
2a4419b5b   Nick Piggin   fs: fs_struct rwl...
9
  	spinlock_t lock;
c28cc3646   Nick Piggin   fs: fs_struct use...
10
  	seqcount_t seq;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
11
  	int umask;
498052bba   Al Viro   New locking/refco...
12
  	int in_exec;
7f2da1e7d   Al Viro   [PATCH] kill altroot
13
  	struct path root, pwd;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
14
  };
aa362a83e   Christoph Lameter   [PATCH] Move fs_c...
15
  extern struct kmem_cache *fs_cachep;
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
16
  extern void exit_fs(struct task_struct *);
ac748a09f   Jan Blunck   Make set_fs_{root...
17
18
  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
19
  extern struct fs_struct *copy_fs_struct(struct fs_struct *);
498052bba   Al Viro   New locking/refco...
20
  extern void free_fs_struct(struct fs_struct *);
3e93cd671   Al Viro   Take fs_struct ha...
21
22
  extern void daemonize_fs_struct(void);
  extern int unshare_fs_struct(void);
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
23

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