devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "boot_disk" ,
+ exp_links => ["boot_disk"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "boot_disk" ,
+ exp_links => ["boot_disk"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "boot_disk" ,
+ exp_links => ["boot_disk"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "boot_disk1" ,
+ exp_links => ["boot_disk1"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "boot_disk1" ,
+ exp_links => ["boot_disk1", "boot_disk1-4", "boot_disk1-5"],
+ not_exp_links => ["boot_disk1-1", "boot_disk1-2", "boot_disk1-3"]
}],
rules => <<EOF
SUBSYSTEMS=="scsi", ATTRS{vendor}=="?ATA", SYMLINK+="boot_disk%n-1"
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA?", SYMLINK+="boot_disk%n-2"
SUBSYSTEMS=="scsi", ATTRS{vendor}=="A??", SYMLINK+="boot_disk%n"
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATAS", SYMLINK+="boot_disk%n-3"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="AT?", SYMLINK+="boot_disk%n-4"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="??A", SYMLINK+="boot_disk%n-5"
EOF
},
{
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "boot_disk1" ,
+ exp_links => ["boot_disk1"],
+ not_exp_links => ["boot_diskX1"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", ATTRS{model}=="ST910021AS X ", SYMLINK+="boot_diskX%n"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "boot_disk1" ,
+ exp_links => ["boot_disk1", "boot_diskXY1"],
+ not_exp_links => ["boot_diskXX1"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", ATTRS{model}=="ST910021AS", ATTRS{scsi_level}=="6", ATTRS{rev}=="4.06", ATTRS{type}=="0", ATTRS{queue_depth}=="32", SYMLINK+="boot_diskXX%n"
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", ATTRS{model}=="ST910021AS", ATTRS{scsi_level}=="6", ATTRS{rev}=="4.06", ATTRS{type}=="0", ATTRS{queue_depth}=="1", SYMLINK+="boot_diskXY%n"
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", ATTRS{model}=="ST910021AS", ATTRS{scsi_level}=="6", ATTRS{rev}=="4.06", ATTRS{type}=="0", SYMLINK+="boot_disk%n"
EOF
},
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "modem/0" ,
+ exp_links => ["modem/0", "catch-all"],
}],
rules => <<EOF
KERNEL=="ttyACM*", SYMLINK+="modem/%n"
+KERNEL=="*", SYMLINK+="catch-all"
EOF
},
+ # 10
{
desc => "catch device by * - take 2",
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "modem/0" ,
+ exp_links => ["modem/0"],
+ not_exp_links => ["bad"],
}],
rules => <<EOF
KERNEL=="*ACM1", SYMLINK+="bad"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "modem/0" ,
+ exp_links => ["modem/0"],
+ not_exp_links => ["modem/0-1", "modem/0-2"],
}],
rules => <<EOF
KERNEL=="ttyACM??*", SYMLINK+="modem/%n-1"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "modem/0" ,
+ exp_links => ["modem/0"],
+ not_exp_links => ["modem/0-1", "modem/0-2"],
}],
rules => <<EOF
KERNEL=="ttyACM[A-Z]*", SYMLINK+="modem/%n-1"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "modem" ,
+ exp_links => ["modem"],
}],
rules => <<EOF
KERNEL=="ttyACM0", SYMLINK+="modem"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "modem" ,
+ exp_links => ["modem"],
}],
rules => <<EOF
# this is a comment
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "modem" ,
+ exp_links => ["modem"],
}],
rules => <<EOF
# this is a comment with whitespace before the comment
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "whitespace" ,
+ exp_links => ["whitespace"],
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "modem" ,
+ exp_links => ["modem"],
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "modem" ,
+ exp_links => ["modem"],
}],
rules => <<EOF
KERNEL=="ttyACM0", \\
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "aaa",
+ exp_links => ["aaa"],
}],
rules => <<EOF
KERNEL=="ttyACM0", PROGRAM=="/bin/echo -e \\101", RESULT=="A", SYMLINK+="aaa"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "modem" ,
+ exp_links => ["modem"],
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "sub/direct/ory/modem" ,
+ exp_links => ["sub/direct/ory/modem"],
}],
rules => <<EOF
KERNEL=="ttyACM0", SYMLINK+="sub/direct/ory/modem"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "first_disk5" ,
+ exp_links => ["first_disk5"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="first_disk%n"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" ,
+ exp_links => ["Major:8:minor:5:kernelnumber:5:id:0:0:0:0"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="Major:%M:minor:%m:kernelnumber:%n:id:%b"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node12345678",
+ exp_links => ["node12345678"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", IMPORT{program}="/bin/echo -e \' TEST_KEY=12345678\\n TEST_key2=98765\'", SYMLINK+="node\$env{TEST_KEY}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "disk-ATA-sda" ,
+ exp_links => ["disk-ATA-sda"],
+ not_exp_links => ["modem"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="disk-%s{vendor}-%k"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "special-device-5" ,
- not_exp_name => "not" ,
+ exp_links => ["special-device-5"],
+ not_exp_links => ["not"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="-special-*", SYMLINK+="not"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "newline_removed" ,
+ exp_links => ["newline_removed"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo test", RESULT=="test", SYMLINK+="newline_removed"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "test-0:0:0:0" ,
+ exp_links => ["test-0:0:0:0"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n test-%b", RESULT=="test-0:0*", SYMLINK+="%c"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "foo9" ,
+ exp_links => ["foo9"],
+ not_exp_links => ["foo3", "foo4", "foo5", "foo6", "foo7", "foo8"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda5", SYMLINK+="%c{7}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "bar9" ,
+ exp_links => ["bar9"],
+ not_exp_links => ["foo3", "foo4", "foo5", "foo6", "foo7", "foo8"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c 'echo foo3 foo4 foo5 foo6 foo7 foo8 foo9 | sed s/foo9/bar9/'", KERNEL=="sda5", SYMLINK+="%c{7}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "foo7" ,
+ exp_links => ["foo7"],
+ not_exp_links => ["foo3", "foo4", "foo5", "foo6", "foo8"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n 'foo3 foo4' 'foo5 foo6 foo7 foo8'", KERNEL=="sda5", SYMLINK+="%c{5}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "foo2" ,
+ exp_links => ["foo2"],
+ not_exp_links => ["foo1"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c 'printf %%s \\\"foo1 foo2\\\" | grep \\\"foo1 foo2\\\"'", KERNEL=="sda5", SYMLINK+="%c{2}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "foo2" ,
+ exp_links => ["foo2"],
+ not_exp_links => ["foo1"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c \\\"printf %%s 'foo1 foo2' | grep 'foo1 foo2'\\\"", KERNEL=="sda5", SYMLINK+="%c{2}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "foo2" ,
+ exp_links => ["foo2"],
+ not_exp_links => ["foo1", "foo3"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c 'printf \\\"%%s %%s\\\" \\\"foo1 foo2\\\" \\\"foo3\\\"| grep \\\"foo1 foo2\\\"'", KERNEL=="sda5", SYMLINK+="%c{2}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "my-foo9" ,
+ exp_links => ["my-foo9"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda5", SYMLINK+="my-%c{7}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "my-foo8" ,
+ exp_links => ["my-foo8"],
+ not_exp_links => ["my-foo3", "my-foo4", "my-foo5", "my-foo6", "my-foo7", "my-foo9"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda5", SYMLINK+="my-%c{6}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0",
+ exp_links => ["Major:8-minor:5-kernelnumber:5-id:0:0:0:0"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="Major:\$major-minor:\$minor-kernelnumber:\$number-id:\$id"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0",
+ exp_links => ["Major:8-minor:5-kernelnumber:5-id:0:0:0:0"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", SYMLINK+="Major:\$major-minor:%m-kernelnumber:\$number-id:\$id"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "850:0:0:05" ,
+ exp_links => ["850:0:0:05"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", SYMLINK+="%M%m%b%n"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "855" ,
+ exp_links => ["855"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", SYMLINK+="\$major\$minor\$number"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "8550:0:0:0" ,
+ exp_links => ["8550:0:0:0"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", SYMLINK+="\$major%m%n\$id"
devices => [
{
devpath => "/devices/virtual/tty/console",
- exp_name => "TTY",
+ exp_links => ["TTY"],
+ not_exp_links => ["foo"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo", RESULT=="foo", SYMLINK+="foo"
devices => [
{
devpath => "/devices/virtual/tty/console",
- exp_name => "TTY" ,
+ exp_links => ["TTY"],
+ not_exp_links => ["foo"],
}],
rules => <<EOF
SUBSYSTEMS=="foo", ATTRS{dev}=="5:1", SYMLINK+="foo"
devices => [
{
devpath => "/devices/virtual/tty/console",
- exp_name => "foo" ,
+ exp_links => ["foo", "TTY"],
}],
rules => <<EOF
KERNEL=="console", SYMLINK+="TTY"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "empty" ,
+ exp_links => ["empty", "not-something"],
+ not_exp_links => ["something", "not-empty"],
}],
rules => <<EOF
KERNEL=="sda", ATTR{test_empty_file}=="?*", SYMLINK+="something"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "non-existent" ,
+ exp_links => ["non-existent", "wrong"],
+ not_exp_links => ["something", "empty", "not-empty",
+ "not-something", "something"],
}],
rules => <<EOF
KERNEL=="sda", ATTR{nofile}=="?*", SYMLINK+="something"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "scsi-0:0:0:0" ,
+ exp_links => ["scsi-0:0:0:0"],
}],
rules => <<EOF
SUBSYSTEMS=="usb", PROGRAM=="/bin/echo -n usb-%b", SYMLINK+="%c"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "modem" ,
+ exp_links => ["modem"],
}],
rules => <<EOF
ATTRS{idProduct}=="007b", SYMLINK+="modem"
{
devpath => "/devices/virtual/block/fake!blockdev0",
devnode => "fake/blockdev0",
- exp_name => "is/a/fake/blockdev0" ,
+ exp_links => ["is/a/fake/blockdev0"],
+ not_exp_links => ["is/not/a/fake/blockdev0", "modem"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", SYMLINK+="is/not/a/%k"
{
devpath => "/devices/virtual/block/fake!blockdev0",
devnode => "fake/blockdev0",
- exp_rem_error => "yes",
+ not_exp_links => ["modem"],
}],
rules => <<EOF
KERNEL=="ttyACM0", SYMLINK+="modem"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "scsi-0:0:0:0",
+ exp_links => ["scsi-0:0:0:0"],
+ not_exp_links => ["no-match", "short-id", "not-scsi"],
}],
rules => <<EOF
SUBSYSTEMS=="usb", KERNELS=="0:0:0:0", SYMLINK+="not-scsi"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "scsi-0:0:0:0",
+ exp_links => ["scsi-0:0:0:0"],
+ not_exp_links => ["no-match", "before"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNELS=="*:1", SYMLINK+="no-match"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "scsi-0:0:0:0",
+ exp_links => ["scsi-0:0:0:0", "before"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="before"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "scsi-0:0:0:0",
+ exp_links => ["scsi-0:0:0:0", "before"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="before"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "driver-is-sd",
+ exp_links => ["driver-is-sd"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", SYMLINK+="driver-is-\$attr{driver}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "driver-is-ahci",
+ exp_links => ["driver-is-ahci"],
}],
rules => <<EOF
SUBSYSTEMS=="pci", SYMLINK+="driver-is-\$attr{driver}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "ignored",
+ exp_links => ["ignored"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", ATTRS{whitespace_test}=="WHITE SPACE", SYMLINK+="ignored"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "matched-with-space",
+ exp_links => ["matched-with-space"],
+ not_exp_links => ["wrong-to-ignore"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", ATTRS{whitespace_test}=="WHITE SPACE ", SYMLINK+="wrong-to-ignore"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node",
+ exp_links => ["node"],
exp_perms => "1::0600",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node",
+ exp_links => ["node"],
exp_perms => ":1:0660",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node",
+ exp_links => ["node"],
exp_perms => "daemon::0600",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node",
+ exp_links => ["node"],
exp_perms => ":daemon:0660",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node",
+ exp_links => ["node"],
exp_perms => "root:audio:0660",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node",
+ exp_links => ["node"],
exp_perms => "::0777",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node",
+ exp_links => ["node"],
exp_perms => "1:1:0777",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node",
+ exp_links => ["node"],
exp_majorminor => "8:0",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/virtual/misc/misc-fake1",
- exp_name => "node",
+ exp_links => ["node"],
exp_majorminor => "4095:1",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/virtual/misc/misc-fake89999",
- exp_name => "node",
+ exp_links => ["node"],
exp_majorminor => "4095:89999",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "symlink2-ttyACM0",
+ exp_links => ["symlink1-0", "symlink2-ttyACM0", "symlink3-"],
}],
rules => <<EOF
KERNEL=="ttyACM[0-9]*", SYMLINK="symlink1-%n symlink2-%k symlink3-%b"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "one",
- not_exp_name => " ",
+ exp_links => ["one", "two"],
+ not_exp_links => [" "],
}],
rules => <<EOF
KERNEL=="ttyACM[0-9]*", SYMLINK=" one two "
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "name-one_two_three-end",
- not_exp_name => " ",
+ exp_links => ["name-one_two_three-end"],
+ not_exp_links => [" "],
}],
rules => <<EOF
ENV{WITH_WS}="one two three"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "name-one_two_three-end",
- not_exp_name => " ",
+ exp_links => ["name-one_two_three-end"],
+ not_exp_links => [" "],
}],
rules => <<EOF
ENV{WITH_WS}=" one two three"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "name-one_two_three-end",
- not_exp_name => " ",
+ exp_links => ["name-one_two_three-end"],
+ not_exp_links => [" "],
}],
rules => <<EOF
ENV{WITH_WS}="one two three "
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "name-one_two_three-end",
- not_exp_name => " ",
+ exp_links => ["name-one_two_three-end"],
+ not_exp_links => [" "],
}],
rules => <<EOF
ENV{WITH_WS}=" one two three "
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "name-one_two_three-end",
- not_exp_name => " ",
+ exp_links => ["name-one_two_three-end"],
+ not_exp_links => [" "],
}],
rules => <<EOF
ENV{WITH_WS}=" one two three "
EOF
},
{
- desc => "symlink with space and var with space, part 1",
+ desc => "symlink with space and var with space",
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "first",
- not_exp_name => " ",
+ exp_links => ["first"],
+ not_exp_links => [" "],
}],
rules => <<EOF
ENV{WITH_WS}=" one two three "
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "name-one_two_three-end",
- not_exp_name => " ",
+ exp_links => ["name-one_two_three-end"],
+ not_exp_links => [" "],
}],
rules => <<EOF
ENV{WITH_WS}=" one two three "
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "another_symlink",
- not_exp_name => " ",
+ exp_links => ["another_symlink"],
+ not_exp_links => [" "],
}],
rules => <<EOF
ENV{WITH_WS}=" one two three "
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "modem0",
+ exp_links => ["modem0"],
}],
rules => <<EOF
KERNEL=="ttyACM[0-9]*", SYMLINK+="ttyACM%n", SYMLINK="modem%n"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "second-0" ,
+ exp_links => ["first-0", "second-0", "third-0"],
}],
rules => <<EOF
KERNEL=="ttyACM0", SYMLINK="first-%n second-%n third-%n"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => ".",
+ exp_links => ["."],
exp_add_error => "yes",
exp_rem_error => "yes",
}],
devices => [
{
devpath => "/devices/virtual/tty/tty0",
- exp_name => "link",
+ exp_links => ["link"],
exp_add_error => "yes",
exp_rem_error => "yes",
}],
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "symlink0",
+ exp_links => ["symlink0"],
}],
rules => <<EOF
KERNEL=="ttyACM[0-9]*", SYMLINK+="ttyACM%n", SYMLINK+="symlink%n"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "symlink-ttyACM0",
+ exp_links => ["symlink-ttyACM0"],
}],
rules => <<EOF
KERNEL=="ttyACM[0-9]*", SYMLINK+="ttyACM%n", SYMLINK+="symlink-%k"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "major-166:0",
+ exp_links => ["major-166:0"],
}],
rules => <<EOF
KERNEL=="ttyACM[0-9]*", SYMLINK+="ttyACM%n", SYMLINK+="major-%M:%m"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "symlink-0:0:0:0",
+ exp_links => ["symlink-0:0:0:0"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="symlink-%b"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "test",
+ exp_links => ["test"],
}],
rules => <<EOF
KERNEL=="ttyACM[0-9]*", PROGRAM=="/bin/echo test", SYMLINK+="%c"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "test",
+ exp_links => ["test"],
+ not_exp_links => ["symlink", "this"],
}],
rules => <<EOF
KERNEL=="ttyACM[0-9]*", PROGRAM=="/bin/echo symlink test this", SYMLINK+="%c{2}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "this",
+ exp_links => ["test", "this"],
+ not_exp_links => ["symlink"],
}],
rules => <<EOF
KERNEL=="ttyACM[0-9]*", PROGRAM=="/bin/echo symlink test this", SYMLINK+="%c{2+}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "test",
+ exp_links => ["test", "this"],
+ not_exp_links => ["symlink"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda", PROGRAM=="/bin/echo link test this" SYMLINK+="%c{2+}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "166:0",
+ exp_links => ["166:0"],
}],
rules => <<EOF
KERNEL=="ttyACM[0-9]*", SYMLINK+="%s{dev}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "link1",
+ exp_links => ["link1", "link2"],
+ not_exp_links => ["node"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n node link1 link2", RESULT=="node *", SYMLINK+="%c{2} %c{3}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
- exp_name => "link4",
+ exp_links => ["link1", "link2", "link3", "link4"],
+ not_exp_links => ["node"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n node link1 link2 link3 link4", RESULT=="node *", SYMLINK+="%c{2+}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node",
+ exp_links => ["node"],
+ not_exp_links => ["should_not_match", "should_not_match2"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="should_not_match", SUBSYSTEM=="vc"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node",
+ exp_links => ["node"],
+ not_exp_links => ["should_not_match"]
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="should_not_match", DRIVERS=="sd-wrong"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node",
+ exp_links => ["node"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda", PROGRAM=="/usr/bin/test -b %N" SYMLINK+="node"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "sda-part-1",
+ exp_links => ["sda-part-1"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda1", SYMLINK+="%P-part-1"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "start-/dev-end",
+ exp_links => ["start-/dev-end"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda1", SYMLINK+="start-%r-end"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "last",
+ exp_links => ["last"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda1", SYMLINK+="last", OPTIONS="last_rule"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "match",
+ exp_links => ["match", "before"],
+ not_exp_links => ["matches-but-is-negated"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL!="sda1", SYMLINK+="matches-but-is-negated"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "not-anything",
+ exp_links => ["before", "not-anything"],
+ not_exp_links => ["matches-but-is-negated"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", SUBSYSTEM=="block", KERNEL!="sda1", SYMLINK+="matches-but-is-negated"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "nonzero-program",
+ exp_links => ["before", "nonzero-program"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda1", SYMLINK+="before"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "true",
+ exp_links => ["true"],
+ not_exp_links => ["bad", "wrong"],
}],
rules => <<EOF
ENV{ENV_KEY_TEST}="test"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "true",
+ exp_links => ["true"],
+ not_exp_links => ["bad", "wrong", "no"],
}],
rules => <<EOF
ENV{ENV_KEY_TEST}="test"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "true",
+ exp_links => ["true", "before"],
+ not_exp_links => ["no"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}="true"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "true",
+ exp_links => ["true", "before"],
+ not_exp_links => ["no", "bad"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}="true"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "part",
- }],
+ exp_links => ["part"],
+ not_exp_links => ["disk"],
+ },
+ ],
rules => <<EOF
SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{PARTITION}="true", ENV{MAINDEVICE}="false"
SUBSYSTEM=="block", KERNEL=="*[!0-9]", ENV{PARTITION}="false", ENV{MAINDEVICE}="true"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "sane",
+ exp_links => ["sane"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e name; (/usr/bin/badprogram)", RESULT=="name_ _/usr/bin/badprogram_", SYMLINK+="sane"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "uber",
+ exp_links => ["uber"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e \\xc3\\xbcber" RESULT=="\xc3\xbcber", SYMLINK+="uber"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "replaced",
+ exp_links => ["replaced"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e \\xef\\xe8garbage", RESULT=="__garbage", SYMLINK+="replaced"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "serial-354172020305000",
+ exp_links => ["serial-354172020305000"],
}],
rules => <<EOF
KERNEL=="ttyACM*", ATTRS{serial}=="?*", SYMLINK+="serial-%s{serial}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "ok",
+ exp_links => ["ok"],
+ not_exp_links => ["not-1-ok", "not-2-ok", "not-3-ok"],
}],
rules => <<EOF
KERNEL=="sda", ATTRS{nothing}!="", SYMLINK+="not-1-ok"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "ok",
+ exp_links => ["ok"],
+ not_exp_links => ["unknown-not-ok"],
}],
rules => <<EOF
ACTION=="unknown", KERNEL=="sda", SYMLINK+="unknown-not-ok"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "ok",
+ exp_links => ["ok"],
exp_perms => "root:tty:0640",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "ok",
+ exp_links => ["ok"],
exp_perms => "root:tty:0640",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "node-add-me",
+ exp_links => ["node-add-me"],
}],
rules => <<EOF
KERNEL=="sda", MODE="0666", SYMLINK+="node-\$env{ACTION}-me"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "three",
- not_exp_name => "two",
+ exp_links => ["three"],
+ not_exp_links => ["two", "one"],
}],
rules => <<EOF
KERNEL=="ttyACM[0-9]*", SYMLINK+="one"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "right",
- not_exp_name => "wrong",
+ exp_links => ["right"],
+ not_exp_links => ["wrong"],
}],
rules => <<EOF
KERNEL=="ttyACM[0-9]*", SYMLINK+="wrong"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "right",
+ exp_links => ["right", "before"],
}],
rules => <<EOF
KERNEL=="ttyACM*", SYMLINK+="before"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "right",
+ exp_links => ["right", "before"],
+ not_exp_links => ["nomatch"],
}],
rules => <<EOF
KERNEL=="dontknow*|*nothing", SYMLINK+="nomatch"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "right",
+ exp_links => ["right"],
+ not_exp_links => ["nomatch", "wrong1", "wrong2"],
}],
rules => <<EOF
KERNEL=="dontknow|nothing", SYMLINK+="nomatch"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
- exp_name => "right",
+ exp_links => ["right"],
+ not_exp_links => ["nomatch", "wrong1", "wrong2", "wrong3"],
}],
rules => <<EOF
KERNEL=="dontknow|nothing", SYMLINK+="nomatch"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found",
+ exp_links => ["found"],
not_exp_name => "bad",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found",
+ exp_links => ["found"],
not_exp_name => "bad",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found",
+ exp_links => ["found"],
not_exp_name => "bad",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found",
+ exp_links => ["found"],
not_exp_name => "bad",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found",
+ exp_links => ["found"],
not_exp_name => "bad",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found",
+ exp_links => ["found"],
not_exp_name => "bad",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found",
+ exp_links => ["found"],
not_exp_name => "bad",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "parent",
+ exp_links => ["parent"],
}],
option => "keep",
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "parentenv-parent_right",
+ exp_links => ["parentenv-parent_right"],
}],
option => "clean",
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "right",
+ exp_links => ["right"],
+ not_exp_test => ["wrong", "wrong2"],
}],
rules => <<EOF
KERNEL=="sda1", GOTO="TEST"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "right",
+ exp_links => ["right"],
}],
rules => <<EOF
KERNEL=="sda1", GOTO="does-not-exist"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "right",
- not_exp_name => "wrong",
+ exp_links => ["right", "link"],
+ not_exp_links => ["wrong"],
}],
rules => <<EOF
KERNEL=="sda1", SYMLINK+="link"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "yes",
+ exp_links => ["yes"],
+ not_exp_links => ["no"],
}],
rules => <<EOF
KERNEL="sda1", SYMLINK+="no"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "yes",
+ exp_links => ["yes"],
}],
rules => <<EOF
KERNEL=="sda", ATTR{test:colon+plus}=="?*", SYMLINK+="yes"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "yes",
+ exp_links => ["yes"],
+ not_exp_links => ["no"],
}],
rules => <<EOF
# 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "00:16:41:e2:8d:ff",
+ exp_links => ["00:16:41:e2:8d:ff"],
}],
rules => <<EOF
KERNEL=="sda", SYMLINK+="\$attr{[net/eth0]address}"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "there",
+ exp_links => ["there"],
+ not_exp_links => ["notthere"],
}],
rules => <<EOF
TEST=="/etc/machine-id", SYMLINK+="there"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "yes",
+ exp_links => ["yes"],
}],
rules => <<EOF
KERNEL=="sda", TEST=="[net/eth0]", SYMLINK+="yes"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "relative",
+ exp_links => ["relative"],
}],
rules => <<EOF
KERNEL=="sda", TEST=="size", SYMLINK+="relative"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found-subdir",
+ exp_links => ["found-subdir"],
}],
rules => <<EOF
KERNEL=="sda", TEST=="*/nr_requests", SYMLINK+="found-subdir"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "sda-8741C4G-end",
+ exp_links => ["sda-8741C4G-end"],
exp_perms => "0:0:0600",
}],
rules => <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0",
+ exp_links => ["disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0"],
}],
rules => <<EOF
KERNEL=="sda", IMPORT{builtin}="path_id"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found",
- not_exp_name => "bad" ,
+ exp_links => ["found"],
+ not_exp_links => ["bad"],
}],
rules => <<EOF
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", TAG+="green"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found",
+ exp_links => ["found"],
}],
rules => $rules_10k_tags . <<EOF
TAGS=="test1", TAGS=="test500", TAGS=="test1234", TAGS=="test9999", TAGS=="test10000", SYMLINK+="found"
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found",
+ exp_links => ["found"],
not_exp_name => "bad",
}],
rules => $rules_10k_tags_continuation . <<EOF
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found",
+ exp_links => ["found"],
not_exp_name => "bad",
}],
devices => [
{
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
- exp_name => "found",
+ exp_links => ["found"],
not_exp_name => "bad",
}],
rules => <<EOF
return $devnode;
}
-sub check_add {
- my ($device) = @_;
-
- if (defined($device->{not_exp_name})) {
- if ((-e "$udev_dev/$device->{not_exp_name}") ||
- (-l "$udev_dev/$device->{not_exp_name}")) {
- print "nonexistent: error \'$device->{not_exp_name}\' not expected to be there\n";
- $error++;
- sleep(1);
- }
- }
+sub get_link_target {
+ my ($link) = @_;
- my $devnode = check_devnode($device);
+ my $cwd = getcwd();
+ my $dir = "$udev_dev/$link";
+ my $tgt = readlink("$udev_dev/$link");
+ $dir =~ s!/[^/]*$!!;
+ $tgt = abs_path("$dir/$tgt");
+ $tgt =~ s!^$cwd/!!;
+ return $tgt;
+}
- return if (!defined($device->{exp_name}));
+sub check_link_add {
+ my ($link, $devnode, $err_expected) = @_;
- my @st = lstat("$udev_dev/$device->{exp_name}");
+ my @st = lstat("$udev_dev/$link");
if (-l _) {
- my $cwd = getcwd();
- my $dir = "$udev_dev/$device->{exp_name}";
- $dir =~ s!/[^/]*$!!;
- my $tgt = readlink("$udev_dev/$device->{exp_name}");
- $tgt = abs_path("$dir/$tgt");
- $tgt =~ s!^$cwd/!!;
+ my $tgt = get_link_target($link);
if ($tgt ne $devnode) {
- print "symlink $device->{exp_name}: error, found -> $tgt\n";
+ print "symlink $link: error, found -> $tgt\n";
$error++;
system("tree", "$udev_dev");
} else {
- print "symlink $device->{exp_name}: ok\n";
+ print "symlink $link: ok\n";
}
} else {
- print "symlink $device->{exp_name}: error";
- if ($device->{exp_add_error}) {
+ print "symlink $link: error";
+ if ($err_expected) {
print " as expected\n";
} else {
print "\n";
}
}
+sub check_link_nonexistent {
+ my ($link, $devnode, $err_expected) = @_;
+
+ if ((-e "$udev_dev/$link") || (-l "$udev_dev/$link")) {
+ my $tgt = get_link_target($link);
+
+ if ($tgt ne $devnode) {
+ print "nonexistent: '$link' points to other device (ok)\n";
+ } else {
+ print "nonexistent: error \'$link\' should not be there";
+ if ($err_expected) {
+ print " (as expected)\n";
+ } else {
+ print "\n";
+ system("tree", "$udev_dev");
+ print "\n";
+ $error++;
+ sleep(1);
+ }
+ }
+ } else {
+ print "nonexistent $link: ok\n";
+ }
+}
+
+sub check_add {
+ my ($device) = @_;
+ my $devnode = check_devnode($device);
+
+ if (defined($device->{exp_links})) {
+ foreach my $link (@{$device->{exp_links}}) {
+ check_link_add($link, $devnode,
+ $device->{exp_add_error});
+ }
+ }
+ if (defined $device->{not_exp_links}) {
+ foreach my $link (@{$device->{not_exp_links}}) {
+ check_link_nonexistent($link, $devnode,
+ $device->{exp_nodev_error});
+ }
+ }
+}
+
sub check_remove_devnode {
my ($device) = @_;
my $devnode = get_devnode($device);
}
}
-sub check_remove {
- my ($device) = @_;
+sub check_link_remove {
+ my ($link, $err_expected) = @_;
- check_remove_devnode($device);
-
- return if (!defined($device->{exp_name}));
-
- if ((-e "$udev_dev/$device->{exp_name}") ||
- (-l "$udev_dev/$device->{exp_name}")) {
- print "remove $device->{exp_name}: error";
- if ($device->{exp_rem_error}) {
+ if ((-e "$udev_dev/$link") ||
+ (-l "$udev_dev/$link")) {
+ print "remove $link: error";
+ if ($err_expected) {
print " as expected\n";
} else {
print "\n";
sleep(1);
}
} else {
- print "remove $device->{exp_name}: ok\n";
+ print "remove $link: ok\n";
+ }
+}
+
+sub check_remove {
+ my ($device) = @_;
+
+ check_remove_devnode($device);
+
+ return if (!defined($device->{exp_links}));
+
+ foreach my $link (@{$device->{exp_links}}) {
+ check_link_remove($link, $device->{exp_rem_error});
}
}