aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-01-23 17:07:38 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-22 23:31:31 -0500
commit496ad9aa8ef448058e36ca7a787c61f2e63f0f54 (patch)
tree8f4abde793cd7db5bb8fde6d27ebcacd0e54379a /kernel
parent57eccb830f1cc93d4b506ba306d8dfa685e0c88f (diff)
new helper: file_inode(file)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/acct.c2
-rw-r--r--kernel/cgroup.c6
-rw-r--r--kernel/events/core.c2
-rw-r--r--kernel/fork.c2
-rw-r--r--kernel/irq/proc.c2
-rw-r--r--kernel/nsproxy.c2
-rw-r--r--kernel/relay.c4
-rw-r--r--kernel/sys.c8
8 files changed, 14 insertions, 14 deletions
diff --git a/kernel/acct.c b/kernel/acct.c
index 051e071a06e7..0d2981358e08 100644
--- a/kernel/acct.c
+++ b/kernel/acct.c
@@ -205,7 +205,7 @@ static int acct_on(struct filename *pathname)
205 if (IS_ERR(file)) 205 if (IS_ERR(file))
206 return PTR_ERR(file); 206 return PTR_ERR(file);
207 207
208 if (!S_ISREG(file->f_path.dentry->d_inode->i_mode)) { 208 if (!S_ISREG(file_inode(file)->i_mode)) {
209 filp_close(file, NULL); 209 filp_close(file, NULL);
210 return -EACCES; 210 return -EACCES;
211 } 211 }
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 4855892798fd..4fe52b3b6ef6 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -2637,7 +2637,7 @@ static struct dentry *cgroup_lookup(struct inode *dir, struct dentry *dentry, un
2637 */ 2637 */
2638static inline struct cftype *__file_cft(struct file *file) 2638static inline struct cftype *__file_cft(struct file *file)
2639{ 2639{
2640 if (file->f_dentry->d_inode->i_fop != &cgroup_file_operations) 2640 if (file_inode(file)->i_fop != &cgroup_file_operations)
2641 return ERR_PTR(-EINVAL); 2641 return ERR_PTR(-EINVAL);
2642 return __d_cft(file->f_dentry); 2642 return __d_cft(file->f_dentry);
2643} 2643}
@@ -3852,7 +3852,7 @@ static int cgroup_write_event_control(struct cgroup *cgrp, struct cftype *cft,
3852 3852
3853 /* the process need read permission on control file */ 3853 /* the process need read permission on control file */
3854 /* AV: shouldn't we check that it's been opened for read instead? */ 3854 /* AV: shouldn't we check that it's been opened for read instead? */
3855 ret = inode_permission(cfile->f_path.dentry->d_inode, MAY_READ); 3855 ret = inode_permission(file_inode(cfile), MAY_READ);
3856 if (ret < 0) 3856 if (ret < 0)
3857 goto fail; 3857 goto fail;
3858 3858
@@ -5441,7 +5441,7 @@ struct cgroup_subsys_state *cgroup_css_from_dir(struct file *f, int id)
5441 struct inode *inode; 5441 struct inode *inode;
5442 struct cgroup_subsys_state *css; 5442 struct cgroup_subsys_state *css;
5443 5443
5444 inode = f->f_dentry->d_inode; 5444 inode = file_inode(f);
5445 /* check in cgroup filesystem dir */ 5445 /* check in cgroup filesystem dir */
5446 if (inode->i_op != &cgroup_dir_inode_operations) 5446 if (inode->i_op != &cgroup_dir_inode_operations)
5447 return ERR_PTR(-EBADF); 5447 return ERR_PTR(-EBADF);
diff --git a/kernel/events/core.c b/kernel/events/core.c
index 301079d06f24..3b106554b42e 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -3682,7 +3682,7 @@ unlock:
3682 3682
3683static int perf_fasync(int fd, struct file *filp, int on) 3683static int perf_fasync(int fd, struct file *filp, int on)
3684{ 3684{
3685 struct inode *inode = filp->f_path.dentry->d_inode; 3685 struct inode *inode = file_inode(filp);
3686 struct perf_event *event = filp->private_data; 3686 struct perf_event *event = filp->private_data;
3687 int retval; 3687 int retval;
3688 3688
diff --git a/kernel/fork.c b/kernel/fork.c
index c535f33bbb9c..4ff724f81f25 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -413,7 +413,7 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm)
413 tmp->vm_next = tmp->vm_prev = NULL; 413 tmp->vm_next = tmp->vm_prev = NULL;
414 file = tmp->vm_file; 414 file = tmp->vm_file;
415 if (file) { 415 if (file) {
416 struct inode *inode = file->f_path.dentry->d_inode; 416 struct inode *inode = file_inode(file);
417 struct address_space *mapping = file->f_mapping; 417 struct address_space *mapping = file->f_mapping;
418 418
419 get_file(file); 419 get_file(file);
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 4bd4faa6323a..397db02209ed 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -76,7 +76,7 @@ static int irq_affinity_list_proc_show(struct seq_file *m, void *v)
76static ssize_t write_irq_affinity(int type, struct file *file, 76static ssize_t write_irq_affinity(int type, struct file *file,
77 const char __user *buffer, size_t count, loff_t *pos) 77 const char __user *buffer, size_t count, loff_t *pos)
78{ 78{
79 unsigned int irq = (int)(long)PDE(file->f_path.dentry->d_inode)->data; 79 unsigned int irq = (int)(long)PDE(file_inode(file))->data;
80 cpumask_var_t new_value; 80 cpumask_var_t new_value;
81 int err; 81 int err;
82 82
diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c
index 78e2ecb20165..c057104bf05c 100644
--- a/kernel/nsproxy.c
+++ b/kernel/nsproxy.c
@@ -251,7 +251,7 @@ SYSCALL_DEFINE2(setns, int, fd, int, nstype)
251 return PTR_ERR(file); 251 return PTR_ERR(file);
252 252
253 err = -EINVAL; 253 err = -EINVAL;
254 ei = PROC_I(file->f_dentry->d_inode); 254 ei = PROC_I(file_inode(file));
255 ops = ei->ns_ops; 255 ops = ei->ns_ops;
256 if (nstype && (ops->type != nstype)) 256 if (nstype && (ops->type != nstype))
257 goto out; 257 goto out;
diff --git a/kernel/relay.c b/kernel/relay.c
index e8cd2027abbd..01ab081ac53a 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -1139,7 +1139,7 @@ static ssize_t relay_file_read_subbufs(struct file *filp, loff_t *ppos,
1139 if (!desc->count) 1139 if (!desc->count)
1140 return 0; 1140 return 0;
1141 1141
1142 mutex_lock(&filp->f_path.dentry->d_inode->i_mutex); 1142 mutex_lock(&file_inode(filp)->i_mutex);
1143 do { 1143 do {
1144 if (!relay_file_read_avail(buf, *ppos)) 1144 if (!relay_file_read_avail(buf, *ppos))
1145 break; 1145 break;
@@ -1159,7 +1159,7 @@ static ssize_t relay_file_read_subbufs(struct file *filp, loff_t *ppos,
1159 *ppos = relay_file_read_end_pos(buf, read_start, ret); 1159 *ppos = relay_file_read_end_pos(buf, read_start, ret);
1160 } 1160 }
1161 } while (desc->count && ret); 1161 } while (desc->count && ret);
1162 mutex_unlock(&filp->f_path.dentry->d_inode->i_mutex); 1162 mutex_unlock(&file_inode(filp)->i_mutex);
1163 1163
1164 return desc->written; 1164 return desc->written;
1165} 1165}
diff --git a/kernel/sys.c b/kernel/sys.c
index 265b37690421..e3932ea50ec8 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1792,14 +1792,14 @@ SYSCALL_DEFINE1(umask, int, mask)
1792static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd) 1792static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd)
1793{ 1793{
1794 struct fd exe; 1794 struct fd exe;
1795 struct dentry *dentry; 1795 struct inode *inode;
1796 int err; 1796 int err;
1797 1797
1798 exe = fdget(fd); 1798 exe = fdget(fd);
1799 if (!exe.file) 1799 if (!exe.file)
1800 return -EBADF; 1800 return -EBADF;
1801 1801
1802 dentry = exe.file->f_path.dentry; 1802 inode = file_inode(exe.file);
1803 1803
1804 /* 1804 /*
1805 * Because the original mm->exe_file points to executable file, make 1805 * Because the original mm->exe_file points to executable file, make
@@ -1807,11 +1807,11 @@ static int prctl_set_mm_exe_file(struct mm_struct *mm, unsigned int fd)
1807 * overall picture. 1807 * overall picture.
1808 */ 1808 */
1809 err = -EACCES; 1809 err = -EACCES;
1810 if (!S_ISREG(dentry->d_inode->i_mode) || 1810 if (!S_ISREG(inode->i_mode) ||
1811 exe.file->f_path.mnt->mnt_flags & MNT_NOEXEC) 1811 exe.file->f_path.mnt->mnt_flags & MNT_NOEXEC)
1812 goto exit; 1812 goto exit;
1813 1813
1814 err = inode_permission(dentry->d_inode, MAY_EXEC); 1814 err = inode_permission(inode, MAY_EXEC);
1815 if (err) 1815 if (err)
1816 goto exit; 1816 goto exit;
1817 1817