[RFC PATCH 4/5] proc: introduce pid_entry_name()

From: Oleg Nesterov
Date: Fri Aug 08 2014 - 15:00:32 EST


Yes, this is ugly. I think we should simply export struct pid_entry,
or make is_tgid_pid_entry/pid_entry_name "struct inode *". Or something
else. Lets discuss this later.

See the next patch which explains why.

Signed-off-by: Oleg Nesterov <oleg@xxxxxxxxxx>
---
fs/proc/base.c | 7 +++++++
fs/proc/internal.h | 1 +
2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 368f6fe..81d372c 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2992,6 +2992,13 @@ bool is_tgid_pid_entry(const struct pid_entry *p)
BUG();
}

+// THIS IS UGLY, JUST TO DISCUSS RFC
+const char *pid_entry_name(const struct pid_entry *p)
+{
+ is_tgid_pid_entry(p); // trigger BUG_ON() if not valid
+ return p->name;
+}
+
static int proc_tid_base_readdir(struct file *file, struct dir_context *ctx)
{
return proc_pident_readdir(file, ctx,
diff --git a/fs/proc/internal.h b/fs/proc/internal.h
index 46500af..c162db2 100644
--- a/fs/proc/internal.h
+++ b/fs/proc/internal.h
@@ -150,6 +150,7 @@ out:
extern const struct file_operations proc_tid_children_operations;

extern bool is_tgid_pid_entry(const struct pid_entry *p);
+extern const char *pid_entry_name(const struct pid_entry *p);

extern int proc_pid_stat(struct seq_file *, struct pid_namespace *,
struct pid *, struct task_struct *);
--
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/