[S390] s390: use simple_read_from_buffer()
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
d9cef21af0
commit
a29591c475
arch/s390/hypfs
|
@ -150,33 +150,24 @@ static ssize_t hypfs_aio_read(struct kiocb *iocb, const struct iovec *iov,
|
||||||
unsigned long nr_segs, loff_t offset)
|
unsigned long nr_segs, loff_t offset)
|
||||||
{
|
{
|
||||||
char *data;
|
char *data;
|
||||||
size_t len;
|
ssize_t ret;
|
||||||
struct file *filp = iocb->ki_filp;
|
struct file *filp = iocb->ki_filp;
|
||||||
/* XXX: temporary */
|
/* XXX: temporary */
|
||||||
char __user *buf = iov[0].iov_base;
|
char __user *buf = iov[0].iov_base;
|
||||||
size_t count = iov[0].iov_len;
|
size_t count = iov[0].iov_len;
|
||||||
|
|
||||||
if (nr_segs != 1) {
|
if (nr_segs != 1)
|
||||||
count = -EINVAL;
|
return -EINVAL;
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
data = filp->private_data;
|
data = filp->private_data;
|
||||||
len = strlen(data);
|
ret = simple_read_from_buffer(buf, count, &offset, data, strlen(data));
|
||||||
if (offset > len) {
|
if (ret <= 0)
|
||||||
count = 0;
|
return ret;
|
||||||
goto out;
|
|
||||||
}
|
iocb->ki_pos += ret;
|
||||||
if (count > len - offset)
|
|
||||||
count = len - offset;
|
|
||||||
if (copy_to_user(buf, data + offset, count)) {
|
|
||||||
count = -EFAULT;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
iocb->ki_pos += count;
|
|
||||||
file_accessed(filp);
|
file_accessed(filp);
|
||||||
out:
|
|
||||||
return count;
|
return ret;
|
||||||
}
|
}
|
||||||
static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov,
|
||||||
unsigned long nr_segs, loff_t offset)
|
unsigned long nr_segs, loff_t offset)
|
||||||
|
|
Loading…
Reference in New Issue