aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-01-14 22:58:40 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-14 22:58:40 -0500
commitbca268565fd18f0b36ab8fff6e1623d8dffae2b1 (patch)
tree11abda03d7a7764cfa6a49a6ec2da1576b3058ee /fs
parent74d96f018673759d04d032c137d132f6447bfb1e (diff)
parent26689452f5ca201add63b1b1ff0dbcf82d6885e7 (diff)
Merge branch 'syscalls' of git://git390.osdl.marist.edu/pub/scm/linux-2.6
* 'syscalls' of git://git390.osdl.marist.edu/pub/scm/linux-2.6: (44 commits) [CVE-2009-0029] s390 specific system call wrappers [CVE-2009-0029] System call wrappers part 33 [CVE-2009-0029] System call wrappers part 32 [CVE-2009-0029] System call wrappers part 31 [CVE-2009-0029] System call wrappers part 30 [CVE-2009-0029] System call wrappers part 29 [CVE-2009-0029] System call wrappers part 28 [CVE-2009-0029] System call wrappers part 27 [CVE-2009-0029] System call wrappers part 26 [CVE-2009-0029] System call wrappers part 25 [CVE-2009-0029] System call wrappers part 24 [CVE-2009-0029] System call wrappers part 23 [CVE-2009-0029] System call wrappers part 22 [CVE-2009-0029] System call wrappers part 21 [CVE-2009-0029] System call wrappers part 20 [CVE-2009-0029] System call wrappers part 19 [CVE-2009-0029] System call wrappers part 18 [CVE-2009-0029] System call wrappers part 17 [CVE-2009-0029] System call wrappers part 16 [CVE-2009-0029] System call wrappers part 15 ...
Diffstat (limited to 'fs')
-rw-r--r--fs/aio.c22
-rw-r--r--fs/buffer.c2
-rw-r--r--fs/compat.c6
-rw-r--r--fs/dcache.c2
-rw-r--r--fs/dcookies.c10
-rw-r--r--fs/eventfd.c5
-rw-r--r--fs/eventpoll.c18
-rw-r--r--fs/exec.c2
-rw-r--r--fs/fcntl.c11
-rw-r--r--fs/filesystems.c2
-rw-r--r--fs/ioctl.c2
-rw-r--r--fs/ioprio.c5
-rw-r--r--fs/locks.c2
-rw-r--r--fs/namei.c35
-rw-r--r--fs/namespace.c13
-rw-r--r--fs/nfsctl.c4
-rw-r--r--fs/notify/inotify/inotify_user.c9
-rw-r--r--fs/open.c82
-rw-r--r--fs/pipe.c4
-rw-r--r--fs/quota.c3
-rw-r--r--fs/read_write.c49
-rw-r--r--fs/readdir.c9
-rw-r--r--fs/select.c27
-rw-r--r--fs/signalfd.c8
-rw-r--r--fs/splice.c12
-rw-r--r--fs/stat.c38
-rw-r--r--fs/super.c2
-rw-r--r--fs/sync.c32
-rw-r--r--fs/timerfd.c10
-rw-r--r--fs/utimes.c11
-rw-r--r--fs/xattr.c53
31 files changed, 276 insertions, 214 deletions
diff --git a/fs/aio.c b/fs/aio.c
index d6f89d3c15e8..8fa77e233944 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1270,7 +1270,7 @@ static void io_destroy(struct kioctx *ioctx)
1270 * pointer is passed for ctxp. Will fail with -ENOSYS if not 1270 * pointer is passed for ctxp. Will fail with -ENOSYS if not
1271 * implemented. 1271 * implemented.
1272 */ 1272 */
1273asmlinkage long sys_io_setup(unsigned nr_events, aio_context_t __user *ctxp) 1273SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp)
1274{ 1274{
1275 struct kioctx *ioctx = NULL; 1275 struct kioctx *ioctx = NULL;
1276 unsigned long ctx; 1276 unsigned long ctx;
@@ -1308,7 +1308,7 @@ out:
1308 * implemented. May fail with -EFAULT if the context pointed to 1308 * implemented. May fail with -EFAULT if the context pointed to
1309 * is invalid. 1309 * is invalid.
1310 */ 1310 */
1311asmlinkage long sys_io_destroy(aio_context_t ctx) 1311SYSCALL_DEFINE1(io_destroy, aio_context_t, ctx)
1312{ 1312{
1313 struct kioctx *ioctx = lookup_ioctx(ctx); 1313 struct kioctx *ioctx = lookup_ioctx(ctx);
1314 if (likely(NULL != ioctx)) { 1314 if (likely(NULL != ioctx)) {
@@ -1662,8 +1662,8 @@ out_put_req:
1662 * are available to queue any iocbs. Will return 0 if nr is 0. Will 1662 * are available to queue any iocbs. Will return 0 if nr is 0. Will
1663 * fail with -ENOSYS if not implemented. 1663 * fail with -ENOSYS if not implemented.
1664 */ 1664 */
1665asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr, 1665SYSCALL_DEFINE3(io_submit, aio_context_t, ctx_id, long, nr,
1666 struct iocb __user * __user *iocbpp) 1666 struct iocb __user * __user *, iocbpp)
1667{ 1667{
1668 struct kioctx *ctx; 1668 struct kioctx *ctx;
1669 long ret = 0; 1669 long ret = 0;
@@ -1737,8 +1737,8 @@ static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb,
1737 * invalid. May fail with -EAGAIN if the iocb specified was not 1737 * invalid. May fail with -EAGAIN if the iocb specified was not
1738 * cancelled. Will fail with -ENOSYS if not implemented. 1738 * cancelled. Will fail with -ENOSYS if not implemented.
1739 */ 1739 */
1740asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb, 1740SYSCALL_DEFINE3(io_cancel, aio_context_t, ctx_id, struct iocb __user *, iocb,
1741 struct io_event __user *result) 1741 struct io_event __user *, result)
1742{ 1742{
1743 int (*cancel)(struct kiocb *iocb, struct io_event *res); 1743 int (*cancel)(struct kiocb *iocb, struct io_event *res);
1744 struct kioctx *ctx; 1744 struct kioctx *ctx;
@@ -1799,11 +1799,11 @@ asmlinkage long sys_io_cancel(aio_context_t ctx_id, struct iocb __user *iocb,
1799 * will be updated if not NULL and the operation blocks. Will fail 1799 * will be updated if not NULL and the operation blocks. Will fail
1800 * with -ENOSYS if not implemented. 1800 * with -ENOSYS if not implemented.
1801 */ 1801 */
1802asmlinkage long sys_io_getevents(aio_context_t ctx_id, 1802SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id,
1803 long min_nr, 1803 long, min_nr,
1804 long nr, 1804 long, nr,
1805 struct io_event __user *events, 1805 struct io_event __user *, events,
1806 struct timespec __user *timeout) 1806 struct timespec __user *, timeout)
1807{ 1807{
1808 struct kioctx *ioctx = lookup_ioctx(ctx_id); 1808 struct kioctx *ioctx = lookup_ioctx(ctx_id);
1809 long ret = -EINVAL; 1809 long ret = -EINVAL;
diff --git a/fs/buffer.c b/fs/buffer.c
index b6e8b8632e2f..b58208f1640a 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -3243,7 +3243,7 @@ void block_sync_page(struct page *page)
3243 * Use of bdflush() is deprecated and will be removed in a future kernel. 3243 * Use of bdflush() is deprecated and will be removed in a future kernel.
3244 * The `pdflush' kernel threads fully replace bdflush daemons and this call. 3244 * The `pdflush' kernel threads fully replace bdflush daemons and this call.
3245 */ 3245 */
3246asmlinkage long sys_bdflush(int func, long data) 3246SYSCALL_DEFINE2(bdflush, int, func, long, data)
3247{ 3247{
3248 static int msg_count; 3248 static int msg_count;
3249 3249
diff --git a/fs/compat.c b/fs/compat.c
index 30f2faa22f5c..65a070e705ab 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1709,7 +1709,7 @@ asmlinkage long compat_sys_select(int n, compat_ulong_t __user *inp,
1709} 1709}
1710 1710
1711#ifdef HAVE_SET_RESTORE_SIGMASK 1711#ifdef HAVE_SET_RESTORE_SIGMASK
1712asmlinkage long compat_sys_pselect7(int n, compat_ulong_t __user *inp, 1712static long do_compat_pselect(int n, compat_ulong_t __user *inp,
1713 compat_ulong_t __user *outp, compat_ulong_t __user *exp, 1713 compat_ulong_t __user *outp, compat_ulong_t __user *exp,
1714 struct compat_timespec __user *tsp, compat_sigset_t __user *sigmask, 1714 struct compat_timespec __user *tsp, compat_sigset_t __user *sigmask,
1715 compat_size_t sigsetsize) 1715 compat_size_t sigsetsize)
@@ -1775,8 +1775,8 @@ asmlinkage long compat_sys_pselect6(int n, compat_ulong_t __user *inp,
1775 (compat_size_t __user *)(sig+sizeof(up)))) 1775 (compat_size_t __user *)(sig+sizeof(up))))
1776 return -EFAULT; 1776 return -EFAULT;
1777 } 1777 }
1778 return compat_sys_pselect7(n, inp, outp, exp, tsp, compat_ptr(up), 1778 return do_compat_pselect(n, inp, outp, exp, tsp, compat_ptr(up),
1779 sigsetsize); 1779 sigsetsize);
1780} 1780}
1781 1781
1782asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds, 1782asmlinkage long compat_sys_ppoll(struct pollfd __user *ufds,
diff --git a/fs/dcache.c b/fs/dcache.c
index 4547f66884a0..937df0fb0da5 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2092,7 +2092,7 @@ Elong:
2092 * return NULL; 2092 * return NULL;
2093 * } 2093 * }
2094 */ 2094 */
2095asmlinkage long sys_getcwd(char __user *buf, unsigned long size) 2095SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size)
2096{ 2096{
2097 int error; 2097 int error;
2098 struct path pwd, root; 2098 struct path pwd, root;
diff --git a/fs/dcookies.c b/fs/dcookies.c
index 180e9fec4ad8..a21cabdbd87b 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 */
148asmlinkage long sys_lookup_dcookie(u64 cookie64, char __user * buf, size_t len) 148SYSCALL_DEFINE(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;
@@ -198,7 +198,13 @@ out:
198 mutex_unlock(&dcookie_mutex); 198 mutex_unlock(&dcookie_mutex);
199 return err; 199 return err;
200} 200}
201 201#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
202asmlinkage long SyS_lookup_dcookie(u64 cookie64, long buf, long len)
203{
204 return SYSC_lookup_dcookie(cookie64, (char __user *) buf, (size_t) len);
205}
206SYSCALL_ALIAS(sys_lookup_dcookie, SyS_lookup_dcookie);
207#endif
202 208
203static int dcookie_init(void) 209static int dcookie_init(void)
204{ 210{
diff --git a/fs/eventfd.c b/fs/eventfd.c
index 08bf558d0408..5de2c2db3aa2 100644
--- a/fs/eventfd.c
+++ b/fs/eventfd.c
@@ -198,7 +198,7 @@ struct file *eventfd_fget(int fd)
198 return file; 198 return file;
199} 199}
200 200
201asmlinkage long sys_eventfd2(unsigned int count, int flags) 201SYSCALL_DEFINE2(eventfd2, unsigned int, count, int, flags)
202{ 202{
203 int fd; 203 int fd;
204 struct eventfd_ctx *ctx; 204 struct eventfd_ctx *ctx;
@@ -228,8 +228,7 @@ asmlinkage long sys_eventfd2(unsigned int count, int flags)
228 return fd; 228 return fd;
229} 229}
230 230
231asmlinkage long sys_eventfd(unsigned int count) 231SYSCALL_DEFINE1(eventfd, unsigned int, count)
232{ 232{
233 return sys_eventfd2(count, 0); 233 return sys_eventfd2(count, 0);
234} 234}
235
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 96355d505347..ba2f9ec71192 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1110,7 +1110,7 @@ retry:
1110/* 1110/*
1111 * Open an eventpoll file descriptor. 1111 * Open an eventpoll file descriptor.
1112 */ 1112 */
1113asmlinkage long sys_epoll_create1(int flags) 1113SYSCALL_DEFINE1(epoll_create1, int, flags)
1114{ 1114{
1115 int error, fd = -1; 1115 int error, fd = -1;
1116 struct eventpoll *ep; 1116 struct eventpoll *ep;
@@ -1150,7 +1150,7 @@ error_return:
1150 return fd; 1150 return fd;
1151} 1151}
1152 1152
1153asmlinkage long sys_epoll_create(int size) 1153SYSCALL_DEFINE1(epoll_create, int, size)
1154{ 1154{
1155 if (size < 0) 1155 if (size < 0)
1156 return -EINVAL; 1156 return -EINVAL;
@@ -1163,8 +1163,8 @@ asmlinkage long sys_epoll_create(int size)
1163 * the eventpoll file that enables the insertion/removal/change of 1163 * the eventpoll file that enables the insertion/removal/change of
1164 * file descriptors inside the interest set. 1164 * file descriptors inside the interest set.
1165 */ 1165 */
1166asmlinkage long sys_epoll_ctl(int epfd, int op, int fd, 1166SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
1167 struct epoll_event __user *event) 1167 struct epoll_event __user *, event)
1168{ 1168{
1169 int error; 1169 int error;
1170 struct file *file, *tfile; 1170 struct file *file, *tfile;
@@ -1261,8 +1261,8 @@ error_return:
1261 * Implement the event wait interface for the eventpoll file. It is the kernel 1261 * Implement the event wait interface for the eventpoll file. It is the kernel
1262 * part of the user space epoll_wait(2). 1262 * part of the user space epoll_wait(2).
1263 */ 1263 */
1264asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events, 1264SYSCALL_DEFINE4(epoll_wait, int, epfd, struct epoll_event __user *, events,
1265 int maxevents, int timeout) 1265 int, maxevents, int, timeout)
1266{ 1266{
1267 int error; 1267 int error;
1268 struct file *file; 1268 struct file *file;
@@ -1319,9 +1319,9 @@ error_return:
1319 * Implement the event wait interface for the eventpoll file. It is the kernel 1319 * Implement the event wait interface for the eventpoll file. It is the kernel
1320 * part of the user space epoll_pwait(2). 1320 * part of the user space epoll_pwait(2).
1321 */ 1321 */
1322asmlinkage long sys_epoll_pwait(int epfd, struct epoll_event __user *events, 1322SYSCALL_DEFINE6(epoll_pwait, int, epfd, struct epoll_event __user *, events,
1323 int maxevents, int timeout, const sigset_t __user *sigmask, 1323 int, maxevents, int, timeout, const sigset_t __user *, sigmask,
1324 size_t sigsetsize) 1324 size_t, sigsetsize)
1325{ 1325{
1326 int error; 1326 int error;
1327 sigset_t ksigmask, sigsaved; 1327 sigset_t ksigmask, sigsaved;
diff --git a/fs/exec.c b/fs/exec.c
index 71a6efe5d8bd..0dd60a01f1b4 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -99,7 +99,7 @@ static inline void put_binfmt(struct linux_binfmt * fmt)
99 * 99 *
100 * Also note that we take the address to load from from the file itself. 100 * Also note that we take the address to load from from the file itself.
101 */ 101 */
102asmlinkage long sys_uselib(const char __user * library) 102SYSCALL_DEFINE1(uselib, const char __user *, library)
103{ 103{
104 struct file *file; 104 struct file *file;
105 struct nameidata nd; 105 struct nameidata nd;
diff --git a/fs/fcntl.c b/fs/fcntl.c
index cdc141946724..bd215cc791da 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -50,7 +50,7 @@ static int get_close_on_exec(unsigned int fd)
50 return res; 50 return res;
51} 51}
52 52
53asmlinkage long sys_dup3(unsigned int oldfd, unsigned int newfd, int flags) 53SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags)
54{ 54{
55 int err = -EBADF; 55 int err = -EBADF;
56 struct file * file, *tofree; 56 struct file * file, *tofree;
@@ -113,7 +113,7 @@ out_unlock:
113 return err; 113 return err;
114} 114}
115 115
116asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd) 116SYSCALL_DEFINE2(dup2, unsigned int, oldfd, unsigned int, newfd)
117{ 117{
118 if (unlikely(newfd == oldfd)) { /* corner case */ 118 if (unlikely(newfd == oldfd)) { /* corner case */
119 struct files_struct *files = current->files; 119 struct files_struct *files = current->files;
@@ -126,7 +126,7 @@ asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd)
126 return sys_dup3(oldfd, newfd, 0); 126 return sys_dup3(oldfd, newfd, 0);
127} 127}
128 128
129asmlinkage long sys_dup(unsigned int fildes) 129SYSCALL_DEFINE1(dup, unsigned int, fildes)
130{ 130{
131 int ret = -EBADF; 131 int ret = -EBADF;
132 struct file *file = fget(fildes); 132 struct file *file = fget(fildes);
@@ -335,7 +335,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
335 return err; 335 return err;
336} 336}
337 337
338asmlinkage long sys_fcntl(unsigned int fd, unsigned int cmd, unsigned long arg) 338SYSCALL_DEFINE3(fcntl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
339{ 339{
340 struct file *filp; 340 struct file *filp;
341 long err = -EBADF; 341 long err = -EBADF;
@@ -358,7 +358,8 @@ out:
358} 358}
359 359
360#if BITS_PER_LONG == 32 360#if BITS_PER_LONG == 32
361asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg) 361SYSCALL_DEFINE3(fcntl64, unsigned int, fd, unsigned int, cmd,
362 unsigned long, arg)
362{ 363{
363 struct file * filp; 364 struct file * filp;
364 long err; 365 long err;
diff --git a/fs/filesystems.c b/fs/filesystems.c
index d488dcd7f2bb..1aa70260e6d1 100644
--- a/fs/filesystems.c
+++ b/fs/filesystems.c
@@ -179,7 +179,7 @@ static int fs_maxindex(void)
179/* 179/*
180 * Whee.. Weird sysv syscall. 180 * Whee.. Weird sysv syscall.
181 */ 181 */
182asmlinkage long sys_sysfs(int option, unsigned long arg1, unsigned long arg2) 182SYSCALL_DEFINE3(sysfs, int, option, unsigned long, arg1, unsigned long, arg2)
183{ 183{
184 int retval = -EINVAL; 184 int retval = -EINVAL;
185 185
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 20b0a8a24c6b..240ec63984cb 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -542,7 +542,7 @@ int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
542 return error; 542 return error;
543} 543}
544 544
545asmlinkage long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg) 545SYSCALL_DEFINE3(ioctl, unsigned int, fd, unsigned int, cmd, unsigned long, arg)
546{ 546{
547 struct file *filp; 547 struct file *filp;
548 int error = -EBADF; 548 int error = -EBADF;
diff --git a/fs/ioprio.c b/fs/ioprio.c
index 1a39ac370942..c7c0b28d7d21 100644
--- a/fs/ioprio.c
+++ b/fs/ioprio.c
@@ -72,7 +72,7 @@ int set_task_ioprio(struct task_struct *task, int ioprio)
72} 72}
73EXPORT_SYMBOL_GPL(set_task_ioprio); 73EXPORT_SYMBOL_GPL(set_task_ioprio);
74 74
75asmlinkage long sys_ioprio_set(int which, int who, int ioprio) 75SYSCALL_DEFINE3(ioprio_set, int, which, int, who, int, ioprio)
76{ 76{
77 int class = IOPRIO_PRIO_CLASS(ioprio); 77 int class = IOPRIO_PRIO_CLASS(ioprio);
78 int data = IOPRIO_PRIO_DATA(ioprio); 78 int data = IOPRIO_PRIO_DATA(ioprio);
@@ -188,7 +188,7 @@ int ioprio_best(unsigned short aprio, unsigned short bprio)
188 return aprio; 188 return aprio;
189} 189}
190 190
191asmlinkage long sys_ioprio_get(int which, int who) 191SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
192{ 192{
193 struct task_struct *g, *p; 193 struct task_struct *g, *p;
194 struct user_struct *user; 194 struct user_struct *user;
@@ -252,4 +252,3 @@ asmlinkage long sys_ioprio_get(int which, int who)
252 read_unlock(&tasklist_lock); 252 read_unlock(&tasklist_lock);
253 return ret; 253 return ret;
254} 254}
255
diff --git a/fs/locks.c b/fs/locks.c
index 46a2e12f7d42..ec3deea29e37 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1564,7 +1564,7 @@ EXPORT_SYMBOL(flock_lock_file_wait);
1564 * %LOCK_MAND can be combined with %LOCK_READ or %LOCK_WRITE to allow other 1564 * %LOCK_MAND can be combined with %LOCK_READ or %LOCK_WRITE to allow other
1565 * processes read and write access respectively. 1565 * processes read and write access respectively.
1566 */ 1566 */
1567asmlinkage long sys_flock(unsigned int fd, unsigned int cmd) 1567SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd)
1568{ 1568{
1569 struct file *filp; 1569 struct file *filp;
1570 struct file_lock *lock; 1570 struct file_lock *lock;
diff --git a/fs/namei.c b/fs/namei.c
index f05bed242422..bbc15c237558 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1962,8 +1962,8 @@ static int may_mknod(mode_t mode)
1962 } 1962 }
1963} 1963}
1964 1964
1965asmlinkage long sys_mknodat(int dfd, const char __user *filename, int mode, 1965SYSCALL_DEFINE4(mknodat, int, dfd, const char __user *, filename, int, mode,
1966 unsigned dev) 1966 unsigned, dev)
1967{ 1967{
1968 int error; 1968 int error;
1969 char *tmp; 1969 char *tmp;
@@ -2017,7 +2017,7 @@ out_unlock:
2017 return error; 2017 return error;
2018} 2018}
2019 2019
2020asmlinkage long sys_mknod(const char __user *filename, int mode, unsigned dev) 2020SYSCALL_DEFINE3(mknod, const char __user *, filename, int, mode, unsigned, dev)
2021{ 2021{
2022 return sys_mknodat(AT_FDCWD, filename, mode, dev); 2022 return sys_mknodat(AT_FDCWD, filename, mode, dev);
2023} 2023}
@@ -2044,7 +2044,7 @@ int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
2044 return error; 2044 return error;
2045} 2045}
2046 2046
2047asmlinkage long sys_mkdirat(int dfd, const char __user *pathname, int mode) 2047SYSCALL_DEFINE3(mkdirat, int, dfd, const char __user *, pathname, int, mode)
2048{ 2048{
2049 int error = 0; 2049 int error = 0;
2050 char * tmp; 2050 char * tmp;
@@ -2081,7 +2081,7 @@ out_err:
2081 return error; 2081 return error;
2082} 2082}
2083 2083
2084asmlinkage long sys_mkdir(const char __user *pathname, int mode) 2084SYSCALL_DEFINE2(mkdir, const char __user *, pathname, int, mode)
2085{ 2085{
2086 return sys_mkdirat(AT_FDCWD, pathname, mode); 2086 return sys_mkdirat(AT_FDCWD, pathname, mode);
2087} 2087}
@@ -2195,7 +2195,7 @@ exit1:
2195 return error; 2195 return error;
2196} 2196}
2197 2197
2198asmlinkage long sys_rmdir(const char __user *pathname) 2198SYSCALL_DEFINE1(rmdir, const char __user *, pathname)
2199{ 2199{
2200 return do_rmdir(AT_FDCWD, pathname); 2200 return do_rmdir(AT_FDCWD, pathname);
2201} 2201}
@@ -2291,7 +2291,7 @@ slashes:
2291 goto exit2; 2291 goto exit2;
2292} 2292}
2293 2293
2294asmlinkage long sys_unlinkat(int dfd, const char __user *pathname, int flag) 2294SYSCALL_DEFINE3(unlinkat, int, dfd, const char __user *, pathname, int, flag)
2295{ 2295{
2296 if ((flag & ~AT_REMOVEDIR) != 0) 2296 if ((flag & ~AT_REMOVEDIR) != 0)
2297 return -EINVAL; 2297 return -EINVAL;
@@ -2302,7 +2302,7 @@ asmlinkage long sys_unlinkat(int dfd, const char __user *pathname, int flag)
2302 return do_unlinkat(dfd, pathname); 2302 return do_unlinkat(dfd, pathname);
2303} 2303}
2304 2304
2305asmlinkage long sys_unlink(const char __user *pathname) 2305SYSCALL_DEFINE1(unlink, const char __user *, pathname)
2306{ 2306{
2307 return do_unlinkat(AT_FDCWD, pathname); 2307 return do_unlinkat(AT_FDCWD, pathname);
2308} 2308}
@@ -2328,8 +2328,8 @@ int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
2328 return error; 2328 return error;
2329} 2329}
2330 2330
2331asmlinkage long sys_symlinkat(const char __user *oldname, 2331SYSCALL_DEFINE3(symlinkat, const char __user *, oldname,
2332 int newdfd, const char __user *newname) 2332 int, newdfd, const char __user *, newname)
2333{ 2333{
2334 int error; 2334 int error;
2335 char *from; 2335 char *from;
@@ -2370,7 +2370,7 @@ out_putname:
2370 return error; 2370 return error;
2371} 2371}
2372 2372
2373asmlinkage long sys_symlink(const char __user *oldname, const char __user *newname) 2373SYSCALL_DEFINE2(symlink, const char __user *, oldname, const char __user *, newname)
2374{ 2374{
2375 return sys_symlinkat(oldname, AT_FDCWD, newname); 2375 return sys_symlinkat(oldname, AT_FDCWD, newname);
2376} 2376}
@@ -2422,9 +2422,8 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de
2422 * with linux 2.0, and to avoid hard-linking to directories 2422 * with linux 2.0, and to avoid hard-linking to directories
2423 * and other special files. --ADM 2423 * and other special files. --ADM
2424 */ 2424 */
2425asmlinkage long sys_linkat(int olddfd, const char __user *oldname, 2425SYSCALL_DEFINE5(linkat, int, olddfd, const char __user *, oldname,
2426 int newdfd, const char __user *newname, 2426 int, newdfd, const char __user *, newname, int, flags)
2427 int flags)
2428{ 2427{
2429 struct dentry *new_dentry; 2428 struct dentry *new_dentry;
2430 struct nameidata nd; 2429 struct nameidata nd;
@@ -2473,7 +2472,7 @@ out:
2473 return error; 2472 return error;
2474} 2473}
2475 2474
2476asmlinkage long sys_link(const char __user *oldname, const char __user *newname) 2475SYSCALL_DEFINE2(link, const char __user *, oldname, const char __user *, newname)
2477{ 2476{
2478 return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0); 2477 return sys_linkat(AT_FDCWD, oldname, AT_FDCWD, newname, 0);
2479} 2478}
@@ -2624,8 +2623,8 @@ int vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
2624 return error; 2623 return error;
2625} 2624}
2626 2625
2627asmlinkage long sys_renameat(int olddfd, const char __user *oldname, 2626SYSCALL_DEFINE4(renameat, int, olddfd, const char __user *, oldname,
2628 int newdfd, const char __user *newname) 2627 int, newdfd, const char __user *, newname)
2629{ 2628{
2630 struct dentry *old_dir, *new_dir; 2629 struct dentry *old_dir, *new_dir;
2631 struct dentry *old_dentry, *new_dentry; 2630 struct dentry *old_dentry, *new_dentry;
@@ -2718,7 +2717,7 @@ exit:
2718 return error; 2717 return error;
2719} 2718}
2720 2719
2721asmlinkage long sys_rename(const char __user *oldname, const char __user *newname) 2720SYSCALL_DEFINE2(rename, const char __user *, oldname, const char __user *, newname)
2722{ 2721{
2723 return sys_renameat(AT_FDCWD, oldname, AT_FDCWD, newname); 2722 return sys_renameat(AT_FDCWD, oldname, AT_FDCWD, newname);
2724} 2723}
diff --git a/fs/namespace.c b/fs/namespace.c
index a40685d800a8..228d8c4bfd18 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1128,7 +1128,7 @@ static int do_umount(struct vfsmount *mnt, int flags)
1128 * unixes. Our API is identical to OSF/1 to avoid making a mess of AMD 1128 * unixes. Our API is identical to OSF/1 to avoid making a mess of AMD
1129 */ 1129 */
1130 1130
1131asmlinkage long sys_umount(char __user * name, int flags) 1131SYSCALL_DEFINE2(umount, char __user *, name, int, flags)
1132{ 1132{
1133 struct path path; 1133 struct path path;
1134 int retval; 1134 int retval;
@@ -1160,7 +1160,7 @@ out:
1160/* 1160/*
1161 * The 2.0 compatible umount. No flags. 1161 * The 2.0 compatible umount. No flags.
1162 */ 1162 */
1163asmlinkage long sys_oldumount(char __user * name) 1163SYSCALL_DEFINE1(oldumount, char __user *, name)
1164{ 1164{
1165 return sys_umount(name, 0); 1165 return sys_umount(name, 0);
1166} 1166}
@@ -2045,9 +2045,8 @@ struct mnt_namespace *copy_mnt_ns(unsigned long flags, struct mnt_namespace *ns,
2045 return new_ns; 2045 return new_ns;
2046} 2046}
2047 2047
2048asmlinkage long sys_mount(char __user * dev_name, char __user * dir_name, 2048SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name,
2049 char __user * type, unsigned long flags, 2049 char __user *, type, unsigned long, flags, void __user *, data)
2050 void __user * data)
2051{ 2050{
2052 int retval; 2051 int retval;
2053 unsigned long data_page; 2052 unsigned long data_page;
@@ -2172,8 +2171,8 @@ static void chroot_fs_refs(struct path *old_root, struct path *new_root)
2172 * though, so you may need to say mount --bind /nfs/my_root /nfs/my_root 2171 * though, so you may need to say mount --bind /nfs/my_root /nfs/my_root
2173 * first. 2172 * first.
2174 */ 2173 */
2175asmlinkage long sys_pivot_root(const char __user * new_root, 2174SYSCALL_DEFINE2(pivot_root, const char __user *, new_root,
2176 const char __user * put_old) 2175 const char __user *, put_old)
2177{ 2176{
2178 struct vfsmount *tmp; 2177 struct vfsmount *tmp;
2179 struct path new, old, parent_path, root_parent, root; 2178 struct path new, old, parent_path, root_parent, root;
diff --git a/fs/nfsctl.c b/fs/nfsctl.c
index b27451909dff..8f9a20556f79 100644
--- a/fs/nfsctl.c
+++ b/fs/nfsctl.c
@@ -86,8 +86,8 @@ static struct {
86 }, 86 },
87}; 87};
88 88
89long 89SYSCALL_DEFINE3(nfsservctl, int, cmd, struct nfsctl_arg __user *, arg,
90asmlinkage sys_nfsservctl(int cmd, struct nfsctl_arg __user *arg, void __user *res) 90 void __user *, res)
91{ 91{
92 struct file *file; 92 struct file *file;
93 void __user *p = &arg->u; 93 void __user *p = &arg->u;
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index 81b8644b0136..d53a1838d6e8 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -576,7 +576,7 @@ static const struct inotify_operations inotify_user_ops = {
576 .destroy_watch = free_inotify_user_watch, 576 .destroy_watch = free_inotify_user_watch,
577}; 577};
578 578
579asmlinkage long sys_inotify_init1(int flags) 579SYSCALL_DEFINE1(inotify_init1, int, flags)
580{ 580{
581 struct inotify_device *dev; 581 struct inotify_device *dev;
582 struct inotify_handle *ih; 582 struct inotify_handle *ih;
@@ -655,12 +655,13 @@ out_put_fd:
655 return ret; 655 return ret;
656} 656}
657 657
658asmlinkage long sys_inotify_init(void) 658SYSCALL_DEFINE0(inotify_init)
659{ 659{
660 return sys_inotify_init1(0); 660 return sys_inotify_init1(0);
661} 661}
662 662
663asmlinkage long sys_inotify_add_watch(int fd, const char __user *pathname, u32 mask) 663SYSCALL_DEFINE3(inotify_add_watch, int, fd, const char __user *, pathname,
664 u32, mask)
664{ 665{
665 struct inode *inode; 666 struct inode *inode;
666 struct inotify_device *dev; 667 struct inotify_device *dev;
@@ -704,7 +705,7 @@ fput_and_out:
704 return ret; 705 return ret;
705} 706}
706 707
707asmlinkage long sys_inotify_rm_watch(int fd, __s32 wd) 708SYSCALL_DEFINE2(inotify_rm_watch, int, fd, __s32, wd)
708{ 709{
709 struct file *filp; 710 struct file *filp;
710 struct inotify_device *dev; 711 struct inotify_device *dev;
diff --git a/fs/open.c b/fs/open.c
index d882fd2351d6..a3a78ceb2a2b 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -122,7 +122,7 @@ static int vfs_statfs64(struct dentry *dentry, struct statfs64 *buf)
122 return 0; 122 return 0;
123} 123}
124 124
125asmlinkage long sys_statfs(const char __user *pathname, struct statfs __user * buf) 125SYSCALL_DEFINE2(statfs, const char __user *, pathname, struct statfs __user *, buf)
126{ 126{
127 struct path path; 127 struct path path;
128 int error; 128 int error;
@@ -138,8 +138,7 @@ asmlinkage long sys_statfs(const char __user *pathname, struct statfs __user * b
138 return error; 138 return error;
139} 139}
140 140
141 141SYSCALL_DEFINE3(statfs64, const char __user *, pathname, size_t, sz, struct statfs64 __user *, buf)
142asmlinkage long sys_statfs64(const char __user *pathname, size_t sz, struct statfs64 __user *buf)
143{ 142{
144 struct path path; 143 struct path path;
145 long error; 144 long error;
@@ -157,8 +156,7 @@ asmlinkage long sys_statfs64(const char __user *pathname, size_t sz, struct stat
157 return error; 156 return error;
158} 157}
159 158
160 159SYSCALL_DEFINE2(fstatfs, unsigned int, fd, struct statfs __user *, buf)
161asmlinkage long sys_fstatfs(unsigned int fd, struct statfs __user * buf)
162{ 160{
163 struct file * file; 161 struct file * file;
164 struct statfs tmp; 162 struct statfs tmp;
@@ -176,7 +174,7 @@ out:
176 return error; 174 return error;
177} 175}
178 176
179asmlinkage long sys_fstatfs64(unsigned int fd, size_t sz, struct statfs64 __user *buf) 177SYSCALL_DEFINE3(fstatfs64, unsigned int, fd, size_t, sz, struct statfs64 __user *, buf)
180{ 178{
181 struct file * file; 179 struct file * file;
182 struct statfs64 tmp; 180 struct statfs64 tmp;
@@ -289,7 +287,7 @@ out:
289 return error; 287 return error;
290} 288}
291 289
292asmlinkage long sys_truncate(const char __user * path, unsigned long length) 290SYSCALL_DEFINE2(truncate, const char __user *, path, unsigned long, length)
293{ 291{
294 /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */ 292 /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */
295 return do_sys_truncate(path, (long)length); 293 return do_sys_truncate(path, (long)length);
@@ -341,7 +339,7 @@ out:
341 return error; 339 return error;
342} 340}
343 341
344asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length) 342SYSCALL_DEFINE2(ftruncate, unsigned int, fd, unsigned long, length)
345{ 343{
346 long ret = do_sys_ftruncate(fd, length, 1); 344 long ret = do_sys_ftruncate(fd, length, 1);
347 /* avoid REGPARM breakage on x86: */ 345 /* avoid REGPARM breakage on x86: */
@@ -351,21 +349,35 @@ asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
351 349
352/* LFS versions of truncate are only needed on 32 bit machines */ 350/* LFS versions of truncate are only needed on 32 bit machines */
353#if BITS_PER_LONG == 32 351#if BITS_PER_LONG == 32
354asmlinkage long sys_truncate64(const char __user * path, loff_t length) 352SYSCALL_DEFINE(truncate64)(const char __user * path, loff_t length)
355{ 353{
356 return do_sys_truncate(path, length); 354 return do_sys_truncate(path, length);
357} 355}
356#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
357asmlinkage long SyS_truncate64(long path, loff_t length)
358{
359 return SYSC_truncate64((const char __user *) path, length);
360}
361SYSCALL_ALIAS(sys_truncate64, SyS_truncate64);
362#endif
358 363
359asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length) 364SYSCALL_DEFINE(ftruncate64)(unsigned int fd, loff_t length)
360{ 365{
361 long ret = do_sys_ftruncate(fd, length, 0); 366 long ret = do_sys_ftruncate(fd, length, 0);
362 /* avoid REGPARM breakage on x86: */ 367 /* avoid REGPARM breakage on x86: */
363 asmlinkage_protect(2, ret, fd, length); 368 asmlinkage_protect(2, ret, fd, length);
364 return ret; 369 return ret;
365} 370}
371#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
372asmlinkage long SyS_ftruncate64(long fd, loff_t length)
373{
374 return SYSC_ftruncate64((unsigned int) fd, length);
375}
376SYSCALL_ALIAS(sys_ftruncate64, SyS_ftruncate64);
366#endif 377#endif
378#endif /* BITS_PER_LONG == 32 */
367 379
368asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len) 380SYSCALL_DEFINE(fallocate)(int fd, int mode, loff_t offset, loff_t len)
369{ 381{
370 struct file *file; 382 struct file *file;
371 struct inode *inode; 383 struct inode *inode;
@@ -422,13 +434,20 @@ out_fput:
422out: 434out:
423 return ret; 435 return ret;
424} 436}
437#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
438asmlinkage long SyS_fallocate(long fd, long mode, loff_t offset, loff_t len)
439{
440 return SYSC_fallocate((int)fd, (int)mode, offset, len);
441}
442SYSCALL_ALIAS(sys_fallocate, SyS_fallocate);
443#endif
425 444
426/* 445/*
427 * access() needs to use the real uid/gid, not the effective uid/gid. 446 * access() needs to use the real uid/gid, not the effective uid/gid.
428 * We do this by temporarily clearing all FS-related capabilities and 447 * We do this by temporarily clearing all FS-related capabilities and
429 * switching the fsuid/fsgid around to the real ones. 448 * switching the fsuid/fsgid around to the real ones.
430 */ 449 */
431asmlinkage long sys_faccessat(int dfd, const char __user *filename, int mode) 450SYSCALL_DEFINE3(faccessat, int, dfd, const char __user *, filename, int, mode)
432{ 451{
433 const struct cred *old_cred; 452 const struct cred *old_cred;
434 struct cred *override_cred; 453 struct cred *override_cred;
@@ -498,12 +517,12 @@ out:
498 return res; 517 return res;
499} 518}
500 519
501asmlinkage long sys_access(const char __user *filename, int mode) 520SYSCALL_DEFINE2(access, const char __user *, filename, int, mode)
502{ 521{
503 return sys_faccessat(AT_FDCWD, filename, mode); 522 return sys_faccessat(AT_FDCWD, filename, mode);
504} 523}
505 524
506asmlinkage long sys_chdir(const char __user * filename) 525SYSCALL_DEFINE1(chdir, const char __user *, filename)
507{ 526{
508 struct path path; 527 struct path path;
509 int error; 528 int error;
@@ -524,7 +543,7 @@ out:
524 return error; 543 return error;
525} 544}
526 545
527asmlinkage long sys_fchdir(unsigned int fd) 546SYSCALL_DEFINE1(fchdir, unsigned int, fd)
528{ 547{
529 struct file *file; 548 struct file *file;
530 struct inode *inode; 549 struct inode *inode;
@@ -550,7 +569,7 @@ out:
550 return error; 569 return error;
551} 570}
552 571
553asmlinkage long sys_chroot(const char __user * filename) 572SYSCALL_DEFINE1(chroot, const char __user *, filename)
554{ 573{
555 struct path path; 574 struct path path;
556 int error; 575 int error;
@@ -575,7 +594,7 @@ out:
575 return error; 594 return error;
576} 595}
577 596
578asmlinkage long sys_fchmod(unsigned int fd, mode_t mode) 597SYSCALL_DEFINE2(fchmod, unsigned int, fd, mode_t, mode)
579{ 598{
580 struct inode * inode; 599 struct inode * inode;
581 struct dentry * dentry; 600 struct dentry * dentry;
@@ -609,8 +628,7 @@ out:
609 return err; 628 return err;
610} 629}
611 630
612asmlinkage long sys_fchmodat(int dfd, const char __user *filename, 631SYSCALL_DEFINE3(fchmodat, int, dfd, const char __user *, filename, mode_t, mode)
613 mode_t mode)
614{ 632{
615 struct path path; 633 struct path path;
616 struct inode *inode; 634 struct inode *inode;
@@ -639,7 +657,7 @@ out:
639 return error; 657 return error;
640} 658}
641 659
642asmlinkage long sys_chmod(const char __user *filename, mode_t mode) 660SYSCALL_DEFINE2(chmod, const char __user *, filename, mode_t, mode)
643{ 661{
644 return sys_fchmodat(AT_FDCWD, filename, mode); 662 return sys_fchmodat(AT_FDCWD, filename, mode);
645} 663}
@@ -669,7 +687,7 @@ static int chown_common(struct dentry * dentry, uid_t user, gid_t group)
669 return error; 687 return error;
670} 688}
671 689
672asmlinkage long sys_chown(const char __user * filename, uid_t user, gid_t group) 690SYSCALL_DEFINE3(chown, const char __user *, filename, uid_t, user, gid_t, group)
673{ 691{
674 struct path path; 692 struct path path;
675 int error; 693 int error;
@@ -688,8 +706,8 @@ out:
688 return error; 706 return error;
689} 707}
690 708
691asmlinkage long sys_fchownat(int dfd, const char __user *filename, uid_t user, 709SYSCALL_DEFINE5(fchownat, int, dfd, const char __user *, filename, uid_t, user,
692 gid_t group, int flag) 710 gid_t, group, int, flag)
693{ 711{
694 struct path path; 712 struct path path;
695 int error = -EINVAL; 713 int error = -EINVAL;
@@ -713,7 +731,7 @@ out:
713 return error; 731 return error;
714} 732}
715 733
716asmlinkage long sys_lchown(const char __user * filename, uid_t user, gid_t group) 734SYSCALL_DEFINE3(lchown, const char __user *, filename, uid_t, user, gid_t, group)
717{ 735{
718 struct path path; 736 struct path path;
719 int error; 737 int error;
@@ -732,8 +750,7 @@ out:
732 return error; 750 return error;
733} 751}
734 752
735 753SYSCALL_DEFINE3(fchown, unsigned int, fd, uid_t, user, gid_t, group)
736asmlinkage long sys_fchown(unsigned int fd, uid_t user, gid_t group)
737{ 754{
738 struct file * file; 755 struct file * file;
739 int error = -EBADF; 756 int error = -EBADF;
@@ -1029,7 +1046,7 @@ long do_sys_open(int dfd, const char __user *filename, int flags, int mode)
1029 return fd; 1046 return fd;
1030} 1047}
1031 1048
1032asmlinkage long sys_open(const char __user *filename, int flags, int mode) 1049SYSCALL_DEFINE3(open, const char __user *, filename, int, flags, int, mode)
1033{ 1050{
1034 long ret; 1051 long ret;
1035 1052
@@ -1042,8 +1059,8 @@ asmlinkage long sys_open(const char __user *filename, int flags, int mode)
1042 return ret; 1059 return ret;
1043} 1060}
1044 1061
1045asmlinkage long sys_openat(int dfd, const char __user *filename, int flags, 1062SYSCALL_DEFINE4(openat, int, dfd, const char __user *, filename, int, flags,
1046 int mode) 1063 int, mode)
1047{ 1064{
1048 long ret; 1065 long ret;
1049 1066
@@ -1062,7 +1079,7 @@ asmlinkage long sys_openat(int dfd, const char __user *filename, int flags,
1062 * For backward compatibility? Maybe this should be moved 1079 * For backward compatibility? Maybe this should be moved
1063 * into arch/i386 instead? 1080 * into arch/i386 instead?
1064 */ 1081 */
1065asmlinkage long sys_creat(const char __user * pathname, int mode) 1082SYSCALL_DEFINE2(creat, const char __user *, pathname, int, mode)
1066{ 1083{
1067 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode); 1084 return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC, mode);
1068} 1085}
@@ -1098,7 +1115,7 @@ EXPORT_SYMBOL(filp_close);
1098 * releasing the fd. This ensures that one clone task can't release 1115 * releasing the fd. This ensures that one clone task can't release
1099 * an fd while another clone is opening it. 1116 * an fd while another clone is opening it.
1100 */ 1117 */
1101asmlinkage long sys_close(unsigned int fd) 1118SYSCALL_DEFINE1(close, unsigned int, fd)
1102{ 1119{
1103 struct file * filp; 1120 struct file * filp;
1104 struct files_struct *files = current->files; 1121 struct files_struct *files = current->files;
@@ -1131,14 +1148,13 @@ out_unlock:
1131 spin_unlock(&files->file_lock); 1148 spin_unlock(&files->file_lock);
1132 return -EBADF; 1149 return -EBADF;
1133} 1150}
1134
1135EXPORT_SYMBOL(sys_close); 1151EXPORT_SYMBOL(sys_close);
1136 1152
1137/* 1153/*
1138 * This routine simulates a hangup on the tty, to arrange that users 1154 * This routine simulates a hangup on the tty, to arrange that users
1139 * are given clean terminals at login time. 1155 * are given clean terminals at login time.
1140 */ 1156 */
1141asmlinkage long sys_vhangup(void) 1157SYSCALL_DEFINE0(vhangup)
1142{ 1158{
1143 if (capable(CAP_SYS_TTY_CONFIG)) { 1159 if (capable(CAP_SYS_TTY_CONFIG)) {
1144 tty_vhangup_self(); 1160 tty_vhangup_self();
diff --git a/fs/pipe.c b/fs/pipe.c
index 891697112f66..3a48ba5179d5 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -1043,7 +1043,7 @@ int do_pipe(int *fd)
1043 * sys_pipe() is the normal C calling standard for creating 1043 * sys_pipe() is the normal C calling standard for creating
1044 * a pipe. It's not the way Unix traditionally does this, though. 1044 * a pipe. It's not the way Unix traditionally does this, though.
1045 */ 1045 */
1046asmlinkage long __weak sys_pipe2(int __user *fildes, int flags) 1046SYSCALL_DEFINE2(pipe2, int __user *, fildes, int, flags)
1047{ 1047{
1048 int fd[2]; 1048 int fd[2];
1049 int error; 1049 int error;
@@ -1059,7 +1059,7 @@ asmlinkage long __weak sys_pipe2(int __user *fildes, int flags)
1059 return error; 1059 return error;
1060} 1060}
1061 1061
1062asmlinkage long __weak sys_pipe(int __user *fildes) 1062SYSCALL_DEFINE1(pipe, int __user *, fildes)
1063{ 1063{
1064 return sys_pipe2(fildes, 0); 1064 return sys_pipe2(fildes, 0);
1065} 1065}
diff --git a/fs/quota.c b/fs/quota.c
index 4a8c94f05f76..d76ada914f98 100644
--- a/fs/quota.c
+++ b/fs/quota.c
@@ -371,7 +371,8 @@ static inline struct super_block *quotactl_block(const char __user *special)
371 * calls. Maybe we need to add the process quotas etc. in the future, 371 * calls. Maybe we need to add the process quotas etc. in the future,
372 * but we probably should use rlimits for that. 372 * but we probably should use rlimits for that.
373 */ 373 */
374asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special, qid_t id, void __user *addr) 374SYSCALL_DEFINE4(quotactl, unsigned int, cmd, const char __user *, special,
375 qid_t, id, void __user *, addr)
375{ 376{
376 uint cmds, type; 377 uint cmds, type;
377 struct super_block *sb = NULL; 378 struct super_block *sb = NULL;
diff --git a/fs/read_write.c b/fs/read_write.c
index 5cc6924eb158..400fe81c973e 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -147,7 +147,7 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin)
147} 147}
148EXPORT_SYMBOL(vfs_llseek); 148EXPORT_SYMBOL(vfs_llseek);
149 149
150asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin) 150SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, origin)
151{ 151{
152 off_t retval; 152 off_t retval;
153 struct file * file; 153 struct file * file;
@@ -171,9 +171,9 @@ bad:
171} 171}
172 172
173#ifdef __ARCH_WANT_SYS_LLSEEK 173#ifdef __ARCH_WANT_SYS_LLSEEK
174asmlinkage long sys_llseek(unsigned int fd, unsigned long offset_high, 174SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high,
175 unsigned long offset_low, loff_t __user * result, 175 unsigned long, offset_low, loff_t __user *, result,
176 unsigned int origin) 176 unsigned int, origin)
177{ 177{
178 int retval; 178 int retval;
179 struct file * file; 179 struct file * file;
@@ -369,7 +369,7 @@ static inline void file_pos_write(struct file *file, loff_t pos)
369 file->f_pos = pos; 369 file->f_pos = pos;
370} 370}
371 371
372asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count) 372SYSCALL_DEFINE3(read, unsigned int, fd, char __user *, buf, size_t, count)
373{ 373{
374 struct file *file; 374 struct file *file;
375 ssize_t ret = -EBADF; 375 ssize_t ret = -EBADF;
@@ -386,7 +386,8 @@ asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count)
386 return ret; 386 return ret;
387} 387}
388 388
389asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count) 389SYSCALL_DEFINE3(write, unsigned int, fd, const char __user *, buf,
390 size_t, count)
390{ 391{
391 struct file *file; 392 struct file *file;
392 ssize_t ret = -EBADF; 393 ssize_t ret = -EBADF;
@@ -403,8 +404,8 @@ asmlinkage ssize_t sys_write(unsigned int fd, const char __user * buf, size_t co
403 return ret; 404 return ret;
404} 405}
405 406
406asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf, 407SYSCALL_DEFINE(pread64)(unsigned int fd, char __user *buf,
407 size_t count, loff_t pos) 408 size_t count, loff_t pos)
408{ 409{
409 struct file *file; 410 struct file *file;
410 ssize_t ret = -EBADF; 411 ssize_t ret = -EBADF;
@@ -423,9 +424,17 @@ asmlinkage ssize_t sys_pread64(unsigned int fd, char __user *buf,
423 424
424 return ret; 425 return ret;
425} 426}
427#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
428asmlinkage long SyS_pread64(long fd, long buf, long count, loff_t pos)
429{
430 return SYSC_pread64((unsigned int) fd, (char __user *) buf,
431 (size_t) count, pos);
432}
433SYSCALL_ALIAS(sys_pread64, SyS_pread64);
434#endif
426 435
427asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf, 436SYSCALL_DEFINE(pwrite64)(unsigned int fd, const char __user *buf,
428 size_t count, loff_t pos) 437 size_t count, loff_t pos)
429{ 438{
430 struct file *file; 439 struct file *file;
431 ssize_t ret = -EBADF; 440 ssize_t ret = -EBADF;
@@ -444,6 +453,14 @@ asmlinkage ssize_t sys_pwrite64(unsigned int fd, const char __user *buf,
444 453
445 return ret; 454 return ret;
446} 455}
456#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
457asmlinkage long SyS_pwrite64(long fd, long buf, long count, loff_t pos)
458{
459 return SYSC_pwrite64((unsigned int) fd, (const char __user *) buf,
460 (size_t) count, pos);
461}
462SYSCALL_ALIAS(sys_pwrite64, SyS_pwrite64);
463#endif
447 464
448/* 465/*
449 * Reduce an iovec's length in-place. Return the resulting number of segments 466 * Reduce an iovec's length in-place. Return the resulting number of segments
@@ -672,8 +689,8 @@ ssize_t vfs_writev(struct file *file, const struct iovec __user *vec,
672 689
673EXPORT_SYMBOL(vfs_writev); 690EXPORT_SYMBOL(vfs_writev);
674 691
675asmlinkage ssize_t 692SYSCALL_DEFINE3(readv, unsigned long, fd, const struct iovec __user *, vec,
676sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) 693 unsigned long, vlen)
677{ 694{
678 struct file *file; 695 struct file *file;
679 ssize_t ret = -EBADF; 696 ssize_t ret = -EBADF;
@@ -693,8 +710,8 @@ sys_readv(unsigned long fd, const struct iovec __user *vec, unsigned long vlen)
693 return ret; 710 return ret;
694} 711}
695 712
696asmlinkage ssize_t 713SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec,
697sys_writev(unsigned long fd, const struct iovec __user *vec, unsigned long vlen) 714 unsigned long, vlen)
698{ 715{
699 struct file *file; 716 struct file *file;
700 ssize_t ret = -EBADF; 717 ssize_t ret = -EBADF;
@@ -812,7 +829,7 @@ out:
812 return retval; 829 return retval;
813} 830}
814 831
815asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, size_t count) 832SYSCALL_DEFINE4(sendfile, int, out_fd, int, in_fd, off_t __user *, offset, size_t, count)
816{ 833{
817 loff_t pos; 834 loff_t pos;
818 off_t off; 835 off_t off;
@@ -831,7 +848,7 @@ asmlinkage ssize_t sys_sendfile(int out_fd, int in_fd, off_t __user *offset, siz
831 return do_sendfile(out_fd, in_fd, NULL, count, 0); 848 return do_sendfile(out_fd, in_fd, NULL, count, 0);
832} 849}
833 850
834asmlinkage ssize_t sys_sendfile64(int out_fd, int in_fd, loff_t __user *offset, size_t count) 851SYSCALL_DEFINE4(sendfile64, int, out_fd, int, in_fd, loff_t __user *, offset, size_t, count)
835{ 852{
836 loff_t pos; 853 loff_t pos;
837 ssize_t ret; 854 ssize_t ret;
diff --git a/fs/readdir.c b/fs/readdir.c
index b318d9b5af2e..7723401f8d8b 100644
--- a/fs/readdir.c
+++ b/fs/readdir.c
@@ -102,7 +102,8 @@ efault:
102 return -EFAULT; 102 return -EFAULT;
103} 103}
104 104
105asmlinkage long old_readdir(unsigned int fd, struct old_linux_dirent __user * dirent, unsigned int count) 105SYSCALL_DEFINE3(old_readdir, unsigned int, fd,
106 struct old_linux_dirent __user *, dirent, unsigned int, count)
106{ 107{
107 int error; 108 int error;
108 struct file * file; 109 struct file * file;
@@ -187,7 +188,8 @@ efault:
187 return -EFAULT; 188 return -EFAULT;
188} 189}
189 190
190asmlinkage long sys_getdents(unsigned int fd, struct linux_dirent __user * dirent, unsigned int count) 191SYSCALL_DEFINE3(getdents, unsigned int, fd,
192 struct linux_dirent __user *, dirent, unsigned int, count)
191{ 193{
192 struct file * file; 194 struct file * file;
193 struct linux_dirent __user * lastdirent; 195 struct linux_dirent __user * lastdirent;
@@ -268,7 +270,8 @@ efault:
268 return -EFAULT; 270 return -EFAULT;
269} 271}
270 272
271asmlinkage long sys_getdents64(unsigned int fd, struct linux_dirent64 __user * dirent, unsigned int count) 273SYSCALL_DEFINE3(getdents64, unsigned int, fd,
274 struct linux_dirent64 __user *, dirent, unsigned int, count)
272{ 275{
273 struct file * file; 276 struct file * file;
274 struct linux_dirent64 __user * lastdirent; 277 struct linux_dirent64 __user * lastdirent;
diff --git a/fs/select.c b/fs/select.c
index b0cf1f0896d9..0fe0e1469df3 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -557,8 +557,8 @@ out_nofds:
557 return ret; 557 return ret;
558} 558}
559 559
560asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp, 560SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp,
561 fd_set __user *exp, struct timeval __user *tvp) 561 fd_set __user *, exp, struct timeval __user *, tvp)
562{ 562{
563 struct timespec end_time, *to = NULL; 563 struct timespec end_time, *to = NULL;
564 struct timeval tv; 564 struct timeval tv;
@@ -582,9 +582,9 @@ asmlinkage long sys_select(int n, fd_set __user *inp, fd_set __user *outp,
582} 582}
583 583
584#ifdef HAVE_SET_RESTORE_SIGMASK 584#ifdef HAVE_SET_RESTORE_SIGMASK
585asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp, 585static long do_pselect(int n, fd_set __user *inp, fd_set __user *outp,
586 fd_set __user *exp, struct timespec __user *tsp, 586 fd_set __user *exp, struct timespec __user *tsp,
587 const sigset_t __user *sigmask, size_t sigsetsize) 587 const sigset_t __user *sigmask, size_t sigsetsize)
588{ 588{
589 sigset_t ksigmask, sigsaved; 589 sigset_t ksigmask, sigsaved;
590 struct timespec ts, end_time, *to = NULL; 590 struct timespec ts, end_time, *to = NULL;
@@ -636,8 +636,9 @@ asmlinkage long sys_pselect7(int n, fd_set __user *inp, fd_set __user *outp,
636 * which has a pointer to the sigset_t itself followed by a size_t containing 636 * which has a pointer to the sigset_t itself followed by a size_t containing
637 * the sigset size. 637 * the sigset size.
638 */ 638 */
639asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp, 639SYSCALL_DEFINE6(pselect6, int, n, fd_set __user *, inp, fd_set __user *, outp,
640 fd_set __user *exp, struct timespec __user *tsp, void __user *sig) 640 fd_set __user *, exp, struct timespec __user *, tsp,
641 void __user *, sig)
641{ 642{
642 size_t sigsetsize = 0; 643 size_t sigsetsize = 0;
643 sigset_t __user *up = NULL; 644 sigset_t __user *up = NULL;
@@ -650,7 +651,7 @@ asmlinkage long sys_pselect6(int n, fd_set __user *inp, fd_set __user *outp,
650 return -EFAULT; 651 return -EFAULT;
651 } 652 }
652 653
653 return sys_pselect7(n, inp, outp, exp, tsp, up, sigsetsize); 654 return do_pselect(n, inp, outp, exp, tsp, up, sigsetsize);
654} 655}
655#endif /* HAVE_SET_RESTORE_SIGMASK */ 656#endif /* HAVE_SET_RESTORE_SIGMASK */
656 657
@@ -854,8 +855,8 @@ static long do_restart_poll(struct restart_block *restart_block)
854 return ret; 855 return ret;
855} 856}
856 857
857asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, 858SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds,
858 long timeout_msecs) 859 long, timeout_msecs)
859{ 860{
860 struct timespec end_time, *to = NULL; 861 struct timespec end_time, *to = NULL;
861 int ret; 862 int ret;
@@ -889,9 +890,9 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
889} 890}
890 891
891#ifdef HAVE_SET_RESTORE_SIGMASK 892#ifdef HAVE_SET_RESTORE_SIGMASK
892asmlinkage long sys_ppoll(struct pollfd __user *ufds, unsigned int nfds, 893SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds, unsigned int, nfds,
893 struct timespec __user *tsp, const sigset_t __user *sigmask, 894 struct timespec __user *, tsp, const sigset_t __user *, sigmask,
894 size_t sigsetsize) 895 size_t, sigsetsize)
895{ 896{
896 sigset_t ksigmask, sigsaved; 897 sigset_t ksigmask, sigsaved;
897 struct timespec ts, end_time, *to = NULL; 898 struct timespec ts, end_time, *to = NULL;
diff --git a/fs/signalfd.c b/fs/signalfd.c
index 9c39bc7f8431..b07565c94386 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -205,8 +205,8 @@ static const struct file_operations signalfd_fops = {
205 .read = signalfd_read, 205 .read = signalfd_read,
206}; 206};
207 207
208asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask, 208SYSCALL_DEFINE4(signalfd4, int, ufd, sigset_t __user *, user_mask,
209 size_t sizemask, int flags) 209 size_t, sizemask, int, flags)
210{ 210{
211 sigset_t sigmask; 211 sigset_t sigmask;
212 struct signalfd_ctx *ctx; 212 struct signalfd_ctx *ctx;
@@ -259,8 +259,8 @@ asmlinkage long sys_signalfd4(int ufd, sigset_t __user *user_mask,
259 return ufd; 259 return ufd;
260} 260}
261 261
262asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, 262SYSCALL_DEFINE3(signalfd, int, ufd, sigset_t __user *, user_mask,
263 size_t sizemask) 263 size_t, sizemask)
264{ 264{
265 return sys_signalfd4(ufd, user_mask, sizemask, 0); 265 return sys_signalfd4(ufd, user_mask, sizemask, 0);
266} 266}
diff --git a/fs/splice.c b/fs/splice.c
index a54b3e3f10a7..4ed0ba44a966 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -1435,8 +1435,8 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov,
1435 * Currently we punt and implement it as a normal copy, see pipe_to_user(). 1435 * Currently we punt and implement it as a normal copy, see pipe_to_user().
1436 * 1436 *
1437 */ 1437 */
1438asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov, 1438SYSCALL_DEFINE4(vmsplice, int, fd, const struct iovec __user *, iov,
1439 unsigned long nr_segs, unsigned int flags) 1439 unsigned long, nr_segs, unsigned int, flags)
1440{ 1440{
1441 struct file *file; 1441 struct file *file;
1442 long error; 1442 long error;
@@ -1461,9 +1461,9 @@ asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov,
1461 return error; 1461 return error;
1462} 1462}
1463 1463
1464asmlinkage long sys_splice(int fd_in, loff_t __user *off_in, 1464SYSCALL_DEFINE6(splice, int, fd_in, loff_t __user *, off_in,
1465 int fd_out, loff_t __user *off_out, 1465 int, fd_out, loff_t __user *, off_out,
1466 size_t len, unsigned int flags) 1466 size_t, len, unsigned int, flags)
1467{ 1467{
1468 long error; 1468 long error;
1469 struct file *in, *out; 1469 struct file *in, *out;
@@ -1685,7 +1685,7 @@ static long do_tee(struct file *in, struct file *out, size_t len,
1685 return ret; 1685 return ret;
1686} 1686}
1687 1687
1688asmlinkage long sys_tee(int fdin, int fdout, size_t len, unsigned int flags) 1688SYSCALL_DEFINE4(tee, int, fdin, int, fdout, size_t, len, unsigned int, flags)
1689{ 1689{
1690 struct file *in; 1690 struct file *in;
1691 int error, fput_in; 1691 int error, fput_in;
diff --git a/fs/stat.c b/fs/stat.c
index 7e12a6f82795..2db740a0cfb5 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -152,7 +152,7 @@ static int cp_old_stat(struct kstat *stat, struct __old_kernel_stat __user * sta
152 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 152 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
153} 153}
154 154
155asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user * statbuf) 155SYSCALL_DEFINE2(stat, char __user *, filename, struct __old_kernel_stat __user *, statbuf)
156{ 156{
157 struct kstat stat; 157 struct kstat stat;
158 int error = vfs_stat_fd(AT_FDCWD, filename, &stat); 158 int error = vfs_stat_fd(AT_FDCWD, filename, &stat);
@@ -162,7 +162,8 @@ asmlinkage long sys_stat(char __user * filename, struct __old_kernel_stat __user
162 162
163 return error; 163 return error;
164} 164}
165asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __user * statbuf) 165
166SYSCALL_DEFINE2(lstat, char __user *, filename, struct __old_kernel_stat __user *, statbuf)
166{ 167{
167 struct kstat stat; 168 struct kstat stat;
168 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); 169 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat);
@@ -172,7 +173,8 @@ asmlinkage long sys_lstat(char __user * filename, struct __old_kernel_stat __use
172 173
173 return error; 174 return error;
174} 175}
175asmlinkage long sys_fstat(unsigned int fd, struct __old_kernel_stat __user * statbuf) 176
177SYSCALL_DEFINE2(fstat, unsigned int, fd, struct __old_kernel_stat __user *, statbuf)
176{ 178{
177 struct kstat stat; 179 struct kstat stat;
178 int error = vfs_fstat(fd, &stat); 180 int error = vfs_fstat(fd, &stat);
@@ -235,7 +237,7 @@ static int cp_new_stat(struct kstat *stat, struct stat __user *statbuf)
235 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 237 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
236} 238}
237 239
238asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf) 240SYSCALL_DEFINE2(newstat, char __user *, filename, struct stat __user *, statbuf)
239{ 241{
240 struct kstat stat; 242 struct kstat stat;
241 int error = vfs_stat_fd(AT_FDCWD, filename, &stat); 243 int error = vfs_stat_fd(AT_FDCWD, filename, &stat);
@@ -246,7 +248,7 @@ asmlinkage long sys_newstat(char __user *filename, struct stat __user *statbuf)
246 return error; 248 return error;
247} 249}
248 250
249asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf) 251SYSCALL_DEFINE2(newlstat, char __user *, filename, struct stat __user *, statbuf)
250{ 252{
251 struct kstat stat; 253 struct kstat stat;
252 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat); 254 int error = vfs_lstat_fd(AT_FDCWD, filename, &stat);
@@ -258,8 +260,8 @@ asmlinkage long sys_newlstat(char __user *filename, struct stat __user *statbuf)
258} 260}
259 261
260#if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT) 262#if !defined(__ARCH_WANT_STAT64) || defined(__ARCH_WANT_SYS_NEWFSTATAT)
261asmlinkage long sys_newfstatat(int dfd, char __user *filename, 263SYSCALL_DEFINE4(newfstatat, int, dfd, char __user *, filename,
262 struct stat __user *statbuf, int flag) 264 struct stat __user *, statbuf, int, flag)
263{ 265{
264 struct kstat stat; 266 struct kstat stat;
265 int error = -EINVAL; 267 int error = -EINVAL;
@@ -280,7 +282,7 @@ out:
280} 282}
281#endif 283#endif
282 284
283asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf) 285SYSCALL_DEFINE2(newfstat, unsigned int, fd, struct stat __user *, statbuf)
284{ 286{
285 struct kstat stat; 287 struct kstat stat;
286 int error = vfs_fstat(fd, &stat); 288 int error = vfs_fstat(fd, &stat);
@@ -291,8 +293,8 @@ asmlinkage long sys_newfstat(unsigned int fd, struct stat __user *statbuf)
291 return error; 293 return error;
292} 294}
293 295
294asmlinkage long sys_readlinkat(int dfd, const char __user *pathname, 296SYSCALL_DEFINE4(readlinkat, int, dfd, const char __user *, pathname,
295 char __user *buf, int bufsiz) 297 char __user *, buf, int, bufsiz)
296{ 298{
297 struct path path; 299 struct path path;
298 int error; 300 int error;
@@ -318,8 +320,8 @@ asmlinkage long sys_readlinkat(int dfd, const char __user *pathname,
318 return error; 320 return error;
319} 321}
320 322
321asmlinkage long sys_readlink(const char __user *path, char __user *buf, 323SYSCALL_DEFINE3(readlink, const char __user *, path, char __user *, buf,
322 int bufsiz) 324 int, bufsiz)
323{ 325{
324 return sys_readlinkat(AT_FDCWD, path, buf, bufsiz); 326 return sys_readlinkat(AT_FDCWD, path, buf, bufsiz);
325} 327}
@@ -365,7 +367,7 @@ static long cp_new_stat64(struct kstat *stat, struct stat64 __user *statbuf)
365 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0; 367 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
366} 368}
367 369
368asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbuf) 370SYSCALL_DEFINE2(stat64, char __user *, filename, struct stat64 __user *, statbuf)
369{ 371{
370 struct kstat stat; 372 struct kstat stat;
371 int error = vfs_stat(filename, &stat); 373 int error = vfs_stat(filename, &stat);
@@ -375,7 +377,8 @@ asmlinkage long sys_stat64(char __user * filename, struct stat64 __user * statbu
375 377
376 return error; 378 return error;
377} 379}
378asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statbuf) 380
381SYSCALL_DEFINE2(lstat64, char __user *, filename, struct stat64 __user *, statbuf)
379{ 382{
380 struct kstat stat; 383 struct kstat stat;
381 int error = vfs_lstat(filename, &stat); 384 int error = vfs_lstat(filename, &stat);
@@ -385,7 +388,8 @@ asmlinkage long sys_lstat64(char __user * filename, struct stat64 __user * statb
385 388
386 return error; 389 return error;
387} 390}
388asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf) 391
392SYSCALL_DEFINE2(fstat64, unsigned long, fd, struct stat64 __user *, statbuf)
389{ 393{
390 struct kstat stat; 394 struct kstat stat;
391 int error = vfs_fstat(fd, &stat); 395 int error = vfs_fstat(fd, &stat);
@@ -396,8 +400,8 @@ asmlinkage long sys_fstat64(unsigned long fd, struct stat64 __user * statbuf)
396 return error; 400 return error;
397} 401}
398 402
399asmlinkage long sys_fstatat64(int dfd, char __user *filename, 403SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename,
400 struct stat64 __user *statbuf, int flag) 404 struct stat64 __user *, statbuf, int, flag)
401{ 405{
402 struct kstat stat; 406 struct kstat stat;
403 int error = -EINVAL; 407 int error = -EINVAL;
diff --git a/fs/super.c b/fs/super.c
index ed080c417167..645e5403f2a0 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -544,7 +544,7 @@ rescan:
544 return NULL; 544 return NULL;
545} 545}
546 546
547asmlinkage long sys_ustat(unsigned dev, struct ustat __user * ubuf) 547SYSCALL_DEFINE2(ustat, unsigned, dev, struct ustat __user *, ubuf)
548{ 548{
549 struct super_block *s; 549 struct super_block *s;
550 struct ustat tmp; 550 struct ustat tmp;
diff --git a/fs/sync.c b/fs/sync.c
index ac02b56548bc..a16d53e5fe9d 100644
--- a/fs/sync.c
+++ b/fs/sync.c
@@ -36,7 +36,7 @@ static void do_sync(unsigned long wait)
36 laptop_sync_completion(); 36 laptop_sync_completion();
37} 37}
38 38
39asmlinkage long sys_sync(void) 39SYSCALL_DEFINE0(sync)
40{ 40{
41 do_sync(1); 41 do_sync(1);
42 return 0; 42 return 0;
@@ -144,12 +144,12 @@ static int do_fsync(unsigned int fd, int datasync)
144 return ret; 144 return ret;
145} 145}
146 146
147asmlinkage long sys_fsync(unsigned int fd) 147SYSCALL_DEFINE1(fsync, unsigned int, fd)
148{ 148{
149 return do_fsync(fd, 0); 149 return do_fsync(fd, 0);
150} 150}
151 151
152asmlinkage long sys_fdatasync(unsigned int fd) 152SYSCALL_DEFINE1(fdatasync, unsigned int, fd)
153{ 153{
154 return do_fsync(fd, 1); 154 return do_fsync(fd, 1);
155} 155}
@@ -201,8 +201,8 @@ asmlinkage long sys_fdatasync(unsigned int fd)
201 * already-instantiated disk blocks, there are no guarantees here that the data 201 * already-instantiated disk blocks, there are no guarantees here that the data
202 * will be available after a crash. 202 * will be available after a crash.
203 */ 203 */
204asmlinkage long sys_sync_file_range(int fd, loff_t offset, loff_t nbytes, 204SYSCALL_DEFINE(sync_file_range)(int fd, loff_t offset, loff_t nbytes,
205 unsigned int flags) 205 unsigned int flags)
206{ 206{
207 int ret; 207 int ret;
208 struct file *file; 208 struct file *file;
@@ -262,14 +262,32 @@ out_put:
262out: 262out:
263 return ret; 263 return ret;
264} 264}
265#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
266asmlinkage long SyS_sync_file_range(long fd, loff_t offset, loff_t nbytes,
267 long flags)
268{
269 return SYSC_sync_file_range((int) fd, offset, nbytes,
270 (unsigned int) flags);
271}
272SYSCALL_ALIAS(sys_sync_file_range, SyS_sync_file_range);
273#endif
265 274
266/* It would be nice if people remember that not all the world's an i386 275/* It would be nice if people remember that not all the world's an i386
267 when they introduce new system calls */ 276 when they introduce new system calls */
268asmlinkage long sys_sync_file_range2(int fd, unsigned int flags, 277SYSCALL_DEFINE(sync_file_range2)(int fd, unsigned int flags,
269 loff_t offset, loff_t nbytes) 278 loff_t offset, loff_t nbytes)
270{ 279{
271 return sys_sync_file_range(fd, offset, nbytes, flags); 280 return sys_sync_file_range(fd, offset, nbytes, flags);
272} 281}
282#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
283asmlinkage long SyS_sync_file_range2(long fd, long flags,
284 loff_t offset, loff_t nbytes)
285{
286 return SYSC_sync_file_range2((int) fd, (unsigned int) flags,
287 offset, nbytes);
288}
289SYSCALL_ALIAS(sys_sync_file_range2, SyS_sync_file_range2);
290#endif
273 291
274/* 292/*
275 * `endbyte' is inclusive 293 * `endbyte' is inclusive
diff --git a/fs/timerfd.c b/fs/timerfd.c
index 0862f0e49d0c..6a123b8ff3f5 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -177,7 +177,7 @@ static struct file *timerfd_fget(int fd)
177 return file; 177 return file;
178} 178}
179 179
180asmlinkage long sys_timerfd_create(int clockid, int flags) 180SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
181{ 181{
182 int ufd; 182 int ufd;
183 struct timerfd_ctx *ctx; 183 struct timerfd_ctx *ctx;
@@ -208,9 +208,9 @@ asmlinkage long sys_timerfd_create(int clockid, int flags)
208 return ufd; 208 return ufd;
209} 209}
210 210
211asmlinkage long sys_timerfd_settime(int ufd, int flags, 211SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
212 const struct itimerspec __user *utmr, 212 const struct itimerspec __user *, utmr,
213 struct itimerspec __user *otmr) 213 struct itimerspec __user *, otmr)
214{ 214{
215 struct file *file; 215 struct file *file;
216 struct timerfd_ctx *ctx; 216 struct timerfd_ctx *ctx;
@@ -265,7 +265,7 @@ asmlinkage long sys_timerfd_settime(int ufd, int flags,
265 return 0; 265 return 0;
266} 266}
267 267
268asmlinkage long sys_timerfd_gettime(int ufd, struct itimerspec __user *otmr) 268SYSCALL_DEFINE2(timerfd_gettime, int, ufd, struct itimerspec __user *, otmr)
269{ 269{
270 struct file *file; 270 struct file *file;
271 struct timerfd_ctx *ctx; 271 struct timerfd_ctx *ctx;
diff --git a/fs/utimes.c b/fs/utimes.c
index 6929e3e91d05..e4c75db5d373 100644
--- a/fs/utimes.c
+++ b/fs/utimes.c
@@ -24,7 +24,7 @@
24 * must be owner or have write permission. 24 * must be owner or have write permission.
25 * Else, update from *times, must be owner or super user. 25 * Else, update from *times, must be owner or super user.
26 */ 26 */
27asmlinkage long sys_utime(char __user *filename, struct utimbuf __user *times) 27SYSCALL_DEFINE2(utime, char __user *, filename, struct utimbuf __user *, times)
28{ 28{
29 struct timespec tv[2]; 29 struct timespec tv[2];
30 30
@@ -170,7 +170,8 @@ out:
170 return error; 170 return error;
171} 171}
172 172
173asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __user *utimes, int flags) 173SYSCALL_DEFINE4(utimensat, int, dfd, char __user *, filename,
174 struct timespec __user *, utimes, int, flags)
174{ 175{
175 struct timespec tstimes[2]; 176 struct timespec tstimes[2];
176 177
@@ -187,7 +188,8 @@ asmlinkage long sys_utimensat(int dfd, char __user *filename, struct timespec __
187 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags); 188 return do_utimes(dfd, filename, utimes ? tstimes : NULL, flags);
188} 189}
189 190
190asmlinkage long sys_futimesat(int dfd, char __user *filename, struct timeval __user *utimes) 191SYSCALL_DEFINE3(futimesat, int, dfd, char __user *, filename,
192 struct timeval __user *, utimes)
191{ 193{
192 struct timeval times[2]; 194 struct timeval times[2];
193 struct timespec tstimes[2]; 195 struct timespec tstimes[2];
@@ -214,7 +216,8 @@ asmlinkage long sys_futimesat(int dfd, char __user *filename, struct timeval __u
214 return do_utimes(dfd, filename, utimes ? tstimes : NULL, 0); 216 return do_utimes(dfd, filename, utimes ? tstimes : NULL, 0);
215} 217}
216 218
217asmlinkage long sys_utimes(char __user *filename, struct timeval __user *utimes) 219SYSCALL_DEFINE2(utimes, char __user *, filename,
220 struct timeval __user *, utimes)
218{ 221{
219 return sys_futimesat(AT_FDCWD, filename, utimes); 222 return sys_futimesat(AT_FDCWD, filename, utimes);
220} 223}
diff --git a/fs/xattr.c b/fs/xattr.c
index 237804cd6b56..197c4fcac032 100644
--- a/fs/xattr.c
+++ b/fs/xattr.c
@@ -251,9 +251,9 @@ setxattr(struct dentry *d, const char __user *name, const void __user *value,
251 return error; 251 return error;
252} 252}
253 253
254asmlinkage long 254SYSCALL_DEFINE5(setxattr, const char __user *, pathname,
255sys_setxattr(const char __user *pathname, const char __user *name, 255 const char __user *, name, const void __user *, value,
256 const void __user *value, size_t size, int flags) 256 size_t, size, int, flags)
257{ 257{
258 struct path path; 258 struct path path;
259 int error; 259 int error;
@@ -270,9 +270,9 @@ sys_setxattr(const char __user *pathname, const char __user *name,
270 return error; 270 return error;
271} 271}
272 272
273asmlinkage long 273SYSCALL_DEFINE5(lsetxattr, const char __user *, pathname,
274sys_lsetxattr(const char __user *pathname, const char __user *name, 274 const char __user *, name, const void __user *, value,
275 const void __user *value, size_t size, int flags) 275 size_t, size, int, flags)
276{ 276{
277 struct path path; 277 struct path path;
278 int error; 278 int error;
@@ -289,9 +289,8 @@ sys_lsetxattr(const char __user *pathname, const char __user *name,
289 return error; 289 return error;
290} 290}
291 291
292asmlinkage long 292SYSCALL_DEFINE5(fsetxattr, int, fd, const char __user *, name,
293sys_fsetxattr(int fd, const char __user *name, const void __user *value, 293 const void __user *,value, size_t, size, int, flags)
294 size_t size, int flags)
295{ 294{
296 struct file *f; 295 struct file *f;
297 struct dentry *dentry; 296 struct dentry *dentry;
@@ -349,9 +348,8 @@ getxattr(struct dentry *d, const char __user *name, void __user *value,
349 return error; 348 return error;
350} 349}
351 350
352asmlinkage ssize_t 351SYSCALL_DEFINE4(getxattr, const char __user *, pathname,
353sys_getxattr(const char __user *pathname, const char __user *name, 352 const char __user *, name, void __user *, value, size_t, size)
354 void __user *value, size_t size)
355{ 353{
356 struct path path; 354 struct path path;
357 ssize_t error; 355 ssize_t error;
@@ -364,9 +362,8 @@ sys_getxattr(const char __user *pathname, const char __user *name,
364 return error; 362 return error;
365} 363}
366 364
367asmlinkage ssize_t 365SYSCALL_DEFINE4(lgetxattr, const char __user *, pathname,
368sys_lgetxattr(const char __user *pathname, const char __user *name, void __user *value, 366 const char __user *, name, void __user *, value, size_t, size)
369 size_t size)
370{ 367{
371 struct path path; 368 struct path path;
372 ssize_t error; 369 ssize_t error;
@@ -379,8 +376,8 @@ sys_lgetxattr(const char __user *pathname, const char __user *name, void __user
379 return error; 376 return error;
380} 377}
381 378
382asmlinkage ssize_t 379SYSCALL_DEFINE4(fgetxattr, int, fd, const char __user *, name,
383sys_fgetxattr(int fd, const char __user *name, void __user *value, size_t size) 380 void __user *, value, size_t, size)
384{ 381{
385 struct file *f; 382 struct file *f;
386 ssize_t error = -EBADF; 383 ssize_t error = -EBADF;
@@ -424,8 +421,8 @@ listxattr(struct dentry *d, char __user *list, size_t size)
424 return error; 421 return error;
425} 422}
426 423
427asmlinkage ssize_t 424SYSCALL_DEFINE3(listxattr, const char __user *, pathname, char __user *, list,
428sys_listxattr(const char __user *pathname, char __user *list, size_t size) 425 size_t, size)
429{ 426{
430 struct path path; 427 struct path path;
431 ssize_t error; 428 ssize_t error;
@@ -438,8 +435,8 @@ sys_listxattr(const char __user *pathname, char __user *list, size_t size)
438 return error; 435 return error;
439} 436}
440 437
441asmlinkage ssize_t 438SYSCALL_DEFINE3(llistxattr, const char __user *, pathname, char __user *, list,
442sys_llistxattr(const char __user *pathname, char __user *list, size_t size) 439 size_t, size)
443{ 440{
444 struct path path; 441 struct path path;
445 ssize_t error; 442 ssize_t error;
@@ -452,8 +449,7 @@ sys_llistxattr(const char __user *pathname, char __user *list, size_t size)
452 return error; 449 return error;
453} 450}
454 451
455asmlinkage ssize_t 452SYSCALL_DEFINE3(flistxattr, int, fd, char __user *, list, size_t, size)
456sys_flistxattr(int fd, char __user *list, size_t size)
457{ 453{
458 struct file *f; 454 struct file *f;
459 ssize_t error = -EBADF; 455 ssize_t error = -EBADF;
@@ -485,8 +481,8 @@ removexattr(struct dentry *d, const char __user *name)
485 return vfs_removexattr(d, kname); 481 return vfs_removexattr(d, kname);
486} 482}
487 483
488asmlinkage long 484SYSCALL_DEFINE2(removexattr, const char __user *, pathname,
489sys_removexattr(const char __user *pathname, const char __user *name) 485 const char __user *, name)
490{ 486{
491 struct path path; 487 struct path path;
492 int error; 488 int error;
@@ -503,8 +499,8 @@ sys_removexattr(const char __user *pathname, const char __user *name)
503 return error; 499 return error;
504} 500}
505 501
506asmlinkage long 502SYSCALL_DEFINE2(lremovexattr, const char __user *, pathname,
507sys_lremovexattr(const char __user *pathname, const char __user *name) 503 const char __user *, name)
508{ 504{
509 struct path path; 505 struct path path;
510 int error; 506 int error;
@@ -521,8 +517,7 @@ sys_lremovexattr(const char __user *pathname, const char __user *name)
521 return error; 517 return error;
522} 518}
523 519
524asmlinkage long 520SYSCALL_DEFINE2(fremovexattr, int, fd, const char __user *, name)
525sys_fremovexattr(int fd, const char __user *name)
526{ 521{
527 struct file *f; 522 struct file *f;
528 struct dentry *dentry; 523 struct dentry *dentry;