From 13b41b09491e5d75e8027dca1ee78f5e073bc4c0 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Mon, 26 Jun 2006 00:25:56 -0700 Subject: [PATCH] proc: Use struct pid not struct task_ref Incrementally update my proc-dont-lock-task_structs-indefinitely patches so that they work with struct pid instead of struct task_ref. Mostly this is a straight 1-1 substitution. Signed-off-by: Eric W. Biederman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- fs/proc/base.c | 8 ++++---- fs/proc/inode.c | 4 ++-- fs/proc/internal.h | 7 +++---- fs/proc/task_mmu.c | 4 ++-- 4 files changed, 11 insertions(+), 12 deletions(-) (limited to 'fs/proc') diff --git a/fs/proc/base.c b/fs/proc/base.c index 489810abc72d..c7f855441573 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -951,7 +951,7 @@ static ssize_t proc_loginuid_write(struct file * file, const char __user * buf, if (!capable(CAP_AUDIT_CONTROL)) return -EPERM; - if (current != proc_tref(inode)->task) + if (current != pid_task(proc_pid(inode), PIDTYPE_PID)) return -EPERM; if (count >= PAGE_SIZE) @@ -1363,8 +1363,8 @@ static struct inode *proc_pid_make_inode(struct super_block * sb, struct task_st /* * grab the reference to task. */ - ei->tref = tref_get_by_task(task); - if (!tref_task(ei->tref)) + ei->pid = get_pid(task->pids[PIDTYPE_PID].pid); + if (!ei->pid) goto out_unlock; inode->i_uid = 0; @@ -1482,7 +1482,7 @@ static int pid_delete_dentry(struct dentry * dentry) * If so, then don't put the dentry on the lru list, * kill it immediately. */ - return !proc_tref(dentry->d_inode)->task; + return !proc_pid(dentry->d_inode)->tasks[PIDTYPE_PID].first; } static struct dentry_operations tid_fd_dentry_operations = diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 31e0475c6cb9..6dcef089e18e 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c @@ -62,7 +62,7 @@ static void proc_delete_inode(struct inode *inode) truncate_inode_pages(&inode->i_data, 0); /* Stop tracking associated processes */ - tref_put(PROC_I(inode)->tref); + put_pid(PROC_I(inode)->pid); /* Let go of any associated proc directory entry */ de = PROC_I(inode)->pde; @@ -91,7 +91,7 @@ static struct inode *proc_alloc_inode(struct super_block *sb) ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, SLAB_KERNEL); if (!ei) return NULL; - ei->tref = NULL; + ei->pid = NULL; ei->fd = 0; ei->op.proc_get_link = NULL; ei->pde = NULL; diff --git a/fs/proc/internal.h b/fs/proc/internal.h index 37f1648adc23..146a434ba944 100644 --- a/fs/proc/internal.h +++ b/fs/proc/internal.h @@ -10,7 +10,6 @@ */ #include -#include struct vmalloc_info { unsigned long used; @@ -51,14 +50,14 @@ void free_proc_entry(struct proc_dir_entry *de); int proc_init_inodecache(void); -static inline struct task_ref *proc_tref(struct inode *inode) +static inline struct pid *proc_pid(struct inode *inode) { - return PROC_I(inode)->tref; + return PROC_I(inode)->pid; } static inline struct task_struct *get_proc_task(struct inode *inode) { - return get_tref_task(proc_tref(inode)); + return get_pid_task(proc_pid(inode), PIDTYPE_PID); } static inline int proc_fd(struct inode *inode) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index abf3208c3f60..0137ec4c1368 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -320,7 +320,7 @@ static void *m_start(struct seq_file *m, loff_t *pos) if (last_addr == -1UL) return NULL; - priv->task = get_tref_task(priv->tref); + priv->task = get_pid_task(priv->pid, PIDTYPE_PID); if (!priv->task) return NULL; @@ -416,7 +416,7 @@ static int do_maps_open(struct inode *inode, struct file *file, int ret = -ENOMEM; priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (priv) { - priv->tref = proc_tref(inode); + priv->pid = proc_pid(inode); ret = seq_open(file, ops); if (!ret) { struct seq_file *m = file->private_data; -- cgit v1.2.2