From 162a9e8732beb11d524aca4a52ef4f4adf5cb28b Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sat, 9 Dec 1995 20:39:47 +0000 Subject: [PATCH] Move sysctl machdep.consdev to cons.c --- sys/amd64/amd64/machdep.c | 13 +------------ sys/i386/i386/cons.c | 19 +++++++++---------- sys/i386/i386/cons.h | 3 +-- sys/i386/i386/machdep.c | 13 +------------ sys/kern/tty_cons.c | 19 +++++++++---------- sys/sys/cons.h | 3 +-- 6 files changed, 22 insertions(+), 48 deletions(-) diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c index 4717cc740289..06d236f43c3e 100644 --- a/sys/amd64/amd64/machdep.c +++ b/sys/amd64/amd64/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.154 1995/12/04 16:47:40 phk Exp $ + * $Id: machdep.c,v 1.155 1995/12/07 12:45:32 davidg Exp $ */ #include "npx.h" @@ -1070,17 +1070,6 @@ sysctl_machdep_adjkerntz SYSCTL_HANDLER_ARGS SYSCTL_PROC(_machdep, CPU_ADJKERNTZ, adjkerntz, CTLTYPE_INT|CTLFLAG_RW, &adjkerntz, 0, sysctl_machdep_adjkerntz, "I", ""); -static int -sysctl_machdep_consdev SYSCTL_HANDLER_ARGS -{ - dev_t consdev; - consdev = (cn_tty == NULL ? NODEV : cn_tty->t_dev); - return (sysctl_handle_opaque(oidp, &consdev, sizeof consdev, req)); -} - -SYSCTL_PROC(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD, - 0, 0, sysctl_machdep_consdev, "T,dev_t", ""); - SYSCTL_INT(_machdep, CPU_DISRTCSET, disable_rtc_set, CTLFLAG_RW, &disable_rtc_set, 0, ""); diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c index 9db6f41401d4..eeaa5f43fd34 100644 --- a/sys/i386/i386/cons.c +++ b/sys/i386/i386/cons.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 - * $Id: cons.c,v 1.37 1995/12/08 11:13:21 julian Exp $ + * $Id: cons.c,v 1.38 1995/12/08 23:20:00 phk Exp $ */ #include @@ -46,9 +46,11 @@ #include #include #include +#include #include #include +#include #include #include @@ -83,7 +85,11 @@ static struct cdevsw cn_cdevsw = cnselect, nommap, NULL, "console", NULL, -1 }; struct tty *constty = 0; /* virtual console output device */ -struct tty *cn_tty; /* XXX: console tty struct for tprintf */ + +static dev_t cn_dev_t; +SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD, + &cn_dev_t, sizeof cn_dev_t, "T,dev_t", ""); + int cons_unavail = 0; /* XXX: * physical console not available for * input (i.e., it is in graphics mode) @@ -150,14 +156,7 @@ cninit_finish() cn_phys_open = cdp->d_open; cdp->d_open = cnopen; cn_tp = (*cdp->d_devtotty)(cn_tab->cn_dev); - /* - * XXX there are too many tty pointers. cn_tty is only used for - * sysctl(CPU_CONSDEV) (not for tprintf like the above comment - * says). cn_tp in struct consdev hasn't been initialized - * (except statically to NULL) or used (except to initialize - * cn_tty to the wrong value) for a year or two. - */ - cn_tty = cn_tp; + cn_dev_t = cn_tp->t_dev; } static int diff --git a/sys/i386/i386/cons.h b/sys/i386/i386/cons.h index 8fa2d90f6578..9bb2f13e10e8 100644 --- a/sys/i386/i386/cons.h +++ b/sys/i386/i386/cons.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.h 7.2 (Berkeley) 5/9/91 - * $Id: cons.h,v 1.11 1995/09/10 21:34:50 bde Exp $ + * $Id: cons.h,v 1.12 1995/12/08 11:13:23 julian Exp $ */ #ifndef _MACHINE_CONS_H_ @@ -101,7 +101,6 @@ struct consdev { #ifdef KERNEL extern struct consdev constab[]; extern struct consdev *cn_tab; -extern struct tty *cn_tty; extern int cons_unavail; struct proc; struct uio; diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c index 4717cc740289..06d236f43c3e 100644 --- a/sys/i386/i386/machdep.c +++ b/sys/i386/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.154 1995/12/04 16:47:40 phk Exp $ + * $Id: machdep.c,v 1.155 1995/12/07 12:45:32 davidg Exp $ */ #include "npx.h" @@ -1070,17 +1070,6 @@ sysctl_machdep_adjkerntz SYSCTL_HANDLER_ARGS SYSCTL_PROC(_machdep, CPU_ADJKERNTZ, adjkerntz, CTLTYPE_INT|CTLFLAG_RW, &adjkerntz, 0, sysctl_machdep_adjkerntz, "I", ""); -static int -sysctl_machdep_consdev SYSCTL_HANDLER_ARGS -{ - dev_t consdev; - consdev = (cn_tty == NULL ? NODEV : cn_tty->t_dev); - return (sysctl_handle_opaque(oidp, &consdev, sizeof consdev, req)); -} - -SYSCTL_PROC(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD, - 0, 0, sysctl_machdep_consdev, "T,dev_t", ""); - SYSCTL_INT(_machdep, CPU_DISRTCSET, disable_rtc_set, CTLFLAG_RW, &disable_rtc_set, 0, ""); diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c index 9db6f41401d4..eeaa5f43fd34 100644 --- a/sys/kern/tty_cons.c +++ b/sys/kern/tty_cons.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.c 7.2 (Berkeley) 5/9/91 - * $Id: cons.c,v 1.37 1995/12/08 11:13:21 julian Exp $ + * $Id: cons.c,v 1.38 1995/12/08 23:20:00 phk Exp $ */ #include @@ -46,9 +46,11 @@ #include #include #include +#include #include #include +#include #include #include @@ -83,7 +85,11 @@ static struct cdevsw cn_cdevsw = cnselect, nommap, NULL, "console", NULL, -1 }; struct tty *constty = 0; /* virtual console output device */ -struct tty *cn_tty; /* XXX: console tty struct for tprintf */ + +static dev_t cn_dev_t; +SYSCTL_OPAQUE(_machdep, CPU_CONSDEV, consdev, CTLTYPE_OPAQUE|CTLFLAG_RD, + &cn_dev_t, sizeof cn_dev_t, "T,dev_t", ""); + int cons_unavail = 0; /* XXX: * physical console not available for * input (i.e., it is in graphics mode) @@ -150,14 +156,7 @@ cninit_finish() cn_phys_open = cdp->d_open; cdp->d_open = cnopen; cn_tp = (*cdp->d_devtotty)(cn_tab->cn_dev); - /* - * XXX there are too many tty pointers. cn_tty is only used for - * sysctl(CPU_CONSDEV) (not for tprintf like the above comment - * says). cn_tp in struct consdev hasn't been initialized - * (except statically to NULL) or used (except to initialize - * cn_tty to the wrong value) for a year or two. - */ - cn_tty = cn_tp; + cn_dev_t = cn_tp->t_dev; } static int diff --git a/sys/sys/cons.h b/sys/sys/cons.h index 8fa2d90f6578..9bb2f13e10e8 100644 --- a/sys/sys/cons.h +++ b/sys/sys/cons.h @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)cons.h 7.2 (Berkeley) 5/9/91 - * $Id: cons.h,v 1.11 1995/09/10 21:34:50 bde Exp $ + * $Id: cons.h,v 1.12 1995/12/08 11:13:23 julian Exp $ */ #ifndef _MACHINE_CONS_H_ @@ -101,7 +101,6 @@ struct consdev { #ifdef KERNEL extern struct consdev constab[]; extern struct consdev *cn_tab; -extern struct tty *cn_tty; extern int cons_unavail; struct proc; struct uio;