s390/compat: add sync_file_range and fallocate compat syscalls
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Sat, 1 Mar 2014 12:09:26 +0000 (13:09 +0100)
committerHeiko Carstens <heiko.carstens@de.ibm.com>
Tue, 4 Mar 2014 08:05:47 +0000 (09:05 +0100)
The compat syscall wrappers for sync_file_range and fallocate merged 32 bit
parameters into 64 bit parameters. Therefore they did more than just the
usual zero and/or sign extension of system call parameters.

So convert these two wrappers to full s390 specific compat sytem calls.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
arch/s390/kernel/compat_linux.c
arch/s390/kernel/compat_linux.h
arch/s390/kernel/compat_wrapper.S
arch/s390/kernel/syscalls.S

index 59097741f5090f06d69777fe9f3bc03e9c2f9946..ca38139423ae7f22e3a4d5e33d4990d9f4bc5daa 100644 (file)
@@ -504,3 +504,17 @@ COMPAT_SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, arg
                a.advice = POSIX_FADV_NOREUSE;
        return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
 }
+
+COMPAT_SYSCALL_DEFINE6(s390_sync_file_range, int, fd, u32, offhigh, u32, offlow,
+                      u32, nhigh, u32, nlow, unsigned int, flags)
+{
+       return sys_sync_file_range(fd, ((loff_t)offhigh << 32) + offlow,
+                                  ((u64)nhigh << 32) + nlow, flags);
+}
+
+COMPAT_SYSCALL_DEFINE6(s390_fallocate, int, fd, int, mode, u32, offhigh, u32, offlow,
+                      u32, lenhigh, u32, lenlow)
+{
+       return sys_fallocate(fd, mode, ((loff_t)offhigh << 32) + offlow,
+                            ((u64)lenhigh << 32) + lenlow);
+}
index 7d2ce4bb84a6b453f9e0acb447153b43818f7a78..330e11d164d71c9329f513fc48a21ad35188401d 100644 (file)
@@ -110,4 +110,7 @@ long compat_sys_s390_read(unsigned int fd, char __user * buf, compat_size_t coun
 long compat_sys_s390_write(unsigned int fd, const char __user * buf, compat_size_t count);
 long compat_sys_s390_fadvise64(int fd, u32 high, u32 low, compat_size_t len, int advise);
 long compat_sys_s390_fadvise64_64(struct fadvise64_64_args __user *args);
+long compat_sys_s390_sync_file_range(int fd, u32 offhigh, u32 offlow, u32 nhigh, u32 nlow, unsigned int flags);
+long compat_sys_s390_fallocate(int fd, int mode, u32 offhigh, u32 offlow, u32 lenhigh, u32 lenlow);
+
 #endif /* _ASM_S390X_S390_H */
index a1a13671922ac8a6e8f56878249560a151236a68..23d9f8a7c6f576a0ff33b723f2b0b945e248e1ed 100644 (file)
@@ -317,15 +317,6 @@ ENTRY(compat_sys_ppoll_wrapper)
        llgfr   %r6,%r6                 # size_t
        jg      compat_sys_ppoll
 
-ENTRY(sys_sync_file_range_wrapper)
-       lgfr    %r2,%r2                 # int
-       sllg    %r3,%r3,32              # get high word of 64bit loff_t
-       or      %r3,%r4                 # get low word of 64bit loff_t
-       sllg    %r4,%r5,32              # get high word of 64bit loff_t
-       or      %r4,%r6                 # get low word of 64bit loff_t
-       llgf    %r5,164(%r15)           # unsigned int
-       jg      sys_sync_file_range
-
 ENTRY(compat_sys_utimes_wrapper)
        llgtr   %r2,%r2                 # char *
        llgtr   %r3,%r3                 # struct compat_timeval *
@@ -338,15 +329,6 @@ ENTRY(compat_sys_utimensat_wrapper)
        lgfr    %r5,%r5                 # int
        jg      compat_sys_utimensat
 
-ENTRY(sys_fallocate_wrapper)
-       lgfr    %r2,%r2                 # int
-       lgfr    %r3,%r3                 # int
-       sllg    %r4,%r4,32              # get high word of 64bit loff_t
-       lr      %r4,%r5                 # get low word of 64bit loff_t
-       sllg    %r5,%r6,32              # get high word of 64bit loff_t
-       l       %r5,164(%r15)           # get low word of 64bit loff_t
-       jg      sys_fallocate
-
 ENTRY(compat_sys_keyctl_wrapper)
        llgfr   %r2,%r2                 # u32
        llgfr   %r3,%r3                 # u32
index 3ad73a6f61597a6575bffb791057e794101901a2..dbdec47e935ad321613a2c2b59ad6249f438aca1 100644 (file)
@@ -315,14 +315,14 @@ SYSCALL(sys_unshare,sys_unshare,compat_sys_unshare)
 SYSCALL(sys_set_robust_list,sys_set_robust_list,compat_sys_set_robust_list)
 SYSCALL(sys_get_robust_list,sys_get_robust_list,compat_sys_get_robust_list)
 SYSCALL(sys_splice,sys_splice,compat_sys_splice)
-SYSCALL(sys_sync_file_range,sys_sync_file_range,sys_sync_file_range_wrapper)
+SYSCALL(sys_sync_file_range,sys_sync_file_range,compat_sys_s390_sync_file_range)
 SYSCALL(sys_tee,sys_tee,compat_sys_tee)
 SYSCALL(sys_vmsplice,sys_vmsplice,compat_sys_vmsplice)
 NI_SYSCALL                                                     /* 310 sys_move_pages */
 SYSCALL(sys_getcpu,sys_getcpu,compat_sys_getcpu)
 SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait)
 SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper)
-SYSCALL(sys_s390_fallocate,sys_fallocate,sys_fallocate_wrapper)
+SYSCALL(sys_s390_fallocate,sys_fallocate,compat_sys_s390_fallocate)
 SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper)      /* 315 */
 SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd)
 NI_SYSCALL                                             /* 317 old sys_timer_fd */