]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 21 Jan 2021 00:48:47 +0000 (16:48 -0800)
commitbc6ef0e56c35c6abc7a49da5d56d7653561d6acd
treec0fbc7f3ff3d7525c548911e1132c4c130111af5
parentd8a9b22bc3f472f4cefeafc943cc52b8fdfeaa56
tty: convert tty_ldisc_ops 'read()' function to take a kernel pointer

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>
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