From 1c2ad7a66c2e8945cc26c9376b264a241da354fb Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 15 Sep 2021 13:30:16 +0900 Subject: [PATCH] udev: replace sd_device_get_sysattr_value() with device_get_sysattr_value_maybe_from_netlink() --- src/udev/udev-event.c | 5 +++-- src/udev/udev-rules.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index 11531236ce3..145204b226c 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -30,6 +30,7 @@ #include "strxcpyx.h" #include "udev-builtin.h" #include "udev-event.h" +#include "udev-netlink.h" #include "udev-node.h" #include "udev-util.h" #include "udev-watch.h" @@ -351,11 +352,11 @@ static ssize_t udev_event_subst_format( /* try to read the attribute the device */ if (!val) - (void) sd_device_get_sysattr_value(dev, attr, &val); + (void) device_get_sysattr_value_maybe_from_netlink(dev, &event->rtnl, attr, &val); /* try to read the attribute of the parent device, other matches have selected */ if (!val && event->dev_parent && event->dev_parent != dev) - (void) sd_device_get_sysattr_value(event->dev_parent, attr, &val); + (void) device_get_sysattr_value_maybe_from_netlink(event->dev_parent, &event->rtnl, attr, &val); if (!val) goto null_terminate; diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 3759ac84007..693c743c574 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -29,6 +29,7 @@ #include "syslog-util.h" #include "udev-builtin.h" #include "udev-event.h" +#include "udev-netlink.h" #include "udev-rules.h" #include "udev-util.h" #include "user-util.h" @@ -1396,7 +1397,7 @@ static bool token_match_attr(UdevRuleToken *token, sd_device *dev, UdevEvent *ev name = nbuf; _fallthrough_; case SUBST_TYPE_PLAIN: - if (sd_device_get_sysattr_value(dev, name, &value) < 0) + if (device_get_sysattr_value_maybe_from_netlink(dev, &event->rtnl, name, &value) < 0) return false; break; case SUBST_TYPE_SUBSYS: -- 2.47.3