On Tue, Apr 13, 2010 at 06:53:39PM +0000, Jaakko Heinonen wrote: > Author: jh > Date: Tue Apr 13 18:53:39 2010 > New Revision: 206560 > URL: http://svn.freebsd.org/changeset/base/206560 > > Log: > - Ignore and report duplicate and empty device names in > devfs_populate_loop() > instead of causing erratic behavior. Currently make_dev(9) can't fail, so > there is no way to report an error to make_dev(9) callers. > - Disallow using "." and ".." in device path names. It didn't work > previously > but now it is reported rather than panicing. > - Treat multiple sequential slashes as single in device path names. > > Discussed with: pjd I think that this could be done more clean.
Main motivation of not changing make_dev(9) seems to be desire to avoid handling impossible errors for creation of simple-named devices, where device name is fully controlled by driver. On the other hand, make_dev(9) is sometimes used to create devfs node with externally-supplied name, that does not obey devfs naming rules, or cause some other irregularity. The make_dev_credf() signature can be changed to return int error code instead of void, and a flag, lets call it MAKEDEV_CHECKNAME, added, that specifies that make_dev_credf() is allowed to fail with error EINVAL if supplied name is not sane. If flag is not supplied, make_dev_credf() should KASSERT or even just panic(9) if name does not pass internal validation. Small comment about the patch itself: Collapsion of the consequent '/' may be done in make_dev_credv() immediately after vsnprintf().
pgp92mj2IcfOP.pgp
Description: PGP signature