From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Tue, 31 May 2005 22:10:37 +0000 Subject: Re: Wishlist + bugs for udev-058 Message-Id: <20050531221037.GA27926@vrfy.org> List-Id: References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Tue, May 31, 2005 at 08:54:44PM +0200, Bodo Eggert wrote: > > I tried to make udev create the following device nodes for my usb > stick(s): > > /udev/usb/stick%E/disk > /udev/usb/stick%E/part%n > /udev/usb/stick%E/sg > /udev/usb/stick%E/default -> part1, if -e part1 > /udev/usb/stick%E/default -> disk , otherwise > > where %E is the same number for each node pointing to a given device, > starting with 0 (or 1, if you're a pascal programmer:). > > The best I could do was usb/%k/* without "default", and I had to use some > very ugly tricks. SCSI-devices are not numerically enumerated, so this will not work. Well, device node enumeration in general is a very bad idea on systems where devices can come and go at any time. Just forget the enumeration and switch to a naming-scheme, that uses persistent/unique attributes. > For those interested, I ended with: > > BUS="usb", DRIVER="usb-storage", KERNEL="sg*", PROGRAM="/bin/sh -c > '/usr/bin/readlink /sys/%p/device/block|/usr/bin/sed -e s,.\*/,,'" > NAME="usb/%c/sg", GROUP="root", OWNER="root", Mode="600" > BUS="usb", DRIVER="usb-storage", PROGRAM="/bin/bash -c 'a=%P;echo > ${a%%/disk};[ $a ]'", NAME="%c/part%n", GROUP="users", OWNER="root", > Mode="660" > BUS="usb", DRIVER="usb-storage", NAME="usb/%k/disk", GROUP="users", > OWNER="root", Mode60 > > These are the missing features and the bugs I encountered while I tried: > > Wish: Make sg devices be a child of their corresponding devices That's a kernel thing. Try to convince the scsi-guys. :) > Wish: Support really fprintf-like syntax > > Bug: PROGRAM="/bin/sh -c '/usr/bin/readlink \ > /sys/%p/device/block|/usr/bin/sed -e \ > s,.\*/,,'" will be run with an empty extra parameter Use a script for stuff like that. > Wish: Comparing using ! Doesn't it work? > Wish: Comparing and string replacement using extended regex > (compiletime-optional) Again, use a script if you need this. Udev supports only simple pattern matching like fnmatch(). > Wish: Direct access to the "parent device" variable. What does 'variable' mean? The name of the node? > Wish: Query the existence and the number of partitions. Look at sysfs for yourself. It's beyond the scope of udev. > Wish: User variables. I'd like to use e.g. V{name}="foo", V{name}="foo" > and NAME="%v{name}" Care to give a good real-world example why this is needed. > Wish: Remove empty directories on unlinking device nodes Doesn't it work? > Bug?: SYSFS{removable}="1" is found for /block/sdd, but not for > /block/sdd/sdd1. Is that intentional? How does the failing rule look like? You can match only against sysfs files in one and the same directory. SYSFS{../removable} may work as a bad trick. :) > Bug: udev stops to honor rules containing NAME="foo" after it has found > the first one. This behaviour is undocumentated. Fixed with the next version. > Misfeature: udevtest will not give debugging output unless udev will do > the same, and there is no way to get the debugging output without > reconfiguring syslog or changing the source code. If debugging is enabled, > the config parsing will be too chatty to be useful. Compile with debug, disable debug in the config and try: UDEV_LOG=7 ./udevinfo ... > Bug: Dependencies on logging.h are missing in the Makefile. Fixed with the next version. > Misfeature: Fancy make output on non-ttys, will mess up IDEs like jstar > and emacs. pass V=1 Kay ------------------------------------------------------- This SF.Net email is sponsored by Yahoo. Introducing Yahoo! Search Developer Network - Create apps using Yahoo! Search APIs Find out how you can build Yahoo! directly into your own Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005 _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel