From 8228e2c313194f13f1d1806ed5734a26c38d49ac Mon Sep 17 00:00:00 2001 From: Dmitry Kadashev Date: Thu, 8 Jul 2021 13:34:42 +0700 Subject: namei: add getname_uflags() There are a couple of places where we already open-code the (flags & AT_EMPTY_PATH) check and io_uring will likely add another one in the future. Let's just add a simple helper getname_uflags() that handles this directly and use it. Cc: Al Viro Cc: Christian Brauner Acked-by: Linus Torvalds Link: https://lore.kernel.org/io-uring/20210415100815.edrn4a7cy26wkowe@wittgenstein/ Signed-off-by: Christian Brauner Signed-off-by: Dmitry Kadashev Acked-by: Christian Brauner Link: https://lore.kernel.org/r/20210708063447.3556403-7-dkadashev@gmail.com Signed-off-by: Jens Axboe --- fs/namei.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'fs/namei.c') diff --git a/fs/namei.c b/fs/namei.c index 522c35b33fea..41f58dabe84c 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -203,6 +203,14 @@ getname_flags(const char __user *filename, int flags, int *empty) return result; } +struct filename * +getname_uflags(const char __user *filename, int uflags) +{ + int flags = (uflags & AT_EMPTY_PATH) ? LOOKUP_EMPTY : 0; + + return getname_flags(filename, flags, NULL); +} + struct filename * getname(const char __user * filename) { -- cgit v1.2.3-59-g8ed1b