dcavalca / rpms / systemd

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