summaryrefslogtreecommitdiffstats
path: root/fs/iomap
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2021-05-18 03:19:35 +0200
committerAl Viro <viro@zeniv.linux.org.uk>2021-05-19 02:06:36 +0200
commit3acca043261fa6268961d152ea2505e217eabcba (patch)
treef8113f1648eb75b189c6cfbf8d638b39299e9ea6 /fs/iomap
parentd_path: saner calling conventions for __dentry_path() (diff)
downloadlinux-3acca043261fa6268961d152ea2505e217eabcba.tar.xz
linux-3acca043261fa6268961d152ea2505e217eabcba.zip
d_path: regularize handling of root dentry in __dentry_path()
All path-forming primitives boil down to sequence of prepend_name() on dentries encountered along the way toward root. Each time we prepend / + dentry name to the buffer. Normally that does exactly what we want, but there's a corner case when we don't call prepend_name() at all (in case of __dentry_path() that happens if we are given root dentry). We obviously want to end up with "/", rather than "", so this corner case needs to be handled. __dentry_path() used to manually put '/' in the end of buffer before doing anything else, to be overwritten by the first call of prepend_name() if one happens and to be left in place if we don't call prepend_name() at all. That required manually checking that we had space in the buffer (prepend_name() and prepend() take care of such checks themselves) and lead to clumsy keeping track of return value. A better approach is to check if the main loop has added anything into the buffer and prepend "/" if it hasn't. A side benefit of using prepend() is that it does the right thing if we'd already run out of buffer, making the overflow-handling logics simpler. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/iomap')
0 files changed, 0 insertions, 0 deletions