Commit 7a8e0c8d9af43c9dfc62a8b2b9cc0484f48f7da4
1 parent
cb1863a461
[S390] Wire up sys_fallocate.
This patch implements support of fallocate system call on s390(x) platform. A wrapper is added to address the issue which s390 ABI has with the arguments of this system call. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Showing 4 changed files with 32 additions and 2 deletions Side-by-side Diff
arch/s390/kernel/compat_wrapper.S
... | ... | @@ -1710,4 +1710,14 @@ |
1710 | 1710 | sys_eventfd_wrapper: |
1711 | 1711 | llgfr %r2,%r2 # unsigned int |
1712 | 1712 | jg sys_eventfd |
1713 | + | |
1714 | + .globl sys_fallocate_wrapper | |
1715 | +sys_fallocate_wrapper: | |
1716 | + lgfr %r2,%r2 # int | |
1717 | + lgfr %r3,%r3 # int | |
1718 | + sllg %r4,%r4,32 # get high word of 64bit loff_t | |
1719 | + lr %r4,%r5 # get low word of 64bit loff_t | |
1720 | + sllg %r5,%r6,32 # get high word of 64bit loff_t | |
1721 | + l %r5,164(%r15) # get low word of 64bit loff_t | |
1722 | + jg sys_fallocate |
arch/s390/kernel/sys_s390.c
... | ... | @@ -265,4 +265,24 @@ |
265 | 265 | return -EFAULT; |
266 | 266 | return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice); |
267 | 267 | } |
268 | + | |
269 | +#ifndef CONFIG_64BIT | |
270 | +/* | |
271 | + * This is a wrapper to call sys_fallocate(). For 31 bit s390 the last | |
272 | + * 64 bit argument "len" is split into the upper and lower 32 bits. The | |
273 | + * system call wrapper in the user space loads the value to %r6/%r7. | |
274 | + * The code in entry.S keeps the values in %r2 - %r6 where they are and | |
275 | + * stores %r7 to 96(%r15). But the standard C linkage requires that | |
276 | + * the whole 64 bit value for len is stored on the stack and doesn't | |
277 | + * use %r6 at all. So s390_fallocate has to convert the arguments from | |
278 | + * %r2: fd, %r3: mode, %r4/%r5: offset, %r6/96(%r15)-99(%r15): len | |
279 | + * to | |
280 | + * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len | |
281 | + */ | |
282 | +asmlinkage long s390_fallocate(int fd, int mode, loff_t offset, | |
283 | + u32 len_high, u32 len_low) | |
284 | +{ | |
285 | + return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low); | |
286 | +} | |
287 | +#endif |
arch/s390/kernel/syscalls.S
... | ... | @@ -322,7 +322,7 @@ |
322 | 322 | SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper) |
323 | 323 | SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait_wrapper) |
324 | 324 | SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper) |
325 | -NI_SYSCALL /* 314 sys_fallocate */ | |
325 | +SYSCALL(s390_fallocate,sys_fallocate,sys_fallocate_wrapper) | |
326 | 326 | SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper) /* 315 */ |
327 | 327 | SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper) |
328 | 328 | SYSCALL(sys_timerfd,sys_timerfd,compat_sys_timerfd_wrapper) |
include/asm-s390/unistd.h
... | ... | @@ -251,7 +251,7 @@ |
251 | 251 | #define __NR_getcpu 311 |
252 | 252 | #define __NR_epoll_pwait 312 |
253 | 253 | #define __NR_utimes 313 |
254 | -/* Number 314 is reserved for new sys_fallocate */ | |
254 | +#define __NR_fallocate 314 | |
255 | 255 | #define __NR_utimensat 315 |
256 | 256 | #define __NR_signalfd 316 |
257 | 257 | #define __NR_timerfd 317 |