summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2018-10-29 15:39:53 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-11-07 13:35:03 +0900
commitdbea7f24d2311f47947fbe7adea68fb65cca17a5 (patch)
tree8f932cfac597ac47a0303f193896bd731e126f7f
parent1017d66bf511427f19b15fac927be7afae931126 (diff)
downloadsystemd-dbea7f24d2311f47947fbe7adea68fb65cca17a5.tar.gz
systemd-dbea7f24d2311f47947fbe7adea68fb65cca17a5.tar.bz2
systemd-dbea7f24d2311f47947fbe7adea68fb65cca17a5.zip
udev-rules: replace two udev_list_entry_foreach() by corresponding FOREACH_DEVICE_*() macros
-rw-r--r--src/udev/udev-rules.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 49ee14c650..a5ead0930b 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -1767,18 +1767,15 @@ int udev_rules_apply_to_event(
goto nomatch;
break;
case TK_M_DEVLINK: {
- struct udev_list_entry *list_entry;
+ const char *devlink;
bool match = false;
- udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(event->dev)) {
- const char *devlink;
-
- devlink = udev_list_entry_get_name(list_entry) + STRLEN("/dev/");
- if (match_key(rules, cur, devlink) == 0) {
+ FOREACH_DEVICE_DEVLINK(event->dev->device, devlink)
+ if (match_key(rules, cur, devlink + STRLEN("/dev/")) == 0) {
match = true;
break;
}
- }
+
if (!match)
goto nomatch;
break;
@@ -1802,15 +1799,15 @@ int udev_rules_apply_to_event(
break;
}
case TK_M_TAG: {
- struct udev_list_entry *list_entry;
bool match = false;
+ const char *tag;
- udev_list_entry_foreach(list_entry, udev_device_get_tags_list_entry(event->dev)) {
- if (streq(rules_str(rules, cur->key.value_off), udev_list_entry_get_name(list_entry))) {
+ FOREACH_DEVICE_TAG(event->dev->device, tag)
+ if (streq(rules_str(rules, cur->key.value_off), tag)) {
match = true;
break;
}
- }
+
if ((!match && (cur->key.op != OP_NOMATCH)) ||
(match && (cur->key.op == OP_NOMATCH)))
goto nomatch;