From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrick Mansfield Date: Mon, 01 Dec 2003 16:59:41 +0000 Subject: Re: pattern matching in udev 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 Sat, Nov 29, 2003 at 09:58:20PM +0100, Stephane Chauveau wrote: > LABEL is useless because the 'keys' are identical and TOPOLOGY > is also not what I want because the scsi host are not constant. > > The current solution is to use CALLOUT but a better way to do it > would be to add some simple pattern matching capabilities to udev. Yes, that sounds like a good idea. > For example using the usual * and ? : > > LABEL, BUS="scsi", vendor="ImageMate CF-SM ", ID="*:0:0:0" , NAME="mem0-%n" > LABEL, BUS="scsi", vendor="ImageMate CF-SM ", ID="*:0:0:1" , NAME="mem1-%n" > Or even better using regular expressions that could be reused to build > the final name: > > REGEXP "<$bus><$vendor><$id>"="<.*:0:0:\(.*\)>", > NAME="mem\1-%n" IMO the pattern matching should be part of the TOPOLOGY plus PLACE. The scsi naming also requires a parent, your example above is only valid if you have one host adapter connected (or one usb mass storage device attached), there could exist another sd on *:0:0:0. The matching should be capable of including the parent path, or more easily but uglier, the whole sysfs path. For example: Two usb mass storage at LUN 0 and LUN1: /sysfs/devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1:1.0/host0/0:0:0:0 /sysfs/devices/pci0000:00/0000:00:07.2/usb1/1-1/1-1:1.0/host0/0:0:0:1 And a system with a scsi host adapter with a single device at LUN 0: /sysfs/devices/pci0000:01/0000:01:0c.0/host1/1:0:0:0 Could be named via: TOPOLOGY, BUS="usb", place="pci0000:00/0000:00:07.2/usb1/1-1/1-1:1.0/*/*:0:0:0", NAME="mem0-%n" TOPOLOGY, BUS="usb", place="pci0000:00/0000:00:07.2/usb1/1-1/1-1:1.0/*/*:0:0:1", NAME="mem1-%n" TOPOLOGY, BUS="usb", place="pci0000:01/0000:01:0c.0/*/*:0:0:0" NAME="disk1%n" -- Patrick Mansfield ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ 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