diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2018-03-19 12:38:31 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2018-04-02 14:16:09 -0400 |
commit | 36028d5dd71175c332ab634e089e16dbdfe3812b (patch) | |
tree | d25084dfe2fe7c0a070cad40333a365af076695c /fs/read_write.c | |
parent | df260e21e6cd5d2dfc1fe9b6a3bbf747e72b3bed (diff) |
fs: add ksys_p{read,write}64() helpers; remove in-kernel calls to syscalls
Using the ksys_p{read,write}64() wrappers allows us to get rid of
in-kernel calls to the sys_pread64() and sys_pwrite64() syscalls.
The ksys_ prefix denotes that this function is meant as a drop-in
replacement for the syscall. In particular, it uses the same calling
convention as sys_p{read,write}64().
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 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index fc441e1ac683..c4eabbfc90df 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -610,8 +610,8 @@ SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, | |||
610 | return ksys_write(fd, buf, count); | 610 | return ksys_write(fd, buf, count); |
611 | } | 611 | } |
612 | 612 | ||
613 | SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf, | 613 | ssize_t ksys_pread64(unsigned int fd, char __user *buf, size_t count, |
614 | size_t, count, loff_t, pos) | 614 | loff_t pos) |
615 | { | 615 | { |
616 | struct fd f; | 616 | struct fd f; |
617 | ssize_t ret = -EBADF; | 617 | ssize_t ret = -EBADF; |
@@ -630,8 +630,14 @@ SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf, | |||
630 | return ret; | 630 | return ret; |
631 | } | 631 | } |
632 | 632 | ||
633 | SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf, | 633 | SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf, |
634 | size_t, count, loff_t, pos) | 634 | size_t, count, loff_t, pos) |
635 | { | ||
636 | return ksys_pread64(fd, buf, count, pos); | ||
637 | } | ||
638 | |||
639 | ssize_t ksys_pwrite64(unsigned int fd, const char __user *buf, | ||
640 | size_t count, loff_t pos) | ||
635 | { | 641 | { |
636 | struct fd f; | 642 | struct fd f; |
637 | ssize_t ret = -EBADF; | 643 | ssize_t ret = -EBADF; |
@@ -650,6 +656,12 @@ SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf, | |||
650 | return ret; | 656 | return ret; |
651 | } | 657 | } |
652 | 658 | ||
659 | SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf, | ||
660 | size_t, count, loff_t, pos) | ||
661 | { | ||
662 | return ksys_pwrite64(fd, buf, count, pos); | ||
663 | } | ||
664 | |||
653 | static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter, | 665 | static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter, |
654 | loff_t *ppos, int type, rwf_t flags) | 666 | loff_t *ppos, int type, rwf_t flags) |
655 | { | 667 | { |