Commit 572b9adb authored by Rodolfo Giometti's avatar Rodolfo Giometti Committed by Linus Torvalds

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: default avatarRodolfo 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent b3e63afe
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include <linux/audit.h> #include <linux/audit.h>
#include <linux/file.h> #include <linux/file.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/module.h>
#include <asm/system.h> #include <asm/system.h>
...@@ -2091,3 +2092,19 @@ struct tty_ldisc_ops tty_ldisc_N_TTY = { ...@@ -2091,3 +2092,19 @@ struct tty_ldisc_ops tty_ldisc_N_TTY = {
.receive_buf = n_tty_receive_buf, .receive_buf = n_tty_receive_buf,
.write_wakeup = n_tty_write_wakeup .write_wakeup = n_tty_write_wakeup
}; };
/**
* n_tty_inherit_ops - inherit N_TTY methods
* @ops: struct tty_ldisc_ops where to save N_TTY methods
*
* Used by a generic struct tty_ldisc_ops to easily inherit N_TTY
* methods.
*/
void n_tty_inherit_ops(struct tty_ldisc_ops *ops)
{
*ops = tty_ldisc_N_TTY;
ops->owner = NULL;
ops->refcount = ops->flags = 0;
}
EXPORT_SYMBOL_GPL(n_tty_inherit_ops);
...@@ -514,6 +514,7 @@ extern void tty_ldisc_enable(struct tty_struct *tty); ...@@ -514,6 +514,7 @@ extern void tty_ldisc_enable(struct tty_struct *tty);
/* n_tty.c */ /* n_tty.c */
extern struct tty_ldisc_ops tty_ldisc_N_TTY; extern struct tty_ldisc_ops tty_ldisc_N_TTY;
extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
/* tty_audit.c */ /* tty_audit.c */
#ifdef CONFIG_AUDIT #ifdef CONFIG_AUDIT
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment