<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/fs/d_path.c, branch v5.14</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/
</subtitle>
<id>https://git.shady.money/linux/atom?h=v5.14</id>
<link rel='self' href='https://git.shady.money/linux/atom?h=v5.14'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/'/>
<updated>2021-05-19T00:15:58Z</updated>
<entry>
<title>getcwd(2): clean up error handling</title>
<updated>2021-05-19T00:15:58Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2021-05-17T00:24:00Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=e4b275531887fef7f7d8a7284bfc32f0fbbd4208'/>
<id>urn:sha1:e4b275531887fef7f7d8a7284bfc32f0fbbd4208</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>d_path: prepend_path() is unlikely to return non-zero</title>
<updated>2021-05-19T00:15:58Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2021-05-17T00:19:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=cf4febc1adc8e5cd11ca3386e1e3ea356e0792f0'/>
<id>urn:sha1:cf4febc1adc8e5cd11ca3386e1e3ea356e0792f0</id>
<content type='text'>
Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>d_path: prepend_path(): lift the inner loop into a new helper</title>
<updated>2021-05-19T00:15:57Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2021-05-12T20:38:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=008673ff74a513ac2c282db8825b6118151ee660'/>
<id>urn:sha1:008673ff74a513ac2c282db8825b6118151ee660</id>
<content type='text'>
... and leave the rename_lock/mount_lock handling in prepend_path()
itself

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>d_path: prepend_path(): lift resetting b in case when we'd return 3 out of loop</title>
<updated>2021-05-19T00:15:56Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2021-05-12T20:21:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=2dac0ad17598d1e54a264ed9286fa7bdbd75a97b'/>
<id>urn:sha1:2dac0ad17598d1e54a264ed9286fa7bdbd75a97b</id>
<content type='text'>
preparation to extracting the loop into helper (next commit)

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>d_path: prepend_path(): get rid of vfsmnt</title>
<updated>2021-05-19T00:15:56Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2021-05-12T20:24:12Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=7c0d552fd5aa3527ed01290832ebbe072fa5de52'/>
<id>urn:sha1:7c0d552fd5aa3527ed01290832ebbe072fa5de52</id>
<content type='text'>
it's kept equal to &amp;mnt-&gt;mnt all along.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>d_path: introduce struct prepend_buffer</title>
<updated>2021-05-19T00:14:53Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2021-05-12T18:51:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=ad08ae586586ea9e2c0228a3d5a083500ea54202'/>
<id>urn:sha1:ad08ae586586ea9e2c0228a3d5a083500ea54202</id>
<content type='text'>
        We've a lot of places where we have pairs of form (pointer to end
of buffer, amount of space left in front of that).  These sit in pairs of
variables located next to each other and usually passed by reference.
Turn those into instances of new type (struct prepend_buffer) and pass
reference to the pair instead of pairs of references to its fields.

Declared and initialized by DECLARE_BUFFER(name, buf, buflen).

extract_string(prepend_buffer) returns the buffer contents if
no overflow has happened, ERR_PTR(ENAMETOOLONG) otherwise.
All places where we used to have that boilerplate converted to use
of that helper.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>d_path: make prepend_name() boolean</title>
<updated>2021-05-19T00:08:12Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2021-05-18T02:41:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=95b55c42f65af3fb9e2dceaf4d8dde522c0472d3'/>
<id>urn:sha1:95b55c42f65af3fb9e2dceaf4d8dde522c0472d3</id>
<content type='text'>
It returns only 0 or -ENAMETOOLONG and both callers only check if
the result is negative.  Might as well return true on success and
false on failure...

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>d_path: lift -ENAMETOOLONG handling into callers of prepend_path()</title>
<updated>2021-05-19T00:08:12Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2021-05-18T02:29:03Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=01a4428ee7068875995ee27e9ba5503874f23e3b'/>
<id>urn:sha1:01a4428ee7068875995ee27e9ba5503874f23e3b</id>
<content type='text'>
The only negative value ever returned by prepend_path() is -ENAMETOOLONG
and callers can recognize that situation (overflow) by looking at the
sign of buflen.  Lift that into the callers; we already have the
same logics (buf if buflen is non-negative, ERR_PTR(-ENAMETOOLONG) otherwise)
in several places and that'll become a new primitive several commits down
the road.

Make prepend_path() return 0 instead of -ENAMETOOLONG.  That makes for
saner calling conventions (0/1/2/3/-ENAMETOOLONG is obnoxious) and
callers actually get simpler, especially once the aforementioned
primitive gets added.

In prepend_path() itself we switch prepending the / (in case of
empty path) to use of prepend() - no need to open-code that, compiler
will do the right thing.  It's exactly the same logics as in
__dentry_path().

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>d_path: don't bother with return value of prepend()</title>
<updated>2021-05-19T00:08:11Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2021-05-18T02:05:23Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=d8548232ea2858d1d130f3ac835185159d367caa'/>
<id>urn:sha1:d8548232ea2858d1d130f3ac835185159d367caa</id>
<content type='text'>
Only simple_dname() checks it, and there we can simply do those
calls and check for overflow (by looking of negative buflen)
in the end.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
<entry>
<title>getcwd(2): saner logics around prepend_path() call</title>
<updated>2021-05-19T00:08:11Z</updated>
<author>
<name>Al Viro</name>
<email>viro@zeniv.linux.org.uk</email>
</author>
<published>2021-05-18T01:56:38Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/linux/commit/?id=a0378fb9b33308fb4547f098c6281af8ab4b5fb5'/>
<id>urn:sha1:a0378fb9b33308fb4547f098c6281af8ab4b5fb5</id>
<content type='text'>
The only negative value that might get returned by prepend_path() is
-ENAMETOOLONG, and that happens only on overflow.  The same goes for
prepend_unreachable().  Overflow is detectable by observing negative
buflen, so we can simplify the control flow around the prepend_path()
call.  Expand prepend_unreachable(), while we are at it - that's the
only caller.

Signed-off-by: Al Viro &lt;viro@zeniv.linux.org.uk&gt;
</content>
</entry>
</feed>
