[PATCH 198/437] scsi: sg: convert to read/write iterators

From: Jens Axboe
Date: Thu Apr 11 2024 - 12:23:46 EST


Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
---
drivers/scsi/sg.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 386981c6976a..c8047981eb9e 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -553,6 +553,7 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
kfree(old_hdr);
return retval;
}
+FOPS_READ_ITER_HELPER(sg_read);

static ssize_t
sg_new_read(Sg_fd * sfp, char __user *buf, size_t count, Sg_request * srp)
@@ -707,6 +708,7 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
k = sg_common_write(sfp, srp, cmnd, sfp->timeout, blocking);
return (k < 0) ? k : count;
}
+FOPS_WRITE_ITER_HELPER(sg_write);

static ssize_t
sg_new_write(Sg_fd *sfp, struct file *file, const char __user *buf,
@@ -1412,8 +1414,8 @@ sg_rq_end_io(struct request *rq, blk_status_t status)

static const struct file_operations sg_fops = {
.owner = THIS_MODULE,
- .read = sg_read,
- .write = sg_write,
+ .read_iter = sg_read_iter,
+ .write_iter = sg_write_iter,
.poll = sg_poll,
.unlocked_ioctl = sg_ioctl,
.compat_ioctl = compat_ptr_ioctl,
--
2.43.0