diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-01-23 17:07:38 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-02-22 23:31:31 -0500 |
commit | 496ad9aa8ef448058e36ca7a787c61f2e63f0f54 (patch) | |
tree | 8f4abde793cd7db5bb8fde6d27ebcacd0e54379a /include/linux/fs.h | |
parent | 57eccb830f1cc93d4b506ba306d8dfa685e0c88f (diff) |
new helper: file_inode(file)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 7617ee04f066..3ab69777b4d8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -2217,6 +2217,11 @@ static inline bool execute_ok(struct inode *inode) | |||
2217 | return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); | 2217 | return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); |
2218 | } | 2218 | } |
2219 | 2219 | ||
2220 | static inline struct inode *file_inode(struct file *f) | ||
2221 | { | ||
2222 | return f->f_path.dentry->d_inode; | ||
2223 | } | ||
2224 | |||
2220 | /* | 2225 | /* |
2221 | * get_write_access() gets write permission for a file. | 2226 | * get_write_access() gets write permission for a file. |
2222 | * put_write_access() releases this write permission. | 2227 | * put_write_access() releases this write permission. |
@@ -2239,7 +2244,7 @@ static inline int get_write_access(struct inode *inode) | |||
2239 | } | 2244 | } |
2240 | static inline int deny_write_access(struct file *file) | 2245 | static inline int deny_write_access(struct file *file) |
2241 | { | 2246 | { |
2242 | struct inode *inode = file->f_path.dentry->d_inode; | 2247 | struct inode *inode = file_inode(file); |
2243 | return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; | 2248 | return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; |
2244 | } | 2249 | } |
2245 | static inline void put_write_access(struct inode * inode) | 2250 | static inline void put_write_access(struct inode * inode) |
@@ -2249,7 +2254,7 @@ static inline void put_write_access(struct inode * inode) | |||
2249 | static inline void allow_write_access(struct file *file) | 2254 | static inline void allow_write_access(struct file *file) |
2250 | { | 2255 | { |
2251 | if (file) | 2256 | if (file) |
2252 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 2257 | atomic_inc(&file_inode(file)->i_writecount); |
2253 | } | 2258 | } |
2254 | #ifdef CONFIG_IMA | 2259 | #ifdef CONFIG_IMA |
2255 | static inline void i_readcount_dec(struct inode *inode) | 2260 | static inline void i_readcount_dec(struct inode *inode) |