[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220520094459.116240-4-Jason@zx2c4.com>
Date: Fri, 20 May 2022 11:44:59 +0200
From: "Jason A. Donenfeld" <Jason@...c4.com>
To: Jens Axboe <axboe@...nel.dk>, Theodore Ts'o <tytso@....edu>,
Christoph Hellwig <hch@....de>,
LKML <linux-kernel@...r.kernel.org>,
Al Viro <viro@...iv.linux.org.uk>
Cc: "Jason A . Donenfeld" <Jason@...c4.com>
Subject: [PATCH v4 3/3] random: wire up fops->splice_{read,write}_iter()
From: Jens Axboe <axboe@...nel.dk>
Now that random/urandom is using {read,write}_iter, we can wire it up to
using the generic splice handlers.
Fixes: 36e2c7421f02 ("fs: don't allow splice read/write without explicit ops")
Signed-off-by: Jens Axboe <axboe@...nel.dk>
[Jason: added the splice_write path. Note that sendfile() and such still
does not work for read, though it does for write, because of the
outdated file type restriction in splice_direct_to_actor(), which I'll
address separately.]
Cc: Al Viro <viro@...iv.linux.org.uk>
Signed-off-by: Jason A. Donenfeld <Jason@...c4.com>
---
drivers/char/random.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/char/random.c b/drivers/char/random.c
index 831cafcd1034..15a9e5ea1b3f 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1412,6 +1412,8 @@ const struct file_operations random_fops = {
.compat_ioctl = compat_ptr_ioctl,
.fasync = random_fasync,
.llseek = noop_llseek,
+ .splice_read = generic_file_splice_read,
+ .splice_write = iter_file_splice_write,
};
const struct file_operations urandom_fops = {
@@ -1421,6 +1423,8 @@ const struct file_operations urandom_fops = {
.compat_ioctl = compat_ptr_ioctl,
.fasync = random_fasync,
.llseek = noop_llseek,
+ .splice_read = generic_file_splice_read,
+ .splice_write = iter_file_splice_write,
};
--
2.35.1
Powered by blists - more mailing lists