diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-03-09 02:08:03 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-03-11 19:49:53 +0100 |
commit | d4d690facd063321fc22dc25f2e57e08f10b2ad5 (patch) | |
tree | 85c82c905a5169252d35b06599b8411454a2b746 /src/udev/udev-rules.c | |
parent | util: introduce device_for_action() (diff) | |
download | systemd-d4d690facd063321fc22dc25f2e57e08f10b2ad5.tar.xz systemd-d4d690facd063321fc22dc25f2e57e08f10b2ad5.zip |
udevd: use device_get_action() and device_get_seqnum()
Diffstat (limited to 'src/udev/udev-rules.c')
-rw-r--r-- | src/udev/udev-rules.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index d4aeca2fd3..b27b212a99 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -1767,18 +1767,19 @@ int udev_rules_apply_to_event( sd_device *dev = event->dev; enum escape_type esc = ESCAPE_UNSET; struct token *cur, *rule; - const char *action, *val; + DeviceAction action; + const char *val; bool can_set_name; int r; if (!rules->tokens) return 0; - r = sd_device_get_property_value(dev, "ACTION", &action); + r = device_get_action(dev, &action); if (r < 0) return r; - can_set_name = (!streq(action, "remove") && + can_set_name = (action != DEVICE_ACTION_REMOVE && (sd_device_get_devnum(dev, NULL) >= 0 || sd_device_get_ifindex(dev, NULL) >= 0)); @@ -1797,7 +1798,7 @@ int udev_rules_apply_to_event( esc = ESCAPE_UNSET; break; case TK_M_ACTION: - if (!match_key(rules, cur, action)) + if (!match_key(rules, cur, device_action_to_string(action))) goto nomatch; break; case TK_M_DEVPATH: |