Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/gehenna-devsw]: src/sys/kern Add the character device switch.
details: https://anonhg.NetBSD.org/src/rev/32aec94a9d5a
branches: gehenna-devsw
changeset: 527039:32aec94a9d5a
user: gehenna <gehenna%NetBSD.org@localhost>
date: Thu May 16 04:07:56 2002 +0000
description:
Add the character device switch.
diffstat:
sys/kern/kern_descrip.c | 11 +++++++++--
sys/kern/subr_log.c | 15 +++++++++++++--
sys/kern/tty_pty.c | 48 +++++++++++++++++++++++++++++++++++++++++++-----
sys/kern/tty_tty.c | 15 +++++++++++++--
4 files changed, 78 insertions(+), 11 deletions(-)
diffs (196 lines):
diff -r 842eba9e404a -r 32aec94a9d5a sys/kern/kern_descrip.c
--- a/sys/kern/kern_descrip.c Thu May 16 04:04:27 2002 +0000
+++ b/sys/kern/kern_descrip.c Thu May 16 04:07:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_descrip.c,v 1.92 2002/05/09 17:57:07 atatat Exp $ */
+/* $NetBSD: kern_descrip.c,v 1.92.2.1 2002/05/16 04:07:56 gehenna Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1991, 1993
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.92 2002/05/09 17:57:07 atatat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_descrip.c,v 1.92.2.1 2002/05/16 04:07:56 gehenna Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -80,6 +80,13 @@
int finishdup(struct proc *, int, int, register_t *);
int fcntl_forfs(int, struct proc *, int, void *);
+dev_type_open(filedescopen);
+
+const struct cdevsw filedesc_cdevsw = {
+ filedescopen, noclose, noread, nowrite, noioctl,
+ nostop, notty, nopoll, nommap,
+};
+
static __inline void
fd_used(struct filedesc *fdp, int fd)
{
diff -r 842eba9e404a -r 32aec94a9d5a sys/kern/subr_log.c
--- a/sys/kern/subr_log.c Thu May 16 04:04:27 2002 +0000
+++ b/sys/kern/subr_log.c Thu May 16 04:07:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_log.c,v 1.22 2002/04/28 04:13:51 enami Exp $ */
+/* $NetBSD: subr_log.c,v 1.22.2.1 2002/05/16 04:07:56 gehenna Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_log.c,v 1.22 2002/04/28 04:13:51 enami Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_log.c,v 1.22.2.1 2002/05/16 04:07:56 gehenna Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -71,6 +71,17 @@
int msgbufenabled; /* is logging to the buffer enabled */
struct kern_msgbuf *msgbufp; /* the mapped buffer, itself. */
+dev_type_open(logopen);
+dev_type_close(logclose);
+dev_type_read(logread);
+dev_type_ioctl(logioctl);
+dev_type_poll(logpoll);
+
+const struct cdevsw log_cdevsw = {
+ logopen, logclose, logread, nowrite, logioctl,
+ nostop, notty, logpoll, nommap,
+};
+
void
initmsgbuf(buf, bufsize)
caddr_t buf;
diff -r 842eba9e404a -r 32aec94a9d5a sys/kern/tty_pty.c
--- a/sys/kern/tty_pty.c Thu May 16 04:04:27 2002 +0000
+++ b/sys/kern/tty_pty.c Thu May 16 04:07:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty_pty.c,v 1.62 2002/03/25 04:26:43 itohy Exp $ */
+/* $NetBSD: tty_pty.c,v 1.62.2.1 2002/05/16 04:07:56 gehenna Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1993
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.62 2002/03/25 04:26:43 itohy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.62.2.1 2002/05/16 04:07:56 gehenna Exp $");
#include "opt_compat_sunos.h"
@@ -95,14 +95,50 @@
void ptyattach __P((int));
void ptcwakeup __P((struct tty *, int));
-int ptcopen __P((dev_t, int, int, struct proc *));
-struct tty *ptytty __P((dev_t));
void ptsstart __P((struct tty *));
int pty_maxptys __P((int, int));
static struct pt_softc **ptyarralloc __P((int));
static int check_pty __P((dev_t));
+dev_type_open(ptcopen);
+dev_type_close(ptcclose);
+dev_type_read(ptcread);
+dev_type_write(ptcwrite);
+dev_type_poll(ptcpoll);
+
+dev_type_open(ptsopen);
+dev_type_close(ptsclose);
+dev_type_read(ptsread);
+dev_type_write(ptswrite);
+dev_type_stop(ptsstop);
+dev_type_poll(ptspoll);
+
+dev_type_ioctl(ptyioctl);
+dev_type_tty(ptytty);
+
+const struct cdevsw ptc_cdevsw = {
+ ptcopen, ptcclose, ptcread, ptcwrite, ptyioctl,
+ nullstop, ptytty, ptcpoll, nommap, D_TTY
+};
+
+const struct cdevsw pts_cdevsw = {
+ ptsopen, ptsclose, ptsread, ptswrite, ptyioctl,
+ ptsstop, ptytty, ptspoll, nommap, D_TTY
+};
+
+#if defined(pmax)
+const struct cdevsw ptc_ultrix_cdevsw = {
+ ptcopen, ptcclose, ptcread, ptcwrite, ptyioctl,
+ nullstop, ptytty, ptcpoll, nommap, D_TTY
+};
+
+const struct cdevsw pts_ultrix_cdevsw = {
+ ptsopen, ptsclose, ptsread, ptswrite, ptyioctl,
+ ptsstop, ptytty, ptspoll, nommap, D_TTY
+};
+#endif /* defined(pmax) */
+
/*
* Allocate and zero array of nelem elements.
*/
@@ -734,9 +770,11 @@
{
struct pt_softc *pti = pt_softc[minor(dev)];
struct tty *tp = pti->pt_tty;
+ const struct cdevsw *cdev;
u_char *cc = tp->t_cc;
int stop, error, sig;
+ cdev = cdevsw_lookup(dev);
/*
* IF CONTROLLER STTY THEN MUST FLUSH TO PREVENT A HANG.
* ttywflush(tp) will hang if there are characters in the outq.
@@ -763,7 +801,7 @@
}
return(0);
} else
- if (cdevsw[major(dev)].d_open == ptcopen)
+ if (cdev != NULL && cdev->d_open == ptcopen)
switch (cmd) {
case TIOCGPGRP:
diff -r 842eba9e404a -r 32aec94a9d5a sys/kern/tty_tty.c
--- a/sys/kern/tty_tty.c Thu May 16 04:04:27 2002 +0000
+++ b/sys/kern/tty_tty.c Thu May 16 04:07:56 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tty_tty.c,v 1.17 2001/11/12 15:25:30 lukem Exp $ */
+/* $NetBSD: tty_tty.c,v 1.17.8.1 2002/05/16 04:07:56 gehenna Exp $ */
/*-
* Copyright (c) 1982, 1986, 1991, 1993, 1995
@@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_tty.c,v 1.17 2001/11/12 15:25:30 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_tty.c,v 1.17.8.1 2002/05/16 04:07:56 gehenna Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -54,6 +54,17 @@
#define cttyvp(p) ((p)->p_flag & P_CONTROLT ? (p)->p_session->s_ttyvp : NULL)
+dev_type_open(cttyopen);
+dev_type_read(cttyread);
+dev_type_write(cttywrite);
+dev_type_ioctl(cttyioctl);
+dev_type_poll(cttypoll);
+
+const struct cdevsw ctty_cdevsw = {
+ cttyopen, nullclose, cttyread, cttywrite, cttyioctl,
+ nullstop, notty, cttypoll, nommap, D_TTY
+};
+
/*ARGSUSED*/
int
cttyopen(dev, flag, mode, p)
Home |
Main Index |
Thread Index |
Old Index