DEVFS - remove dev_ops_add(), dev_ops_get(), and get_dev()
[dragonfly.git] / sys / dev / misc / dcons / dcons_os.c
index 9ebba48..f684a71 100644 (file)
@@ -32,7 +32,7 @@
  * SUCH DAMAGE.
  * 
  * $FreeBSD: src/sys/dev/dcons/dcons_os.c,v 1.4 2004/10/24 12:41:04 simokawa Exp $
- * $DragonFly: src/sys/dev/misc/dcons/dcons_os.c,v 1.11 2007/05/07 05:21:40 dillon Exp $
+ * $DragonFly: src/sys/dev/misc/dcons/dcons_os.c,v 1.13 2007/08/07 13:14:11 hasso Exp $
  */
 
 #include <sys/param.h>
@@ -50,6 +50,7 @@
 #include <sys/tty.h>
 #include <sys/malloc.h>
 #include <sys/proc.h>
+#include <sys/priv.h>
 #include <sys/thread2.h>
 #include <sys/ucred.h>
 #include <sys/bus.h>
@@ -100,6 +101,7 @@ static struct dev_ops dcons_ops = {
        .d_write =      ttywrite,
        .d_ioctl =      dcons_ioctl,
        .d_poll =       ttypoll,
+       .d_revoke =     ttyrevoke
 };
 
 #ifndef KLD_MODULE
@@ -272,7 +274,7 @@ dcons_open(struct dev_open_args *ap)
                tp->t_lflag = TTYDEF_LFLAG;
                tp->t_ispeed = tp->t_ospeed = TTYDEF_SPEED;
                ttsetwater(tp);
-       } else if ((tp->t_state & TS_XCLUDE) && suser_cred(ap->a_cred, 0)) {
+       } else if ((tp->t_state & TS_XCLUDE) && priv_check_cred(ap->a_cred, PRIV_ROOT, 0)) {
                crit_exit();
                return (EBUSY);
        }
@@ -565,9 +567,6 @@ dcons_attach(void)
 {
        int polltime;
 
-#ifdef __DragonFly__
-       dev_ops_add(&dcons_ops, -1, 0);
-#endif
        dcons_attach_port(DCONS_CON, "dcons", 0);
        dcons_attach_port(DCONS_GDB, "dgdb", DC_GDB);
 #if __FreeBSD_version < 500000
@@ -596,10 +595,7 @@ dcons_detach(int port)
                kprintf("dcons: still opened\n");
 #if __FreeBSD_version < 502113
                (*linesw[tp->t_line].l_close)(tp, 0);
-               tp->t_gen++;
                ttyclose(tp);
-               ttwakeup(tp);
-               ttwwakeup(tp);
 #else
                ttyld_close(tp, 0);
                tty_close(tp);