drivers/char/mem: implement splice() for /dev/zero, /dev/full
authorMax Kellermann <max.kellermann@ionos.com>
Tue, 19 Sep 2023 07:37:42 +0000 (09:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Oct 2023 11:34:05 +0000 (13:34 +0200)
commit1b057bd800c3ea0c926191d7950cd2365eddc9bb
treefd2479575d90eea9432fb808cc0ed3119197f9bf
parent19e3e6cdfdc73400eb68d1102cdbad4f9493f474
drivers/char/mem: implement splice() for /dev/zero, /dev/full

This allows splicing zeroed pages into a pipe, and allows discarding
pages from a pipe by splicing them to /dev/zero.  Writing to /dev/zero
should have the same effect as writing to /dev/null, and a
"splice_write" implementation exists only for /dev/null.

(The /dev/zero splice_read implementation could be optimized by
pushing references to the global zero page to the pipe, but that's an
optimization for another day.)

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
Link: https://lore.kernel.org/r/20230919073743.1066313-1-max.kellermann@ionos.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/mem.c