Commit ee0b3e671baff681d69fbf0db33b47603c0a8280
Committed by
Linus Torvalds
1 parent
027445c372
Exists in
master
and in
7 other branches
[PATCH] Remove readv/writev methods and use aio_read/aio_write instead
This patch removes readv() and writev() methods and replaces them with aio_read()/aio_write() methods. Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Showing 21 changed files with 154 additions and 388 deletions Side-by-side Diff
- drivers/char/raw.c
- drivers/net/tun.c
- fs/bad_inode.c
- fs/block_dev.c
- fs/cifs/cifsfs.c
- fs/compat.c
- fs/ext2/file.c
- fs/ext3/file.c
- fs/fat/file.c
- fs/fuse/dev.c
- fs/hostfs/hostfs_kern.c
- fs/jfs/file.c
- fs/ntfs/file.c
- fs/pipe.c
- fs/read_write.c
- fs/read_write.h
- fs/xfs/linux-2.6/xfs_file.c
- include/linux/fs.h
- mm/filemap.c
- net/socket.c
- sound/core/pcm_native.c
drivers/char/raw.c
drivers/net/tun.c
... | ... | @@ -288,11 +288,10 @@ |
288 | 288 | return len; |
289 | 289 | } |
290 | 290 | |
291 | -/* Writev */ | |
292 | -static ssize_t tun_chr_writev(struct file * file, const struct iovec *iv, | |
293 | - unsigned long count, loff_t *pos) | |
291 | +static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv, | |
292 | + unsigned long count, loff_t pos) | |
294 | 293 | { |
295 | - struct tun_struct *tun = file->private_data; | |
294 | + struct tun_struct *tun = iocb->ki_filp->private_data; | |
296 | 295 | |
297 | 296 | if (!tun) |
298 | 297 | return -EBADFD; |
... | ... | @@ -302,14 +301,6 @@ |
302 | 301 | return tun_get_user(tun, (struct iovec *) iv, iov_total(iv, count)); |
303 | 302 | } |
304 | 303 | |
305 | -/* Write */ | |
306 | -static ssize_t tun_chr_write(struct file * file, const char __user * buf, | |
307 | - size_t count, loff_t *pos) | |
308 | -{ | |
309 | - struct iovec iv = { (void __user *) buf, count }; | |
310 | - return tun_chr_writev(file, &iv, 1, pos); | |
311 | -} | |
312 | - | |
313 | 304 | /* Put packet to the user space buffer */ |
314 | 305 | static __inline__ ssize_t tun_put_user(struct tun_struct *tun, |
315 | 306 | struct sk_buff *skb, |
316 | 307 | |
... | ... | @@ -343,10 +334,10 @@ |
343 | 334 | return total; |
344 | 335 | } |
345 | 336 | |
346 | -/* Readv */ | |
347 | -static ssize_t tun_chr_readv(struct file *file, const struct iovec *iv, | |
348 | - unsigned long count, loff_t *pos) | |
337 | +static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv, | |
338 | + unsigned long count, loff_t pos) | |
349 | 339 | { |
340 | + struct file *file = iocb->ki_filp; | |
350 | 341 | struct tun_struct *tun = file->private_data; |
351 | 342 | DECLARE_WAITQUEUE(wait, current); |
352 | 343 | struct sk_buff *skb; |
... | ... | @@ -426,14 +417,6 @@ |
426 | 417 | return ret; |
427 | 418 | } |
428 | 419 | |
429 | -/* Read */ | |
430 | -static ssize_t tun_chr_read(struct file * file, char __user * buf, | |
431 | - size_t count, loff_t *pos) | |
432 | -{ | |
433 | - struct iovec iv = { buf, count }; | |
434 | - return tun_chr_readv(file, &iv, 1, pos); | |
435 | -} | |
436 | - | |
437 | 420 | static void tun_setup(struct net_device *dev) |
438 | 421 | { |
439 | 422 | struct tun_struct *tun = netdev_priv(dev); |
... | ... | @@ -764,10 +747,10 @@ |
764 | 747 | static struct file_operations tun_fops = { |
765 | 748 | .owner = THIS_MODULE, |
766 | 749 | .llseek = no_llseek, |
767 | - .read = tun_chr_read, | |
768 | - .readv = tun_chr_readv, | |
769 | - .write = tun_chr_write, | |
770 | - .writev = tun_chr_writev, | |
750 | + .read = do_sync_read, | |
751 | + .aio_read = tun_chr_aio_read, | |
752 | + .write = do_sync_write, | |
753 | + .aio_write = tun_chr_aio_write, | |
771 | 754 | .poll = tun_chr_poll, |
772 | 755 | .ioctl = tun_chr_ioctl, |
773 | 756 | .open = tun_chr_open, |
fs/bad_inode.c
fs/block_dev.c
... | ... | @@ -1191,8 +1191,6 @@ |
1191 | 1191 | #ifdef CONFIG_COMPAT |
1192 | 1192 | .compat_ioctl = compat_blkdev_ioctl, |
1193 | 1193 | #endif |
1194 | - .readv = generic_file_readv, | |
1195 | - .writev = generic_file_write_nolock, | |
1196 | 1194 | .sendfile = generic_file_sendfile, |
1197 | 1195 | .splice_read = generic_file_splice_read, |
1198 | 1196 | .splice_write = generic_file_splice_write, |
fs/cifs/cifsfs.c
... | ... | @@ -480,18 +480,6 @@ |
480 | 480 | return simple_set_mnt(mnt, sb); |
481 | 481 | } |
482 | 482 | |
483 | -static ssize_t cifs_file_writev(struct file *file, const struct iovec *iov, | |
484 | - unsigned long nr_segs, loff_t *ppos) | |
485 | -{ | |
486 | - struct inode *inode = file->f_dentry->d_inode; | |
487 | - ssize_t written; | |
488 | - | |
489 | - written = generic_file_writev(file, iov, nr_segs, ppos); | |
490 | - if (!CIFS_I(inode)->clientCanCacheAll) | |
491 | - filemap_fdatawrite(inode->i_mapping); | |
492 | - return written; | |
493 | -} | |
494 | - | |
495 | 483 | static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, |
496 | 484 | unsigned long nr_segs, loff_t pos) |
497 | 485 | { |
... | ... | @@ -577,8 +565,6 @@ |
577 | 565 | const struct file_operations cifs_file_ops = { |
578 | 566 | .read = do_sync_read, |
579 | 567 | .write = do_sync_write, |
580 | - .readv = generic_file_readv, | |
581 | - .writev = cifs_file_writev, | |
582 | 568 | .aio_read = generic_file_aio_read, |
583 | 569 | .aio_write = cifs_file_aio_write, |
584 | 570 | .open = cifs_open, |
... | ... | @@ -620,8 +606,6 @@ |
620 | 606 | const struct file_operations cifs_file_nobrl_ops = { |
621 | 607 | .read = do_sync_read, |
622 | 608 | .write = do_sync_write, |
623 | - .readv = generic_file_readv, | |
624 | - .writev = cifs_file_writev, | |
625 | 609 | .aio_read = generic_file_aio_read, |
626 | 610 | .aio_write = cifs_file_aio_write, |
627 | 611 | .open = cifs_open, |
fs/compat.c
... | ... | @@ -70,6 +70,8 @@ |
70 | 70 | return ret; |
71 | 71 | } |
72 | 72 | |
73 | +#include "read_write.h" | |
74 | + | |
73 | 75 | /* |
74 | 76 | * Not all architectures have sys_utime, so implement this in terms |
75 | 77 | * of sys_utimes. |
... | ... | @@ -1149,9 +1151,6 @@ |
1149 | 1151 | const struct compat_iovec __user *uvector, |
1150 | 1152 | unsigned long nr_segs, loff_t *pos) |
1151 | 1153 | { |
1152 | - typedef ssize_t (*io_fn_t)(struct file *, char __user *, size_t, loff_t *); | |
1153 | - typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long, loff_t *); | |
1154 | - | |
1155 | 1154 | compat_ssize_t tot_len; |
1156 | 1155 | struct iovec iovstack[UIO_FASTIOV]; |
1157 | 1156 | struct iovec *iov=iovstack, *vector; |
1158 | 1157 | |
1159 | 1158 | |
1160 | 1159 | |
1161 | 1160 | |
... | ... | @@ -1234,39 +1233,18 @@ |
1234 | 1233 | fnv = NULL; |
1235 | 1234 | if (type == READ) { |
1236 | 1235 | fn = file->f_op->read; |
1237 | - fnv = file->f_op->readv; | |
1236 | + fnv = file->f_op->aio_read; | |
1238 | 1237 | } else { |
1239 | 1238 | fn = (io_fn_t)file->f_op->write; |
1240 | - fnv = file->f_op->writev; | |
1239 | + fnv = file->f_op->aio_write; | |
1241 | 1240 | } |
1242 | - if (fnv) { | |
1243 | - ret = fnv(file, iov, nr_segs, pos); | |
1244 | - goto out; | |
1245 | - } | |
1246 | 1241 | |
1247 | - /* Do it by hand, with file-ops */ | |
1248 | - ret = 0; | |
1249 | - vector = iov; | |
1250 | - while (nr_segs > 0) { | |
1251 | - void __user * base; | |
1252 | - size_t len; | |
1253 | - ssize_t nr; | |
1242 | + if (fnv) | |
1243 | + ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, | |
1244 | + pos, fnv); | |
1245 | + else | |
1246 | + ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); | |
1254 | 1247 | |
1255 | - base = vector->iov_base; | |
1256 | - len = vector->iov_len; | |
1257 | - vector++; | |
1258 | - nr_segs--; | |
1259 | - | |
1260 | - nr = fn(file, base, len, pos); | |
1261 | - | |
1262 | - if (nr < 0) { | |
1263 | - if (!ret) ret = nr; | |
1264 | - break; | |
1265 | - } | |
1266 | - ret += nr; | |
1267 | - if (nr != len) | |
1268 | - break; | |
1269 | - } | |
1270 | 1248 | out: |
1271 | 1249 | if (iov != iovstack) |
1272 | 1250 | kfree(iov); |
... | ... | @@ -1294,7 +1272,7 @@ |
1294 | 1272 | goto out; |
1295 | 1273 | |
1296 | 1274 | ret = -EINVAL; |
1297 | - if (!file->f_op || (!file->f_op->readv && !file->f_op->read)) | |
1275 | + if (!file->f_op || (!file->f_op->aio_read && !file->f_op->read)) | |
1298 | 1276 | goto out; |
1299 | 1277 | |
1300 | 1278 | ret = compat_do_readv_writev(READ, file, vec, vlen, &file->f_pos); |
... | ... | @@ -1317,7 +1295,7 @@ |
1317 | 1295 | goto out; |
1318 | 1296 | |
1319 | 1297 | ret = -EINVAL; |
1320 | - if (!file->f_op || (!file->f_op->writev && !file->f_op->write)) | |
1298 | + if (!file->f_op || (!file->f_op->aio_write && !file->f_op->write)) | |
1321 | 1299 | goto out; |
1322 | 1300 | |
1323 | 1301 | ret = compat_do_readv_writev(WRITE, file, vec, vlen, &file->f_pos); |
fs/ext2/file.c
... | ... | @@ -53,8 +53,6 @@ |
53 | 53 | .open = generic_file_open, |
54 | 54 | .release = ext2_release_file, |
55 | 55 | .fsync = ext2_sync_file, |
56 | - .readv = generic_file_readv, | |
57 | - .writev = generic_file_writev, | |
58 | 56 | .sendfile = generic_file_sendfile, |
59 | 57 | .splice_read = generic_file_splice_read, |
60 | 58 | .splice_write = generic_file_splice_write, |
fs/ext3/file.c
... | ... | @@ -112,8 +112,6 @@ |
112 | 112 | .write = do_sync_write, |
113 | 113 | .aio_read = generic_file_aio_read, |
114 | 114 | .aio_write = ext3_file_write, |
115 | - .readv = generic_file_readv, | |
116 | - .writev = generic_file_writev, | |
117 | 115 | .ioctl = ext3_ioctl, |
118 | 116 | #ifdef CONFIG_COMPAT |
119 | 117 | .compat_ioctl = ext3_compat_ioctl, |
fs/fat/file.c
... | ... | @@ -127,8 +127,6 @@ |
127 | 127 | .llseek = generic_file_llseek, |
128 | 128 | .read = do_sync_read, |
129 | 129 | .write = do_sync_write, |
130 | - .readv = generic_file_readv, | |
131 | - .writev = generic_file_writev, | |
132 | 130 | .aio_read = generic_file_aio_read, |
133 | 131 | .aio_write = generic_file_aio_write, |
134 | 132 | .mmap = generic_file_mmap, |
fs/fuse/dev.c
... | ... | @@ -680,14 +680,15 @@ |
680 | 680 | * request_end(). Otherwise add it to the processing list, and set |
681 | 681 | * the 'sent' flag. |
682 | 682 | */ |
683 | -static ssize_t fuse_dev_readv(struct file *file, const struct iovec *iov, | |
684 | - unsigned long nr_segs, loff_t *off) | |
683 | +static ssize_t fuse_dev_read(struct kiocb *iocb, const struct iovec *iov, | |
684 | + unsigned long nr_segs, loff_t pos) | |
685 | 685 | { |
686 | 686 | int err; |
687 | 687 | struct fuse_req *req; |
688 | 688 | struct fuse_in *in; |
689 | 689 | struct fuse_copy_state cs; |
690 | 690 | unsigned reqsize; |
691 | + struct file *file = iocb->ki_filp; | |
691 | 692 | struct fuse_conn *fc = fuse_get_conn(file); |
692 | 693 | if (!fc) |
693 | 694 | return -EPERM; |
... | ... | @@ -761,15 +762,6 @@ |
761 | 762 | return err; |
762 | 763 | } |
763 | 764 | |
764 | -static ssize_t fuse_dev_read(struct file *file, char __user *buf, | |
765 | - size_t nbytes, loff_t *off) | |
766 | -{ | |
767 | - struct iovec iov; | |
768 | - iov.iov_len = nbytes; | |
769 | - iov.iov_base = buf; | |
770 | - return fuse_dev_readv(file, &iov, 1, off); | |
771 | -} | |
772 | - | |
773 | 765 | /* Look up request on processing list by unique ID */ |
774 | 766 | static struct fuse_req *request_find(struct fuse_conn *fc, u64 unique) |
775 | 767 | { |
776 | 768 | |
... | ... | @@ -814,15 +806,15 @@ |
814 | 806 | * it from the list and copy the rest of the buffer to the request. |
815 | 807 | * The request is finished by calling request_end() |
816 | 808 | */ |
817 | -static ssize_t fuse_dev_writev(struct file *file, const struct iovec *iov, | |
818 | - unsigned long nr_segs, loff_t *off) | |
809 | +static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov, | |
810 | + unsigned long nr_segs, loff_t pos) | |
819 | 811 | { |
820 | 812 | int err; |
821 | 813 | unsigned nbytes = iov_length(iov, nr_segs); |
822 | 814 | struct fuse_req *req; |
823 | 815 | struct fuse_out_header oh; |
824 | 816 | struct fuse_copy_state cs; |
825 | - struct fuse_conn *fc = fuse_get_conn(file); | |
817 | + struct fuse_conn *fc = fuse_get_conn(iocb->ki_filp); | |
826 | 818 | if (!fc) |
827 | 819 | return -EPERM; |
828 | 820 | |
... | ... | @@ -898,15 +890,6 @@ |
898 | 890 | return err; |
899 | 891 | } |
900 | 892 | |
901 | -static ssize_t fuse_dev_write(struct file *file, const char __user *buf, | |
902 | - size_t nbytes, loff_t *off) | |
903 | -{ | |
904 | - struct iovec iov; | |
905 | - iov.iov_len = nbytes; | |
906 | - iov.iov_base = (char __user *) buf; | |
907 | - return fuse_dev_writev(file, &iov, 1, off); | |
908 | -} | |
909 | - | |
910 | 893 | static unsigned fuse_dev_poll(struct file *file, poll_table *wait) |
911 | 894 | { |
912 | 895 | unsigned mask = POLLOUT | POLLWRNORM; |
... | ... | @@ -1041,10 +1024,10 @@ |
1041 | 1024 | const struct file_operations fuse_dev_operations = { |
1042 | 1025 | .owner = THIS_MODULE, |
1043 | 1026 | .llseek = no_llseek, |
1044 | - .read = fuse_dev_read, | |
1045 | - .readv = fuse_dev_readv, | |
1046 | - .write = fuse_dev_write, | |
1047 | - .writev = fuse_dev_writev, | |
1027 | + .read = do_sync_read, | |
1028 | + .aio_read = fuse_dev_read, | |
1029 | + .write = do_sync_write, | |
1030 | + .aio_write = fuse_dev_write, | |
1048 | 1031 | .poll = fuse_dev_poll, |
1049 | 1032 | .release = fuse_dev_release, |
1050 | 1033 | .fasync = fuse_dev_fasync, |
fs/hostfs/hostfs_kern.c
... | ... | @@ -389,8 +389,6 @@ |
389 | 389 | .sendfile = generic_file_sendfile, |
390 | 390 | .aio_read = generic_file_aio_read, |
391 | 391 | .aio_write = generic_file_aio_write, |
392 | - .readv = generic_file_readv, | |
393 | - .writev = generic_file_writev, | |
394 | 392 | .write = generic_file_write, |
395 | 393 | .mmap = generic_file_mmap, |
396 | 394 | .open = hostfs_file_open, |
fs/jfs/file.c
... | ... | @@ -108,8 +108,6 @@ |
108 | 108 | .aio_read = generic_file_aio_read, |
109 | 109 | .aio_write = generic_file_aio_write, |
110 | 110 | .mmap = generic_file_mmap, |
111 | - .readv = generic_file_readv, | |
112 | - .writev = generic_file_writev, | |
113 | 111 | .sendfile = generic_file_sendfile, |
114 | 112 | .fsync = jfs_fsync, |
115 | 113 | .release = jfs_release, |
fs/ntfs/file.c
... | ... | @@ -2298,11 +2298,9 @@ |
2298 | 2298 | .llseek = generic_file_llseek, /* Seek inside file. */ |
2299 | 2299 | .read = generic_file_read, /* Read from file. */ |
2300 | 2300 | .aio_read = generic_file_aio_read, /* Async read from file. */ |
2301 | - .readv = generic_file_readv, /* Read from file. */ | |
2302 | 2301 | #ifdef NTFS_RW |
2303 | 2302 | .write = ntfs_file_write, /* Write to file. */ |
2304 | 2303 | .aio_write = ntfs_file_aio_write, /* Async write to file. */ |
2305 | - .writev = ntfs_file_writev, /* Write to file. */ | |
2306 | 2304 | /*.release = ,*/ /* Last file is closed. See |
2307 | 2305 | fs/ext2/file.c:: |
2308 | 2306 | ext2_release_file() for |
fs/pipe.c
... | ... | @@ -218,9 +218,10 @@ |
218 | 218 | }; |
219 | 219 | |
220 | 220 | static ssize_t |
221 | -pipe_readv(struct file *filp, const struct iovec *_iov, | |
222 | - unsigned long nr_segs, loff_t *ppos) | |
221 | +pipe_read(struct kiocb *iocb, const struct iovec *_iov, | |
222 | + unsigned long nr_segs, loff_t pos) | |
223 | 223 | { |
224 | + struct file *filp = iocb->ki_filp; | |
224 | 225 | struct inode *inode = filp->f_dentry->d_inode; |
225 | 226 | struct pipe_inode_info *pipe; |
226 | 227 | int do_wakeup; |
227 | 228 | |
... | ... | @@ -330,17 +331,10 @@ |
330 | 331 | } |
331 | 332 | |
332 | 333 | static ssize_t |
333 | -pipe_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | |
334 | +pipe_write(struct kiocb *iocb, const struct iovec *_iov, | |
335 | + unsigned long nr_segs, loff_t ppos) | |
334 | 336 | { |
335 | - struct iovec iov = { .iov_base = buf, .iov_len = count }; | |
336 | - | |
337 | - return pipe_readv(filp, &iov, 1, ppos); | |
338 | -} | |
339 | - | |
340 | -static ssize_t | |
341 | -pipe_writev(struct file *filp, const struct iovec *_iov, | |
342 | - unsigned long nr_segs, loff_t *ppos) | |
343 | -{ | |
337 | + struct file *filp = iocb->ki_filp; | |
344 | 338 | struct inode *inode = filp->f_dentry->d_inode; |
345 | 339 | struct pipe_inode_info *pipe; |
346 | 340 | ssize_t ret; |
... | ... | @@ -510,15 +504,6 @@ |
510 | 504 | } |
511 | 505 | |
512 | 506 | static ssize_t |
513 | -pipe_write(struct file *filp, const char __user *buf, | |
514 | - size_t count, loff_t *ppos) | |
515 | -{ | |
516 | - struct iovec iov = { .iov_base = (void __user *)buf, .iov_len = count }; | |
517 | - | |
518 | - return pipe_writev(filp, &iov, 1, ppos); | |
519 | -} | |
520 | - | |
521 | -static ssize_t | |
522 | 507 | bad_pipe_r(struct file *filp, char __user *buf, size_t count, loff_t *ppos) |
523 | 508 | { |
524 | 509 | return -EBADF; |
... | ... | @@ -736,8 +721,8 @@ |
736 | 721 | */ |
737 | 722 | const struct file_operations read_fifo_fops = { |
738 | 723 | .llseek = no_llseek, |
739 | - .read = pipe_read, | |
740 | - .readv = pipe_readv, | |
724 | + .read = do_sync_read, | |
725 | + .aio_read = pipe_read, | |
741 | 726 | .write = bad_pipe_w, |
742 | 727 | .poll = pipe_poll, |
743 | 728 | .ioctl = pipe_ioctl, |
... | ... | @@ -749,8 +734,8 @@ |
749 | 734 | const struct file_operations write_fifo_fops = { |
750 | 735 | .llseek = no_llseek, |
751 | 736 | .read = bad_pipe_r, |
752 | - .write = pipe_write, | |
753 | - .writev = pipe_writev, | |
737 | + .write = do_sync_write, | |
738 | + .aio_write = pipe_write, | |
754 | 739 | .poll = pipe_poll, |
755 | 740 | .ioctl = pipe_ioctl, |
756 | 741 | .open = pipe_write_open, |
... | ... | @@ -760,10 +745,10 @@ |
760 | 745 | |
761 | 746 | const struct file_operations rdwr_fifo_fops = { |
762 | 747 | .llseek = no_llseek, |
763 | - .read = pipe_read, | |
764 | - .readv = pipe_readv, | |
765 | - .write = pipe_write, | |
766 | - .writev = pipe_writev, | |
748 | + .read = do_sync_read, | |
749 | + .aio_read = pipe_read, | |
750 | + .write = do_sync_write, | |
751 | + .aio_write = pipe_write, | |
767 | 752 | .poll = pipe_poll, |
768 | 753 | .ioctl = pipe_ioctl, |
769 | 754 | .open = pipe_rdwr_open, |
... | ... | @@ -773,8 +758,8 @@ |
773 | 758 | |
774 | 759 | static struct file_operations read_pipe_fops = { |
775 | 760 | .llseek = no_llseek, |
776 | - .read = pipe_read, | |
777 | - .readv = pipe_readv, | |
761 | + .read = do_sync_read, | |
762 | + .aio_read = pipe_read, | |
778 | 763 | .write = bad_pipe_w, |
779 | 764 | .poll = pipe_poll, |
780 | 765 | .ioctl = pipe_ioctl, |
... | ... | @@ -786,8 +771,8 @@ |
786 | 771 | static struct file_operations write_pipe_fops = { |
787 | 772 | .llseek = no_llseek, |
788 | 773 | .read = bad_pipe_r, |
789 | - .write = pipe_write, | |
790 | - .writev = pipe_writev, | |
774 | + .write = do_sync_write, | |
775 | + .aio_write = pipe_write, | |
791 | 776 | .poll = pipe_poll, |
792 | 777 | .ioctl = pipe_ioctl, |
793 | 778 | .open = pipe_write_open, |
... | ... | @@ -797,10 +782,10 @@ |
797 | 782 | |
798 | 783 | static struct file_operations rdwr_pipe_fops = { |
799 | 784 | .llseek = no_llseek, |
800 | - .read = pipe_read, | |
801 | - .readv = pipe_readv, | |
802 | - .write = pipe_write, | |
803 | - .writev = pipe_writev, | |
785 | + .read = do_sync_read, | |
786 | + .aio_read = pipe_read, | |
787 | + .write = do_sync_write, | |
788 | + .aio_write = pipe_write, | |
804 | 789 | .poll = pipe_poll, |
805 | 790 | .ioctl = pipe_ioctl, |
806 | 791 | .open = pipe_rdwr_open, |
fs/read_write.c
... | ... | @@ -15,6 +15,7 @@ |
15 | 15 | #include <linux/module.h> |
16 | 16 | #include <linux/syscalls.h> |
17 | 17 | #include <linux/pagemap.h> |
18 | +#include "read_write.h" | |
18 | 19 | |
19 | 20 | #include <asm/uaccess.h> |
20 | 21 | #include <asm/unistd.h> |
... | ... | @@ -450,6 +451,62 @@ |
450 | 451 | |
451 | 452 | EXPORT_UNUSED_SYMBOL(iov_shorten); /* June 2006 */ |
452 | 453 | |
454 | +ssize_t do_sync_readv_writev(struct file *filp, const struct iovec *iov, | |
455 | + unsigned long nr_segs, size_t len, loff_t *ppos, iov_fn_t fn) | |
456 | +{ | |
457 | + struct kiocb kiocb; | |
458 | + ssize_t ret; | |
459 | + | |
460 | + init_sync_kiocb(&kiocb, filp); | |
461 | + kiocb.ki_pos = *ppos; | |
462 | + kiocb.ki_left = len; | |
463 | + kiocb.ki_nbytes = len; | |
464 | + | |
465 | + for (;;) { | |
466 | + ret = fn(&kiocb, iov, nr_segs, kiocb.ki_pos); | |
467 | + if (ret != -EIOCBRETRY) | |
468 | + break; | |
469 | + wait_on_retry_sync_kiocb(&kiocb); | |
470 | + } | |
471 | + | |
472 | + if (ret == -EIOCBQUEUED) | |
473 | + ret = wait_on_sync_kiocb(&kiocb); | |
474 | + *ppos = kiocb.ki_pos; | |
475 | + return ret; | |
476 | +} | |
477 | + | |
478 | +/* Do it by hand, with file-ops */ | |
479 | +ssize_t do_loop_readv_writev(struct file *filp, struct iovec *iov, | |
480 | + unsigned long nr_segs, loff_t *ppos, io_fn_t fn) | |
481 | +{ | |
482 | + struct iovec *vector = iov; | |
483 | + ssize_t ret = 0; | |
484 | + | |
485 | + while (nr_segs > 0) { | |
486 | + void __user *base; | |
487 | + size_t len; | |
488 | + ssize_t nr; | |
489 | + | |
490 | + base = vector->iov_base; | |
491 | + len = vector->iov_len; | |
492 | + vector++; | |
493 | + nr_segs--; | |
494 | + | |
495 | + nr = fn(filp, base, len, ppos); | |
496 | + | |
497 | + if (nr < 0) { | |
498 | + if (!ret) | |
499 | + ret = nr; | |
500 | + break; | |
501 | + } | |
502 | + ret += nr; | |
503 | + if (nr != len) | |
504 | + break; | |
505 | + } | |
506 | + | |
507 | + return ret; | |
508 | +} | |
509 | + | |
453 | 510 | /* A write operation does a read from user space and vice versa */ |
454 | 511 | #define vrfy_dir(type) ((type) == READ ? VERIFY_WRITE : VERIFY_READ) |
455 | 512 | |
456 | 513 | |
... | ... | @@ -457,12 +514,9 @@ |
457 | 514 | const struct iovec __user * uvector, |
458 | 515 | unsigned long nr_segs, loff_t *pos) |
459 | 516 | { |
460 | - typedef ssize_t (*io_fn_t)(struct file *, char __user *, size_t, loff_t *); | |
461 | - typedef ssize_t (*iov_fn_t)(struct file *, const struct iovec *, unsigned long, loff_t *); | |
462 | - | |
463 | 517 | size_t tot_len; |
464 | 518 | struct iovec iovstack[UIO_FASTIOV]; |
465 | - struct iovec *iov=iovstack, *vector; | |
519 | + struct iovec *iov = iovstack; | |
466 | 520 | ssize_t ret; |
467 | 521 | int seg; |
468 | 522 | io_fn_t fn; |
469 | 523 | |
470 | 524 | |
471 | 525 | |
472 | 526 | |
... | ... | @@ -532,39 +586,18 @@ |
532 | 586 | fnv = NULL; |
533 | 587 | if (type == READ) { |
534 | 588 | fn = file->f_op->read; |
535 | - fnv = file->f_op->readv; | |
589 | + fnv = file->f_op->aio_read; | |
536 | 590 | } else { |
537 | 591 | fn = (io_fn_t)file->f_op->write; |
538 | - fnv = file->f_op->writev; | |
592 | + fnv = file->f_op->aio_write; | |
539 | 593 | } |
540 | - if (fnv) { | |
541 | - ret = fnv(file, iov, nr_segs, pos); | |
542 | - goto out; | |
543 | - } | |
544 | 594 | |
545 | - /* Do it by hand, with file-ops */ | |
546 | - ret = 0; | |
547 | - vector = iov; | |
548 | - while (nr_segs > 0) { | |
549 | - void __user * base; | |
550 | - size_t len; | |
551 | - ssize_t nr; | |
595 | + if (fnv) | |
596 | + ret = do_sync_readv_writev(file, iov, nr_segs, tot_len, | |
597 | + pos, fnv); | |
598 | + else | |
599 | + ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn); | |
552 | 600 | |
553 | - base = vector->iov_base; | |
554 | - len = vector->iov_len; | |
555 | - vector++; | |
556 | - nr_segs--; | |
557 | - | |
558 | - nr = fn(file, base, len, pos); | |
559 | - | |
560 | - if (nr < 0) { | |
561 | - if (!ret) ret = nr; | |
562 | - break; | |
563 | - } | |
564 | - ret += nr; | |
565 | - if (nr != len) | |
566 | - break; | |
567 | - } | |
568 | 601 | out: |
569 | 602 | if (iov != iovstack) |
570 | 603 | kfree(iov); |
... | ... | @@ -585,7 +618,7 @@ |
585 | 618 | { |
586 | 619 | if (!(file->f_mode & FMODE_READ)) |
587 | 620 | return -EBADF; |
588 | - if (!file->f_op || (!file->f_op->readv && !file->f_op->read)) | |
621 | + if (!file->f_op || (!file->f_op->aio_read && !file->f_op->read)) | |
589 | 622 | return -EINVAL; |
590 | 623 | |
591 | 624 | return do_readv_writev(READ, file, vec, vlen, pos); |
... | ... | @@ -598,7 +631,7 @@ |
598 | 631 | { |
599 | 632 | if (!(file->f_mode & FMODE_WRITE)) |
600 | 633 | return -EBADF; |
601 | - if (!file->f_op || (!file->f_op->writev && !file->f_op->write)) | |
634 | + if (!file->f_op || (!file->f_op->aio_write && !file->f_op->write)) | |
602 | 635 | return -EINVAL; |
603 | 636 | |
604 | 637 | return do_readv_writev(WRITE, file, vec, vlen, pos); |
fs/read_write.h
1 | +/* | |
2 | + * This file is only for sharing some helpers from read_write.c with compat.c. | |
3 | + * Don't use anywhere else. | |
4 | + */ | |
5 | + | |
6 | + | |
7 | +typedef ssize_t (*io_fn_t)(struct file *, char __user *, size_t, loff_t *); | |
8 | +typedef ssize_t (*iov_fn_t)(struct kiocb *, const struct iovec *, | |
9 | + unsigned long, loff_t); | |
10 | + | |
11 | +ssize_t do_sync_readv_writev(struct file *filp, const struct iovec *iov, | |
12 | + unsigned long nr_segs, size_t len, loff_t *ppos, iov_fn_t fn); | |
13 | +ssize_t do_loop_readv_writev(struct file *filp, struct iovec *iov, | |
14 | + unsigned long nr_segs, loff_t *ppos, io_fn_t fn); |
fs/xfs/linux-2.6/xfs_file.c
... | ... | @@ -123,97 +123,7 @@ |
123 | 123 | return __xfs_file_write(iocb, iov, nr_segs, IO_ISAIO|IO_INVIS, pos); |
124 | 124 | } |
125 | 125 | |
126 | -STATIC inline ssize_t | |
127 | -__xfs_file_readv( | |
128 | - struct file *file, | |
129 | - const struct iovec *iov, | |
130 | - int ioflags, | |
131 | - unsigned long nr_segs, | |
132 | - loff_t *ppos) | |
133 | -{ | |
134 | - struct inode *inode = file->f_mapping->host; | |
135 | - bhv_vnode_t *vp = vn_from_inode(inode); | |
136 | - struct kiocb kiocb; | |
137 | - ssize_t rval; | |
138 | - | |
139 | - init_sync_kiocb(&kiocb, file); | |
140 | - kiocb.ki_pos = *ppos; | |
141 | - | |
142 | - if (unlikely(file->f_flags & O_DIRECT)) | |
143 | - ioflags |= IO_ISDIRECT; | |
144 | - rval = bhv_vop_read(vp, &kiocb, iov, nr_segs, | |
145 | - &kiocb.ki_pos, ioflags, NULL); | |
146 | - | |
147 | - *ppos = kiocb.ki_pos; | |
148 | - return rval; | |
149 | -} | |
150 | - | |
151 | 126 | STATIC ssize_t |
152 | -xfs_file_readv( | |
153 | - struct file *file, | |
154 | - const struct iovec *iov, | |
155 | - unsigned long nr_segs, | |
156 | - loff_t *ppos) | |
157 | -{ | |
158 | - return __xfs_file_readv(file, iov, 0, nr_segs, ppos); | |
159 | -} | |
160 | - | |
161 | -STATIC ssize_t | |
162 | -xfs_file_readv_invis( | |
163 | - struct file *file, | |
164 | - const struct iovec *iov, | |
165 | - unsigned long nr_segs, | |
166 | - loff_t *ppos) | |
167 | -{ | |
168 | - return __xfs_file_readv(file, iov, IO_INVIS, nr_segs, ppos); | |
169 | -} | |
170 | - | |
171 | -STATIC inline ssize_t | |
172 | -__xfs_file_writev( | |
173 | - struct file *file, | |
174 | - const struct iovec *iov, | |
175 | - int ioflags, | |
176 | - unsigned long nr_segs, | |
177 | - loff_t *ppos) | |
178 | -{ | |
179 | - struct inode *inode = file->f_mapping->host; | |
180 | - bhv_vnode_t *vp = vn_from_inode(inode); | |
181 | - struct kiocb kiocb; | |
182 | - ssize_t rval; | |
183 | - | |
184 | - init_sync_kiocb(&kiocb, file); | |
185 | - kiocb.ki_pos = *ppos; | |
186 | - if (unlikely(file->f_flags & O_DIRECT)) | |
187 | - ioflags |= IO_ISDIRECT; | |
188 | - | |
189 | - rval = bhv_vop_write(vp, &kiocb, iov, nr_segs, | |
190 | - &kiocb.ki_pos, ioflags, NULL); | |
191 | - | |
192 | - *ppos = kiocb.ki_pos; | |
193 | - return rval; | |
194 | -} | |
195 | - | |
196 | -STATIC ssize_t | |
197 | -xfs_file_writev( | |
198 | - struct file *file, | |
199 | - const struct iovec *iov, | |
200 | - unsigned long nr_segs, | |
201 | - loff_t *ppos) | |
202 | -{ | |
203 | - return __xfs_file_writev(file, iov, 0, nr_segs, ppos); | |
204 | -} | |
205 | - | |
206 | -STATIC ssize_t | |
207 | -xfs_file_writev_invis( | |
208 | - struct file *file, | |
209 | - const struct iovec *iov, | |
210 | - unsigned long nr_segs, | |
211 | - loff_t *ppos) | |
212 | -{ | |
213 | - return __xfs_file_writev(file, iov, IO_INVIS, nr_segs, ppos); | |
214 | -} | |
215 | - | |
216 | -STATIC ssize_t | |
217 | 127 | xfs_file_sendfile( |
218 | 128 | struct file *filp, |
219 | 129 | loff_t *pos, |
... | ... | @@ -540,8 +450,6 @@ |
540 | 450 | .llseek = generic_file_llseek, |
541 | 451 | .read = do_sync_read, |
542 | 452 | .write = do_sync_write, |
543 | - .readv = xfs_file_readv, | |
544 | - .writev = xfs_file_writev, | |
545 | 453 | .aio_read = xfs_file_aio_read, |
546 | 454 | .aio_write = xfs_file_aio_write, |
547 | 455 | .sendfile = xfs_file_sendfile, |
... | ... | @@ -565,8 +473,6 @@ |
565 | 473 | .llseek = generic_file_llseek, |
566 | 474 | .read = do_sync_read, |
567 | 475 | .write = do_sync_write, |
568 | - .readv = xfs_file_readv_invis, | |
569 | - .writev = xfs_file_writev_invis, | |
570 | 476 | .aio_read = xfs_file_aio_read_invis, |
571 | 477 | .aio_write = xfs_file_aio_write_invis, |
572 | 478 | .sendfile = xfs_file_sendfile_invis, |
include/linux/fs.h
... | ... | @@ -1113,8 +1113,6 @@ |
1113 | 1113 | int (*aio_fsync) (struct kiocb *, int datasync); |
1114 | 1114 | int (*fasync) (int, struct file *, int); |
1115 | 1115 | int (*lock) (struct file *, int, struct file_lock *); |
1116 | - ssize_t (*readv) (struct file *, const struct iovec *, unsigned long, loff_t *); | |
1117 | - ssize_t (*writev) (struct file *, const struct iovec *, unsigned long, loff_t *); | |
1118 | 1116 | ssize_t (*sendfile) (struct file *, loff_t *, size_t, read_actor_t, void *); |
1119 | 1117 | ssize_t (*sendpage) (struct file *, struct page *, int, size_t, loff_t *, int); |
1120 | 1118 | unsigned long (*get_unmapped_area)(struct file *, unsigned long, unsigned long, unsigned long, unsigned long); |
... | ... | @@ -1734,10 +1732,6 @@ |
1734 | 1732 | |
1735 | 1733 | extern void |
1736 | 1734 | file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); |
1737 | -extern ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, | |
1738 | - unsigned long nr_segs, loff_t *ppos); | |
1739 | -ssize_t generic_file_writev(struct file *filp, const struct iovec *iov, | |
1740 | - unsigned long nr_segs, loff_t *ppos); | |
1741 | 1735 | extern loff_t no_llseek(struct file *file, loff_t offset, int origin); |
1742 | 1736 | extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); |
1743 | 1737 | extern loff_t remote_llseek(struct file *file, loff_t offset, int origin); |
mm/filemap.c
... | ... | @@ -2421,42 +2421,6 @@ |
2421 | 2421 | } |
2422 | 2422 | EXPORT_SYMBOL(generic_file_write); |
2423 | 2423 | |
2424 | -ssize_t generic_file_readv(struct file *filp, const struct iovec *iov, | |
2425 | - unsigned long nr_segs, loff_t *ppos) | |
2426 | -{ | |
2427 | - struct kiocb kiocb; | |
2428 | - ssize_t ret; | |
2429 | - | |
2430 | - init_sync_kiocb(&kiocb, filp); | |
2431 | - ret = __generic_file_aio_read(&kiocb, iov, nr_segs, ppos); | |
2432 | - if (-EIOCBQUEUED == ret) | |
2433 | - ret = wait_on_sync_kiocb(&kiocb); | |
2434 | - return ret; | |
2435 | -} | |
2436 | -EXPORT_SYMBOL(generic_file_readv); | |
2437 | - | |
2438 | -ssize_t generic_file_writev(struct file *file, const struct iovec *iov, | |
2439 | - unsigned long nr_segs, loff_t *ppos) | |
2440 | -{ | |
2441 | - struct address_space *mapping = file->f_mapping; | |
2442 | - struct inode *inode = mapping->host; | |
2443 | - ssize_t ret; | |
2444 | - | |
2445 | - mutex_lock(&inode->i_mutex); | |
2446 | - ret = __generic_file_write_nolock(file, iov, nr_segs, ppos); | |
2447 | - mutex_unlock(&inode->i_mutex); | |
2448 | - | |
2449 | - if (ret > 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { | |
2450 | - int err; | |
2451 | - | |
2452 | - err = sync_page_range(inode, mapping, *ppos - ret, ret); | |
2453 | - if (err < 0) | |
2454 | - ret = err; | |
2455 | - } | |
2456 | - return ret; | |
2457 | -} | |
2458 | -EXPORT_SYMBOL(generic_file_writev); | |
2459 | - | |
2460 | 2424 | /* |
2461 | 2425 | * Called under i_mutex for writes to S_ISREG files. Returns -EIO if something |
2462 | 2426 | * went wrong during pagecache shootdown. |
net/socket.c
... | ... | @@ -110,10 +110,6 @@ |
110 | 110 | unsigned int cmd, unsigned long arg); |
111 | 111 | #endif |
112 | 112 | static int sock_fasync(int fd, struct file *filp, int on); |
113 | -static ssize_t sock_readv(struct file *file, const struct iovec *vector, | |
114 | - unsigned long count, loff_t *ppos); | |
115 | -static ssize_t sock_writev(struct file *file, const struct iovec *vector, | |
116 | - unsigned long count, loff_t *ppos); | |
117 | 113 | static ssize_t sock_sendpage(struct file *file, struct page *page, |
118 | 114 | int offset, size_t size, loff_t *ppos, int more); |
119 | 115 | |
... | ... | @@ -136,8 +132,6 @@ |
136 | 132 | .open = sock_no_open, /* special open code to disallow open via /proc */ |
137 | 133 | .release = sock_close, |
138 | 134 | .fasync = sock_fasync, |
139 | - .readv = sock_readv, | |
140 | - .writev = sock_writev, | |
141 | 135 | .sendpage = sock_sendpage, |
142 | 136 | .splice_write = generic_splice_sendpage, |
143 | 137 | }; |
... | ... | @@ -700,23 +694,6 @@ |
700 | 694 | return __sock_recvmsg(iocb, sock, msg, size, msg->msg_flags); |
701 | 695 | } |
702 | 696 | |
703 | -static ssize_t sock_readv(struct file *file, const struct iovec *iov, | |
704 | - unsigned long nr_segs, loff_t *ppos) | |
705 | -{ | |
706 | - struct kiocb iocb; | |
707 | - struct sock_iocb siocb; | |
708 | - struct msghdr msg; | |
709 | - int ret; | |
710 | - | |
711 | - init_sync_kiocb(&iocb, NULL); | |
712 | - iocb.private = &siocb; | |
713 | - | |
714 | - ret = do_sock_read(&msg, &iocb, file, iov, nr_segs); | |
715 | - if (-EIOCBQUEUED == ret) | |
716 | - ret = wait_on_sync_kiocb(&iocb); | |
717 | - return ret; | |
718 | -} | |
719 | - | |
720 | 697 | static ssize_t sock_aio_read(struct kiocb *iocb, const struct iovec *iov, |
721 | 698 | unsigned long nr_segs, loff_t pos) |
722 | 699 | { |
... | ... | @@ -757,23 +734,6 @@ |
757 | 734 | msg->msg_flags |= MSG_EOR; |
758 | 735 | |
759 | 736 | return __sock_sendmsg(iocb, sock, msg, size); |
760 | -} | |
761 | - | |
762 | -static ssize_t sock_writev(struct file *file, const struct iovec *iov, | |
763 | - unsigned long nr_segs, loff_t *ppos) | |
764 | -{ | |
765 | - struct msghdr msg; | |
766 | - struct kiocb iocb; | |
767 | - struct sock_iocb siocb; | |
768 | - int ret; | |
769 | - | |
770 | - init_sync_kiocb(&iocb, NULL); | |
771 | - iocb.private = &siocb; | |
772 | - | |
773 | - ret = do_sock_write(&msg, &iocb, file, iov, nr_segs); | |
774 | - if (-EIOCBQUEUED == ret) | |
775 | - ret = wait_on_sync_kiocb(&iocb); | |
776 | - return ret; | |
777 | 737 | } |
778 | 738 | |
779 | 739 | static ssize_t sock_aio_write(struct kiocb *iocb, const struct iovec *iov, |
sound/core/pcm_native.c
... | ... | @@ -2852,8 +2852,8 @@ |
2852 | 2852 | return result; |
2853 | 2853 | } |
2854 | 2854 | |
2855 | -static ssize_t snd_pcm_readv(struct file *file, const struct iovec *_vector, | |
2856 | - unsigned long count, loff_t * offset) | |
2855 | +static ssize_t snd_pcm_aio_read(struct kiocb *iocb, const struct iovec *iov, | |
2856 | + unsigned long nr_segs, loff_t pos) | |
2857 | 2857 | |
2858 | 2858 | { |
2859 | 2859 | struct snd_pcm_file *pcm_file; |
2860 | 2860 | |
2861 | 2861 | |
2862 | 2862 | |
2863 | 2863 | |
... | ... | @@ -2864,22 +2864,22 @@ |
2864 | 2864 | void __user **bufs; |
2865 | 2865 | snd_pcm_uframes_t frames; |
2866 | 2866 | |
2867 | - pcm_file = file->private_data; | |
2867 | + pcm_file = iocb->ki_filp->private_data; | |
2868 | 2868 | substream = pcm_file->substream; |
2869 | 2869 | snd_assert(substream != NULL, return -ENXIO); |
2870 | 2870 | runtime = substream->runtime; |
2871 | 2871 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN) |
2872 | 2872 | return -EBADFD; |
2873 | - if (count > 1024 || count != runtime->channels) | |
2873 | + if (nr_segs > 1024 || nr_segs != runtime->channels) | |
2874 | 2874 | return -EINVAL; |
2875 | - if (!frame_aligned(runtime, _vector->iov_len)) | |
2875 | + if (!frame_aligned(runtime, iov->iov_len)) | |
2876 | 2876 | return -EINVAL; |
2877 | - frames = bytes_to_samples(runtime, _vector->iov_len); | |
2878 | - bufs = kmalloc(sizeof(void *) * count, GFP_KERNEL); | |
2877 | + frames = bytes_to_samples(runtime, iov->iov_len); | |
2878 | + bufs = kmalloc(sizeof(void *) * nr_segs, GFP_KERNEL); | |
2879 | 2879 | if (bufs == NULL) |
2880 | 2880 | return -ENOMEM; |
2881 | - for (i = 0; i < count; ++i) | |
2882 | - bufs[i] = _vector[i].iov_base; | |
2881 | + for (i = 0; i < nr_segs; ++i) | |
2882 | + bufs[i] = iov[i].iov_base; | |
2883 | 2883 | result = snd_pcm_lib_readv(substream, bufs, frames); |
2884 | 2884 | if (result > 0) |
2885 | 2885 | result = frames_to_bytes(runtime, result); |
... | ... | @@ -2887,8 +2887,8 @@ |
2887 | 2887 | return result; |
2888 | 2888 | } |
2889 | 2889 | |
2890 | -static ssize_t snd_pcm_writev(struct file *file, const struct iovec *_vector, | |
2891 | - unsigned long count, loff_t * offset) | |
2890 | +static ssize_t snd_pcm_aio_write(struct kiocb *iocb, const struct iovec *iov, | |
2891 | + unsigned long nr_segs, loff_t pos) | |
2892 | 2892 | { |
2893 | 2893 | struct snd_pcm_file *pcm_file; |
2894 | 2894 | struct snd_pcm_substream *substream; |
... | ... | @@ -2898,7 +2898,7 @@ |
2898 | 2898 | void __user **bufs; |
2899 | 2899 | snd_pcm_uframes_t frames; |
2900 | 2900 | |
2901 | - pcm_file = file->private_data; | |
2901 | + pcm_file = iocb->ki_filp->private_data; | |
2902 | 2902 | substream = pcm_file->substream; |
2903 | 2903 | snd_assert(substream != NULL, result = -ENXIO; goto end); |
2904 | 2904 | runtime = substream->runtime; |
2905 | 2905 | |
2906 | 2906 | |
... | ... | @@ -2906,17 +2906,17 @@ |
2906 | 2906 | result = -EBADFD; |
2907 | 2907 | goto end; |
2908 | 2908 | } |
2909 | - if (count > 128 || count != runtime->channels || | |
2910 | - !frame_aligned(runtime, _vector->iov_len)) { | |
2909 | + if (nr_segs > 128 || nr_segs != runtime->channels || | |
2910 | + !frame_aligned(runtime, iov->iov_len)) { | |
2911 | 2911 | result = -EINVAL; |
2912 | 2912 | goto end; |
2913 | 2913 | } |
2914 | - frames = bytes_to_samples(runtime, _vector->iov_len); | |
2915 | - bufs = kmalloc(sizeof(void *) * count, GFP_KERNEL); | |
2914 | + frames = bytes_to_samples(runtime, iov->iov_len); | |
2915 | + bufs = kmalloc(sizeof(void *) * nr_segs, GFP_KERNEL); | |
2916 | 2916 | if (bufs == NULL) |
2917 | 2917 | return -ENOMEM; |
2918 | - for (i = 0; i < count; ++i) | |
2919 | - bufs[i] = _vector[i].iov_base; | |
2918 | + for (i = 0; i < nr_segs; ++i) | |
2919 | + bufs[i] = iov[i].iov_base; | |
2920 | 2920 | result = snd_pcm_lib_writev(substream, bufs, frames); |
2921 | 2921 | if (result > 0) |
2922 | 2922 | result = frames_to_bytes(runtime, result); |
... | ... | @@ -3426,7 +3426,7 @@ |
3426 | 3426 | { |
3427 | 3427 | .owner = THIS_MODULE, |
3428 | 3428 | .write = snd_pcm_write, |
3429 | - .writev = snd_pcm_writev, | |
3429 | + .aio_write = snd_pcm_aio_write, | |
3430 | 3430 | .open = snd_pcm_playback_open, |
3431 | 3431 | .release = snd_pcm_release, |
3432 | 3432 | .poll = snd_pcm_playback_poll, |
... | ... | @@ -3438,7 +3438,7 @@ |
3438 | 3438 | { |
3439 | 3439 | .owner = THIS_MODULE, |
3440 | 3440 | .read = snd_pcm_read, |
3441 | - .readv = snd_pcm_readv, | |
3441 | + .aio_read = snd_pcm_aio_read, | |
3442 | 3442 | .open = snd_pcm_capture_open, |
3443 | 3443 | .release = snd_pcm_release, |
3444 | 3444 | .poll = snd_pcm_capture_poll, |