diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-03-09 02:45:15 +0100 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-03-11 19:49:53 +0100 |
commit | a707c65b70a00cc0c81072f2669358ca3980a3af (patch) | |
tree | 1fe76b3239592dc0353c41dda6dd8a39cafe30c8 | |
parent | sd-device: store parsed ACTION= and SEQNUM= udev properties (diff) | |
download | systemd-a707c65b70a00cc0c81072f2669358ca3980a3af.tar.xz systemd-a707c65b70a00cc0c81072f2669358ca3980a3af.zip |
util: introduce device_for_action()
It will be used in later commits.
-rw-r--r-- | src/shared/udev-util.c | 11 | ||||
-rw-r--r-- | src/shared/udev-util.h | 2 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/shared/udev-util.c b/src/shared/udev-util.c index 6847d715f6..19d823c11d 100644 --- a/src/shared/udev-util.c +++ b/src/shared/udev-util.c @@ -181,3 +181,14 @@ int device_is_renaming(sd_device *dev) { return r >= 0; } + +bool device_for_action(sd_device *dev, DeviceAction action) { + DeviceAction a; + + assert(dev); + + if (device_get_action(dev, &a) < 0) + return false; + + return a == action; +} diff --git a/src/shared/udev-util.h b/src/shared/udev-util.h index c45d6a11fd..3c45447515 100644 --- a/src/shared/udev-util.h +++ b/src/shared/udev-util.h @@ -3,6 +3,7 @@ #include "sd-device.h" +#include "device-private.h" #include "time-util.h" typedef enum ResolveNameTiming { @@ -28,3 +29,4 @@ static inline int udev_parse_config(void) { int device_wait_for_initialization(sd_device *device, const char *subsystem, sd_device **ret); int device_is_renaming(sd_device *dev); +bool device_for_action(sd_device *dev, DeviceAction action); |