[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4703A53B.9090804@openvz.org>
Date: Wed, 03 Oct 2007 18:20:43 +0400
From: Pavel Emelyanov <xemul@...nvz.org>
To: Andrew Morton <akpm@...l.org>
CC: Sukadev Bhattiprolu <sukadev@...ibm.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
devel@...nvz.org, Matt Mackall <mpm@...enic.com>
Subject: [PATCH 2/3] Prepare pid_nr() etc functions to work with not-NULL
pids
Just make the __pid_nr() etc functions that expect the argument
to always be not NULL.
Signed-off-by: Pavel Emelyanov <xemul@...nvz.org>
---
diff --git a/include/linux/pid.h b/include/linux/pid.h
index e29a900..50b6899 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -135,21 +135,32 @@ extern void zap_pid_ns_processes(struct
* see also task_xid_nr() etc in include/linux/sched.h
*/
+static inline pid_t __pid_nr(struct pid *pid)
+{
+ return pid->numbers[0].nr;
+}
+
static inline pid_t pid_nr(struct pid *pid)
{
pid_t nr = 0;
if (pid)
- nr = pid->numbers[0].nr;
+ nr = __pid_nr(pid);
return nr;
}
+pid_t __pid_nr_ns(struct pid *pid, struct pid_namespace *ns);
pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns);
+static inline pid_t __pid_vnr(struct pid *pid)
+{
+ return pid->numbers[pid->level].nr;
+}
+
static inline pid_t pid_vnr(struct pid *pid)
{
pid_t nr = 0;
if (pid)
- nr = pid->numbers[pid->level].nr;
+ nr = __pid_vnr(pid);
return nr;
}
diff --git a/kernel/pid.c b/kernel/pid.c
index d7388d7..b7a11cf 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -430,12 +441,12 @@ struct pid *find_get_pid(pid_t nr)
return pid;
}
-pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
+pid_t __pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
{
struct upid *upid;
pid_t nr = 0;
- if (pid && ns->level <= pid->level) {
+ if (ns->level <= pid->level) {
upid = &pid->numbers[ns->level];
if (upid->ns == ns)
nr = upid->nr;
@@ -443,6 +454,14 @@ pid_t pid_nr_ns(struct pid *pid, struct
return nr;
}
+pid_t pid_nr_ns(struct pid *pid, struct pid_namespace *ns)
+{
+ pid_t nr = 0;
+ if (pid)
+ nr = __pid_nr_ns(pid, ns);
+ return nr;
+}
+
pid_t task_pid_nr_ns(struct task_struct *tsk, struct pid_namespace *ns)
{
return pid_nr_ns(task_pid(tsk), ns);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists