summaryrefslogtreecommitdiffstats
path: root/sys/dev/syscons
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-02-12 21:32:59 +0000
committerphk <phk@FreeBSD.org>2004-02-12 21:32:59 +0000
commit27cfdd1ae9e9097acea22ce743d2e1d1ead1a8fe (patch)
treeb479d3b3eacf62c462da2404c1e0b252d20acb12 /sys/dev/syscons
parent81636e22b051784300f39ebfc9c27f37c74e63c2 (diff)
downloadFreeBSD-src-27cfdd1ae9e9097acea22ce743d2e1d1ead1a8fe.zip
FreeBSD-src-27cfdd1ae9e9097acea22ce743d2e1d1ead1a8fe.tar.gz
Don't use makedev() to hack up dev_t's early in boot, do it right
with make_dev() (and avoid doing it again later).
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r--sys/dev/syscons/syscons.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c
index 0115954..88c6ade 100644
--- a/sys/dev/syscons/syscons.c
+++ b/sys/dev/syscons/syscons.c
@@ -389,9 +389,11 @@ sc_attach_unit(int unit, int flags)
(void *)(uintptr_t)unit, SHUTDOWN_PRI_DEFAULT);
for (vc = 0; vc < sc->vtys; vc++) {
- dev = make_dev(&sc_cdevsw, vc + unit * MAXCONS,
- UID_ROOT, GID_WHEEL, 0600, "ttyv%r", vc + unit * MAXCONS);
- sc->dev[vc] = dev;
+ if (sc->dev[vc] == NULL) {
+ dev = make_dev(&sc_cdevsw, vc + unit * MAXCONS,
+ UID_ROOT, GID_WHEEL, 0600, "ttyv%r", vc + unit * MAXCONS);
+ sc->dev[vc] = dev;
+ }
/*
* The first vty already has struct tty and scr_stat initialized
* in scinit(). The other vtys will have these structs when
@@ -2730,7 +2732,8 @@ scinit(int unit, int flags)
sc->vtys = MAXCONS; /* XXX: should be configurable */
if (flags & SC_KERNEL_CONSOLE) {
sc->dev = main_devs;
- sc->dev[0] = makedev(CDEV_MAJOR, unit*MAXCONS);
+ sc->dev[0] = make_dev(&sc_cdevsw, unit * MAXCONS,
+ UID_ROOT, GID_WHEEL, 0600, "ttyv%r", unit * MAXCONS);
sc->dev[0]->si_tty = &main_tty;
ttyregister(&main_tty);
scp = &main_console;
@@ -2745,7 +2748,8 @@ scinit(int unit, int flags)
} else {
/* assert(sc_malloc) */
sc->dev = malloc(sizeof(dev_t)*sc->vtys, M_DEVBUF, M_WAITOK|M_ZERO);
- sc->dev[0] = makedev(CDEV_MAJOR, unit*MAXCONS);
+ sc->dev[0] = make_dev(&sc_cdevsw, unit * MAXCONS,
+ UID_ROOT, GID_WHEEL, 0600, "ttyv%r", unit * MAXCONS);
sc->dev[0]->si_tty = ttymalloc(sc->dev[0]->si_tty);
scp = alloc_scp(sc, sc->first_vty);
}
OpenPOWER on IntegriCloud