summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_conf.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-03-02 19:46:45 +0000
committerphk <phk@FreeBSD.org>2003-03-02 19:46:45 +0000
commit5ed5e586983b902ab964ec76cc68ac4e3effbc39 (patch)
tree41c42fec0a675673e4956fa99d92cef9e3708877 /sys/kern/kern_conf.c
parent2f3dcfb876a330bc0da46bf60b7ab6ebac33f9f9 (diff)
downloadFreeBSD-src-5ed5e586983b902ab964ec76cc68ac4e3effbc39.zip
FreeBSD-src-5ed5e586983b902ab964ec76cc68ac4e3effbc39.tar.gz
Explicitly initialize all cdevsw methods with the relevant nofoo() function
if they are NULL.
Diffstat (limited to 'sys/kern/kern_conf.c')
-rw-r--r--sys/kern/kern_conf.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index 3a73551..d1794fa 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -277,6 +277,17 @@ make_dev(struct cdevsw *devsw, int minor, uid_t uid, gid_t gid, int perms, const
KASSERT((minor & ~0xffff00ff) == 0,
("Invalid minor (0x%x) in make_dev", minor));
+ if (devsw->d_open == NULL) devsw->d_open = noopen;
+ if (devsw->d_close == NULL) devsw->d_close = noclose;
+ if (devsw->d_read == NULL) devsw->d_read = noread;
+ if (devsw->d_write == NULL) devsw->d_write = nowrite;
+ if (devsw->d_ioctl == NULL) devsw->d_ioctl = noioctl;
+ if (devsw->d_poll == NULL) devsw->d_poll = nopoll;
+ if (devsw->d_mmap == NULL) devsw->d_mmap = nommap;
+ if (devsw->d_strategy == NULL) devsw->d_strategy = nostrategy;
+ if (devsw->d_dump == NULL) devsw->d_dump = nodump;
+ if (devsw->d_kqfilter == NULL) devsw->d_kqfilter = nokqfilter;
+
if (devsw->d_maj == MAJOR_AUTO) {
for (i = NUMCDEVSW - 1; i > 0; i--)
if (reserved_majors[i] != i)
OpenPOWER on IntegriCloud