summaryrefslogtreecommitdiffstats
path: root/fs/read_write.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/read_write.c')
-rw-r--r--fs/read_write.c50
1 files changed, 25 insertions, 25 deletions
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