aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/tty_cons.c
diff options
context:
space:
mode:
authorJulian Elischer <julian@FreeBSD.org>1995-11-29 10:49:16 +0000
committerJulian Elischer <julian@FreeBSD.org>1995-11-29 10:49:16 +0000
commit53ac6efbd86e7552454f4b69d25d8980dd619634 (patch)
tree5ed2d747156a38098db0e540f833114bc9dd1b51 /sys/kern/tty_cons.c
parent3924871a1d9667169a58975b96b4a57759479f0e (diff)
downloadsrc-53ac6efbd86e7552454f4b69d25d8980dd619634.tar.gz
src-53ac6efbd86e7552454f4b69d25d8980dd619634.zip
OK, that's it..
That's EVERY SINGLE driver that has an entry in conf.c.. my next trick will be to define cdevsw[] and bdevsw[] as empty arrays and remove all those DAMNED defines as well.. Each of these drivers has a SYSINIT linker set entry that comes in very early.. and asks teh driver to add it's own entry to the two devsw[] tables. some slight reworking of the commits from yesterday (added the SYSINIT stuff and some usually wrong but token DEVFS entries to all these devices. BTW does anyone know where the 'ata' entries in conf.c actually reside? seems we don't actually have a 'ataopen() etc... If you want to add a new device in conf.c please make sure I know so I can keep it up to date too.. as before, this is all dependent on #if defined(JREMOD) (and #ifdef DEVFS in parts)
Notes
Notes: svn path=/head/; revision=12517
Diffstat (limited to 'sys/kern/tty_cons.c')
-rw-r--r--sys/kern/tty_cons.c54
1 files changed, 36 insertions, 18 deletions
diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c
index 0b509594c3b9..9b8735d1f954 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.33 1995/09/10 18:57:25 bde Exp $
+ * $Id: cons.c,v 1.34 1995/09/10 21:34:49 bde Exp $
*/
#include <sys/param.h>
@@ -48,6 +48,14 @@
#include <machine/cons.h>
#include <machine/stdarg.h>
+#ifdef JREMOD
+#include <sys/kernel.h>
+#ifdef DEVFS
+#include <sys/devfsext.h>
+#endif /*DEVFS*/
+#define CDEV_MAJOR 0
+#endif /*JREMOD*/
+
/* XXX this should be config(8)ed. */
#include "sc.h"
#include "vt.h"
@@ -79,23 +87,6 @@ static d_open_t *cn_phys_open; /* physical device open function */
static struct consdev *cn_tab; /* physical console device info */
static struct tty *cn_tp; /* physical console tty struct */
-#ifdef DEVFS
-#include <sys/kernel.h>
-#include <sys/devfsext.h>
-
-static void cndev_init __P((void *));
-SYSINIT(cndev, SI_SUB_DEVFS, SI_ORDER_ANY, cndev_init, NULL)
-
-static void
-cndev_init(dummy)
- void *dummy;
-{
- void * x;
-/* path name devsw minor type uid gid perm*/
- x=dev_add("/misc", "console", cnopen, 0, DV_CHR, 0, 0, 0640);
-}
-#endif /* DEVFS */
-
void
cninit()
{
@@ -322,3 +313,30 @@ pg(const char *p, ...) {
}
+#ifdef JREMOD
+struct cdevsw cn_cdevsw =
+ { cnopen, cnclose, cnread, cnwrite, /*0*/
+ cnioctl, nullstop, nullreset, nodevtotty,/* console */
+ cnselect, nommap, NULL };
+
+static cn_devsw_installed = 0;
+
+static void cn_drvinit(void *unused)
+{
+ void * x;
+ dev_t dev;
+
+ if( ! cn_devsw_installed ) {
+ dev = makedev(CDEV_MAJOR,0);
+ cdevsw_add(&dev,&cn_cdevsw,NULL);
+ cn_devsw_installed = 1;
+#ifdef DEVFS
+ /* path,name,major,minor,type,uid,gid,perm */
+ x=devfs_add_devsw("/","console",major(dev),0,DV_CHR,0,0,0640);
+#endif
+}
+
+SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL)
+
+#endif /* JREMOD */
+