summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_conf.c
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2005-03-17 12:07:00 +0000
committerphk <phk@FreeBSD.org>2005-03-17 12:07:00 +0000
commitcfa6bb09ea1f02e2fd37547ab40b7676048c034b (patch)
treea2144fe4b33bba27b94f9bbef8160b79a6789a7d /sys/kern/kern_conf.c
parent92d24b8044e535eb473c6698795051f9ce495496 (diff)
downloadFreeBSD-src-cfa6bb09ea1f02e2fd37547ab40b7676048c034b.zip
FreeBSD-src-cfa6bb09ea1f02e2fd37547ab40b7676048c034b.tar.gz
Prepare for the final onslaught on devices:
Move uid/gid/mode from cdev to cdevsw. Add kind field to use for devd(8) later. Bump both D_VERSION and __FreeBSD_version
Diffstat (limited to 'sys/kern/kern_conf.c')
-rw-r--r--sys/kern/kern_conf.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index d29e319..884872c 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -365,7 +365,7 @@ prep_cdevsw(struct cdevsw *devsw)
dev_lock();
- if (devsw->d_version != D_VERSION_00) {
+ if (devsw->d_version != D_VERSION_01) {
printf(
"WARNING: Device driver \"%s\" has wrong version %s\n",
devsw->d_name, "and is disabled. Recompile KLD module.");
@@ -419,8 +419,15 @@ make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int perms, con
KASSERT((minornr & ~MAXMINOR) == 0,
("Invalid minor (0x%x) in make_dev", minornr));
- if (!(devsw->d_flags & D_INIT))
+ if (!(devsw->d_flags & D_INIT)) {
prep_cdevsw(devsw);
+ if (devsw->d_uid == 0)
+ devsw->d_uid = uid;
+ if (devsw->d_gid == 0)
+ devsw->d_gid = gid;
+ if (devsw->d_mode == 0)
+ devsw->d_mode = perms;
+ }
dev = allocdev();
dev_lock();
dev = newdev(devsw->d_maj, minornr, dev);
@@ -448,9 +455,6 @@ make_dev(struct cdevsw *devsw, int minornr, uid_t uid, gid_t gid, int perms, con
va_end(ap);
dev->si_devsw = devsw;
- dev->si_uid = uid;
- dev->si_gid = gid;
- dev->si_mode = perms;
dev->si_flags |= SI_NAMED;
LIST_INSERT_HEAD(&devsw->d_devs, dev, si_list);
OpenPOWER on IntegriCloud