diff options
| author | Michal Marek <mmarek@suse.cz> | 2010-12-14 22:01:55 +0100 |
|---|---|---|
| committer | Michal Marek <mmarek@suse.cz> | 2010-12-14 22:01:55 +0100 |
| commit | 8990c1bc4be46473ad19bf2fa612ca57286f3df4 (patch) | |
| tree | 3cea60576903a1d26c67e6ec62891b524d390e95 /include/linux/fs_struct.h | |
| parent | 2979076fbf17a0947d6eba367b0cac19c907c160 (diff) | |
| parent | c8ddb2713c624f432fa5fe3c7ecffcdda46ea0d4 (diff) | |
Merge commit 'v2.6.37-rc1' into kbuild/kbuild
Diffstat (limited to 'include/linux/fs_struct.h')
| -rw-r--r-- | include/linux/fs_struct.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/include/linux/fs_struct.h b/include/linux/fs_struct.h index 78a05bfcd8eb..a42b5bf02f8b 100644 --- a/include/linux/fs_struct.h +++ b/include/linux/fs_struct.h @@ -5,7 +5,7 @@ struct fs_struct { int users; - rwlock_t lock; + spinlock_t lock; int umask; int in_exec; struct path root, pwd; @@ -21,4 +21,31 @@ extern void free_fs_struct(struct fs_struct *); extern void daemonize_fs_struct(void); extern int unshare_fs_struct(void); +static inline void get_fs_root(struct fs_struct *fs, struct path *root) +{ + spin_lock(&fs->lock); + *root = fs->root; + path_get(root); + spin_unlock(&fs->lock); +} + +static inline void get_fs_pwd(struct fs_struct *fs, struct path *pwd) +{ + spin_lock(&fs->lock); + *pwd = fs->pwd; + path_get(pwd); + spin_unlock(&fs->lock); +} + +static inline void get_fs_root_and_pwd(struct fs_struct *fs, struct path *root, + struct path *pwd) +{ + spin_lock(&fs->lock); + *root = fs->root; + path_get(root); + *pwd = fs->pwd; + path_get(pwd); + spin_unlock(&fs->lock); +} + #endif /* _LINUX_FS_STRUCT_H */ |
