pipe: switch to ->read_iter()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Al Viro 2014-04-02 19:56:54 -04:00
parent e6a7bcb4c4
commit fb9096a344

View File

@ -271,24 +271,18 @@ static const struct pipe_buf_operations packet_pipe_buf_ops = {
}; };
static ssize_t static ssize_t
pipe_read(struct kiocb *iocb, const struct iovec *_iov, pipe_read(struct kiocb *iocb, struct iov_iter *to)
unsigned long nr_segs, loff_t pos)
{ {
size_t total_len = iov_iter_count(to);
struct file *filp = iocb->ki_filp; struct file *filp = iocb->ki_filp;
struct pipe_inode_info *pipe = filp->private_data; struct pipe_inode_info *pipe = filp->private_data;
int do_wakeup; int do_wakeup;
ssize_t ret; ssize_t ret;
struct iovec *iov = (struct iovec *)_iov;
size_t total_len;
struct iov_iter iter;
total_len = iov_length(iov, nr_segs);
/* Null read succeeds. */ /* Null read succeeds. */
if (unlikely(total_len == 0)) if (unlikely(total_len == 0))
return 0; return 0;
iov_iter_init(&iter, READ, iov, nr_segs, total_len);
do_wakeup = 0; do_wakeup = 0;
ret = 0; ret = 0;
__pipe_lock(pipe); __pipe_lock(pipe);
@ -312,7 +306,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov,
break; break;
} }
written = copy_page_to_iter(buf->page, buf->offset, chars, &iter); written = copy_page_to_iter(buf->page, buf->offset, chars, to);
if (unlikely(written < chars)) { if (unlikely(written < chars)) {
if (!ret) if (!ret)
ret = -EFAULT; ret = -EFAULT;
@ -1044,8 +1038,8 @@ static int fifo_open(struct inode *inode, struct file *filp)
const struct file_operations pipefifo_fops = { const struct file_operations pipefifo_fops = {
.open = fifo_open, .open = fifo_open,
.llseek = no_llseek, .llseek = no_llseek,
.read = do_sync_read, .read = new_sync_read,
.aio_read = pipe_read, .read_iter = pipe_read,
.write = do_sync_write, .write = do_sync_write,
.aio_write = pipe_write, .aio_write = pipe_write,
.poll = pipe_poll, .poll = pipe_poll,