[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240411153126.16201-86-axboe@kernel.dk>
Date: Thu, 11 Apr 2024 09:13:45 -0600
From: Jens Axboe <axboe@...nel.dk>
To: linux-kernel@...r.kernel.org
Cc: Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 085/437] kprobes: convert to read/write iterators
Signed-off-by: Jens Axboe <axboe@...nel.dk>
---
kernel/kprobes.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index 9d9095e81792..ead4b7cb70d0 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -2971,8 +2971,7 @@ static int disarm_all_kprobes(void)
* when the bool state is switched. We can reuse that facility when
* available
*/
-static ssize_t read_enabled_file_bool(struct file *file,
- char __user *user_buf, size_t count, loff_t *ppos)
+static ssize_t read_enabled_file_bool(struct kiocb *iocb, struct iov_iter *to)
{
char buf[3];
@@ -2982,16 +2981,16 @@ static ssize_t read_enabled_file_bool(struct file *file,
buf[0] = '0';
buf[1] = '\n';
buf[2] = 0x00;
- return simple_read_from_buffer(user_buf, count, ppos, buf, 2);
+ return simple_copy_to_iter(buf, &iocb->ki_pos, 2, to);
}
-static ssize_t write_enabled_file_bool(struct file *file,
- const char __user *user_buf, size_t count, loff_t *ppos)
+static ssize_t write_enabled_file_bool(struct kiocb *iocb, struct iov_iter *from)
{
+ size_t count = iov_iter_count(from);
bool enable;
int ret;
- ret = kstrtobool_from_user(user_buf, count, &enable);
+ ret = kstrtobool_from_iter(from, count, &enable);
if (ret)
return ret;
@@ -3003,8 +3002,8 @@ static ssize_t write_enabled_file_bool(struct file *file,
}
static const struct file_operations fops_kp = {
- .read = read_enabled_file_bool,
- .write = write_enabled_file_bool,
+ .read_iter = read_enabled_file_bool,
+ .write_iter = write_enabled_file_bool,
.llseek = default_llseek,
};
--
2.43.0
Powered by blists - more mailing lists