From owner-freebsd-usb@FreeBSD.ORG Sun Nov 9 12:20:33 2008 Return-Path: Delivered-To: usb@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1CCD91065688 for ; Sun, 9 Nov 2008 12:20:33 +0000 (UTC) (envelope-from rink@rink.nu) Received: from mx1.rink.nu (gloom.rink.nu [213.34.49.2]) by mx1.freebsd.org (Postfix) with ESMTP id D3CEA8FC0A for ; Sun, 9 Nov 2008 12:20:32 +0000 (UTC) (envelope-from rink@rink.nu) Received: from localhost (localhost [127.0.0.1]) by mx1.rink.nu (Postfix) with ESMTP id 07A5E6D439 for ; Sun, 9 Nov 2008 13:03:01 +0100 (CET) X-Virus-Scanned: amavisd-new at rink.nu Received: from mx1.rink.nu ([213.34.49.2]) by localhost (gloom.rink.nu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ubMU+6vLAPDB for ; Sun, 9 Nov 2008 13:02:57 +0100 (CET) Received: by mx1.rink.nu (Postfix, from userid 1000) id E97236D42B; Sun, 9 Nov 2008 13:02:57 +0100 (CET) Date: Sun, 9 Nov 2008 13:02:57 +0100 From: Rink Springer To: usb@FreeBSD.org Message-ID: <20081109120257.GA78524@rink.nu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Cc: Subject: Patch to convert usb2 to use cdev X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Nov 2008 12:20:33 -0000 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