Skip to contentSkip to conversation

include: linux: pid: Update documentation.

PATCH Superseded Varsha Rao 1 participant 5 messages Mar 26, 2017 1 message not in the archive

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Varsha Rao

author
#1 lore raw

PATCH v2 1/5 include: linux: pid: Update documentation.

In reply to a message not in the archive

This patch adds comments to update documentation.

---
Changes in v2:
- Keep original comments.
- Modified commit message.

 include/linux/pid.h | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)
include/linux/pid.h +24 -4
index 4d17931..728ba63 100644
@@ -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)
Signature · 1 line
2.9.3
author
#2 lore raw

PATCH v2 2/5 include: linux: pid: Move open brace to previous line.

In reply to a message not in the archive

Move open braces to the same line, as that of struct and enum. This patch fixes the checkpatch issue.

---
 include/linux/pid.h | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
include/linux/pid.h +3 -6
index 728ba63..c27ca01 100644
@@ -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;
 };
Signature · 1 line
2.9.3
author
#3 lore raw

PATCH v2 3/5 include: linux: pid: Add identifier to function definition argument.

In reply to a message not in the archive

Add ns as the identifier to function definition argument struct pid_namespace and this patch fixes the checkpatch issue.

---
 include/linux/pid.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/pid.h +1 -1
index c27ca01..04c0a5b 100644
@@ -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);
Signature · 1 line
2.9.3
author
#4 lore raw

PATCH v2 4/5 include: linux: pid: Add a blank line after declarations.

In reply to a message not in the archive

Add a blank line after declarations and this patch fixes the checkpatch issue.

---
Changes in v2:
- No changes.

 include/linux/pid.h | 2 ++
 1 file changed, 2 insertions(+)
include/linux/pid.h +2 -0
index 04c0a5b..dd74e72 100644
@@ -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;
Signature · 1 line
2.9.3
author
#5 lore raw

PATCH v2 5/5 include: linux: pid: Remove space before tabs.

In reply to a message not in the archive

Remove space before tabs. This patch fixes the following checkpatch issue:

WARNING: please, no space before tabs

---
Changes in v2:
- No changes.

 include/linux/pid.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/linux/pid.h +4 -4
index dd74e72..94d61e3 100644
@@ -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)
 {
Signature · 1 line
2.9.3