mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Jens Axboe <axboe@kernel.dk>, LKML <linux-kernel@vger.kernel.org>
Cc: "Jason A . Donenfeld" <Jason@zx2c4.com>
Subject: [PATCH v3 3/3] random: wire up fops->splice_{read,write}_iter()
Date: Fri, 20 May 2022 02:40:58 +0200	[thread overview]
Message-ID: <20220520004058.96691-4-Jason@zx2c4.com> (raw)
In-Reply-To: <20220520004058.96691-1-Jason@zx2c4.com>

From: Jens Axboe <axboe@kernel.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@kernel.dk>
[Jason: added the splice_write path.]
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
---
 drivers/char/random.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/char/random.c b/drivers/char/random.c
index a664e2b89ae0..90d779c5d1a1 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1417,6 +1417,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 = {
@@ -1426,6 +1428,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


  parent reply	other threads:[~2022-05-20  0:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-20  0:40 [PATCH v3 0/3] random: Jens' {read,write}_iter respin Jason A. Donenfeld
2022-05-20  0:40 ` [PATCH v3 1/3] random: convert to using fops->read_iter() Jason A. Donenfeld
2022-05-20  1:11   ` Jens Axboe
2022-05-20  9:04     ` Jason A. Donenfeld
2022-05-20  0:40 ` [PATCH v3 2/3] random: convert to using fops->write_iter() Jason A. Donenfeld
2022-05-20  0:40 ` Jason A. Donenfeld [this message]
2022-05-20  1:11 ` [PATCH v3 0/3] random: Jens' {read,write}_iter respin Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220520004058.96691-4-Jason@zx2c4.com \
    --to=jason@zx2c4.com \
    --cc=axboe@kernel.dk \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®