devpath => "/block/sda",
exp_name => "boot_disk" ,
conf => <<EOF
-BUS="scsi", SYSFS{vendor}="IBM-ESXS", NAME="boot_disk%n"
-KERNEL="ttyUSB0", NAME="visor"
+BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", NAME="boot_disk%n"
+KERNEL=="ttyUSB0", NAME="visor"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "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
},
{
devpath => "/block/sda/sda1",
exp_name => "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
},
{
devpath => "/block/sda/sda1",
exp_name => "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
},
{
devpath => "/block/sda/sda1",
exp_name => "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
},
{
devpath => "/class/tty/ttyUSB0",
exp_name => "visor/0" ,
conf => <<EOF
-KERNEL="ttyUSB*", NAME="visor/%n"
+KERNEL=="ttyUSB*", NAME="visor/%n"
EOF
},
{
devpath => "/class/tty/ttyUSB0",
exp_name => "visor/0" ,
conf => <<EOF
-KERNEL="*USB1", NAME="bad"
-KERNEL="*USB0", NAME="visor/%n"
+KERNEL=="*USB1", NAME="bad"
+KERNEL=="*USB0", NAME="visor/%n"
EOF
},
{
devpath => "/class/tty/ttyUSB0",
exp_name => "visor/0" ,
conf => <<EOF
-KERNEL="ttyUSB??*", NAME="visor/%n-1"
-KERNEL="ttyUSB??", NAME="visor/%n-2"
-KERNEL="ttyUSB?", NAME="visor/%n"
+KERNEL=="ttyUSB??*", NAME="visor/%n-1"
+KERNEL=="ttyUSB??", NAME="visor/%n-2"
+KERNEL=="ttyUSB?", NAME="visor/%n"
EOF
},
{
devpath => "/class/tty/ttyUSB0",
exp_name => "visor/0" ,
conf => <<EOF
-KERNEL="ttyUSB[A-Z]*", NAME="visor/%n-1"
-KERNEL="ttyUSB?[0-9]", NAME="visor/%n-2"
-KERNEL="ttyUSB[0-9]*", NAME="visor/%n"
+KERNEL=="ttyUSB[A-Z]*", NAME="visor/%n-1"
+KERNEL=="ttyUSB?[0-9]", NAME="visor/%n-2"
+KERNEL=="ttyUSB[0-9]*", NAME="visor/%n"
EOF
},
{
devpath => "/class/tty/ttyUSB0",
exp_name => "visor" ,
conf => <<EOF
-KERNEL="ttyUSB0", NAME="visor"
+KERNEL=="ttyUSB0", NAME="visor"
EOF
},
{
exp_name => "visor" ,
conf => <<EOF
# this is a comment
-KERNEL="ttyUSB0", NAME="visor"
+KERNEL=="ttyUSB0", NAME="visor"
EOF
},
exp_name => "visor" ,
conf => <<EOF
# this is a comment with whitespace before the comment
-KERNEL="ttyUSB0", NAME="visor"
+KERNEL=="ttyUSB0", NAME="visor"
EOF
},
# this is a comment with whitespace before the comment
-KERNEL="ttyUSB0", NAME="whitespace"
+KERNEL=="ttyUSB0", NAME="whitespace"
exp_name => "visor" ,
conf => <<EOF
-KERNEL="ttyUSB0", NAME="visor"
+KERNEL=="ttyUSB0", NAME="visor"
EOF
},
devpath => "/class/tty/ttyUSB0",
exp_name => "visor" ,
conf => <<EOF
-KERNEL="ttyUSB0", \\
+KERNEL=="ttyUSB0", \\
NAME="visor"
EOF
devpath => "/class/tty/ttyUSB0",
exp_name => "aaa",
conf => <<EOF
-KERNEL="ttyUSB0", PROGRAM="/bin/echo -e \\101", RESULT="A", NAME="aaa"
+KERNEL=="ttyUSB0", PROGRAM=="/bin/echo -e \\101", RESULT=="A", NAME="aaa"
EOF
},
{
#\\
-KERNEL="ttyUSB0", \\
+KERNEL=="ttyUSB0", \\
NAME="visor"
EOF
devpath => "/class/tty/ttyUSB0",
exp_name => "sub/direct/ory/visor" ,
conf => <<EOF
-KERNEL="ttyUSB0", NAME="sub/direct/ory/visor"
+KERNEL=="ttyUSB0", NAME="sub/direct/ory/visor"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "first_disk3" ,
conf => <<EOF
-BUS="scsi", ID="0:0:0:0", NAME="first_disk%n"
+BUS=="scsi", ID=="0:0:0:0", NAME="first_disk%n"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" ,
conf => <<EOF
-BUS="scsi", ID="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b"
+BUS=="scsi", ID=="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "M8-m3-n3-b0:0-sIBM" ,
conf => <<EOF
-BUS="scsi", ID="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-s%3s{vendor}"
+BUS=="scsi", ID=="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-s%3s{vendor}"
EOF
},
{
devpath => "/block/sda",
exp_name => "good" ,
conf => <<EOF
-BUS="scsi", SYSFS_vendor="IBM-ESXS", NAME="good"
+BUS=="scsi", SYSFS_vendor=="IBM-ESXS", NAME="good"
EOF
},
{
devpath => "/block/sda",
exp_name => "disk-IBM-ESXS-sda" ,
conf => <<EOF
-BUS="scsi", SYSFS{vendor}="IBM-ESXS", NAME="disk-%s{vendor}-%k"
-KERNEL="ttyUSB0", NAME="visor"
+BUS=="scsi", SYSFS{vendor}=="IBM-ESXS", NAME="disk-%s{vendor}-%k"
+KERNEL=="ttyUSB0", NAME="visor"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "special-device-3" ,
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="-special-*", NAME="%c-1-%n"
-BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="special--*", NAME="%c-2-%n"
-BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="special-device-", NAME="%c-3-%n"
-BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="special-devic", NAME="%c-4-%n"
-BUS="scsi", PROGRAM="/bin/echo -n special-device", RESULT="special-*", NAME="%c-%n"
+BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="-special-*", NAME="%c-1-%n"
+BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special--*", NAME="%c-2-%n"
+BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-device-", NAME="%c-3-%n"
+BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-devic", NAME="%c-4-%n"
+BUS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="special-*", NAME="%c-%n"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "subsys_block" ,
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/echo", RESULT="block", NAME="subsys_block"
+BUS=="scsi", PROGRAM=="/bin/echo", RESULT=="block", NAME="subsys_block"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "newline_removed" ,
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/echo test", RESULT="test", NAME="newline_removed"
+BUS=="scsi", PROGRAM=="/bin/echo test", RESULT=="test", NAME="newline_removed"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "test-0:0:0:0" ,
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/echo -n test-%b", RESULT="test-0:0*", NAME="%c"
+BUS=="scsi", PROGRAM=="/bin/echo -n test-%b", RESULT=="test-0:0*", NAME="%c"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "escape-3" ,
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/echo -n escape-%%n", KERNEL="sda3", NAME="%c"
+BUS=="scsi", PROGRAM=="/bin/echo -n escape-%%n", KERNEL=="sda3", NAME="%c"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "foo9" ,
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL="sda3", NAME="%c{7}"
+BUS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda3", NAME="%c{7}"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "bar9" ,
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/sh -c 'echo foo3 foo4 foo5 foo6 foo7 foo8 foo9 | sed s/foo9/bar9/'", KERNEL="sda3", NAME="%c{7}"
+BUS=="scsi", PROGRAM=="/bin/sh -c 'echo foo3 foo4 foo5 foo6 foo7 foo8 foo9 | sed s/foo9/bar9/'", KERNEL=="sda3", NAME="%c{7}"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "foo7" ,
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/echo -n 'foo3 foo4' 'foo5 foo6 foo7 foo8'", KERNEL="sda3", NAME="%c{5}"
+BUS=="scsi", PROGRAM=="/bin/echo -n 'foo3 foo4' 'foo5 foo6 foo7 foo8'", KERNEL=="sda3", NAME="%c{5}"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "my-foo9" ,
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL="sda3", NAME="my-%c{7}"
+BUS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda3", NAME="my-%c{7}"
EOF
},
{
devpath => "/block/sda/sda3",
exp_name => "my-foo8" ,
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL="sda3", NAME="my-%c{6}"
+BUS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda3", NAME="my-%c{6}"
EOF
},
{
devpath => "/class/tty/console",
exp_name => "TTY" ,
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/echo -n foo", RESULT="foo", NAME="foo"
-KERNEL="console", NAME="TTY"
+BUS=="scsi", PROGRAM=="/bin/echo -n foo", RESULT=="foo", NAME="foo"
+KERNEL=="console", NAME="TTY"
EOF
},
{
devpath => "/class/tty/console",
exp_name => "foo" ,
conf => <<EOF
-PROGRAM="/bin/echo -n foo", RESULT="foo", NAME="foo"
-KERNEL="console", NAME="TTY"
+PROGRAM=="/bin/echo -n foo", RESULT=="foo", NAME="foo"
+KERNEL=="console", NAME="TTY"
EOF
},
{
devpath => "/class/tty/console",
exp_name => "TTY" ,
conf => <<EOF
-BUS="foo", SYSFS{dev}="5:1", NAME="foo"
-KERNEL="console", NAME="TTY"
+BUS=="foo", SYSFS{dev}=="5:1", NAME="foo"
+KERNEL=="console", NAME="TTY"
EOF
},
{
devpath => "/class/tty/console",
exp_name => "foo" ,
conf => <<EOF
-SYSFS{dev}="5:1", NAME="foo"
-KERNEL="console", NAME="TTY"
+SYSFS{dev}=="5:1", NAME="foo"
+KERNEL=="console", NAME="TTY"
EOF
},
{
devpath => "/block/sda",
exp_name => "scsi-0:0:0:0" ,
conf => <<EOF
-BUS="usb", PROGRAM="/bin/echo -n usb-%b", NAME="%c"
-BUS="scsi", PROGRAM="/bin/echo -n scsi-%b", NAME="%c"
-BUS="foo", PROGRAM="/bin/echo -n foo-%b", NAME="%c"
+BUS=="usb", PROGRAM=="/bin/echo -n usb-%b", NAME="%c"
+BUS=="scsi", PROGRAM=="/bin/echo -n scsi-%b", NAME="%c"
+BUS=="foo", PROGRAM=="/bin/echo -n foo-%b", NAME="%c"
EOF
},
{
devpath => "/block/sda",
exp_name => "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
},
{
devpath => "/class/tty/ttyUSB0",
exp_name => "visor" ,
conf => <<EOF
-SYSFS{idProduct}="2008", NAME="visor"
+SYSFS{idProduct}=="2008", NAME="visor"
EOF
},
{
devpath => "/block/rd!c0d0",
exp_name => "rd/c0d0" ,
conf => <<EOF
-BUS="scsi", NAME="%k"
-KERNEL="ttyUSB0", NAME="visor"
+BUS=="scsi", NAME="%k"
+KERNEL=="ttyUSB0", NAME="visor"
EOF
},
{
devpath => "/block/rd!c0d0",
exp_name => "rd/c0d0" ,
conf => <<EOF
-KERNEL="ttyUSB0", NAME="visor"
+KERNEL=="ttyUSB0", NAME="visor"
EOF
},
{
devpath => "/block/cciss!c0d0/cciss!c0d0p1",
exp_name => "cciss/c0d0p1" ,
conf => <<EOF
-BUS="scsi", NAME="%k"
-KERNEL="ttyUSB0", NAME="visor"
+BUS=="scsi", NAME="%k"
+KERNEL=="ttyUSB0", NAME="visor"
EOF
},
{
devpath => "/block/sda",
exp_name => "scsi-0:0:0:0",
conf => <<EOF
-BUS="usb", ID="0:0:0:0", NAME="not-scsi"
-BUS="scsi", ID="0:0:0:1", NAME="no-match"
-BUS="scsi", ID=":0", NAME="short-id"
-BUS="scsi", ID="/0:0:0:0", NAME="no-match"
-BUS="scsi", ID="0:0:0:0", NAME="scsi-0:0:0:0"
+BUS=="usb", ID=="0:0:0:0", NAME="not-scsi"
+BUS=="scsi", ID=="0:0:0:1", NAME="no-match"
+BUS=="scsi", ID==":0", NAME="short-id"
+BUS=="scsi", ID=="/0:0:0:0", NAME="no-match"
+BUS=="scsi", ID=="0:0:0:0", NAME="scsi-0:0:0:0"
EOF
},
{
devpath => "/block/sda",
exp_name => "scsi-0:0:0:0",
conf => <<EOF
-BUS="scsi", ID="*:1", NAME="no-match"
-BUS="scsi", ID="*:0:1", NAME="no-match"
-BUS="scsi", ID="*:0:0:1", NAME="no-match"
-BUS="scsi", ID="*", NAME="scsi-0:0:0:0"
-BUS="scsi", ID="0:0:0:0", NAME="bad"
+BUS=="scsi", ID=="*:1", NAME="no-match"
+BUS=="scsi", ID=="*:0:1", NAME="no-match"
+BUS=="scsi", ID=="*:0:0:1", NAME="no-match"
+BUS=="scsi", ID=="*", NAME="scsi-0:0:0:0"
+BUS=="scsi", ID=="0:0:0:0", NAME="bad"
EOF
},
{
devpath => "/block/sda",
exp_name => "scsi-0:0:0:0",
conf => <<EOF
-BUS="scsi", ID="*:0", NAME="scsi-0:0:0:0"
-BUS="scsi", ID="0:0:0:0", NAME="bad"
+BUS=="scsi", ID=="*:0", NAME="scsi-0:0:0:0"
+BUS=="scsi", ID=="0:0:0:0", NAME="bad"
EOF
},
{
devpath => "/block/sda",
exp_name => "scsi-0:0:0:0",
conf => <<EOF
-BUS="scsi", ID="*:0:0:0", NAME="scsi-0:0:0:0"
-BUS="scsi", ID="0:0:0:0", NAME="bad"
+BUS=="scsi", ID=="*:0:0:0", NAME="scsi-0:0:0:0"
+BUS=="scsi", ID=="0:0:0:0", NAME="bad"
EOF
},
{
devpath => "/block/sda",
exp_name => "ignored",
conf => <<EOF
-BUS="scsi", SYSFS{whitespace_test}="WHITE SPACE", NAME="ignored"
+BUS=="scsi", SYSFS{whitespace_test}=="WHITE SPACE", NAME="ignored"
EOF
},
{
devpath => "/block/sda",
exp_name => "matched-with-space",
conf => <<EOF
-BUS="scsi", SYSFS{whitespace_test}="WHITE SPACE ", NAME="wrong-to-ignore"
-BUS="scsi", SYSFS{whitespace_test}="WHITE SPACE ", NAME="matched-with-space"
+BUS=="scsi", SYSFS{whitespace_test}=="WHITE SPACE ", NAME="wrong-to-ignore"
+BUS=="scsi", SYSFS{whitespace_test}=="WHITE SPACE ", NAME="matched-with-space"
EOF
},
{
exp_name => "tty33",
exp_perms => "0:0:0660",
conf => <<EOF
-KERNEL="tty33", NAME="tty33", OWNER="bad", GROUP="name"
+KERNEL=="tty33", NAME="tty33", OWNER="bad", GROUP="name"
EOF
},
{
exp_name => "node",
exp_perms => "5000::0660",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="node", OWNER="5000"
+BUS=="scsi", KERNEL=="sda", NAME="node", OWNER="5000"
EOF
},
{
exp_name => "node",
exp_perms => ":100:0660",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="node", GROUP="100"
+BUS=="scsi", KERNEL=="sda", NAME="node", GROUP="100"
EOF
},
{
exp_name => "node",
exp_perms => "::0777",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="node", MODE="0777"
+BUS=="scsi", KERNEL=="sda", NAME="node", MODE="0777"
EOF
},
{
exp_name => "node",
exp_perms => "5000:100:0777",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="node", OWNER="5000", GROUP="100", MODE="0777"
+BUS=="scsi", KERNEL=="sda", NAME="node", OWNER="5000", GROUP="100", MODE="0777"
EOF
},
{
exp_name => "ttyUSB0",
exp_perms => "5000::",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", OWNER="5000"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", OWNER="5000"
EOF
},
{
exp_name => "ttyUSB0",
exp_perms => ":100:0660",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", GROUP="100"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", GROUP="100"
EOF
},
{
exp_name => "ttyUSB0",
exp_perms => "::0060",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", MODE="0060"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", MODE="0060"
EOF
},
{
exp_name => "ttyUSB0",
exp_perms => "5000:100:0777",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", OWNER="5000", GROUP="100", MODE="0777"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", OWNER="5000", GROUP="100", MODE="0777"
EOF
},
{
exp_name => "ttyUSB0",
exp_perms => "5000:100:0777",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", OWNER="5000", GROUP="100", MODE="0777"
-KERNEL="ttyUSX[0-9]*", OWNER="5001", GROUP="101", MODE="0444"
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n"
+KERNEL=="ttyUSB[0-9]*", OWNER="5000", GROUP="100", MODE="0777"
+KERNEL=="ttyUSX[0-9]*", OWNER="5001", GROUP="101", MODE="0444"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n"
EOF
},
{
exp_name => "ttyUSB0",
exp_perms => "3000:4000:0777",
conf => <<EOF
-SUBSYSTEM="tty", OWNER="3000"
-SUBSYSTEM="tty", GROUP="4000"
-SUBSYSTEM="tty", MODE="0777"
-KERNEL="ttyUSX[0-9]*", OWNER="5001", GROUP="101", MODE="0444"
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n"
+SUBSYSTEM=="tty", OWNER="3000"
+SUBSYSTEM=="tty", GROUP="4000"
+SUBSYSTEM=="tty", MODE="0777"
+KERNEL=="ttyUSX[0-9]*", OWNER="5001", GROUP="101", MODE="0444"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n"
EOF
},
{
exp_name => "ttyUSB0",
exp_perms => "3000:8000:0777",
conf => <<EOF
-SUBSYSTEM="tty", OWNER="3000"
-SUBSYSTEM="tty", GROUP="4000"
-SUBSYSTEM="tty", MODE="0777"
-KERNEL="ttyUSX[0-9]*", OWNER="5001", GROUP="101", MODE="0444"
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", GROUP="8000"
+SUBSYSTEM=="tty", OWNER="3000"
+SUBSYSTEM=="tty", GROUP="4000"
+SUBSYSTEM=="tty", MODE="0777"
+KERNEL=="ttyUSX[0-9]*", OWNER="5001", GROUP="101", MODE="0444"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", GROUP="8000"
EOF
},
{
exp_name => "node",
exp_majorminor => "8:0",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="node"
+BUS=="scsi", KERNEL=="sda", NAME="node"
EOF
},
{
exp_name => "node",
exp_majorminor => "89:300",
conf => <<EOF
-KERNEL="i2c-300", NAME="node"
+KERNEL=="i2c-300", NAME="node"
EOF
},
{
exp_name => "node",
exp_majorminor => "4095:1",
conf => <<EOF
-KERNEL="i2c-fake1", NAME="node"
+KERNEL=="i2c-fake1", NAME="node"
EOF
},
{
exp_name => "node",
exp_majorminor => "4094:89999",
conf => <<EOF
-KERNEL="i2c-fake2", NAME="node"
+KERNEL=="i2c-fake2", NAME="node"
EOF
},
{
exp_name => "symlink2-ttyUSB0",
exp_target => "ttyUSB0",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="symlink1-%n symlink2-%k symlink3-%b"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="symlink1-%n symlink2-%k symlink3-%b"
EOF
},
{
exp_name => "visor0",
exp_target => "ttyUSB0",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="visor%n"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="visor%n"
EOF
},
{
exp_name => "1/2/symlink" ,
exp_target => "a/b/node",
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
},
{
exp_name => "1/2/c/d/symlink" ,
exp_target => "../../a/b/node",
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
},
{
exp_name => "second-0" ,
exp_target => "visor" ,
conf => <<EOF
-KERNEL="ttyUSB0", NAME="visor", SYMLINK="first-%n second-%n third-%n"
+KERNEL=="ttyUSB0", NAME="visor", SYMLINK="first-%n second-%n third-%n"
EOF
},
{
exp_name => "symlink-only2",
exp_target => "link",
conf => <<EOF
-BUS="scsi", KERNEL="sda", SYMLINK="symlink-only1"
-BUS="scsi", KERNEL="sda", SYMLINK="symlink-only2"
-BUS="scsi", KERNEL="sda", NAME="link", SYMLINK="symlink0"
+BUS=="scsi", KERNEL=="sda", SYMLINK="symlink-only1"
+BUS=="scsi", KERNEL=="sda", SYMLINK="symlink-only2"
+BUS=="scsi", KERNEL=="sda", NAME="link", SYMLINK="symlink0"
EOF
},
{
exp_add_error => "yes",
exp_rem_error => "yes",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="link", SYMLINK="."
+BUS=="scsi", KERNEL=="sda", NAME="link", SYMLINK="."
EOF
},
{
exp_rem_error => "yes",
option => "clear",
conf => <<EOF
-KERNEL="tty0", NAME="link", SYMLINK="link"
+KERNEL=="tty0", NAME="link", SYMLINK="link"
EOF
},
{
exp_name => "symlink0",
exp_target => "ttyUSB0",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="symlink%n"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="symlink%n"
EOF
},
{
exp_name => "symlink-ttyUSB0",
exp_target => "ttyUSB0",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="symlink-%k"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="symlink-%k"
EOF
},
{
exp_name => "major-188:0",
exp_target => "ttyUSB0",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="major-%M:%m"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="major-%M:%m"
EOF
},
{
exp_name => "symlink-0:0:0:0",
exp_target => "node",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="node", SYMLINK="symlink-%b"
+BUS=="scsi", KERNEL=="sda", NAME="node", SYMLINK="symlink-%b"
EOF
},
{
exp_name => "test",
exp_target => "ttyUSB0",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", PROGRAM="/bin/echo test" NAME="ttyUSB%n", SYMLINK="%c"
+KERNEL=="ttyUSB[0-9]*", PROGRAM=="/bin/echo test" NAME="ttyUSB%n", SYMLINK="%c"
EOF
},
{
exp_name => "test",
exp_target => "ttyUSB0",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", PROGRAM="/bin/echo symlink test this" NAME="ttyUSB%n", SYMLINK="%c{2}"
+KERNEL=="ttyUSB[0-9]*", PROGRAM=="/bin/echo symlink test this" NAME="ttyUSB%n", SYMLINK="%c{2}"
EOF
},
{
exp_name => "this",
exp_target => "ttyUSB0",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", PROGRAM="/bin/echo symlink test this" NAME="ttyUSB%n", SYMLINK="%c{2+}"
+KERNEL=="ttyUSB[0-9]*", PROGRAM=="/bin/echo symlink test this" NAME="ttyUSB%n", SYMLINK="%c{2+}"
EOF
},
{
exp_name => "test",
exp_target => "link",
conf => <<EOF
-BUS="scsi", KERNEL="sda", PROGRAM="/bin/echo link test this" SYMLINK="%c{2+}"
-BUS="scsi", KERNEL="sda", NAME="link", SYMLINK="symlink0"
+BUS=="scsi", KERNEL=="sda", PROGRAM=="/bin/echo link test this" SYMLINK="%c{2+}"
+BUS=="scsi", KERNEL=="sda", NAME="link", SYMLINK="symlink0"
EOF
},
{
exp_name => "188:0",
exp_target => "ttyUSB0",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="%s{dev}"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="%s{dev}"
EOF
},
{
exp_name => "188",
exp_target => "ttyUSB0",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="%3s{dev}"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="%3s{dev}"
EOF
},
{
exp_name => "percent%sign",
exp_target => "ttyUSB0",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="percent%%sign"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="percent%%sign"
EOF
},
{
exp_name => "%ttyUSB0_name",
exp_target => "ttyUSB0",
conf => <<EOF
-KERNEL="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="%%%k_name"
+KERNEL=="ttyUSB[0-9]*", NAME="ttyUSB%n", SYMLINK="%%%k_name"
EOF
},
{
exp_name => "link1",
exp_target => "node",
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/echo -n node link1 link2", RESULT="node *", NAME="%c{1}", SYMLINK="%c{2} %c{3}"
+BUS=="scsi", PROGRAM=="/bin/echo -n node link1 link2", RESULT=="node *", NAME="%c{1}", SYMLINK="%c{2} %c{3}"
EOF
},
{
exp_name => "link4",
exp_target => "node",
conf => <<EOF
-BUS="scsi", PROGRAM="/bin/echo -n node link1 link2 link3 link4", RESULT="node *", NAME="%c{1}", SYMLINK="%c{2+}"
+BUS=="scsi", PROGRAM=="/bin/echo -n node link1 link2 link3 link4", RESULT=="node *", NAME="%c{1}", SYMLINK="%c{2+}"
EOF
},
{
devpath => "/block/sda",
exp_name => "cdrom",
conf => <<EOF
-KERNEL="sda", NAME="cdrom%e"
+KERNEL=="sda", NAME="cdrom%e"
EOF
},
{
exp_name => "cdrom",
option => "keep",
conf => <<EOF
-KERNEL="sda", NAME="cdrom%e"
+KERNEL=="sda", NAME="cdrom%e"
EOF
},
{
exp_name => "enum",
option => "keep",
conf => <<EOF
-KERNEL="sda1", NAME="enum%e"
+KERNEL=="sda1", NAME="enum%e"
EOF
},
{
exp_name => "cdrom1",
option => "keep",
conf => <<EOF
-KERNEL="sda2", NAME="cdrom%e"
+KERNEL=="sda2", NAME="cdrom%e"
EOF
},
{
exp_name => "enum1",
option => "keep",
conf => <<EOF
-KERNEL="sda3", NAME="enum%e"
+KERNEL=="sda3", NAME="enum%e"
EOF
},
{
exp_name => "cdrom2",
option => "clear",
conf => <<EOF
-KERNEL="sda4", NAME="cdrom%e"
+KERNEL=="sda4", NAME="cdrom%e"
EOF
},
{
devpath => "/block/sda",
exp_name => "cdrom",
conf => <<EOF
-KERNEL="sda", NAME="cdrom%e"
+KERNEL=="sda", NAME="cdrom%e"
EOF
},
{
exp_name => "node",
exp_add_error => "yes",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="node", OPTIONS="ignore"
+BUS=="scsi", KERNEL=="sda", NAME="node", OPTIONS="ignore"
EOF
},
{
devpath => "/block/sda",
exp_name => "node6",
conf => <<EOF
-SUBSYSTEM="block", OPTIONS="all_partitions"
-BUS="scsi", KERNEL="sda", NAME="node"
+SUBSYSTEM=="block", OPTIONS="all_partitions"
+BUS=="scsi", KERNEL=="sda", NAME="node"
EOF
},
{
exp_name => "node6",
exp_add_error => "yes",
conf => <<EOF
-SUBSYSTEM="block", OPTIONS="all_partitions"
-BUS="scsi", KERNEL="sda", NAME="node"
+SUBSYSTEM=="block", OPTIONS="all_partitions"
+BUS=="scsi", KERNEL=="sda", NAME="node"
EOF
},
{
exp_name => "node",
exp_rem_error => "yes",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="node", OPTIONS="ignore_remove"
+BUS=="scsi", KERNEL=="sda", NAME="node", OPTIONS="ignore_remove"
EOF
},
{
exp_rem_error => "yes",
option => "clear",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="node", OPTIONS="ignore_remove, all_partitions"
+BUS=="scsi", KERNEL=="sda", NAME="node", OPTIONS="ignore_remove, all_partitions"
EOF
},
{
devpath => "/block/sda",
exp_name => "node",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="should_not_match", SUBSYSTEM="vc"
-BUS="scsi", KERNEL="sda", NAME="node", SUBSYSTEM="block"
-BUS="scsi", KERNEL="sda", NAME="should_not_match2", SUBSYSTEM="vc"
+BUS=="scsi", KERNEL=="sda", NAME="should_not_match", SUBSYSTEM=="vc"
+BUS=="scsi", KERNEL=="sda", NAME="node", SUBSYSTEM=="block"
+BUS=="scsi", KERNEL=="sda", NAME="should_not_match2", SUBSYSTEM=="vc"
EOF
},
{
devpath => "/block/sda",
exp_name => "node",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="should_not_match", DRIVER="sd-wrong"
-BUS="scsi", KERNEL="sda", NAME="node", DRIVER="sd"
+BUS=="scsi", KERNEL=="sda", NAME="should_not_match", DRIVER=="sd-wrong"
+BUS=="scsi", KERNEL=="sda", NAME="node", DRIVER=="sd"
EOF
},
{
devpath => "/block/sda",
exp_name => "node",
conf => <<EOF
-BUS="scsi", KERNEL="sda", PROGRAM="/usr/bin/test -b %N" NAME="node"
+BUS=="scsi", KERNEL=="sda", PROGRAM=="/usr/bin/test -b %N" NAME="node"
EOF
},
{
devpath => "/block/sda",
exp_name => "sda",
conf => <<EOF
-BUS="scsi", KERNEL="sda", PROGRAM="/bin/echo %p", RESULT="/block/sda" NAME="%k"
+BUS=="scsi", KERNEL=="sda", PROGRAM=="/bin/echo %p", RESULT=="/block/sda" NAME="%k"
EOF
},
{
exp_name => "main_device",
option => "keep",
conf => <<EOF
-BUS="scsi", KERNEL="sda", NAME="main_device"
+BUS=="scsi", KERNEL=="sda", NAME="main_device"
EOF
},
{
exp_name => "main_device-part-1",
option => "clean",
conf => <<EOF
-BUS="scsi", KERNEL="sda1", NAME="%P-part-1"
+BUS=="scsi", KERNEL=="sda1", NAME="%P-part-1"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "start-udev-root-end",
conf => <<EOF
-BUS="scsi", KERNEL="sda1", NAME="start-%r-end"
+BUS=="scsi", KERNEL=="sda1", NAME="start-%r-end"
EOF
},
{
devpath => "/block/sda/sda1",
exp_name => "last",
conf => <<EOF
-BUS="scsi", KERNEL="sda1", SYMLINK="last", OPTIONS="last_rule"
-BUS="scsi", KERNEL="sda1", NAME="very-last"
+BUS=="scsi", KERNEL=="sda1", SYMLINK="last", OPTIONS="last_rule"
+BUS=="scsi", KERNEL=="sda1", NAME="very-last"
+EOF
+ },
+ {
+ desc => "negation KERNEL!=",
+ subsys => "block",
+ devpath => "/block/sda/sda1",
+ exp_name => "match",
+ conf => <<EOF
+BUS=="scsi", KERNEL!="sda1", NAME="matches-but-is-negated"
+BUS=="scsi", KERNEL!="xsda1", NAME="match"
+BUS=="scsi", KERNEL=="sda1", NAME="wrong"
+EOF
+ },
+ {
+ desc => "negation SUBSYSTEM!=",
+ subsys => "block",
+ devpath => "/block/sda/sda1",
+ exp_name => "not-anything",
+ conf => <<EOF
+BUS=="scsi", SUBSYSTEM=="block", KERNEL!="sda1", NAME="matches-but-is-negated"
+BUS=="scsi", SUBSYSTEM!="anything", NAME="not-anything"
+BUS=="scsi", KERNEL=="sda1", NAME="wrong"
+EOF
+ },
+ {
+ desc => "negation PROGRAM!= exit code",
+ subsys => "block",
+ devpath => "/block/sda/sda1",
+ exp_name => "nonzero-program",
+ conf => <<EOF
+KERNEL=="sda1", PROGRAM!="/bin/false", NAME="nonzero-program"
+BUS=="scsi", KERNEL=="sda1", NAME="wrong"
EOF
},
);
udev_rule_dump(rule);
}
+static int get_key(char **line, char **key, enum key_operation *operation, char **value)
+{
+ char *linepos;
+ char *temp;
+
+ linepos = *line;
+ if (!linepos)
+ return -1;
+
+ /* skip whitespace */
+ while (isspace(linepos[0]) || linepos[0] == ',')
+ linepos++;
+
+ /* get the key */
+ *key = linepos;
+ while (1) {
+ linepos++;
+ if (linepos[0] == '\0')
+ return -1;
+ if (isspace(linepos[0]))
+ break;
+ if (linepos[0] == '=')
+ break;
+ if (linepos[0] == '+')
+ break;
+ if (linepos[0] == '!')
+ break;
+ }
+
+ /* remember end of key */
+ temp = linepos;
+
+ /* skip whitespace after key */
+ while (isspace(linepos[0]))
+ linepos++;
+
+ /* get operation type */
+ if (linepos[0] == '=' && linepos[1] == '=') {
+ *operation = KEY_OP_MATCH;
+ linepos += 2;
+ dbg("operator=match");
+ } else if (linepos[0] == '!' && linepos[1] == '=') {
+ *operation = KEY_OP_NOMATCH;
+ linepos += 2;
+ dbg("operator=nomatch");
+ } else if (linepos[0] == '+' && linepos[1] == '=') {
+ *operation = KEY_OP_ADD;
+ linepos += 2;
+ dbg("operator=add");
+ } else if (linepos[0] == '=') {
+ *operation = KEY_OP_ASSIGN;
+ linepos++;
+ dbg("operator=assign");
+ } else
+ return -1;
+
+ /* terminate key */
+ temp[0] = '\0';
+ dbg("key='%s'", *key);
+
+ /* skip whitespace after operator */
+ while (isspace(linepos[0]))
+ linepos++;
+
+ /* get the value*/
+ if (linepos[0] == '"')
+ linepos++;
+ else
+ return -1;
+ *value = linepos;
+
+ temp = strchr(linepos, '"');
+ if (!temp)
+ return -1;
+ temp[0] = '\0';
+ temp++;
+ dbg("value='%s'", *value);
+
+ /* move line to next key */
+ *line = temp;
+
+ return 0;
+}
+
/* extract possible KEY{attr} */
static char *get_key_attribute(char *str)
{
char line[LINE_SIZE];
char *bufline;
int lineno;
- char *temp;
- char *temp2;
- char *temp3;
+ char *linepos;
char *attr;
char *buf;
size_t bufsize;
int retval = 0;
struct udev_rule rule;
- if (file_map(filename, &buf, &bufsize) == 0) {
- dbg("reading '%s' as rules file", filename);
- } else {
+ if (file_map(filename, &buf, &bufsize) != 0) {
dbg("can't open '%s' as rules file", filename);
return -1;
}
+ dbg("reading '%s' as rules file", filename);
/* loop through the whole file */
cur = 0;
/* get all known keys */
memset(&rule, 0x00, sizeof(struct udev_rule));
- temp = line;
+ linepos = line;
valid = 0;
while (1) {
- retval = parse_get_pair(&temp, &temp2, &temp3);
+ char *key;
+ char *value;
+ enum key_operation operation = KEY_OP_UNKNOWN;
+
+ retval = get_key(&linepos, &key, &operation, &value);
if (retval)
break;
- if (strcasecmp(temp2, FIELD_KERNEL) == 0) {
- strlcpy(rule.kernel, temp3, sizeof(rule.kernel));
+ if (strcasecmp(key, KEY_KERNEL) == 0) {
+ strlcpy(rule.kernel, value, sizeof(rule.kernel));
+ rule.kernel_operation = operation;
valid = 1;
continue;
}
- if (strcasecmp(temp2, FIELD_SUBSYSTEM) == 0) {
- strlcpy(rule.subsystem, temp3, sizeof(rule.subsystem));
+ if (strcasecmp(key, KEY_SUBSYSTEM) == 0) {
+ strlcpy(rule.subsystem, value, sizeof(rule.subsystem));
+ rule.subsystem_operation = operation;
valid = 1;
continue;
}
- if (strcasecmp(temp2, FIELD_BUS) == 0) {
- strlcpy(rule.bus, temp3, sizeof(rule.bus));
+ if (strcasecmp(key, KEY_BUS) == 0) {
+ strlcpy(rule.bus, value, sizeof(rule.bus));
+ rule.bus_operation = operation;
valid = 1;
continue;
}
- if (strcasecmp(temp2, FIELD_ID) == 0) {
- strlcpy(rule.id, temp3, sizeof(rule.id));
+ if (strcasecmp(key, KEY_ID) == 0) {
+ strlcpy(rule.id, value, sizeof(rule.id));
+ rule.id_operation = operation;
valid = 1;
continue;
}
- if (strncasecmp(temp2, FIELD_SYSFS, sizeof(FIELD_SYSFS)-1) == 0) {
+ if (strncasecmp(key, KEY_SYSFS, sizeof(KEY_SYSFS)-1) == 0) {
struct sysfs_pair *pair = &rule.sysfs_pair[0];
int sysfs_pair_num = 0;
++pair;
}
if (pair) {
- attr = get_key_attribute(temp2 + sizeof(FIELD_SYSFS)-1);
+ attr = get_key_attribute(key + sizeof(KEY_SYSFS)-1);
if (attr == NULL) {
- dbg("error parsing " FIELD_SYSFS " attribute");
+ dbg("error parsing " KEY_SYSFS " attribute");
continue;
}
strlcpy(pair->file, attr, sizeof(pair->file));
- strlcpy(pair->value, temp3, sizeof(pair->value));
+ strlcpy(pair->value, value, sizeof(pair->value));
+ pair->operation = operation;
valid = 1;
}
continue;
}
- if (strcasecmp(temp2, FIELD_DRIVER) == 0) {
- strlcpy(rule.driver, temp3, sizeof(rule.driver));
+ if (strcasecmp(key, KEY_DRIVER) == 0) {
+ strlcpy(rule.driver, value, sizeof(rule.driver));
+ rule.driver_operation = operation;
valid = 1;
continue;
}
- if (strcasecmp(temp2, FIELD_PROGRAM) == 0) {
- program_given = 1;
- strlcpy(rule.program, temp3, sizeof(rule.program));
+ if (strcasecmp(key, KEY_RESULT) == 0) {
+ strlcpy(rule.result, value, sizeof(rule.result));
+ rule.result_operation = operation;
valid = 1;
continue;
}
- if (strcasecmp(temp2, FIELD_RESULT) == 0) {
- strlcpy(rule.result, temp3, sizeof(rule.result));
+ if (strcasecmp(key, KEY_PROGRAM) == 0) {
+ strlcpy(rule.program, value, sizeof(rule.program));
+ rule.program_operation = operation;
+ program_given = 1;
valid = 1;
continue;
}
- if (strncasecmp(temp2, FIELD_NAME, sizeof(FIELD_NAME)-1) == 0) {
- attr = get_key_attribute(temp2 + sizeof(FIELD_NAME)-1);
+ if (strncasecmp(key, KEY_NAME, sizeof(KEY_NAME)-1) == 0) {
+ attr = get_key_attribute(key + sizeof(KEY_NAME)-1);
/* FIXME: remove old style options and make OPTIONS= mandatory */
if (attr != NULL) {
if (strstr(attr, OPTION_PARTITIONS) != NULL) {
rule.ignore_remove = 1;
}
}
- if (temp3[0] != '\0')
- strlcpy(rule.name, temp3, sizeof(rule.name));
+ if (value[0] != '\0')
+ strlcpy(rule.name, value, sizeof(rule.name));
else
rule.ignore_device = 1;
valid = 1;
continue;
}
- if (strcasecmp(temp2, FIELD_SYMLINK) == 0) {
- strlcpy(rule.symlink, temp3, sizeof(rule.symlink));
+ if (strcasecmp(key, KEY_SYMLINK) == 0) {
+ strlcpy(rule.symlink, value, sizeof(rule.symlink));
valid = 1;
continue;
}
- if (strcasecmp(temp2, FIELD_OWNER) == 0) {
- strlcpy(rule.owner, temp3, sizeof(rule.owner));
+ if (strcasecmp(key, KEY_OWNER) == 0) {
+ strlcpy(rule.owner, value, sizeof(rule.owner));
valid = 1;
continue;
}
- if (strcasecmp(temp2, FIELD_GROUP) == 0) {
- strlcpy(rule.group, temp3, sizeof(rule.group));
+ if (strcasecmp(key, KEY_GROUP) == 0) {
+ strlcpy(rule.group, value, sizeof(rule.group));
valid = 1;
continue;
}
- if (strcasecmp(temp2, FIELD_MODE) == 0) {
- rule.mode = strtol(temp3, NULL, 8);
+ if (strcasecmp(key, KEY_MODE) == 0) {
+ rule.mode = strtol(value, NULL, 8);
valid = 1;
continue;
}
- if (strcasecmp(temp2, FIELD_OPTIONS) == 0) {
- if (strstr(temp3, OPTION_LAST_RULE) != NULL) {
+ if (strcasecmp(key, KEY_OPTIONS) == 0) {
+ if (strstr(value, OPTION_LAST_RULE) != NULL) {
dbg("last rule to be applied");
rule.last_rule = 1;
}
- if (strstr(temp3, OPTION_IGNORE_DEVICE) != NULL) {
+ if (strstr(value, OPTION_IGNORE_DEVICE) != NULL) {
dbg("device should be ignored");
rule.ignore_device = 1;
}
- if (strstr(temp3, OPTION_IGNORE_REMOVE) != NULL) {
+ if (strstr(value, OPTION_IGNORE_REMOVE) != NULL) {
dbg("remove event should be ignored");
rule.ignore_remove = 1;
}
- if (strstr(temp3, OPTION_PARTITIONS) != NULL) {
+ if (strstr(value, OPTION_PARTITIONS) != NULL) {
dbg("creation of partition nodes requested");
rule.partitions = DEFAULT_PARTITIONS_COUNT;
}
continue;
}
- dbg("unknown type of field '%s'", temp2);
+ dbg("unknown key '%s'", key);
goto error;
}
/* simple plausibility checks for given keys */
if ((rule.sysfs_pair[0].file[0] == '\0') ^
(rule.sysfs_pair[0].value[0] == '\0')) {
- info("inconsistency in " FIELD_SYSFS " key");
+ info("inconsistency in " KEY_SYSFS " key");
goto error;
}
if ((rule.result[0] != '\0') && (program_given == 0)) {
- info(FIELD_RESULT " is only useful when "
- FIELD_PROGRAM " is called in any rule before");
+ info(KEY_RESULT " is only useful when "
+ KEY_PROGRAM " is called in any rule before");
goto error;
}
continue;
error:
info("parse error %s, line %d:%d, rule skipped",
- filename, lineno, (int) (temp - line));
+ filename, lineno, (int) (linepos - line));
}
}