]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit - drivers/tty/n_tracesink.c
tty: convert tty_ldisc_ops 'read()' function to take a kernel pointer
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 18 Jan 2021 21:31:30 +0000 (13:31 -0800)
committerAndrea Righi <andrea.righi@canonical.com>
Mon, 15 Mar 2021 14:09:01 +0000 (15:09 +0100)
commit242570aacc218c44e3bc0034154148bdc448abc5
treeb2c9c64a9ff985d5c55447fe2b9f511b83b9b957
parentd6306ea7a5e75f8aed870857ac5ca79b4d29ad58
tty: convert tty_ldisc_ops 'read()' function to take a kernel pointer

[ Upstream commit 3b830a9c34d5897be07176ce4e6f2d75e2c8cfd7 ]

The tty line discipline .read() function was passed the final user
pointer destination as an argument, which doesn't match the 'write()'
function, and makes it very inconvenient to do a splice method for
ttys.

This is a conversion to use a kernel buffer instead.

NOTE! It does this by passing the tty line discipline ->read() function
an additional "cookie" to fill in, and an offset into the cookie data.

The line discipline can fill in the cookie data with its own private
information, and then the reader will repeat the read until either the
cookie is cleared or it runs out of data.

The only real user of this is N_HDLC, which can use this to handle big
packets, even if the kernel buffer is smaller than the whole packet.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
14 files changed:
drivers/bluetooth/hci_ldisc.c
drivers/input/serio/serport.c
drivers/net/ppp/ppp_async.c
drivers/net/ppp/ppp_synctty.c
drivers/tty/n_gsm.c
drivers/tty/n_hdlc.c
drivers/tty/n_null.c
drivers/tty/n_r3964.c
drivers/tty/n_tracerouter.c
drivers/tty/n_tracesink.c
drivers/tty/n_tty.c
drivers/tty/tty_io.c
include/linux/tty_ldisc.h
net/nfc/nci/uart.c