diff options
author | phk <phk@FreeBSD.org> | 2001-10-27 17:44:21 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2001-10-27 17:44:21 +0000 |
commit | a298958ff19ad5e4d8416a9623b9d3e0601eefa3 (patch) | |
tree | 9c14f1616c72955669bdf28ab19ab8d89829a984 /sys/kern/kern_conf.c | |
parent | 4c52c72d92026ab3c4f2e80242e639274b443e09 (diff) | |
download | FreeBSD-src-a298958ff19ad5e4d8416a9623b9d3e0601eefa3.zip FreeBSD-src-a298958ff19ad5e4d8416a9623b9d3e0601eefa3.tar.gz |
Nudge the axe a bit closer to cdevsw[]:
Make it a panic to repeat make_dev() or destroy_dev(), this check
should maybe be neutered when -current goes -stable.
Whine if devsw() is called on anon dev_t's in a devfs system.
Make a hack to avoid our lazy-eval disk code triggering the above whine.
Fix the multiple make_dev() in disk code by making ${disk}${unit}s${slice}
an alias/symlink to ${disk}${unit}s${slice}c
Diffstat (limited to 'sys/kern/kern_conf.c')
-rw-r--r-- | sys/kern/kern_conf.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index ca42144..ef07c55 100644 --- a/sys/kern/kern_conf.c +++ b/sys/kern/kern_conf.c @@ -74,11 +74,20 @@ int devfs_present; static int free_devt; SYSCTL_INT(_debug, OID_AUTO, free_devt, CTLFLAG_RW, &free_devt, 0, ""); +/* XXX: This is a hack */ +void disk_dev_synth(dev_t dev); + struct cdevsw * devsw(dev_t dev) { if (dev->si_devsw) return (dev->si_devsw); + /* XXX: Hack around our backwards disk code */ + disk_dev_synth(dev); + if (dev->si_devsw) + return (dev->si_devsw); + if (devfs_present) + printf("WARNING: devsw() called on %s %u/%u\n", dev->si_name, major(dev), minor(dev)); return(cdevsw[major(dev)]); } @@ -283,6 +292,7 @@ make_dev(struct cdevsw *devsw, int minor, uid_t uid, gid_t gid, int perms, const if (dev->si_flags & SI_NAMED) { printf( "WARNING: Driver mistake: repeat make_dev(\"%s\")\n", dev->si_name); + panic("don't do that"); return (dev); } va_start(ap, fmt); @@ -350,6 +360,7 @@ destroy_dev(dev_t dev) if (!(dev->si_flags & SI_NAMED)) { printf( "WARNING: Driver mistake: destroy_dev on %d/%d\n", major(dev), minor(dev)); + panic("don't do that"); return; } |