Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ldisc n_tty: add new method n_tty_inherit_ops()

This new method can be used to init a new struct tty_ldisc_ops as the
default tty_ldisc_N_TTY struct.

Signed-off-by: Rodolfo Giometti <giometti@linux.it>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Greg KH <greg@kroah.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Alexander Gordeev <lasaine@lvk.cs.msu.su>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Rodolfo Giometti and committed by
Linus Torvalds
572b9adb b3e63afe

+18
+17
drivers/char/n_tty.c
··· 48 48 #include <linux/audit.h> 49 49 #include <linux/file.h> 50 50 #include <linux/uaccess.h> 51 + #include <linux/module.h> 51 52 52 53 #include <asm/system.h> 53 54 ··· 2092 2091 .receive_buf = n_tty_receive_buf, 2093 2092 .write_wakeup = n_tty_write_wakeup 2094 2093 }; 2094 + 2095 + /** 2096 + * n_tty_inherit_ops - inherit N_TTY methods 2097 + * @ops: struct tty_ldisc_ops where to save N_TTY methods 2098 + * 2099 + * Used by a generic struct tty_ldisc_ops to easily inherit N_TTY 2100 + * methods. 2101 + */ 2102 + 2103 + void n_tty_inherit_ops(struct tty_ldisc_ops *ops) 2104 + { 2105 + *ops = tty_ldisc_N_TTY; 2106 + ops->owner = NULL; 2107 + ops->refcount = ops->flags = 0; 2108 + } 2109 + EXPORT_SYMBOL_GPL(n_tty_inherit_ops);
+1
include/linux/tty.h
··· 514 514 515 515 /* n_tty.c */ 516 516 extern struct tty_ldisc_ops tty_ldisc_N_TTY; 517 + extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops); 517 518 518 519 /* tty_audit.c */ 519 520 #ifdef CONFIG_AUDIT