mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -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/[email protected]
Cc: Al Viro <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Dominik Brodowski <[email protected]>
This commit is contained in:
parent
cbfe20f565
commit
55731b3cda
6 changed files with 46 additions and 16 deletions
23
fs/open.c
23
fs/open.c
|
|
@ -645,8 +645,8 @@ retry_deleg:
|
|||
return error;
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,
|
||||
gid_t, group, int, flag)
|
||||
int do_fchownat(int dfd, const char __user *filename, uid_t user, gid_t group,
|
||||
int flag)
|
||||
{
|
||||
struct path path;
|
||||
int error = -EINVAL;
|
||||
|
|
@ -677,18 +677,24 @@ out:
|
|||
return error;
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,
|
||||
gid_t, group, int, flag)
|
||||
{
|
||||
return do_fchownat(dfd, filename, user, group, flag);
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group)
|
||||
{
|
||||
return sys_fchownat(AT_FDCWD, filename, user, group, 0);
|
||||
return do_fchownat(AT_FDCWD, filename, user, group, 0);
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group)
|
||||
{
|
||||
return sys_fchownat(AT_FDCWD, filename, user, group,
|
||||
AT_SYMLINK_NOFOLLOW);
|
||||
return do_fchownat(AT_FDCWD, filename, user, group,
|
||||
AT_SYMLINK_NOFOLLOW);
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
|
||||
int ksys_fchown(unsigned int fd, uid_t user, gid_t group)
|
||||
{
|
||||
struct fd f = fdget(fd);
|
||||
int error = -EBADF;
|
||||
|
|
@ -708,6 +714,11 @@ out:
|
|||
return error;
|
||||
}
|
||||
|
||||
SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
|
||||
{
|
||||
return ksys_fchown(fd, user, group);
|
||||
}
|
||||
|
||||
int open_check_o_direct(struct file *f)
|
||||
{
|
||||
/* NB: we're sure to have correct a_ops only after f_op->open */
|
||||
|
|
|
|||
Loading…
Reference in a new issue