Commit a29591c4 authored by Akinobu Mita's avatar Akinobu Mita Committed by Heiko Carstens

[S390] s390: use simple_read_from_buffer()

Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent d9cef21a
......@@ -150,33 +150,24 @@ static ssize_t hypfs_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t offset)
{
char *data;
size_t len;
ssize_t ret;
struct file *filp = iocb->ki_filp;
/* XXX: temporary */
char __user *buf = iov[0].iov_base;
size_t count = iov[0].iov_len;
if (nr_segs != 1) {
count = -EINVAL;
goto out;
}
if (nr_segs != 1)
return -EINVAL;
data = filp->private_data;
len = strlen(data);
if (offset > len) {
count = 0;
goto out;
}
if (count > len - offset)
count = len - offset;
if (copy_to_user(buf, data + offset, count)) {
count = -EFAULT;
goto out;
}
iocb->ki_pos += count;
ret = simple_read_from_buffer(buf, count, &offset, data, strlen(data));
if (ret <= 0)
return ret;
iocb->ki_pos += ret;
file_accessed(filp);
out:
return count;
return ret;
}
static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t offset)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment