aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pipe.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/pipe.c')
-rw-r--r--fs/pipe.c59
1 files changed, 22 insertions, 37 deletions
diff --git a/fs/pipe.c b/fs/pipe.c
index f3b6f71e9d0b..2e60e1c8815e 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -218,9 +218,10 @@ static struct pipe_buf_operations anon_pipe_buf_ops = {
218}; 218};
219 219
220static ssize_t 220static ssize_t
221pipe_readv(struct file *filp, const struct iovec *_iov, 221pipe_read(struct kiocb *iocb, const struct iovec *_iov,
222 unsigned long nr_segs, loff_t *ppos) 222 unsigned long nr_segs, loff_t pos)
223{ 223{
224 struct file *filp = iocb->ki_filp;
224 struct inode *inode = filp->f_dentry->d_inode; 225 struct inode *inode = filp->f_dentry->d_inode;
225 struct pipe_inode_info *pipe; 226 struct pipe_inode_info *pipe;
226 int do_wakeup; 227 int do_wakeup;
@@ -330,17 +331,10 @@ redo:
330} 331}
331 332
332static ssize_t 333static ssize_t
333pipe_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) 334pipe_write(struct kiocb *iocb, const struct iovec *_iov,
334{ 335 unsigned long nr_segs, loff_t ppos)
335 struct iovec iov = { .iov_base = buf, .iov_len = count };
336
337 return pipe_readv(filp, &iov, 1, ppos);
338}
339
340static ssize_t
341pipe_writev(struct file *filp, const struct iovec *_iov,
342 unsigned long nr_segs, loff_t *ppos)
343{ 336{
337 struct file *filp = iocb->ki_filp;
344 struct inode *inode = filp->f_dentry->d_inode; 338 struct inode *inode = filp->f_dentry->d_inode;
345 struct pipe_inode_info *pipe; 339 struct pipe_inode_info *pipe;
346 ssize_t ret; 340 ssize_t ret;
@@ -510,15 +504,6 @@ out:
510} 504}
511 505
512static ssize_t 506static ssize_t
513pipe_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
521static ssize_t
522bad_pipe_r(struct file *filp, char __user *buf, size_t count, loff_t *ppos) 507bad_pipe_r(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
523{ 508{
524 return -EBADF; 509 return -EBADF;
@@ -736,8 +721,8 @@ pipe_rdwr_open(struct inode *inode, struct file *filp)
736 */ 721 */
737const struct file_operations read_fifo_fops = { 722const struct file_operations read_fifo_fops = {
738 .llseek = no_llseek, 723 .llseek = no_llseek,
739 .read = pipe_read, 724 .read = do_sync_read,
740 .readv = pipe_readv, 725 .aio_read = pipe_read,
741 .write = bad_pipe_w, 726 .write = bad_pipe_w,
742 .poll = pipe_poll, 727 .poll = pipe_poll,
743 .ioctl = pipe_ioctl, 728 .ioctl = pipe_ioctl,
@@ -749,8 +734,8 @@ const struct file_operations read_fifo_fops = {
749const struct file_operations write_fifo_fops = { 734const struct file_operations write_fifo_fops = {
750 .llseek = no_llseek, 735 .llseek = no_llseek,
751 .read = bad_pipe_r, 736 .read = bad_pipe_r,
752 .write = pipe_write, 737 .write = do_sync_write,
753 .writev = pipe_writev, 738 .aio_write = pipe_write,
754 .poll = pipe_poll, 739 .poll = pipe_poll,
755 .ioctl = pipe_ioctl, 740 .ioctl = pipe_ioctl,
756 .open = pipe_write_open, 741 .open = pipe_write_open,
@@ -760,10 +745,10 @@ const struct file_operations write_fifo_fops = {
760 745
761const struct file_operations rdwr_fifo_fops = { 746const struct file_operations rdwr_fifo_fops = {
762 .llseek = no_llseek, 747 .llseek = no_llseek,
763 .read = pipe_read, 748 .read = do_sync_read,
764 .readv = pipe_readv, 749 .aio_read = pipe_read,
765 .write = pipe_write, 750 .write = do_sync_write,
766 .writev = pipe_writev, 751 .aio_write = pipe_write,
767 .poll = pipe_poll, 752 .poll = pipe_poll,
768 .ioctl = pipe_ioctl, 753 .ioctl = pipe_ioctl,
769 .open = pipe_rdwr_open, 754 .open = pipe_rdwr_open,
@@ -773,8 +758,8 @@ const struct file_operations rdwr_fifo_fops = {
773 758
774static struct file_operations read_pipe_fops = { 759static struct file_operations read_pipe_fops = {
775 .llseek = no_llseek, 760 .llseek = no_llseek,
776 .read = pipe_read, 761 .read = do_sync_read,
777 .readv = pipe_readv, 762 .aio_read = pipe_read,
778 .write = bad_pipe_w, 763 .write = bad_pipe_w,
779 .poll = pipe_poll, 764 .poll = pipe_poll,
780 .ioctl = pipe_ioctl, 765 .ioctl = pipe_ioctl,
@@ -786,8 +771,8 @@ static struct file_operations read_pipe_fops = {
786static struct file_operations write_pipe_fops = { 771static struct file_operations write_pipe_fops = {
787 .llseek = no_llseek, 772 .llseek = no_llseek,
788 .read = bad_pipe_r, 773 .read = bad_pipe_r,
789 .write = pipe_write, 774 .write = do_sync_write,
790 .writev = pipe_writev, 775 .aio_write = pipe_write,
791 .poll = pipe_poll, 776 .poll = pipe_poll,
792 .ioctl = pipe_ioctl, 777 .ioctl = pipe_ioctl,
793 .open = pipe_write_open, 778 .open = pipe_write_open,
@@ -797,10 +782,10 @@ static struct file_operations write_pipe_fops = {
797 782
798static struct file_operations rdwr_pipe_fops = { 783static struct file_operations rdwr_pipe_fops = {
799 .llseek = no_llseek, 784 .llseek = no_llseek,
800 .read = pipe_read, 785 .read = do_sync_read,
801 .readv = pipe_readv, 786 .aio_read = pipe_read,
802 .write = pipe_write, 787 .write = do_sync_write,
803 .writev = pipe_writev, 788 .aio_write = pipe_write,
804 .poll = pipe_poll, 789 .poll = pipe_poll,
805 .ioctl = pipe_ioctl, 790 .ioctl = pipe_ioctl,
806 .open = pipe_rdwr_open, 791 .open = pipe_rdwr_open,