chiark / gitweb /
[PATCH] add test and documentation for new %D devfs format modifier
authorgreg@kroah.com <greg@kroah.com>
Tue, 25 Nov 2003 07:45:38 +0000 (23:45 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:13:04 +0000 (21:13 -0700)
test/udev-test.pl
udev.8
udev.config

index 2835489238d2462a546326488f52d94230581282..ee2f4e691eca25b20b8d897f18b6c838b70f2408 100644 (file)
@@ -25,7 +25,7 @@ my $PWD = $ENV{PWD};
 my $sysfs     = "sys/";
 my $udev_bin  = "../udev";
 my $udev_root = "udev-root/"; # !!! directory will be removed !!!
-my $udev_db   = "udev.tdb";
+my $udev_db   = ".udev.tdb";
 my $perm      = "udev.permissions";
 my $conf_tmp  = "udev-test.config";
 
@@ -106,6 +106,24 @@ EOF
                expected => "test-0:0:0:0" ,
                conf     => <<EOF
 CALLOUT, BUS="scsi", PROGRAM="/bin/echo -n test-%b", ID="test-*", NAME="%c"
+EOF
+       },
+       {
+               desc     => "devfs disk naming substitution",
+               subsys   => "block",
+               devpath  => "block/sda",
+               expected => "lun0/disk" ,
+               conf     => <<EOF
+LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="lun0/%D"
+EOF
+       },
+       {
+               desc     => "devfs disk naming substitution",
+               subsys   => "block",
+               devpath  => "block/sda/sda2",
+               expected => "lun0/part2" ,
+               conf     => <<EOF
+LABEL, BUS="scsi", vendor="IBM-ESXS", NAME="lun0/%D"
 EOF
        },
 );
@@ -173,7 +191,7 @@ foreach my $config (@tests) {
 print "$error errors occured\n\n";
 
 # cleanup
+unlink($udev_db);
 system("rm -rf $udev_root");
 unlink($conf_tmp);
-unlink($udev_db);
 
diff --git a/udev.8 b/udev.8
index 1500b3b424d79a5e3f350043a269b154410bda26..22c4586daabe004998accd76f4ea1fce54ec140c 100644 (file)
--- a/udev.8
+++ b/udev.8
@@ -106,6 +106,11 @@ the bus id for the device
 .B %c
 the CALLOUT program returned string
 (this does not work within the PROGRAM field for the obvious reason.)
+.TP
+.B %D
+Use the devfs style disk name for this device.
+For partitions, this will result in 'part%n'
+If this is not a partition, it will result in 'disk'
 .RE
 .P
 A sample \fIudev.conf\fP might look like this:
index 3eb688a3a0b5fcc4ae2a730452a36a6ca5ace7e9..7e67d3a3b47ba3fd178af5c6ffc81ac33c50f6fa 100644 (file)
@@ -7,6 +7,9 @@
 # %b - the bus id for the device
 # %c - the return value for the CALLOUT program (note, this doesn't work within
 #      the PROGRAM field for the obvious reason.)
+# %D - use the devfs style disk name for this device.
+#      For partitions, this will result in 'part%n'
+#      If this is not a partition, it will result in 'disk'
 #
 
 # Looking for scsi bus id 42:0:0:1