summaryrefslogtreecommitdiff
path: root/test/udev-test.pl
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-02-16 21:36:34 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:32:28 -0700
commita27cd06c6d3c83d9906f5e1aaf8d3c4b32055830 (patch)
tree66b39f3edb9b9fc900988a071121fbf345d72fbc /test/udev-test.pl
parente68582be4a9522bb936a7c8adcd20991793d7d14 (diff)
[PATCH] Adding '%s' format specifier to NAME and SYMLINK
On Thu, Feb 12, 2004 at 05:34:57PM -0800, Greg KH wrote: > On Tue, Feb 10, 2004 at 09:14:20AM +0100, Hannes Reinecke wrote: > > Hi all, > > > > this patch makes the format for NAME and SYMLINK a bit more flexible: > > I've added a new format specifier '%s{<SYSFS_var>}', which allows for > > the value of any sysfs entry found for this device to be inserted. > > Example (for our S/390 fcp adapter): > > > > BUS="ccw", SYSFS_devtype="1732/03", NAME="%k" \ > > SYMLINK="zfcp-%s{hba_id}-%s{wwpn}:%s{fcp_lun}" > > > > I know this could also be done with an external program, but having this > > incorporated into udev makes life easier, especially if run from > > initramfs. Plus it makes the rules easier to follow, as the result is > > directly visible and need not to be looked up in some external program. > > > > Comments etc. welcome. > > Oops, sorry I missed this for the 017 release. I'll look at it tomorrow > and get back to you. At first glance it looks like a good thing. > > Oh, you forgot to update the documentation, that's important to do if > you want this change to make it in :) I took a part of the code and made a version that uses already implemented attribute finding logic. The parsing of the format length '%3x' and the '%x{attribute}' is a fuction now, maybe there are more possible users in the future. I've also added the test to udev-test.pl.
Diffstat (limited to 'test/udev-test.pl')
-rw-r--r--test/udev-test.pl10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl
index 62a2bb327b..cbe110f797 100644
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -194,6 +194,16 @@ BUS="scsi", PLACE="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b"
EOF
},
{
+ desc => "sustitution of sysfs value (%s{file})",
+ subsys => "block",
+ devpath => "block/sda",
+ expected => "disk-IBM-ESXS-sda" ,
+ conf => <<EOF
+BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="disk-%s{vendor}-%k"
+KERNEL="ttyUSB0", NAME="visor"
+EOF
+ },
+ {
desc => "program result substitution",
subsys => "block",
devpath => "block/sda/sda3",