diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-01-21 15:16:58 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-03-03 22:46:22 -0500 |
commit | 4a0fd5bf0fd0795af8f1be3b261f5cf146a4cb9b (patch) | |
tree | 8f8efa46a8e4e3fc1c3163f5021aff4f94aaa7fd | |
parent | 07fe6e00f6cca6fef85a14a1dc3ed4f2e35d3f0b (diff) |
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>
-rw-r--r-- | arch/s390/kernel/sys_s390.c | 14 | ||||
-rw-r--r-- | fs/dcookies.c | 9 | ||||
-rw-r--r-- | fs/notify/fanotify/fanotify_user.c | 17 | ||||
-rw-r--r-- | fs/open.c | 28 | ||||
-rw-r--r-- | fs/read_write.c | 24 | ||||
-rw-r--r-- | fs/sync.c | 26 | ||||
-rw-r--r-- | include/linux/syscalls.h | 5 | ||||
-rw-r--r-- | mm/fadvise.c | 18 | ||||
-rw-r--r-- | mm/readahead.c | 9 |
9 files changed, 23 insertions, 127 deletions
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c index d0964d22adb5..23eb222c1658 100644 --- a/arch/s390/kernel/sys_s390.c +++ b/arch/s390/kernel/sys_s390.c | |||
@@ -132,19 +132,9 @@ SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args) | |||
132 | * to | 132 | * to |
133 | * %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len | 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, | 135 | SYSCALL_DEFINE5(s390_fallocate, int, fd, int, mode, loff_t, offset, |
136 | u32 len_high, u32 len_low) | 136 | u32, len_high, u32, len_low) |
137 | { | 137 | { |
138 | return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low); | 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 | #endif | 140 | #endif |
diff --git a/fs/dcookies.c b/fs/dcookies.c index 17c779967828..f08375b97ffb 100644 --- a/fs/dcookies.c +++ b/fs/dcookies.c | |||
@@ -145,7 +145,7 @@ out: | |||
145 | /* And here is where the userspace process can look up the cookie value | 145 | /* And here is where the userspace process can look up the cookie value |
146 | * to retrieve the path. | 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 | unsigned long cookie = (unsigned long)cookie64; | 150 | unsigned long cookie = (unsigned long)cookie64; |
151 | int err = -EINVAL; | 151 | int err = -EINVAL; |
@@ -201,13 +201,6 @@ out: | |||
201 | mutex_unlock(&dcookie_mutex); | 201 | mutex_unlock(&dcookie_mutex); |
202 | return err; | 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 | static int dcookie_init(void) | 205 | static int dcookie_init(void) |
213 | { | 206 | { |
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 5d8444268a16..d0be29fa94cf 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c | |||
@@ -755,9 +755,9 @@ out_destroy_group: | |||
755 | return fd; | 755 | return fd; |
756 | } | 756 | } |
757 | 757 | ||
758 | SYSCALL_DEFINE(fanotify_mark)(int fanotify_fd, unsigned int flags, | 758 | SYSCALL_DEFINE5(fanotify_mark, int, fanotify_fd, unsigned int, flags, |
759 | __u64 mask, int dfd, | 759 | __u64, mask, int, dfd, |
760 | const char __user * pathname) | 760 | const char __user *, pathname) |
761 | { | 761 | { |
762 | struct inode *inode = NULL; | 762 | struct inode *inode = NULL; |
763 | struct vfsmount *mnt = NULL; | 763 | struct vfsmount *mnt = NULL; |
@@ -857,17 +857,6 @@ fput_and_out: | |||
857 | return ret; | 857 | return ret; |
858 | } | 858 | } |
859 | 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 | |||
871 | /* | 860 | /* |
872 | * fanotify_user_setup - Our initialization function. Note that we cannot return | 861 | * fanotify_user_setup - Our initialization function. Note that we cannot return |
873 | * error because we have compiled-in VFS hooks. So an (unlikely) failure here | 862 | * error because we have compiled-in VFS hooks. So an (unlikely) failure here |
@@ -212,32 +212,18 @@ COMPAT_SYSCALL_DEFINE2(ftruncate, unsigned int, fd, compat_ulong_t, length) | |||
212 | 212 | ||
213 | /* LFS versions of truncate are only needed on 32 bit machines */ | 213 | /* LFS versions of truncate are only needed on 32 bit machines */ |
214 | #if BITS_PER_LONG == 32 | 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 | return do_sys_truncate(path, length); | 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 | long ret = do_sys_ftruncate(fd, length, 0); | 222 | long ret = do_sys_ftruncate(fd, length, 0); |
230 | /* avoid REGPARM breakage on x86: */ | 223 | /* avoid REGPARM breakage on x86: */ |
231 | asmlinkage_protect(2, ret, fd, length); | 224 | asmlinkage_protect(2, ret, fd, length); |
232 | return ret; | 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 | #endif /* BITS_PER_LONG == 32 */ | 227 | #endif /* BITS_PER_LONG == 32 */ |
242 | 228 | ||
243 | 229 | ||
@@ -299,7 +285,7 @@ int do_fallocate(struct file *file, int mode, loff_t offset, loff_t len) | |||
299 | return ret; | 285 | return ret; |
300 | } | 286 | } |
301 | 287 | ||
302 | SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len) | 288 | SYSCALL_DEFINE4(fallocate, int, fd, int, mode, loff_t, offset, loff_t, len) |
303 | { | 289 | { |
304 | struct fd f = fdget(fd); | 290 | struct fd f = fdget(fd); |
305 | int error = -EBADF; | 291 | int error = -EBADF; |
@@ -311,14 +297,6 @@ SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len) | |||
311 | return error; | 297 | return error; |
312 | } | 298 | } |
313 | 299 | ||
314 | #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS | ||
315 | asmlinkage long SyS_fallocate(long fd, long mode, loff_t offset, loff_t len) | ||
316 | { | ||
317 | return SYSC_fallocate((int)fd, (int)mode, offset, len); | ||
318 | } | ||
319 | SYSCALL_ALIAS(sys_fallocate, SyS_fallocate); | ||
320 | #endif | ||
321 | |||
322 | /* | 300 | /* |
323 | * access() needs to use the real uid/gid, not the effective uid/gid. | 301 | * access() needs to use the real uid/gid, not the effective uid/gid. |
324 | * We do this by temporarily clearing all FS-related capabilities and | 302 | * We do this by temporarily clearing all FS-related capabilities and |
diff --git a/fs/read_write.c b/fs/read_write.c index a698eff457fb..dcfd58d95f44 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -487,8 +487,8 @@ SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf, | |||
487 | return ret; | 487 | return ret; |
488 | } | 488 | } |
489 | 489 | ||
490 | SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf, | 490 | SYSCALL_DEFINE4(pread64, unsigned int, fd, char __user *, buf, |
491 | size_t count, loff_t pos) | 491 | size_t, count, loff_t, pos) |
492 | { | 492 | { |
493 | struct fd f; | 493 | struct fd f; |
494 | ssize_t ret = -EBADF; | 494 | ssize_t ret = -EBADF; |
@@ -506,17 +506,9 @@ SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf, | |||
506 | 506 | ||
507 | return ret; | 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, | 510 | SYSCALL_DEFINE4(pwrite64, unsigned int, fd, const char __user *, buf, |
519 | size_t count, loff_t pos) | 511 | size_t, count, loff_t, pos) |
520 | { | 512 | { |
521 | struct fd f; | 513 | struct fd f; |
522 | ssize_t ret = -EBADF; | 514 | ssize_t ret = -EBADF; |
@@ -534,14 +526,6 @@ SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf, | |||
534 | 526 | ||
535 | return ret; | 527 | return ret; |
536 | } | 528 | } |
537 | #ifdef CONFIG_HAVE_SYSCALL_WRAPPERS | ||
538 | asmlinkage long SyS_pwrite64(long fd, long buf, long count, loff_t pos) | ||
539 | { | ||
540 | return SYSC_pwrite64((unsigned int) fd, (const char __user *) buf, | ||
541 | (size_t) count, pos); | ||
542 | } | ||
543 | SYSCALL_ALIAS(sys_pwrite64, SyS_pwrite64); | ||
544 | #endif | ||
545 | 529 | ||
546 | /* | 530 | /* |
547 | * Reduce an iovec's length in-place. Return the resulting number of segments | 531 | * Reduce an iovec's length in-place. Return the resulting number of segments |
@@ -283,8 +283,8 @@ EXPORT_SYMBOL(generic_write_sync); | |||
283 | * already-instantiated disk blocks, there are no guarantees here that the data | 283 | * already-instantiated disk blocks, there are no guarantees here that the data |
284 | * will be available after a crash. | 284 | * will be available after a crash. |
285 | */ | 285 | */ |
286 | SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes, | 286 | SYSCALL_DEFINE4(sync_file_range, int, fd, loff_t, offset, loff_t, nbytes, |
287 | unsigned int flags) | 287 | unsigned int, flags) |
288 | { | 288 | { |
289 | int ret; | 289 | int ret; |
290 | struct fd f; | 290 | struct fd f; |
@@ -365,29 +365,11 @@ out_put: | |||
365 | out: | 365 | out: |
366 | return ret; | 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 | /* It would be nice if people remember that not all the world's an i386 | 369 | /* It would be nice if people remember that not all the world's an i386 |
379 | when they introduce new system calls */ | 370 | when they introduce new system calls */ |
380 | SYSCALL_DEFINE(sync_file_range2)(int fd, unsigned int flags, | 371 | SYSCALL_DEFINE4(sync_file_range2, int, fd, unsigned int, flags, |
381 | loff_t offset, loff_t nbytes) | 372 | loff_t, offset, loff_t, nbytes) |
382 | { | 373 | { |
383 | return sys_sync_file_range(fd, offset, nbytes, flags); | 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 | ||
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index f9411f0c1c80..3e07b92efbf6 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -96,9 +96,10 @@ struct sigaltstack; | |||
96 | #define __MAP(n,...) __MAP##n(__VA_ARGS__) | 96 | #define __MAP(n,...) __MAP##n(__VA_ARGS__) |
97 | 97 | ||
98 | #define __SC_DECL(t, a) t a | 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 | #define __SC_CAST(t, a) (t) a | 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 | #ifdef CONFIG_FTRACE_SYSCALLS | 104 | #ifdef CONFIG_FTRACE_SYSCALLS |
104 | #define __SC_STR_ADECL(t, a) #a | 105 | #define __SC_STR_ADECL(t, a) #a |
diff --git a/mm/fadvise.c b/mm/fadvise.c index 7e092689a12a..3bcfd81db45e 100644 --- a/mm/fadvise.c +++ b/mm/fadvise.c | |||
@@ -25,7 +25,7 @@ | |||
25 | * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could | 25 | * POSIX_FADV_WILLNEED could set PG_Referenced, and POSIX_FADV_NOREUSE could |
26 | * deactivate the pages and clear PG_Referenced. | 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 | struct fd f = fdget(fd); | 30 | struct fd f = fdget(fd); |
31 | struct address_space *mapping; | 31 | struct address_space *mapping; |
@@ -145,26 +145,12 @@ out: | |||
145 | fdput(f); | 145 | fdput(f); |
146 | return ret; | 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 | #ifdef __ARCH_WANT_SYS_FADVISE64 | 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 | return sys_fadvise64_64(fd, offset, len, advice); | 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 | #endif | 156 | #endif |
diff --git a/mm/readahead.c b/mm/readahead.c index 7963f2391236..daed28dd5830 100644 --- a/mm/readahead.c +++ b/mm/readahead.c | |||
@@ -576,7 +576,7 @@ do_readahead(struct address_space *mapping, struct file *filp, | |||
576 | return 0; | 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 | ssize_t ret; | 581 | ssize_t ret; |
582 | struct fd f; | 582 | struct fd f; |
@@ -595,10 +595,3 @@ SYSCALL_DEFINE(readahead)(int fd, loff_t offset, size_t count) | |||
595 | } | 595 | } |
596 | return ret; | 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 | ||