linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] udev - switch SYSFS_file to SYSFS{file}
@ 2004-02-17  1:01 Kay Sievers
  2004-02-17  1:32 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Kay Sievers @ 2004-02-17  1:01 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

Here we switch the configs and man pages to the new attribute syntax.
Also the 'partition trick' is mentioned in udev.8

I think it's more clear visible now, that inside the brackets are user
supplied values used and not some magic keys handled:

  'SYSFS_dev' is now 'SYSFS{dev}'

The old syntax is still supported.


thanks,
Kay

[-- Attachment #2: 01-uderscore_to_bracket.patch --]
[-- Type: text/plain, Size: 9135 bytes --]

diff -Nru a/etc/udev/udev.rules b/etc/udev/udev.rules
--- a/etc/udev/udev.rules	Tue Feb 17 01:26:34 2004
+++ b/etc/udev/udev.rules	Tue Feb 17 01:26:34 2004
@@ -5,13 +5,13 @@
 BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c"
 
 # A usb camera.
-BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n"
+BUS="usb", SYSFS{vendor}="FUJIFILM", SYSFS{model}="M100", NAME="camera%n"
 
 # USB Epson printer to be called lp_epson
 BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson"
 
 # USB HP printer to be called lp_hp
-BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp"
+BUS="usb", SYSFS{serial}="W09090207101241330", NAME="lp_hp"
 
 # sound card with PCI bus id 00:0b.0 to be the first sound card
 BUS="pci", ID="00:0b.0", NAME="dsp"
diff -Nru a/etc/udev/udev.rules.gentoo b/etc/udev/udev.rules.gentoo
--- a/etc/udev/udev.rules.gentoo	Tue Feb 17 01:26:34 2004
+++ b/etc/udev/udev.rules.gentoo	Tue Feb 17 01:26:34 2004
@@ -23,13 +23,13 @@
 BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-42:0:0:1", NAME="%c"
 
 # A usb camera.
-BUS="usb", SYSFS_vendor="FUJIFILM", SYSFS_model="M100", NAME="camera%n"
+BUS="usb", SYSFS{vendor}="FUJIFILM", SYSFS{model}="M100", NAME="camera%n"
 
 # USB Epson printer to be called lp_epson
-BUS="usb", SYSFS_serial="HXOLL0012202323480", NAME="lp_epson"
+BUS="usb", SYSFS{serial}="HXOLL0012202323480", NAME="lp_epson"
 
 # USB HP printer to be called lp_hp
-BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_hp"
+BUS="usb", SYSFS{serial}="W09090207101241330", NAME="lp_hp"
 
 # sound card with PCI bus id 00:0b.0 to be the first sound card
 BUS="pci", ID="00:0b.0", NAME="dsp"
diff -Nru a/test/label_test b/test/label_test
--- a/test/label_test	Tue Feb 17 01:26:34 2004
+++ b/test/label_test	Tue Feb 17 01:26:34 2004
@@ -8,8 +8,8 @@
 export UDEV_CONFIG_FILE=$PWD/$CONFIG
 
 cat > $RULES << EOF
-BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW   !#", NAME="boot_diskX%n"
-BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW    !#", NAME="boot_disk%n"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW   !#", NAME="boot_diskX%n"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW    !#", NAME="boot_disk%n"
 EOF
 
 cat > $CONFIG << EOF
diff -Nru a/test/udev-test.pl b/test/udev-test.pl
--- a/test/udev-test.pl	Tue Feb 17 01:26:34 2004
+++ b/test/udev-test.pl	Tue Feb 17 01:26:34 2004
@@ -38,7 +38,7 @@
 		devpath  => "block/sda",
 		expected => "boot_disk" ,
 		conf     => <<EOF
-BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="boot_disk%n"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", NAME="boot_disk%n"
 KERNEL="ttyUSB0", NAME="visor"
 EOF
 	},
@@ -48,7 +48,7 @@
 		devpath  => "block/sda/sda1",
 		expected => "boot_disk1" ,
 		conf     => <<EOF
-BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="boot_disk%n"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", NAME="boot_disk%n"
 EOF
 	},
 	{
@@ -57,10 +57,10 @@
 		devpath  => "block/sda/sda1",
 		expected => "boot_disk1" ,
 		conf     => <<EOF
-BUS="scsi", SYSFS_vendor="?IBM-ESXS", NAME="boot_disk%n-1"
-BUS="scsi", SYSFS_vendor="IBM-ESXS?", NAME="boot_disk%n-2"
-BUS="scsi", SYSFS_vendor="IBM-ES??", NAME="boot_disk%n"
-BUS="scsi", SYSFS_vendor="IBM-ESXSS", NAME="boot_disk%n-3"
+BUS="scsi", SYSFS{vendor}="?IBM-ESXS", NAME="boot_disk%n-1"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS?", NAME="boot_disk%n-2"
+BUS="scsi", SYSFS{vendor}="IBM-ES??", NAME="boot_disk%n"
+BUS="scsi", SYSFS{vendor}="IBM-ESXSS", NAME="boot_disk%n-3"
 EOF
 	},
 	{
@@ -69,8 +69,8 @@
 		devpath  => "block/sda/sda1",
 		expected => "boot_disk1" ,
 		conf     => <<EOF
-BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW   !#", NAME="boot_diskX%n"
-BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW    !#", NAME="boot_disk%n"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW   !#", NAME="boot_diskX%n"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW    !#", NAME="boot_disk%n"
 EOF
 	},
 	{
@@ -79,8 +79,8 @@
 		devpath  => "block/sda/sda1",
 		expected => "boot_disk1" ,
 		conf     => <<EOF
-BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW    !#", SYSFS_scsi_level="4", SYSFS_rev="B245", SYSFS_type="2", SYSFS_queue_depth="32", NAME="boot_diskXX%n"
-BUS="scsi", SYSFS_vendor="IBM-ESXS", SYSFS_model="ST336605LW    !#", SYSFS_scsi_level="4", SYSFS_rev="B245", SYSFS_type="0", NAME="boot_disk%n"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW    !#", SYSFS{scsi_level}="4", SYSFS{rev}="B245", SYSFS{type}="2", SYSFS{queue_depth}="32", NAME="boot_diskXX%n"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", SYSFS{model}="ST336605LW    !#", SYSFS{scsi_level}="4", SYSFS{rev}="B245", SYSFS{type}="0", NAME="boot_disk%n"
 EOF
 	},
 	{
@@ -209,7 +209,7 @@
 		devpath  => "block/sda",
 		expected => "disk-IBM-ESXS-sda" ,
 		conf     => <<EOF
-BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="disk-%s{vendor}-%k"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", NAME="disk-%s{vendor}-%k"
 KERNEL="ttyUSB0", NAME="visor"
 EOF
 	},
@@ -279,7 +279,7 @@
 		devpath  => "class/tty/console",
 		expected => "TTY" ,
 		conf     => <<EOF
-BUS="foo", SYSFS_dev="5:1", NAME="foo"
+BUS="foo", SYSFS{dev}="5:1", NAME="foo"
 KERNEL="console", NAME="TTY"
 EOF
 	},
@@ -289,7 +289,7 @@
 		devpath  => "class/tty/console",
 		expected => "foo" ,
 		conf     => <<EOF
-SYSFS_dev="5:1", NAME="foo"
+SYSFS{dev}="5:1", NAME="foo"
 KERNEL="console", NAME="TTY"
 EOF
 	},
@@ -319,7 +319,7 @@
 		devpath  => "block/sda/sda2",
 		expected => "1/2/a/b/symlink" ,
 		conf     => <<EOF
-BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="1/2/node", SYMLINK="1/2/a/b/symlink"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", NAME="1/2/node", SYMLINK="1/2/a/b/symlink"
 EOF
 	},
 	{
@@ -328,7 +328,7 @@
 		devpath  => "block/sda/sda2",
 		expected => "1/2/symlink" ,
 		conf     => <<EOF
-BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/symlink"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/symlink"
 EOF
 	},
 	{
@@ -337,7 +337,7 @@
 		devpath  => "block/sda/sda2",
 		expected => "1/2/c/d/symlink" ,
 		conf     => <<EOF
-BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/c/d/symlink"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", NAME="1/2/a/b/node", SYMLINK="1/2/c/d/symlink"
 EOF
 	},
 	{
@@ -355,7 +355,7 @@
 		devpath  => "block/sda",
 		expected => "boot_disk15" ,
 		conf     => <<EOF
-BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME{all_partitions}="boot_disk"
+BUS="scsi", SYSFS{vendor}="IBM-ESXS", NAME{all_partitions}="boot_disk"
 EOF
 	},
 	{
@@ -364,7 +364,7 @@
 		devpath  => "class/tty/ttyUSB0",
 		expected => "visor" ,
 		conf     => <<EOF
-SYSFS_idProduct="2008", NAME="visor"
+SYSFS{idProduct}="2008", NAME="visor"
 EOF
 	},
 	{
diff -Nru a/udev.8 b/udev.8
--- a/udev.8	Tue Feb 17 01:26:34 2004
+++ b/udev.8	Tue Feb 17 01:26:34 2004
@@ -144,7 +144,7 @@
 .B PLACE
 Match the topological position on bus, like physical port of USB device
 .TP
-.BI SYSFS_ filename
+.BI SYSFS{ filename }
 Match sysfs device attribute like label, vendor, USB serial number, SCSI UUID
 or file system label.  Up to 5 different sysfs files can be checked, with
 all of the values being required in order to match the rule.
@@ -162,6 +162,13 @@
 .B PROGRAM
 call.
 .P
+The
+.B NAME
+field given with the attribute
+.BR NAME{ all_partitions }
+will  create all 15 partitions of a blockdevice.
+This may be useful for removable media devices.
+.P
 .RB "The " NAME " ," SYMLINK " and " PROGRAM
 fields support simple printf-like string substitution:
 .TP
@@ -199,10 +206,10 @@
 BUS="scsi", PROGRAM="/sbin/scsi_id", RESULT="OEM 0815", NAME="disk1"
 
 # USB printer to be called lp_color
-BUS="usb", SYSFS_serial="W09090207101241330", NAME="lp_color"
+BUS="usb", SYSFS{serial}="W09090207101241330", NAME="lp_color"
 
 # SCSI disk with a specific vendor and model number is to be called boot
-BUS="scsi", SYSFS_vendor="IBM", SYSFS_model="ST336", NAME="boot%n"
+BUS="scsi", SYSFS{vendor}="IBM", SYSFS{model}="ST336", NAME="boot%n"
 
 # sound card with PCI bus id 00:0b.0 to be called dsp
 BUS="pci", ID="00:0b.0", NAME="dsp"
@@ -214,7 +221,7 @@
 KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld"
 
 # multiple USB webcams with symlinks to be called webcam0, webcam1, ...
-BUS="usb", SYSFS_model="XV3", NAME="video%n", SYMLINK="webcam%n"
+BUS="usb", SYSFS{model}="XV3", NAME="video%n", SYMLINK="webcam%n"
 .fi
 .P
 Permissions and ownership for the created device files may specified at
diff -Nru a/udevinfo.8 b/udevinfo.8
--- a/udevinfo.8	Tue Feb 17 01:26:34 2004
+++ b/udevinfo.8	Tue Feb 17 01:26:34 2004
@@ -38,7 +38,7 @@
 .TP
 .B -a
 Print all
-.BI SYSFS_ filename
+.BI SYSFS{ filename }
 attributes along the device chain. Useful for for finding
 unique attributes to compose a rule.
 .RB Needs " -p " specified.
diff -Nru a/udevinfo.c b/udevinfo.c
--- a/udevinfo.c	Tue Feb 17 01:26:34 2004
+++ b/udevinfo.c	Tue Feb 17 01:26:34 2004
@@ -90,7 +90,7 @@
 				len--;
 			}
 			if (len == 0)
-				printf("    SYSFS_%s=\"%s\"\n", attr->name, value);
+				printf("    SYSFS{%s}=\"%s\"\n", attr->name, value);
 		}
 	}
 	printf("\n");

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-02-17  1:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-17  1:01 [PATCH] udev - switch SYSFS_file to SYSFS{file} Kay Sievers
2004-02-17  1:32 ` Greg KH

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).