mirror of
https://github.com/systemd/systemd.git
synced 2025-01-27 18:04:05 +03:00
[PATCH] "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.
This commit is contained in:
parent
558f80ba64
commit
0a5417a0eb
15
namedev.c
15
namedev.c
@ -815,16 +815,11 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (dev->symlink[0] != '\0') {
|
if (dev->symlink[0] != '\0') {
|
||||||
char temp[NAME_MAX];
|
|
||||||
|
|
||||||
info("configured rule in '%s' at line %i applied, added symlink '%s'",
|
info("configured rule in '%s' at line %i applied, added symlink '%s'",
|
||||||
dev->config_file, dev->config_line, dev->symlink);
|
dev->config_file, dev->config_line, dev->symlink);
|
||||||
/* do not clobber dev */
|
if (udev->symlink[0] != '\0')
|
||||||
strfieldcpy(temp, dev->symlink);
|
strfieldcat(udev->symlink, " ");
|
||||||
apply_format(udev, temp, sizeof(temp),
|
strfieldcat(udev->symlink, dev->symlink);
|
||||||
class_dev, sysfs_device);
|
|
||||||
strfieldcat(udev->symlink, temp);
|
|
||||||
strfieldcat(udev->symlink, " ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dev->name[0] != '\0') {
|
if (dev->name[0] != '\0') {
|
||||||
@ -841,8 +836,8 @@ int namedev_name_device(struct sysfs_class_device *class_dev, struct udevice *ud
|
|||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
found:
|
found:
|
||||||
apply_format(udev, udev->name, sizeof(udev->name),
|
apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device);
|
||||||
class_dev, sysfs_device);
|
apply_format(udev, udev->symlink, sizeof(udev->symlink), class_dev, sysfs_device);
|
||||||
udev->partitions = dev->partitions;
|
udev->partitions = dev->partitions;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
@ -511,6 +511,17 @@ EOF
|
|||||||
conf => <<EOF
|
conf => <<EOF
|
||||||
BUS="scsi", SYSFS{whitespace_test}="WHITE SPACE ", NAME="wrong-to-ignore"
|
BUS="scsi", SYSFS{whitespace_test}="WHITE SPACE ", NAME="wrong-to-ignore"
|
||||||
BUS="scsi", SYSFS{whitespace_test}="WHITE SPACE ", NAME="matched-with-space"
|
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
|
EOF
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user