lkml.org 
[lkml]   [2024]   [Apr]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 186/437] scsi: csiostor: convert to read/write iterators
Date
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
drivers/scsi/csiostor/csio_init.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/scsi/csiostor/csio_init.c b/drivers/scsi/csiostor/csio_init.c
index d649b7a2a879..177d485975e1 100644
--- a/drivers/scsi/csiostor/csio_init.c
+++ b/drivers/scsi/csiostor/csio_init.c
@@ -59,13 +59,14 @@ static struct scsi_transport_template *csio_fcoe_transport_vport;
/*
* debugfs support
*/
-static ssize_t
-csio_mem_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
+static ssize_t csio_mem_read(struct kiocb *iocb, struct iov_iter *to)
{
- loff_t pos = *ppos;
+ loff_t pos = iocb->ki_pos;
+ struct file *file = iocb->ki_filp;
loff_t avail = file_inode(file)->i_size;
unsigned int mem = (uintptr_t)file->private_data & 3;
struct csio_hw *hw = file->private_data - mem;
+ size_t count = iov_iter_count(to);

if (pos < 0)
return -EINVAL;
@@ -90,22 +91,21 @@ csio_mem_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)

ofst = pos % sizeof(data);
len = min(count, sizeof(data) - ofst);
- if (copy_to_user(buf, (u8 *)data + ofst, len))
+ if (!copy_to_iter_full((u8 *)data + ofst, len, to))
return -EFAULT;

- buf += len;
pos += len;
count -= len;
}
- count = pos - *ppos;
- *ppos = pos;
+ count = pos - iocb->ki_pos;
+ iocb->ki_pos = pos;
return count;
}

static const struct file_operations csio_mem_debugfs_fops = {
.owner = THIS_MODULE,
.open = simple_open,
- .read = csio_mem_read,
+ .read_iter = csio_mem_read,
.llseek = default_llseek,
};

--
2.43.0

\
 
 \ /
  Last update: 2024-05-27 16:36    [W:1.246 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site