lkml.org 
[lkml]   [2014]   [Aug]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[RFC PATCH 4/5] proc: introduce pid_entry_name()
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@redhat.com>
---
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


\
 
 \ /
  Last update: 2014-08-08 21:21    [W:0.066 / U:0.208 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site