summaryrefslogtreecommitdiffstats
path: root/arch/s390/hypfs/inode.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2008-07-14 09:59:16 +0200
committerHeiko Carstens <heiko.carstens@de.ibm.com>2008-07-14 10:02:16 +0200
commita29591c47524dde594c84a279a5f1827e688a4c4 (patch)
treef847eb6f612aa5739459a2e01d448f5ba85c092a /arch/s390/hypfs/inode.c
parent[S390] s390/cio: use memory_read_from_buffer() (diff)
downloadlinux-a29591c47524dde594c84a279a5f1827e688a4c4.tar.xz
linux-a29591c47524dde594c84a279a5f1827e688a4c4.zip
[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>
Diffstat (limited to 'arch/s390/hypfs/inode.c')
-rw-r--r--arch/s390/hypfs/inode.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/arch/s390/hypfs/inode.c b/arch/s390/hypfs/inode.c
index 4b010ff814c9..7383781f3e6a 100644
--- a/arch/s390/hypfs/inode.c
+++ b/arch/s390/hypfs/inode.c
@@ -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)