Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/gehenna-devsw]: src/sys/dev Add the character device switch.
details: https://anonhg.NetBSD.org/src/rev/d93e1c4ec6c0
branches: gehenna-devsw
changeset: 527058:d93e1c4ec6c0
user: gehenna <gehenna%NetBSD.org@localhost>
date: Thu May 16 04:49:35 2002 +0000
description:
Add the character device switch.
diffstat:
sys/dev/clockctl.c | 28 ++++++++--------------------
sys/dev/radio.c | 20 ++++++++++++--------
sys/dev/rnd.c | 28 +++++++++++++---------------
3 files changed, 33 insertions(+), 43 deletions(-)
diffs (167 lines):
diff -r 3a4e23002c58 -r d93e1c4ec6c0 sys/dev/clockctl.c
--- a/sys/dev/clockctl.c Thu May 16 04:47:32 2002 +0000
+++ b/sys/dev/clockctl.c Thu May 16 04:49:35 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: clockctl.c,v 1.6 2002/03/01 22:58:33 manu Exp $ */
+/* $NetBSD: clockctl.c,v 1.6.6.1 2002/05/16 04:49:35 gehenna Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.6 2002/03/01 22:58:33 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clockctl.c,v 1.6.6.1 2002/05/16 04:49:35 gehenna Exp $");
#include "opt_ntp.h"
@@ -52,6 +52,12 @@
struct device clockctl_dev;
};
+dev_type_ioctl(clockctlioctl);
+
+const struct cdevsw clockctl_cdevsw = {
+ nullopen, nullclose, noread, nowrite, clockctlioctl,
+ nostop, notty, nopoll, nommap,
+};
void
clockctlattach(parent, self, aux)
@@ -64,24 +70,6 @@
}
int
-clockctlopen(dev, flags, fmt, p)
- dev_t dev;
- int flags, fmt;
- struct proc *p;
-{
- return 0;
-}
-
-int
-clockctlclose(dev, flags, fmt, p)
- dev_t dev;
- int flags, fmt;
- struct proc *p;
-{
- return 0;
-}
-
-int
clockctlioctl(dev, cmd, data, flags, p)
dev_t dev;
u_long cmd;
diff -r 3a4e23002c58 -r d93e1c4ec6c0 sys/dev/radio.c
--- a/sys/dev/radio.c Thu May 16 04:47:32 2002 +0000
+++ b/sys/dev/radio.c Thu May 16 04:49:35 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: radio.c,v 1.3 2002/01/05 01:30:01 augustss Exp $ */
+/* $NetBSD: radio.c,v 1.3.12.1 2002/05/16 04:49:35 gehenna Exp $ */
/* $OpenBSD: radio.c,v 1.2 2001/12/05 10:27:06 mickey Exp $ */
/* $RuOBSD: radio.c,v 1.7 2001/12/04 06:03:05 tm Exp $ */
@@ -30,7 +30,7 @@
/* This is the /dev/radio driver from OpenBSD */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: radio.c,v 1.3 2002/01/05 01:30:01 augustss Exp $");
+__KERNEL_RCSID(0, "$NetBSD: radio.c,v 1.3.12.1 2002/05/16 04:49:35 gehenna Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -47,9 +47,6 @@
int radioprobe(struct device *, struct cfdata *, void *);
void radioattach(struct device *, struct device *, void *);
-int radioopen(dev_t, int, int, struct proc *);
-int radioclose(dev_t, int, int, struct proc *);
-int radioioctl(dev_t, u_long, caddr_t, int, struct proc *);
int radioprint(void *, const char *);
int radiodetach(struct device *, int);
int radioactivate(struct device *, enum devact);
@@ -59,6 +56,15 @@
radiodetach, radioactivate
};
+dev_type_open(radioopen);
+dev_type_close(radioclose);
+dev_type_ioctl(radioioctl);
+
+const struct cdevsw radio_cdevsw = {
+ radioopen, radioclose, noread, nowrite, radioioctl,
+ nostop, notty, nopoll, nommap,
+};
+
extern struct cfdriver radio_cd;
int
@@ -176,9 +182,7 @@
int maj, mn;
/* locate the major number */
- for (maj = 0; maj < nchrdev; maj++)
- if (cdevsw[maj].d_open == radioopen)
- break;
+ maj = cdevsw_lookup_major(&radio_cdevsw);
/* Nuke the vnodes for any open instances (calls close). */
mn = self->dv_unit;
diff -r 3a4e23002c58 -r d93e1c4ec6c0 sys/dev/rnd.c
--- a/sys/dev/rnd.c Thu May 16 04:47:32 2002 +0000
+++ b/sys/dev/rnd.c Thu May 16 04:49:35 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rnd.c,v 1.26 2002/03/08 20:48:37 thorpej Exp $ */
+/* $NetBSD: rnd.c,v 1.26.6.1 2002/05/16 04:49:35 gehenna Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.26 2002/03/08 20:48:37 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rnd.c,v 1.26.6.1 2002/05/16 04:49:35 gehenna Exp $");
#include <sys/param.h>
#include <sys/ioctl.h>
@@ -155,12 +155,17 @@
struct callout rnd_callout = CALLOUT_INITIALIZER;
void rndattach __P((int));
-int rndopen __P((dev_t, int, int, struct proc *));
-int rndclose __P((dev_t, int, int, struct proc *));
-int rndread __P((dev_t, struct uio *, int));
-int rndwrite __P((dev_t, struct uio *, int));
-int rndioctl __P((dev_t, u_long, caddr_t, int, struct proc *));
-int rndpoll __P((dev_t, int, struct proc *));
+
+dev_type_open(rndopen);
+dev_type_read(rndread);
+dev_type_write(rndwrite);
+dev_type_ioctl(rndioctl);
+dev_type_poll(rndpoll);
+
+const struct cdevsw rnd_cdevsw = {
+ rndopen, nullclose, rndread, rndwrite, rndioctl,
+ nostop, notty, rndpoll, nommap,
+};
static inline void rnd_wakeup_readers(void);
static inline u_int32_t rnd_estimate_entropy(rndsource_t *, u_int32_t);
@@ -325,13 +330,6 @@
}
int
-rndclose(dev_t dev, int flags, int ifmt, struct proc *p)
-{
-
- return (0);
-}
-
-int
rndread(dev_t dev, struct uio *uio, int ioflag)
{
u_int8_t *buf;
Home |
Main Index |
Thread Index |
Old Index