Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Oct 2008 14:02:14 GMT
From:      Ed Schouten <ed@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 151952 for review
Message-ID:  <200810261402.m9QE2EK7066407@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=151952

Change 151952 by ed@ed_mekker on 2008/10/26 14:01:20

	Step 2: nuke /dev/console and rename my new /dev/konzole to /dev/console.
	
	My system still boots. :-)

Affected files ...

.. //depot/projects/mpsafetty/sys/kern/tty.c#57 edit
.. //depot/projects/mpsafetty/sys/kern/tty_cons.c#3 edit

Differences ...

==== //depot/projects/mpsafetty/sys/kern/tty.c#57 (text+ko) ====

@@ -311,6 +311,9 @@
 {
 	struct tty *tp = dev->si_drv1;
 
+	if (TTY_CONSOLE(dev))
+		return (0);
+
 	tty_lock(tp);
 
 	/*
@@ -1773,7 +1776,7 @@
 {
 
 	dev_console = make_dev(&ttydev_cdevsw, 0, UID_ROOT, GID_WHEEL,
-	    0600, "konzole");
+	    0600, "console");
 }
 
 SYSINIT(tty, SI_SUB_DRIVERS, SI_ORDER_FIRST, ttyconsdev_init, NULL);

==== //depot/projects/mpsafetty/sys/kern/tty_cons.c#3 (text+ko) ====

@@ -70,25 +70,7 @@
 
 static	d_open_t	cnopen;
 static	d_close_t	cnclose;
-static	d_read_t	cnread;
-static	d_write_t	cnwrite;
-static	d_ioctl_t	cnioctl;
-static	d_poll_t	cnpoll;
-static	d_kqfilter_t	cnkqfilter;
 
-static struct cdevsw cn_cdevsw = {
-	.d_version =	D_VERSION,
-	.d_open =	cnopen,
-	.d_close =	cnclose,
-	.d_read =	cnread,
-	.d_write =	cnwrite,
-	.d_ioctl =	cnioctl,
-	.d_poll =	cnpoll,
-	.d_name =	"console",
-	.d_flags =	D_TTY | D_NEEDGIANT,
-	.d_kqfilter =	cnkqfilter,
-};
-
 struct cn_device {
 	STAILQ_ENTRY(cn_device) cnd_next;
 	struct		vnode *cnd_vp;
@@ -447,131 +429,6 @@
 	return (0);
 }
 
-static int
-cnread(struct cdev *dev, struct uio *uio, int flag)
-{
-	struct cn_device *cnd;
-	struct cdevsw *csw;
-	int error;
-
-	cnd = STAILQ_FIRST(&cn_devlist);
-	if (cn_mute || CND_INVALID(cnd, curthread))
-		return (0);
-	dev = cnd->cnd_vp->v_rdev;
-	csw = dev_refthread(dev);
-	if (csw == NULL)
-		return (ENXIO);
-	error = (csw->d_read)(dev, uio, flag);
-	dev_relthread(dev);
-	return (error);
-}
-
-static int
-cnwrite(struct cdev *dev, struct uio *uio, int flag)
-{
-	struct cn_device *cnd;
-	struct cdevsw *csw;
-	int error;
-
-	cnd = STAILQ_FIRST(&cn_devlist);
-	if (cn_mute || CND_INVALID(cnd, curthread))
-		goto done;
-	if (constty)
-		dev = constty->t_dev;
-	else
-		dev = cnd->cnd_vp->v_rdev;
-	if (dev != NULL) {
-		log_console(uio);
-		csw = dev_refthread(dev);
-		if (csw == NULL)
-			return (ENXIO);
-		error = (csw->d_write)(dev, uio, flag);
-		dev_relthread(dev);
-		return (error);
-	}
-done:
-	uio->uio_resid = 0; /* dump the data */
-	return (0);
-}
-
-static int
-cnioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
-{
-	struct cn_device *cnd;
-	struct cdevsw *csw;
-	int error;
-
-	cnd = STAILQ_FIRST(&cn_devlist);
-	if (cn_mute || CND_INVALID(cnd, td))
-		return (0);
-	/*
-	 * Superuser can always use this to wrest control of console
-	 * output from the "virtual" console.
-	 */
-	if (cmd == TIOCCONS && constty) {
-		error = priv_check(td, PRIV_TTY_CONSOLE);
-		if (error)
-			return (error);
-		constty = NULL;
-		return (0);
-	}
-	dev = cnd->cnd_vp->v_rdev;
-	if (dev == NULL)
-		return (0);	/* XXX : ENOTTY ? */
-	csw = dev_refthread(dev);
-	if (csw == NULL)
-		return (ENXIO);
-	error = (csw->d_ioctl)(dev, cmd, data, flag, td);
-	dev_relthread(dev);
-	return (error);
-}
-
-/*
- * XXX
- * poll/kqfilter do not appear to be correct
- */
-static int
-cnpoll(struct cdev *dev, int events, struct thread *td)
-{
-	struct cn_device *cnd;
-	struct cdevsw *csw;
-	int error;
-
-	cnd = STAILQ_FIRST(&cn_devlist);
-	if (cn_mute || CND_INVALID(cnd, td))
-		return (0);
-	dev = cnd->cnd_vp->v_rdev;
-	if (dev == NULL)
-		return (0);
-	csw = dev_refthread(dev);
-	if (csw == NULL)
-		return (ENXIO);
-	error = (csw->d_poll)(dev, events, td);
-	dev_relthread(dev);
-	return (error);
-}
-
-static int
-cnkqfilter(struct cdev *dev, struct knote *kn)
-{
-	struct cn_device *cnd;
-	struct cdevsw *csw;
-	int error;
-
-	cnd = STAILQ_FIRST(&cn_devlist);
-	if (cn_mute || CND_INVALID(cnd, curthread))
-		return (EINVAL);
-	dev = cnd->cnd_vp->v_rdev;
-	if (dev == NULL)
-		return (ENXIO);
-	csw = dev_refthread(dev);
-	if (csw == NULL)
-		return (ENXIO);
-	error = (csw->d_kqfilter)(dev, kn);
-	dev_relthread(dev);
-	return (error);
-}
-
 /*
  * Low level console routines.
  */
@@ -737,7 +594,7 @@
 cn_drvinit(void *unused)
 {
 
-	make_dev(&cn_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "console");
+	/*make_dev(&cn_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "console");*/
 
 	mtx_init(&cnputs_mtx, "cnputs_mtx", NULL, MTX_SPIN | MTX_NOWITNESS);
 	use_cnputs_mtx = 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200810261402.m9QE2EK7066407>