• L
    tty: convert tty_ldisc_ops 'read()' function to take a kernel pointer · 9b13155f
    Linus Torvalds 提交于
    stable inclusion
    from stable-5.10.20
    commit 279e54536ddbb4dbd337fca74926b68651160043
    bugzilla: 50608
    
    --------------------------------
    
    [ Upstream commit 3b830a9c ]
    
    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: NLinus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: NSasha Levin <sashal@kernel.org>
    Signed-off-by: NChen Jun <chenjun102@huawei.com>
    Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
    Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
    9b13155f
hci_ldisc.c 19.9 KB