aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2018-03-11 06:34:53 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2018-04-02 14:15:57 -0400
commit03450e271a160bc07a2c48e5769e0ba338582d77 (patch)
tree712f97925bdf4cc7e484f379a9d2355ae8629850 /include/linux
parent46ea89eb652a365e10257016d09dcf1aaf23cf63 (diff)
fs: add ksys_fchmod() and do_fchmodat() helpers and ksys_chmod() wrapper; remove in-kernel calls to syscall
Using the fs-internal do_fchmodat() helper allows us to get rid of fs-internal calls to the sys_fchmodat() syscall. Introducing the ksys_fchmod() helper and the ksys_chmod() wrapper allows us to avoid the in-kernel calls to the sys_fchmod() and sys_chmod() syscalls. The ksys_ prefix denotes that these functions are meant as a drop-in replacement for the syscalls. In particular, they use the same calling convention as sys_fchmod() and sys_chmod(). 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: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/syscalls.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 827ed917630c..dd6c306f4f00 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -953,6 +953,7 @@ int ksys_dup(unsigned int fildes);
953int ksys_chroot(const char __user *filename); 953int ksys_chroot(const char __user *filename);
954ssize_t ksys_write(unsigned int fd, const char __user *buf, size_t count); 954ssize_t ksys_write(unsigned int fd, const char __user *buf, size_t count);
955int ksys_chdir(const char __user *filename); 955int ksys_chdir(const char __user *filename);
956int ksys_fchmod(unsigned int fd, umode_t mode);
956 957
957/* 958/*
958 * The following kernel syscall equivalents are just wrappers to fs-internal 959 * The following kernel syscall equivalents are just wrappers to fs-internal
@@ -1006,4 +1007,11 @@ static inline long ksys_link(const char __user *oldname,
1006 return do_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0); 1007 return do_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
1007} 1008}
1008 1009
1010extern int do_fchmodat(int dfd, const char __user *filename, umode_t mode);
1011
1012static inline int ksys_chmod(const char __user *filename, umode_t mode)
1013{
1014 return do_fchmodat(AT_FDCWD, filename, mode);
1015}
1016
1009#endif 1017#endif