diff options
author | bde <bde@FreeBSD.org> | 1995-11-05 20:25:59 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1995-11-05 20:25:59 +0000 |
commit | d461b5899dc0ba4686df948588f1fb15f2133fb7 (patch) | |
tree | 0502a1ef0d7f58dedecd38161993cff25de03939 /sys | |
parent | 1bebc101f8240ac40ce3c1d39f59089ad85ddf1f (diff) | |
download | FreeBSD-src-d461b5899dc0ba4686df948588f1fb15f2133fb7.zip FreeBSD-src-d461b5899dc0ba4686df948588f1fb15f2133fb7.tar.gz |
Replaced bogus macros for entry points to unconfigured line disciplines
by functions.
tty_conf.c:
Cleaned up formatting of tables.
Removed another ARGSUSED for consistency.
conf.h:
Introduced typedefs for line discipline functions.
Backed out most of previous revision (it is done elsewhere).
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/tty_conf.c | 133 | ||||
-rw-r--r-- | sys/net/if_sl.c | 11 | ||||
-rw-r--r-- | sys/sys/conf.h | 38 | ||||
-rw-r--r-- | sys/sys/linedisc.h | 38 |
4 files changed, 138 insertions, 82 deletions
diff --git a/sys/kern/tty_conf.c b/sys/kern/tty_conf.c index 608c259..4cca2e6 100644 --- a/sys/kern/tty_conf.c +++ b/sys/kern/tty_conf.c @@ -36,70 +36,57 @@ * SUCH DAMAGE. * * @(#)tty_conf.c 8.4 (Berkeley) 1/21/94 - * $Id: tty_conf.c,v 1.6 1995/05/30 08:06:10 rgrimes Exp $ + * $Id: tty_conf.c,v 1.7 1995/07/29 13:35:34 bde Exp $ */ #include <sys/param.h> #include <sys/systm.h> -#include <sys/buf.h> -#include <sys/ioctl.h> -#include <sys/proc.h> #include <sys/tty.h> #include <sys/conf.h> -#define ttynodisc ((int (*) __P((dev_t, struct tty *)))enodev) -#define ttyerrclose ((int (*) __P((struct tty *, int flags)))enodev) -#define ttyerrio ((int (*) __P((struct tty *, struct uio *, int)))enodev) -#define ttyerrinput ((int (*) __P((int c, struct tty *)))enodev) -#define ttyerrstart ((int (*) __P((struct tty *)))enodev) - -int nullioctl __P((struct tty *tp, int cmd, caddr_t data, - int flag, struct proc *p)); - #ifndef MAXLDISC #define MAXLDISC 8 #endif +static l_open_t l_noopen; +static l_close_t l_noclose; +static l_ioctl_t l_nullioctl; +static l_rint_t l_norint; +static l_start_t l_nostart; + +/* + * XXX it probably doesn't matter what the entries other than the l_open + * entry are here. The l_nullioctl and ttymodem entries still look fishy. + * Reconsider the removal of nullmodem anyway. It was too much like + * ttymodem, but a completely null version might be useful. + */ #define NODISC(n) \ - { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, \ - ttyerrinput, ttyerrstart, ttymodem }, + { l_noopen, l_noclose, l_noread, l_nowrite, \ + l_nullioctl, l_norint, l_nostart, ttymodem } struct linesw linesw[MAXLDISC] = { - { ttyopen, ttylclose, ttread, ttwrite, nullioctl, - ttyinput, ttstart, ttymodem }, /* 0- termios */ - - { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, - ttyerrinput, ttyerrstart, ttymodem }, /* 1- defunct */ - + /* 0- termios */ + { ttyopen, ttylclose, ttread, ttwrite, + l_nullioctl, ttyinput, ttstart, ttymodem }, + NODISC(1), /* 1- defunct */ + /* 2- NTTYDISC */ #ifdef COMPAT_43 - { ttyopen, ttylclose, ttread, ttwrite, nullioctl, - ttyinput, ttstart, ttymodem }, /* 2- NTTYDISC */ + { ttyopen, ttylclose, ttread, ttwrite, + l_nullioctl, ttyinput, ttstart, ttymodem }, #else - { ttynodisc, ttyerrclose, ttyerrio, ttyerrio, nullioctl, - ttyerrinput, ttyerrstart, ttymodem }, + NODISC(2), #endif - - NODISC(3) /* TABLDISC */ - NODISC(4) /* SLIPDISC */ - NODISC(5) /* PPPDISC */ - NODISC(6) /* loadable */ - NODISC(7) /* loadable */ + NODISC(3), /* TABLDISC */ + NODISC(4), /* SLIPDISC */ + NODISC(5), /* PPPDISC */ + NODISC(6), /* loadable */ + NODISC(7), /* loadable */ }; int nlinesw = sizeof (linesw) / sizeof (linesw[0]); -static struct linesw nodisc = -{ - ttynodisc, - ttyerrclose, - ttyerrio, - ttyerrio, - nullioctl, - ttyerrinput, - ttyerrstart, - ttymodem -}; +static struct linesw nodisc = NODISC(0); #define LOADABLE_LDISC 6 /* @@ -149,14 +136,67 @@ ldisc_deregister(discipline) } } +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); +} + +static int +l_nostart(tp) + struct tty *tp; +{ + + return (ENODEV); +} /* * Do nothing specific version of line * discipline specific ioctl command. */ -/*ARGSUSED*/ -int -nullioctl(tp, cmd, data, flags, p) +static int +l_nullioctl(tp, cmd, data, flags, p) struct tty *tp; int cmd; char *data; @@ -164,8 +204,5 @@ nullioctl(tp, cmd, data, flags, p) struct proc *p; { -#ifdef lint - tp = tp; data = data; flags = flags; p = p; -#endif return (-1); } diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index 67bf528..acfa65e 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)if_sl.c 8.6 (Berkeley) 2/1/94 - * $Id: if_sl.c,v 1.32 1995/09/17 23:38:29 ache Exp $ + * $Id: if_sl.c,v 1.33 1995/10/31 19:22:30 peter Exp $ */ /* @@ -189,11 +189,10 @@ static struct mbuf *sl_btom __P((struct sl_softc *, int)); static timeout_t sl_keepalive; static timeout_t sl_outfill; -#define ttyerrio ((int (*) __P((struct tty *, struct uio *, int)))enodev) - -static struct linesw slipdisc = - { slopen, slclose, ttyerrio, ttyerrio, sltioctl, - slinput, slstart, ttymodem }; +static struct linesw slipdisc = { + slopen, slclose, l_noread, l_nowrite, + sltioctl, slinput, slstart, ttymodem +}; /* * Called from boot code to establish sl interfaces. diff --git a/sys/sys/conf.h b/sys/sys/conf.h index acba200..d9a9fbc 100644 --- a/sys/sys/conf.h +++ b/sys/sys/conf.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)conf.h 8.3 (Berkeley) 1/21/94 - * $Id: conf.h,v 1.19 1995/11/04 13:25:32 bde Exp $ + * $Id: conf.h,v 1.20 1995/11/05 09:37:28 peter Exp $ */ #ifndef _SYS_CONF_H_ @@ -68,6 +68,16 @@ typedef int d_select_t __P((dev_t, int, struct proc *)); typedef int d_mmap_t __P((dev_t, int, int)); typedef struct tty * d_ttycv_t __P((dev_t)); +typedef int l_open_t __P((dev_t dev, struct tty *tp)); +typedef int l_close_t __P((struct tty *tp, int flag)); +typedef int l_read_t __P((struct tty *tp, struct uio *uio, int flag)); +typedef int l_write_t __P((struct tty *tp, struct uio *uio, int flag)); +typedef int l_ioctl_t __P((struct tty *tp, int cmd, caddr_t data, int flag, + struct proc *p)); +typedef int l_rint_t __P((int c, struct tty *tp)); +typedef int l_start_t __P((struct tty *tp)); +typedef int l_modem_t __P((struct tty *tp, int flag)); + struct bdevsw { d_open_t *d_open; d_close_t *d_close; @@ -105,17 +115,14 @@ extern char devioc[], devcls[]; #endif struct linesw { - int (*l_open) __P((dev_t dev, struct tty *tp)); - int (*l_close) __P((struct tty *tp, int flag)); - int (*l_read) __P((struct tty *tp, struct uio *uio, - int flag)); - int (*l_write) __P((struct tty *tp, struct uio *uio, - int flag)); - int (*l_ioctl) __P((struct tty *tp, int cmd, caddr_t data, - int flag, struct proc *p)); - int (*l_rint) __P((int c, struct tty *tp)); - int (*l_start) __P((struct tty *tp)); - int (*l_modem) __P((struct tty *tp, int flag)); + l_open_t *l_open; + l_close_t *l_close; + l_read_t *l_read; + l_write_t *l_write; + l_ioctl_t *l_ioctl; + l_rint_t *l_rint; + l_start_t *l_start; + l_modem_t *l_modem; }; #ifdef KERNEL @@ -152,6 +159,9 @@ d_reset_t nullreset; */ #define nullstrategy ((d_strategy *)NULL) +l_read_t l_noread; +l_write_t l_nowrite; + dev_t chrtoblk __P((dev_t dev)); int getmajorbyname __P((const char *name)); int isdisk __P((dev_t dev, int type)); @@ -163,9 +173,9 @@ int unregister_cdev __P((const char *name, const struct cdevsw *cdp)); #ifdef JREMOD int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw *old)); int bdevsw_add __P((dev_t *descrip,struct bdevsw *new,struct bdevsw *old)); -#endif /* JREMOD */ +#endif +#endif /* KERNEL */ #include <machine/conf.h> -#endif /* KERNEL */ #endif /* !_SYS_CONF_H_ */ diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h index acba200..d9a9fbc 100644 --- a/sys/sys/linedisc.h +++ b/sys/sys/linedisc.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)conf.h 8.3 (Berkeley) 1/21/94 - * $Id: conf.h,v 1.19 1995/11/04 13:25:32 bde Exp $ + * $Id: conf.h,v 1.20 1995/11/05 09:37:28 peter Exp $ */ #ifndef _SYS_CONF_H_ @@ -68,6 +68,16 @@ typedef int d_select_t __P((dev_t, int, struct proc *)); typedef int d_mmap_t __P((dev_t, int, int)); typedef struct tty * d_ttycv_t __P((dev_t)); +typedef int l_open_t __P((dev_t dev, struct tty *tp)); +typedef int l_close_t __P((struct tty *tp, int flag)); +typedef int l_read_t __P((struct tty *tp, struct uio *uio, int flag)); +typedef int l_write_t __P((struct tty *tp, struct uio *uio, int flag)); +typedef int l_ioctl_t __P((struct tty *tp, int cmd, caddr_t data, int flag, + struct proc *p)); +typedef int l_rint_t __P((int c, struct tty *tp)); +typedef int l_start_t __P((struct tty *tp)); +typedef int l_modem_t __P((struct tty *tp, int flag)); + struct bdevsw { d_open_t *d_open; d_close_t *d_close; @@ -105,17 +115,14 @@ extern char devioc[], devcls[]; #endif struct linesw { - int (*l_open) __P((dev_t dev, struct tty *tp)); - int (*l_close) __P((struct tty *tp, int flag)); - int (*l_read) __P((struct tty *tp, struct uio *uio, - int flag)); - int (*l_write) __P((struct tty *tp, struct uio *uio, - int flag)); - int (*l_ioctl) __P((struct tty *tp, int cmd, caddr_t data, - int flag, struct proc *p)); - int (*l_rint) __P((int c, struct tty *tp)); - int (*l_start) __P((struct tty *tp)); - int (*l_modem) __P((struct tty *tp, int flag)); + l_open_t *l_open; + l_close_t *l_close; + l_read_t *l_read; + l_write_t *l_write; + l_ioctl_t *l_ioctl; + l_rint_t *l_rint; + l_start_t *l_start; + l_modem_t *l_modem; }; #ifdef KERNEL @@ -152,6 +159,9 @@ d_reset_t nullreset; */ #define nullstrategy ((d_strategy *)NULL) +l_read_t l_noread; +l_write_t l_nowrite; + dev_t chrtoblk __P((dev_t dev)); int getmajorbyname __P((const char *name)); int isdisk __P((dev_t dev, int type)); @@ -163,9 +173,9 @@ int unregister_cdev __P((const char *name, const struct cdevsw *cdp)); #ifdef JREMOD int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw *old)); int bdevsw_add __P((dev_t *descrip,struct bdevsw *new,struct bdevsw *old)); -#endif /* JREMOD */ +#endif +#endif /* KERNEL */ #include <machine/conf.h> -#endif /* KERNEL */ #endif /* !_SYS_CONF_H_ */ |