udev: replace sd_device_get_sysattr_value() with device_get_sysattr_value_maybe_from_netlink()

This commit is contained in:
Yu Watanabe
2021-10-06 16:39:52 +09:00
parent e44b0fbce7
commit 1c2ad7a66c
2 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -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;
+2 -1
View File
@@ -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: