* [PATCH v3 1/5] include: linux: pid: Update documentation.
[not found] <cover.1490695255.git.rvarsha016@gmail.com>
@ 2017-03-28 10:08 ` Varsha Rao
2017-03-28 10:11 ` [PATCH v3 2/5] include: linux: pid: Move open brace to previous line Varsha Rao
` (3 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: Varsha Rao @ 2017-03-28 10:08 UTC (permalink / raw)
To: mawilcox; +Cc: outreachy-kernel
This patch adds comments to update documentation.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
Changes in v3:
- Changed comment style.
Changes in v2:
- Keep original comments.
- Modified commit message.
include/linux/pid.h | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 4d17931..ea90c1f 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -5,10 +5,10 @@
enum pid_type
{
- PIDTYPE_PID,
- PIDTYPE_PGID,
- PIDTYPE_SID,
- PIDTYPE_MAX
+ PIDTYPE_PID, /* Process ID */
+ PIDTYPE_PGID, /* Process group ID */
+ PIDTYPE_SID, /* Process session ID */
+ PIDTYPE_MAX /* Number of ID types */
};
/*
@@ -42,11 +42,15 @@ enum pid_type
/*
+ * struct upid - Get PID for particular namespace.
+ * @nr: Pid value.
+ * @ns: Represents the namespace to which pid value belongs.
+ * @pid_chain: Hash chain.
+ *
* struct upid is used to get the id of the struct pid, as it is
* seen in particular namespace. Later the struct pid is found with
* find_pid_ns() using the int nr and struct pid_namespace *ns.
*/
-
struct upid {
/* Try to keep pid_chain in the same cacheline as nr for find_vpid */
int nr;
@@ -54,6 +58,14 @@ struct upid {
struct hlist_node pid_chain;
};
+/*
+ * struct pid
+ * @count: Reference counter.
+ * @level: Number of namespaces in which the process is visible.
+ * @tasks: Lists of tasks.
+ * @rcu: RCU helper.
+ * @numbers: Instance of upid for each level.
+ */
struct pid
{
atomic_t count;
@@ -66,12 +78,21 @@ struct pid
extern struct pid init_struct_pid;
+/*
+ * struct pid_link - Per process linkage into hash tables.
+ * @node: List element.
+ * @pid: Pointer to the struct pid of the process.
+ */
struct pid_link
{
struct hlist_node node;
struct pid *pid;
};
+/*
+ * get_pid() - Checks availability of process id and if available assigns
+ * process ID.
+ */
static inline struct pid *get_pid(struct pid *pid)
{
if (pid)
--
2.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v3 2/5] include: linux: pid: Move open brace to previous line.
[not found] <cover.1490695255.git.rvarsha016@gmail.com>
2017-03-28 10:08 ` [PATCH v3 1/5] include: linux: pid: Update documentation Varsha Rao
@ 2017-03-28 10:11 ` Varsha Rao
2017-03-28 10:12 ` [PATCH v3 3/5] include: linux: pid: Add identifier to function definition argument Varsha Rao
` (2 subsequent siblings)
4 siblings, 0 replies; 5+ messages in thread
From: Varsha Rao @ 2017-03-28 10:11 UTC (permalink / raw)
To: mawilcox; +Cc: outreachy-kernel
Move open braces to the same line, as that of struct and enum. This patch
fixes the checkpatch issue.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
Changes in v3:
- Commit message wrapped within 74 columns.
Changes in v2:
- No changes.
include/linux/pid.h | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/include/linux/pid.h b/include/linux/pid.h
index ea90c1f..c6d947f 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -3,8 +3,7 @@
#include <linux/rculist.h>
-enum pid_type
-{
+enum pid_type {
PIDTYPE_PID, /* Process ID */
PIDTYPE_PGID, /* Process group ID */
PIDTYPE_SID, /* Process session ID */
@@ -66,8 +65,7 @@ struct upid {
* @rcu: RCU helper.
* @numbers: Instance of upid for each level.
*/
-struct pid
-{
+struct pid {
atomic_t count;
unsigned int level;
/* lists of tasks that use this pid */
@@ -83,8 +81,7 @@ extern struct pid init_struct_pid;
* @node: List element.
* @pid: Pointer to the struct pid of the process.
*/
-struct pid_link
-{
+struct pid_link {
struct hlist_node node;
struct pid *pid;
};
--
2.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v3 3/5] include: linux: pid: Add identifier to function definition argument.
[not found] <cover.1490695255.git.rvarsha016@gmail.com>
2017-03-28 10:08 ` [PATCH v3 1/5] include: linux: pid: Update documentation Varsha Rao
2017-03-28 10:11 ` [PATCH v3 2/5] include: linux: pid: Move open brace to previous line Varsha Rao
@ 2017-03-28 10:12 ` Varsha Rao
2017-03-28 10:14 ` [PATCH v3 4/5] include: linux: pid: Add a blank line after declarations Varsha Rao
2017-03-28 10:15 ` [PATCH v3 5/5] include: linux: pid: Remove space before tabs Varsha Rao
4 siblings, 0 replies; 5+ messages in thread
From: Varsha Rao @ 2017-03-28 10:12 UTC (permalink / raw)
To: mawilcox; +Cc: outreachy-kernel
Add ns as the identifier to function definition argument struct
pid_namespace and this patch fixes the checkpatch issue.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
Changes in v3:
- No changes.
Changes in v2:
- No changes.
include/linux/pid.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/pid.h b/include/linux/pid.h
index c6d947f..b94c68b 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -132,7 +132,7 @@ extern struct pid *find_vpid(int nr);
* Lookup a PID in the hash table, and return with it's count elevated.
*/
extern struct pid *find_get_pid(int nr);
-extern struct pid *find_ge_pid(int nr, struct pid_namespace *);
+extern struct pid *find_ge_pid(int nr, struct pid_namespace *ns);
int next_pidmap(struct pid_namespace *pid_ns, unsigned int last);
extern struct pid *alloc_pid(struct pid_namespace *ns);
--
2.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v3 4/5] include: linux: pid: Add a blank line after declarations.
[not found] <cover.1490695255.git.rvarsha016@gmail.com>
` (2 preceding siblings ...)
2017-03-28 10:12 ` [PATCH v3 3/5] include: linux: pid: Add identifier to function definition argument Varsha Rao
@ 2017-03-28 10:14 ` Varsha Rao
2017-03-28 10:15 ` [PATCH v3 5/5] include: linux: pid: Remove space before tabs Varsha Rao
4 siblings, 0 replies; 5+ messages in thread
From: Varsha Rao @ 2017-03-28 10:14 UTC (permalink / raw)
To: mawilcox; +Cc: outreachy-kernel
Add a blank line after declarations and this patch fixes the checkpatch
issue.
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
Changes in v3:
- No changes.
Changes in v2:
- No changes.
include/linux/pid.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/linux/pid.h b/include/linux/pid.h
index b94c68b..ba4f90f 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -152,6 +152,7 @@ extern void disable_pid_allocation(struct pid_namespace *ns);
static inline struct pid_namespace *ns_of_pid(struct pid *pid)
{
struct pid_namespace *ns = NULL;
+
if (pid)
ns = pid->numbers[pid->level].ns;
return ns;
@@ -182,6 +183,7 @@ static inline bool is_child_reaper(struct pid *pid)
static inline pid_t pid_nr(struct pid *pid)
{
pid_t nr = 0;
+
if (pid)
nr = pid->numbers[0].nr;
return nr;
--
2.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH v3 5/5] include: linux: pid: Remove space before tabs.
[not found] <cover.1490695255.git.rvarsha016@gmail.com>
` (3 preceding siblings ...)
2017-03-28 10:14 ` [PATCH v3 4/5] include: linux: pid: Add a blank line after declarations Varsha Rao
@ 2017-03-28 10:15 ` Varsha Rao
4 siblings, 0 replies; 5+ messages in thread
From: Varsha Rao @ 2017-03-28 10:15 UTC (permalink / raw)
To: mawilcox; +Cc: outreachy-kernel
Remove space before tabs. This patch fixes the following checkpatch
issue:
WARNING: please, no space before tabs
Signed-off-by: Varsha Rao <rvarsha016@gmail.com>
---
Changes in v3:
- No changes.
Changes in v2:
- No changes.
include/linux/pid.h | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/include/linux/pid.h b/include/linux/pid.h
index ba4f90f..5feb5c3 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -144,10 +144,10 @@ extern void disable_pid_allocation(struct pid_namespace *ns);
* allocated.
*
* NOTE:
- * ns_of_pid() is expected to be called for a process (task) that has
- * an attached 'struct pid' (see attach_pid(), detach_pid()) i.e @pid
- * is expected to be non-NULL. If @pid is NULL, caller should handle
- * the resulting NULL pid-ns.
+ * ns_of_pid() is expected to be called for a process (task) that has
+ * an attached 'struct pid' (see attach_pid(), detach_pid()) i.e @pid
+ * is expected to be non-NULL. If @pid is NULL, caller should handle
+ * the resulting NULL pid-ns.
*/
static inline struct pid_namespace *ns_of_pid(struct pid *pid)
{
--
2.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread