From: akpm@linux-foundation.org Subject: [patch 10/11] vfs: expand some comments (d_path / seq_path) Date: Mon, 01 Dec 2008 14:35:00 -0800 Message-ID: <200812012235.mB1MZ0nC021142@imap1.linux-foundation.org> Cc: linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org, arjan@infradead.org, arjan@linux.intel.com, hch@lst.de To: viro@zeniv.linux.org.uk Return-path: Received: from smtp1.linux-foundation.org ([140.211.169.13]:55809 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751930AbYLAWmv (ORCPT ); Mon, 1 Dec 2008 17:42:51 -0500 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: From: Arjan van de Ven Explain that you really need to use the return value of d_path rather than the buffer you passed into it. Also fix the comment for seq_path(), the function arguments changed recently but the comment hadn't been updated in sync. Signed-off-by: Arjan van de Ven Cc: Al Viro Cc: Christoph Hellwig Signed-off-by: Andrew Morton --- fs/dcache.c | 8 ++++++-- fs/seq_file.c | 10 ++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff -puN fs/dcache.c~vfs-expand-some-comments-d_path-seq_path fs/dcache.c --- a/fs/dcache.c~vfs-expand-some-comments-d_path-seq_path +++ a/fs/dcache.c @@ -1912,7 +1912,8 @@ static int prepend_name(char **buffer, i * Convert a dentry into an ASCII path name. If the entry has been deleted * the string " (deleted)" is appended. Note that this is ambiguous. * - * Returns the buffer or an error code if the path was too long. + * Returns a pointer into the buffer or an error code if the + * path was too long. * * "buflen" should be positive. Caller holds the dcache_lock. * @@ -1988,7 +1989,10 @@ Elong: * Convert a dentry into an ASCII path name. If the entry has been deleted * the string " (deleted)" is appended. Note that this is ambiguous. * - * Returns the buffer or an error code if the path was too long. + * Returns a pointer into the buffer or an error code if the path was + * too long. Note: Callers should use the returned pointer, not the passed + * in buffer, to use the name! The implementation often starts at an offset + * into the buffer, and may leave 0 bytes at the start. * * "buflen" should be positive. */ diff -puN fs/seq_file.c~vfs-expand-some-comments-d_path-seq_path fs/seq_file.c --- a/fs/seq_file.c~vfs-expand-some-comments-d_path-seq_path +++ a/fs/seq_file.c @@ -389,8 +389,14 @@ char *mangle_path(char *s, char *p, char } EXPORT_SYMBOL_GPL(mangle_path); -/* - * return the absolute path of 'dentry' residing in mount 'mnt'. +/** + * seq_path - seq_file interface to print a pathname + * @m: the seq_file handle + * @path: the struct path to print + * @esc: set of characters to escape in the output + * + * return the absolute path of 'path', as represented by the + * dentry / mnt pair in the path parameter. */ int seq_path(struct seq_file *m, struct path *path, char *esc) { _