mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 08:56:15 +09:00
Merge pull request #23291 from yuwata/udev-rule-fix-regression
udev: fix parent token handling
This commit is contained in:
@@ -2425,11 +2425,15 @@ static int udev_rule_apply_parent_token_to_event(
|
||||
UdevRuleToken *head;
|
||||
int r;
|
||||
|
||||
line = rules->current_file->current_line;
|
||||
head = rules->current_file->current_line->current_token;
|
||||
event->dev_parent = event->dev;
|
||||
assert(rules);
|
||||
assert(rules->current_file);
|
||||
assert(event);
|
||||
|
||||
line = ASSERT_PTR(rules->current_file->current_line);
|
||||
head = ASSERT_PTR(rules->current_file->current_line->current_token);
|
||||
event->dev_parent = ASSERT_PTR(event->dev);
|
||||
|
||||
for (;;) {
|
||||
line->current_token = NULL;
|
||||
LIST_FOREACH(tokens, token, head) {
|
||||
if (!token_is_for_parents(token))
|
||||
return true; /* All parent tokens match. */
|
||||
@@ -2441,8 +2445,8 @@ static int udev_rule_apply_parent_token_to_event(
|
||||
if (r == 0)
|
||||
break;
|
||||
}
|
||||
if (!line->current_token)
|
||||
/* All parent tokens match. But no assign tokens in the line. Hmm... */
|
||||
if (r > 0)
|
||||
/* All parent tokens match, and no more token (except for GOTO) in the line. */
|
||||
return true;
|
||||
|
||||
if (sd_device_get_parent(event->dev_parent, &event->dev_parent) < 0) {
|
||||
|
||||
@@ -176,7 +176,7 @@ EOF
|
||||
{
|
||||
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
|
||||
exp_links => ["boot_disk1", "boot_disk1-4", "boot_disk1-5"],
|
||||
not_exp_links => ["boot_disk1-1", "boot_disk1-2", "boot_disk1-3"]
|
||||
not_exp_links => ["boot_disk1-1", "boot_disk1-2", "boot_disk1-3", "boot_disk1-6", "boot_disk1-7"]
|
||||
}],
|
||||
rules => <<EOF
|
||||
SUBSYSTEMS=="scsi", ATTRS{vendor}=="?ATA", SYMLINK+="boot_disk%n-1"
|
||||
@@ -185,6 +185,12 @@ SUBSYSTEMS=="scsi", ATTRS{vendor}=="A??", SYMLINK+="boot_disk%n"
|
||||
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATAS", SYMLINK+="boot_disk%n-3"
|
||||
SUBSYSTEMS=="scsi", ATTRS{vendor}=="AT?", SYMLINK+="boot_disk%n-4"
|
||||
SUBSYSTEMS=="scsi", ATTRS{vendor}=="??A", SYMLINK+="boot_disk%n-5"
|
||||
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", GOTO="skip-6"
|
||||
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n-6"
|
||||
LABEL="skip-6"
|
||||
SUBSYSTEMS=="scsi", GOTO="skip-7"
|
||||
SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", SYMLINK+="boot_disk%n-7"
|
||||
LABEL="skip-7"
|
||||
EOF
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user