* [PATCH v2 1/5] include: linux: pid: Update documentation.
[not found] <cover.1490539294.git.rvarsha016@gmail.com>
@ 2017-03-26 14:48 ` Varsha Rao
2017-03-26 14:50 ` [PATCH v2 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-26 14:48 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 v2:
- Keep original comments.
- Modified commit message.
include/linux/pid.h | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/include/linux/pid.h b/include/linux/pid.h
index 4d17931..728ba63 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 */
};
/*
@@ -45,6 +45,9 @@ enum pid_type
* 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.
+ * @nr: Pid value.
+ * @ns: Represents the namespace to which pid value belongs.
+ * @pid_chain: Hash chain.
*/
struct upid {
@@ -54,6 +57,15 @@ 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,20 @@ struct pid
extern struct pid init_struct_pid;
+/*
+ * struct pid_link is used for 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 v2 2/5] include: linux: pid: Move open brace to previous line.
[not found] <cover.1490539294.git.rvarsha016@gmail.com>
2017-03-26 14:48 ` [PATCH v2 1/5] include: linux: pid: Update documentation Varsha Rao
@ 2017-03-26 14:50 ` Varsha Rao
2017-03-26 14:51 ` [PATCH v2 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-26 14:50 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>
---
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 728ba63..c27ca01 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 {
* @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 v2 3/5] include: linux: pid: Add identifier to function definition argument.
[not found] <cover.1490539294.git.rvarsha016@gmail.com>
2017-03-26 14:48 ` [PATCH v2 1/5] include: linux: pid: Update documentation Varsha Rao
2017-03-26 14:50 ` [PATCH v2 2/5] include: linux: pid: Move open brace to previous line Varsha Rao
@ 2017-03-26 14:51 ` Varsha Rao
2017-03-26 14:53 ` [PATCH v2 4/5] include: linux: pid: Add a blank line after declarations Varsha Rao
2017-03-26 14:55 ` [PATCH v2 5/5] include: linux: pid: Remove space before tabs Varsha Rao
4 siblings, 0 replies; 5+ messages in thread
From: Varsha Rao @ 2017-03-26 14:51 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>
---
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 c27ca01..04c0a5b 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -131,7 +131,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 v2 4/5] include: linux: pid: Add a blank line after declarations.
[not found] <cover.1490539294.git.rvarsha016@gmail.com>
` (2 preceding siblings ...)
2017-03-26 14:51 ` [PATCH v2 3/5] include: linux: pid: Add identifier to function definition argument Varsha Rao
@ 2017-03-26 14:53 ` Varsha Rao
2017-03-26 14:55 ` [PATCH v2 5/5] include: linux: pid: Remove space before tabs Varsha Rao
4 siblings, 0 replies; 5+ messages in thread
From: Varsha Rao @ 2017-03-26 14:53 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 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 04c0a5b..dd74e72 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -151,6 +151,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;
@@ -181,6 +182,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 v2 5/5] include: linux: pid: Remove space before tabs.
[not found] <cover.1490539294.git.rvarsha016@gmail.com>
` (3 preceding siblings ...)
2017-03-26 14:53 ` [PATCH v2 4/5] include: linux: pid: Add a blank line after declarations Varsha Rao
@ 2017-03-26 14:55 ` Varsha Rao
4 siblings, 0 replies; 5+ messages in thread
From: Varsha Rao @ 2017-03-26 14:55 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 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 dd74e72..94d61e3 100644
--- a/include/linux/pid.h
+++ b/include/linux/pid.h
@@ -143,10 +143,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