Skip to content

Commit

Permalink
fs: add do_lookup_dcookie() helper; remove in-kernel call to syscall
Browse files Browse the repository at this point in the history
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/[email protected]

Cc: Al Viro <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Dominik Brodowski <[email protected]>
  • Loading branch information
Dominik Brodowski committed Apr 2, 2018
1 parent 2fc96f8 commit 98e5f7b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions fs/dcookies.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* 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;
int err = -EINVAL;
Expand Down Expand Up @@ -203,13 +203,18 @@ SYSCALL_DEFINE3(lookup_dcookie, u64, cookie64, char __user *, buf, size_t, len)
return err;
}

SYSCALL_DEFINE3(lookup_dcookie, u64, cookie64, char __user *, buf, size_t, len)
{
return do_lookup_dcookie(cookie64, buf, len);
}

#ifdef CONFIG_COMPAT
COMPAT_SYSCALL_DEFINE4(lookup_dcookie, u32, w0, u32, w1, char __user *, buf, compat_size_t, len)
{
#ifdef __BIG_ENDIAN
return sys_lookup_dcookie(((u64)w0 << 32) | w1, buf, len);
return do_lookup_dcookie(((u64)w0 << 32) | w1, buf, len);
#else
return sys_lookup_dcookie(((u64)w1 << 32) | w0, buf, len);
return do_lookup_dcookie(((u64)w1 << 32) | w0, buf, len);
#endif
}
#endif
Expand Down

0 comments on commit 98e5f7b

Please sign in to comment.