Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/gehenna-devsw]: src/sys/dev/wscons Add the character device switch.
details: https://anonhg.NetBSD.org/src/rev/4525b2833ad3
branches: gehenna-devsw
changeset: 527062:4525b2833ad3
user: gehenna <gehenna%NetBSD.org@localhost>
date: Thu May 16 04:54:51 2002 +0000
description:
Add the character device switch.
Replace the direct-access to devsw table with calling devsw API.
diffstat:
sys/dev/wscons/wsdisplay.c | 30 ++++++++++++++++++++----------
sys/dev/wscons/wskbd.c | 21 ++++++++++++++-------
sys/dev/wscons/wsmouse.c | 19 +++++++++++++------
3 files changed, 47 insertions(+), 23 deletions(-)
diffs (169 lines):
diff -r 16fcabe7b3d1 -r 4525b2833ad3 sys/dev/wscons/wsdisplay.c
--- a/sys/dev/wscons/wsdisplay.c Thu May 16 04:54:02 2002 +0000
+++ b/sys/dev/wscons/wsdisplay.c Thu May 16 04:54:51 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsdisplay.c,v 1.63 2002/04/07 09:25:47 hannken Exp $ */
+/* $NetBSD: wsdisplay.c,v 1.63.2.1 2002/05/16 04:54:51 gehenna Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.63 2002/04/07 09:25:47 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsdisplay.c,v 1.63.2.1 2002/05/16 04:54:51 gehenna Exp $");
#include "opt_wsdisplay_compat.h"
#include "opt_compat_netbsd.h"
@@ -153,9 +153,23 @@
wsdisplay_noemul_attach,
};
-/* Exported tty- and cdevsw-related functions. */
-cdev_decl(wsdisplay);
+dev_type_open(wsdisplayopen);
+dev_type_close(wsdisplayclose);
+dev_type_read(wsdisplayread);
+dev_type_write(wsdisplaywrite);
+dev_type_ioctl(wsdisplayioctl);
+dev_type_stop(wsdisplaystop);
+dev_type_tty(wsdisplaytty);
+dev_type_poll(wsdisplaypoll);
+dev_type_mmap(wsdisplaymmap);
+const struct cdevsw wsdisplay_cdevsw = {
+ wsdisplayopen, wsdisplayclose, wsdisplayread, wsdisplaywrite,
+ wsdisplayioctl, wsdisplaystop, wsdisplaytty, wsdisplaypoll,
+ wsdisplaymmap, D_TTY
+};
+
+/* Exported tty- functions. */
static void wsdisplaystart(struct tty *);
static int wsdisplayparam(struct tty *, struct termios *);
@@ -380,9 +394,7 @@
}
/* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == wsdisplayopen)
- break;
+ maj = cdevsw_lookup_major(&wsdisplay_cdevsw);
/* locate the screen index */
for (idx = 0; idx < WSDISPLAY_MAXSCREEN; idx++)
if (scr == sc->sc_scr[idx])
@@ -490,9 +502,7 @@
int maj;
/* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == wsdisplayopen)
- break;
+ maj = cdevsw_lookup_major(&wsdisplay_cdevsw);
cn_tab->cn_dev = makedev(maj, WSDISPLAYMINOR(self->dv_unit, 0));
}
diff -r 16fcabe7b3d1 -r 4525b2833ad3 sys/dev/wscons/wskbd.c
--- a/sys/dev/wscons/wskbd.c Thu May 16 04:54:02 2002 +0000
+++ b/sys/dev/wscons/wskbd.c Thu May 16 04:54:51 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wskbd.c,v 1.61 2002/03/17 19:41:06 atatat Exp $ */
+/* $NetBSD: wskbd.c,v 1.61.4.1 2002/05/16 04:54:51 gehenna Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -83,7 +83,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.61 2002/03/17 19:41:06 atatat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wskbd.c,v 1.61.4.1 2002/05/16 04:54:51 gehenna Exp $");
#include "opt_ddb.h"
#include "opt_kgdb.h"
@@ -243,6 +243,17 @@
extern struct cfdriver wskbd_cd;
+dev_type_open(wskbdopen);
+dev_type_close(wskbdclose);
+dev_type_read(wskbdread);
+dev_type_ioctl(wskbdioctl);
+dev_type_poll(wskbdpoll);
+
+const struct cdevsw wskbd_cdevsw = {
+ wskbdopen, wskbdclose, wskbdread, nowrite, wskbdioctl,
+ nostop, notty, wskbdpoll, nommap,
+};
+
#ifndef WSKBD_DEFAULT_BELL_PITCH
#define WSKBD_DEFAULT_BELL_PITCH 1500 /* 1500Hz */
#endif
@@ -273,8 +284,6 @@
WSKBD_DEFAULT_KEYREPEAT_DELN,
};
-cdev_decl(wskbd);
-
#if NWSDISPLAY > 0 || NWSMUX > 0
struct wssrcops wskbd_srcops = {
WSMUX_KBD,
@@ -542,9 +551,7 @@
}
/* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == wskbdopen)
- break;
+ maj = cdevsw_lookup_major(&wskbd_cdevsw);
/* Nuke the vnodes for any open instances. */
mn = self->dv_unit;
diff -r 16fcabe7b3d1 -r 4525b2833ad3 sys/dev/wscons/wsmouse.c
--- a/sys/dev/wscons/wsmouse.c Thu May 16 04:54:02 2002 +0000
+++ b/sys/dev/wscons/wsmouse.c Thu May 16 04:54:51 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: wsmouse.c,v 1.22 2001/11/22 00:57:14 augustss Exp $ */
+/* $NetBSD: wsmouse.c,v 1.22.8.1 2002/05/16 04:54:52 gehenna Exp $ */
/*
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
@@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.22 2001/11/22 00:57:14 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsmouse.c,v 1.22.8.1 2002/05/16 04:54:52 gehenna Exp $");
#include "wsmouse.h"
#include "wsdisplay.h"
@@ -161,7 +161,16 @@
extern struct cfdriver wsmouse_cd;
#endif /* NWSMOUSE > 0 */
-cdev_decl(wsmouse);
+dev_type_open(wsmouseopen);
+dev_type_close(wsmouseclose);
+dev_type_read(wsmouseread);
+dev_type_ioctl(wsmouseioctl);
+dev_type_poll(wsmousepoll);
+
+const struct cdevsw wsmouse_cdevsw = {
+ wsmouseopen, wsmouseclose, wsmouseread, nowrite, wsmouseioctl,
+ nostop, notty, wsmousepoll, nommap,
+};
#if NWSMUX > 0
struct wssrcops wsmouse_srcops = {
@@ -270,9 +279,7 @@
}
/* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == wsmouseopen)
- break;
+ maj = cdevsw_lookup_major(&wsmouse_cdevsw);
/* Nuke the vnodes for any open instances (calls close). */
mn = self->dv_unit;
Home |
Main Index |
Thread Index |
Old Index