aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2006-06-26 03:25:56 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-26 12:58:26 -0400
commit13b41b09491e5d75e8027dca1ee78f5e073bc4c0 (patch)
tree3f08183a4f59075fc3015165183b8ef17cb562a6
parent99f895518368252ba862cc15ce4eb98ebbe1bec6 (diff)
[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 <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/proc/base.c8
-rw-r--r--fs/proc/inode.c4
-rw-r--r--fs/proc/internal.h7
-rw-r--r--fs/proc/task_mmu.c4
-rw-r--r--include/linux/proc_fs.h4
-rw-r--r--kernel/cpuset.c11
6 files changed, 18 insertions, 20 deletions
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,
951 if (!capable(CAP_AUDIT_CONTROL)) 951 if (!capable(CAP_AUDIT_CONTROL))
952 return -EPERM; 952 return -EPERM;
953 953
954 if (current != proc_tref(inode)->task) 954 if (current != pid_task(proc_pid(inode), PIDTYPE_PID))
955 return -EPERM; 955 return -EPERM;
956 956
957 if (count >= PAGE_SIZE) 957 if (count >= PAGE_SIZE)
@@ -1363,8 +1363,8 @@ static struct inode *proc_pid_make_inode(struct super_block * sb, struct task_st
1363 /* 1363 /*
1364 * grab the reference to task. 1364 * grab the reference to task.
1365 */ 1365 */
1366 ei->tref = tref_get_by_task(task); 1366 ei->pid = get_pid(task->pids[PIDTYPE_PID].pid);
1367 if (!tref_task(ei->tref)) 1367 if (!ei->pid)
1368 goto out_unlock; 1368 goto out_unlock;
1369 1369
1370 inode->i_uid = 0; 1370 inode->i_uid = 0;
@@ -1482,7 +1482,7 @@ static int pid_delete_dentry(struct dentry * dentry)
1482 * If so, then don't put the dentry on the lru list, 1482 * If so, then don't put the dentry on the lru list,
1483 * kill it immediately. 1483 * kill it immediately.
1484 */ 1484 */
1485 return !proc_tref(dentry->d_inode)->task; 1485 return !proc_pid(dentry->d_inode)->tasks[PIDTYPE_PID].first;
1486} 1486}
1487 1487
1488static struct dentry_operations tid_fd_dentry_operations = 1488static 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)
62 truncate_inode_pages(&inode->i_data, 0); 62 truncate_inode_pages(&inode->i_data, 0);
63 63
64 /* Stop tracking associated processes */ 64 /* Stop tracking associated processes */
65 tref_put(PROC_I(inode)->tref); 65 put_pid(PROC_I(inode)->pid);
66 66
67 /* Let go of any associated proc directory entry */ 67 /* Let go of any associated proc directory entry */
68 de = PROC_I(inode)->pde; 68 de = PROC_I(inode)->pde;
@@ -91,7 +91,7 @@ static struct inode *proc_alloc_inode(struct super_block *sb)
91 ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, SLAB_KERNEL); 91 ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, SLAB_KERNEL);
92 if (!ei) 92 if (!ei)
93 return NULL; 93 return NULL;
94 ei->tref = NULL; 94 ei->pid = NULL;
95 ei->fd = 0; 95 ei->fd = 0;
96 ei->op.proc_get_link = NULL; 96 ei->op.proc_get_link = NULL;
97 ei->pde = NULL; 97 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 @@
10 */ 10 */
11 11
12#include <linux/proc_fs.h> 12#include <linux/proc_fs.h>
13#include <linux/task_ref.h>
14 13
15struct vmalloc_info { 14struct vmalloc_info {
16 unsigned long used; 15 unsigned long used;
@@ -51,14 +50,14 @@ void free_proc_entry(struct proc_dir_entry *de);
51 50
52int proc_init_inodecache(void); 51int proc_init_inodecache(void);
53 52
54static inline struct task_ref *proc_tref(struct inode *inode) 53static inline struct pid *proc_pid(struct inode *inode)
55{ 54{
56 return PROC_I(inode)->tref; 55 return PROC_I(inode)->pid;
57} 56}
58 57
59static inline struct task_struct *get_proc_task(struct inode *inode) 58static inline struct task_struct *get_proc_task(struct inode *inode)
60{ 59{
61 return get_tref_task(proc_tref(inode)); 60 return get_pid_task(proc_pid(inode), PIDTYPE_PID);
62} 61}
63 62
64static inline int proc_fd(struct inode *inode) 63static 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)
320 if (last_addr == -1UL) 320 if (last_addr == -1UL)
321 return NULL; 321 return NULL;
322 322
323 priv->task = get_tref_task(priv->tref); 323 priv->task = get_pid_task(priv->pid, PIDTYPE_PID);
324 if (!priv->task) 324 if (!priv->task)
325 return NULL; 325 return NULL;
326 326
@@ -416,7 +416,7 @@ static int do_maps_open(struct inode *inode, struct file *file,
416 int ret = -ENOMEM; 416 int ret = -ENOMEM;
417 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 417 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
418 if (priv) { 418 if (priv) {
419 priv->tref = proc_tref(inode); 419 priv->pid = proc_pid(inode);
420 ret = seq_open(file, ops); 420 ret = seq_open(file, ops);
421 if (!ret) { 421 if (!ret) {
422 struct seq_file *m = file->private_data; 422 struct seq_file *m = file->private_data;
diff --git a/include/linux/proc_fs.h b/include/linux/proc_fs.h
index 4c7271f04697..17e75783e3a5 100644
--- a/include/linux/proc_fs.h
+++ b/include/linux/proc_fs.h
@@ -246,7 +246,7 @@ extern void kclist_add(struct kcore_list *, void *, size_t);
246#endif 246#endif
247 247
248struct proc_inode { 248struct proc_inode {
249 struct task_ref *tref; 249 struct pid *pid;
250 int fd; 250 int fd;
251 union { 251 union {
252 int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **); 252 int (*proc_get_link)(struct inode *, struct dentry **, struct vfsmount **);
@@ -267,7 +267,7 @@ static inline struct proc_dir_entry *PDE(const struct inode *inode)
267} 267}
268 268
269struct proc_maps_private { 269struct proc_maps_private {
270 struct task_ref *tref; 270 struct pid *pid;
271 struct task_struct *task; 271 struct task_struct *task;
272 struct vm_area_struct *tail_vma; 272 struct vm_area_struct *tail_vma;
273}; 273};
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 3e991c0c02e2..1535af3a912d 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -50,7 +50,6 @@
50#include <linux/time.h> 50#include <linux/time.h>
51#include <linux/backing-dev.h> 51#include <linux/backing-dev.h>
52#include <linux/sort.h> 52#include <linux/sort.h>
53#include <linux/task_ref.h>
54 53
55#include <asm/uaccess.h> 54#include <asm/uaccess.h>
56#include <asm/atomic.h> 55#include <asm/atomic.h>
@@ -2443,7 +2442,7 @@ void __cpuset_memory_pressure_bump(void)
2443 */ 2442 */
2444static int proc_cpuset_show(struct seq_file *m, void *v) 2443static int proc_cpuset_show(struct seq_file *m, void *v)
2445{ 2444{
2446 struct task_ref *tref; 2445 struct pid *pid;
2447 struct task_struct *tsk; 2446 struct task_struct *tsk;
2448 char *buf; 2447 char *buf;
2449 int retval; 2448 int retval;
@@ -2454,8 +2453,8 @@ static int proc_cpuset_show(struct seq_file *m, void *v)
2454 goto out; 2453 goto out;
2455 2454
2456 retval = -ESRCH; 2455 retval = -ESRCH;
2457 tref = m->private; 2456 pid = m->private;
2458 tsk = get_tref_task(tref); 2457 tsk = get_pid_task(pid, PIDTYPE_PID);
2459 if (!tsk) 2458 if (!tsk)
2460 goto out_free; 2459 goto out_free;
2461 2460
@@ -2478,8 +2477,8 @@ out:
2478 2477
2479static int cpuset_open(struct inode *inode, struct file *file) 2478static int cpuset_open(struct inode *inode, struct file *file)
2480{ 2479{
2481 struct task_ref *tref = PROC_I(inode)->tref; 2480 struct pid *pid = PROC_I(inode)->pid;
2482 return single_open(file, proc_cpuset_show, tref); 2481 return single_open(file, proc_cpuset_show, pid);
2483} 2482}
2484 2483
2485struct file_operations proc_cpuset_operations = { 2484struct file_operations proc_cpuset_operations = {