[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1267101671-23575-4-git-send-email-giometti@linux.it>
Date: Thu, 25 Feb 2010 13:41:08 +0100
From: Rodolfo Giometti <giometti@...ux.it>
To: linux-kernel@...r.kernel.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
David Woodhouse <dwmw2@...radead.org>,
Dave Jones <davej@...hat.com>, Sam Ravnborg <sam@...nborg.org>,
Greg KH <greg@...ah.com>,
Randy Dunlap <randy.dunlap@...cle.com>,
Kay Sievers <kay.sievers@...y.org>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...e.hu>,
Michael Kerrisk <mtk.manpages@...il.com>,
Christoph Hellwig <hch@...radead.org>,
Alexander Gordeev <lasaine@....cs.msu.su>,
Rodolfo Giometti <giometti@...ux.it>
Subject: [PATCH 3/6] 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@...ux.it>
---
drivers/char/n_tty.c | 17 +++++++++++++++++
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 2e50f4d..bdae832 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -48,6 +48,7 @@
#include <linux/audit.h>
#include <linux/file.h>
#include <linux/uaccess.h>
+#include <linux/module.h>
#include <asm/system.h>
@@ -2091,3 +2092,19 @@ struct tty_ldisc_ops tty_ldisc_N_TTY = {
.receive_buf = n_tty_receive_buf,
.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);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 6abfcf5..d6cc652 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -504,6 +504,7 @@ extern void tty_ldisc_enable(struct tty_struct *tty);
/* n_tty.c */
extern struct tty_ldisc_ops tty_ldisc_N_TTY;
+extern void n_tty_inherit_ops(struct tty_ldisc_ops *ops);
/* tty_audit.c */
#ifdef CONFIG_AUDIT
--
1.6.3.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists