Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

procfs: make proc_get_link to use dentry instead of inode

Prepare the ground for the next "map_files" patch which needs a name of a
link file to analyse.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: Pavel Emelyanov <xemul@parallels.com>
Cc: Tejun Heo <tj@kernel.org>
Cc: Vasiliy Kulikov <segoon@openwall.com>
Cc: "Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Cyrill Gorcunov and committed by
Linus Torvalds
7773fbc5 5e6292c0

+11 -11
+10 -10
fs/proc/base.c
··· 166 166 return result; 167 167 } 168 168 169 - static int proc_cwd_link(struct inode *inode, struct path *path) 169 + static int proc_cwd_link(struct dentry *dentry, struct path *path) 170 170 { 171 - struct task_struct *task = get_proc_task(inode); 171 + struct task_struct *task = get_proc_task(dentry->d_inode); 172 172 int result = -ENOENT; 173 173 174 174 if (task) { ··· 183 183 return result; 184 184 } 185 185 186 - static int proc_root_link(struct inode *inode, struct path *path) 186 + static int proc_root_link(struct dentry *dentry, struct path *path) 187 187 { 188 - struct task_struct *task = get_proc_task(inode); 188 + struct task_struct *task = get_proc_task(dentry->d_inode); 189 189 int result = -ENOENT; 190 190 191 191 if (task) { ··· 1456 1456 .release = single_release, 1457 1457 }; 1458 1458 1459 - static int proc_exe_link(struct inode *inode, struct path *exe_path) 1459 + static int proc_exe_link(struct dentry *dentry, struct path *exe_path) 1460 1460 { 1461 1461 struct task_struct *task; 1462 1462 struct mm_struct *mm; 1463 1463 struct file *exe_file; 1464 1464 1465 - task = get_proc_task(inode); 1465 + task = get_proc_task(dentry->d_inode); 1466 1466 if (!task) 1467 1467 return -ENOENT; 1468 1468 mm = get_task_mm(task); ··· 1492 1492 if (!proc_fd_access_allowed(inode)) 1493 1493 goto out; 1494 1494 1495 - error = PROC_I(inode)->op.proc_get_link(inode, &nd->path); 1495 + error = PROC_I(inode)->op.proc_get_link(dentry, &nd->path); 1496 1496 out: 1497 1497 return ERR_PTR(error); 1498 1498 } ··· 1531 1531 if (!proc_fd_access_allowed(inode)) 1532 1532 goto out; 1533 1533 1534 - error = PROC_I(inode)->op.proc_get_link(inode, &path); 1534 + error = PROC_I(inode)->op.proc_get_link(dentry, &path); 1535 1535 if (error) 1536 1536 goto out; 1537 1537 ··· 1823 1823 return -ENOENT; 1824 1824 } 1825 1825 1826 - static int proc_fd_link(struct inode *inode, struct path *path) 1826 + static int proc_fd_link(struct dentry *dentry, struct path *path) 1827 1827 { 1828 - return proc_fd_info(inode, path, NULL); 1828 + return proc_fd_info(dentry->d_inode, path, NULL); 1829 1829 } 1830 1830 1831 1831 static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
+1 -1
include/linux/proc_fs.h
··· 253 253 extern const struct proc_ns_operations ipcns_operations; 254 254 255 255 union proc_op { 256 - int (*proc_get_link)(struct inode *, struct path *); 256 + int (*proc_get_link)(struct dentry *, struct path *); 257 257 int (*proc_read)(struct task_struct *task, char *page); 258 258 int (*proc_show)(struct seq_file *m, 259 259 struct pid_namespace *ns, struct pid *pid,