mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-24 21:54:34 -04:00
fs: add do_fchownat(), ksys_fchown() helpers and ksys_{,l}chown() wrappers
Using the fs-interal do_fchownat() wrapper allows us to get rid of
fs-internal calls to the sys_fchownat() syscall.
Introducing the ksys_fchown() helper and the ksys_{,}chown() wrappers
allows us to avoid the in-kernel calls to the sys_{,l,f}chown() 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_{,l,f}chown().
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
cbfe20f565
commit
55731b3cda
6 changed files with 46 additions and 16 deletions
|
|
@ -954,6 +954,7 @@ 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);
|
||||
int ksys_fchown(unsigned int fd, uid_t user, gid_t group);
|
||||
|
||||
/*
|
||||
* The following kernel syscall equivalents are just wrappers to fs-internal
|
||||
|
|
@ -1021,4 +1022,20 @@ static inline long ksys_access(const char __user *filename, int mode)
|
|||
return do_faccessat(AT_FDCWD, filename, mode);
|
||||
}
|
||||
|
||||
extern int do_fchownat(int dfd, const char __user *filename, uid_t user,
|
||||
gid_t group, int flag);
|
||||
|
||||
static inline long ksys_chown(const char __user *filename, uid_t user,
|
||||
gid_t group)
|
||||
{
|
||||
return do_fchownat(AT_FDCWD, filename, user, group, 0);
|
||||
}
|
||||
|
||||
static inline long ksys_lchown(const char __user *filename, uid_t user,
|
||||
gid_t group)
|
||||
{
|
||||
return do_fchownat(AT_FDCWD, filename, user, group,
|
||||
AT_SYMLINK_NOFOLLOW);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue