mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-17 16:10:46 +01:00
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).
This commit is contained in:
parent
fb27879cc5
commit
286f8561e2
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=12109
@ -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);
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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_ */
|
||||
|
@ -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_ */
|
||||
|
Loading…
Reference in New Issue
Block a user