Module Name:    src
Committed By:   martin
Date:           Tue Oct 31 10:46:47 UTC 2017

Modified Files:
        src/sys/dev/sun: sunkbd.c sunms.c

Log Message:
PR port-sparc64/52622: mark the parent device as TS_KERN_ONLY,
so userland will not touch it (and change serial params w/o our
controll).


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/sun/sunkbd.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/sun/sunms.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sun/sunkbd.c
diff -u src/sys/dev/sun/sunkbd.c:1.29 src/sys/dev/sun/sunkbd.c:1.30
--- src/sys/dev/sun/sunkbd.c:1.29	Sun Sep 15 14:10:04 2013
+++ src/sys/dev/sun/sunkbd.c	Tue Oct 31 10:46:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sunkbd.c,v 1.29 2013/09/15 14:10:04 martin Exp $	*/
+/*	$NetBSD: sunkbd.c,v 1.30 2017/10/31 10:46:47 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -51,7 +51,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunkbd.c,v 1.29 2013/09/15 14:10:04 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunkbd.c,v 1.30 2017/10/31 10:46:47 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -145,6 +145,7 @@ sunkbd_attach(device_t parent, device_t 
 	KASSERT(tp->t_linesw == &sunkbd_disc);
 	tp->t_oflag &= ~OPOST;
 	tp->t_dev = args->kmta_dev;
+	SET(tp->t_state, TS_KERN_ONLY);
 
 	/* link the structures together. */
 	k->k_priv = tp;
@@ -218,6 +219,7 @@ sunkbdiopen(device_t dev, int flags)
 	int error;
 
 	/* Open the lower device */
+	CLR(tp->t_state, TS_KERN_ONLY);
 	if ((error = cdev_open(tp->t_dev, O_NONBLOCK|flags,
 				     0/* ignored? */, l)) != 0)
 		return (error);
@@ -228,6 +230,7 @@ sunkbdiopen(device_t dev, int flags)
 	t.c_ospeed = sunkbd_bps;
 	t.c_cflag =  CLOCAL|CS8;
 	(*tp->t_param)(tp, &t);
+	SET(tp->t_state, TS_KERN_ONLY);
 
 	return (0);
 }

Index: src/sys/dev/sun/sunms.c
diff -u src/sys/dev/sun/sunms.c:1.32 src/sys/dev/sun/sunms.c:1.33
--- src/sys/dev/sun/sunms.c:1.32	Sun Sep 15 14:13:19 2013
+++ src/sys/dev/sun/sunms.c	Tue Oct 31 10:46:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sunms.c,v 1.32 2013/09/15 14:13:19 martin Exp $	*/
+/*	$NetBSD: sunms.c,v 1.33 2017/10/31 10:46:47 martin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -52,7 +52,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunms.c,v 1.32 2013/09/15 14:13:19 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunms.c,v 1.33 2017/10/31 10:46:47 martin Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -162,6 +162,7 @@ sunms_attach(device_t parent, device_t s
 	tp->t_linesw = ttyldisc_lookup(sunms_disc.l_name);
 	KASSERT(tp->t_linesw == &sunms_disc);
 	tp->t_oflag &= ~OPOST;
+	SET(tp->t_state, TS_KERN_ONLY);
 
 	/* Initialize translator. */
 	ms->ms_byteno = -1;
@@ -192,6 +193,7 @@ sunmsiopen(device_t dev, int flags)
 	int error;
 
 	/* Open the lower device */
+	CLR(tp->t_state, TS_KERN_ONLY);
 	if ((error = cdev_open(tp->t_dev, O_NONBLOCK|flags,
 				     0/* ignored? */, l)) != 0)
 		return (error);
@@ -202,6 +204,7 @@ sunmsiopen(device_t dev, int flags)
 	t.c_ospeed = sunms_bps;
 	t.c_cflag =  CLOCAL|CS8;
 	(*tp->t_param)(tp, &t);
+	SET(tp->t_state, TS_KERN_ONLY);
 
 	return (0);
 }

Reply via email to