Home | History | Annotate | Line # | Download | only in kern
tty_conf.c revision 1.47.8.1
      1  1.47.8.1      yamt /*	$NetBSD: tty_conf.c,v 1.47.8.1 2005/11/29 21:23:29 yamt Exp $	*/
      2  1.47.8.1      yamt 
      3  1.47.8.1      yamt /*-
      4  1.47.8.1      yamt  * Copyright (c) 2005 The NetBSD Foundation, Inc.
      5  1.47.8.1      yamt  * All rights reserved.
      6  1.47.8.1      yamt  *
      7  1.47.8.1      yamt  * This code is derived from software contributed to The NetBSD Foundation
      8  1.47.8.1      yamt  * by Jason R. Thorpe.
      9  1.47.8.1      yamt  *
     10  1.47.8.1      yamt  * Redistribution and use in source and binary forms, with or without
     11  1.47.8.1      yamt  * modification, are permitted provided that the following conditions
     12  1.47.8.1      yamt  * are met:
     13  1.47.8.1      yamt  * 1. Redistributions of source code must retain the above copyright
     14  1.47.8.1      yamt  *    notice, this list of conditions and the following disclaimer.
     15  1.47.8.1      yamt  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.47.8.1      yamt  *    notice, this list of conditions and the following disclaimer in the
     17  1.47.8.1      yamt  *    documentation and/or other materials provided with the distribution.
     18  1.47.8.1      yamt  * 3. All advertising materials mentioning features or use of this software
     19  1.47.8.1      yamt  *    must display the following acknowledgement:
     20  1.47.8.1      yamt  *	This product includes software developed by the NetBSD
     21  1.47.8.1      yamt  *	Foundation, Inc. and its contributors.
     22  1.47.8.1      yamt  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.47.8.1      yamt  *    contributors may be used to endorse or promote products derived
     24  1.47.8.1      yamt  *    from this software without specific prior written permission.
     25  1.47.8.1      yamt  *
     26  1.47.8.1      yamt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.47.8.1      yamt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.47.8.1      yamt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.47.8.1      yamt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.47.8.1      yamt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.47.8.1      yamt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.47.8.1      yamt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.47.8.1      yamt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.47.8.1      yamt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.47.8.1      yamt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.47.8.1      yamt  * POSSIBILITY OF SUCH DAMAGE.
     37  1.47.8.1      yamt  */
     38      1.14       cgd 
     39      1.10       cgd /*-
     40      1.10       cgd  * Copyright (c) 1982, 1986, 1991, 1993
     41      1.10       cgd  *	The Regents of the University of California.  All rights reserved.
     42      1.10       cgd  * (c) UNIX System Laboratories, Inc.
     43      1.10       cgd  * All or some portions of this file are derived from material licensed
     44      1.10       cgd  * to the University of California by American Telephone and Telegraph
     45      1.10       cgd  * Co. or Unix System Laboratories, Inc. and are reproduced herein with
     46      1.10       cgd  * the permission of UNIX System Laboratories, Inc.
     47      1.10       cgd  *
     48      1.10       cgd  * Redistribution and use in source and binary forms, with or without
     49      1.10       cgd  * modification, are permitted provided that the following conditions
     50      1.10       cgd  * are met:
     51      1.10       cgd  * 1. Redistributions of source code must retain the above copyright
     52      1.10       cgd  *    notice, this list of conditions and the following disclaimer.
     53      1.10       cgd  * 2. Redistributions in binary form must reproduce the above copyright
     54      1.10       cgd  *    notice, this list of conditions and the following disclaimer in the
     55      1.10       cgd  *    documentation and/or other materials provided with the distribution.
     56      1.43       agc  * 3. Neither the name of the University nor the names of its contributors
     57      1.10       cgd  *    may be used to endorse or promote products derived from this software
     58      1.10       cgd  *    without specific prior written permission.
     59      1.10       cgd  *
     60      1.10       cgd  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     61      1.10       cgd  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     62      1.10       cgd  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     63      1.10       cgd  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     64      1.10       cgd  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     65      1.10       cgd  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     66      1.10       cgd  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     67      1.10       cgd  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     68      1.10       cgd  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     69      1.10       cgd  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     70      1.10       cgd  * SUCH DAMAGE.
     71      1.10       cgd  *
     72      1.20      fvdl  *	@(#)tty_conf.c	8.5 (Berkeley) 1/9/95
     73      1.10       cgd  */
     74      1.35     lukem 
     75      1.35     lukem #include <sys/cdefs.h>
     76  1.47.8.1      yamt __KERNEL_RCSID(0, "$NetBSD: tty_conf.c,v 1.47.8.1 2005/11/29 21:23:29 yamt Exp $");
     77      1.10       cgd 
     78      1.10       cgd #include <sys/param.h>
     79      1.10       cgd #include <sys/systm.h>
     80      1.47        ws #include <sys/poll.h>
     81      1.10       cgd #include <sys/proc.h>
     82      1.10       cgd #include <sys/tty.h>
     83      1.28       eeh #include <sys/ttycom.h>
     84      1.10       cgd #include <sys/conf.h>
     85  1.47.8.1      yamt #include <sys/once.h>
     86  1.47.8.1      yamt #include <sys/lock.h>
     87  1.47.8.1      yamt #include <sys/queue.h>
     88  1.47.8.1      yamt 
     89  1.47.8.1      yamt static struct linesw termios_disc = {
     90  1.47.8.1      yamt 	.l_name = "termios",
     91  1.47.8.1      yamt 	.l_open = ttylopen,
     92  1.47.8.1      yamt 	.l_close = ttylclose,
     93  1.47.8.1      yamt 	.l_read = ttread,
     94  1.47.8.1      yamt 	.l_write = ttwrite,
     95  1.47.8.1      yamt 	.l_ioctl = ttynullioctl,
     96  1.47.8.1      yamt 	.l_rint = ttyinput,
     97  1.47.8.1      yamt 	.l_start = ttstart,
     98  1.47.8.1      yamt 	.l_modem = ttymodem,
     99  1.47.8.1      yamt 	.l_poll = ttpoll
    100  1.47.8.1      yamt };
    101      1.10       cgd 
    102  1.47.8.1      yamt /*
    103  1.47.8.1      yamt  * This is for the benefit of old BSD TTY compatbility, but since it is
    104  1.47.8.1      yamt  * identical to termios (except for the name), don't bother conditionalizing
    105  1.47.8.1      yamt  * it.
    106  1.47.8.1      yamt  */
    107  1.47.8.1      yamt static struct linesw ntty_disc = {	/* old NTTYDISC */
    108  1.47.8.1      yamt 	.l_name = "ntty",
    109  1.47.8.1      yamt 	.l_open = ttylopen,
    110  1.47.8.1      yamt 	.l_close = ttylclose,
    111  1.47.8.1      yamt 	.l_read = ttread,
    112  1.47.8.1      yamt 	.l_write = ttwrite,
    113  1.47.8.1      yamt 	.l_ioctl = ttynullioctl,
    114  1.47.8.1      yamt 	.l_rint = ttyinput,
    115  1.47.8.1      yamt 	.l_start = ttstart,
    116  1.47.8.1      yamt 	.l_modem = ttymodem,
    117  1.47.8.1      yamt 	.l_poll = ttpoll
    118  1.47.8.1      yamt };
    119      1.36  augustss 
    120  1.47.8.1      yamt static LIST_HEAD(, linesw) ttyldisc_list = LIST_HEAD_INITIALIZER(ttyldisc_head);
    121  1.47.8.1      yamt static struct simplelock ttyldisc_list_slock = SIMPLELOCK_INITIALIZER;
    122      1.25       eeh 
    123      1.25       eeh /*
    124  1.47.8.1      yamt  * Note: We don't bother refcounting termios_disc and ntty_disc; they can't
    125  1.47.8.1      yamt  * be removed from the list, and termios_disc is likely to have very many
    126  1.47.8.1      yamt  * references (could we overflow the count?).
    127      1.25       eeh  */
    128  1.47.8.1      yamt #define	TTYLDISC_ISSTATIC(disc)					\
    129  1.47.8.1      yamt 	((disc) == &termios_disc || (disc) == &ntty_disc)
    130  1.47.8.1      yamt 
    131  1.47.8.1      yamt #define	TTYLDISC_HOLD(disc)					\
    132  1.47.8.1      yamt do {								\
    133  1.47.8.1      yamt 	if (! TTYLDISC_ISSTATIC(disc)) {			\
    134  1.47.8.1      yamt 		KASSERT((disc)->l_refcnt != UINT_MAX);		\
    135  1.47.8.1      yamt 		(disc)->l_refcnt++;				\
    136  1.47.8.1      yamt 	}							\
    137  1.47.8.1      yamt } while (/*CONSTCOND*/0)
    138  1.47.8.1      yamt 
    139  1.47.8.1      yamt #define	TTYLDISC_RELE(disc)					\
    140  1.47.8.1      yamt do {								\
    141  1.47.8.1      yamt 	if (! TTYLDISC_ISSTATIC(disc)) {			\
    142  1.47.8.1      yamt 		KASSERT((disc)->l_refcnt != 0);			\
    143  1.47.8.1      yamt 		(disc)->l_refcnt--;				\
    144  1.47.8.1      yamt 	}							\
    145  1.47.8.1      yamt } while (/*CONSTCOND*/0)
    146  1.47.8.1      yamt 
    147  1.47.8.1      yamt #define	TTYLDISC_ISINUSE(disc)					\
    148  1.47.8.1      yamt 	(TTYLDISC_ISSTATIC(disc) || (disc)->l_refcnt != 0)
    149      1.10       cgd 
    150      1.10       cgd /*
    151      1.10       cgd  * Do nothing specific version of line
    152      1.10       cgd  * discipline specific ioctl command.
    153      1.10       cgd  */
    154      1.10       cgd /*ARGSUSED*/
    155      1.17  christos int
    156  1.47.8.1      yamt ttynullioctl(struct tty *tp, u_long cmd, char *data, int flags, struct proc *p)
    157      1.10       cgd {
    158      1.10       cgd 
    159      1.10       cgd #ifdef lint
    160      1.42      fvdl 	tp = tp; data = data; flags = flags; p = p;
    161      1.10       cgd #endif
    162      1.38    atatat 	return (EPASSTHROUGH);
    163      1.28       eeh }
    164      1.28       eeh 
    165      1.28       eeh /*
    166      1.47        ws  * Return error to line discipline
    167      1.47        ws  * specific poll call.
    168      1.47        ws  */
    169      1.47        ws /*ARGSUSED*/
    170      1.47        ws int
    171  1.47.8.1      yamt ttyerrpoll(struct tty *tp, int events, struct proc *p)
    172      1.47        ws {
    173      1.47        ws 
    174      1.47        ws #ifdef lint
    175      1.47        ws 	tp = tp; events = events; p = p;
    176      1.47        ws #endif
    177      1.47        ws 	return (POLLERR);
    178      1.47        ws }
    179      1.47        ws 
    180  1.47.8.1      yamt static ONCE_DECL(ttyldisc_init_once);
    181      1.28       eeh 
    182  1.47.8.1      yamt static void
    183  1.47.8.1      yamt ttyldisc_init(void)
    184  1.47.8.1      yamt {
    185      1.28       eeh 
    186  1.47.8.1      yamt 	if (ttyldisc_attach(&termios_disc) != 0)
    187  1.47.8.1      yamt 		panic("ttyldisc_init: termios_disc");
    188  1.47.8.1      yamt 	if (ttyldisc_attach(&ntty_disc) != 0)
    189  1.47.8.1      yamt 		panic("ttyldisc_init: ntty_disc");
    190  1.47.8.1      yamt }
    191      1.28       eeh 
    192  1.47.8.1      yamt static struct linesw *
    193  1.47.8.1      yamt ttyldisc_lookup_locked(const char *name)
    194  1.47.8.1      yamt {
    195  1.47.8.1      yamt 	struct linesw *disc;
    196      1.28       eeh 
    197  1.47.8.1      yamt 	LIST_FOREACH(disc, &ttyldisc_list, l_list) {
    198  1.47.8.1      yamt 		if (strcmp(name, disc->l_name) == 0)
    199  1.47.8.1      yamt 			return (disc);
    200      1.28       eeh 	}
    201      1.28       eeh 
    202  1.47.8.1      yamt 	return (NULL);
    203  1.47.8.1      yamt }
    204  1.47.8.1      yamt 
    205  1.47.8.1      yamt /*
    206  1.47.8.1      yamt  * Look up a line discipline by its name.  Caller holds a reference on
    207  1.47.8.1      yamt  * the returned line discipline.
    208  1.47.8.1      yamt  */
    209  1.47.8.1      yamt struct linesw *
    210  1.47.8.1      yamt ttyldisc_lookup(const char *name)
    211  1.47.8.1      yamt {
    212  1.47.8.1      yamt 	struct linesw *disc;
    213  1.47.8.1      yamt 
    214  1.47.8.1      yamt 	RUN_ONCE(&ttyldisc_init_once, ttyldisc_init);
    215      1.44  junyoung 
    216  1.47.8.1      yamt 	simple_lock(&ttyldisc_list_slock);
    217  1.47.8.1      yamt 	disc = ttyldisc_lookup_locked(name);
    218  1.47.8.1      yamt 	if (disc != NULL)
    219  1.47.8.1      yamt 		TTYLDISC_HOLD(disc);
    220  1.47.8.1      yamt 	simple_unlock(&ttyldisc_list_slock);
    221  1.47.8.1      yamt 
    222  1.47.8.1      yamt 	return (disc);
    223      1.28       eeh }
    224      1.28       eeh 
    225      1.28       eeh /*
    226  1.47.8.1      yamt  * Look up a line discipline by its legacy number.  Caller holds a
    227  1.47.8.1      yamt  * reference on the returned line discipline.
    228      1.28       eeh  */
    229      1.28       eeh struct linesw *
    230  1.47.8.1      yamt ttyldisc_lookup_bynum(int num)
    231      1.28       eeh {
    232      1.28       eeh 	struct linesw *disc;
    233      1.28       eeh 
    234  1.47.8.1      yamt 	RUN_ONCE(&ttyldisc_init_once, ttyldisc_init);
    235      1.28       eeh 
    236  1.47.8.1      yamt 	simple_lock(&ttyldisc_list_slock);
    237  1.47.8.1      yamt 
    238  1.47.8.1      yamt 	LIST_FOREACH(disc, &ttyldisc_list, l_list) {
    239  1.47.8.1      yamt 		if (disc->l_no == num) {
    240  1.47.8.1      yamt 			TTYLDISC_HOLD(disc);
    241  1.47.8.1      yamt 			simple_unlock(&ttyldisc_list_slock);
    242      1.28       eeh 			return (disc);
    243      1.28       eeh 		}
    244      1.28       eeh 	}
    245  1.47.8.1      yamt 
    246  1.47.8.1      yamt 	simple_unlock(&ttyldisc_list_slock);
    247      1.28       eeh 	return (NULL);
    248      1.28       eeh }
    249      1.28       eeh 
    250      1.28       eeh /*
    251  1.47.8.1      yamt  * Release a reference on a line discipline previously added by
    252  1.47.8.1      yamt  * ttyldisc_lookup() or ttyldisc_lookup_bynum().
    253      1.28       eeh  */
    254  1.47.8.1      yamt void
    255  1.47.8.1      yamt ttyldisc_release(struct linesw *disc)
    256      1.28       eeh {
    257      1.28       eeh 
    258  1.47.8.1      yamt 	if (disc == NULL)
    259  1.47.8.1      yamt 		return;
    260  1.47.8.1      yamt 
    261  1.47.8.1      yamt 	simple_lock(&ttyldisc_list_slock);
    262  1.47.8.1      yamt 	TTYLDISC_RELE(disc);
    263  1.47.8.1      yamt 	simple_unlock(&ttyldisc_list_slock);
    264      1.28       eeh }
    265      1.28       eeh 
    266  1.47.8.1      yamt #define	TTYLDISC_LEGACY_NUMBER_MIN	10
    267  1.47.8.1      yamt #define	TTYLDISC_LEGACY_NUMBER_MAX	INT_MAX
    268  1.47.8.1      yamt 
    269  1.47.8.1      yamt static void
    270  1.47.8.1      yamt ttyldisc_assign_legacy_number(struct linesw *disc)
    271  1.47.8.1      yamt {
    272  1.47.8.1      yamt 	static const struct {
    273  1.47.8.1      yamt 		const char *name;
    274  1.47.8.1      yamt 		int num;
    275  1.47.8.1      yamt 	} table[] = {
    276  1.47.8.1      yamt 		{ "termios",		TTYDISC },
    277  1.47.8.1      yamt 		{ "ntty",		2 /* XXX old NTTYDISC */ },
    278  1.47.8.1      yamt 		{ "tablet",		TABLDISC },
    279  1.47.8.1      yamt 		{ "slip",		SLIPDISC },
    280  1.47.8.1      yamt 		{ "ppp",		PPPDISC },
    281  1.47.8.1      yamt 		{ "strip",		STRIPDISC },
    282  1.47.8.1      yamt 		{ "hdlc",		HDLCDISC },
    283  1.47.8.1      yamt 		{ NULL,			0 }
    284  1.47.8.1      yamt 	};
    285  1.47.8.1      yamt 	struct linesw *ldisc;
    286  1.47.8.1      yamt 	int i;
    287  1.47.8.1      yamt 
    288  1.47.8.1      yamt 	for (i = 0; table[i].name != NULL; i++) {
    289  1.47.8.1      yamt 		if (strcmp(disc->l_name, table[i].name) == 0) {
    290  1.47.8.1      yamt 			disc->l_no = table[i].num;
    291  1.47.8.1      yamt 			return;
    292  1.47.8.1      yamt 		}
    293  1.47.8.1      yamt 	}
    294  1.47.8.1      yamt 
    295  1.47.8.1      yamt 	disc->l_no = TTYLDISC_LEGACY_NUMBER_MIN;
    296  1.47.8.1      yamt 
    297  1.47.8.1      yamt 	LIST_FOREACH(ldisc, &ttyldisc_list, l_list) {
    298  1.47.8.1      yamt 		if (disc->l_no == ldisc->l_no) {
    299  1.47.8.1      yamt 			KASSERT(disc->l_no < TTYLDISC_LEGACY_NUMBER_MAX);
    300  1.47.8.1      yamt 			disc->l_no++;
    301  1.47.8.1      yamt 		}
    302  1.47.8.1      yamt 	}
    303  1.47.8.1      yamt }
    304      1.28       eeh 
    305      1.28       eeh /*
    306  1.47.8.1      yamt  * Register a line discipline.
    307      1.44  junyoung  */
    308  1.47.8.1      yamt int
    309  1.47.8.1      yamt ttyldisc_attach(struct linesw *disc)
    310      1.29     enami {
    311      1.29     enami 
    312  1.47.8.1      yamt 	KASSERT(disc->l_name != NULL);
    313  1.47.8.1      yamt 	KASSERT(disc->l_open != NULL);
    314  1.47.8.1      yamt 	KASSERT(disc->l_close != NULL);
    315  1.47.8.1      yamt 	KASSERT(disc->l_read != NULL);
    316  1.47.8.1      yamt 	KASSERT(disc->l_write != NULL);
    317  1.47.8.1      yamt 	KASSERT(disc->l_ioctl != NULL);
    318  1.47.8.1      yamt 	KASSERT(disc->l_rint != NULL);
    319  1.47.8.1      yamt 	KASSERT(disc->l_start != NULL);
    320  1.47.8.1      yamt 	KASSERT(disc->l_modem != NULL);
    321  1.47.8.1      yamt 	KASSERT(disc->l_poll != NULL);
    322      1.28       eeh 
    323  1.47.8.1      yamt 	/* You are not allowed to exceed TTLINEDNAMELEN */
    324  1.47.8.1      yamt 	if (strlen(disc->l_name) >= TTLINEDNAMELEN)
    325  1.47.8.1      yamt 		return (ENAMETOOLONG);
    326      1.28       eeh 
    327  1.47.8.1      yamt 	simple_lock(&ttyldisc_list_slock);
    328  1.47.8.1      yamt 
    329  1.47.8.1      yamt 	if (ttyldisc_lookup_locked(disc->l_name) != NULL) {
    330  1.47.8.1      yamt 		simple_unlock(&ttyldisc_list_slock);
    331  1.47.8.1      yamt 		return (EEXIST);
    332  1.47.8.1      yamt 	}
    333  1.47.8.1      yamt 
    334  1.47.8.1      yamt 	ttyldisc_assign_legacy_number(disc);
    335  1.47.8.1      yamt 	LIST_INSERT_HEAD(&ttyldisc_list, disc, l_list);
    336  1.47.8.1      yamt 
    337  1.47.8.1      yamt 	simple_unlock(&ttyldisc_list_slock);
    338  1.47.8.1      yamt 
    339  1.47.8.1      yamt 	return (0);
    340  1.47.8.1      yamt }
    341  1.47.8.1      yamt 
    342  1.47.8.1      yamt /*
    343  1.47.8.1      yamt  * Remove a line discipline.
    344  1.47.8.1      yamt  */
    345  1.47.8.1      yamt int
    346  1.47.8.1      yamt ttyldisc_detach(struct linesw *disc)
    347  1.47.8.1      yamt {
    348  1.47.8.1      yamt #ifdef DIAGNOSTIC
    349  1.47.8.1      yamt 	struct linesw *ldisc = ttyldisc_lookup(disc->l_name);
    350  1.47.8.1      yamt 
    351  1.47.8.1      yamt 	KASSERT(ldisc != NULL);
    352  1.47.8.1      yamt 	KASSERT(ldisc == disc);
    353  1.47.8.1      yamt 	ttyldisc_release(ldisc);
    354      1.28       eeh #endif
    355  1.47.8.1      yamt 
    356  1.47.8.1      yamt 	simple_lock(&ttyldisc_list_slock);
    357  1.47.8.1      yamt 
    358  1.47.8.1      yamt 	if (TTYLDISC_ISINUSE(disc)) {
    359  1.47.8.1      yamt 		simple_unlock(&ttyldisc_list_slock);
    360  1.47.8.1      yamt 		return (EBUSY);
    361  1.47.8.1      yamt 	}
    362  1.47.8.1      yamt 
    363  1.47.8.1      yamt 	LIST_REMOVE(disc, l_list);
    364  1.47.8.1      yamt 
    365  1.47.8.1      yamt 	simple_unlock(&ttyldisc_list_slock);
    366  1.47.8.1      yamt 
    367  1.47.8.1      yamt 	return (0);
    368  1.47.8.1      yamt }
    369  1.47.8.1      yamt 
    370  1.47.8.1      yamt /*
    371  1.47.8.1      yamt  * Return the default line discipline.
    372  1.47.8.1      yamt  */
    373  1.47.8.1      yamt struct linesw *
    374  1.47.8.1      yamt ttyldisc_default(void)
    375  1.47.8.1      yamt {
    376  1.47.8.1      yamt 
    377  1.47.8.1      yamt 	return (&termios_disc);
    378      1.10       cgd }
    379