summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-09-27 21:50:00 +0000
committerphk <phk@FreeBSD.org>2003-09-27 21:50:00 +0000
commitd0dceae232c439e34b42bed2045241fb1ebcbfa0 (patch)
tree7697bfcd65032a030f976139cbb0b64bc0939f78
parent9ac5ba861632606cf8c664b4c2073bb01bdd27d1 (diff)
downloadFreeBSD-src-d0dceae232c439e34b42bed2045241fb1ebcbfa0.zip
FreeBSD-src-d0dceae232c439e34b42bed2045241fb1ebcbfa0.tar.gz
Make life a little bit easier for cloning device drivers.
-rw-r--r--sys/kern/kern_conf.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index d578077..4d8e74b 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -375,6 +375,15 @@ make_dev(struct cdevsw *devsw, int minor, uid_t uid, gid_t gid, int perms, const
}
dev = makedev(devsw->d_maj, minor);
+ if (dev->si_flags & SI_CHEAPCLONE &&
+ dev->si_flags & SI_NAMED &&
+ dev->si_devsw == devsw) {
+ /*
+ * This is allowed as it removes races and generally
+ * simplifies cloning devices.
+ */
+ return (dev);
+ }
if (dev->si_flags & SI_NAMED) {
printf( "WARNING: Driver mistake: repeat make_dev(\"%s\")\n",
dev->si_name);
OpenPOWER on IntegriCloud