Commit 98e5f7bd authored by Dominik Brodowski's avatar Dominik Brodowski

fs: add do_lookup_dcookie() helper; remove in-kernel call to syscall

Using the fs-internal do_lookup_dcookie() helper allows us to get rid of
fs-internal calls to the sys_lookup_dcookie() syscall.

This patch is part of a series which removes in-kernel calls to syscalls.
On this basis, the syscall entry path can be streamlined. For details, see
http://lkml.kernel.org/r/20180325162527.GA17492@light.dominikbrodowski.net

Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent 2fc96f83
...@@ -146,7 +146,7 @@ int get_dcookie(const struct path *path, unsigned long *cookie) ...@@ -146,7 +146,7 @@ int get_dcookie(const struct path *path, unsigned long *cookie)
/* And here is where the userspace process can look up the cookie value /* And here is where the userspace process can look up the cookie value
* to retrieve the path. * to retrieve the path.
*/ */
SYSCALL_DEFINE3(lookup_dcookie, u64, cookie64, char __user *, buf, size_t, len) static int do_lookup_dcookie(u64 cookie64, char __user *buf, size_t len)
{ {
unsigned long cookie = (unsigned long)cookie64; unsigned long cookie = (unsigned long)cookie64;
int err = -EINVAL; int err = -EINVAL;
...@@ -203,13 +203,18 @@ SYSCALL_DEFINE3(lookup_dcookie, u64, cookie64, char __user *, buf, size_t, len) ...@@ -203,13 +203,18 @@ SYSCALL_DEFINE3(lookup_dcookie, u64, cookie64, char __user *, buf, size_t, len)
return err; return err;
} }
SYSCALL_DEFINE3(lookup_dcookie, u64, cookie64, char __user *, buf, size_t, len)
{
return do_lookup_dcookie(cookie64, buf, len);
}
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, w0, u32, w1, char __user *, buf, compat_size_t, len) COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, w0, u32, w1, char __user *, buf, compat_size_t, len)
{ {
#ifdef __BIG_ENDIAN #ifdef __BIG_ENDIAN
return sys_lookup_dcookie(((u64)w0 << 32) | w1, buf, len); return do_lookup_dcookie(((u64)w0 << 32) | w1, buf, len);
#else #else
return sys_lookup_dcookie(((u64)w1 << 32) | w0, buf, len); return do_lookup_dcookie(((u64)w1 << 32) | w0, buf, len);
#endif #endif
} }
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment