Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752359Ab0BWMk6 (ORCPT ); Tue, 23 Feb 2010 07:40:58 -0500 Received: from 81-174-11-161.static.ngi.it ([81.174.11.161]:37743 "EHLO mail.enneenne.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751879Ab0BWMk4 (ORCPT ); Tue, 23 Feb 2010 07:40:56 -0500 From: Rodolfo Giometti To: linux-kernel@vger.kernel.org Cc: Andrew Morton , David Woodhouse , Dave Jones , Sam Ravnborg , Greg KH , Randy Dunlap , Kay Sievers , Alan Cox , "H. Peter Anvin" , Ingo Molnar , Michael Kerrisk , Christoph Hellwig , Alexander Gordeev , Rodolfo Giometti Date: Tue, 23 Feb 2010 13:40:32 +0100 Message-Id: <1266928835-5435-4-git-send-email-giometti@linux.it> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1266928835-5435-3-git-send-email-giometti@linux.it> References: <1266928835-5435-1-git-send-email-giometti@linux.it> <1266928835-5435-2-git-send-email-giometti@linux.it> <1266928835-5435-3-git-send-email-giometti@linux.it> X-SA-Exim-Connect-IP: 192.168.32.37 X-SA-Exim-Mail-From: giometti@enneenne.com Subject: [PATCH 3/6] ldisc n_tty: add new method n_tty_inherit_ops() X-SA-Exim-Version: 4.2.1 (built Wed, 25 Jun 2008 17:14:11 +0000) X-SA-Exim-Scanned: Yes (on mail.enneenne.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1744 Lines: 61 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 --- 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 #include #include +#include #include @@ -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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/