at v2.6.36 1.1 kB view raw
1#ifndef _LINUX_FS_STRUCT_H 2#define _LINUX_FS_STRUCT_H 3 4#include <linux/path.h> 5 6struct fs_struct { 7 int users; 8 spinlock_t lock; 9 int umask; 10 int in_exec; 11 struct path root, pwd; 12}; 13 14extern struct kmem_cache *fs_cachep; 15 16extern void exit_fs(struct task_struct *); 17extern void set_fs_root(struct fs_struct *, struct path *); 18extern void set_fs_pwd(struct fs_struct *, struct path *); 19extern struct fs_struct *copy_fs_struct(struct fs_struct *); 20extern void free_fs_struct(struct fs_struct *); 21extern void daemonize_fs_struct(void); 22extern int unshare_fs_struct(void); 23 24static inline void get_fs_root(struct fs_struct *fs, struct path *root) 25{ 26 spin_lock(&fs->lock); 27 *root = fs->root; 28 path_get(root); 29 spin_unlock(&fs->lock); 30} 31 32static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd) 33{ 34 spin_lock(&fs->lock); 35 *pwd = fs->pwd; 36 path_get(pwd); 37 spin_unlock(&fs->lock); 38} 39 40static inline void get_fs_root_and_pwd(struct fs_struct *fs, struct path *root, 41 struct path *pwd) 42{ 43 spin_lock(&fs->lock); 44 *root = fs->root; 45 path_get(root); 46 *pwd = fs->pwd; 47 path_get(pwd); 48 spin_unlock(&fs->lock); 49} 50 51#endif /* _LINUX_FS_STRUCT_H */