Patch to convert usb2 to use cdev
Rink Springer
rink at FreeBSD.org
Sun Nov 9 04:20:33 PST 2008
Hi everyone,
I've made a patch, available at http://rink.nu/tmp/usb-cdev.diff, which
removes the custom "/dev/usb " device, associated event handlers and
custom ownership/permissions structures and converts the whole deal to
use make_dev(9) and friends. The end result is that every USB device
will get a /dev entry, which can be chmod(1)-ed, chown(1)-ed etc as
usual - futhermore, possible races between looking up a device name and
opening it are completely removed by this patch [1]
usbconfig(8) works as before after applying the patch, but obviously,
commands that involve setting permissions or ownership will return an
error as those ioctl's are no longer present; I intend to remove them
completely and from usbconfig itself after this patch has been
committed.
Feel free to review this patch; I'd like to commit it to HEAD at the end
of the week or so.
[1] The previous code would set a global variable to determine which
USB device corresponds with the file being looked up, and a
subsequent open call would open this device. I don't know the VFS
well enough to determine if this can be exploited, but it doesn't
look right to me :-)
Regards,
--
Rink P.W. Springer - http://rink.nu
"Anyway boys, this is America. Just because you get more votes doesn't
mean you win." - Fox Mulder
More information about the freebsd-usb
mailing list