Skip to contentSkip to conversation

"symlink only" test

PATCH In review Kay Sievers 2 participants 2 messages Mar 11, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 "symlink only" test

Here is a test for the "symlink only" rule.

Any reason to do the apply_format() inside the loop? I've changed it.

thanks,
Kay

===== namedev.c 1.129 vs edited =====

namedev.c +5 -10
@@ -815,16 +815,11 @@
 			}
 
 			if (dev->symlink[0] != '\0') {
-				char temp[NAME_MAX];
-
 				info("configured rule in '%s' at line %i applied, added symlink '%s'",
 				     dev->config_file, dev->config_line, dev->symlink);
-				/* do not clobber dev */
-				strfieldcpy(temp, dev->symlink);
-				apply_format(udev, temp, sizeof(temp),
-					     class_dev, sysfs_device);
-				strfieldcat(udev->symlink, temp);
-				strfieldcat(udev->symlink, " ");
+				if (udev->symlink[0] != '\0')
+					strfieldcat(udev->symlink, " ");
+				strfieldcat(udev->symlink, dev->symlink);
 			}
 
 			if (dev->name[0] != '\0') {
@@ -841,8 +836,8 @@
 	goto done;
 
 found:
-	apply_format(udev, udev->name, sizeof(udev->name),
-		     class_dev, sysfs_device);
+	apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device);
+	apply_format(udev, udev->symlink, sizeof(udev->symlink), class_dev, sysfs_device);
 	udev->partitions = dev->partitions;
 
 done:

===== test/udev-test.pl 1.44 vs edited =====

test/udev-test.pl +11 -0
@@ -513,6 +513,17 @@
 BUS="scsi", SYSFS{whitespace_test}="WHITE  SPACE   ", NAME="matched-with-space"
 EOF
 	},
+	{
+		desc     => "SYMLINK only rule",
+		subsys   => "block",
+		devpath  => "block/sda",
+		expected => "symlink-only2",
+		conf     => <<EOF
+BUS="scsi", KERNEL="sda", SYMLINK="symlink-only1"
+BUS="scsi", KERNEL="sda", SYMLINK="symlink-only2"
+BUS="scsi", KERNEL="sda", NAME="link", SYMLINK="symlink0"
+EOF
+	},
 );
 
 # set env
#1 lore raw
Quoted 4 lines · Kay Sievers

Here is a test for the "symlink only" rule.

Any reason to do the apply_format() inside the loop? I've changed it.

Nice cleanup. Applied, thanks.

greg k-h

-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel