X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/378393581903b274cb7a4d18e0d978071a6b592d..a991bd8d3e7fe02dbca0644054bab73c5b75324a:/bsd/kern/tty_conf.c diff --git a/bsd/kern/tty_conf.c b/bsd/kern/tty_conf.c index 5bf3647b1..51ddadd8c 100644 --- a/bsd/kern/tty_conf.c +++ b/bsd/kern/tty_conf.c @@ -1,25 +1,30 @@ /* - * Copyright (c) 2000 Apple Computer, Inc. All rights reserved. + * Copyright (c) 1997-2006 Apple Computer, Inc. All rights reserved. * - * @APPLE_LICENSE_HEADER_START@ - * - * The contents of this file constitute Original Code as defined in and - * are subject to the Apple Public Source License Version 1.1 (the - * "License"). You may not use this file except in compliance with the - * License. Please obtain a copy of the License at - * http://www.apple.com/publicsource and read it before using this file. - * - * This Original Code and all software distributed under the License are - * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the - * License for the specific language governing rights and limitations - * under the License. - * - * @APPLE_LICENSE_HEADER_END@ + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ -/* Copyright (c) 1997 Apple Computer, Inc. All Rights Reserved */ /*- * Copyright (c) 1982, 1986, 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -69,20 +74,14 @@ #define MAXLDISC 8 #endif -#ifndef NeXT -static l_open_t l_noopen; -static l_close_t l_noclose; -static l_rint_t l_norint; -#else /* NeXT */ -#define l_noopen ((l_open_t *) &enodev) -#define l_noclose ((l_close_t *) &enodev) -#define l_noread ((l_read_t *) &enodev) -#define l_nowrite ((l_write_t *) &enodev) -#define l_norint ((l_rint_t *) &enodev) -#endif /* !NeXT */ +#define l_noopen ((l_open_t *) &enodev) +#define l_noclose ((l_close_t *) &enodev) +#define l_noread ((l_read_t *) &enodev) +#define l_nowrite ((l_write_t *) &enodev) +#define l_norint ((l_rint_t *) &enodev) -static l_ioctl_t l_noioctl; -static l_start_t l_nostart; +static l_ioctl_t l_noioctl; +static l_start_t l_nostart; /* * XXX it probably doesn't matter what the entries other than the l_open @@ -94,27 +93,23 @@ static l_start_t l_nostart; { l_noopen, l_noclose, l_noread, l_nowrite, \ l_noioctl, l_norint, l_nostart, ttymodem } -struct linesw linesw[MAXLDISC] = +struct linesw linesw[MAXLDISC] = { - /* 0- termios */ - { ttyopen, ttylclose, ttread, ttwrite, - l_noioctl, ttyinput, ttwwakeup, ttymodem }, - NODISC(1), /* 1- defunct */ - /* 2- NTTYDISC */ -#if COMPAT_43_TTY - { ttyopen, ttylclose, ttread, ttwrite, - l_noioctl, ttyinput, ttwwakeup, ttymodem }, -#else - NODISC(2), -#endif - NODISC(3), /* TABLDISC */ - NODISC(4), /* SLIPDISC */ - NODISC(5), /* PPPDISC */ - NODISC(6), /* loadable */ - NODISC(7), /* loadable */ + /* 0- termios */ + { ttyopen, ttylclose, ttread, ttwrite, + l_noioctl, ttyinput, ttwwakeup, ttymodem }, + NODISC(1), /* 1- defunct */ + /* 2- NTTYDISC */ + { ttyopen, ttylclose, ttread, ttwrite, + l_noioctl, ttyinput, ttwwakeup, ttymodem }, + NODISC(3), /* TABLDISC */ + NODISC(4), /* SLIPDISC */ + NODISC(5), /* PPPDISC */ + NODISC(6), /* loadable */ + NODISC(7), /* loadable */ }; -int nlinesw = sizeof (linesw) / sizeof (linesw[0]); +const int nlinesw = sizeof(linesw) / sizeof(linesw[0]); static struct linesw nodisc = NODISC(0); @@ -128,25 +123,24 @@ static struct linesw nodisc = NODISC(0); * Returns: Index used or -1 on failure. */ int -ldisc_register(discipline, linesw_p) - int discipline; - struct linesw *linesw_p; +ldisc_register(int discipline, struct linesw *linesw_p) { int slot = -1; if (discipline == LDISC_LOAD) { int i; - for (i = LOADABLE_LDISC; i < MAXLDISC; i++) + for (i = LOADABLE_LDISC; i < MAXLDISC; i++) { if (bcmp(linesw + i, &nodisc, sizeof(nodisc)) == 0) { slot = i; } - } - else if (discipline >= 0 && discipline < MAXLDISC) { + } + } else if (discipline >= 0 && discipline < MAXLDISC) { slot = discipline; } - if (slot != -1 && linesw_p) + if (slot != -1 && linesw_p) { linesw[slot] = *linesw_p; + } return slot; } @@ -158,75 +152,25 @@ ldisc_register(discipline, linesw_p) * discipline: Index for discipline to unload. */ void -ldisc_deregister(discipline) - int discipline; +ldisc_deregister(int discipline) { if (discipline >= LOADABLE_LDISC && discipline < MAXLDISC) { linesw[discipline] = nodisc; } } -#ifndef NeXT -static int -l_noopen(dev, tp) - dev_t dev; - struct tty *tp; -{ - - return (ENODEV); -} - -static int -l_noclose(tp, flag) - struct tty *tp; - int flag; -{ - - return (ENODEV); -} - -int -l_noread(tp, uio, flag) - struct tty *tp; - struct uio *uio; - int flag; -{ - - return (ENODEV); -} - -int -l_nowrite(tp, uio, flag) - struct tty *tp; - struct uio *uio; - int flag; -{ - - return (ENODEV); -} - -static int -l_norint(c, tp) - int c; - struct tty *tp; -{ - - return (ENODEV); -} -#endif /* !NeXT */ - /* * Do nothing specific version of line * discipline specific ioctl command. */ static int l_noioctl(__unused struct tty *tp, __unused u_long cmd, __unused caddr_t data, - __unused int flags, __unused struct proc *p) + __unused int flags, __unused struct proc *p) { - return ENOTTY; } static void l_nostart(__unused struct tty *tp) - { } +{ +}