Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

teach SYSCALL_DEFINE<n> how to deal with long long/unsigned long long

... and convert a bunch of SYSCALL_DEFINE ones to SYSCALL_DEFINE<n>,
killing the boilerplate crap around them.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 4a0fd5bf 07fe6e00

+23 -127
+2 -12
arch/s390/kernel/sys_s390.c
··· 132 132 * to 133 133 * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len 134 134 */ 135 - SYSCALL_DEFINE(s390_fallocate)(int fd, int mode, loff_t offset, 136 - u32 len_high, u32 len_low) 135 + SYSCALL_DEFINE5(s390_fallocate, int, fd, int, mode, loff_t, offset, 136 + u32, len_high, u32, len_low) 137 137 { 138 138 return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low); 139 139 } 140 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 141 - asmlinkage long SyS_s390_fallocate(long fd, long mode, loff_t offset, 142 - long len_high, long len_low) 143 - { 144 - return SYSC_s390_fallocate((int) fd, (int) mode, offset, 145 - (u32) len_high, (u32) len_low); 146 - } 147 - SYSCALL_ALIAS(sys_s390_fallocate, SyS_s390_fallocate); 148 - #endif 149 - 150 140 #endif
+1 -8
fs/dcookies.c
··· 145 145 /* And here is where the userspace process can look up the cookie value 146 146 * to retrieve the path. 147 147 */ 148 - SYSCALL_DEFINE(lookup_dcookie)(u64 cookie64, char __user * buf, size_t len) 148 + SYSCALL_DEFINE3(lookup_dcookie, u64, cookie64, char __user *, buf, size_t, len) 149 149 { 150 150 unsigned long cookie = (unsigned long)cookie64; 151 151 int err = -EINVAL; ··· 201 201 mutex_unlock(&dcookie_mutex); 202 202 return err; 203 203 } 204 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 205 - asmlinkage long SyS_lookup_dcookie(u64 cookie64, long buf, long len) 206 - { 207 - return SYSC_lookup_dcookie(cookie64, (char __user *) buf, (size_t) len); 208 - } 209 - SYSCALL_ALIAS(sys_lookup_dcookie, SyS_lookup_dcookie); 210 - #endif 211 204 212 205 static int dcookie_init(void) 213 206 {
+3 -14
fs/notify/fanotify/fanotify_user.c
··· 755 755 return fd; 756 756 } 757 757 758 - SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags, 759 - __u64 mask, int dfd, 760 - const char __user * pathname) 758 + SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags, 759 + __u64, mask, int, dfd, 760 + const char __user *, pathname) 761 761 { 762 762 struct inode *inode = NULL; 763 763 struct vfsmount *mnt = NULL; ··· 856 856 fdput(f); 857 857 return ret; 858 858 } 859 - 860 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 861 - asmlinkage long SyS_fanotify_mark(long fanotify_fd, long flags, __u64 mask, 862 - long dfd, long pathname) 863 - { 864 - return SYSC_fanotify_mark((int) fanotify_fd, (unsigned int) flags, 865 - mask, (int) dfd, 866 - (const char __user *) pathname); 867 - } 868 - SYSCALL_ALIAS(sys_fanotify_mark, SyS_fanotify_mark); 869 - #endif 870 859 871 860 /* 872 861 * fanotify_user_setup - Our initialization function. Note that we cannot return
+3 -25
fs/open.c
··· 212 212 213 213 /* LFS versions of truncate are only needed on 32 bit machines */ 214 214 #if BITS_PER_LONG == 32 215 - SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length) 215 + SYSCALL_DEFINE2(truncate64, const char __user *, path, loff_t, length) 216 216 { 217 217 return do_sys_truncate(path, length); 218 218 } 219 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 220 - asmlinkage long SyS_truncate64(long path, loff_t length) 221 - { 222 - return SYSC_truncate64((const char __user *) path, length); 223 - } 224 - SYSCALL_ALIAS(sys_truncate64, SyS_truncate64); 225 - #endif 226 219 227 - SYSCALL_DEFINE(ftruncate64)(unsigned int fd, loff_t length) 220 + SYSCALL_DEFINE2(ftruncate64, unsigned int, fd, loff_t, length) 228 221 { 229 222 long ret = do_sys_ftruncate(fd, length, 0); 230 223 /* avoid REGPARM breakage on x86: */ 231 224 asmlinkage_protect(2, ret, fd, length); 232 225 return ret; 233 226 } 234 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 235 - asmlinkage long SyS_ftruncate64(long fd, loff_t length) 236 - { 237 - return SYSC_ftruncate64((unsigned int) fd, length); 238 - } 239 - SYSCALL_ALIAS(sys_ftruncate64, SyS_ftruncate64); 240 - #endif 241 227 #endif /* BITS_PER_LONG == 32 */ 242 228 243 229 ··· 285 299 return ret; 286 300 } 287 301 288 - SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len) 302 + SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len) 289 303 { 290 304 struct fd f = fdget(fd); 291 305 int error = -EBADF; ··· 296 310 } 297 311 return error; 298 312 } 299 - 300 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 301 - asmlinkage long SyS_fallocate(long fd, long mode, loff_t offset, loff_t len) 302 - { 303 - return SYSC_fallocate((int)fd, (int)mode, offset, len); 304 - } 305 - SYSCALL_ALIAS(sys_fallocate, SyS_fallocate); 306 - #endif 307 313 308 314 /* 309 315 * access() needs to use the real uid/gid, not the effective uid/gid.
+4 -20
fs/read_write.c
··· 487 487 return ret; 488 488 } 489 489 490 - SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf, 491 - size_t count, loff_t pos) 490 + SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf, 491 + size_t, count, loff_t, pos) 492 492 { 493 493 struct fd f; 494 494 ssize_t ret = -EBADF; ··· 506 506 507 507 return ret; 508 508 } 509 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 510 - asmlinkage long SyS_pread64(long fd, long buf, long count, loff_t pos) 511 - { 512 - return SYSC_pread64((unsigned int) fd, (char __user *) buf, 513 - (size_t) count, pos); 514 - } 515 - SYSCALL_ALIAS(sys_pread64, SyS_pread64); 516 - #endif 517 509 518 - SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf, 519 - size_t count, loff_t pos) 510 + SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf, 511 + size_t, count, loff_t, pos) 520 512 { 521 513 struct fd f; 522 514 ssize_t ret = -EBADF; ··· 526 534 527 535 return ret; 528 536 } 529 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 530 - asmlinkage long SyS_pwrite64(long fd, long buf, long count, loff_t pos) 531 - { 532 - return SYSC_pwrite64((unsigned int) fd, (const char __user *) buf, 533 - (size_t) count, pos); 534 - } 535 - SYSCALL_ALIAS(sys_pwrite64, SyS_pwrite64); 536 - #endif 537 537 538 538 /* 539 539 * Reduce an iovec's length in-place. Return the resulting number of segments
+4 -22
fs/sync.c
··· 283 283 * already-instantiated disk blocks, there are no guarantees here that the data 284 284 * will be available after a crash. 285 285 */ 286 - SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes, 287 - unsigned int flags) 286 + SYSCALL_DEFINE4(sync_file_range, int, fd, loff_t, offset, loff_t, nbytes, 287 + unsigned int, flags) 288 288 { 289 289 int ret; 290 290 struct fd f; ··· 365 365 out: 366 366 return ret; 367 367 } 368 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 369 - asmlinkage long SyS_sync_file_range(long fd, loff_t offset, loff_t nbytes, 370 - long flags) 371 - { 372 - return SYSC_sync_file_range((int) fd, offset, nbytes, 373 - (unsigned int) flags); 374 - } 375 - SYSCALL_ALIAS(sys_sync_file_range, SyS_sync_file_range); 376 - #endif 377 368 378 369 /* It would be nice if people remember that not all the world's an i386 379 370 when they introduce new system calls */ 380 - SYSCALL_DEFINE(sync_file_range2)(int fd, unsigned int flags, 381 - loff_t offset, loff_t nbytes) 371 + SYSCALL_DEFINE4(sync_file_range2, int, fd, unsigned int, flags, 372 + loff_t, offset, loff_t, nbytes) 382 373 { 383 374 return sys_sync_file_range(fd, offset, nbytes, flags); 384 375 } 385 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 386 - asmlinkage long SyS_sync_file_range2(long fd, long flags, 387 - loff_t offset, loff_t nbytes) 388 - { 389 - return SYSC_sync_file_range2((int) fd, (unsigned int) flags, 390 - offset, nbytes); 391 - } 392 - SYSCALL_ALIAS(sys_sync_file_range2, SyS_sync_file_range2); 393 - #endif
+3 -2
include/linux/syscalls.h
··· 96 96 #define __MAP(n,...) __MAP##n(__VA_ARGS__) 97 97 98 98 #define __SC_DECL(t, a) t a 99 - #define __SC_LONG(t, a) long a 99 + #define __TYPE_IS_LL(t) (__same_type((t)0, 0LL) || __same_type((t)0, 0ULL)) 100 + #define __SC_LONG(t, a) __typeof(__builtin_choose_expr(__TYPE_IS_LL(t), 0LL, 0L)) a 100 101 #define __SC_CAST(t, a) (t) a 101 - #define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(sizeof(type) > sizeof(long)) 102 + #define __SC_TEST(t, a) (void)BUILD_BUG_ON_ZERO(!__TYPE_IS_LL(t) && sizeof(t) > sizeof(long)) 102 103 103 104 #ifdef CONFIG_FTRACE_SYSCALLS 104 105 #define __SC_STR_ADECL(t, a) #a
+2 -16
mm/fadvise.c
··· 25 25 * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could 26 26 * deactivate the pages and clear PG_Referenced. 27 27 */ 28 - SYSCALL_DEFINE(fadvise64_64)(int fd, loff_t offset, loff_t len, int advice) 28 + SYSCALL_DEFINE4(fadvise64_64, int, fd, loff_t, offset, loff_t, len, int, advice) 29 29 { 30 30 struct fd f = fdget(fd); 31 31 struct address_space *mapping; ··· 145 145 fdput(f); 146 146 return ret; 147 147 } 148 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 149 - asmlinkage long SyS_fadvise64_64(long fd, loff_t offset, loff_t len, long advice) 150 - { 151 - return SYSC_fadvise64_64((int) fd, offset, len, (int) advice); 152 - } 153 - SYSCALL_ALIAS(sys_fadvise64_64, SyS_fadvise64_64); 154 - #endif 155 148 156 149 #ifdef __ARCH_WANT_SYS_FADVISE64 157 150 158 - SYSCALL_DEFINE(fadvise64)(int fd, loff_t offset, size_t len, int advice) 151 + SYSCALL_DEFINE4(fadvise64, int, fd, loff_t, offset, size_t, len, int, advice) 159 152 { 160 153 return sys_fadvise64_64(fd, offset, len, advice); 161 154 } 162 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 163 - asmlinkage long SyS_fadvise64(long fd, loff_t offset, long len, long advice) 164 - { 165 - return SYSC_fadvise64((int) fd, offset, (size_t)len, (int)advice); 166 - } 167 - SYSCALL_ALIAS(sys_fadvise64, SyS_fadvise64); 168 - #endif 169 155 170 156 #endif
+1 -8
mm/readahead.c
··· 576 576 return 0; 577 577 } 578 578 579 - SYSCALL_DEFINE(readahead)(int fd, loff_t offset, size_t count) 579 + SYSCALL_DEFINE3(readahead, int, fd, loff_t, offset, size_t, count) 580 580 { 581 581 ssize_t ret; 582 582 struct fd f; ··· 595 595 } 596 596 return ret; 597 597 } 598 - #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS 599 - asmlinkage long SyS_readahead(long fd, loff_t offset, long count) 600 - { 601 - return SYSC_readahead((int) fd, offset, (size_t) count); 602 - } 603 - SYSCALL_ALIAS(sys_readahead, SyS_readahead); 604 - #endif