From: Patrick Mansfield <patmans@us.ibm.com>
To: linux-hotplug@vger.kernel.org
Subject: Re: pattern matching in udev
Date: Mon, 01 Dec 2003 16:59:41 +0000 [thread overview]
Message-ID: <marc-linux-hotplug-107029809806277@msgid-missing> (raw)
In-Reply-To: <marc-linux-hotplug-107013956514187@msgid-missing>
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>"="<scsi><ImageMate.*><.*: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
next prev parent reply other threads:[~2003-12-01 16:59 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-29 20:58 pattern matching in udev Stephane Chauveau
2003-12-01 16:59 ` Patrick Mansfield [this message]
2003-12-02 0:21 ` Greg KH
2003-12-04 9:51 ` Olaf Hering
2003-12-04 10:17 ` Chauveau S.
2003-12-04 10:29 ` Ihno Krumreich
2003-12-04 10:34 ` Olaf Hering
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=marc-linux-hotplug-107029809806277@msgid-missing \
--to=patmans@us.ibm.com \
--cc=linux-hotplug@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).