Index: sys/dev/vt/vt.h =================================================================== --- sys/dev/vt/vt.h (revision 267624) +++ sys/dev/vt/vt.h (working copy) @@ -50,6 +50,8 @@ #include "opt_syscons.h" #include "opt_splash.h" +#include + #ifndef VT_MAXWINDOWS #ifdef MAXCONS #define VT_MAXWINDOWS MAXCONS Index: sys/dev/vt/vt_consolectl.c =================================================================== --- sys/dev/vt/vt_consolectl.c (revision 267626) +++ sys/dev/vt/vt_consolectl.c (working copy) @@ -73,7 +73,7 @@ consolectl_drvinit(void *unused) { - if (getenv("kern.vt.disable")) + if (is_vtsubsys_selected("vt") == 0) return; make_dev(&consolectl_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "consolectl"); Index: sys/dev/vt/vt_core.c =================================================================== --- sys/dev/vt/vt_core.c (revision 267626) +++ sys/dev/vt/vt_core.c (working copy) @@ -215,7 +215,7 @@ vt_update_static(void *dummy) { - if (getenv("kern.vt.disable")) + if (is_vtsubsys_selected("vt") == 0) return; if (main_vd->vd_driver != NULL) printf("VT: running with driver \"%s\".\n", @@ -959,7 +959,7 @@ struct vt_device *vd = vw->vw_device; struct winsize wsz; - if (getenv("kern.vt.disable")) + if (is_vtsubsys_selected("vt") == 0) return; if (vd->vd_flags & VDF_INITIALIZED) @@ -1996,7 +1996,7 @@ struct vt_window *vw; unsigned int i; - if (getenv("kern.vt.disable")) + if (is_vtsubsys_selected("vt") == 0) return; for (i = 0; i < VT_MAXWINDOWS; i++) { @@ -2064,7 +2064,7 @@ struct vt_device *vd; struct winsize wsz; - if (getenv("kern.vt.disable")) + if (is_vtsubsys_selected("vt") == 0) return; if (main_vd->vd_driver == NULL) { Index: sys/dev/vt/vt_sysmouse.c =================================================================== --- sys/dev/vt/vt_sysmouse.c (revision 267626) +++ sys/dev/vt/vt_sysmouse.c (working copy) @@ -405,7 +405,7 @@ sysmouse_drvinit(void *unused) { - if (getenv("kern.vt.disable")) + if (is_vtsubsys_selected("vt") == 0) return; mtx_init(&sysmouse_lock, "sysmouse", NULL, MTX_DEF); cv_init(&sysmouse_sleep, "sysmrd"); Index: sys/dev/vt/vtsubsys_select.h =================================================================== --- sys/dev/vt/vtsubsys_select.h (revision 0) +++ sys/dev/vt/vtsubsys_select.h (working copy) @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2014 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Oleksandr Rybalko under sponsorship from + * the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _VTSUBSYS_SELECT_H_ +#define _VTSUBSYS_SELECT_H_ +#include +#include +#include + +#ifndef KERN_VT_DEFAULT +#define KERN_VT_DEFAULT "syscons" +#endif + +static int +is_vtsubsys_selected(char *name) +{ + char *value; + + value = getenv("kern.vty"); + if (value == NULL) + value = KERN_VT_DEFAULT; + if (strcmp(value, name) == 0) + return (1); + + return (0); +} + +#endif /* _VTSUBSYS_SELECT_H_ */ Property changes on: sys/dev/vt/vtsubsys_select.h ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Index: sys/dev/syscons/syscons.c =================================================================== --- sys/dev/syscons/syscons.c (revision 267625) +++ sys/dev/syscons/syscons.c (working copy) @@ -267,6 +267,10 @@ int sc_probe_unit(int unit, int flags) { + if (is_vtsubsys_selected("syscons") == 0) { + return ENXIO; + } + if (!scvidprobe(unit, flags, FALSE)) { if (bootverbose) printf("%s%d: no video adapter found.\n", SC_DRIVER_NAME, unit); @@ -494,6 +498,10 @@ flags &= ~SC_KERNEL_CONSOLE; + if (is_vtsubsys_selected("syscons") == 0) { + return ENXIO; + } + if (sc_console_unit == unit) { /* * If this unit is being used as the system console, we need to @@ -576,6 +584,9 @@ static void scmeminit(void *arg) { + if (is_vtsubsys_selected("syscons") == 0) { + return; + } if (sc_malloc) return; sc_malloc = TRUE; @@ -1589,7 +1600,7 @@ int unit; int flags; - if (getenv("hw.syscons.disable")) { + if (is_vtsubsys_selected("syscons") == 0) { cp->cn_pri = CN_DEAD; return; } Index: sys/dev/syscons/syscons.h =================================================================== --- sys/dev/syscons/syscons.h (revision 267541) +++ sys/dev/syscons/syscons.h (working copy) @@ -36,6 +36,7 @@ #include #include +#include /* machine-dependent part of the header */ Index: sys/dev/syscons/sysmouse.c =================================================================== --- sys/dev/syscons/sysmouse.c (revision 267625) +++ sys/dev/syscons/sysmouse.c (working copy) @@ -165,7 +165,7 @@ static void sm_attach_mouse(void *unused) { - if (getenv("hw.syscons.disable")) + if (is_vtsubsys_selected("syscons") == 0) return; sysmouse_tty = tty_alloc(&smdev_ttydevsw, NULL); tty_makedev(sysmouse_tty, NULL, "sysmouse");