[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-285-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:17:04 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 284/437] fs/coda: convert to read/write iterators
Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
fs/coda/psdev.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c
index 3c3148588491..1c7f1c5c4941 100644
--- a/fs/coda/psdev.c
+++ b/fs/coda/psdev.c
@@ -196,16 +196,17 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf,
out:
return(count ? count : retval);
}
+FOPS_WRITE_ITER_HELPER(coda_psdev_write);
/*
* Read a message from the kernel to Venus
*/
-static ssize_t coda_psdev_read(struct file * file, char __user * buf,
- size_t nbytes, loff_t *off)
+static ssize_t coda_psdev_read(struct kiocb *iocb, struct iov_iter *to)
{
DECLARE_WAITQUEUE(wait, current);
- struct venus_comm *vcp = (struct venus_comm *) file->private_data;
+ struct venus_comm *vcp = iocb->ki_filp->private_data;
+ size_t nbytes = iov_iter_count(to);
struct upc_req *req;
ssize_t retval = 0, count = 0;
@@ -218,7 +219,7 @@ static ssize_t coda_psdev_read(struct file * file, char __user * buf,
set_current_state(TASK_INTERRUPTIBLE);
while (list_empty(&vcp->vc_pending)) {
- if (file->f_flags & O_NONBLOCK) {
+ if (iocb->ki_filp->f_flags & O_NONBLOCK) {
retval = -EAGAIN;
break;
}
@@ -248,9 +249,9 @@ static ssize_t coda_psdev_read(struct file * file, char __user * buf,
count = nbytes;
}
- if (copy_to_user(buf, req->uc_data, count))
+ if (!copy_to_iter_full(req->uc_data, count, to))
retval = -EFAULT;
-
+
/* If request was not a signal, enqueue and don't free */
if (!(req->uc_flags & CODA_REQ_ASYNC)) {
req->uc_flags |= CODA_REQ_READ;
@@ -344,8 +345,8 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
static const struct file_operations coda_psdev_fops = {
.owner = THIS_MODULE,
- .read = coda_psdev_read,
- .write = coda_psdev_write,
+ .read_iter = coda_psdev_read,
+ .write_iter = coda_psdev_write_iter,
.poll = coda_psdev_poll,
.unlocked_ioctl = coda_psdev_ioctl,
.open = coda_psdev_open,
--
2.43.0
Powered by blists - more mailing lists