[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 098/108] linux-user: Split out fallocate, sync_fi
From: |
Richard Henderson |
Subject: |
[Qemu-devel] [PATCH v2 098/108] linux-user: Split out fallocate, sync_file_range/2 |
Date: |
Sat, 9 Jun 2018 17:02:10 -1000 |
All targets define fallocate; remove the ifdefs.
Signed-off-by: Richard Henderson <address@hidden>
---
linux-user/syscall.c | 101 +++++++++++++++++++++++++++----------------
1 file changed, 63 insertions(+), 38 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 1158afde27..5edcb39b73 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -8208,6 +8208,18 @@ IMPL(fadvise64)
# endif
#endif /* end fadvise64 handling */
+#ifdef CONFIG_FALLOCATE
+IMPL(fallocate)
+{
+# if TARGET_ABI_BITS == 32
+ return get_errno(fallocate(arg1, arg2, target_offset64(arg3, arg4),
+ target_offset64(arg5, arg6)));
+# else
+ return get_errno(fallocate(arg1, arg2, arg3, arg4));
+# endif
+}
+#endif
+
IMPL(fchdir)
{
return get_errno(fchdir(arg1));
@@ -12310,6 +12322,46 @@ IMPL(syncfs)
}
#endif
+#ifdef CONFIG_SYNC_FILE_RANGE
+# ifdef TARGET_NR_sync_file_range
+IMPL(sync_file_range)
+{
+ uint64_t off, len;
+ unsigned flags;
+
+# if TARGET_ABI_BITS == 32
+ if (regpairs_aligned(cpu_env, TARGET_NR_sync_file_range)) {
+ off = target_offset64(arg3, arg4);
+ len = target_offset64(arg5, arg6);
+ flags = arg7;
+ } else {
+ off = target_offset64(arg2, arg3);
+ len = target_offset64(arg4, arg5);
+ flags = arg6;
+ }
+# else
+ off = arg2;
+ len = arg3;
+ flags = arg4;
+# endif
+ return get_errno(sync_file_range(arg1, off, len, flags));
+}
+# endif
+
+# ifdef TARGET_NR_sync_file_range2
+IMPL(sync_file_range2)
+{
+ /* This is like sync_file_range but the arguments are reordered */
+# if TARGET_ABI_BITS == 32
+ return get_errno(sync_file_range(arg1, target_offset64(arg3, arg4),
+ target_offset64(arg5, arg6), arg2));
+# else
+ return get_errno(sync_file_range(arg1, arg3, arg4, arg2));
+# endif
+}
+# endif
+#endif /* CONFIG_SYNC_FILE_RANGE */
+
#ifdef TARGET_NR__sysctl
IMPL(_sysctl)
{
@@ -12798,44 +12850,6 @@ static abi_long do_syscall1(void *cpu_env, unsigned
num, abi_long arg1,
abi_long ret;
switch(num) {
-#if defined(CONFIG_FALLOCATE) && defined(TARGET_NR_fallocate)
- case TARGET_NR_fallocate:
-#if TARGET_ABI_BITS == 32
- ret = get_errno(fallocate(arg1, arg2, target_offset64(arg3, arg4),
- target_offset64(arg5, arg6)));
-#else
- ret = get_errno(fallocate(arg1, arg2, arg3, arg4));
-#endif
- return ret;
-#endif
-#if defined(CONFIG_SYNC_FILE_RANGE)
-#if defined(TARGET_NR_sync_file_range)
- case TARGET_NR_sync_file_range:
-#if TARGET_ABI_BITS == 32
-#if defined(TARGET_MIPS)
- ret = get_errno(sync_file_range(arg1, target_offset64(arg3, arg4),
- target_offset64(arg5, arg6), arg7));
-#else
- ret = get_errno(sync_file_range(arg1, target_offset64(arg2, arg3),
- target_offset64(arg4, arg5), arg6));
-#endif /* !TARGET_MIPS */
-#else
- ret = get_errno(sync_file_range(arg1, arg2, arg3, arg4));
-#endif
- return ret;
-#endif
-#if defined(TARGET_NR_sync_file_range2)
- case TARGET_NR_sync_file_range2:
- /* This is like sync_file_range but the arguments are reordered */
-#if TARGET_ABI_BITS == 32
- ret = get_errno(sync_file_range(arg1, target_offset64(arg3, arg4),
- target_offset64(arg5, arg6), arg2));
-#else
- ret = get_errno(sync_file_range(arg1, arg3, arg4, arg2));
-#endif
- return ret;
-#endif
-#endif
#if defined(TARGET_NR_signalfd4)
case TARGET_NR_signalfd4:
return do_signalfd4(arg1, arg2, arg4);
@@ -13341,6 +13355,9 @@ static impl_fn *syscall_table(unsigned num)
# else
SYSCALL_WITH(fadvise64_64, fadvise64);
# endif
+#endif
+#ifdef CONFIG_FALLOCATE
+ SYSCALL(fallocate);
#endif
SYSCALL(fchdir);
SYSCALL(fchmod);
@@ -13841,6 +13858,14 @@ static impl_fn *syscall_table(unsigned num)
#ifdef CONFIG_SYNCFS
SYSCALL(syncfs);
#endif
+#ifdef CONFIG_SYNC_FILE_RANGE
+# ifdef TARGET_NR_sync_file_range
+ SYSCALL(sync_file_range);
+# endif
+# ifdef TARGET_NR_sync_file_range2
+ SYSCALL(sync_file_range2);
+# endif
+#endif
#ifdef TARGET_NR__sysctl
SYSCALL(_sysctl);
#endif
--
2.17.1
- [Qemu-devel] [PATCH v2 090/108] linux-user: Fix clock_nanosleep, (continued)
- [Qemu-devel] [PATCH v2 090/108] linux-user: Fix clock_nanosleep, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 088/108] linux-user: Split out getdomainname, get_thread_area, set_thread_area, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 091/108] linux-user: Split out set_tid_address, tgkill, tkill, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 092/108] linux-user: Split out futex, utimensat, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 093/108] linux-user: Remove sys_futex, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 094/108] linux-user: Split out inotify syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 095/108] linux-user: Split out mq syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 096/108] linux-user: Split out splice, tee, vmsplice, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 097/108] linux-user: Split out eventfd, eventfd2, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 099/108] linux-user: Split out signalfd, signalfd4, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 098/108] linux-user: Split out fallocate, sync_file_range/2,
Richard Henderson <=
- [Qemu-devel] [PATCH v2 100/108] linux-user: Split out epoll syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 101/108] linux-user: Split out prlimit64, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 102/108] linux-user: Split out atomic_barrier, gethostname, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 103/108] linux-user: Split out atomic_cmpxchg_32, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 104/108] linux-user: Split out timer syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 105/108] linux-user: Split out timerfd syscalls, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 106/108] linux-user: Split out ioprio_get, ioprio_set, kcmp, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 107/108] linux-user: Split out setns, unshare, Richard Henderson, 2018/06/09
- [Qemu-devel] [PATCH v2 108/108] linux-user: Fold away do_syscall1, Richard Henderson, 2018/06/09
- Re: [Qemu-devel] [PATCH v2 000/108] linux-user: Split do_syscall, no-reply, 2018/06/10