summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-07-06 12:58:37 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-08-31 17:32:38 -0400
commitddef7ed2b5cbafae692d1d580bb5a07808926a9c (patch)
treeb9cc72697712852cb7ef2c27bb1de6d126c2d61f
parent4f59c718521a0f00b6589da6b8fcea2dc296026d (diff)
annotate RWF_... flags
[AV: added missing annotations in syscalls.h/compat.h] Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/nfsd/vfs.c2
-rw-r--r--fs/read_write.c50
-rw-r--r--include/linux/compat.h16
-rw-r--r--include/linux/fs.h12
-rw-r--r--include/linux/syscalls.h4
-rw-r--r--include/uapi/linux/aio_abi.h21
-rw-r--r--include/uapi/linux/fs.h28
7 files changed, 80 insertions, 53 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 38d0383dc7f9..bc69d40c4e8b 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -969,7 +969,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
969 int use_wgather; 969 int use_wgather;
970 loff_t pos = offset; 970 loff_t pos = offset;
971 unsigned int pflags = current->flags; 971 unsigned int pflags = current->flags;
972 int flags = 0; 972 rwf_t flags = 0;
973 973
974 if (test_bit(RQ_LOCAL, &rqstp->rq_flags)) 974 if (test_bit(RQ_LOCAL, &rqstp->rq_flags))
975 /* 975 /*
diff --git a/fs/read_write.c b/fs/read_write.c
index 0cc7033aa413..61b58c7b6531 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -33,7 +33,7 @@ const struct file_operations generic_ro_fops = {
33 33
34EXPORT_SYMBOL(generic_ro_fops); 34EXPORT_SYMBOL(generic_ro_fops);
35 35
36static inline int unsigned_offsets(struct file *file) 36static inline bool unsigned_offsets(struct file *file)
37{ 37{
38 return file->f_mode & FMODE_UNSIGNED_OFFSET; 38 return file->f_mode & FMODE_UNSIGNED_OFFSET;
39} 39}
@@ -633,7 +633,7 @@ unsigned long iov_shorten(struct iovec *iov, unsigned long nr_segs, size_t to)
633EXPORT_SYMBOL(iov_shorten); 633EXPORT_SYMBOL(iov_shorten);
634 634
635static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter, 635static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter,
636 loff_t *ppos, int type, int flags) 636 loff_t *ppos, int type, rwf_t flags)
637{ 637{
638 struct kiocb kiocb; 638 struct kiocb kiocb;
639 ssize_t ret; 639 ssize_t ret;
@@ -655,7 +655,7 @@ static ssize_t do_iter_readv_writev(struct file *filp, struct iov_iter *iter,
655 655
656/* Do it by hand, with file-ops */ 656/* Do it by hand, with file-ops */
657static ssize_t do_loop_readv_writev(struct file *filp, struct iov_iter *iter, 657static ssize_t do_loop_readv_writev(struct file *filp, struct iov_iter *iter,
658 loff_t *ppos, int type, int flags) 658 loff_t *ppos, int type, rwf_t flags)
659{ 659{
660 ssize_t ret = 0; 660 ssize_t ret = 0;
661 661
@@ -871,7 +871,7 @@ out:
871#endif 871#endif
872 872
873static ssize_t do_iter_read(struct file *file, struct iov_iter *iter, 873static ssize_t do_iter_read(struct file *file, struct iov_iter *iter,
874 loff_t *pos, int flags) 874 loff_t *pos, rwf_t flags)
875{ 875{
876 size_t tot_len; 876 size_t tot_len;
877 ssize_t ret = 0; 877 ssize_t ret = 0;
@@ -899,7 +899,7 @@ out:
899} 899}
900 900
901ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos, 901ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos,
902 int flags) 902 rwf_t flags)
903{ 903{
904 if (!file->f_op->read_iter) 904 if (!file->f_op->read_iter)
905 return -EINVAL; 905 return -EINVAL;
@@ -908,7 +908,7 @@ ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos,
908EXPORT_SYMBOL(vfs_iter_read); 908EXPORT_SYMBOL(vfs_iter_read);
909 909
910static ssize_t do_iter_write(struct file *file, struct iov_iter *iter, 910static ssize_t do_iter_write(struct file *file, struct iov_iter *iter,
911 loff_t *pos, int flags) 911 loff_t *pos, rwf_t flags)
912{ 912{
913 size_t tot_len; 913 size_t tot_len;
914 ssize_t ret = 0; 914 ssize_t ret = 0;
@@ -935,7 +935,7 @@ static ssize_t do_iter_write(struct file *file, struct iov_iter *iter,
935} 935}
936 936
937ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos, 937ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos,
938 int flags) 938 rwf_t flags)
939{ 939{
940 if (!file->f_op->write_iter) 940 if (!file->f_op->write_iter)
941 return -EINVAL; 941 return -EINVAL;
@@ -944,7 +944,7 @@ ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos,
944EXPORT_SYMBOL(vfs_iter_write); 944EXPORT_SYMBOL(vfs_iter_write);
945 945
946ssize_t vfs_readv(struct file *file, const struct iovec __user *vec, 946ssize_t vfs_readv(struct file *file, const struct iovec __user *vec,
947 unsigned long vlen, loff_t *pos, int flags) 947 unsigned long vlen, loff_t *pos, rwf_t flags)
948{ 948{
949 struct iovec iovstack[UIO_FASTIOV]; 949 struct iovec iovstack[UIO_FASTIOV];
950 struct iovec *iov = iovstack; 950 struct iovec *iov = iovstack;
@@ -962,7 +962,7 @@ ssize_t vfs_readv(struct file *file, const struct iovec __user *vec,
962EXPORT_SYMBOL(vfs_readv); 962EXPORT_SYMBOL(vfs_readv);
963 963
964ssize_t vfs_writev(struct file *file, const struct iovec __user *vec, 964ssize_t vfs_writev(struct file *file, const struct iovec __user *vec,
965 unsigned long vlen, loff_t *pos, int flags) 965 unsigned long vlen, loff_t *pos, rwf_t flags)
966{ 966{
967 struct iovec iovstack[UIO_FASTIOV]; 967 struct iovec iovstack[UIO_FASTIOV];
968 struct iovec *iov = iovstack; 968 struct iovec *iov = iovstack;
@@ -981,7 +981,7 @@ ssize_t vfs_writev(struct file *file, const struct iovec __user *vec,
981EXPORT_SYMBOL(vfs_writev); 981EXPORT_SYMBOL(vfs_writev);
982 982
983static ssize_t do_readv(unsigned long fd, const struct iovec __user *vec, 983static ssize_t do_readv(unsigned long fd, const struct iovec __user *vec,
984 unsigned long vlen, int flags) 984 unsigned long vlen, rwf_t flags)
985{ 985{
986 struct fd f = fdget_pos(fd); 986 struct fd f = fdget_pos(fd);
987 ssize_t ret = -EBADF; 987 ssize_t ret = -EBADF;
@@ -1001,7 +1001,7 @@ static ssize_t do_readv(unsigned long fd, const struct iovec __user *vec,
1001} 1001}
1002 1002
1003static ssize_t do_writev(unsigned long fd, const struct iovec __user *vec, 1003static ssize_t do_writev(unsigned long fd, const struct iovec __user *vec,
1004 unsigned long vlen, int flags) 1004 unsigned long vlen, rwf_t flags)
1005{ 1005{
1006 struct fd f = fdget_pos(fd); 1006 struct fd f = fdget_pos(fd);
1007 ssize_t ret = -EBADF; 1007 ssize_t ret = -EBADF;
@@ -1027,7 +1027,7 @@ static inline loff_t pos_from_hilo(unsigned long high, unsigned long low)
1027} 1027}
1028 1028
1029static ssize_t do_preadv(unsigned long fd, const struct iovec __user *vec, 1029static ssize_t do_preadv(unsigned long fd, const struct iovec __user *vec,
1030 unsigned long vlen, loff_t pos, int flags) 1030 unsigned long vlen, loff_t pos, rwf_t flags)
1031{ 1031{
1032 struct fd f; 1032 struct fd f;
1033 ssize_t ret = -EBADF; 1033 ssize_t ret = -EBADF;
@@ -1050,7 +1050,7 @@ static ssize_t do_preadv(unsigned long fd, const struct iovec __user *vec,
1050} 1050}
1051 1051
1052static ssize_t do_pwritev(unsigned long fd, const struct iovec __user *vec, 1052static ssize_t do_pwritev(unsigned long fd, const struct iovec __user *vec,
1053 unsigned long vlen, loff_t pos, int flags) 1053 unsigned long vlen, loff_t pos, rwf_t flags)
1054{ 1054{
1055 struct fd f; 1055 struct fd f;
1056 ssize_t ret = -EBADF; 1056 ssize_t ret = -EBADF;
@@ -1094,7 +1094,7 @@ SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
1094 1094
1095SYSCALL_DEFINE6(preadv2, unsigned long, fd, const struct iovec __user *, vec, 1095SYSCALL_DEFINE6(preadv2, unsigned long, fd, const struct iovec __user *, vec,
1096 unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h, 1096 unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h,
1097 int, flags) 1097 rwf_t, flags)
1098{ 1098{
1099 loff_t pos = pos_from_hilo(pos_h, pos_l); 1099 loff_t pos = pos_from_hilo(pos_h, pos_l);
1100 1100
@@ -1114,7 +1114,7 @@ SYSCALL_DEFINE5(pwritev, unsigned long, fd, const struct iovec __user *, vec,
1114 1114
1115SYSCALL_DEFINE6(pwritev2, unsigned long, fd, const struct iovec __user *, vec, 1115SYSCALL_DEFINE6(pwritev2, unsigned long, fd, const struct iovec __user *, vec,
1116 unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h, 1116 unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h,
1117 int, flags) 1117 rwf_t, flags)
1118{ 1118{
1119 loff_t pos = pos_from_hilo(pos_h, pos_l); 1119 loff_t pos = pos_from_hilo(pos_h, pos_l);
1120 1120
@@ -1127,7 +1127,7 @@ SYSCALL_DEFINE6(pwritev2, unsigned long, fd, const struct iovec __user *, vec,
1127#ifdef CONFIG_COMPAT 1127#ifdef CONFIG_COMPAT
1128static size_t compat_readv(struct file *file, 1128static size_t compat_readv(struct file *file,
1129 const struct compat_iovec __user *vec, 1129 const struct compat_iovec __user *vec,
1130 unsigned long vlen, loff_t *pos, int flags) 1130 unsigned long vlen, loff_t *pos, rwf_t flags)
1131{ 1131{
1132 struct iovec iovstack[UIO_FASTIOV]; 1132 struct iovec iovstack[UIO_FASTIOV];
1133 struct iovec *iov = iovstack; 1133 struct iovec *iov = iovstack;
@@ -1147,7 +1147,7 @@ static size_t compat_readv(struct file *file,
1147 1147
1148static size_t do_compat_readv(compat_ulong_t fd, 1148static size_t do_compat_readv(compat_ulong_t fd,
1149 const struct compat_iovec __user *vec, 1149 const struct compat_iovec __user *vec,
1150 compat_ulong_t vlen, int flags) 1150 compat_ulong_t vlen, rwf_t flags)
1151{ 1151{
1152 struct fd f = fdget_pos(fd); 1152 struct fd f = fdget_pos(fd);
1153 ssize_t ret; 1153 ssize_t ret;
@@ -1173,7 +1173,7 @@ COMPAT_SYSCALL_DEFINE3(readv, compat_ulong_t, fd,
1173 1173
1174static long do_compat_preadv64(unsigned long fd, 1174static long do_compat_preadv64(unsigned long fd,
1175 const struct compat_iovec __user *vec, 1175 const struct compat_iovec __user *vec,
1176 unsigned long vlen, loff_t pos, int flags) 1176 unsigned long vlen, loff_t pos, rwf_t flags)
1177{ 1177{
1178 struct fd f; 1178 struct fd f;
1179 ssize_t ret; 1179 ssize_t ret;
@@ -1211,7 +1211,7 @@ COMPAT_SYSCALL_DEFINE5(preadv, compat_ulong_t, fd,
1211#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64V2 1211#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64V2
1212COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd, 1212COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
1213 const struct compat_iovec __user *,vec, 1213 const struct compat_iovec __user *,vec,
1214 unsigned long, vlen, loff_t, pos, int, flags) 1214 unsigned long, vlen, loff_t, pos, rwf_t, flags)
1215{ 1215{
1216 return do_compat_preadv64(fd, vec, vlen, pos, flags); 1216 return do_compat_preadv64(fd, vec, vlen, pos, flags);
1217} 1217}
@@ -1220,7 +1220,7 @@ COMPAT_SYSCALL_DEFINE5(preadv64v2, unsigned long, fd,
1220COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd, 1220COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
1221 const struct compat_iovec __user *,vec, 1221 const struct compat_iovec __user *,vec,
1222 compat_ulong_t, vlen, u32, pos_low, u32, pos_high, 1222 compat_ulong_t, vlen, u32, pos_low, u32, pos_high,
1223 int, flags) 1223 rwf_t, flags)
1224{ 1224{
1225 loff_t pos = ((loff_t)pos_high << 32) | pos_low; 1225 loff_t pos = ((loff_t)pos_high << 32) | pos_low;
1226 1226
@@ -1232,7 +1232,7 @@ COMPAT_SYSCALL_DEFINE6(preadv2, compat_ulong_t, fd,
1232 1232
1233static size_t compat_writev(struct file *file, 1233static size_t compat_writev(struct file *file,
1234 const struct compat_iovec __user *vec, 1234 const struct compat_iovec __user *vec,
1235 unsigned long vlen, loff_t *pos, int flags) 1235 unsigned long vlen, loff_t *pos, rwf_t flags)
1236{ 1236{
1237 struct iovec iovstack[UIO_FASTIOV]; 1237 struct iovec iovstack[UIO_FASTIOV];
1238 struct iovec *iov = iovstack; 1238 struct iovec *iov = iovstack;
@@ -1254,7 +1254,7 @@ static size_t compat_writev(struct file *file,
1254 1254
1255static size_t do_compat_writev(compat_ulong_t fd, 1255static size_t do_compat_writev(compat_ulong_t fd,
1256 const struct compat_iovec __user* vec, 1256 const struct compat_iovec __user* vec,
1257 compat_ulong_t vlen, int flags) 1257 compat_ulong_t vlen, rwf_t flags)
1258{ 1258{
1259 struct fd f = fdget_pos(fd); 1259 struct fd f = fdget_pos(fd);
1260 ssize_t ret; 1260 ssize_t ret;
@@ -1279,7 +1279,7 @@ COMPAT_SYSCALL_DEFINE3(writev, compat_ulong_t, fd,
1279 1279
1280static long do_compat_pwritev64(unsigned long fd, 1280static long do_compat_pwritev64(unsigned long fd,
1281 const struct compat_iovec __user *vec, 1281 const struct compat_iovec __user *vec,
1282 unsigned long vlen, loff_t pos, int flags) 1282 unsigned long vlen, loff_t pos, rwf_t flags)
1283{ 1283{
1284 struct fd f; 1284 struct fd f;
1285 ssize_t ret; 1285 ssize_t ret;
@@ -1317,7 +1317,7 @@ COMPAT_SYSCALL_DEFINE5(pwritev, compat_ulong_t, fd,
1317#ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64V2 1317#ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64V2
1318COMPAT_SYSCALL_DEFINE5(pwritev64v2, unsigned long, fd, 1318COMPAT_SYSCALL_DEFINE5(pwritev64v2, unsigned long, fd,
1319 const struct compat_iovec __user *,vec, 1319 const struct compat_iovec __user *,vec,
1320 unsigned long, vlen, loff_t, pos, int, flags) 1320 unsigned long, vlen, loff_t, pos, rwf_t, flags)
1321{ 1321{
1322 return do_compat_pwritev64(fd, vec, vlen, pos, flags); 1322 return do_compat_pwritev64(fd, vec, vlen, pos, flags);
1323} 1323}
@@ -1325,7 +1325,7 @@ COMPAT_SYSCALL_DEFINE5(pwritev64v2, unsigned long, fd,
1325 1325
1326COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd, 1326COMPAT_SYSCALL_DEFINE6(pwritev2, compat_ulong_t, fd,
1327 const struct compat_iovec __user *,vec, 1327 const struct compat_iovec __user *,vec,
1328 compat_ulong_t, vlen, u32, pos_low, u32, pos_high, int, flags) 1328 compat_ulong_t, vlen, u32, pos_low, u32, pos_high, rwf_t, flags)
1329{ 1329{
1330 loff_t pos = ((loff_t)pos_high << 32) | pos_low; 1330 loff_t pos = ((loff_t)pos_high << 32) | pos_low;
1331 1331
diff --git a/include/linux/compat.h b/include/linux/compat.h
index e5d3fbe24f7d..3fc433303d7a 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -365,10 +365,10 @@ asmlinkage ssize_t compat_sys_pwritev(compat_ulong_t fd,
365 compat_ulong_t vlen, u32 pos_low, u32 pos_high); 365 compat_ulong_t vlen, u32 pos_low, u32 pos_high);
366asmlinkage ssize_t compat_sys_preadv2(compat_ulong_t fd, 366asmlinkage ssize_t compat_sys_preadv2(compat_ulong_t fd,
367 const struct compat_iovec __user *vec, 367 const struct compat_iovec __user *vec,
368 compat_ulong_t vlen, u32 pos_low, u32 pos_high, int flags); 368 compat_ulong_t vlen, u32 pos_low, u32 pos_high, rwf_t flags);
369asmlinkage ssize_t compat_sys_pwritev2(compat_ulong_t fd, 369asmlinkage ssize_t compat_sys_pwritev2(compat_ulong_t fd,
370 const struct compat_iovec __user *vec, 370 const struct compat_iovec __user *vec,
371 compat_ulong_t vlen, u32 pos_low, u32 pos_high, int flags); 371 compat_ulong_t vlen, u32 pos_low, u32 pos_high, rwf_t flags);
372 372
373#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64 373#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64
374asmlinkage long compat_sys_preadv64(unsigned long fd, 374asmlinkage long compat_sys_preadv64(unsigned long fd,
@@ -382,6 +382,18 @@ asmlinkage long compat_sys_pwritev64(unsigned long fd,
382 unsigned long vlen, loff_t pos); 382 unsigned long vlen, loff_t pos);
383#endif 383#endif
384 384
385#ifdef __ARCH_WANT_COMPAT_SYS_PREADV64V2
386asmlinkage long compat_sys_readv64v2(unsigned long fd,
387 const struct compat_iovec __user *vec,
388 unsigned long vlen, loff_t pos, rwf_t flags);
389#endif
390
391#ifdef __ARCH_WANT_COMPAT_SYS_PWRITEV64V2
392asmlinkage long compat_sys_pwritev64v2(unsigned long fd,
393 const struct compat_iovec __user *vec,
394 unsigned long vlen, loff_t pos, rwf_t flags);
395#endif
396
385asmlinkage long compat_sys_lseek(unsigned int, compat_off_t, unsigned int); 397asmlinkage long compat_sys_lseek(unsigned int, compat_off_t, unsigned int);
386 398
387asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv, 399asmlinkage long compat_sys_execve(const char __user *filename, const compat_uptr_t __user *argv,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index cbfe127bccf8..2625fc47c7e5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -72,6 +72,8 @@ extern int leases_enable, lease_break_time;
72extern int sysctl_protected_symlinks; 72extern int sysctl_protected_symlinks;
73extern int sysctl_protected_hardlinks; 73extern int sysctl_protected_hardlinks;
74 74
75typedef __kernel_rwf_t rwf_t;
76
75struct buffer_head; 77struct buffer_head;
76typedef int (get_block_t)(struct inode *inode, sector_t iblock, 78typedef int (get_block_t)(struct inode *inode, sector_t iblock,
77 struct buffer_head *bh_result, int create); 79 struct buffer_head *bh_result, int create);
@@ -1758,9 +1760,9 @@ extern ssize_t __vfs_write(struct file *, const char __user *, size_t, loff_t *)
1758extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *); 1760extern ssize_t vfs_read(struct file *, char __user *, size_t, loff_t *);
1759extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *); 1761extern ssize_t vfs_write(struct file *, const char __user *, size_t, loff_t *);
1760extern ssize_t vfs_readv(struct file *, const struct iovec __user *, 1762extern ssize_t vfs_readv(struct file *, const struct iovec __user *,
1761 unsigned long, loff_t *, int); 1763 unsigned long, loff_t *, rwf_t);
1762extern ssize_t vfs_writev(struct file *, const struct iovec __user *, 1764extern ssize_t vfs_writev(struct file *, const struct iovec __user *,
1763 unsigned long, loff_t *, int); 1765 unsigned long, loff_t *, rwf_t);
1764extern ssize_t vfs_copy_file_range(struct file *, loff_t , struct file *, 1766extern ssize_t vfs_copy_file_range(struct file *, loff_t , struct file *,
1765 loff_t, size_t, unsigned int); 1767 loff_t, size_t, unsigned int);
1766extern int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in, 1768extern int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,
@@ -2874,9 +2876,9 @@ extern ssize_t generic_file_direct_write(struct kiocb *, struct iov_iter *);
2874extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t); 2876extern ssize_t generic_perform_write(struct file *, struct iov_iter *, loff_t);
2875 2877
2876ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos, 2878ssize_t vfs_iter_read(struct file *file, struct iov_iter *iter, loff_t *ppos,
2877 int flags); 2879 rwf_t flags);
2878ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos, 2880ssize_t vfs_iter_write(struct file *file, struct iov_iter *iter, loff_t *ppos,
2879 int flags); 2881 rwf_t flags);
2880 2882
2881/* fs/block_dev.c */ 2883/* fs/block_dev.c */
2882extern ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to); 2884extern ssize_t blkdev_read_iter(struct kiocb *iocb, struct iov_iter *to);
@@ -3143,7 +3145,7 @@ static inline int iocb_flags(struct file *file)
3143 return res; 3145 return res;
3144} 3146}
3145 3147
3146static inline int kiocb_set_rw_flags(struct kiocb *ki, int flags) 3148static inline int kiocb_set_rw_flags(struct kiocb *ki, rwf_t flags)
3147{ 3149{
3148 if (unlikely(flags & ~RWF_SUPPORTED)) 3150 if (unlikely(flags & ~RWF_SUPPORTED))
3149 return -EOPNOTSUPP; 3151 return -EOPNOTSUPP;
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 0bc1d2e8cc17..138c94535864 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -579,12 +579,12 @@ asmlinkage long sys_preadv(unsigned long fd, const struct iovec __user *vec,
579 unsigned long vlen, unsigned long pos_l, unsigned long pos_h); 579 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
580asmlinkage long sys_preadv2(unsigned long fd, const struct iovec __user *vec, 580asmlinkage long sys_preadv2(unsigned long fd, const struct iovec __user *vec,
581 unsigned long vlen, unsigned long pos_l, unsigned long pos_h, 581 unsigned long vlen, unsigned long pos_l, unsigned long pos_h,
582 int flags); 582 rwf_t flags);
583asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec, 583asmlinkage long sys_pwritev(unsigned long fd, const struct iovec __user *vec,
584 unsigned long vlen, unsigned long pos_l, unsigned long pos_h); 584 unsigned long vlen, unsigned long pos_l, unsigned long pos_h);
585asmlinkage long sys_pwritev2(unsigned long fd, const struct iovec __user *vec, 585asmlinkage long sys_pwritev2(unsigned long fd, const struct iovec __user *vec,
586 unsigned long vlen, unsigned long pos_l, unsigned long pos_h, 586 unsigned long vlen, unsigned long pos_l, unsigned long pos_h,
587 int flags); 587 rwf_t flags);
588asmlinkage long sys_getcwd(char __user *buf, unsigned long size); 588asmlinkage long sys_getcwd(char __user *buf, unsigned long size);
589asmlinkage long sys_mkdir(const char __user *pathname, umode_t mode); 589asmlinkage long sys_mkdir(const char __user *pathname, umode_t mode);
590asmlinkage long sys_chdir(const char __user *filename); 590asmlinkage long sys_chdir(const char __user *filename);
diff --git a/include/uapi/linux/aio_abi.h b/include/uapi/linux/aio_abi.h
index a2d4a8ac94ca..a04adbc70ddf 100644
--- a/include/uapi/linux/aio_abi.h
+++ b/include/uapi/linux/aio_abi.h
@@ -28,6 +28,7 @@
28#define __LINUX__AIO_ABI_H 28#define __LINUX__AIO_ABI_H
29 29
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/fs.h>
31#include <asm/byteorder.h> 32#include <asm/byteorder.h>
32 33
33typedef __kernel_ulong_t aio_context_t; 34typedef __kernel_ulong_t aio_context_t;
@@ -62,14 +63,6 @@ struct io_event {
62 __s64 res2; /* secondary result */ 63 __s64 res2; /* secondary result */
63}; 64};
64 65
65#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
66#define PADDED(x,y) x, y
67#elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
68#define PADDED(x,y) y, x
69#else
70#error edit for your odd byteorder.
71#endif
72
73/* 66/*
74 * we always use a 64bit off_t when communicating 67 * we always use a 64bit off_t when communicating
75 * with userland. its up to libraries to do the 68 * with userland. its up to libraries to do the
@@ -79,8 +72,16 @@ struct io_event {
79struct iocb { 72struct iocb {
80 /* these are internal to the kernel/libc. */ 73 /* these are internal to the kernel/libc. */
81 __u64 aio_data; /* data to be returned in event's data */ 74 __u64 aio_data; /* data to be returned in event's data */
82 __u32 PADDED(aio_key, aio_rw_flags); 75
83 /* the kernel sets aio_key to the req # */ 76#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
77 __u32 aio_key; /* the kernel sets aio_key to the req # */
78 __kernel_rwf_t aio_rw_flags; /* RWF_* flags */
79#elif defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
80 __kernel_rwf_t aio_rw_flags; /* RWF_* flags */
81 __u32 aio_key; /* the kernel sets aio_key to the req # */
82#else
83#error edit for your odd byteorder.
84#endif
84 85
85 /* common fields */ 86 /* common fields */
86 __u16 aio_lio_opcode; /* see IOCB_CMD_ above */ 87 __u16 aio_lio_opcode; /* see IOCB_CMD_ above */
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index b7495d05e8de..56235dddea7d 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -358,13 +358,25 @@ struct fscrypt_key {
358#define SYNC_FILE_RANGE_WRITE 2 358#define SYNC_FILE_RANGE_WRITE 2
359#define SYNC_FILE_RANGE_WAIT_AFTER 4 359#define SYNC_FILE_RANGE_WAIT_AFTER 4
360 360
361/* flags for preadv2/pwritev2: */ 361/*
362#define RWF_HIPRI 0x00000001 /* high priority request, poll if possible */ 362 * Flags for preadv2/pwritev2:
363#define RWF_DSYNC 0x00000002 /* per-IO O_DSYNC */ 363 */
364#define RWF_SYNC 0x00000004 /* per-IO O_SYNC */ 364
365#define RWF_NOWAIT 0x00000008 /* per-IO, return -EAGAIN if operation would block */ 365typedef int __bitwise __kernel_rwf_t;
366 366
367#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC |\ 367/* high priority request, poll if possible */
368 RWF_NOWAIT) 368#define RWF_HIPRI ((__force __kernel_rwf_t)0x00000001)
369
370/* per-IO O_DSYNC */
371#define RWF_DSYNC ((__force __kernel_rwf_t)0x00000002)
372
373/* per-IO O_SYNC */
374#define RWF_SYNC ((__force __kernel_rwf_t)0x00000004)
375
376/* per-IO, return -EAGAIN if operation would block */
377#define RWF_NOWAIT ((__force __kernel_rwf_t)0x00000008)
378
379/* mask of flags supported by the kernel */
380#define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT)
369 381
370#endif /* _UAPI_LINUX_FS_H */ 382#endif /* _UAPI_LINUX_FS_H */