ryantimwilson / rpms / systemd

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