浏览代码

proc/maps: replace proc_maps_private->pid with "struct inode *inode"

m_start() can use get_proc_task() instead, and "struct inode *"
provides more potentially useful info, see the next changes.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Greg Ungerer <gerg@uclinux.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Oleg Nesterov 10 年之前
父节点
当前提交
2c03376d2d
共有 3 个文件被更改,包括 5 次插入5 次删除
  1. 1 1
      fs/proc/internal.h
  2. 2 2
      fs/proc/task_mmu.c
  3. 2 2
      fs/proc/task_nommu.c

+ 1 - 1
fs/proc/internal.h

@@ -268,7 +268,7 @@ extern int proc_remount(struct super_block *, int *, char *);
  * task_[no]mmu.c
  * task_[no]mmu.c
  */
  */
 struct proc_maps_private {
 struct proc_maps_private {
-	struct pid *pid;
+	struct inode *inode;
 	struct task_struct *task;
 	struct task_struct *task;
 	struct mm_struct *mm;
 	struct mm_struct *mm;
 #ifdef CONFIG_MMU
 #ifdef CONFIG_MMU

+ 2 - 2
fs/proc/task_mmu.c

@@ -164,7 +164,7 @@ static void *m_start(struct seq_file *m, loff_t *ppos)
 	if (last_addr == -1UL)
 	if (last_addr == -1UL)
 		return NULL;
 		return NULL;
 
 
-	priv->task = get_pid_task(priv->pid, PIDTYPE_PID);
+	priv->task = get_proc_task(priv->inode);
 	if (!priv->task)
 	if (!priv->task)
 		return ERR_PTR(-ESRCH);
 		return ERR_PTR(-ESRCH);
 
 
@@ -231,7 +231,7 @@ static int proc_maps_open(struct inode *inode, struct file *file,
 	if (!priv)
 	if (!priv)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
-	priv->pid = proc_pid(inode);
+	priv->inode = inode;
 	priv->mm = proc_mem_open(inode, PTRACE_MODE_READ);
 	priv->mm = proc_mem_open(inode, PTRACE_MODE_READ);
 	if (IS_ERR(priv->mm)) {
 	if (IS_ERR(priv->mm)) {
 		int err = PTR_ERR(priv->mm);
 		int err = PTR_ERR(priv->mm);

+ 2 - 2
fs/proc/task_nommu.c

@@ -212,7 +212,7 @@ static void *m_start(struct seq_file *m, loff_t *pos)
 	loff_t n = *pos;
 	loff_t n = *pos;
 
 
 	/* pin the task and mm whilst we play with them */
 	/* pin the task and mm whilst we play with them */
-	priv->task = get_pid_task(priv->pid, PIDTYPE_PID);
+	priv->task = get_proc_task(priv->inode);
 	if (!priv->task)
 	if (!priv->task)
 		return ERR_PTR(-ESRCH);
 		return ERR_PTR(-ESRCH);
 
 
@@ -276,7 +276,7 @@ static int maps_open(struct inode *inode, struct file *file,
 	if (!priv)
 	if (!priv)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
-	priv->pid = proc_pid(inode);
+	priv->inode = inode;
 	priv->mm = proc_mem_open(inode, PTRACE_MODE_READ);
 	priv->mm = proc_mem_open(inode, PTRACE_MODE_READ);
 	if (IS_ERR(priv->mm)) {
 	if (IS_ERR(priv->mm)) {
 		int err = PTR_ERR(priv->mm);
 		int err = PTR_ERR(priv->mm);