mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-23 21:19:04 -04:00
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>
This commit is contained in:
parent
46ea89eb65
commit
03450e271a
4 changed files with 27 additions and 6 deletions
|
|
@ -953,6 +953,7 @@ int ksys_dup(unsigned int fildes);
|
|||
int ksys_chroot(const char __user *filename);
|
||||
ssize_t ksys_write(unsigned int fd, const char __user *buf, size_t count);
|
||||
int ksys_chdir(const char __user *filename);
|
||||
int ksys_fchmod(unsigned int fd, umode_t mode);
|
||||
|
||||
/*
|
||||
* The following kernel syscall equivalents are just wrappers to fs-internal
|
||||
|
|
@ -1006,4 +1007,11 @@ static inline long ksys_link(const char __user *oldname,
|
|||
return do_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
|
||||
}
|
||||
|
||||
extern int do_fchmodat(int dfd, const char __user *filename, umode_t mode);
|
||||
|
||||
static inline int ksys_chmod(const char __user *filename, umode_t mode)
|
||||
{
|
||||
return do_fchmodat(AT_FDCWD, filename, mode);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue