From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Tue, 16 Dec 2003 00:21:58 +0000 Subject: Re: [udev] don't rely on field order in namedev_parse Message-Id: 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 Mon, Dec 15, 2003 at 02:36:04PM -0800, Greg KH wrote: > On Fri, Dec 12, 2003 at 08:36:03PM +0100, Kay Sievers wrote: > > Hi, > > here is a patch for the namedev-parser not to rely on the order of the > > fields given in the rule. The error handling now is relaxed, if a field is given > > twice, the last one wins. If a key is unknown we use it as a sysfs attribute. > > > > It is not as efficient as the current version, > > cause we need to loop over the list of known fields for every given field, > > but we are free to sort the fields in udev.rules. > > What do you think? > > I like the idea, it really cleans up the code a lot. But it looks like > it breaks the fact that we might want to test for the sysfs file "name" > in a rule, right? Yes, that's not nice. Two options come to my mind: o prepend SYSFS_ to the match, like: LABEL, BUS="usb", SYSFS_model="Creative Labs WebCam*", NAME="video%n" This is my favorite. It's close to the current and says clearly what it does. o switch to case sensitive field name match and hope nobody puts uppercase 'ID', 'BUS', 'NAME' in the kernel It's more like a text adventure :) What do you think? > > -#define TYPE_LABEL "LABEL" > > -#define TYPE_NUMBER "NUMBER" > > -#define TYPE_TOPOLOGY "TOPOLOGY" > > -#define TYPE_REPLACE "REPLACE" > > -#define TYPE_CALLOUT "CALLOUT" > > Why remove these? Oh I just wrote the code without it in mind and later simply removed it (being lazy). The field name strings are also embedded in the code, we may use #define's for the names of the fields too, then I'm happy :) thanks, Kay ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click _______________________________________________ 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