From 69bdfc8898e8968395adceae515036d1f18af718 Mon Sep 17 00:00:00 2001 From: "Eric W. Biederman" Date: Fri, 8 Feb 2008 04:19:15 -0800 Subject: [PATCH] --- yaml --- r: 84667 b: refs/heads/master c: 44c4e1b2581f7273ab14ef30b6430618801c57b1 h: refs/heads/master i: 84665: 338e29f099c647874ab49e74e57b0b218c03c2cf 84663: b16a3917dc05e7679cf50cad92ff3fa6c635c392 v: v3 --- [refs] | 2 +- trunk/include/linux/pid.h | 14 +++----------- trunk/include/linux/sched.h | 5 ++--- trunk/kernel/pid.c | 6 ++++++ 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index 0137e2865d89..21f5f4010a41 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 161550d74c07303ffa6187ba776f62df5a906a21 +refs/heads/master: 44c4e1b2581f7273ab14ef30b6430618801c57b1 diff --git a/trunk/include/linux/pid.h b/trunk/include/linux/pid.h index 061abb6c0796..b91f4732dc1b 100644 --- a/trunk/include/linux/pid.h +++ b/trunk/include/linux/pid.h @@ -127,9 +127,8 @@ extern void FASTCALL(free_pid(struct pid *pid)); * the helpers to get the pid's id seen from different namespaces * * pid_nr() : global id, i.e. the id seen from the init namespace; - * pid_vnr() : virtual id, i.e. the id seen from the namespace this pid - * belongs to. this only makes sence when called in the - * context of the task that belongs to the same namespace; + * pid_vnr() : virtual id, i.e. the id seen from the pid namespace of + * current. * pid_nr_ns() : id seen from the ns specified. * * see also task_xid_nr() etc in include/linux/sched.h @@ -144,14 +143,7 @@ static inline pid_t pid_nr(struct pid *pid) } pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns); - -static inline pid_t pid_vnr(struct pid *pid) -{ - pid_t nr = 0; - if (pid) - nr = pid->numbers[pid->level].nr; - return nr; -} +pid_t pid_vnr(struct pid *pid); #define do_each_pid_task(pid, type, task) \ do { \ diff --git a/trunk/include/linux/sched.h b/trunk/include/linux/sched.h index d1c9b7f1d51e..3deb6e5d3096 100644 --- a/trunk/include/linux/sched.h +++ b/trunk/include/linux/sched.h @@ -1332,9 +1332,8 @@ struct pid_namespace; * from various namespaces * * task_xid_nr() : global id, i.e. the id seen from the init namespace; - * task_xid_vnr() : virtual id, i.e. the id seen from the namespace the task - * belongs to. this only makes sence when called in the - * context of the task that belongs to the same namespace; + * task_xid_vnr() : virtual id, i.e. the id seen from the pid namespace of + * current. * task_xid_nr_ns() : id seen from the ns specified; * * set_task_vxid() : assigns a virtual id to a task; diff --git a/trunk/kernel/pid.c b/trunk/kernel/pid.c index 939746fb4ce7..a32859c4a3cd 100644 --- a/trunk/kernel/pid.c +++ b/trunk/kernel/pid.c @@ -443,6 +443,12 @@ pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns) return nr; } +pid_t pid_vnr(struct pid *pid) +{ + return pid_nr_ns(pid, current->nsproxy->pid_ns); +} +EXPORT_SYMBOL_GPL(pid_vnr); + pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns) { return pid_nr_ns(task_pid(tsk), ns);