mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 17:51:22 +03:00
udev-rules: make match_attr() take sd_device instead of udev_device
This commit is contained in:
parent
480ecb7d28
commit
5ba7e79885
@ -1673,11 +1673,9 @@ static int match_key(struct udev_rules *rules, struct token *token, const char *
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct udev_event *event, struct token *cur) {
|
||||
const char *name;
|
||||
char nbuf[UTIL_NAME_SIZE];
|
||||
const char *value;
|
||||
char vbuf[UTIL_NAME_SIZE];
|
||||
static int match_attr(struct udev_rules *rules, sd_device *dev, struct udev_event *event, struct token *cur) {
|
||||
char nbuf[UTIL_NAME_SIZE], vbuf[UTIL_NAME_SIZE];
|
||||
const char *name, *value;
|
||||
size_t len;
|
||||
|
||||
name = rules_str(rules, cur->key.attr_off);
|
||||
@ -1687,8 +1685,7 @@ static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct
|
||||
name = nbuf;
|
||||
_fallthrough_;
|
||||
case SB_NONE:
|
||||
value = udev_device_get_sysattr_value(dev, name);
|
||||
if (value == NULL)
|
||||
if (sd_device_get_sysattr_value(dev, name, &value) < 0)
|
||||
return -1;
|
||||
break;
|
||||
case SB_SUBSYS:
|
||||
@ -1831,7 +1828,7 @@ int udev_rules_apply_to_event(
|
||||
goto nomatch;
|
||||
break;
|
||||
case TK_M_ATTR:
|
||||
if (match_attr(rules, event->dev, event, cur) != 0)
|
||||
if (match_attr(rules, event->dev->device, event, cur) != 0)
|
||||
goto nomatch;
|
||||
break;
|
||||
case TK_M_SYSCTL: {
|
||||
@ -1885,7 +1882,7 @@ int udev_rules_apply_to_event(
|
||||
goto try_parent;
|
||||
break;
|
||||
case TK_M_ATTRS:
|
||||
if (match_attr(rules, event->dev_parent, event, key) != 0)
|
||||
if (match_attr(rules, event->dev_parent->device, event, key) != 0)
|
||||
goto try_parent;
|
||||
break;
|
||||
case TK_M_TAGS: {
|
||||
|
Loading…
Reference in New Issue
Block a user