aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/hypfs
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2008-07-14 03:59:16 -0400
committerHeiko Carstens <heiko.carstens@de.ibm.com>2008-07-14 04:02:16 -0400
commita29591c47524dde594c84a279a5f1827e688a4c4 (patch)
treef847eb6f612aa5739459a2e01d448f5ba85c092a /arch/s390/hypfs
parentd9cef21af03eb56473db5bb20d8754f377a498e7 (diff)
[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')
-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,
150 unsigned long nr_segs, loff_t offset) 150 unsigned long nr_segs, loff_t offset)
151{ 151{
152 char *data; 152 char *data;
153 size_t len; 153 ssize_t ret;
154 struct file *filp = iocb->ki_filp; 154 struct file *filp = iocb->ki_filp;
155 /* XXX: temporary */ 155 /* XXX: temporary */
156 char __user *buf = iov[0].iov_base; 156 char __user *buf = iov[0].iov_base;
157 size_t count = iov[0].iov_len; 157 size_t count = iov[0].iov_len;
158 158
159 if (nr_segs != 1) { 159 if (nr_segs != 1)
160 count = -EINVAL; 160 return -EINVAL;
161 goto out;
162 }
163 161
164 data = filp->private_data; 162 data = filp->private_data;
165 len = strlen(data); 163 ret = simple_read_from_buffer(buf, count, &offset, data, strlen(data));
166 if (offset > len) { 164 if (ret <= 0)
167 count = 0; 165 return ret;
168 goto out; 166
169 } 167 iocb->ki_pos += ret;
170 if (count > len - offset)
171 count = len - offset;
172 if (copy_to_user(buf, data + offset, count)) {
173 count = -EFAULT;
174 goto out;
175 }
176 iocb->ki_pos += count;
177 file_accessed(filp); 168 file_accessed(filp);
178out: 169
179 return count; 170 return ret;
180} 171}
181static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov, 172static ssize_t hypfs_aio_write(struct kiocb *iocb, const struct iovec *iov,
182 unsigned long nr_segs, loff_t offset) 173 unsigned long nr_segs, loff_t offset)