Skip to content

Commit

Permalink
expand some comments (d_path / seq_path)
Browse files Browse the repository at this point in the history
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 <arjan@linux.intel.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Arjan van de Ven authored and Al Viro committed Dec 31, 2008
1 parent be42c4c commit 52afeef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
8 changes: 6 additions & 2 deletions fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,8 @@ static int prepend_name(char **buffer, int *buflen, struct qstr *name)
* 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.
*
Expand Down Expand Up @@ -1984,7 +1985,10 @@ char *__d_path(const struct path *path, struct path *root,
* 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.
*/
Expand Down
10 changes: 8 additions & 2 deletions fs/seq_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,14 @@ char *mangle_path(char *s, char *p, char *esc)
}
EXPORT_SYMBOL(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)
{
Expand Down

0 comments on commit 52afeef

Please sign in to comment.