From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleg Nesterov Subject: [RFC PATCH 4/5] proc: introduce pid_entry_name() Date: Fri, 8 Aug 2014 20:57:59 +0200 Message-ID: <20140808185759.GA791@redhat.com> References: <20140808185732.GA760@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: Alexander Viro , Alexey Dobriyan , Andrew Morton , Cyrill Gorcunov , David Howells , "David S. Miller" , "Eric W. Biederman" , "Kirill A. Shutemov" , Peter Zijlstra , Sasha Levin Return-path: Content-Disposition: inline In-Reply-To: <20140808185732.GA760@redhat.com> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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 --- 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