diff options
| author | Mark Rutland <mark.rutland@arm.com> | 2018-07-11 09:56:51 -0400 |
|---|---|---|
| committer | Will Deacon <will.deacon@arm.com> | 2018-07-12 09:49:48 -0400 |
| commit | 9b54bf9d6a5b30e2cc22b18793e9a4158c5b4882 (patch) | |
| tree | 2239cebf690d0e02e630567eec999229d27e74cf /fs/statfs.c | |
| parent | bf1c77b4644f46d2986b7ca5e43e012f0fc8984b (diff) | |
kernel: add kcompat_sys_{f,}statfs64()
Using this helper allows us to avoid the in-kernel calls to the
compat_sys_{f,}statfs64() sycalls, as are necessary for parameter
mangling in arm64's compat handling.
Following the example of ksys_* functions, kcompat_sys_* functions are
intended to be a drop-in replacement for their compat_sys_*
counterparts, with the same calling convention.
This is necessary to enable conversion of arm64's syscall handling to
use pt_regs wrappers.
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Dominik Brodowski <linux@dominikbrodowski.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Will Deacon <will.deacon@arm.com>
Diffstat (limited to 'fs/statfs.c')
| -rw-r--r-- | fs/statfs.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/statfs.c b/fs/statfs.c index 5b2a24f0f263..f0216629621d 100644 --- a/fs/statfs.c +++ b/fs/statfs.c | |||
| @@ -335,7 +335,7 @@ static int put_compat_statfs64(struct compat_statfs64 __user *ubuf, struct kstat | |||
| 335 | return 0; | 335 | return 0; |
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | COMPAT_SYSCALL_DEFINE3(statfs64, const char __user *, pathname, compat_size_t, sz, struct compat_statfs64 __user *, buf) | 338 | int kcompat_sys_statfs64(const char __user * pathname, compat_size_t sz, struct compat_statfs64 __user * buf) |
| 339 | { | 339 | { |
| 340 | struct kstatfs tmp; | 340 | struct kstatfs tmp; |
| 341 | int error; | 341 | int error; |
| @@ -349,7 +349,12 @@ COMPAT_SYSCALL_DEFINE3(statfs64, const char __user *, pathname, compat_size_t, s | |||
| 349 | return error; | 349 | return error; |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | COMPAT_SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, compat_size_t, sz, struct compat_statfs64 __user *, buf) | 352 | COMPAT_SYSCALL_DEFINE3(statfs64, const char __user *, pathname, compat_size_t, sz, struct compat_statfs64 __user *, buf) |
| 353 | { | ||
| 354 | return kcompat_sys_statfs64(pathname, sz, buf); | ||
| 355 | } | ||
| 356 | |||
| 357 | int kcompat_sys_fstatfs64(unsigned int fd, compat_size_t sz, struct compat_statfs64 __user * buf) | ||
| 353 | { | 358 | { |
| 354 | struct kstatfs tmp; | 359 | struct kstatfs tmp; |
| 355 | int error; | 360 | int error; |
| @@ -363,6 +368,11 @@ COMPAT_SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, compat_size_t, sz, struct co | |||
| 363 | return error; | 368 | return error; |
| 364 | } | 369 | } |
| 365 | 370 | ||
| 371 | COMPAT_SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, compat_size_t, sz, struct compat_statfs64 __user *, buf) | ||
| 372 | { | ||
| 373 | return kcompat_sys_fstatfs64(fd, sz, buf); | ||
| 374 | } | ||
| 375 | |||
| 366 | /* | 376 | /* |
| 367 | * This is a copy of sys_ustat, just dealing with a structure layout. | 377 | * This is a copy of sys_ustat, just dealing with a structure layout. |
| 368 | * Given how simple this syscall is that apporach is more maintainable | 378 | * Given how simple this syscall is that apporach is more maintainable |
