Make life a little bit easier for cloning device drivers.

This commit is contained in:
Poul-Henning Kamp 2003-09-27 21:50:00 +00:00
parent 370d48ebe4
commit 98c469d484
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=120529

View File

@ -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);