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:
@@ -343,7 +343,7 @@ static int __init do_name(void)
|
||||
wfd = sys_open(collected, openflags, mode);
|
||||
|
||||
if (wfd >= 0) {
|
||||
sys_fchown(wfd, uid, gid);
|
||||
ksys_fchown(wfd, uid, gid);
|
||||
ksys_fchmod(wfd, mode);
|
||||
if (body_len)
|
||||
sys_ftruncate(wfd, body_len);
|
||||
@@ -353,14 +353,14 @@ static int __init do_name(void)
|
||||
}
|
||||
} else if (S_ISDIR(mode)) {
|
||||
ksys_mkdir(collected, mode);
|
||||
sys_chown(collected, uid, gid);
|
||||
ksys_chown(collected, uid, gid);
|
||||
ksys_chmod(collected, mode);
|
||||
dir_add(collected, mtime);
|
||||
} else if (S_ISBLK(mode) || S_ISCHR(mode) ||
|
||||
S_ISFIFO(mode) || S_ISSOCK(mode)) {
|
||||
if (maybe_link() == 0) {
|
||||
ksys_mknod(collected, mode, rdev);
|
||||
sys_chown(collected, uid, gid);
|
||||
ksys_chown(collected, uid, gid);
|
||||
ksys_chmod(collected, mode);
|
||||
do_utime(collected, mtime);
|
||||
}
|
||||
@@ -393,7 +393,7 @@ static int __init do_symlink(void)
|
||||
collected[N_ALIGN(name_len) + body_len] = '\0';
|
||||
clean_path(collected, 0);
|
||||
ksys_symlink(collected + N_ALIGN(name_len), collected);
|
||||
sys_lchown(collected, uid, gid);
|
||||
ksys_lchown(collected, uid, gid);
|
||||
do_utime(collected, mtime);
|
||||
state = SkipIt;
|
||||
next_state = Reset;
|
||||
|
Reference in New Issue
Block a user