mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 02:36:02 +00:00
d_path: get rid of path_with_deleted()
expand in the sole caller; transform the initial prepends similar to what we'd done in dentry_path() (prepend_path() will fail the right way if we call it with negative buflen, same as __dentry_path() does). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
3acca04326
commit
9024348f53
23
fs/d_path.c
23
fs/d_path.c
@ -211,23 +211,6 @@ char *d_absolute_path(const struct path *path,
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* same as __d_path but appends "(deleted)" for unlinked files.
|
|
||||||
*/
|
|
||||||
static int path_with_deleted(const struct path *path,
|
|
||||||
const struct path *root,
|
|
||||||
char **buf, int *buflen)
|
|
||||||
{
|
|
||||||
prepend(buf, buflen, "", 1);
|
|
||||||
if (d_unlinked(path->dentry)) {
|
|
||||||
int error = prepend(buf, buflen, " (deleted)", 10);
|
|
||||||
if (error)
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
return prepend_path(path, root, buf, buflen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int prepend_unreachable(char **buffer, int *buflen)
|
static int prepend_unreachable(char **buffer, int *buflen)
|
||||||
{
|
{
|
||||||
return prepend(buffer, buflen, "(unreachable)", 13);
|
return prepend(buffer, buflen, "(unreachable)", 13);
|
||||||
@ -282,7 +265,11 @@ char *d_path(const struct path *path, char *buf, int buflen)
|
|||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
get_fs_root_rcu(current->fs, &root);
|
get_fs_root_rcu(current->fs, &root);
|
||||||
error = path_with_deleted(path, &root, &res, &buflen);
|
if (unlikely(d_unlinked(path->dentry)))
|
||||||
|
prepend(&res, &buflen, " (deleted)", 11);
|
||||||
|
else
|
||||||
|
prepend(&res, &buflen, "", 1);
|
||||||
|
error = prepend_path(path, &root, &res, &buflen);
|
||||||
rcu_read_unlock();
|
rcu_read_unlock();
|
||||||
|
|
||||||
if (error < 0)
|
if (error < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user