aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-06-17 19:27:51 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-18 16:03:55 -0400
commit17f98dcf6010a1cfd25d179fd0ce77d3dc2685c3 (patch)
tree520d88ba2282b4811f492be6cc4565a2a3eea128
parent7338f29984114066b00da343a22876bb08259a84 (diff)
pids: clean up find_task_by_pid variants
find_task_by_pid_type_ns is only used to implement find_task_by_vpid and find_task_by_pid_ns, but both of them pass PIDTYPE_PID as first argument. So just fold find_task_by_pid_type_ns into find_task_by_pid_ns and use find_task_by_pid_ns to implement find_task_by_vpid. While we're at it also remove the exports for find_task_by_pid_ns and find_task_by_vpid - we don't have any modular callers left as the only modular caller of he old pre pid namespace find_task_by_pid (gfs2) was switched to pid_task which operates on a struct pid pointer instead of a pid_t. Given the confusion about pid_t values vs namespace that's generally the better option anyway and I think we're better of restricting modules to do it that way. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Pavel Emelyanov <xemul@openvz.org> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/sched.h6
-rw-r--r--kernel/pid.c17
2 files changed, 3 insertions, 20 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h
index d0342101756a..4d0754269884 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1878,9 +1878,6 @@ extern struct pid_namespace init_pid_ns;
1878/* 1878/*
1879 * find a task by one of its numerical ids 1879 * find a task by one of its numerical ids
1880 * 1880 *
1881 * find_task_by_pid_type_ns():
1882 * it is the most generic call - it finds a task by all id,
1883 * type and namespace specified
1884 * find_task_by_pid_ns(): 1881 * find_task_by_pid_ns():
1885 * finds a task by its pid in the specified namespace 1882 * finds a task by its pid in the specified namespace
1886 * find_task_by_vpid(): 1883 * find_task_by_vpid():
@@ -1889,9 +1886,6 @@ extern struct pid_namespace init_pid_ns;
1889 * see also find_vpid() etc in include/linux/pid.h 1886 * see also find_vpid() etc in include/linux/pid.h
1890 */ 1887 */
1891 1888
1892extern struct task_struct *find_task_by_pid_type_ns(int type, int pid,
1893 struct pid_namespace *ns);
1894
1895extern struct task_struct *find_task_by_vpid(pid_t nr); 1889extern struct task_struct *find_task_by_vpid(pid_t nr);
1896extern struct task_struct *find_task_by_pid_ns(pid_t nr, 1890extern struct task_struct *find_task_by_pid_ns(pid_t nr,
1897 struct pid_namespace *ns); 1891 struct pid_namespace *ns);
diff --git a/kernel/pid.c b/kernel/pid.c
index b2e5f78fd281..31310b5d3f50 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -378,26 +378,15 @@ EXPORT_SYMBOL(pid_task);
378/* 378/*
379 * Must be called under rcu_read_lock() or with tasklist_lock read-held. 379 * Must be called under rcu_read_lock() or with tasklist_lock read-held.
380 */ 380 */
381struct task_struct *find_task_by_pid_type_ns(int type, int nr, 381struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
382 struct pid_namespace *ns)
383{ 382{
384 return pid_task(find_pid_ns(nr, ns), type); 383 return pid_task(find_pid_ns(nr, ns), PIDTYPE_PID);
385} 384}
386 385
387EXPORT_SYMBOL(find_task_by_pid_type_ns);
388
389struct task_struct *find_task_by_vpid(pid_t vnr) 386struct task_struct *find_task_by_vpid(pid_t vnr)
390{ 387{
391 return find_task_by_pid_type_ns(PIDTYPE_PID, vnr, 388 return find_task_by_pid_ns(vnr, current->nsproxy->pid_ns);
392 current->nsproxy->pid_ns);
393}
394EXPORT_SYMBOL(find_task_by_vpid);
395
396struct task_struct *find_task_by_pid_ns(pid_t nr, struct pid_namespace *ns)
397{
398 return find_task_by_pid_type_ns(PIDTYPE_PID, nr, ns);
399} 389}
400EXPORT_SYMBOL(find_task_by_pid_ns);
401 390
402struct pid *get_task_pid(struct task_struct *task, enum pid_type type) 391struct pid *get_task_pid(struct task_struct *task, enum pid_type type)
403{ 392{