diff options
| author | Rodolfo Giometti <giometti@linux.it> | 2010-03-10 18:23:46 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-03-12 18:52:43 -0500 |
| commit | 572b9adbd40b5565dc413db04af9cc234f72bf19 (patch) | |
| tree | 038e00dc5f3b5b1e8835b083df7dccabb2cfd88f | |
| parent | b3e63afe8a74c0134d05a551cc74facc3b3ec0d7 (diff) | |
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>
| -rw-r--r-- | drivers/char/n_tty.c | 17 | ||||
| -rw-r--r-- | include/linux/tty.h | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index 2e50f4dfc79c..bdae8327143c 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
| @@ -48,6 +48,7 @@ | |||
| 48 | #include <linux/audit.h> | 48 | #include <linux/audit.h> |
| 49 | #include <linux/file.h> | 49 | #include <linux/file.h> |
| 50 | #include <linux/uaccess.h> | 50 | #include <linux/uaccess.h> |
| 51 | #include <linux/module.h> | ||
| 51 | 52 | ||
| 52 | #include <asm/system.h> | 53 | #include <asm/system.h> |
| 53 | 54 | ||
| @@ -2091,3 +2092,19 @@ struct tty_ldisc_ops tty_ldisc_N_TTY = { | |||
| 2091 | .receive_buf = n_tty_receive_buf, | 2092 | .receive_buf = n_tty_receive_buf, |
| 2092 | .write_wakeup = n_tty_write_wakeup | 2093 | .write_wakeup = n_tty_write_wakeup |
| 2093 | }; | 2094 | }; |
| 2095 | |||
| 2096 | /** | ||
| 2097 | * n_tty_inherit_ops - inherit N_TTY methods | ||
| 2098 | * @ops: struct tty_ldisc_ops where to save N_TTY methods | ||
| 2099 | * | ||
| 2100 | * Used by a generic struct tty_ldisc_ops to easily inherit N_TTY | ||
| 2101 | * methods. | ||
| 2102 | */ | ||
| 2103 | |||
| 2104 | void n_tty_inherit_ops(struct tty_ldisc_ops *ops) | ||
| 2105 | { | ||
| 2106 | *ops = tty_ldisc_N_TTY; | ||
| 2107 | ops->owner = NULL; | ||
| 2108 | ops->refcount = ops->flags = 0; | ||
| 2109 | } | ||
| 2110 | EXPORT_SYMBOL_GPL(n_tty_inherit_ops); | ||
diff --git a/include/linux/tty.h b/include/linux/tty.h index d96e5882f129..568369a86306 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
| @@ -514,6 +514,7 @@ extern void tty_ldisc_enable(struct tty_struct *tty); | |||
| 514 | 514 | ||
| 515 | /* n_tty.c */ | 515 | /* n_tty.c */ |
| 516 | extern struct tty_ldisc_ops tty_ldisc_N_TTY; | 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 | /* tty_audit.c */ | 519 | /* tty_audit.c */ |
| 519 | #ifdef CONFIG_AUDIT | 520 | #ifdef CONFIG_AUDIT |
