[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 8 Aug 2014 20:57:59 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Alexander Viro <viro@...iv.linux.org.uk>,
Alexey Dobriyan <adobriyan@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Cyrill Gorcunov <gorcunov@...nvz.org>,
David Howells <dhowells@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
"Kirill A. Shutemov" <kirill@...temov.name>,
Peter Zijlstra <peterz@...radead.org>,
Sasha Levin <levinsasha928@...il.com>
Cc: linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
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@...hat.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists