daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
bd1529
From fb8d10456d7d5a085e1adb5bfd45f1cda813ac22 Mon Sep 17 00:00:00 2001
bd1529
From: Martin Wilck <mwilck@suse.com>
bd1529
Date: Tue, 24 Apr 2018 17:15:58 +0200
bd1529
Subject: [PATCH] test/udev-test.pl: allow checking multiple symlinks
bd1529
bd1529
Instead of testing the existence or non-exisitence of just a single
bd1529
symlink, allow testing of several links per device.
bd1529
bd1529
Change the test definitions accordingly.
bd1529
bd1529
(cherry picked from commit e62acc3159935781f05fa59c48e5a74e85c61ce2)
bd1529
bd1529
Related: #1642728
bd1529
---
bd1529
 test/udev-test.pl | 495 +++++++++++++++++++++++++++-------------------
bd1529
 1 file changed, 296 insertions(+), 199 deletions(-)
bd1529
bd1529
diff --git a/test/udev-test.pl b/test/udev-test.pl
bd1529
index 2e3089c5e0..f5edecefd0 100755
bd1529
--- a/test/udev-test.pl
bd1529
+++ b/test/udev-test.pl
bd1529
@@ -71,7 +71,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "boot_disk" ,
bd1529
+                                exp_links       => ["boot_disk"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n"
bd1529
@@ -83,7 +83,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "boot_disk" ,
bd1529
+                                exp_links       => ["boot_disk"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n"
bd1529
@@ -95,7 +95,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "boot_disk" ,
bd1529
+                                exp_links       => ["boot_disk"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n"
bd1529
@@ -107,7 +107,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "boot_disk1" ,
bd1529
+                                exp_links       => ["boot_disk1"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n"
bd1529
@@ -118,13 +118,16 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "boot_disk1" ,
bd1529
+                                exp_links       => ["boot_disk1", "boot_disk1-4", "boot_disk1-5"],
bd1529
+                                not_exp_links   => ["boot_disk1-1", "boot_disk1-2", "boot_disk1-3"]
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", ATTRS{vendor}=="?ATA", SYMLINK+="boot_disk%n-1"
bd1529
 SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA?", SYMLINK+="boot_disk%n-2"
bd1529
 SUBSYSTEMS=="scsi", ATTRS{vendor}=="A??", SYMLINK+="boot_disk%n"
bd1529
 SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATAS", SYMLINK+="boot_disk%n-3"
bd1529
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="AT?", SYMLINK+="boot_disk%n-4"
bd1529
+SUBSYSTEMS=="scsi", ATTRS{vendor}=="??A", SYMLINK+="boot_disk%n-5"
bd1529
 EOF
bd1529
         },
bd1529
         {
bd1529
@@ -132,7 +135,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "boot_disk1" ,
bd1529
+                                exp_links       => ["boot_disk1"],
bd1529
+                                not_exp_links   => ["boot_diskX1"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", ATTRS{model}=="ST910021AS X ", SYMLINK+="boot_diskX%n"
bd1529
@@ -144,10 +148,12 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "boot_disk1" ,
bd1529
+                                exp_links       => ["boot_disk1", "boot_diskXY1"],
bd1529
+                                not_exp_links   => ["boot_diskXX1"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 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"
bd1529
+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"
bd1529
 SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", ATTRS{model}=="ST910021AS", ATTRS{scsi_level}=="6", ATTRS{rev}=="4.06", ATTRS{type}=="0", SYMLINK+="boot_disk%n"
bd1529
 EOF
bd1529
         },
bd1529
@@ -156,18 +162,21 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "modem/0" ,
bd1529
+                                exp_links       => ["modem/0", "catch-all"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM*", SYMLINK+="modem/%n"
bd1529
+KERNEL=="*", SYMLINK+="catch-all"
bd1529
 EOF
bd1529
         },
bd1529
+        # 10
bd1529
         {
bd1529
                 desc            => "catch device by * - take 2",
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "modem/0" ,
bd1529
+                                exp_links       => ["modem/0"],
bd1529
+                                not_exp_links   => ["bad"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="*ACM1", SYMLINK+="bad"
bd1529
@@ -179,7 +188,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "modem/0" ,
bd1529
+                                exp_links       => ["modem/0"],
bd1529
+                                not_exp_links   => ["modem/0-1", "modem/0-2"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM??*", SYMLINK+="modem/%n-1"
bd1529
@@ -192,7 +202,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "modem/0" ,
bd1529
+                                exp_links       => ["modem/0"],
bd1529
+                                not_exp_links   => ["modem/0-1", "modem/0-2"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[A-Z]*", SYMLINK+="modem/%n-1"
bd1529
@@ -205,7 +216,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "modem" ,
bd1529
+                                exp_links       => ["modem"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM0", SYMLINK+="modem"
bd1529
@@ -216,7 +227,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "modem" ,
bd1529
+                                exp_links       => ["modem"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 # this is a comment
bd1529
@@ -229,7 +240,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "modem" ,
bd1529
+                                exp_links       => ["modem"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
  # this is a comment with whitespace before the comment
bd1529
@@ -242,7 +253,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "whitespace" ,
bd1529
+                                exp_links       => ["whitespace"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 
bd1529
@@ -260,7 +271,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "modem" ,
bd1529
+                                exp_links       => ["modem"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 
bd1529
@@ -273,7 +284,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "modem" ,
bd1529
+                                exp_links       => ["modem"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM0", \\
bd1529
@@ -286,7 +297,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "aaa",
bd1529
+                                exp_links       => ["aaa"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM0", PROGRAM=="/bin/echo -e \\101", RESULT=="A", SYMLINK+="aaa"
bd1529
@@ -297,7 +308,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "modem" ,
bd1529
+                                exp_links       => ["modem"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 
bd1529
@@ -318,7 +329,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "sub/direct/ory/modem" ,
bd1529
+                                exp_links       => ["sub/direct/ory/modem"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM0", SYMLINK+="sub/direct/ory/modem"
bd1529
@@ -329,7 +340,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "first_disk5" ,
bd1529
+                                exp_links       => ["first_disk5"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="first_disk%n"
bd1529
@@ -340,7 +351,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "Major:8:minor:5:kernelnumber:5:id:0:0:0:0" ,
bd1529
+                                exp_links       => ["Major:8:minor:5:kernelnumber:5:id:0:0:0:0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="Major:%M:minor:%m:kernelnumber:%n:id:%b"
bd1529
@@ -351,7 +362,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node12345678",
bd1529
+                                exp_links       => ["node12345678"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", IMPORT{program}="/bin/echo -e \' TEST_KEY=12345678\\n  TEST_key2=98765\'", SYMLINK+="node\$env{TEST_KEY}"
bd1529
@@ -363,7 +374,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "disk-ATA-sda" ,
bd1529
+                                exp_links       => ["disk-ATA-sda"],
bd1529
+                                not_exp_links   => ["modem"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="disk-%s{vendor}-%k"
bd1529
@@ -375,8 +387,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "special-device-5" ,
bd1529
-                                not_exp_name    => "not" ,
bd1529
+                                exp_links       => ["special-device-5"],
bd1529
+                                not_exp_links   => ["not"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n special-device", RESULT=="-special-*", SYMLINK+="not"
bd1529
@@ -388,7 +400,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "newline_removed" ,
bd1529
+                                exp_links       => ["newline_removed"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo test", RESULT=="test", SYMLINK+="newline_removed"
bd1529
@@ -399,7 +411,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "test-0:0:0:0" ,
bd1529
+                                exp_links       => ["test-0:0:0:0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n test-%b", RESULT=="test-0:0*", SYMLINK+="%c"
bd1529
@@ -410,7 +422,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "foo9" ,
bd1529
+                                exp_links       => ["foo9"],
bd1529
+                                not_exp_links   => ["foo3", "foo4", "foo5", "foo6", "foo7", "foo8"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda5", SYMLINK+="%c{7}"
bd1529
@@ -421,7 +434,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "bar9" ,
bd1529
+                                exp_links       => ["bar9"],
bd1529
+                                not_exp_links   => ["foo3", "foo4", "foo5", "foo6", "foo7", "foo8"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c 'echo foo3 foo4 foo5 foo6 foo7 foo8 foo9 | sed  s/foo9/bar9/'", KERNEL=="sda5", SYMLINK+="%c{7}"
bd1529
@@ -432,7 +446,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "foo7" ,
bd1529
+                                exp_links       => ["foo7"],
bd1529
+                                not_exp_links   => ["foo3", "foo4", "foo5", "foo6", "foo8"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n 'foo3 foo4'   'foo5   foo6   foo7 foo8'", KERNEL=="sda5", SYMLINK+="%c{5}"
bd1529
@@ -443,7 +458,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "foo2" ,
bd1529
+                                exp_links       => ["foo2"],
bd1529
+                                not_exp_links   => ["foo1"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c 'printf %%s \\\"foo1 foo2\\\" | grep \\\"foo1 foo2\\\"'", KERNEL=="sda5", SYMLINK+="%c{2}"
bd1529
@@ -454,7 +470,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "foo2" ,
bd1529
+                                exp_links       => ["foo2"],
bd1529
+                                not_exp_links   => ["foo1"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c \\\"printf %%s 'foo1 foo2' | grep 'foo1 foo2'\\\"", KERNEL=="sda5", SYMLINK+="%c{2}"
bd1529
@@ -465,7 +482,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "foo2" ,
bd1529
+                                exp_links       => ["foo2"],
bd1529
+                                not_exp_links   => ["foo1", "foo3"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/sh -c 'printf \\\"%%s %%s\\\" \\\"foo1 foo2\\\" \\\"foo3\\\"| grep \\\"foo1 foo2\\\"'", KERNEL=="sda5", SYMLINK+="%c{2}"
bd1529
@@ -476,7 +494,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "my-foo9" ,
bd1529
+                                exp_links       => ["my-foo9"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda5", SYMLINK+="my-%c{7}"
bd1529
@@ -487,7 +505,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "my-foo8" ,
bd1529
+                                exp_links       => ["my-foo8"],
bd1529
+                                not_exp_links   => ["my-foo3", "my-foo4", "my-foo5", "my-foo6", "my-foo7", "my-foo9"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo3 foo4 foo5 foo6 foo7 foo8 foo9", KERNEL=="sda5", SYMLINK+="my-%c{6}"
bd1529
@@ -498,7 +517,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0",
bd1529
+                                exp_links       => ["Major:8-minor:5-kernelnumber:5-id:0:0:0:0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="Major:\$major-minor:\$minor-kernelnumber:\$number-id:\$id"
bd1529
@@ -509,7 +528,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "Major:8-minor:5-kernelnumber:5-id:0:0:0:0",
bd1529
+                                exp_links       => ["Major:8-minor:5-kernelnumber:5-id:0:0:0:0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", SYMLINK+="Major:\$major-minor:%m-kernelnumber:\$number-id:\$id"
bd1529
@@ -520,7 +539,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "850:0:0:05" ,
bd1529
+                                exp_links       => ["850:0:0:05"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", SYMLINK+="%M%m%b%n"
bd1529
@@ -531,7 +550,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "855" ,
bd1529
+                                exp_links       => ["855"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", SYMLINK+="\$major\$minor\$number"
bd1529
@@ -542,7 +561,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "8550:0:0:0" ,
bd1529
+                                exp_links       => ["8550:0:0:0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", DEVPATH=="*/sda/*", SYMLINK+="\$major%m%n\$id"
bd1529
@@ -553,7 +572,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/virtual/tty/console",
bd1529
-                                exp_name        => "TTY",
bd1529
+                                exp_links       => ["TTY"],
bd1529
+                                not_exp_links   => ["foo"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n foo", RESULT=="foo", SYMLINK+="foo"
bd1529
@@ -565,7 +585,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/virtual/tty/console",
bd1529
-                                exp_name        => "TTY" ,
bd1529
+                                exp_links       => ["TTY"],
bd1529
+                                not_exp_links   => ["foo"],
bd1529
                         }],
bd1529
                 rules                => <
bd1529
 SUBSYSTEMS=="foo", ATTRS{dev}=="5:1", SYMLINK+="foo"
bd1529
@@ -577,7 +598,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/virtual/tty/console",
bd1529
-                                exp_name        => "foo" ,
bd1529
+                                exp_links       => ["foo", "TTY"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="console", SYMLINK+="TTY"
bd1529
@@ -589,7 +610,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "empty" ,
bd1529
+                                exp_links       => ["empty", "not-something"],
bd1529
+                                not_exp_links   => ["something", "not-empty"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda", ATTR{test_empty_file}=="?*", SYMLINK+="something"
bd1529
@@ -603,7 +625,9 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "non-existent" ,
bd1529
+                                exp_links       => ["non-existent", "wrong"],
bd1529
+                                not_exp_links   => ["something", "empty", "not-empty",
bd1529
+                                                    "not-something", "something"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda", ATTR{nofile}=="?*", SYMLINK+="something"
bd1529
@@ -619,7 +643,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "scsi-0:0:0:0" ,
bd1529
+                                exp_links       => ["scsi-0:0:0:0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="usb", PROGRAM=="/bin/echo -n usb-%b", SYMLINK+="%c"
bd1529
@@ -632,7 +656,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "modem" ,
bd1529
+                                exp_links       => ["modem"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 ATTRS{idProduct}=="007b", SYMLINK+="modem"
bd1529
@@ -644,7 +668,8 @@ EOF
bd1529
                         {
bd1529
                                 devpath         => "/devices/virtual/block/fake!blockdev0",
bd1529
                                 devnode         => "fake/blockdev0",
bd1529
-                                exp_name        => "is/a/fake/blockdev0" ,
bd1529
+                                exp_links       => ["is/a/fake/blockdev0"],
bd1529
+                                not_exp_links       => ["is/not/a/fake/blockdev0", "modem"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", SYMLINK+="is/not/a/%k"
bd1529
@@ -658,7 +683,7 @@ EOF
bd1529
                         {
bd1529
                                 devpath         => "/devices/virtual/block/fake!blockdev0",
bd1529
                                 devnode         => "fake/blockdev0",
bd1529
-                                exp_rem_error   => "yes",
bd1529
+                                not_exp_links       => ["modem"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM0", SYMLINK+="modem"
bd1529
@@ -669,7 +694,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "scsi-0:0:0:0",
bd1529
+                                exp_links       => ["scsi-0:0:0:0"],
bd1529
+                                not_exp_links       => ["no-match", "short-id", "not-scsi"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="usb", KERNELS=="0:0:0:0", SYMLINK+="not-scsi"
bd1529
@@ -684,7 +710,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "scsi-0:0:0:0",
bd1529
+                                exp_links       => ["scsi-0:0:0:0"],
bd1529
+                                not_exp_links   => ["no-match", "before"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNELS=="*:1", SYMLINK+="no-match"
bd1529
@@ -699,7 +726,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "scsi-0:0:0:0",
bd1529
+                                exp_links       => ["scsi-0:0:0:0", "before"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="before"
bd1529
@@ -711,7 +738,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "scsi-0:0:0:0",
bd1529
+                                exp_links       => ["scsi-0:0:0:0", "before"],
bd1529
                         }],
bd1529
                 rules                => <
bd1529
 SUBSYSTEMS=="scsi", KERNELS=="0:0:0:0", SYMLINK+="before"
bd1529
@@ -723,7 +750,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "driver-is-sd",
bd1529
+                                exp_links       => ["driver-is-sd"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", SYMLINK+="driver-is-\$attr{driver}"
bd1529
@@ -734,7 +761,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "driver-is-ahci",
bd1529
+                                exp_links       => ["driver-is-ahci"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="pci", SYMLINK+="driver-is-\$attr{driver}"
bd1529
@@ -745,7 +772,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "ignored",
bd1529
+                                exp_links       => ["ignored"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", ATTRS{whitespace_test}=="WHITE  SPACE", SYMLINK+="ignored"
bd1529
@@ -756,7 +783,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "matched-with-space",
bd1529
+                                exp_links       => ["matched-with-space"],
bd1529
+                                not_exp_links   => ["wrong-to-ignore"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", ATTRS{whitespace_test}=="WHITE  SPACE ", SYMLINK+="wrong-to-ignore"
bd1529
@@ -779,7 +807,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
                                 exp_perms       => "1::0600",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -791,7 +819,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
                                 exp_perms       => ":1:0660",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -803,7 +831,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
                                 exp_perms       => "daemon::0600",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -815,7 +843,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
                                 exp_perms       => ":daemon:0660",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -827,7 +855,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
                                 exp_perms       => "root:audio:0660",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -839,7 +867,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
                                 exp_perms       => "::0777",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -851,7 +879,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
                                 exp_perms       => "1:1:0777",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -950,7 +978,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
                                 exp_majorminor  => "8:0",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -962,7 +990,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/virtual/misc/misc-fake1",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
                                 exp_majorminor  => "4095:1",
bd1529
                         }],
bd1529
                 rules                => <
bd1529
@@ -974,7 +1002,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/virtual/misc/misc-fake89999",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
                                 exp_majorminor  => "4095:89999",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -986,7 +1014,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "symlink2-ttyACM0",
bd1529
+                                exp_links       => ["symlink1-0", "symlink2-ttyACM0", "symlink3-"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[0-9]*", SYMLINK="symlink1-%n symlink2-%k symlink3-%b"
bd1529
@@ -997,8 +1025,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "one",
bd1529
-                                not_exp_name        => " ",
bd1529
+                                exp_links       => ["one", "two"],
bd1529
+                                not_exp_links       => [" "],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[0-9]*", SYMLINK="  one     two        "
bd1529
@@ -1009,8 +1037,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "name-one_two_three-end",
bd1529
-                                not_exp_name    => " ",
bd1529
+                                exp_links       => ["name-one_two_three-end"],
bd1529
+                                not_exp_links   => [" "],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 ENV{WITH_WS}="one two three"
bd1529
@@ -1022,8 +1050,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "name-one_two_three-end",
bd1529
-                                not_exp_name    => " ",
bd1529
+                                exp_links       => ["name-one_two_three-end"],
bd1529
+                                not_exp_links   => [" "],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 ENV{WITH_WS}="   one two three"
bd1529
@@ -1035,8 +1063,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "name-one_two_three-end",
bd1529
-                                not_exp_name    => " ",
bd1529
+                                exp_links       => ["name-one_two_three-end"],
bd1529
+                                not_exp_links   => [" "],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 ENV{WITH_WS}="one two three   "
bd1529
@@ -1048,8 +1076,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "name-one_two_three-end",
bd1529
-                                not_exp_name    => " ",
bd1529
+                                exp_links       => ["name-one_two_three-end"],
bd1529
+                                not_exp_links   => [" "],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 ENV{WITH_WS}="   one two three   "
bd1529
@@ -1061,8 +1089,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "name-one_two_three-end",
bd1529
-                                not_exp_name    => " ",
bd1529
+                                exp_links       => ["name-one_two_three-end"],
bd1529
+                                not_exp_links   => [" "],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 ENV{WITH_WS}="   one  two  three   "
bd1529
@@ -1070,12 +1098,12 @@ SYMLINK="name-\$env{WITH_WS}-end"
bd1529
 EOF
bd1529
         },
bd1529
         {
bd1529
-                desc            => "symlink with space and var with space, part 1",
bd1529
+                desc            => "symlink with space and var with space",
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "first",
bd1529
-                                not_exp_name    => " ",
bd1529
+                                exp_links        => ["first"],
bd1529
+                                not_exp_links    => [" "],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 ENV{WITH_WS}="   one  two  three   "
bd1529
@@ -1087,8 +1115,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "name-one_two_three-end",
bd1529
-                                not_exp_name    => " ",
bd1529
+                                exp_links        => ["name-one_two_three-end"],
bd1529
+                                not_exp_links    => [" "],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 ENV{WITH_WS}="   one  two  three   "
bd1529
@@ -1100,8 +1128,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "another_symlink",
bd1529
-                                not_exp_name    => " ",
bd1529
+                                exp_links        => ["another_symlink"],
bd1529
+                                not_exp_links    => [" "],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 ENV{WITH_WS}="   one  two  three   "
bd1529
@@ -1113,7 +1141,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "modem0",
bd1529
+                                exp_links       => ["modem0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[0-9]*", SYMLINK+="ttyACM%n", SYMLINK="modem%n"
bd1529
@@ -1124,7 +1152,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "second-0" ,
bd1529
+                                exp_links       => ["first-0", "second-0", "third-0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM0", SYMLINK="first-%n second-%n third-%n"
bd1529
@@ -1135,7 +1163,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => ".",
bd1529
+                                exp_links       => ["."],
bd1529
                                 exp_add_error        => "yes",
bd1529
                                 exp_rem_error        => "yes",
bd1529
                         }],
bd1529
@@ -1148,7 +1176,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/virtual/tty/tty0",
bd1529
-                                exp_name        => "link",
bd1529
+                                exp_links       => ["link"],
bd1529
                                 exp_add_error        => "yes",
bd1529
                                 exp_rem_error        => "yes",
bd1529
                         }],
bd1529
@@ -1162,7 +1190,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "symlink0",
bd1529
+                                exp_links       => ["symlink0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[0-9]*", SYMLINK+="ttyACM%n", SYMLINK+="symlink%n"
bd1529
@@ -1173,7 +1201,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "symlink-ttyACM0",
bd1529
+                                exp_links       => ["symlink-ttyACM0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[0-9]*", SYMLINK+="ttyACM%n", SYMLINK+="symlink-%k"
bd1529
@@ -1184,7 +1212,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "major-166:0",
bd1529
+                                exp_links       => ["major-166:0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[0-9]*", SYMLINK+="ttyACM%n", SYMLINK+="major-%M:%m"
bd1529
@@ -1195,7 +1223,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "symlink-0:0:0:0",
bd1529
+                                exp_links       => ["symlink-0:0:0:0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="symlink-%b"
bd1529
@@ -1206,7 +1234,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "test",
bd1529
+                                exp_links       => ["test"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[0-9]*", PROGRAM=="/bin/echo test", SYMLINK+="%c"
bd1529
@@ -1217,7 +1245,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "test",
bd1529
+                                exp_links       => ["test"],
bd1529
+                                not_exp_links   => ["symlink", "this"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[0-9]*", PROGRAM=="/bin/echo symlink test this", SYMLINK+="%c{2}"
bd1529
@@ -1228,7 +1257,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "this",
bd1529
+                                exp_links       => ["test", "this"],
bd1529
+                                not_exp_links   => ["symlink"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[0-9]*", PROGRAM=="/bin/echo symlink test this", SYMLINK+="%c{2+}"
bd1529
@@ -1239,7 +1269,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "test",
bd1529
+                                exp_links       => ["test", "this"],
bd1529
+                                not_exp_links   => ["symlink"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda", PROGRAM=="/bin/echo link test this" SYMLINK+="%c{2+}"
bd1529
@@ -1250,7 +1281,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "166:0",
bd1529
+                                exp_links       => ["166:0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[0-9]*", SYMLINK+="%s{dev}"
bd1529
@@ -1261,7 +1292,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "link1",
bd1529
+                                exp_links       => ["link1", "link2"],
bd1529
+                                not_exp_links   => ["node"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n node link1 link2", RESULT=="node *", SYMLINK+="%c{2} %c{3}"
bd1529
@@ -1272,7 +1304,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda5",
bd1529
-                                exp_name        => "link4",
bd1529
+                                exp_links       => ["link1", "link2", "link3", "link4"],
bd1529
+                                not_exp_links   => ["node"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", PROGRAM=="/bin/echo -n node link1 link2 link3 link4", RESULT=="node *", SYMLINK+="%c{2+}"
bd1529
@@ -1283,7 +1316,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
+                                not_exp_links   => ["should_not_match", "should_not_match2"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="should_not_match", SUBSYSTEM=="vc"
bd1529
@@ -1296,7 +1330,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
+                                not_exp_links   => ["should_not_match"]
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda", SYMLINK+="should_not_match", DRIVERS=="sd-wrong"
bd1529
@@ -1308,7 +1343,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node",
bd1529
+                                exp_links       => ["node"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda", PROGRAM=="/usr/bin/test -b %N" SYMLINK+="node"
bd1529
@@ -1319,7 +1354,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "sda-part-1",
bd1529
+                                exp_links       => ["sda-part-1"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda1", SYMLINK+="%P-part-1"
bd1529
@@ -1330,7 +1365,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "start-/dev-end",
bd1529
+                                exp_links       => ["start-/dev-end"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda1", SYMLINK+="start-%r-end"
bd1529
@@ -1341,7 +1376,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "last",
bd1529
+                                exp_links       => ["last"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda1", SYMLINK+="last", OPTIONS="last_rule"
bd1529
@@ -1353,7 +1388,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "match",
bd1529
+                                exp_links       => ["match", "before"],
bd1529
+                                not_exp_links   => ["matches-but-is-negated"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL!="sda1", SYMLINK+="matches-but-is-negated"
bd1529
@@ -1366,7 +1402,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "not-anything",
bd1529
+                                exp_links       => ["before", "not-anything"],
bd1529
+                                not_exp_links   => ["matches-but-is-negated"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", SUBSYSTEM=="block", KERNEL!="sda1", SYMLINK+="matches-but-is-negated"
bd1529
@@ -1379,7 +1416,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "nonzero-program",
bd1529
+                                exp_links       => ["before", "nonzero-program"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda1", SYMLINK+="before"
bd1529
@@ -1391,7 +1428,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "true",
bd1529
+                                exp_links       => ["true"],
bd1529
+                                not_exp_links   => ["bad", "wrong"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 ENV{ENV_KEY_TEST}="test"
bd1529
@@ -1405,7 +1443,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "true",
bd1529
+                                exp_links       => ["true"],
bd1529
+                                not_exp_links   => ["bad", "wrong", "no"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 ENV{ENV_KEY_TEST}="test"
bd1529
@@ -1420,7 +1459,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "true",
bd1529
+                                exp_links       => ["true", "before"],
bd1529
+                                not_exp_links   => ["no"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}="true"
bd1529
@@ -1434,7 +1474,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "true",
bd1529
+                                exp_links       => ["true", "before"],
bd1529
+                                not_exp_links   => ["no", "bad"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda1", ENV{ASSIGN}="true"
bd1529
@@ -1449,8 +1490,10 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "part",
bd1529
-                        }],
bd1529
+                                exp_links       => ["part"],
bd1529
+                                not_exp_links   => ["disk"],
bd1529
+                        },
bd1529
+                    ],
bd1529
                 rules           => <
bd1529
 SUBSYSTEM=="block", KERNEL=="*[0-9]", ENV{PARTITION}="true", ENV{MAINDEVICE}="false"
bd1529
 SUBSYSTEM=="block", KERNEL=="*[!0-9]", ENV{PARTITION}="false", ENV{MAINDEVICE}="true"
bd1529
@@ -1464,7 +1507,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "sane",
bd1529
+                                exp_links       => ["sane"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e name; (/usr/bin/badprogram)", RESULT=="name_ _/usr/bin/badprogram_", SYMLINK+="sane"
bd1529
@@ -1475,7 +1518,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "uber",
bd1529
+                                exp_links       => ["uber"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e \\xc3\\xbcber" RESULT=="\xc3\xbcber", SYMLINK+="uber"
bd1529
@@ -1486,7 +1529,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "replaced",
bd1529
+                                exp_links       => ["replaced"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", KERNEL=="sda1", PROGRAM=="/bin/echo -e \\xef\\xe8garbage", RESULT=="__garbage", SYMLINK+="replaced"
bd1529
@@ -1497,7 +1540,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "serial-354172020305000",
bd1529
+                                exp_links       => ["serial-354172020305000"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM*", ATTRS{serial}=="?*", SYMLINK+="serial-%s{serial}"
bd1529
@@ -1508,7 +1551,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "ok",
bd1529
+                                exp_links       => ["ok"],
bd1529
+                                not_exp_links   => ["not-1-ok", "not-2-ok", "not-3-ok"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda", ATTRS{nothing}!="", SYMLINK+="not-1-ok"
bd1529
@@ -1522,7 +1566,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "ok",
bd1529
+                                exp_links       => ["ok"],
bd1529
+                                not_exp_links   => ["unknown-not-ok"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 ACTION=="unknown", KERNEL=="sda", SYMLINK+="unknown-not-ok"
bd1529
@@ -1534,7 +1579,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "ok",
bd1529
+                                exp_links       => ["ok"],
bd1529
                                 exp_perms       => "root:tty:0640",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -1547,7 +1592,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "ok",
bd1529
+                                exp_links       => ["ok"],
bd1529
                                 exp_perms       => "root:tty:0640",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -1561,7 +1606,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "node-add-me",
bd1529
+                                exp_links       => ["node-add-me"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda", MODE="0666", SYMLINK+="node-\$env{ACTION}-me"
bd1529
@@ -1572,8 +1617,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "three",
bd1529
-                                not_exp_name    => "two",
bd1529
+                                exp_links       => ["three"],
bd1529
+                                not_exp_links   => ["two", "one"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[0-9]*", SYMLINK+="one"
bd1529
@@ -1586,8 +1631,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "right",
bd1529
-                                not_exp_name    => "wrong",
bd1529
+                                exp_links       => ["right"],
bd1529
+                                not_exp_links   => ["wrong"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM[0-9]*", SYMLINK+="wrong"
bd1529
@@ -1600,7 +1645,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "right",
bd1529
+                                exp_links       => ["right", "before"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="ttyACM*", SYMLINK+="before"
bd1529
@@ -1612,7 +1657,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "right",
bd1529
+                                exp_links       => ["right", "before"],
bd1529
+                                not_exp_links   => ["nomatch"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="dontknow*|*nothing", SYMLINK+="nomatch"
bd1529
@@ -1625,7 +1671,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "right",
bd1529
+                                exp_links       => ["right"],
bd1529
+                                not_exp_links   => ["nomatch", "wrong1", "wrong2"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="dontknow|nothing", SYMLINK+="nomatch"
bd1529
@@ -1639,7 +1686,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0",
bd1529
-                                exp_name        => "right",
bd1529
+                                exp_links       => ["right"],
bd1529
+                                not_exp_links   => ["nomatch", "wrong1", "wrong2", "wrong3"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="dontknow|nothing", SYMLINK+="nomatch"
bd1529
@@ -1654,7 +1702,7 @@ EOF
bd1529
                devices => [
bd1529
                        {
bd1529
                                devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                               exp_name        => "found",
bd1529
+                               exp_links       => ["found"],
bd1529
                                not_exp_name    => "bad",
bd1529
                        }],
bd1529
                 rules           => <
bd1529
@@ -1668,7 +1716,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "found",
bd1529
+                                exp_links       => ["found"],
bd1529
                                 not_exp_name    => "bad",
bd1529
                        }],
bd1529
                 rules           => <
bd1529
@@ -1682,7 +1730,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "found",
bd1529
+                                exp_links       => ["found"],
bd1529
                                 not_exp_name    => "bad",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -1696,7 +1744,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "found",
bd1529
+                                exp_links       => ["found"],
bd1529
                                 not_exp_name    => "bad",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -1710,7 +1758,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "found",
bd1529
+                                exp_links       => ["found"],
bd1529
                                 not_exp_name    => "bad",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -1724,7 +1772,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "found",
bd1529
+                                exp_links       => ["found"],
bd1529
                                 not_exp_name    => "bad",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -1738,7 +1786,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "found",
bd1529
+                                exp_links       => ["found"],
bd1529
                                 not_exp_name    => "bad",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -1752,7 +1800,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "parent",
bd1529
+                                exp_links       => ["parent"],
bd1529
                         }],
bd1529
                 option          => "keep",
bd1529
                 rules           => <
bd1529
@@ -1765,7 +1813,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "parentenv-parent_right",
bd1529
+                                exp_links       => ["parentenv-parent_right"],
bd1529
                         }],
bd1529
                 option          => "clean",
bd1529
                 rules           => <
bd1529
@@ -1777,7 +1825,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "right",
bd1529
+                                exp_links       => ["right"],
bd1529
+                                not_exp_test    => ["wrong", "wrong2"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda1", GOTO="TEST"
bd1529
@@ -1794,7 +1843,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "right",
bd1529
+                                exp_links       => ["right"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda1", GOTO="does-not-exist"
bd1529
@@ -1807,8 +1856,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "right",
bd1529
-                                not_exp_name    => "wrong",
bd1529
+                                exp_links       => ["right", "link"],
bd1529
+                                not_exp_links   => ["wrong"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda1", SYMLINK+="link"
bd1529
@@ -1821,7 +1870,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "yes",
bd1529
+                                exp_links       => ["yes"],
bd1529
+                                not_exp_links   => ["no"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL="sda1", SYMLINK+="no"
bd1529
@@ -1833,7 +1883,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "yes",
bd1529
+                                exp_links       => ["yes"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda", ATTR{test:colon+plus}=="?*", SYMLINK+="yes"
bd1529
@@ -1844,7 +1894,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
bd1529
-                                exp_name        => "yes",
bd1529
+                                exp_links       => ["yes"],
bd1529
+                                not_exp_links   => ["no"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 # 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
bd1529
@@ -1858,7 +1909,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "00:16:41:e2:8d:ff",
bd1529
+                                exp_links       => ["00:16:41:e2:8d:ff"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda", SYMLINK+="\$attr{[net/eth0]address}"
bd1529
@@ -1869,7 +1920,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "there",
bd1529
+                                exp_links       => ["there"],
bd1529
+                                not_exp_links   => ["notthere"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 TEST=="/etc/machine-id", SYMLINK+="there"
bd1529
@@ -1881,7 +1933,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "yes",
bd1529
+                                exp_links       => ["yes"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda", TEST=="[net/eth0]", SYMLINK+="yes"
bd1529
@@ -1892,7 +1944,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "relative",
bd1529
+                                exp_links       => ["relative"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda", TEST=="size", SYMLINK+="relative"
bd1529
@@ -1903,7 +1955,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "found-subdir",
bd1529
+                                exp_links       => ["found-subdir"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda", TEST=="*/nr_requests", SYMLINK+="found-subdir"
bd1529
@@ -1952,7 +2004,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "sda-8741C4G-end",
bd1529
+                                exp_links       => ["sda-8741C4G-end"],
bd1529
                                 exp_perms       => "0:0:0600",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -1966,7 +2018,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0",
bd1529
+                                exp_links       => ["disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 KERNEL=="sda", IMPORT{builtin}="path_id"
bd1529
@@ -1978,8 +2030,8 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "found",
bd1529
-                                not_exp_name    => "bad" ,
bd1529
+                                exp_links       => ["found"],
bd1529
+                                not_exp_links   => ["bad"],
bd1529
                         }],
bd1529
                 rules           => <
bd1529
 SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", TAG+="green"
bd1529
@@ -1992,7 +2044,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "found",
bd1529
+                                exp_links       => ["found"],
bd1529
                         }],
bd1529
                 rules           => $rules_10k_tags . <
bd1529
 TAGS=="test1", TAGS=="test500", TAGS=="test1234", TAGS=="test9999", TAGS=="test10000", SYMLINK+="found"
bd1529
@@ -2003,7 +2055,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "found",
bd1529
+                                exp_links       => ["found"],
bd1529
                                 not_exp_name    => "bad",
bd1529
                         }],
bd1529
                 rules           => $rules_10k_tags_continuation . <
bd1529
@@ -2026,7 +2078,7 @@ EOF
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "found",
bd1529
+                                exp_links       => ["found"],
bd1529
                                 not_exp_name    => "bad",
bd1529
 
bd1529
                         }],
bd1529
@@ -2046,7 +2098,7 @@ TAGS=="aaa", SYMLINK+="bad"
bd1529
                 devices => [
bd1529
                         {
bd1529
                                 devpath         => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda",
bd1529
-                                exp_name        => "found",
bd1529
+                                exp_links       => ["found"],
bd1529
                                 not_exp_name    => "bad",
bd1529
                         }],
bd1529
                 rules           => <
bd1529
@@ -2230,41 +2282,35 @@ sub check_devnode {
bd1529
         return $devnode;
bd1529
 }
bd1529
 
bd1529
-sub check_add {
bd1529
-        my ($device) = @_;
bd1529
-
bd1529
-        if (defined($device->{not_exp_name})) {
bd1529
-                if ((-e "$udev_dev/$device->{not_exp_name}") ||
bd1529
-                    (-l "$udev_dev/$device->{not_exp_name}")) {
bd1529
-                        print "nonexistent: error \'$device->{not_exp_name}\' not expected to be there\n";
bd1529
-                        $error++;
bd1529
-                        sleep(1);
bd1529
-                }
bd1529
-        }
bd1529
+sub get_link_target {
bd1529
+        my ($link) = @_;
bd1529
 
bd1529
-        my $devnode = check_devnode($device);
bd1529
+        my $cwd = getcwd();
bd1529
+        my $dir = "$udev_dev/$link";
bd1529
+        my $tgt = readlink("$udev_dev/$link");
bd1529
+        $dir =~ s!/[^/]*$!!;
bd1529
+        $tgt = abs_path("$dir/$tgt");
bd1529
+        $tgt =~ s!^$cwd/!!;
bd1529
+        return $tgt;
bd1529
+}
bd1529
 
bd1529
-        return if (!defined($device->{exp_name}));
bd1529
+sub check_link_add {
bd1529
+        my ($link, $devnode, $err_expected) = @_;
bd1529
 
bd1529
-        my @st = lstat("$udev_dev/$device->{exp_name}");
bd1529
+        my @st = lstat("$udev_dev/$link");
bd1529
         if (-l _) {
bd1529
-                my $cwd = getcwd();
bd1529
-                my $dir = "$udev_dev/$device->{exp_name}";
bd1529
-                $dir =~ s!/[^/]*$!!;
bd1529
-                my $tgt = readlink("$udev_dev/$device->{exp_name}");
bd1529
-                $tgt = abs_path("$dir/$tgt");
bd1529
-                $tgt =~ s!^$cwd/!!;
bd1529
+                my $tgt = get_link_target($link);
bd1529
 
bd1529
                 if ($tgt ne $devnode) {
bd1529
-                        print "symlink $device->{exp_name}:         error, found -> $tgt\n";
bd1529
+                        print "symlink $link:         error, found -> $tgt\n";
bd1529
                         $error++;
bd1529
                         system("tree", "$udev_dev");
bd1529
                 } else {
bd1529
-                        print "symlink $device->{exp_name}:         ok\n";
bd1529
+                        print "symlink $link:         ok\n";
bd1529
                 }
bd1529
         } else {
bd1529
-                print "symlink $device->{exp_name}:         error";
bd1529
-                if ($device->{exp_add_error}) {
bd1529
+                print "symlink $link:         error";
bd1529
+                if ($err_expected) {
bd1529
                         print " as expected\n";
bd1529
                 } else {
bd1529
                         print "\n";
bd1529
@@ -2276,6 +2322,49 @@ sub check_add {
bd1529
         }
bd1529
 }
bd1529
 
bd1529
+sub check_link_nonexistent {
bd1529
+        my ($link, $devnode, $err_expected) = @_;
bd1529
+
bd1529
+        if ((-e "$udev_dev/$link") || (-l "$udev_dev/$link")) {
bd1529
+                my $tgt = get_link_target($link);
bd1529
+
bd1529
+                if ($tgt ne $devnode) {
bd1529
+                        print "nonexistent: '$link' points to other device (ok)\n";
bd1529
+                } else {
bd1529
+                        print "nonexistent: error \'$link\' should not be there";
bd1529
+                        if ($err_expected) {
bd1529
+                                print " (as expected)\n";
bd1529
+                        } else {
bd1529
+                                print "\n";
bd1529
+                                system("tree", "$udev_dev");
bd1529
+                                print "\n";
bd1529
+                                $error++;
bd1529
+                                sleep(1);
bd1529
+                        }
bd1529
+                }
bd1529
+        } else {
bd1529
+                print "nonexistent $link:         ok\n";
bd1529
+        }
bd1529
+}
bd1529
+
bd1529
+sub check_add {
bd1529
+        my ($device) = @_;
bd1529
+        my $devnode = check_devnode($device);
bd1529
+
bd1529
+        if (defined($device->{exp_links})) {
bd1529
+                foreach my $link (@{$device->{exp_links}}) {
bd1529
+                        check_link_add($link, $devnode,
bd1529
+                                       $device->{exp_add_error});
bd1529
+                }
bd1529
+        }
bd1529
+        if (defined $device->{not_exp_links}) {
bd1529
+                foreach my $link (@{$device->{not_exp_links}}) {
bd1529
+                        check_link_nonexistent($link, $devnode,
bd1529
+                                               $device->{exp_nodev_error});
bd1529
+                }
bd1529
+        }
bd1529
+}
bd1529
+
bd1529
 sub check_remove_devnode {
bd1529
         my ($device) = @_;
bd1529
         my $devnode = get_devnode($device);
bd1529
@@ -2292,17 +2381,13 @@ sub check_remove_devnode {
bd1529
         }
bd1529
 }
bd1529
 
bd1529
-sub check_remove {
bd1529
-        my ($device) = @_;
bd1529
+sub check_link_remove {
bd1529
+        my ($link, $err_expected) = @_;
bd1529
 
bd1529
-        check_remove_devnode($device);
bd1529
-
bd1529
-        return if (!defined($device->{exp_name}));
bd1529
-
bd1529
-        if ((-e "$udev_dev/$device->{exp_name}") ||
bd1529
-            (-l "$udev_dev/$device->{exp_name}")) {
bd1529
-                print "remove  $device->{exp_name}:      error";
bd1529
-                if ($device->{exp_rem_error}) {
bd1529
+        if ((-e "$udev_dev/$link") ||
bd1529
+            (-l "$udev_dev/$link")) {
bd1529
+                print "remove  $link:      error";
bd1529
+                if ($err_expected) {
bd1529
                         print " as expected\n";
bd1529
                 } else {
bd1529
                         print "\n";
bd1529
@@ -2312,7 +2397,19 @@ sub check_remove {
bd1529
                         sleep(1);
bd1529
                 }
bd1529
         } else {
bd1529
-                print "remove  $device->{exp_name}:      ok\n";
bd1529
+                print "remove  $link:      ok\n";
bd1529
+        }
bd1529
+}
bd1529
+
bd1529
+sub check_remove {
bd1529
+        my ($device) = @_;
bd1529
+
bd1529
+        check_remove_devnode($device);
bd1529
+
bd1529
+        return if (!defined($device->{exp_links}));
bd1529
+
bd1529
+        foreach my $link (@{$device->{exp_links}}) {
bd1529
+                check_link_remove($link, $device->{exp_rem_error});
bd1529
         }
bd1529
 }
bd1529