]> www.infradead.org Git - users/jedix/linux-maple.git/commit
getname_maybe_null() - the third variant of pathname copy-in
authorAl Viro <viro@zeniv.linux.org.uk>
Tue, 8 Oct 2024 03:08:34 +0000 (23:08 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 20 Oct 2024 00:33:34 +0000 (20:33 -0400)
commite896474fe4851ffc4dd860c92daa906783090346
tree190f43b0cad7d3754b88e3f3f3b9d4f365408bc1
parent5b313bcb6e3597dacd893ae9545fd087df46db45
getname_maybe_null() - the third variant of pathname copy-in

Semantics used by statx(2) (and later *xattrat(2)): without AT_EMPTY_PATH
it's standard getname() (i.e. ERR_PTR(-ENOENT) on empty string,
ERR_PTR(-EFAULT) on NULL), with AT_EMPTY_PATH both empty string and
NULL are accepted.

Calling conventions: getname_maybe_null(user_pointer, flags) returns
* pointer to struct filename when non-empty string had been
successfully read
* ERR_PTR(...) on error
* NULL if an empty string or NULL pointer had been given
with AT_EMPTY_PATH in the flags argument.

It tries to avoid allocation in the last case; it's not always
able to do so, in which case the temporary struct filename instance
is freed and NULL returned anyway.

Fast path is inlined.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/namei.c
fs/stat.c
include/linux/fs.h